code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
getFunctionNames = function(str) {
if (typeof str !== 'string') {
return [];
}
// There are still a bunch of corner cases here where we aren't going to be able to handle
// but we shouldn't break the user's app and we should handle most common cases.
// example of corner cases: we can't check for properti... | Load necessary functions from /lib into variables. | getFunctionNames | javascript | angular/batarang | dist/hint.js | https://github.com/angular/batarang/blob/master/dist/hint.js | MIT |
function ngEventDirectivesDecorator(ngEventAttrName) {
return function ($delegate, $parse) {
var originalCompileFn = $delegate[0].compile;
$delegate[0].compile = function(element, attrs, transclude) {
var linkFn = originalCompileFn.apply(this, arguments);
return function ngEventHandler(scope, el... | Decorate $provide in order to examine ng-event directives
and hint about their effective use. | ngEventDirectivesDecorator | javascript | angular/batarang | dist/hint.js | https://github.com/angular/batarang/blob/master/dist/hint.js | MIT |
SimpleUndo = function(options) {
var settings = options ? options : {};
var defaultOptions = {
provider: function() {
throw new Error("No provider!");
},
maxLength: 30,
onUpdate: function() {}
};
this.provider = (typeof settings.provider != 'undefined') ? settings.provider : defaultOptions.provider;
... | SimpleUndo is a very basic javascript undo/redo stack for managing histories of basically anything.
options are: {
* `provider` : required. a function to call on `save`, which should provide the current state of the historized object through the given "done" callback
* `maxLength` : the maximum number of items in hi... | SimpleUndo | javascript | manuhabitela/drawingboard.js | dist/drawingboard.js | https://github.com/manuhabitela/drawingboard.js/blob/master/dist/drawingboard.js | MIT |
function truncate (stack, limit) {
while (stack.length > limit) {
stack.shift();
}
} | SimpleUndo is a very basic javascript undo/redo stack for managing histories of basically anything.
options are: {
* `provider` : required. a function to call on `save`, which should provide the current state of the historized object through the given "done" callback
* `maxLength` : the maximum number of items in hi... | truncate | javascript | manuhabitela/drawingboard.js | dist/drawingboard.js | https://github.com/manuhabitela/drawingboard.js/blob/master/dist/drawingboard.js | MIT |
sum = function(values, multiplier) { //make the sum of all array values
multiplier = multiplier || 1;
var res = values[0];
for (var i = 1; i < values.length; i++) {
res = res + (values[i]*multiplier);
}
return res;
} | Canvas reset/resize methods: put back the canvas to its default values
depending on options, can set color, size, background back to default values
and store the reseted canvas in webstorage and history queue
resize values depend on the `enlargeYourContainer` option | sum | javascript | manuhabitela/drawingboard.js | dist/drawingboard.js | https://github.com/manuhabitela/drawingboard.js/blob/master/dist/drawingboard.js | MIT |
setStrokeStyle = function(mode) {
if (mode !== "eraser")
that.strokeStyle = that.color;
that.ev.unbind('board:mode', setStrokeStyle);
} | set and get current drawing mode
possible modes are "pencil" (draw normally), "eraser" (draw transparent, like, erase, you know), "filler" (paint can) | setStrokeStyle | javascript | manuhabitela/drawingboard.js | dist/drawingboard.js | https://github.com/manuhabitela/drawingboard.js/blob/master/dist/drawingboard.js | MIT |
function updatePixelColor(pixel) {
img.data[pixel[INDEX]] = r;
img.data[pixel[INDEX] + 1] = g;
img.data[pixel[INDEX] + 2] = b;
} | Fills an area with the current stroke color. | updatePixelColor | javascript | manuhabitela/drawingboard.js | dist/drawingboard.js | https://github.com/manuhabitela/drawingboard.js/blob/master/dist/drawingboard.js | MIT |
function hue2rgb(p, q, t) {
if(t < 0) t += 1;
if(t > 1) t -= 1;
if(t < 1/6) return p + (q - p) * 6 * t;
if(t < 1/2) return q;
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
return p;
} | Drawing handling, with mouse or touch | hue2rgb | javascript | manuhabitela/drawingboard.js | dist/drawingboard.js | https://github.com/manuhabitela/drawingboard.js/blob/master/dist/drawingboard.js | MIT |
SimpleUndo = function(options) {
var settings = options ? options : {};
var defaultOptions = {
provider: function() {
throw new Error("No provider!");
},
maxLength: 30,
onUpdate: function() {}
};
this.provider = (typeof settings.provider != 'undefined') ? settings.provider : defaultOptions.provider;
... | SimpleUndo is a very basic javascript undo/redo stack for managing histories of basically anything.
options are: {
* `provider` : required. a function to call on `save`, which should provide the current state of the historized object through the given "done" callback
* `maxLength` : the maximum number of items in hi... | SimpleUndo | javascript | manuhabitela/drawingboard.js | dist/drawingboard.nocontrol.js | https://github.com/manuhabitela/drawingboard.js/blob/master/dist/drawingboard.nocontrol.js | MIT |
function truncate (stack, limit) {
while (stack.length > limit) {
stack.shift();
}
} | SimpleUndo is a very basic javascript undo/redo stack for managing histories of basically anything.
options are: {
* `provider` : required. a function to call on `save`, which should provide the current state of the historized object through the given "done" callback
* `maxLength` : the maximum number of items in hi... | truncate | javascript | manuhabitela/drawingboard.js | dist/drawingboard.nocontrol.js | https://github.com/manuhabitela/drawingboard.js/blob/master/dist/drawingboard.nocontrol.js | MIT |
sum = function(values, multiplier) { //make the sum of all array values
multiplier = multiplier || 1;
var res = values[0];
for (var i = 1; i < values.length; i++) {
res = res + (values[i]*multiplier);
}
return res;
} | Canvas reset/resize methods: put back the canvas to its default values
depending on options, can set color, size, background back to default values
and store the reseted canvas in webstorage and history queue
resize values depend on the `enlargeYourContainer` option | sum | javascript | manuhabitela/drawingboard.js | dist/drawingboard.nocontrol.js | https://github.com/manuhabitela/drawingboard.js/blob/master/dist/drawingboard.nocontrol.js | MIT |
setStrokeStyle = function(mode) {
if (mode !== "eraser")
that.strokeStyle = that.color;
that.ev.unbind('board:mode', setStrokeStyle);
} | set and get current drawing mode
possible modes are "pencil" (draw normally), "eraser" (draw transparent, like, erase, you know), "filler" (paint can) | setStrokeStyle | javascript | manuhabitela/drawingboard.js | dist/drawingboard.nocontrol.js | https://github.com/manuhabitela/drawingboard.js/blob/master/dist/drawingboard.nocontrol.js | MIT |
function updatePixelColor(pixel) {
img.data[pixel[INDEX]] = r;
img.data[pixel[INDEX] + 1] = g;
img.data[pixel[INDEX] + 2] = b;
} | Fills an area with the current stroke color. | updatePixelColor | javascript | manuhabitela/drawingboard.js | dist/drawingboard.nocontrol.js | https://github.com/manuhabitela/drawingboard.js/blob/master/dist/drawingboard.nocontrol.js | MIT |
sum = function(values, multiplier) { //make the sum of all array values
multiplier = multiplier || 1;
var res = values[0];
for (var i = 1; i < values.length; i++) {
res = res + (values[i]*multiplier);
}
return res;
} | Canvas reset/resize methods: put back the canvas to its default values
depending on options, can set color, size, background back to default values
and store the reseted canvas in webstorage and history queue
resize values depend on the `enlargeYourContainer` option | sum | javascript | manuhabitela/drawingboard.js | js/board.js | https://github.com/manuhabitela/drawingboard.js/blob/master/js/board.js | MIT |
setStrokeStyle = function(mode) {
if (mode !== "eraser")
that.strokeStyle = that.color;
that.ev.unbind('board:mode', setStrokeStyle);
} | set and get current drawing mode
possible modes are "pencil" (draw normally), "eraser" (draw transparent, like, erase, you know), "filler" (paint can) | setStrokeStyle | javascript | manuhabitela/drawingboard.js | js/board.js | https://github.com/manuhabitela/drawingboard.js/blob/master/js/board.js | MIT |
function updatePixelColor(pixel) {
img.data[pixel[INDEX]] = r;
img.data[pixel[INDEX] + 1] = g;
img.data[pixel[INDEX] + 2] = b;
} | Fills an area with the current stroke color. | updatePixelColor | javascript | manuhabitela/drawingboard.js | js/board.js | https://github.com/manuhabitela/drawingboard.js/blob/master/js/board.js | MIT |
render = (messages) => {
ReactDOM.render(
<Provider store={store}>
<LanguageProvider messages={messages}>
<Router
history={history}
routes={rootRoute}
render={
// Scroll to top when going to a new page, imitating default browser
// behaviour
... | app.js
This is the entry file for the application, only setup and boilerplate
code. | render | javascript | edp963/wormhole | rider/rider-webapp/app/app.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/app/app.js | Apache-2.0 |
render = (messages) => {
ReactDOM.render(
<Provider store={store}>
<LanguageProvider messages={messages}>
<Router
history={history}
routes={rootRoute}
render={
// Scroll to top when going to a new page, imitating default browser
// behaviour
... | app.js
This is the entry file for the application, only setup and boilerplate
code. | render | javascript | edp963/wormhole | rider/rider-webapp/app/app.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/app/app.js | Apache-2.0 |
formatTranslationMessages = (locale, messages) => {
const defaultFormattedMessages = locale !== DEFAULT_LOCALE
? formatTranslationMessages(DEFAULT_LOCALE, enTranslationMessages)
: {}
const formattedMessages = {}
const messageKeys = Object.keys(messages)
for (const messageKey of messageKeys) {
if (lo... | This will setup the i18n language files and locale data for your app. | formatTranslationMessages | javascript | edp963/wormhole | rider/rider-webapp/app/i18n.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/app/i18n.js | Apache-2.0 |
formatTranslationMessages = (locale, messages) => {
const defaultFormattedMessages = locale !== DEFAULT_LOCALE
? formatTranslationMessages(DEFAULT_LOCALE, enTranslationMessages)
: {}
const formattedMessages = {}
const messageKeys = Object.keys(messages)
for (const messageKey of messageKeys) {
if (lo... | This will setup the i18n language files and locale data for your app. | formatTranslationMessages | javascript | edp963/wormhole | rider/rider-webapp/app/i18n.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/app/i18n.js | Apache-2.0 |
function routeReducer (state = routeInitialState, action) {
switch (action.type) {
/* istanbul ignore next */
case LOCATION_CHANGE:
return state.merge({
locationBeforeTransitions: action.payload
})
default:
return state
}
} | Merge route into the global application state | routeReducer | javascript | edp963/wormhole | rider/rider-webapp/app/reducers.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/app/reducers.js | Apache-2.0 |
function createReducer (asyncReducers) {
return (state, action) => {
if (action.type === 'LOG_OUT') {
state = undefined
}
return combineReducers({
route: routeReducer,
global: appReducer,
language: languageProviderReducer,
login: appReducer,
project: projectReducer,
... | Creates the main reducer with the asynchronously loaded ones | createReducer | javascript | edp963/wormhole | rider/rider-webapp/app/reducers.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/app/reducers.js | Apache-2.0 |
function configureStore (initialState = {}, history) {
// Create the store with two middlewares
// 1. sagaMiddleware: Makes redux-sagas work
// 2. routerMiddleware: Syncs the location/URL path to the state
const middlewares = [
sagaMiddleware,
routerMiddleware(history)
]
const enhancers = [
app... | Create the store with asynchronously loaded reducers | configureStore | javascript | edp963/wormhole | rider/rider-webapp/app/store.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/app/store.js | Apache-2.0 |
function NotFound () {
return (
<article>
<h1>
<FormattedMessage {...messages.header} />
</h1>
</article>
)
} | NotFoundPage
This is the page we show when the user visits a url that doesn't have a route | NotFound | javascript | edp963/wormhole | rider/rider-webapp/app/containers/NotFoundPage/index.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/app/containers/NotFoundPage/index.js | Apache-2.0 |
function showSinkConfigMsg (value) {
let sinkConfigMsgTemp = ''
if (value === 'cassandra') {
sinkConfigMsgTemp = 'For example: {"mutation_type":"iud"}'
} else if (value === 'mysql' || value === 'oracle' || value === 'postgresql' || value === 'kudu') {
sinkConfigMsgTemp = 'For example: {"mutation_type":"iu... | Sink Config Msg
@param value
@returns {string} | showSinkConfigMsg | javascript | edp963/wormhole | rider/rider-webapp/app/containers/Workbench/workbenchFunction.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/app/containers/Workbench/workbenchFunction.js | Apache-2.0 |
function checkStore (store) {
const shape = {
dispatch: isFunction,
subscribe: isFunction,
getState: isFunction,
replaceReducer: isFunction,
runSaga: isFunction,
asyncReducers: isObject
}
invariant(
conformsTo(store, shape),
'(app/utils...) asyncInjectors: Expected a valid redux st... | Validate the shape of redux store | checkStore | javascript | edp963/wormhole | rider/rider-webapp/app/utils/asyncInjectors.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/app/utils/asyncInjectors.js | Apache-2.0 |
function parseData (response) {
return response.data
} | Parses the JSON returned by a network request
@param {object} response A response from a network request
@return {object} The parsed JSON from the request | parseData | javascript | edp963/wormhole | rider/rider-webapp/app/utils/request.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/app/utils/request.js | Apache-2.0 |
function refreshToken (response) {
if (response.data.header) {
axios.defaults.headers.common['Authorization'] = `Bearer ${response.data.header.token}`
localStorage.setItem('token', response.data.header.token)
}
return response
} | Checks if a network request came back fine, and throws an error if not
@param {object} response A response from a network request
@return {object|undefined} Returns either the response, or throws an error | refreshToken | javascript | edp963/wormhole | rider/rider-webapp/app/utils/request.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/app/utils/request.js | Apache-2.0 |
entry (pkg) {
const dependencyNames = Object.keys(pkg.dependencies)
const exclude = pkg.dllPlugin.exclude || ReactBoilerplate.dllPlugin.defaults.exclude
const include = pkg.dllPlugin.include || ReactBoilerplate.dllPlugin.defaults.include
const includeDependencies = uniq(dependencyNames.concat(in... | Specify any additional dependencies here. We include core-js and lodash
since a lot of our dependencies depend on them and they get picked up by webpack. | entry | javascript | edp963/wormhole | rider/rider-webapp/internals/config.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/config.js | Apache-2.0 |
function componentExists (comp) {
return components.indexOf(comp) >= 0
} | componentExists
Check whether the given component exist in either the components or containers directory | componentExists | javascript | edp963/wormhole | rider/rider-webapp/internals/generators/utils/componentExists.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/generators/utils/componentExists.js | Apache-2.0 |
task = message => {
progress = animateProgress(message)
process.stdout.write(message)
return error => {
if (error) {
process.stderr.write(error)
}
clearTimeout(progress)
return addCheckmark(() => newLine())
}
} | This script will extract the internationalization messages from all components
and package them in the translation json files in the translations file. | task | javascript | edp963/wormhole | rider/rider-webapp/internals/scripts/extract-intl.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/scripts/extract-intl.js | Apache-2.0 |
task = message => {
progress = animateProgress(message)
process.stdout.write(message)
return error => {
if (error) {
process.stderr.write(error)
}
clearTimeout(progress)
return addCheckmark(() => newLine())
}
} | This script will extract the internationalization messages from all components
and package them in the translation json files in the translations file. | task | javascript | edp963/wormhole | rider/rider-webapp/internals/scripts/extract-intl.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/scripts/extract-intl.js | Apache-2.0 |
glob = pattern =>
new Promise((resolve, reject) => {
nodeGlob(pattern, (error, value) => (error ? reject(error) : resolve(value)))
}) | This script will extract the internationalization messages from all components
and package them in the translation json files in the translations file. | glob | javascript | edp963/wormhole | rider/rider-webapp/internals/scripts/extract-intl.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/scripts/extract-intl.js | Apache-2.0 |
glob = pattern =>
new Promise((resolve, reject) => {
nodeGlob(pattern, (error, value) => (error ? reject(error) : resolve(value)))
}) | This script will extract the internationalization messages from all components
and package them in the translation json files in the translations file. | glob | javascript | edp963/wormhole | rider/rider-webapp/internals/scripts/extract-intl.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/scripts/extract-intl.js | Apache-2.0 |
readFile = fileName =>
new Promise((resolve, reject) => {
fs.readFile(fileName, (error, value) => (error ? reject(error) : resolve(value)))
}) | This script will extract the internationalization messages from all components
and package them in the translation json files in the translations file. | readFile | javascript | edp963/wormhole | rider/rider-webapp/internals/scripts/extract-intl.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/scripts/extract-intl.js | Apache-2.0 |
readFile = fileName =>
new Promise((resolve, reject) => {
fs.readFile(fileName, (error, value) => (error ? reject(error) : resolve(value)))
}) | This script will extract the internationalization messages from all components
and package them in the translation json files in the translations file. | readFile | javascript | edp963/wormhole | rider/rider-webapp/internals/scripts/extract-intl.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/scripts/extract-intl.js | Apache-2.0 |
writeFile = (fileName, data) =>
new Promise((resolve, reject) => {
fs.writeFile(fileName, data, (error, value) => (error ? reject(error) : resolve(value)))
}) | This script will extract the internationalization messages from all components
and package them in the translation json files in the translations file. | writeFile | javascript | edp963/wormhole | rider/rider-webapp/internals/scripts/extract-intl.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/scripts/extract-intl.js | Apache-2.0 |
writeFile = (fileName, data) =>
new Promise((resolve, reject) => {
fs.writeFile(fileName, data, (error, value) => (error ? reject(error) : resolve(value)))
}) | This script will extract the internationalization messages from all components
and package them in the translation json files in the translations file. | writeFile | javascript | edp963/wormhole | rider/rider-webapp/internals/scripts/extract-intl.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/scripts/extract-intl.js | Apache-2.0 |
extractFromFile = async fileName => {
try {
const code = await readFile(fileName)
// Use babel plugin to extract instances where react-intl is used
const { metadata: result } = await transform(code, {
presets: pkg.babel.presets,
plugins: [['react-intl']]
})
for (const message of result... | This script will extract the internationalization messages from all components
and package them in the translation json files in the translations file. | extractFromFile | javascript | edp963/wormhole | rider/rider-webapp/internals/scripts/extract-intl.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/scripts/extract-intl.js | Apache-2.0 |
extractFromFile = async fileName => {
try {
const code = await readFile(fileName)
// Use babel plugin to extract instances where react-intl is used
const { metadata: result } = await transform(code, {
presets: pkg.babel.presets,
plugins: [['react-intl']]
})
for (const message of result... | This script will extract the internationalization messages from all components
and package them in the translation json files in the translations file. | extractFromFile | javascript | edp963/wormhole | rider/rider-webapp/internals/scripts/extract-intl.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/scripts/extract-intl.js | Apache-2.0 |
function animateProgress(message, amountOfDots) {
if (typeof amountOfDots !== 'number') {
amountOfDots = 3;
}
let i = 0;
return setInterval(function() {
readline.cursorTo(process.stdout, 0);
i = (i + 1) % (amountOfDots + 1);
const dots = new Array(i + 1).join('.');
process.stdout.write(mess... | Adds an animated progress indicator
@param {string} message The message to write next to the indicator
@param {number} amountOfDots The amount of dots you want to animate | animateProgress | javascript | edp963/wormhole | rider/rider-webapp/internals/scripts/helpers/progress.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/scripts/helpers/progress.js | Apache-2.0 |
render = (translatedMessages) => {
ReactDOM.render(
<Provider store={store}>
<LanguageProvider messages={translatedMessages}>
<Router
history={history}
routes={rootRoute}
render={
// Scroll to top when going to a new page, imitating default browser
... | app.js
This is the entry file for the application, only setup and boilerplate
code. | render | javascript | edp963/wormhole | rider/rider-webapp/internals/templates/app.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/templates/app.js | Apache-2.0 |
render = (translatedMessages) => {
ReactDOM.render(
<Provider store={store}>
<LanguageProvider messages={translatedMessages}>
<Router
history={history}
routes={rootRoute}
render={
// Scroll to top when going to a new page, imitating default browser
... | app.js
This is the entry file for the application, only setup and boilerplate
code. | render | javascript | edp963/wormhole | rider/rider-webapp/internals/templates/app.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/templates/app.js | Apache-2.0 |
render() {
return (
<div>
{React.Children.toArray(this.props.children)}
</div>
);
} | App.react.js
This component is the skeleton around the actual pages, and should only
contain code that should be seen on all pages. (e.g. navigation bar)
NOTE: while this component should technically be a stateless functional
component (SFC), hot reloading does not currently support SFCs. If hot
reloading is not a ne... | render | javascript | edp963/wormhole | rider/rider-webapp/internals/templates/appContainer.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/templates/appContainer.js | Apache-2.0 |
function checkStore(store) {
const shape = {
dispatch: isFunction,
subscribe: isFunction,
getState: isFunction,
replaceReducer: isFunction,
runSaga: isFunction,
asyncReducers: isObject,
};
invariant(
conformsTo(store, shape),
'(app/utils...) asyncInjectors: Expected a valid redux s... | Validate the shape of redux store | checkStore | javascript | edp963/wormhole | rider/rider-webapp/internals/templates/asyncInjectors.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/templates/asyncInjectors.js | Apache-2.0 |
formatTranslationMessages = (locale, messages) => {
const defaultFormattedMessages = locale !== DEFAULT_LOCALE ? formatTranslationMessages(DEFAULT_LOCALE, enTranslationMessages) : {};
const formattedMessages = {};
const messageKeys = Object.keys(messages);
for (const messageKey of messageKeys) {
if (locale ... | i18n.js
This will setup the i18n language files and locale data for your app. | formatTranslationMessages | javascript | edp963/wormhole | rider/rider-webapp/internals/templates/i18n.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/templates/i18n.js | Apache-2.0 |
formatTranslationMessages = (locale, messages) => {
const defaultFormattedMessages = locale !== DEFAULT_LOCALE ? formatTranslationMessages(DEFAULT_LOCALE, enTranslationMessages) : {};
const formattedMessages = {};
const messageKeys = Object.keys(messages);
for (const messageKey of messageKeys) {
if (locale ... | i18n.js
This will setup the i18n language files and locale data for your app. | formatTranslationMessages | javascript | edp963/wormhole | rider/rider-webapp/internals/templates/i18n.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/templates/i18n.js | Apache-2.0 |
function routeReducer(state = routeInitialState, action) {
switch (action.type) {
/* istanbul ignore next */
case LOCATION_CHANGE:
return state.merge({
locationBeforeTransitions: action.payload,
});
default:
return state;
}
} | Merge route into the global application state | routeReducer | javascript | edp963/wormhole | rider/rider-webapp/internals/templates/reducers.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/templates/reducers.js | Apache-2.0 |
function createReducer(asyncReducers) {
return combineReducers({
route: routeReducer,
language: languageProviderReducer,
...asyncReducers,
});
} | Creates the main reducer with the asynchronously loaded ones | createReducer | javascript | edp963/wormhole | rider/rider-webapp/internals/templates/reducers.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/templates/reducers.js | Apache-2.0 |
function configureStore(initialState = {}, history) {
// Create the store with two middlewares
// 1. sagaMiddleware: Makes redux-sagas work
// 2. routerMiddleware: Syncs the location/URL path to the state
const middlewares = [
sagaMiddleware,
routerMiddleware(history),
];
const enhancers = [
ap... | Create the store with asynchronously loaded reducers | configureStore | javascript | edp963/wormhole | rider/rider-webapp/internals/templates/store.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/templates/store.js | Apache-2.0 |
render() {
return (
<h1>
<FormattedMessage {...messages.header} />
</h1>
);
} | NotFoundPage
This is the page we show when the user visits a url that doesn't have a route
NOTE: while this component should technically be a stateless functional
component (SFC), hot reloading does not currently support SFCs. If hot
reloading is not a necessity for you then you can refactor it and remove
the linting... | render | javascript | edp963/wormhole | rider/rider-webapp/internals/templates/notFoundPage/notFoundPage.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/templates/notFoundPage/notFoundPage.js | Apache-2.0 |
function dependencyHandlers () {
// Don't do anything during the DLL Build step
if (process.env.BUILDING_DLL) { return [] }
// If the package.json does not have a dllPlugin property, use the CommonsChunkPlugin
if (!dllPlugin) {
return [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor'... | Select which plugins to use to optimize the bundle's handling of
third party dependencies.
If there is a dllPlugin key on the project's package.json, the
Webpack DLL Plugin will be used. Otherwise the CommonsChunkPlugin
will be used. | dependencyHandlers | javascript | edp963/wormhole | rider/rider-webapp/internals/webpack/webpack.dev.babel.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/webpack/webpack.dev.babel.js | Apache-2.0 |
function templateContent () {
const html = fs.readFileSync(
path.resolve(process.cwd(), 'app/index.html')
).toString()
if (!dllPlugin) { return html }
const doc = cheerio(html)
const body = doc.find('body')
const dllNames = !dllPlugin.dlls ? ['reactBoilerplateDeps'] : Object.keys(dllPlugin.dlls)
dl... | We dynamically generate the HTML content in development so that the different
DLL Javascript files are loaded in script tags and available to our application. | templateContent | javascript | edp963/wormhole | rider/rider-webapp/internals/webpack/webpack.dev.babel.js | https://github.com/edp963/wormhole/blob/master/rider/rider-webapp/internals/webpack/webpack.dev.babel.js | Apache-2.0 |
isPrimitive = function isPrimitive(input) {
var type = typeof input;
return input === null || (type !== 'object' && type !== 'function');
} | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | isPrimitive | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
binder = function () {
if (this instanceof bound) {
// 15.3.4.5.2 [[Construct]]
// When the [[Construct]] internal method of a function object,
// F that was created using the bind function is called with a
// list of argum... | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | binder | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
properlyBoxesContext = function properlyBoxed(method) {
// Check node 0.6.21 bug where third parameter is not boxed
var properlyBoxesNonStrict = true;
var properlyBoxesStrict = true;
var threwException = false;
if (method) {
try {
method.call('foo', fu... | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | properlyBoxesContext | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
pushShim = function push(item) {
var O = ES.ToObject(this);
var n = ES.ToUint32(O.length);
var i = 0;
while (i < arguments.length) {
O[n + i] = arguments[i];
i += 1;
}
O.length = n + i;
return n + i;
} | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | pushShim | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
equalsConstructorPrototype = function (o) {
var ctor = o.constructor;
return ctor && ctor.prototype === o;
} | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | equalsConstructorPrototype | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
equalsConstructorPrototypeIfNotBuggy = function (object) {
if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
return equalsConstructorPrototype(object);
}
try {
return equalsConstructorPrototype(object);
} catch (e) {
return false;
... | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | equalsConstructorPrototypeIfNotBuggy | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
isStandardArguments = function isArguments(value) {
return toStr(value) === '[object Arguments]';
} | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | isStandardArguments | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
isLegacyArguments = function isArguments(value) {
return value !== null &&
typeof value === 'object' &&
typeof value.length === 'number' &&
value.length >= 0 &&
!isArray(value) &&
isCallable(value.callee);
} | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | isLegacyArguments | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
daysInMonth = function daysInMonth(month, year) {
return originalGetDate(new Date(year, month, 0));
} | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | daysInMonth | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
DateShim = function Date(Y, M, D, h, m, s, ms) {
var length = arguments.length;
var date;
if (this instanceof NativeDate) {
var seconds = s;
var millis = ms;
if (hasSafariSignedIntBug && length >= 7 && ms > maxSa... | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | DateShim | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
dayFromMonth = function dayFromMonth(year, month) {
var t = month > 1 ? 1 : 0;
return (
months[month] +
Math.floor((year - 1969 + t) / 4) -
Math.floor((year - 1901 + t) / 100) +
Math.floor((year - 1601 + t) /... | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | dayFromMonth | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
toUTC = function toUTC(t) {
var s = 0;
var ms = t;
if (hasSafariSignedIntBug && ms > maxSafeUnsigned32Bit) {
// work around a Safari 8/9 bug where it treats the seconds as signed
var msToShift = Math.floor(ms / maxSafeUnsigned32Bit)... | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | toUTC | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
parseShim = function parse(string) {
var match = isoDateExpression.exec(string);
if (match) {
// parse months, days, hours, minutes, seconds, and milliseconds
// provide default values if necessary
// parse the UTC offset compon... | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | parseShim | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
toFixedShim = function toFixed(fractionDigits) {
var f, x, s, m, e, z, j, k;
// Test for NaN and round fractionDigits down
f = $Number(fractionDigits);
f = isActualNaN(f) ? 0 : Math.floor(f);
if (f < 0 || f > 20) {
throw new RangeError('Number.toFixed called with in... | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | toFixedShim | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
wrappedReplaceValue = function (match) {
var length = arguments.length;
var originalLastIndex = searchValue.lastIndex;
searchValue.lastIndex = 0;
var args = searchValue.exec(match) || [];
searchValue.lastIndex = original... | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | wrappedReplaceValue | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
errorToStringShim = function toString() {
if (typeof this === 'undefined' || this === null) {
throw new TypeError("can't convert " + this + ' to object');
}
var name = this.name;
if (typeof name === 'undefined') {
name = 'Error';
... | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | errorToStringShim | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
ensureNonEnumerable = function (obj, prop) {
if (isEnum(obj, prop)) {
var desc = Object.getOwnPropertyDescriptor(obj, prop);
if (desc.configurable) {
desc.enumerable = false;
Object.defineProperty(obj, prop, desc);
}
... | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | ensureNonEnumerable | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
regexToString = function toString() {
var str = '/' + this.source + '/';
if (this.global) {
str += 'g';
}
if (this.ignoreCase) {
str += 'i';
}
if (this.multiline) {
str += 'm';
}
... | Brings an environment as close to ECMAScript 5 compliance
as is possible with the facilities of erstwhile engines.
Annotated ES5: http://es5.github.com/ (specific links below)
ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
Required reading: http://javascriptweblog.wordpress.com/201... | regexToString | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
deprecationWrapper = function (url, options) {
helpers.log('This is deprecated, use "new SwaggerClient" instead.');
return new SwaggerClient(url, options);
} | ApiKeyAuthorization allows a query param or header to be injected | deprecationWrapper | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
JQueryHttpClient = function () {
this.type = 'JQueryHttpClient';
} | SwaggerHttp is a wrapper for executing requests | JQueryHttpClient | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
SuperagentHttpClient = function () {
this.type = 'SuperagentHttpClient';
} | SwaggerHttp is a wrapper for executing requests | SuperagentHttpClient | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
requestInterceptor = function(data) {
if(opts && opts.requestInterceptor) {
data = opts.requestInterceptor.apply(data);
}
return data;
} | SwaggerHttp is a wrapper for executing requests | requestInterceptor | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
responseInterceptor = function(data) {
if(opts && opts.responseInterceptor) {
data = opts.responseInterceptor.apply(data);
}
return success(data);
} | SwaggerHttp is a wrapper for executing requests | responseInterceptor | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
errorInterceptor = function(data) {
if(opts && opts.responseInterceptor) {
data = opts.responseInterceptor.apply(data);
}
error(data);
} | SwaggerHttp is a wrapper for executing requests | errorInterceptor | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function splitUrl(url) {
var result = {};
var proto = /[a-z]+:\/\//i.exec(url);
if (proto) {
result.proto = proto[0].slice(0, -3);
url = url.slice(result.proto.length + 1);
}
if (url.slice(0, 2) === '//') {
result.domain = url.slice(2).split('/')[0];
url = url.slice(2 + result.domain.length);
... | immediately in-lines local refs, queues remote refs
for inline resolution | splitUrl | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function unsplitUrl(url) {
var result = url.path;
if (result === undefined) {
result = '';
}
if (url.fragment !== undefined) {
result += '#' + url.fragment;
}
if (url.domain !== undefined) {
if (result.slice(0, 1) === '/') {
result = result.slice(1);
}
result = '//' + url.domain + ... | immediately in-lines local refs, queues remote refs
for inline resolution | unsplitUrl | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function joinUrl(base, rel) {
var relsp = splitUrl(rel);
if (relsp.domain !== undefined) {
return rel;
}
var result = splitUrl(base);
if (relsp.path === undefined) {
// change only fragment part
result.fragment = relsp.fragment;
} else if (relsp.path.slice(0, 1) === '/') {
// relative to dom... | immediately in-lines local refs, queues remote refs
for inline resolution | joinUrl | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function addReference(schema, name, skipRef) {
var modelName = name;
var model;
if (schema.$ref) {
modelName = schema.title || Helpers.simpleRef(schema.$ref);
model = models[modelName];
} else if (_.isUndefined(name)) {
modelName = schema.title || 'Inline Model ' + (++inlineModels);
... | immediately in-lines local refs, queues remote refs
for inline resolution | addReference | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function primitiveToHTML(schema) {
var html = '<span class="propType">';
var type = schema.type || 'object';
if (schema.$ref) {
html += addReference(schema, Helpers.simpleRef(schema.$ref));
} else if (type === 'object') {
if (!_.isUndefined(schema.properties)) {
html += addReference... | immediately in-lines local refs, queues remote refs
for inline resolution | primitiveToHTML | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function primitiveToOptionsHTML(schema, html) {
var options = '';
var type = schema.type || 'object';
var isArray = type === 'array';
if (isArray) {
if (_.isPlainObject(schema.items) && !_.isUndefined(schema.items.type)) {
type = schema.items.type;
} else {
type = 'object';
... | immediately in-lines local refs, queues remote refs
for inline resolution | primitiveToOptionsHTML | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function processModel(schema, name) {
var type = schema.type || 'object';
var isArray = schema.type === 'array';
var html = strongOpen + name + ' ' + (isArray ? '[' : '{') + strongClose;
if (name) {
seenModels.push(name);
}
if (isArray) {
if (_.isArray(schema.items)) {
html... | immediately in-lines local refs, queues remote refs
for inline resolution | processModel | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function itemByPriority(col, itemPriority) {
// No priorities? return first...
if(_.isEmpty(itemPriority)) {
return col[0];
}
for (var i = 0, len = itemPriority.length; i < len; i++) {
if(col.indexOf(itemPriority[i]) > -1) {
return itemPriority[i];
}
}
// Otherwise return first
return... | Returns true if the request accepts header matches anything in this.produces.
If this.produces contains * / *, ignore the accept header.
@param {string=} accepts The client request accept header.
@return {boolean} | itemByPriority | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function btoa(str) {
var buffer
;
if (str instanceof Buffer) {
buffer = str;
} else {
buffer = new Buffer(str.toString(), 'binary');
}
return buffer.toString('base64');
} | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | btoa | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function kMaxLength () {
return Buffer.TYPED_ARRAY_SUPPORT
? 0x7fffffff
: 0x3fffffff
} | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | kMaxLength | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function Buffer (arg) {
if (!(this instanceof Buffer)) {
// Avoid going through an ArgumentsAdaptorTrampoline in the common case.
if (arguments.length > 1) return new Buffer(arg, arguments[1])
return new Buffer(arg)
}
this.length = 0
this.parent = undefined
// Common case.
if (typeof arg === '... | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | Buffer | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function fromNumber (that, length) {
that = allocate(that, length < 0 ? 0 : checked(length) | 0)
if (!Buffer.TYPED_ARRAY_SUPPORT) {
for (var i = 0; i < length; i++) {
that[i] = 0
}
}
return that
} | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | fromNumber | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function fromString (that, string, encoding) {
if (typeof encoding !== 'string' || encoding === '') encoding = 'utf8'
// Assumption: byteLength() return value is always < kMaxLength.
var length = byteLength(string, encoding) | 0
that = allocate(that, length)
that.write(string, encoding)
return that
} | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | fromString | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function fromObject (that, object) {
if (Buffer.isBuffer(object)) return fromBuffer(that, object)
if (isArray(object)) return fromArray(that, object)
if (object == null) {
throw new TypeError('must start with number, buffer, array or string')
}
if (typeof ArrayBuffer !== 'undefined') {
if (object.b... | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | fromObject | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function fromBuffer (that, buffer) {
var length = checked(buffer.length) | 0
that = allocate(that, length)
buffer.copy(that, 0, 0, length)
return that
} | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | fromBuffer | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function fromArray (that, array) {
var length = checked(array.length) | 0
that = allocate(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
} | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | fromArray | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function fromTypedArray (that, array) {
var length = checked(array.length) | 0
that = allocate(that, length)
// Truncating the elements is probably not what people expect from typed
// arrays with BYTES_PER_ELEMENT > 1 but it's compatible with the behavior
// of the old Buffer constructor.
for (var i = 0; i... | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | fromTypedArray | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function fromArrayBuffer (that, array) {
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
array.byteLength
that = Buffer._augment(new Uint8Array(array))
} else {
// Fallback: Return an object instance of the Buffer class
that = fromTypedArray(t... | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | fromArrayBuffer | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function fromArrayLike (that, array) {
var length = checked(array.length) | 0
that = allocate(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
} | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | fromArrayLike | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function fromJsonObject (that, object) {
var array
var length = 0
if (object.type === 'Buffer' && isArray(object.data)) {
array = object.data
length = checked(array.length) | 0
}
that = allocate(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
}
return that
} | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | fromJsonObject | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function allocate (that, length) {
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = Buffer._augment(new Uint8Array(length))
} else {
// Fallback: Return an object instance of the Buffer class
that.length = length
that._isBuffer = true
... | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | allocate | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function checked (length) {
// Note: cannot use `length < kMaxLength` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= kMaxLength()) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
'size: 0x' + kMaxLength().to... | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | checked | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
function SlowBuffer (subject, encoding) {
if (!(this instanceof SlowBuffer)) return new SlowBuffer(subject, encoding)
var buf = new Buffer(subject, encoding)
delete buf.parent
return buf
} | Class: Buffer
=============
The Buffer constructor returns instances of `Uint8Array` that are augmented
with function properties for all the node `Buffer` API functions. We use
`Uint8Array` so that square bracket notation works as expected -- it returns
a single octet.
By augmenting the instances, we can avoid modify... | SlowBuffer | javascript | edp963/wormhole | rider/swagger-ui/swagger-ui.js | https://github.com/edp963/wormhole/blob/master/rider/swagger-ui/swagger-ui.js | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.