repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
jshttp/type-is
index.js
mimeMatch
function mimeMatch (expected, actual) { // invalid type if (expected === false) { return false } // split types var actualParts = actual.split('/') var expectedParts = expected.split('/') // invalid format if (actualParts.length !== 2 || expectedParts.length !== 2) { return false } // val...
javascript
function mimeMatch (expected, actual) { // invalid type if (expected === false) { return false } // split types var actualParts = actual.split('/') var expectedParts = expected.split('/') // invalid format if (actualParts.length !== 2 || expectedParts.length !== 2) { return false } // val...
[ "function", "mimeMatch", "(", "expected", ",", "actual", ")", "{", "// invalid type", "if", "(", "expected", "===", "false", ")", "{", "return", "false", "}", "// split types", "var", "actualParts", "=", "actual", ".", "split", "(", "'/'", ")", "var", "exp...
Check if `expected` mime type matches `actual` mime type with wildcard and +suffix support. @param {String} expected @param {String} actual @return {Boolean} @private
[ "Check", "if", "expected", "mime", "type", "matches", "actual", "mime", "type", "with", "wildcard", "and", "+", "suffix", "support", "." ]
bfebe3d4ac312debccb7dbbc79242e2581dea5f0
https://github.com/jshttp/type-is/blob/bfebe3d4ac312debccb7dbbc79242e2581dea5f0/index.js#L195-L227
train
jshttp/type-is
index.js
normalizeType
function normalizeType (value) { // parse the type var type = typer.parse(value) // remove the parameters type.parameters = undefined // reformat it return typer.format(type) }
javascript
function normalizeType (value) { // parse the type var type = typer.parse(value) // remove the parameters type.parameters = undefined // reformat it return typer.format(type) }
[ "function", "normalizeType", "(", "value", ")", "{", "// parse the type", "var", "type", "=", "typer", ".", "parse", "(", "value", ")", "// remove the parameters", "type", ".", "parameters", "=", "undefined", "// reformat it", "return", "typer", ".", "format", "...
Normalize a type and remove parameters. @param {string} value @return {string} @private
[ "Normalize", "a", "type", "and", "remove", "parameters", "." ]
bfebe3d4ac312debccb7dbbc79242e2581dea5f0
https://github.com/jshttp/type-is/blob/bfebe3d4ac312debccb7dbbc79242e2581dea5f0/index.js#L237-L246
train
adametry/gulp-eslint
util.js
isErrorMessage
function isErrorMessage(message) { const level = message.fatal ? 2 : message.severity; if (Array.isArray(level)) { return level[0] > 1; } return level > 1; }
javascript
function isErrorMessage(message) { const level = message.fatal ? 2 : message.severity; if (Array.isArray(level)) { return level[0] > 1; } return level > 1; }
[ "function", "isErrorMessage", "(", "message", ")", "{", "const", "level", "=", "message", ".", "fatal", "?", "2", ":", "message", ".", "severity", ";", "if", "(", "Array", ".", "isArray", "(", "level", ")", ")", "{", "return", "level", "[", "0", "]",...
Determine if a message is an error @param {Object} message - an ESLint message @returns {Boolean} whether the message is an error message
[ "Determine", "if", "a", "message", "is", "an", "error" ]
40d004fa2f48325f6a507cb10072ff6667aeaf41
https://github.com/adametry/gulp-eslint/blob/40d004fa2f48325f6a507cb10072ff6667aeaf41/util.js#L131-L139
train
adametry/gulp-eslint
util.js
countFixableErrorMessage
function countFixableErrorMessage(count, message) { return count + Number(isErrorMessage(message) && message.fix !== undefined); }
javascript
function countFixableErrorMessage(count, message) { return count + Number(isErrorMessage(message) && message.fix !== undefined); }
[ "function", "countFixableErrorMessage", "(", "count", ",", "message", ")", "{", "return", "count", "+", "Number", "(", "isErrorMessage", "(", "message", ")", "&&", "message", ".", "fix", "!==", "undefined", ")", ";", "}" ]
Increment count if message is a fixable error @param {Number} count - count of errors @param {Object} message - an ESLint message @returns {Number} The number of errors, message included
[ "Increment", "count", "if", "message", "is", "a", "fixable", "error" ]
40d004fa2f48325f6a507cb10072ff6667aeaf41
https://github.com/adametry/gulp-eslint/blob/40d004fa2f48325f6a507cb10072ff6667aeaf41/util.js#L171-L173
train
adametry/gulp-eslint
util.js
countFixableWarningMessage
function countFixableWarningMessage(count, message) { return count + Number(message.severity === 1 && message.fix !== undefined); }
javascript
function countFixableWarningMessage(count, message) { return count + Number(message.severity === 1 && message.fix !== undefined); }
[ "function", "countFixableWarningMessage", "(", "count", ",", "message", ")", "{", "return", "count", "+", "Number", "(", "message", ".", "severity", "===", "1", "&&", "message", ".", "fix", "!==", "undefined", ")", ";", "}" ]
Increment count if message is a fixable warning @param {Number} count - count of errors @param {Object} message - an ESLint message @returns {Number} The number of errors, message included
[ "Increment", "count", "if", "message", "is", "a", "fixable", "warning" ]
40d004fa2f48325f6a507cb10072ff6667aeaf41
https://github.com/adametry/gulp-eslint/blob/40d004fa2f48325f6a507cb10072ff6667aeaf41/util.js#L182-L184
train
adametry/gulp-eslint
index.js
gulpEslint
function gulpEslint(options) { options = migrateOptions(options) || {}; const linter = new CLIEngine(options); return transform((file, enc, cb) => { const filePath = relative(process.cwd(), file.path); if (file.isNull()) { cb(null, file); return; } if (file.isStream()) { cb(new PluginError('gulp-...
javascript
function gulpEslint(options) { options = migrateOptions(options) || {}; const linter = new CLIEngine(options); return transform((file, enc, cb) => { const filePath = relative(process.cwd(), file.path); if (file.isNull()) { cb(null, file); return; } if (file.isStream()) { cb(new PluginError('gulp-...
[ "function", "gulpEslint", "(", "options", ")", "{", "options", "=", "migrateOptions", "(", "options", ")", "||", "{", "}", ";", "const", "linter", "=", "new", "CLIEngine", "(", "options", ")", ";", "return", "transform", "(", "(", "file", ",", "enc", "...
Append ESLint result to each file @param {(Object|String)} [options] - Configure rules, env, global, and other options for running ESLint @returns {stream} gulp file stream
[ "Append", "ESLint", "result", "to", "each", "file" ]
40d004fa2f48325f6a507cb10072ff6667aeaf41
https://github.com/adametry/gulp-eslint/blob/40d004fa2f48325f6a507cb10072ff6667aeaf41/index.js#L26-L84
train
bitovi/syn
src/drag.js
function(focusWindow, fromPoint, toPoint, duration, callback){ this.currentDataTransferItem = null; this.focusWindow = focusWindow; // A series of events to simulate a drag operation this._mouseOver(fromPoint); this._mouseEnter(fromPoint); this._mouseMove(fromPoint); this._mouseDown(fromPoint); this._...
javascript
function(focusWindow, fromPoint, toPoint, duration, callback){ this.currentDataTransferItem = null; this.focusWindow = focusWindow; // A series of events to simulate a drag operation this._mouseOver(fromPoint); this._mouseEnter(fromPoint); this._mouseMove(fromPoint); this._mouseDown(fromPoint); this._...
[ "function", "(", "focusWindow", ",", "fromPoint", ",", "toPoint", ",", "duration", ",", "callback", ")", "{", "this", ".", "currentDataTransferItem", "=", "null", ";", "this", ".", "focusWindow", "=", "focusWindow", ";", "// A series of events to simulate a drag ope...
Performs a series of dragStart, dragEnter, dragOver and drop operations to simulate a dragDrop @param fromElement: element from where drag is started @param channel: destination element for drop
[ "Performs", "a", "series", "of", "dragStart", "dragEnter", "dragOver", "and", "drop", "operations", "to", "simulate", "a", "dragDrop" ]
f04e87b18bee9b4308838db04682d3ce2b98afaa
https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/drag.js#L47-L86
train
bitovi/syn
src/drag.js
function(point, eventName, options){ if (point){ var targetElement = elementFromPoint(point, this.focusWindow); syn.trigger(targetElement, eventName, options); } }
javascript
function(point, eventName, options){ if (point){ var targetElement = elementFromPoint(point, this.focusWindow); syn.trigger(targetElement, eventName, options); } }
[ "function", "(", "point", ",", "eventName", ",", "options", ")", "{", "if", "(", "point", ")", "{", "var", "targetElement", "=", "elementFromPoint", "(", "point", ",", "this", ".", "focusWindow", ")", ";", "syn", ".", "trigger", "(", "targetElement", ","...
Creates and dispatches an event on the node received @param node @param eventName
[ "Creates", "and", "dispatches", "an", "event", "on", "the", "node", "received" ]
f04e87b18bee9b4308838db04682d3ce2b98afaa
https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/drag.js#L138-L143
train
bitovi/syn
src/drag.js
function(dataFlavor, value){ var tempdata = {}; tempdata.dataFlavor = dataFlavor; tempdata.val = value; this.data.push(tempdata); }
javascript
function(dataFlavor, value){ var tempdata = {}; tempdata.dataFlavor = dataFlavor; tempdata.val = value; this.data.push(tempdata); }
[ "function", "(", "dataFlavor", ",", "value", ")", "{", "var", "tempdata", "=", "{", "}", ";", "tempdata", ".", "dataFlavor", "=", "dataFlavor", ";", "tempdata", ".", "val", "=", "value", ";", "this", ".", "data", ".", "push", "(", "tempdata", ")", ";...
setData function assigns the dragValue to an object's property
[ "setData", "function", "assigns", "the", "dragValue", "to", "an", "object", "s", "property" ]
f04e87b18bee9b4308838db04682d3ce2b98afaa
https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/drag.js#L176-L181
train
bitovi/syn
src/drag.js
function(dataFlavor){ for (var i = 0; i < this.data.length; i++){ var tempdata = this.data[i]; if (tempdata.dataFlavor === dataFlavor){ return tempdata.val; } } }
javascript
function(dataFlavor){ for (var i = 0; i < this.data.length; i++){ var tempdata = this.data[i]; if (tempdata.dataFlavor === dataFlavor){ return tempdata.val; } } }
[ "function", "(", "dataFlavor", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "data", ".", "length", ";", "i", "++", ")", "{", "var", "tempdata", "=", "this", ".", "data", "[", "i", "]", ";", "if", "(", "tempdata", "....
getData fetches the dragValue based on the input dataFlavor provided.
[ "getData", "fetches", "the", "dragValue", "based", "on", "the", "input", "dataFlavor", "provided", "." ]
f04e87b18bee9b4308838db04682d3ce2b98afaa
https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/drag.js#L184-L191
train
bitovi/syn
src/synthetic.js
function (el, type) { while (el && el.nodeName.toLowerCase() !== type.toLowerCase()) { el = el.parentNode; } return el; }
javascript
function (el, type) { while (el && el.nodeName.toLowerCase() !== type.toLowerCase()) { el = el.parentNode; } return el; }
[ "function", "(", "el", ",", "type", ")", "{", "while", "(", "el", "&&", "el", ".", "nodeName", ".", "toLowerCase", "(", ")", "!==", "type", ".", "toLowerCase", "(", ")", ")", "{", "el", "=", "el", ".", "parentNode", ";", "}", "return", "el", ";",...
Returns the closest element of a particular type. @hide @param {Object} el @param {Object} type
[ "Returns", "the", "closest", "element", "of", "a", "particular", "type", "." ]
f04e87b18bee9b4308838db04682d3ce2b98afaa
https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/synthetic.js#L302-L307
train
bitovi/syn
src/synthetic.js
function (el, func) { var res; while (el && res !== false) { res = func(el); el = el.parentNode; } return el; }
javascript
function (el, func) { var res; while (el && res !== false) { res = func(el); el = el.parentNode; } return el; }
[ "function", "(", "el", ",", "func", ")", "{", "var", "res", ";", "while", "(", "el", "&&", "res", "!==", "false", ")", "{", "res", "=", "func", "(", "el", ")", ";", "el", "=", "el", ".", "parentNode", ";", "}", "return", "el", ";", "}" ]
Calls a function on the element and all parents of the element until the function returns false. @hide @param {Object} el @param {Object} func
[ "Calls", "a", "function", "on", "the", "element", "and", "all", "parents", "of", "the", "element", "until", "the", "function", "returns", "false", "." ]
f04e87b18bee9b4308838db04682d3ce2b98afaa
https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/synthetic.js#L337-L344
train
bitovi/syn
src/synthetic.js
function (elem) { var attributeNode; // IE8 Standards doesn't like this on some elements if (elem.getAttributeNode) { attributeNode = elem.getAttributeNode("tabIndex"); } return this.focusable.test(elem.nodeName) || (attributeNode && attributeNode.specified) && syn.isVisible(elem); }
javascript
function (elem) { var attributeNode; // IE8 Standards doesn't like this on some elements if (elem.getAttributeNode) { attributeNode = elem.getAttributeNode("tabIndex"); } return this.focusable.test(elem.nodeName) || (attributeNode && attributeNode.specified) && syn.isVisible(elem); }
[ "function", "(", "elem", ")", "{", "var", "attributeNode", ";", "// IE8 Standards doesn't like this on some elements", "if", "(", "elem", ".", "getAttributeNode", ")", "{", "attributeNode", "=", "elem", ".", "getAttributeNode", "(", "\"tabIndex\"", ")", ";", "}", ...
Returns if an element is focusable @hide @param {Object} elem
[ "Returns", "if", "an", "element", "is", "focusable" ]
f04e87b18bee9b4308838db04682d3ce2b98afaa
https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/synthetic.js#L352-L363
train
bitovi/syn
src/synthetic.js
function (elem) { var attributeNode = elem.getAttributeNode("tabIndex"); return attributeNode && attributeNode.specified && (parseInt(elem.getAttribute('tabIndex')) || 0); }
javascript
function (elem) { var attributeNode = elem.getAttributeNode("tabIndex"); return attributeNode && attributeNode.specified && (parseInt(elem.getAttribute('tabIndex')) || 0); }
[ "function", "(", "elem", ")", "{", "var", "attributeNode", "=", "elem", ".", "getAttributeNode", "(", "\"tabIndex\"", ")", ";", "return", "attributeNode", "&&", "attributeNode", ".", "specified", "&&", "(", "parseInt", "(", "elem", ".", "getAttribute", "(", ...
Gets the tabIndex as a number or null @hide @param {Object} elem
[ "Gets", "the", "tabIndex", "as", "a", "number", "or", "null" ]
f04e87b18bee9b4308838db04682d3ce2b98afaa
https://github.com/bitovi/syn/blob/f04e87b18bee9b4308838db04682d3ce2b98afaa/src/synthetic.js#L377-L380
train
marlove/react-native-geocoding
Geocoder.js
toQueryParams
function toQueryParams(object){ return Object.keys(object) .filter(key => !!object[key]) .map(key => key + "=" + encodeURIComponent(object[key])) .join("&") }
javascript
function toQueryParams(object){ return Object.keys(object) .filter(key => !!object[key]) .map(key => key + "=" + encodeURIComponent(object[key])) .join("&") }
[ "function", "toQueryParams", "(", "object", ")", "{", "return", "Object", ".", "keys", "(", "object", ")", ".", "filter", "(", "key", "=>", "!", "!", "object", "[", "key", "]", ")", ".", "map", "(", "key", "=>", "key", "+", "\"=\"", "+", "encodeURI...
Convert an object into query parameters. @param {Object} object Object to convert. @returns {string} Encoded query parameters.
[ "Convert", "an", "object", "into", "query", "parameters", "." ]
90433d23ffd4a11d50bf8cc2f6852f8c4521a3b2
https://github.com/marlove/react-native-geocoding/blob/90433d23ffd4a11d50bf8cc2f6852f8c4521a3b2/Geocoder.js#L192-L197
train
benbaran/adal-angular4
gulpfile.js
copy
function copy(cb) { gulp.src(['adal-angular.d.ts']).pipe(gulp.dest('./dist/')); console.log('adal-angular.d.ts Copied to Dist Directory'); gulp.src(['README.md']).pipe(gulp.dest('./dist/')); console.log('README.md Copied to Dist Directory'); cb(); }
javascript
function copy(cb) { gulp.src(['adal-angular.d.ts']).pipe(gulp.dest('./dist/')); console.log('adal-angular.d.ts Copied to Dist Directory'); gulp.src(['README.md']).pipe(gulp.dest('./dist/')); console.log('README.md Copied to Dist Directory'); cb(); }
[ "function", "copy", "(", "cb", ")", "{", "gulp", ".", "src", "(", "[", "'adal-angular.d.ts'", "]", ")", ".", "pipe", "(", "gulp", ".", "dest", "(", "'./dist/'", ")", ")", ";", "console", ".", "log", "(", "'adal-angular.d.ts Copied to Dist Directory'", ")",...
4. include type definition file for adal-angular
[ "4", ".", "include", "type", "definition", "file", "for", "adal", "-", "angular" ]
72794492c6ff3f2be0b96d9394126e53c8e45b5a
https://github.com/benbaran/adal-angular4/blob/72794492c6ff3f2be0b96d9394126e53c8e45b5a/gulpfile.js#L44-L52
train
benbaran/adal-angular4
gulpfile.js
replace_d
function replace_d(cb) { gulp.src('./dist/adal.service.d.ts') .pipe(replace('../adal-angular.d.ts', './adal-angular.d.ts')) .pipe(gulp.dest('./dist/')); console.log('adal.service.d.ts Path Updated'); cb(); }
javascript
function replace_d(cb) { gulp.src('./dist/adal.service.d.ts') .pipe(replace('../adal-angular.d.ts', './adal-angular.d.ts')) .pipe(gulp.dest('./dist/')); console.log('adal.service.d.ts Path Updated'); cb(); }
[ "function", "replace_d", "(", "cb", ")", "{", "gulp", ".", "src", "(", "'./dist/adal.service.d.ts'", ")", ".", "pipe", "(", "replace", "(", "'../adal-angular.d.ts'", ",", "'./adal-angular.d.ts'", ")", ")", ".", "pipe", "(", "gulp", ".", "dest", "(", "'./dist...
5. rewrite type definition file path for adal-angular in adal.service.d.ts
[ "5", ".", "rewrite", "type", "definition", "file", "path", "for", "adal", "-", "angular", "in", "adal", ".", "service", ".", "d", ".", "ts" ]
72794492c6ff3f2be0b96d9394126e53c8e45b5a
https://github.com/benbaran/adal-angular4/blob/72794492c6ff3f2be0b96d9394126e53c8e45b5a/gulpfile.js#L55-L61
train
benbaran/adal-angular4
gulpfile.js
bump_version
function bump_version(cb) { gulp.src('./package.json') .pipe(bump({ type: 'patch' })) .pipe(gulp.dest('./')); console.log('Version Bumped'); cb(); }
javascript
function bump_version(cb) { gulp.src('./package.json') .pipe(bump({ type: 'patch' })) .pipe(gulp.dest('./')); console.log('Version Bumped'); cb(); }
[ "function", "bump_version", "(", "cb", ")", "{", "gulp", ".", "src", "(", "'./package.json'", ")", ".", "pipe", "(", "bump", "(", "{", "type", ":", "'patch'", "}", ")", ")", ".", "pipe", "(", "gulp", ".", "dest", "(", "'./'", ")", ")", ";", "cons...
6. increase the version in package.json
[ "6", ".", "increase", "the", "version", "in", "package", ".", "json" ]
72794492c6ff3f2be0b96d9394126e53c8e45b5a
https://github.com/benbaran/adal-angular4/blob/72794492c6ff3f2be0b96d9394126e53c8e45b5a/gulpfile.js#L64-L72
train
benbaran/adal-angular4
gulpfile.js
git_commit
function git_commit(cb) { var package = require('./package.json'); exec('git commit -m "Version ' + package.version + ' release."', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); cb(err); }); }
javascript
function git_commit(cb) { var package = require('./package.json'); exec('git commit -m "Version ' + package.version + ' release."', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); cb(err); }); }
[ "function", "git_commit", "(", "cb", ")", "{", "var", "package", "=", "require", "(", "'./package.json'", ")", ";", "exec", "(", "'git commit -m \"Version '", "+", "package", ".", "version", "+", "' release.\"'", ",", "function", "(", "err", ",", "stdout", "...
8. git commit
[ "8", ".", "git", "commit" ]
72794492c6ff3f2be0b96d9394126e53c8e45b5a
https://github.com/benbaran/adal-angular4/blob/72794492c6ff3f2be0b96d9394126e53c8e45b5a/gulpfile.js#L84-L91
train
RxNT/react-jsonschema-form-conditionals
src/actions/uiOverride.js
doOverride
function doOverride(uiSchema, params) { Object.keys(params).forEach(field => { let appendVal = params[field]; let fieldUiSchema = uiSchema[field]; if (!fieldUiSchema) { uiSchema[field] = appendVal; } else if (typeof appendVal === "object" && !Array.isArray(appendVal)) { doOverride(fieldUiS...
javascript
function doOverride(uiSchema, params) { Object.keys(params).forEach(field => { let appendVal = params[field]; let fieldUiSchema = uiSchema[field]; if (!fieldUiSchema) { uiSchema[field] = appendVal; } else if (typeof appendVal === "object" && !Array.isArray(appendVal)) { doOverride(fieldUiS...
[ "function", "doOverride", "(", "uiSchema", ",", "params", ")", "{", "Object", ".", "keys", "(", "params", ")", ".", "forEach", "(", "field", "=>", "{", "let", "appendVal", "=", "params", "[", "field", "]", ";", "let", "fieldUiSchema", "=", "uiSchema", ...
Override original field in uiSchema with defined configuration @param field @param schema @param uiSchema @param conf @returns {{schema: *, uiSchema: *}}
[ "Override", "original", "field", "in", "uiSchema", "with", "defined", "configuration" ]
c834a961d45a09ccbe23bfc30d87fee2a2c22aa9
https://github.com/RxNT/react-jsonschema-form-conditionals/blob/c834a961d45a09ccbe23bfc30d87fee2a2c22aa9/src/actions/uiOverride.js#L13-L25
train
RxNT/react-jsonschema-form-conditionals
src/actions/uiAppend.js
doAppend
function doAppend(uiSchema, params) { Object.keys(params).forEach(field => { let appendVal = params[field]; let fieldUiSchema = uiSchema[field]; if (!fieldUiSchema) { uiSchema[field] = appendVal; } else if (Array.isArray(fieldUiSchema)) { toArray(appendVal) .filter(v => !fieldUiSch...
javascript
function doAppend(uiSchema, params) { Object.keys(params).forEach(field => { let appendVal = params[field]; let fieldUiSchema = uiSchema[field]; if (!fieldUiSchema) { uiSchema[field] = appendVal; } else if (Array.isArray(fieldUiSchema)) { toArray(appendVal) .filter(v => !fieldUiSch...
[ "function", "doAppend", "(", "uiSchema", ",", "params", ")", "{", "Object", ".", "keys", "(", "params", ")", ".", "forEach", "(", "field", "=>", "{", "let", "appendVal", "=", "params", "[", "field", "]", ";", "let", "fieldUiSchema", "=", "uiSchema", "[...
Append original field in uiSchema with external configuration @param field @param schema @param uiSchema @param conf @returns {{schema: *, uiSchema: *}}
[ "Append", "original", "field", "in", "uiSchema", "with", "external", "configuration" ]
c834a961d45a09ccbe23bfc30d87fee2a2c22aa9
https://github.com/RxNT/react-jsonschema-form-conditionals/blob/c834a961d45a09ccbe23bfc30d87fee2a2c22aa9/src/actions/uiAppend.js#L14-L34
train
Availity/availity-reactstrap-validation
src/AvValidator/pattern.js
asRegExp
function asRegExp(pattern) { // if regex then return it if (isRegExp(pattern)) { return pattern; } // if string then test for valid regex then convert to regex and return const match = pattern.match(REGEX); if (match) { return new RegExp(match[1], match[2]); } return new RegExp(pattern); }
javascript
function asRegExp(pattern) { // if regex then return it if (isRegExp(pattern)) { return pattern; } // if string then test for valid regex then convert to regex and return const match = pattern.match(REGEX); if (match) { return new RegExp(match[1], match[2]); } return new RegExp(pattern); }
[ "function", "asRegExp", "(", "pattern", ")", "{", "// if regex then return it", "if", "(", "isRegExp", "(", "pattern", ")", ")", "{", "return", "pattern", ";", "}", "// if string then test for valid regex then convert to regex and return", "const", "match", "=", "patter...
regular expression to test a regular expression
[ "regular", "expression", "to", "test", "a", "regular", "expression" ]
cae0221a60b3a02053e13a3946299555d02517e0
https://github.com/Availity/availity-reactstrap-validation/blob/cae0221a60b3a02053e13a3946299555d02517e0/src/AvValidator/pattern.js#L6-L19
train
heroku/heroku-cli-util
lib/styled.js
styledJSON
function styledJSON (obj) { let json = JSON.stringify(obj, null, 2) if (cli.color.enabled) { let cardinal = require('cardinal') let theme = require('cardinal/themes/jq') cli.log(cardinal.highlight(json, {json: true, theme: theme})) } else { cli.log(json) } }
javascript
function styledJSON (obj) { let json = JSON.stringify(obj, null, 2) if (cli.color.enabled) { let cardinal = require('cardinal') let theme = require('cardinal/themes/jq') cli.log(cardinal.highlight(json, {json: true, theme: theme})) } else { cli.log(json) } }
[ "function", "styledJSON", "(", "obj", ")", "{", "let", "json", "=", "JSON", ".", "stringify", "(", "obj", ",", "null", ",", "2", ")", "if", "(", "cli", ".", "color", ".", "enabled", ")", "{", "let", "cardinal", "=", "require", "(", "'cardinal'", ")...
styledJSON prints out colored, indented JSON @example styledHeader({foo: 'bar'}) # Outputs === { "foo": "bar" } @param {obj} object data to display @returns {null}
[ "styledJSON", "prints", "out", "colored", "indented", "JSON" ]
d214cd4279da2cabc39cec6df391696eed735dfd
https://github.com/heroku/heroku-cli-util/blob/d214cd4279da2cabc39cec6df391696eed735dfd/lib/styled.js#L17-L26
train
heroku/heroku-cli-util
lib/styled.js
styledHeader
function styledHeader (header) { cli.log(cli.color.dim('=== ') + cli.color.bold(header)) }
javascript
function styledHeader (header) { cli.log(cli.color.dim('=== ') + cli.color.bold(header)) }
[ "function", "styledHeader", "(", "header", ")", "{", "cli", ".", "log", "(", "cli", ".", "color", ".", "dim", "(", "'=== '", ")", "+", "cli", ".", "color", ".", "bold", "(", "header", ")", ")", "}" ]
styledHeader logs in a consistent header style @example styledHeader('MyApp') # Outputs === MyApp @param {header} header text @returns {null}
[ "styledHeader", "logs", "in", "a", "consistent", "header", "style" ]
d214cd4279da2cabc39cec6df391696eed735dfd
https://github.com/heroku/heroku-cli-util/blob/d214cd4279da2cabc39cec6df391696eed735dfd/lib/styled.js#L37-L39
train
heroku/heroku-cli-util
lib/styled.js
styledObject
function styledObject (obj, keys) { let keyLengths = Object.keys(obj).map(key => key.toString().length) let maxKeyLength = Math.max.apply(Math, keyLengths) + 2 function pp (obj) { if (typeof obj === 'string' || typeof obj === 'number') { return obj } else if (typeof obj === 'object') { return ...
javascript
function styledObject (obj, keys) { let keyLengths = Object.keys(obj).map(key => key.toString().length) let maxKeyLength = Math.max.apply(Math, keyLengths) + 2 function pp (obj) { if (typeof obj === 'string' || typeof obj === 'number') { return obj } else if (typeof obj === 'object') { return ...
[ "function", "styledObject", "(", "obj", ",", "keys", ")", "{", "let", "keyLengths", "=", "Object", ".", "keys", "(", "obj", ")", ".", "map", "(", "key", "=>", "key", ".", "toString", "(", ")", ".", "length", ")", "let", "maxKeyLength", "=", "Math", ...
styledObject logs an object in a consistent columnar style @example styledObject({name: "myapp", collaborators: ["user1@example.com", "user2@example.com"]}) Collaborators: user1@example.com user2@example.com Name: myapp @param {obj} object data to print @param {keys} optional array of keys to sort/filter out...
[ "styledObject", "logs", "an", "object", "in", "a", "consistent", "columnar", "style" ]
d214cd4279da2cabc39cec6df391696eed735dfd
https://github.com/heroku/heroku-cli-util/blob/d214cd4279da2cabc39cec6df391696eed735dfd/lib/styled.js#L54-L82
train
heroku/heroku-cli-util
lib/preauth.js
preauth
function preauth (app, heroku, secondFactor) { return heroku.request({ method: 'PUT', path: `/apps/${app}/pre-authorizations`, headers: { 'Heroku-Two-Factor-Code': secondFactor } }) }
javascript
function preauth (app, heroku, secondFactor) { return heroku.request({ method: 'PUT', path: `/apps/${app}/pre-authorizations`, headers: { 'Heroku-Two-Factor-Code': secondFactor } }) }
[ "function", "preauth", "(", "app", ",", "heroku", ",", "secondFactor", ")", "{", "return", "heroku", ".", "request", "(", "{", "method", ":", "'PUT'", ",", "path", ":", "`", "${", "app", "}", "`", ",", "headers", ":", "{", "'Heroku-Two-Factor-Code'", "...
preauth will make an API call to preauth a user for an app this makes it so the user will not have to enter a 2fa code for the next few minutes on the specified app. You need this if your command is going to make multiple API calls since otherwise the secondFactor key would only work one time for yubikeys. @param {St...
[ "preauth", "will", "make", "an", "API", "call", "to", "preauth", "a", "user", "for", "an", "app", "this", "makes", "it", "so", "the", "user", "will", "not", "have", "to", "enter", "a", "2fa", "code", "for", "the", "next", "few", "minutes", "on", "the...
d214cd4279da2cabc39cec6df391696eed735dfd
https://github.com/heroku/heroku-cli-util/blob/d214cd4279da2cabc39cec6df391696eed735dfd/lib/preauth.js#L18-L24
train
heroku/heroku-cli-util
lib/util.js
promiseOrCallback
function promiseOrCallback (fn) { return function () { if (typeof arguments[arguments.length - 1] === 'function') { let args = Array.prototype.slice.call(arguments) let callback = args.pop() fn.apply(null, args).then(function () { let args = Array.prototype.slice.call(arguments) ...
javascript
function promiseOrCallback (fn) { return function () { if (typeof arguments[arguments.length - 1] === 'function') { let args = Array.prototype.slice.call(arguments) let callback = args.pop() fn.apply(null, args).then(function () { let args = Array.prototype.slice.call(arguments) ...
[ "function", "promiseOrCallback", "(", "fn", ")", "{", "return", "function", "(", ")", "{", "if", "(", "typeof", "arguments", "[", "arguments", ".", "length", "-", "1", "]", "===", "'function'", ")", "{", "let", "args", "=", "Array", ".", "prototype", "...
promiseOrCallback will convert a function that returns a promise into one that will either make a node-style callback or return a promise based on whether or not a callback is passed in. @example prompt('input? ').then(function (input) { // deal with input }) var prompt2 = promiseOrCallback(prompt) prompt('input? ', f...
[ "promiseOrCallback", "will", "convert", "a", "function", "that", "returns", "a", "promise", "into", "one", "that", "will", "either", "make", "a", "node", "-", "style", "callback", "or", "return", "a", "promise", "based", "on", "whether", "or", "not", "a", ...
d214cd4279da2cabc39cec6df391696eed735dfd
https://github.com/heroku/heroku-cli-util/blob/d214cd4279da2cabc39cec6df391696eed735dfd/lib/util.js#L20-L36
train
assetgraph/assetgraph
lib/transforms/subsetFonts.js
groupTextsByFontFamilyProps
function groupTextsByFontFamilyProps( textByPropsArray, availableFontFaceDeclarations ) { const snappedTexts = _.flatMapDeep(textByPropsArray, textAndProps => { const family = textAndProps.props['font-family']; if (family === undefined) { return []; } // Find all the families in the traced ...
javascript
function groupTextsByFontFamilyProps( textByPropsArray, availableFontFaceDeclarations ) { const snappedTexts = _.flatMapDeep(textByPropsArray, textAndProps => { const family = textAndProps.props['font-family']; if (family === undefined) { return []; } // Find all the families in the traced ...
[ "function", "groupTextsByFontFamilyProps", "(", "textByPropsArray", ",", "availableFontFaceDeclarations", ")", "{", "const", "snappedTexts", "=", "_", ".", "flatMapDeep", "(", "textByPropsArray", ",", "textAndProps", "=>", "{", "const", "family", "=", "textAndProps", ...
Takes the output of fontTracer
[ "Takes", "the", "output", "of", "fontTracer" ]
43e00db43619d8fa74eca22d41c87e6f14f03639
https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/transforms/subsetFonts.js#L79-L158
train
assetgraph/assetgraph
lib/transforms/bundleSystemJs.js
getSharedProperties
function getSharedProperties(configA, configB) { const bKeys = Object.keys(configB); return Object.keys(configA).filter(p => bKeys.includes(p)); }
javascript
function getSharedProperties(configA, configB) { const bKeys = Object.keys(configB); return Object.keys(configA).filter(p => bKeys.includes(p)); }
[ "function", "getSharedProperties", "(", "configA", ",", "configB", ")", "{", "const", "bKeys", "=", "Object", ".", "keys", "(", "configB", ")", ";", "return", "Object", ".", "keys", "(", "configA", ")", ".", "filter", "(", "p", "=>", "bKeys", ".", "inc...
meta, packages deep
[ "meta", "packages", "deep" ]
43e00db43619d8fa74eca22d41c87e6f14f03639
https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/transforms/bundleSystemJs.js#L66-L69
train
assetgraph/assetgraph
lib/transforms/bundleSystemJs.js
generateBundleName
function generateBundleName(name, modules, conditionValueOrVariationObject) { // first check if the given modules already matches an existing bundle let existingBundleName; for (const bundleName of Object.keys(bundles)) { const bundleModules = bundles[bundleName].modules; if ( containsM...
javascript
function generateBundleName(name, modules, conditionValueOrVariationObject) { // first check if the given modules already matches an existing bundle let existingBundleName; for (const bundleName of Object.keys(bundles)) { const bundleModules = bundles[bundleName].modules; if ( containsM...
[ "function", "generateBundleName", "(", "name", ",", "modules", ",", "conditionValueOrVariationObject", ")", "{", "// first check if the given modules already matches an existing bundle", "let", "existingBundleName", ";", "for", "(", "const", "bundleName", "of", "Object", ".",...
simple random bundle name generation with duplication avoidance
[ "simple", "random", "bundle", "name", "generation", "with", "duplication", "avoidance" ]
43e00db43619d8fa74eca22d41c87e6f14f03639
https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/transforms/bundleSystemJs.js#L240-L282
train
assetgraph/assetgraph
lib/transforms/bundleSystemJs.js
intersectModules
function intersectModules(modulesA, modulesB) { const intersection = []; for (const module of modulesA) { if (modulesB.includes(module)) { intersection.push(module); } } return intersection; }
javascript
function intersectModules(modulesA, modulesB) { const intersection = []; for (const module of modulesA) { if (modulesB.includes(module)) { intersection.push(module); } } return intersection; }
[ "function", "intersectModules", "(", "modulesA", ",", "modulesB", ")", "{", "const", "intersection", "=", "[", "]", ";", "for", "(", "const", "module", "of", "modulesA", ")", "{", "if", "(", "modulesB", ".", "includes", "(", "module", ")", ")", "{", "i...
intersect two arrays
[ "intersect", "two", "arrays" ]
43e00db43619d8fa74eca22d41c87e6f14f03639
https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/transforms/bundleSystemJs.js#L285-L293
train
assetgraph/assetgraph
lib/transforms/bundleSystemJs.js
subtractModules
function subtractModules(modulesA, modulesB) { const subtracted = []; for (const module of modulesA) { if (!modulesB.includes(module)) { subtracted.push(module); } } return subtracted; }
javascript
function subtractModules(modulesA, modulesB) { const subtracted = []; for (const module of modulesA) { if (!modulesB.includes(module)) { subtracted.push(module); } } return subtracted; }
[ "function", "subtractModules", "(", "modulesA", ",", "modulesB", ")", "{", "const", "subtracted", "=", "[", "]", ";", "for", "(", "const", "module", "of", "modulesA", ")", "{", "if", "(", "!", "modulesB", ".", "includes", "(", "module", ")", ")", "{", ...
remove elements of arrayB from arrayA
[ "remove", "elements", "of", "arrayB", "from", "arrayA" ]
43e00db43619d8fa74eca22d41c87e6f14f03639
https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/transforms/bundleSystemJs.js#L296-L304
train
assetgraph/assetgraph
lib/util/fonts/downloadGoogleFonts.js
downloadGoogleFonts
async function downloadGoogleFonts( fontProps, { formats = ['woff2', 'woff'], fontDisplay = 'swap', text } = {} ) { const sortedFormats = []; for (const format of formatOrder) { if (formats.includes(format)) { sortedFormats.push(format); } } const result = {}; const googleFontId = getGoogl...
javascript
async function downloadGoogleFonts( fontProps, { formats = ['woff2', 'woff'], fontDisplay = 'swap', text } = {} ) { const sortedFormats = []; for (const format of formatOrder) { if (formats.includes(format)) { sortedFormats.push(format); } } const result = {}; const googleFontId = getGoogl...
[ "async", "function", "downloadGoogleFonts", "(", "fontProps", ",", "{", "formats", "=", "[", "'woff2'", ",", "'woff'", "]", ",", "fontDisplay", "=", "'swap'", ",", "text", "}", "=", "{", "}", ")", "{", "const", "sortedFormats", "=", "[", "]", ";", "for...
Download google fonts for self-hosting @async @param {FontProps} fontProps CSS font properties to get font for @param {Object} options @param {String[]} [options.formats=['woff2', 'woff']] List of formats that should be inclued in the output @param {String} [options.fontDisplay='swap'] CSS font-display value in re...
[ "Download", "google", "fonts", "for", "self", "-", "hosting" ]
43e00db43619d8fa74eca22d41c87e6f14f03639
https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/util/fonts/downloadGoogleFonts.js#L43-L112
train
assetgraph/assetgraph
lib/util/fonts/findCustomPropertyDefinitions.js
findCustomPropertyDefinitions
function findCustomPropertyDefinitions(cssAssets) { const definitionsByProp = {}; const incomingReferencesByProp = {}; for (const cssAsset of cssAssets) { cssAsset.eachRuleInParseTree(cssRule => { if ( cssRule.parent.type === 'rule' && cssRule.type === 'decl' && /^--/.test(cssRul...
javascript
function findCustomPropertyDefinitions(cssAssets) { const definitionsByProp = {}; const incomingReferencesByProp = {}; for (const cssAsset of cssAssets) { cssAsset.eachRuleInParseTree(cssRule => { if ( cssRule.parent.type === 'rule' && cssRule.type === 'decl' && /^--/.test(cssRul...
[ "function", "findCustomPropertyDefinitions", "(", "cssAssets", ")", "{", "const", "definitionsByProp", "=", "{", "}", ";", "const", "incomingReferencesByProp", "=", "{", "}", ";", "for", "(", "const", "cssAsset", "of", "cssAssets", ")", "{", "cssAsset", ".", "...
Find all custom property definitions grouped by the custom properties they contribute to
[ "Find", "all", "custom", "property", "definitions", "grouped", "by", "the", "custom", "properties", "they", "contribute", "to" ]
43e00db43619d8fa74eca22d41c87e6f14f03639
https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/util/fonts/findCustomPropertyDefinitions.js#L4-L52
train
assetgraph/assetgraph
lib/transforms/inlineAssetsPerQueryString.js
getMinimumIeVersionUsage
function getMinimumIeVersionUsage(asset, stack = []) { if (asset.type === 'Html') { return 1; } if (minimumIeVersionByAsset.has(asset)) { return minimumIeVersionByAsset.get(asset); } stack.push(asset); const minimumIeVersion = Math.min( ...asset.incomingRelati...
javascript
function getMinimumIeVersionUsage(asset, stack = []) { if (asset.type === 'Html') { return 1; } if (minimumIeVersionByAsset.has(asset)) { return minimumIeVersionByAsset.get(asset); } stack.push(asset); const minimumIeVersion = Math.min( ...asset.incomingRelati...
[ "function", "getMinimumIeVersionUsage", "(", "asset", ",", "stack", "=", "[", "]", ")", "{", "if", "(", "asset", ".", "type", "===", "'Html'", ")", "{", "return", "1", ";", "}", "if", "(", "minimumIeVersionByAsset", ".", "has", "(", "asset", ")", ")", ...
Asset => minimumIeVersion
[ "Asset", "=", ">", "minimumIeVersion" ]
43e00db43619d8fa74eca22d41c87e6f14f03639
https://github.com/assetgraph/assetgraph/blob/43e00db43619d8fa74eca22d41c87e6f14f03639/lib/transforms/inlineAssetsPerQueryString.js#L20-L61
train
mixmaxhq/mongo-cursor-pagination
src/utils/resolveFields.js
fieldsFromMongo
function fieldsFromMongo(projection = {}, includeIdDefault = false) { const fields = _.reduce(projection, (memo, value, key) => { if (key !== '_id' && value !== undefined && !value) { throw new TypeError('projection includes exclusion, but we do not support that'); } if (value || (key === '_id' && v...
javascript
function fieldsFromMongo(projection = {}, includeIdDefault = false) { const fields = _.reduce(projection, (memo, value, key) => { if (key !== '_id' && value !== undefined && !value) { throw new TypeError('projection includes exclusion, but we do not support that'); } if (value || (key === '_id' && v...
[ "function", "fieldsFromMongo", "(", "projection", "=", "{", "}", ",", "includeIdDefault", "=", "false", ")", "{", "const", "fields", "=", "_", ".", "reduce", "(", "projection", ",", "(", "memo", ",", "value", ",", "key", ")", "=>", "{", "if", "(", "k...
Produce a ProjectionFieldSet from the given mongo projection, after validating it to ensure it doesn't have exclusion rules. @param {Object<String, *>} projection The projected fields. @param {Boolean=} includeIdDefault Whether to include _id by default (mongo's default behavior). @returns {ProjectionFieldSet} The syn...
[ "Produce", "a", "ProjectionFieldSet", "from", "the", "given", "mongo", "projection", "after", "validating", "it", "to", "ensure", "it", "doesn", "t", "have", "exclusion", "rules", "." ]
fa7d2c81012cd0cd08c9338e86bcbfa242f7dd42
https://github.com/mixmaxhq/mongo-cursor-pagination/blob/fa7d2c81012cd0cd08c9338e86bcbfa242f7dd42/src/utils/resolveFields.js#L12-L25
train
mixmaxhq/mongo-cursor-pagination
src/utils/resolveFields.js
resolveFields
function resolveFields(desiredFields, allowedFields, overrideFields) { if (desiredFields != null && !Array.isArray(desiredFields)) { throw new TypeError('expected nullable array for desiredFields'); } if (allowedFields != null && !_.isObject(allowedFields)) { throw new TypeError('expected nullable plain ...
javascript
function resolveFields(desiredFields, allowedFields, overrideFields) { if (desiredFields != null && !Array.isArray(desiredFields)) { throw new TypeError('expected nullable array for desiredFields'); } if (allowedFields != null && !_.isObject(allowedFields)) { throw new TypeError('expected nullable plain ...
[ "function", "resolveFields", "(", "desiredFields", ",", "allowedFields", ",", "overrideFields", ")", "{", "if", "(", "desiredFields", "!=", "null", "&&", "!", "Array", ".", "isArray", "(", "desiredFields", ")", ")", "{", "throw", "new", "TypeError", "(", "'e...
Resolve the fields object, given potentially untrusted fields the user has provided, permitted fields defined by the application, and override fields that should always be provided. @param {String[]} desiredFields The fields in the request. @param {?Object<String, *>=} allowedFields A shallow fields object defining th...
[ "Resolve", "the", "fields", "object", "given", "potentially", "untrusted", "fields", "the", "user", "has", "provided", "permitted", "fields", "defined", "by", "the", "application", "and", "override", "fields", "that", "should", "always", "be", "provided", "." ]
fa7d2c81012cd0cd08c9338e86bcbfa242f7dd42
https://github.com/mixmaxhq/mongo-cursor-pagination/blob/fa7d2c81012cd0cd08c9338e86bcbfa242f7dd42/src/utils/resolveFields.js#L38-L85
train
MitocGroup/deep-framework
src/deep-validation/lib/Helpers/vogelsPolyfill.js
_joiVector
function _joiVector(proto) { let arr = Joi.array(); if (arr.includes) { return arr.includes(proto); } return arr.items(proto); }
javascript
function _joiVector(proto) { let arr = Joi.array(); if (arr.includes) { return arr.includes(proto); } return arr.items(proto); }
[ "function", "_joiVector", "(", "proto", ")", "{", "let", "arr", "=", "Joi", ".", "array", "(", ")", ";", "if", "(", "arr", ".", "includes", ")", "{", "return", "arr", ".", "includes", "(", "proto", ")", ";", "}", "return", "arr", ".", "items", "(...
Fixes weird joi exception! @param {Object} proto @returns {Object} @private
[ "Fixes", "weird", "joi", "exception!" ]
f13b01efefedb3701d10d33138224574dc3189b9
https://github.com/MitocGroup/deep-framework/blob/f13b01efefedb3701d10d33138224574dc3189b9/src/deep-validation/lib/Helpers/vogelsPolyfill.js#L18-L26
train
MitocGroup/deep-framework
src/deep-core/lib/Generic/require1k.js
deepLoad
function deepLoad(module, callback, parentLocation, id) { // If this module is already loading then don't proceed. // This is a bug. // If a module is requested but not loaded then the module isn't ready, // but we callback as if it is. Oh well, 1k! if (module.g) { return callback(module.e, mo...
javascript
function deepLoad(module, callback, parentLocation, id) { // If this module is already loading then don't proceed. // This is a bug. // If a module is requested but not loaded then the module isn't ready, // but we callback as if it is. Oh well, 1k! if (module.g) { return callback(module.e, mo...
[ "function", "deepLoad", "(", "module", ",", "callback", ",", "parentLocation", ",", "id", ")", "{", "// If this module is already loading then don't proceed.", "// This is a bug.", "// If a module is requested but not loaded then the module isn't ready,", "// but we callback as if it i...
Loads the given module and all of it dependencies, recursively - module The module object - callback Called when everything has been loaded - parentLocation Location of the parent directory to look in. Only given for non-relative dependencies - id The name of the dependency. Only used for non-...
[ "Loads", "the", "given", "module", "and", "all", "of", "it", "dependencies", "recursively", "-", "module", "The", "module", "object", "-", "callback", "Called", "when", "everything", "has", "been", "loaded", "-", "parentLocation", "Location", "of", "the", "par...
f13b01efefedb3701d10d33138224574dc3189b9
https://github.com/MitocGroup/deep-framework/blob/f13b01efefedb3701d10d33138224574dc3189b9/src/deep-core/lib/Generic/require1k.js#L44-L112
train
MitocGroup/deep-framework
src/deep-core/lib/Generic/require1k.js
resolveModuleOrGetExports
function resolveModuleOrGetExports(baseOrModule, relative, resolved) { // This should really be after the relative check, but because we are // `throw`ing, it messes up the optimizations. If we are being called // as resolveModule then the string `base` won't have the `e` property, // so we're fine. ...
javascript
function resolveModuleOrGetExports(baseOrModule, relative, resolved) { // This should really be after the relative check, but because we are // `throw`ing, it messes up the optimizations. If we are being called // as resolveModule then the string `base` won't have the `e` property, // so we're fine. ...
[ "function", "resolveModuleOrGetExports", "(", "baseOrModule", ",", "relative", ",", "resolved", ")", "{", "// This should really be after the relative check, but because we are", "// `throw`ing, it messes up the optimizations. If we are being called", "// as resolveModule then the string `ba...
Save bytes by combining two functions - resolveModule which resolves a given relative path against the given base, and returns an existing or new module object - getExports which returns the existing exports or runs the factory to create the exports for a module
[ "Save", "bytes", "by", "combining", "two", "functions", "-", "resolveModule", "which", "resolves", "a", "given", "relative", "path", "against", "the", "given", "base", "and", "returns", "an", "existing", "or", "new", "module", "object", "-", "getExports", "whi...
f13b01efefedb3701d10d33138224574dc3189b9
https://github.com/MitocGroup/deep-framework/blob/f13b01efefedb3701d10d33138224574dc3189b9/src/deep-core/lib/Generic/require1k.js#L119-L161
train
generate/generate
index.js
Generate
function Generate(options) { if (!(this instanceof Generate)) { return new Generate(options); } Assemble.call(this, options); this.is('generate'); this.initGenerate(this.options); if (!setArgs) { setArgs = true; this.base.option(utils.argv); } }
javascript
function Generate(options) { if (!(this instanceof Generate)) { return new Generate(options); } Assemble.call(this, options); this.is('generate'); this.initGenerate(this.options); if (!setArgs) { setArgs = true; this.base.option(utils.argv); } }
[ "function", "Generate", "(", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Generate", ")", ")", "{", "return", "new", "Generate", "(", "options", ")", ";", "}", "Assemble", ".", "call", "(", "this", ",", "options", ")", ";", "this"...
Create an instance of `Generate` with the given `options` ```js var Generate = require('generate'); var generate = new Generate(); ``` @param {Object} `options` Settings to initialize with. @api public
[ "Create", "an", "instance", "of", "Generate", "with", "the", "given", "options" ]
63ab3cf87a61d83806d81541c27308da294c15e8
https://github.com/generate/generate/blob/63ab3cf87a61d83806d81541c27308da294c15e8/index.js#L29-L42
train
nylas/nylas-nodejs
example/webhooks/index.js
verify_nylas_request
function verify_nylas_request(req) { const digest = crypto .createHmac('sha256', config.nylasClientSecret) .update(req.rawBody) .digest('hex'); return digest === req.get('x-nylas-signature'); }
javascript
function verify_nylas_request(req) { const digest = crypto .createHmac('sha256', config.nylasClientSecret) .update(req.rawBody) .digest('hex'); return digest === req.get('x-nylas-signature'); }
[ "function", "verify_nylas_request", "(", "req", ")", "{", "const", "digest", "=", "crypto", ".", "createHmac", "(", "'sha256'", ",", "config", ".", "nylasClientSecret", ")", ".", "update", "(", "req", ".", "rawBody", ")", ".", "digest", "(", "'hex'", ")", ...
Each request made by Nylas includes an X-Nylas-Signature header. The header contains the HMAC-SHA256 signature of the request body, using your client secret as the signing key. This allows your app to verify that the notification really came from Nylas.
[ "Each", "request", "made", "by", "Nylas", "includes", "an", "X", "-", "Nylas", "-", "Signature", "header", ".", "The", "header", "contains", "the", "HMAC", "-", "SHA256", "signature", "of", "the", "request", "body", "using", "your", "client", "secret", "as...
a562be663d135562b44b1d6faf61d518859d16d0
https://github.com/nylas/nylas-nodejs/blob/a562be663d135562b44b1d6faf61d518859d16d0/example/webhooks/index.js#L64-L70
train
AllenWooooo/rc-datetime-picker
build/build.js
buildUmdDev
function buildUmdDev() { return rollup.rollup({ entry: 'src/index.js', plugins: [ babel(babelOptions) ] }).then(function (bundle) { bundle.generate({ format: 'umd', banner: banner, name: 'rc-datetime-picker' }).then(({ code }) => { return write('dist/rc-datetime-pic...
javascript
function buildUmdDev() { return rollup.rollup({ entry: 'src/index.js', plugins: [ babel(babelOptions) ] }).then(function (bundle) { bundle.generate({ format: 'umd', banner: banner, name: 'rc-datetime-picker' }).then(({ code }) => { return write('dist/rc-datetime-pic...
[ "function", "buildUmdDev", "(", ")", "{", "return", "rollup", ".", "rollup", "(", "{", "entry", ":", "'src/index.js'", ",", "plugins", ":", "[", "babel", "(", "babelOptions", ")", "]", "}", ")", ".", "then", "(", "function", "(", "bundle", ")", "{", ...
Standalone development build
[ "Standalone", "development", "build" ]
3cb7b3e4a595047ddac5332ecc055a25187a055a
https://github.com/AllenWooooo/rc-datetime-picker/blob/3cb7b3e4a595047ddac5332ecc055a25187a055a/build/build.js#L55-L70
train
nieldlr/hanzi
lib/dictionary.js
determineFreqCategories
function determineFreqCategories() { if (mean - sd < 0) { var lowrange = 0 + mean / 3; } else { var lowrange = mean - sd; } var midrange = [mean + sd, lowrange]; var highrange = mean + sd; var i = 0; for (; i < potentialexamples.length; i++) { var word = potentialexamples[...
javascript
function determineFreqCategories() { if (mean - sd < 0) { var lowrange = 0 + mean / 3; } else { var lowrange = mean - sd; } var midrange = [mean + sd, lowrange]; var highrange = mean + sd; var i = 0; for (; i < potentialexamples.length; i++) { var word = potentialexamples[...
[ "function", "determineFreqCategories", "(", ")", "{", "if", "(", "mean", "-", "sd", "<", "0", ")", "{", "var", "lowrange", "=", "0", "+", "mean", "/", "3", ";", "}", "else", "{", "var", "lowrange", "=", "mean", "-", "sd", ";", "}", "var", "midran...
Create frequency categories
[ "Create", "frequency", "categories" ]
8b80e6d85130c9412117dbc41802cf6add3a74a3
https://github.com/nieldlr/hanzi/blob/8b80e6d85130c9412117dbc41802cf6add3a74a3/lib/dictionary.js#L202-L234
train
Kitware/paraviewweb
src/IO/Core/DataManager/request.js
makeRequest
function makeRequest(url, handler) { const xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.responseType = handler.type; xhr.onload = function onLoad(e) { if (this.status === 200 || this.status === 0) { handler.fn(null, xhr); return; } handler.fn(e, xhr); }; xhr.onerror ...
javascript
function makeRequest(url, handler) { const xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.responseType = handler.type; xhr.onload = function onLoad(e) { if (this.status === 200 || this.status === 0) { handler.fn(null, xhr); return; } handler.fn(e, xhr); }; xhr.onerror ...
[ "function", "makeRequest", "(", "url", ",", "handler", ")", "{", "const", "xhr", "=", "new", "XMLHttpRequest", "(", ")", ";", "xhr", ".", "open", "(", "'GET'", ",", "url", ",", "true", ")", ";", "xhr", ".", "responseType", "=", "handler", ".", "type"...
Generic request handler
[ "Generic", "request", "handler" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/IO/Core/DataManager/request.js#L2-L19
train
Kitware/paraviewweb
src/IO/Core/DataManager/request.js
arraybufferHandler
function arraybufferHandler(callback) { return { type: 'arraybuffer', fn: (error, xhrObject) => { if (error) { callback(error); return; } callback(null, xhrObject.response); }, }; }
javascript
function arraybufferHandler(callback) { return { type: 'arraybuffer', fn: (error, xhrObject) => { if (error) { callback(error); return; } callback(null, xhrObject.response); }, }; }
[ "function", "arraybufferHandler", "(", "callback", ")", "{", "return", "{", "type", ":", "'arraybuffer'", ",", "fn", ":", "(", "error", ",", "xhrObject", ")", "=>", "{", "if", "(", "error", ")", "{", "callback", "(", "error", ")", ";", "return", ";", ...
Array buffer handler
[ "Array", "buffer", "handler" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/IO/Core/DataManager/request.js#L22-L33
train
Kitware/paraviewweb
src/Common/Misc/WebGl/index.js
showGlInfo
function showGlInfo(gl) { const vertexUnits = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS); const fragmentUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); const combinedUnits = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS); console.log('vertex texture image units:', vertexUnits); console.log(...
javascript
function showGlInfo(gl) { const vertexUnits = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS); const fragmentUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS); const combinedUnits = gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS); console.log('vertex texture image units:', vertexUnits); console.log(...
[ "function", "showGlInfo", "(", "gl", ")", "{", "const", "vertexUnits", "=", "gl", ".", "getParameter", "(", "gl", ".", "MAX_VERTEX_TEXTURE_IMAGE_UNITS", ")", ";", "const", "fragmentUnits", "=", "gl", ".", "getParameter", "(", "gl", ".", "MAX_TEXTURE_IMAGE_UNITS"...
Show GL informations
[ "Show", "GL", "informations" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Misc/WebGl/index.js#L2-L9
train
Kitware/paraviewweb
src/Common/Misc/WebGl/index.js
compileShader
function compileShader(gl, src, type) { const shader = gl.createShader(type); gl.shaderSource(shader, src); // Compile and check status gl.compileShader(shader); if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { // Something went wrong during compilation; get the error const lastError = gl.ge...
javascript
function compileShader(gl, src, type) { const shader = gl.createShader(type); gl.shaderSource(shader, src); // Compile and check status gl.compileShader(shader); if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { // Something went wrong during compilation; get the error const lastError = gl.ge...
[ "function", "compileShader", "(", "gl", ",", "src", ",", "type", ")", "{", "const", "shader", "=", "gl", ".", "createShader", "(", "type", ")", ";", "gl", ".", "shaderSource", "(", "shader", ",", "src", ")", ";", "// Compile and check status", "gl", ".",...
Compile a shader
[ "Compile", "a", "shader" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Misc/WebGl/index.js#L12-L29
train
Kitware/paraviewweb
src/Common/Misc/WebGl/index.js
applyProgramDataMapping
function applyProgramDataMapping( gl, programName, mappingName, glConfig, glResources ) { const program = glResources.programs[programName]; const mapping = glConfig.mappings[mappingName]; mapping.forEach((bufferMapping) => { const glBuffer = glResources.buffers[bufferMapping.id]; gl.bindBuffe...
javascript
function applyProgramDataMapping( gl, programName, mappingName, glConfig, glResources ) { const program = glResources.programs[programName]; const mapping = glConfig.mappings[mappingName]; mapping.forEach((bufferMapping) => { const glBuffer = glResources.buffers[bufferMapping.id]; gl.bindBuffe...
[ "function", "applyProgramDataMapping", "(", "gl", ",", "programName", ",", "mappingName", ",", "glConfig", ",", "glResources", ")", "{", "const", "program", "=", "glResources", ".", "programs", "[", "programName", "]", ";", "const", "mapping", "=", "glConfig", ...
Apply new mapping to a program
[ "Apply", "new", "mapping", "to", "a", "program" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Misc/WebGl/index.js#L59-L89
train
Kitware/paraviewweb
src/Common/Misc/WebGl/index.js
bindTextureToFramebuffer
function bindTextureToFramebuffer(gl, fbo, texture) { gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); gl.bindTexture(gl.TEXTURE_2D, texture); gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, fbo.width, fbo.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null ); gl.framebufferTexture2D( gl.FR...
javascript
function bindTextureToFramebuffer(gl, fbo, texture) { gl.bindFramebuffer(gl.FRAMEBUFFER, fbo); gl.bindTexture(gl.TEXTURE_2D, texture); gl.texImage2D( gl.TEXTURE_2D, 0, gl.RGBA, fbo.width, fbo.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null ); gl.framebufferTexture2D( gl.FR...
[ "function", "bindTextureToFramebuffer", "(", "gl", ",", "fbo", ",", "texture", ")", "{", "gl", ".", "bindFramebuffer", "(", "gl", ".", "FRAMEBUFFER", ",", "fbo", ")", ";", "gl", ".", "bindTexture", "(", "gl", ".", "TEXTURE_2D", ",", "texture", ")", ";", ...
Bind texture to Framebuffer
[ "Bind", "texture", "to", "Framebuffer" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Misc/WebGl/index.js#L122-L155
train
Kitware/paraviewweb
src/Common/Misc/WebGl/index.js
freeGLResources
function freeGLResources(glResources) { const gl = glResources.gl; // Delete each program Object.keys(glResources.programs).forEach((programName) => { const program = glResources.programs[programName]; const shaders = program.shaders; let count = shaders.length; // Delete shaders while (cou...
javascript
function freeGLResources(glResources) { const gl = glResources.gl; // Delete each program Object.keys(glResources.programs).forEach((programName) => { const program = glResources.programs[programName]; const shaders = program.shaders; let count = shaders.length; // Delete shaders while (cou...
[ "function", "freeGLResources", "(", "glResources", ")", "{", "const", "gl", "=", "glResources", ".", "gl", ";", "// Delete each program", "Object", ".", "keys", "(", "glResources", ".", "programs", ")", ".", "forEach", "(", "(", "programName", ")", "=>", "{"...
Free GL resources
[ "Free", "GL", "resources" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Misc/WebGl/index.js#L158-L192
train
Kitware/paraviewweb
src/Common/Misc/WebGl/index.js
createGLResources
function createGLResources(gl, glConfig) { const resources = { gl, buffers: {}, textures: {}, framebuffers: {}, programs: {}, }; const buffers = glConfig.resources.buffers || []; const textures = glConfig.resources.textures || []; const framebuffers = glConfig.resources.framebuffers || [];...
javascript
function createGLResources(gl, glConfig) { const resources = { gl, buffers: {}, textures: {}, framebuffers: {}, programs: {}, }; const buffers = glConfig.resources.buffers || []; const textures = glConfig.resources.textures || []; const framebuffers = glConfig.resources.framebuffers || [];...
[ "function", "createGLResources", "(", "gl", ",", "glConfig", ")", "{", "const", "resources", "=", "{", "gl", ",", "buffers", ":", "{", "}", ",", "textures", ":", "{", "}", ",", "framebuffers", ":", "{", "}", ",", "programs", ":", "{", "}", ",", "}"...
Create GL resources
[ "Create", "GL", "resources" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Misc/WebGl/index.js#L195-L254
train
Kitware/paraviewweb
src/InfoViz/Native/HistogramSelector/index.js
styleRows
function styleRows(selection, self) { selection .classed(style.row, true) .style('height', `${self.rowHeight}px`) .style( transformCSSProp, (d, i) => `translate3d(0,${d.key * self.rowHeight}px,0)` ); }
javascript
function styleRows(selection, self) { selection .classed(style.row, true) .style('height', `${self.rowHeight}px`) .style( transformCSSProp, (d, i) => `translate3d(0,${d.key * self.rowHeight}px,0)` ); }
[ "function", "styleRows", "(", "selection", ",", "self", ")", "{", "selection", ".", "classed", "(", "style", ".", "row", ",", "true", ")", ".", "style", "(", "'height'", ",", "`", "${", "self", ".", "rowHeight", "}", "`", ")", ".", "style", "(", "t...
Apply our desired attributes to the grid rows
[ "Apply", "our", "desired", "attributes", "to", "the", "grid", "rows" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/InfoViz/Native/HistogramSelector/index.js#L81-L89
train
Kitware/paraviewweb
src/InfoViz/Native/HistogramSelector/index.js
styleBoxes
function styleBoxes(selection, self) { selection .style('width', `${self.boxWidth}px`) .style('height', `${self.boxHeight}px`); // .style('margin', `${self.boxMargin / 2}px`) }
javascript
function styleBoxes(selection, self) { selection .style('width', `${self.boxWidth}px`) .style('height', `${self.boxHeight}px`); // .style('margin', `${self.boxMargin / 2}px`) }
[ "function", "styleBoxes", "(", "selection", ",", "self", ")", "{", "selection", ".", "style", "(", "'width'", ",", "`", "${", "self", ".", "boxWidth", "}", "`", ")", ".", "style", "(", "'height'", ",", "`", "${", "self", ".", "boxHeight", "}", "`", ...
apply our desired attributes to the boxes of a row
[ "apply", "our", "desired", "attributes", "to", "the", "boxes", "of", "a", "row" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/InfoViz/Native/HistogramSelector/index.js#L92-L97
train
Kitware/paraviewweb
src/InfoViz/Native/HistogramSelector/index.js
getFieldRow
function getFieldRow(name) { if (model.nest === null) return 0; const foundRow = model.nest.reduce((prev, item, i) => { const val = item.value.filter((def) => def.name === name); if (val.length > 0) { return item.key; } return prev; }, 0); return foundRow; }
javascript
function getFieldRow(name) { if (model.nest === null) return 0; const foundRow = model.nest.reduce((prev, item, i) => { const val = item.value.filter((def) => def.name === name); if (val.length > 0) { return item.key; } return prev; }, 0); return foundRow; }
[ "function", "getFieldRow", "(", "name", ")", "{", "if", "(", "model", ".", "nest", "===", "null", ")", "return", "0", ";", "const", "foundRow", "=", "model", ".", "nest", ".", "reduce", "(", "(", "prev", ",", "item", ",", "i", ")", "=>", "{", "co...
which row of model.nest does this field name reside in?
[ "which", "row", "of", "model", ".", "nest", "does", "this", "field", "name", "reside", "in?" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/InfoViz/Native/HistogramSelector/index.js#L161-L171
train
Kitware/paraviewweb
src/InfoViz/Native/MutualInformationDiagram/index.js
updateStatusBarVisibility
function updateStatusBarVisibility() { const cntnr = d3.select(model.container); if (model.statusBarVisible) { cntnr .select('.status-bar-container') .style('width', function updateWidth() { return this.dataset.width; }); cntnr.select('.show-button').classed(style.h...
javascript
function updateStatusBarVisibility() { const cntnr = d3.select(model.container); if (model.statusBarVisible) { cntnr .select('.status-bar-container') .style('width', function updateWidth() { return this.dataset.width; }); cntnr.select('.show-button').classed(style.h...
[ "function", "updateStatusBarVisibility", "(", ")", "{", "const", "cntnr", "=", "d3", ".", "select", "(", "model", ".", "container", ")", ";", "if", "(", "model", ".", "statusBarVisible", ")", "{", "cntnr", ".", "select", "(", "'.status-bar-container'", ")", ...
Handle style for status bar
[ "Handle", "style", "for", "status", "bar" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/InfoViz/Native/MutualInformationDiagram/index.js#L58-L75
train
Kitware/paraviewweb
src/InfoViz/Native/MutualInformationDiagram/index.js
singleClick
function singleClick(d, i) { // single click handler const overCoords = d3.mouse(model.container); const info = findGroupAndBin(overCoords); if (info.radius > veryOutermostRadius) { showAllChords(); } else if ( info.radius > outerRadius || ...
javascript
function singleClick(d, i) { // single click handler const overCoords = d3.mouse(model.container); const info = findGroupAndBin(overCoords); if (info.radius > veryOutermostRadius) { showAllChords(); } else if ( info.radius > outerRadius || ...
[ "function", "singleClick", "(", "d", ",", "i", ")", "{", "// single click handler", "const", "overCoords", "=", "d3", ".", "mouse", "(", "model", ".", "container", ")", ";", "const", "info", "=", "findGroupAndBin", "(", "overCoords", ")", ";", "if", "(", ...
multiClicker([
[ "multiClicker", "(", "[" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/InfoViz/Native/MutualInformationDiagram/index.js#L748-L773
train
Kitware/paraviewweb
src/Common/Core/CompositeClosureHelper/index.js
flushDataToListener
function flushDataToListener(dataListener, dataChanged) { try { if (dataListener) { const dataToForward = dataHandler.get( model[dataContainerName], dataListener.request, dataChanged ); if ( dataToForward && (JSON.stringify(dataToForwar...
javascript
function flushDataToListener(dataListener, dataChanged) { try { if (dataListener) { const dataToForward = dataHandler.get( model[dataContainerName], dataListener.request, dataChanged ); if ( dataToForward && (JSON.stringify(dataToForwar...
[ "function", "flushDataToListener", "(", "dataListener", ",", "dataChanged", ")", "{", "try", "{", "if", "(", "dataListener", ")", "{", "const", "dataToForward", "=", "dataHandler", ".", "get", "(", "model", "[", "dataContainerName", "]", ",", "dataListener", "...
Internal function that will notify any subscriber with its data in a synchronous manner
[ "Internal", "function", "that", "will", "notify", "any", "subscriber", "with", "its", "data", "in", "a", "synchronous", "manner" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/Common/Core/CompositeClosureHelper/index.js#L269-L289
train
Kitware/paraviewweb
src/React/Containers/OverlayWindow/index.js
getMouseEventInfo
function getMouseEventInfo(event, divElt) { const clientRect = divElt.getBoundingClientRect(); return { relX: event.clientX - clientRect.left, relY: event.clientY - clientRect.top, eltBounds: clientRect, }; }
javascript
function getMouseEventInfo(event, divElt) { const clientRect = divElt.getBoundingClientRect(); return { relX: event.clientX - clientRect.left, relY: event.clientY - clientRect.top, eltBounds: clientRect, }; }
[ "function", "getMouseEventInfo", "(", "event", ",", "divElt", ")", "{", "const", "clientRect", "=", "divElt", ".", "getBoundingClientRect", "(", ")", ";", "return", "{", "relX", ":", "event", ".", "clientX", "-", "clientRect", ".", "left", ",", "relY", ":"...
Return extra information about the target element bounds
[ "Return", "extra", "information", "about", "the", "target", "element", "bounds" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/React/Containers/OverlayWindow/index.js#L19-L26
train
Kitware/paraviewweb
src/React/Widgets/SelectionEditorWidget/rule/index.js
ensureRuleNumbers
function ensureRuleNumbers(rule) { if (!rule || rule.length === 0) { return; } const ruleSelector = rule.type; if (ruleSelector === 'rule') { ensureRuleNumbers(rule.rule); } if (ruleSelector === 'logical') { rule.terms.filter((r, idx) => idx > 0).forEach((r) => ensureRuleNumbers(r)); } if ...
javascript
function ensureRuleNumbers(rule) { if (!rule || rule.length === 0) { return; } const ruleSelector = rule.type; if (ruleSelector === 'rule') { ensureRuleNumbers(rule.rule); } if (ruleSelector === 'logical') { rule.terms.filter((r, idx) => idx > 0).forEach((r) => ensureRuleNumbers(r)); } if ...
[ "function", "ensureRuleNumbers", "(", "rule", ")", "{", "if", "(", "!", "rule", "||", "rule", ".", "length", "===", "0", ")", "{", "return", ";", "}", "const", "ruleSelector", "=", "rule", ".", "type", ";", "if", "(", "ruleSelector", "===", "'rule'", ...
Edit in place
[ "Edit", "in", "place" ]
ebff9dbeefee70225c349077e25280c56d39920e
https://github.com/Kitware/paraviewweb/blob/ebff9dbeefee70225c349077e25280c56d39920e/src/React/Widgets/SelectionEditorWidget/rule/index.js#L27-L45
train
CartoDB/odyssey.js
lib/odyssey/template.js
md2json
function md2json(tree) { var slide = null; var slides = []; var globalProperties = {} var elements = tree.slice(1); for (var i = 0; i < elements.length; ++i) { var el = elements[i]; var add = true; if (el[0] === 'header' && el[1].level === 1) { if (slide) slides.push(Slide(slide.md_tree, sli...
javascript
function md2json(tree) { var slide = null; var slides = []; var globalProperties = {} var elements = tree.slice(1); for (var i = 0; i < elements.length; ++i) { var el = elements[i]; var add = true; if (el[0] === 'header' && el[1].level === 1) { if (slide) slides.push(Slide(slide.md_tree, sli...
[ "function", "md2json", "(", "tree", ")", "{", "var", "slide", "=", "null", ";", "var", "slides", "=", "[", "]", ";", "var", "globalProperties", "=", "{", "}", "var", "elements", "=", "tree", ".", "slice", "(", "1", ")", ";", "for", "(", "var", "i...
given a markdown parsed tree return a list of slides with html and actions
[ "given", "a", "markdown", "parsed", "tree", "return", "a", "list", "of", "slides", "with", "html", "and", "actions" ]
59e194e8cf18154d095f004e01f955b6af9348f9
https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/lib/odyssey/template.js#L239-L302
train
CartoDB/odyssey.js
sandbox/dialog.js
addAction
function addAction(codemirror, slideNumer, action) { // parse properties from the new actions to next compare with // the current ones in the slide var currentActions = O.Template.parseProperties(action); var currentLine; var c = 0; var blockStart; // search for a actions block for (var...
javascript
function addAction(codemirror, slideNumer, action) { // parse properties from the new actions to next compare with // the current ones in the slide var currentActions = O.Template.parseProperties(action); var currentLine; var c = 0; var blockStart; // search for a actions block for (var...
[ "function", "addAction", "(", "codemirror", ",", "slideNumer", ",", "action", ")", "{", "// parse properties from the new actions to next compare with", "// the current ones in the slide", "var", "currentActions", "=", "O", ".", "Template", ".", "parseProperties", "(", "act...
adds action to slideNumber. creates it if the slide does not have any action
[ "adds", "action", "to", "slideNumber", ".", "creates", "it", "if", "the", "slide", "does", "not", "have", "any", "action" ]
59e194e8cf18154d095f004e01f955b6af9348f9
https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/sandbox/dialog.js#L330-L381
train
CartoDB/odyssey.js
sandbox/dialog.js
placeActionButtons
function placeActionButtons(el, codemirror) { // search for h1's var positions = []; var lineNumber = 0; codemirror.eachLine(function(a) { if (SLIDE_REGEXP.exec(a.text)) { positions.push({ pos: codemirror.heightAtLine(lineNumber)-66, // header height line: lineNumbe...
javascript
function placeActionButtons(el, codemirror) { // search for h1's var positions = []; var lineNumber = 0; codemirror.eachLine(function(a) { if (SLIDE_REGEXP.exec(a.text)) { positions.push({ pos: codemirror.heightAtLine(lineNumber)-66, // header height line: lineNumbe...
[ "function", "placeActionButtons", "(", "el", ",", "codemirror", ")", "{", "// search for h1's", "var", "positions", "=", "[", "]", ";", "var", "lineNumber", "=", "0", ";", "codemirror", ".", "eachLine", "(", "function", "(", "a", ")", "{", "if", "(", "SL...
place actions buttons on the left of the beggining of each slide
[ "place", "actions", "buttons", "on", "the", "left", "of", "the", "beggining", "of", "each", "slide" ]
59e194e8cf18154d095f004e01f955b6af9348f9
https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/sandbox/dialog.js#L385-L436
train
CartoDB/odyssey.js
lib/odyssey/actions/debug.js
Debug
function Debug() { function _debug() {}; _debug.log = function(_) { return Action({ enter: function() { console.log("STATE =>", _, arguments); }, update: function() { console.log("STATE (.)", _, arguments); }, exit: function() { console.log("STATE <=", ...
javascript
function Debug() { function _debug() {}; _debug.log = function(_) { return Action({ enter: function() { console.log("STATE =>", _, arguments); }, update: function() { console.log("STATE (.)", _, arguments); }, exit: function() { console.log("STATE <=", ...
[ "function", "Debug", "(", ")", "{", "function", "_debug", "(", ")", "{", "}", ";", "_debug", ".", "log", "=", "function", "(", "_", ")", "{", "return", "Action", "(", "{", "enter", ":", "function", "(", ")", "{", "console", ".", "log", "(", "\"ST...
debug action prints information about current state
[ "debug", "action", "prints", "information", "about", "current", "state" ]
59e194e8cf18154d095f004e01f955b6af9348f9
https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/lib/odyssey/actions/debug.js#L7-L31
train
CartoDB/odyssey.js
lib/odyssey/actions/leaflet/map.js
leaflet_method
function leaflet_method(name) { _map[name] = function() { var args = arguments; return Action(function() { map[name].apply(map, args); }); }; }
javascript
function leaflet_method(name) { _map[name] = function() { var args = arguments; return Action(function() { map[name].apply(map, args); }); }; }
[ "function", "leaflet_method", "(", "name", ")", "{", "_map", "[", "name", "]", "=", "function", "(", ")", "{", "var", "args", "=", "arguments", ";", "return", "Action", "(", "function", "(", ")", "{", "map", "[", "name", "]", ".", "apply", "(", "ma...
helper method to translate leaflet methods to actions
[ "helper", "method", "to", "translate", "leaflet", "methods", "to", "actions" ]
59e194e8cf18154d095f004e01f955b6af9348f9
https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/lib/odyssey/actions/leaflet/map.js#L9-L16
train
CartoDB/odyssey.js
vendor/jquery.spriteanim.js
function(elem) { // is this already initialized? if ($(elem).data('spriteanim')) return $(elem).data('spriteanim'); var spriteanim = new SpriteAnim(elem); $(elem).data('spriteanim', spriteanim); return spriteanim; }
javascript
function(elem) { // is this already initialized? if ($(elem).data('spriteanim')) return $(elem).data('spriteanim'); var spriteanim = new SpriteAnim(elem); $(elem).data('spriteanim', spriteanim); return spriteanim; }
[ "function", "(", "elem", ")", "{", "// is this already initialized?", "if", "(", "$", "(", "elem", ")", ".", "data", "(", "'spriteanim'", ")", ")", "return", "$", "(", "elem", ")", ".", "data", "(", "'spriteanim'", ")", ";", "var", "spriteanim", "=", "...
Initialize the animation for the element.
[ "Initialize", "the", "animation", "for", "the", "element", "." ]
59e194e8cf18154d095f004e01f955b6af9348f9
https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/vendor/jquery.spriteanim.js#L426-L433
train
CartoDB/odyssey.js
lib/odyssey/story.js
Edge
function Edge(a, b) { var s = 0; function t() {} a._story(null, function() { if(s !== 0) { t.trigger(); } s = 0; }); b._story(null, function() { if(s !== 1) { t.trigger(); } s = 1; }); return Trigger(t); }
javascript
function Edge(a, b) { var s = 0; function t() {} a._story(null, function() { if(s !== 0) { t.trigger(); } s = 0; }); b._story(null, function() { if(s !== 1) { t.trigger(); } s = 1; }); return Trigger(t); }
[ "function", "Edge", "(", "a", ",", "b", ")", "{", "var", "s", "=", "0", ";", "function", "t", "(", ")", "{", "}", "a", ".", "_story", "(", "null", ",", "function", "(", ")", "{", "if", "(", "s", "!==", "0", ")", "{", "t", ".", "trigger", ...
check change between two states and triggers
[ "check", "change", "between", "two", "states", "and", "triggers" ]
59e194e8cf18154d095f004e01f955b6af9348f9
https://github.com/CartoDB/odyssey.js/blob/59e194e8cf18154d095f004e01f955b6af9348f9/lib/odyssey/story.js#L305-L321
train
platanus/angular-restmod
src/module/support/default-packer.js
processFeature
function processFeature(_raw, _name, _feature, _other, _do) { if(_feature === '.' || _feature === true) { var skip = [_name]; if(_other) skip.push.apply(skip, angular.isArray(_other) ? _other : [_other]); exclude(_raw, skip, _do); } else if(typeof _feature === 'string') { exclude(_raw[_f...
javascript
function processFeature(_raw, _name, _feature, _other, _do) { if(_feature === '.' || _feature === true) { var skip = [_name]; if(_other) skip.push.apply(skip, angular.isArray(_other) ? _other : [_other]); exclude(_raw, skip, _do); } else if(typeof _feature === 'string') { exclude(_raw[_f...
[ "function", "processFeature", "(", "_raw", ",", "_name", ",", "_feature", ",", "_other", ",", "_do", ")", "{", "if", "(", "_feature", "===", "'.'", "||", "_feature", "===", "true", ")", "{", "var", "skip", "=", "[", "_name", "]", ";", "if", "(", "_...
process links and stores them in the packer cache
[ "process", "links", "and", "stores", "them", "in", "the", "packer", "cache" ]
ed18b4da48fca7582edb8bcbcca91ef3177adf0b
https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/src/module/support/default-packer.js#L20-L30
train
platanus/angular-restmod
src/module/extended/builder-relations.js
applyHooks
function applyHooks(_target, _hooks, _owner) { for(var key in _hooks) { if(_hooks.hasOwnProperty(key)) { _target.$on(key, wrapHook(_hooks[key], _owner)); } } }
javascript
function applyHooks(_target, _hooks, _owner) { for(var key in _hooks) { if(_hooks.hasOwnProperty(key)) { _target.$on(key, wrapHook(_hooks[key], _owner)); } } }
[ "function", "applyHooks", "(", "_target", ",", "_hooks", ",", "_owner", ")", "{", "for", "(", "var", "key", "in", "_hooks", ")", "{", "if", "(", "_hooks", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "_target", ".", "$on", "(", "key", ",", "wr...
wraps a bunch of hooks
[ "wraps", "a", "bunch", "of", "hooks" ]
ed18b4da48fca7582edb8bcbcca91ef3177adf0b
https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/src/module/extended/builder-relations.js#L19-L25
train
platanus/angular-restmod
dist/plugins/preload.js
processGroup
function processGroup(_records, _target, _params) { // extract targets var targets = [], record; for(var i = 0, l = _records.length; i < l; i++) { record = _records[i][_target]; if(angular.isArray(record)) { targets.push.apply(targets, record); } else if(record) { targets....
javascript
function processGroup(_records, _target, _params) { // extract targets var targets = [], record; for(var i = 0, l = _records.length; i < l; i++) { record = _records[i][_target]; if(angular.isArray(record)) { targets.push.apply(targets, record); } else if(record) { targets....
[ "function", "processGroup", "(", "_records", ",", "_target", ",", "_params", ")", "{", "// extract targets", "var", "targets", "=", "[", "]", ",", "record", ";", "for", "(", "var", "i", "=", "0", ",", "l", "=", "_records", ".", "length", ";", "i", "<...
processes a group records of the same type
[ "processes", "a", "group", "records", "of", "the", "same", "type" ]
ed18b4da48fca7582edb8bcbcca91ef3177adf0b
https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/dist/plugins/preload.js#L29-L56
train
platanus/angular-restmod
src/module/serializer.js
function() { return { /** * @memberof BuilderApi# * * @description Sets an attribute mapping. * * Allows a explicit server to model property mapping to be defined. * * For example, to map the response property `stats.create...
javascript
function() { return { /** * @memberof BuilderApi# * * @description Sets an attribute mapping. * * Allows a explicit server to model property mapping to be defined. * * For example, to map the response property `stats.create...
[ "function", "(", ")", "{", "return", "{", "/**\n * @memberof BuilderApi#\n *\n * @description Sets an attribute mapping.\n *\n * Allows a explicit server to model property mapping to be defined.\n *\n * For example, to map the respons...
builds a serializerd DSL, is a standalone object that can be extended.
[ "builds", "a", "serializerd", "DSL", "is", "a", "standalone", "object", "that", "can", "be", "extended", "." ]
ed18b4da48fca7582edb8bcbcca91ef3177adf0b
https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/src/module/serializer.js#L195-L326
train
platanus/angular-restmod
src/module/builder.js
function(_chain) { for(var i = 0, l = _chain.length; i < l; i++) { this.mixin(_chain[i]); } }
javascript
function(_chain) { for(var i = 0, l = _chain.length; i < l; i++) { this.mixin(_chain[i]); } }
[ "function", "(", "_chain", ")", "{", "for", "(", "var", "i", "=", "0", ",", "l", "=", "_chain", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "this", ".", "mixin", "(", "_chain", "[", "i", "]", ")", ";", "}", "}" ]
use the builder to process a mixin chain
[ "use", "the", "builder", "to", "process", "a", "mixin", "chain" ]
ed18b4da48fca7582edb8bcbcca91ef3177adf0b
https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/src/module/builder.js#L313-L317
train
platanus/angular-restmod
src/module/builder.js
function(_mix) { if(_mix.$$chain) { this.chain(_mix.$$chain); } else if(typeof _mix === 'string') { this.mixin($injector.get(_mix)); } else if(isArray(_mix)) { this.chain(_mix); } else if(isFunction(_mix)) { _mix.call(this.dsl, $injector); } else { t...
javascript
function(_mix) { if(_mix.$$chain) { this.chain(_mix.$$chain); } else if(typeof _mix === 'string') { this.mixin($injector.get(_mix)); } else if(isArray(_mix)) { this.chain(_mix); } else if(isFunction(_mix)) { _mix.call(this.dsl, $injector); } else { t...
[ "function", "(", "_mix", ")", "{", "if", "(", "_mix", ".", "$$chain", ")", "{", "this", ".", "chain", "(", "_mix", ".", "$$chain", ")", ";", "}", "else", "if", "(", "typeof", "_mix", "===", "'string'", ")", "{", "this", ".", "mixin", "(", "$injec...
use the builder to process a single mixin
[ "use", "the", "builder", "to", "process", "a", "single", "mixin" ]
ed18b4da48fca7582edb8bcbcca91ef3177adf0b
https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/src/module/builder.js#L320-L332
train
platanus/angular-restmod
src/plugins/debounced.js
buildAsyncSaveFun
function buildAsyncSaveFun(_this, _oldSave, _promise, _oldPromise) { return function() { // swap promises so save behaves like it has been called during the original call. var currentPromise = _this.$promise; _this.$promise = _oldPromise; // when save resolves, the timeout promise is resol...
javascript
function buildAsyncSaveFun(_this, _oldSave, _promise, _oldPromise) { return function() { // swap promises so save behaves like it has been called during the original call. var currentPromise = _this.$promise; _this.$promise = _oldPromise; // when save resolves, the timeout promise is resol...
[ "function", "buildAsyncSaveFun", "(", "_this", ",", "_oldSave", ",", "_promise", ",", "_oldPromise", ")", "{", "return", "function", "(", ")", "{", "// swap promises so save behaves like it has been called during the original call.", "var", "currentPromise", "=", "_this", ...
builds a new async save function bound to a given context and promise.
[ "builds", "a", "new", "async", "save", "function", "bound", "to", "a", "given", "context", "and", "promise", "." ]
ed18b4da48fca7582edb8bcbcca91ef3177adf0b
https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/src/plugins/debounced.js#L46-L67
train
platanus/angular-restmod
dist/angular-restmod-bundle.js
applyRules
function applyRules(_string, _ruleSet, _skip) { if(_skip.indexOf(_string.toLowerCase()) === -1) { var i = 0, rule; while(rule = _ruleSet[i++]) { if(_string.match(rule[0])) { return _string.replace(rule[0], rule[1]); } } } return _string; }
javascript
function applyRules(_string, _ruleSet, _skip) { if(_skip.indexOf(_string.toLowerCase()) === -1) { var i = 0, rule; while(rule = _ruleSet[i++]) { if(_string.match(rule[0])) { return _string.replace(rule[0], rule[1]); } } } return _string; }
[ "function", "applyRules", "(", "_string", ",", "_ruleSet", ",", "_skip", ")", "{", "if", "(", "_skip", ".", "indexOf", "(", "_string", ".", "toLowerCase", "(", ")", ")", "===", "-", "1", ")", "{", "var", "i", "=", "0", ",", "rule", ";", "while", ...
helper function used by singularize and pluralize
[ "helper", "function", "used", "by", "singularize", "and", "pluralize" ]
ed18b4da48fca7582edb8bcbcca91ef3177adf0b
https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/dist/angular-restmod-bundle.js#L99-L111
train
platanus/angular-restmod
dist/angular-restmod-bundle.js
function(_hook, _args, _ctx) { var cbs = hooks[_hook], i, cb; if(cbs) { for(i = 0; !!(cb = cbs[i]); i++) { cb.apply(_ctx || this, _args || []); } } return this; }
javascript
function(_hook, _args, _ctx) { var cbs = hooks[_hook], i, cb; if(cbs) { for(i = 0; !!(cb = cbs[i]); i++) { cb.apply(_ctx || this, _args || []); } } return this; }
[ "function", "(", "_hook", ",", "_args", ",", "_ctx", ")", "{", "var", "cbs", "=", "hooks", "[", "_hook", "]", ",", "i", ",", "cb", ";", "if", "(", "cbs", ")", "{", "for", "(", "i", "=", "0", ";", "!", "!", "(", "cb", "=", "cbs", "[", "i",...
bubbles events comming from related resources
[ "bubbles", "events", "comming", "from", "related", "resources" ]
ed18b4da48fca7582edb8bcbcca91ef3177adf0b
https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/dist/angular-restmod-bundle.js#L2819-L2827
train
platanus/angular-restmod
dist/angular-restmod-bundle.js
function(_items) { var list = new List(); if(_items) list.push.apply(list, _items); return list; }
javascript
function(_items) { var list = new List(); if(_items) list.push.apply(list, _items); return list; }
[ "function", "(", "_items", ")", "{", "var", "list", "=", "new", "List", "(", ")", ";", "if", "(", "_items", ")", "list", ".", "push", ".", "apply", "(", "list", ",", "_items", ")", ";", "return", "list", ";", "}" ]
Creates a new record list. A list is a ordered set of records not bound to a particular scope. Contained records can belong to any scope. @return {List} the new list
[ "Creates", "a", "new", "record", "list", "." ]
ed18b4da48fca7582edb8bcbcca91ef3177adf0b
https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/dist/angular-restmod-bundle.js#L2928-L2932
train
platanus/angular-restmod
dist/angular-restmod-bundle.js
function(_params, _scope) { _params = this.$params ? angular.extend({}, this.$params, _params) : _params; return newCollection(_params, _scope || this.$scope); }
javascript
function(_params, _scope) { _params = this.$params ? angular.extend({}, this.$params, _params) : _params; return newCollection(_params, _scope || this.$scope); }
[ "function", "(", "_params", ",", "_scope", ")", "{", "_params", "=", "this", ".", "$params", "?", "angular", ".", "extend", "(", "{", "}", ",", "this", ".", "$params", ",", "_params", ")", ":", "_params", ";", "return", "newCollection", "(", "_params",...
provide collection constructor
[ "provide", "collection", "constructor" ]
ed18b4da48fca7582edb8bcbcca91ef3177adf0b
https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/dist/angular-restmod-bundle.js#L3116-L3119
train
platanus/angular-restmod
dist/angular-restmod-bundle.js
helpDefine
function helpDefine(_api, _name, _fun) { var api = APIS[_api]; Utils.assert(!!api, 'Invalid api name $1', _api); if(_name) { api[_name] = Utils.override(api[_name], _fun); } else { Utils.extendOverriden(api, _fun); } }
javascript
function helpDefine(_api, _name, _fun) { var api = APIS[_api]; Utils.assert(!!api, 'Invalid api name $1', _api); if(_name) { api[_name] = Utils.override(api[_name], _fun); } else { Utils.extendOverriden(api, _fun); } }
[ "function", "helpDefine", "(", "_api", ",", "_name", ",", "_fun", ")", "{", "var", "api", "=", "APIS", "[", "_api", "]", ";", "Utils", ".", "assert", "(", "!", "!", "api", ",", "'Invalid api name $1'", ",", "_api", ")", ";", "if", "(", "_name", ")"...
helper used to extend api's
[ "helper", "used", "to", "extend", "api", "s" ]
ed18b4da48fca7582edb8bcbcca91ef3177adf0b
https://github.com/platanus/angular-restmod/blob/ed18b4da48fca7582edb8bcbcca91ef3177adf0b/dist/angular-restmod-bundle.js#L3154-L3164
train
adonisjs/adonis-bodyparser
src/Bindings/Validations.js
validateFile
async function validateFile (file, options) { if (file instanceof File === false) { return null } await file.setOptions(Object.assign(file.validationOptions, options)).runValidations() return _.size(file.error()) ? file.error().message : null }
javascript
async function validateFile (file, options) { if (file instanceof File === false) { return null } await file.setOptions(Object.assign(file.validationOptions, options)).runValidations() return _.size(file.error()) ? file.error().message : null }
[ "async", "function", "validateFile", "(", "file", ",", "options", ")", "{", "if", "(", "file", "instanceof", "File", "===", "false", ")", "{", "return", "null", "}", "await", "file", ".", "setOptions", "(", "Object", ".", "assign", "(", "file", ".", "v...
Validates a single file instance. If validation has error, then error message will be returned as string, else null is returned. @method validateFile @param {File} file @param {Object} options @return {String|Null}
[ "Validates", "a", "single", "file", "instance", ".", "If", "validation", "has", "error", "then", "error", "message", "will", "be", "returned", "as", "string", "else", "null", "is", "returned", "." ]
11efb935e382c68da531da28d32d9b3d821338da
https://github.com/adonisjs/adonis-bodyparser/blob/11efb935e382c68da531da28d32d9b3d821338da/src/Bindings/Validations.js#L24-L31
train
adonisjs/adonis-bodyparser
src/Multipart/File.js
function (type, data) { if (type === 'size') { return `File size should be less than ${bytes(data.size)}` } if (type === 'type') { const verb = data.types.length === 1 ? 'is' : 'are' return `Invalid file type ${data.subtype} or ${data.type}. Only ${data.types.join(', ')} ${verb} allowed` } if (t...
javascript
function (type, data) { if (type === 'size') { return `File size should be less than ${bytes(data.size)}` } if (type === 'type') { const verb = data.types.length === 1 ? 'is' : 'are' return `Invalid file type ${data.subtype} or ${data.type}. Only ${data.types.join(', ')} ${verb} allowed` } if (t...
[ "function", "(", "type", ",", "data", ")", "{", "if", "(", "type", "===", "'size'", ")", "{", "return", "`", "${", "bytes", "(", "data", ".", "size", ")", "}", "`", "}", "if", "(", "type", "===", "'type'", ")", "{", "const", "verb", "=", "data"...
Returns the error string for given error type @method getError @param {String} type @param {Object} data @return {String}
[ "Returns", "the", "error", "string", "for", "given", "error", "type" ]
11efb935e382c68da531da28d32d9b3d821338da
https://github.com/adonisjs/adonis-bodyparser/blob/11efb935e382c68da531da28d32d9b3d821338da/src/Multipart/File.js#L40-L54
train
tikonen/blog
mine/js/game.js
_empty
function _empty( x, y, force ) { if ( x < 0 || x >= that.width || y < 0 || y >= that.height ) return; var pos = that.pos(x, y); var d = that.grid[pos]; if (d && (d & SLAB_MASK) && (force || !(d & APPLE_MASK))) { that.grid[pos] &= ~SLAB_MASK; // clear ou...
javascript
function _empty( x, y, force ) { if ( x < 0 || x >= that.width || y < 0 || y >= that.height ) return; var pos = that.pos(x, y); var d = that.grid[pos]; if (d && (d & SLAB_MASK) && (force || !(d & APPLE_MASK))) { that.grid[pos] &= ~SLAB_MASK; // clear ou...
[ "function", "_empty", "(", "x", ",", "y", ",", "force", ")", "{", "if", "(", "x", "<", "0", "||", "x", ">=", "that", ".", "width", "||", "y", "<", "0", "||", "y", ">=", "that", ".", "height", ")", "return", ";", "var", "pos", "=", "that", "...
Check where click hit Recursive function to clear empty areas
[ "Check", "where", "click", "hit", "Recursive", "function", "to", "clear", "empty", "areas" ]
4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae
https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/mine/js/game.js#L182-L204
train
tikonen/blog
simplehttpserver/simplehttpserver.js
directoryHTML
function directoryHTML( res, urldir, pathname, list ) { var ulist = []; function sendHTML( list ) { res.setHeader('Content-Type', 'text/html; charset=utf-8'); res.send('<!DOCTYPE html>' + '<html>\n' + '<title>Directory listing for '+htmlsafe(urldir)+'</title>\n' + '<body>...
javascript
function directoryHTML( res, urldir, pathname, list ) { var ulist = []; function sendHTML( list ) { res.setHeader('Content-Type', 'text/html; charset=utf-8'); res.send('<!DOCTYPE html>' + '<html>\n' + '<title>Directory listing for '+htmlsafe(urldir)+'</title>\n' + '<body>...
[ "function", "directoryHTML", "(", "res", ",", "urldir", ",", "pathname", ",", "list", ")", "{", "var", "ulist", "=", "[", "]", ";", "function", "sendHTML", "(", "list", ")", "{", "res", ".", "setHeader", "(", "'Content-Type'", ",", "'text/html; charset=utf...
Reads directory content and builds HTML response
[ "Reads", "directory", "content", "and", "builds", "HTML", "response" ]
4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae
https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/simplehttpserver/simplehttpserver.js#L142-L184
train
tikonen/blog
slot5/js/slot.js
_check
function _check(err, id) { updateProgress(1); if (err) { alert('Failed to load ' + id + ': ' + err); } loadc++; if (itemc == loadc) callback(); }
javascript
function _check(err, id) { updateProgress(1); if (err) { alert('Failed to load ' + id + ': ' + err); } loadc++; if (itemc == loadc) callback(); }
[ "function", "_check", "(", "err", ",", "id", ")", "{", "updateProgress", "(", "1", ")", ";", "if", "(", "err", ")", "{", "alert", "(", "'Failed to load '", "+", "id", "+", "': '", "+", "err", ")", ";", "}", "loadc", "++", ";", "if", "(", "itemc",...
called by preloadFunction to notify result
[ "called", "by", "preloadFunction", "to", "notify", "result" ]
4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae
https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/slot5/js/slot.js#L31-L38
train
tikonen/blog
slot5/js/slot.js
_fill_canvas
function _fill_canvas(canvas, items) { var ctx = canvas.getContext('2d'); ctx.fillStyle = '#ddd'; for (var i = 0; i < ITEM_COUNT; i++) { var asset = items[i]; ctx.save(); ctx.shadowColor = "rgba(0,0,0,0.5)"; ctx.shadowO...
javascript
function _fill_canvas(canvas, items) { var ctx = canvas.getContext('2d'); ctx.fillStyle = '#ddd'; for (var i = 0; i < ITEM_COUNT; i++) { var asset = items[i]; ctx.save(); ctx.shadowColor = "rgba(0,0,0,0.5)"; ctx.shadowO...
[ "function", "_fill_canvas", "(", "canvas", ",", "items", ")", "{", "var", "ctx", "=", "canvas", ".", "getContext", "(", "'2d'", ")", ";", "ctx", ".", "fillStyle", "=", "'#ddd'", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "ITEM_COUNT", ";...
all loaded draws canvas strip
[ "all", "loaded", "draws", "canvas", "strip" ]
4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae
https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/slot5/js/slot.js#L289-L306
train
tikonen/blog
slot5/js/slot.js
_find
function _find( items, id ) { for ( var i=0; i < items.length; i++ ) { if (items[i].id == id) return i; } }
javascript
function _find( items, id ) { for ( var i=0; i < items.length; i++ ) { if (items[i].id == id) return i; } }
[ "function", "_find", "(", "items", ",", "id", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "items", ".", "length", ";", "i", "++", ")", "{", "if", "(", "items", "[", "i", "]", ".", "id", "==", "id", ")", "return", "i", ";", ...
function locates id from items
[ "function", "locates", "id", "from", "items" ]
4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae
https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/slot5/js/slot.js#L400-L404
train
tikonen/blog
slot5/js/slot.js
_check_slot
function _check_slot(offset, result) { if (now - that.lastUpdate > SPINTIME) { var c = parseInt(Math.abs(offset / SLOT_HEIGHT)) % ITEM_COUNT; if (c == result) { if (result == 0) { if (Math.abs(offset + (ITEM_COUNT * SLOT_HEIGHT)) < (SLOT_SPEED * 1.5)) ...
javascript
function _check_slot(offset, result) { if (now - that.lastUpdate > SPINTIME) { var c = parseInt(Math.abs(offset / SLOT_HEIGHT)) % ITEM_COUNT; if (c == result) { if (result == 0) { if (Math.abs(offset + (ITEM_COUNT * SLOT_HEIGHT)) < (SLOT_SPEED * 1.5)) ...
[ "function", "_check_slot", "(", "offset", ",", "result", ")", "{", "if", "(", "now", "-", "that", ".", "lastUpdate", ">", "SPINTIME", ")", "{", "var", "c", "=", "parseInt", "(", "Math", ".", "abs", "(", "offset", "/", "SLOT_HEIGHT", ")", ")", "%", ...
Check slot status and if spun long enough stop it on result
[ "Check", "slot", "status", "and", "if", "spun", "long", "enough", "stop", "it", "on", "result" ]
4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae
https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/slot5/js/slot.js#L478-L492
train
tikonen/blog
slot2/js/slot.js
initAudio
function initAudio( audios, callback ) { var format = 'mp3'; var elem = document.createElement('audio'); if ( elem ) { // Check if we can play mp3, if not then fall back to ogg if( !elem.canPlayType( 'audio/mpeg;' ) && elem.canPlayType('audio/ogg;')) format = 'ogg'; } var AudioCont...
javascript
function initAudio( audios, callback ) { var format = 'mp3'; var elem = document.createElement('audio'); if ( elem ) { // Check if we can play mp3, if not then fall back to ogg if( !elem.canPlayType( 'audio/mpeg;' ) && elem.canPlayType('audio/ogg;')) format = 'ogg'; } var AudioCont...
[ "function", "initAudio", "(", "audios", ",", "callback", ")", "{", "var", "format", "=", "'mp3'", ";", "var", "elem", "=", "document", ".", "createElement", "(", "'audio'", ")", ";", "if", "(", "elem", ")", "{", "// Check if we can play mp3, if not then fall b...
Initializes audio and loads audio files
[ "Initializes", "audio", "and", "loads", "audio", "files" ]
4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae
https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/slot2/js/slot.js#L156-L185
train
tikonen/blog
drive/js/drive.js
_build_object
function _build_object( game, x, y, speed ) { var car_asset = game.carAssets[parseInt(Math.random()*game.carAssets.length)] var framex = car_asset.w * parseInt(Math.random() * car_asset.count); return { collided: 0, width: car_asset.w, height: car_asset.h, img: car_asset.img, framex: framex, pos: { ...
javascript
function _build_object( game, x, y, speed ) { var car_asset = game.carAssets[parseInt(Math.random()*game.carAssets.length)] var framex = car_asset.w * parseInt(Math.random() * car_asset.count); return { collided: 0, width: car_asset.w, height: car_asset.h, img: car_asset.img, framex: framex, pos: { ...
[ "function", "_build_object", "(", "game", ",", "x", ",", "y", ",", "speed", ")", "{", "var", "car_asset", "=", "game", ".", "carAssets", "[", "parseInt", "(", "Math", ".", "random", "(", ")", "*", "game", ".", "carAssets", ".", "length", ")", "]", ...
Add car in game
[ "Add", "car", "in", "game" ]
4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae
https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/drive/js/drive.js#L161-L208
train
tikonen/blog
biased/biased.js
select
function select(elems) { var r = Math.random(); var ref = 0; for(var i=0; i < elems.length; i++) { var elem= elems[i]; ref += elem[1]; if (r < ref) return elem[0]; } // This happens only if probabilities don't add up to 1 return null; }
javascript
function select(elems) { var r = Math.random(); var ref = 0; for(var i=0; i < elems.length; i++) { var elem= elems[i]; ref += elem[1]; if (r < ref) return elem[0]; } // This happens only if probabilities don't add up to 1 return null; }
[ "function", "select", "(", "elems", ")", "{", "var", "r", "=", "Math", ".", "random", "(", ")", ";", "var", "ref", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "elems", ".", "length", ";", "i", "++", ")", "{", "var", "ele...
Biased random entry selection
[ "Biased", "random", "entry", "selection" ]
4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae
https://github.com/tikonen/blog/blob/4de49cd56886e107ee0b20c1bf6c3e5e4bbb5eae/biased/biased.js#L4-L16
train
bustle/shep
src/util/aws/lambda.js
configStripper
function configStripper (c) { return { DeadLetterConfig: c.DeadLetterConfig, Description: c.Description, Environment: c.Environment, Handler: c.Handler, MemorySize: c.MemorySize, Role: c.Role, Runtime: c.Runtime, Timeout: c.Timeout, TracingConfig: c.TracingConfig } }
javascript
function configStripper (c) { return { DeadLetterConfig: c.DeadLetterConfig, Description: c.Description, Environment: c.Environment, Handler: c.Handler, MemorySize: c.MemorySize, Role: c.Role, Runtime: c.Runtime, Timeout: c.Timeout, TracingConfig: c.TracingConfig } }
[ "function", "configStripper", "(", "c", ")", "{", "return", "{", "DeadLetterConfig", ":", "c", ".", "DeadLetterConfig", ",", "Description", ":", "c", ".", "Description", ",", "Environment", ":", "c", ".", "Environment", ",", "Handler", ":", "c", ".", "Hand...
should beef this up for VpcConfig can only pass SecurityGroupIds and SubnetIds
[ "should", "beef", "this", "up", "for", "VpcConfig", "can", "only", "pass", "SecurityGroupIds", "and", "SubnetIds" ]
a5bbdd27209f5079c12eb98a456d2a2f91a4af8a
https://github.com/bustle/shep/blob/a5bbdd27209f5079c12eb98a456d2a2f91a4af8a/src/util/aws/lambda.js#L160-L172
train
TencentWSRD/connect-cas2
lib/validate.js
validateTicket
function validateTicket(req, options, callback) { var query = { service: utils.getPath('service', options), ticket: req.query.ticket }; var logger = utils.getLogger(req, options); if (options.paths.proxyCallback) query.pgtUrl = utils.getPath('pgtUrl', options); var casServerValidPath = utils.getPath...
javascript
function validateTicket(req, options, callback) { var query = { service: utils.getPath('service', options), ticket: req.query.ticket }; var logger = utils.getLogger(req, options); if (options.paths.proxyCallback) query.pgtUrl = utils.getPath('pgtUrl', options); var casServerValidPath = utils.getPath...
[ "function", "validateTicket", "(", "req", ",", "options", ",", "callback", ")", "{", "var", "query", "=", "{", "service", ":", "utils", ".", "getPath", "(", "'service'", ",", "options", ")", ",", "ticket", ":", "req", ".", "query", ".", "ticket", "}", ...
Validate ticket from CAS server @param req @param options @param callback
[ "Validate", "ticket", "from", "CAS", "server" ]
b01415629abc08bb4a462873c0d53577481bd52d
https://github.com/TencentWSRD/connect-cas2/blob/b01415629abc08bb4a462873c0d53577481bd52d/lib/validate.js#L151-L175
train
TencentWSRD/connect-cas2
lib/validate.js
retrievePGTFromPGTIOU
function retrievePGTFromPGTIOU(req, res, callback, pgtIou, options) { var logger = utils.getLogger(req, options); logger.info('Trying to retrieve pgtId from pgtIou...'); req.sessionStore.get(pgtIou, function(err, session) { /* istanbul ignore if */ if (err) { logger.error('Get pgtId from sessionSto...
javascript
function retrievePGTFromPGTIOU(req, res, callback, pgtIou, options) { var logger = utils.getLogger(req, options); logger.info('Trying to retrieve pgtId from pgtIou...'); req.sessionStore.get(pgtIou, function(err, session) { /* istanbul ignore if */ if (err) { logger.error('Get pgtId from sessionSto...
[ "function", "retrievePGTFromPGTIOU", "(", "req", ",", "res", ",", "callback", ",", "pgtIou", ",", "options", ")", "{", "var", "logger", "=", "utils", ".", "getLogger", "(", "req", ",", "options", ")", ";", "logger", ".", "info", "(", "'Trying to retrieve p...
Find PGT by PGTIOU @param req @param res @param callback @param pgtIou @param options
[ "Find", "PGT", "by", "PGTIOU" ]
b01415629abc08bb4a462873c0d53577481bd52d
https://github.com/TencentWSRD/connect-cas2/blob/b01415629abc08bb4a462873c0d53577481bd52d/lib/validate.js#L231-L292
train
TencentWSRD/connect-cas2
lib/getProxyTicket.js
requestPT
function requestPT(path, callback, retryHandler) { logger.info('Trying to request proxy ticket from ', proxyPath); var startTime = Date.now(); utils.getRequest(path, function(err, response) { /* istanbul ignore if */ logger.access('|GET|' + path + '|' + (err ? 500 : response.status) + "|" + (Da...
javascript
function requestPT(path, callback, retryHandler) { logger.info('Trying to request proxy ticket from ', proxyPath); var startTime = Date.now(); utils.getRequest(path, function(err, response) { /* istanbul ignore if */ logger.access('|GET|' + path + '|' + (err ? 500 : response.status) + "|" + (Da...
[ "function", "requestPT", "(", "path", ",", "callback", ",", "retryHandler", ")", "{", "logger", ".", "info", "(", "'Trying to request proxy ticket from '", ",", "proxyPath", ")", ";", "var", "startTime", "=", "Date", ".", "now", "(", ")", ";", "utils", ".", ...
Request a proxy ticket @param req @param path @param callback @param {Function} retryHandler If this callback is set, it will be called only if request failed due to authentication issue.
[ "Request", "a", "proxy", "ticket" ]
b01415629abc08bb4a462873c0d53577481bd52d
https://github.com/TencentWSRD/connect-cas2/blob/b01415629abc08bb4a462873c0d53577481bd52d/lib/getProxyTicket.js#L159-L191
train
TencentWSRD/connect-cas2
lib/utils.js
isMatchRule
function isMatchRule(req, pathname, rule) { if (typeof rule === 'string') { return pathname.indexOf(rule) > -1; } else if (rule instanceof RegExp) { return rule.test(pathname); } else if (typeof rule === 'function') { return rule(pathname, req); } }
javascript
function isMatchRule(req, pathname, rule) { if (typeof rule === 'string') { return pathname.indexOf(rule) > -1; } else if (rule instanceof RegExp) { return rule.test(pathname); } else if (typeof rule === 'function') { return rule(pathname, req); } }
[ "function", "isMatchRule", "(", "req", ",", "pathname", ",", "rule", ")", "{", "if", "(", "typeof", "rule", "===", "'string'", ")", "{", "return", "pathname", ".", "indexOf", "(", "rule", ")", ">", "-", "1", ";", "}", "else", "if", "(", "rule", "in...
Return `true` when pathname match the rule. @param req @param pathname @param rule @returns {*}
[ "Return", "true", "when", "pathname", "match", "the", "rule", "." ]
b01415629abc08bb4a462873c0d53577481bd52d
https://github.com/TencentWSRD/connect-cas2/blob/b01415629abc08bb4a462873c0d53577481bd52d/lib/utils.js#L16-L24
train
TencentWSRD/connect-cas2
lib/utils.js
shouldIgnore
function shouldIgnore(req, options) { var logger = getLogger(req, options); if (options.match && options.match.splice && options.match.length) { var matchedRule; var hasMatch = options.match.some(function (rule) { matchedRule = rule; return isMatchRule(req, req.path, rule); }); if (hasM...
javascript
function shouldIgnore(req, options) { var logger = getLogger(req, options); if (options.match && options.match.splice && options.match.length) { var matchedRule; var hasMatch = options.match.some(function (rule) { matchedRule = rule; return isMatchRule(req, req.path, rule); }); if (hasM...
[ "function", "shouldIgnore", "(", "req", ",", "options", ")", "{", "var", "logger", "=", "getLogger", "(", "req", ",", "options", ")", ";", "if", "(", "options", ".", "match", "&&", "options", ".", "match", ".", "splice", "&&", "options", ".", "match", ...
Check options.match first, if match, return `false`, then check the options.ignore, if match, return `true`. If returned `true`, then this request will bypass CAS directly. @param req @param options @param logger
[ "Check", "options", ".", "match", "first", "if", "match", "return", "false", "then", "check", "the", "options", ".", "ignore", "if", "match", "return", "true", "." ]
b01415629abc08bb4a462873c0d53577481bd52d
https://github.com/TencentWSRD/connect-cas2/blob/b01415629abc08bb4a462873c0d53577481bd52d/lib/utils.js#L53-L86
train
TencentWSRD/connect-cas2
lib/utils.js
getRequest
function getRequest(path, options, callback) { if (typeof options === 'function') { callback = options; options = { method: 'get' }; } else { options.method = 'get'; } if (options.params) { var uri = url.parse(path, true); uri.query = _.merge({}, uri.query, options.params); pa...
javascript
function getRequest(path, options, callback) { if (typeof options === 'function') { callback = options; options = { method: 'get' }; } else { options.method = 'get'; } if (options.params) { var uri = url.parse(path, true); uri.query = _.merge({}, uri.query, options.params); pa...
[ "function", "getRequest", "(", "path", ",", "options", ",", "callback", ")", "{", "if", "(", "typeof", "options", "===", "'function'", ")", "{", "callback", "=", "options", ";", "options", "=", "{", "method", ":", "'get'", "}", ";", "}", "else", "{", ...
Send a GET request @param path @param {Object} options (Optional) @param callback
[ "Send", "a", "GET", "request" ]
b01415629abc08bb4a462873c0d53577481bd52d
https://github.com/TencentWSRD/connect-cas2/blob/b01415629abc08bb4a462873c0d53577481bd52d/lib/utils.js#L108-L126
train
DScheglov/mongoose-schema-jsonschema
lib/schema.js
schema_jsonSchema
function schema_jsonSchema(name) { let result; name = name || this.options.name; if (this.__buildingSchema) { this.__jsonSchemaId = this.__jsonSchemaId || '#schema-' + (++schema_jsonSchema.__jsonSchemaIdCounter); return {'$ref': this.__jsonSchemaId} } if (!this.__jsonSchem...
javascript
function schema_jsonSchema(name) { let result; name = name || this.options.name; if (this.__buildingSchema) { this.__jsonSchemaId = this.__jsonSchemaId || '#schema-' + (++schema_jsonSchema.__jsonSchemaIdCounter); return {'$ref': this.__jsonSchemaId} } if (!this.__jsonSchem...
[ "function", "schema_jsonSchema", "(", "name", ")", "{", "let", "result", ";", "name", "=", "name", "||", "this", ".", "options", ".", "name", ";", "if", "(", "this", ".", "__buildingSchema", ")", "{", "this", ".", "__jsonSchemaId", "=", "this", ".", "_...
schema_jsonSchema - builds the json schema based on the Mongooose schema. if schema has been already built the method returns new deep copy Method considers the `schema.options.toJSON.virtuals` to included the virtual paths (without detailed description) @memberof mongoose.Schema @param {String} name Name of the ob...
[ "schema_jsonSchema", "-", "builds", "the", "json", "schema", "based", "on", "the", "Mongooose", "schema", ".", "if", "schema", "has", "been", "already", "built", "the", "method", "returns", "new", "deep", "copy" ]
b1a844644553420d2dad341bd55cfce966922ca0
https://github.com/DScheglov/mongoose-schema-jsonschema/blob/b1a844644553420d2dad341bd55cfce966922ca0/lib/schema.js#L19-L51
train
DScheglov/mongoose-schema-jsonschema
lib/types.js
simpleType_jsonSchema
function simpleType_jsonSchema(name) { var result = {}; result.type = this.instance.toLowerCase(); __processOptions(result, this.options) return result; }
javascript
function simpleType_jsonSchema(name) { var result = {}; result.type = this.instance.toLowerCase(); __processOptions(result, this.options) return result; }
[ "function", "simpleType_jsonSchema", "(", "name", ")", "{", "var", "result", "=", "{", "}", ";", "result", ".", "type", "=", "this", ".", "instance", ".", "toLowerCase", "(", ")", ";", "__processOptions", "(", "result", ",", "this", ".", "options", ")", ...
simpleType_jsonSchema - returns jsonSchema for simple-type parameter @memberof mongoose.Schema.Types.String @param {String} name the name of parameter @return {object} the jsonSchema for parameter
[ "simpleType_jsonSchema", "-", "returns", "jsonSchema", "for", "simple", "-", "type", "parameter" ]
b1a844644553420d2dad341bd55cfce966922ca0
https://github.com/DScheglov/mongoose-schema-jsonschema/blob/b1a844644553420d2dad341bd55cfce966922ca0/lib/types.js#L18-L25
train
DScheglov/mongoose-schema-jsonschema
lib/types.js
objectId_jsonSchema
function objectId_jsonSchema(name) { var result = simpleType_jsonSchema.call(this, name); result.type = 'string'; result.pattern = '^[0-9a-fA-F]{24}$'; return result; }
javascript
function objectId_jsonSchema(name) { var result = simpleType_jsonSchema.call(this, name); result.type = 'string'; result.pattern = '^[0-9a-fA-F]{24}$'; return result; }
[ "function", "objectId_jsonSchema", "(", "name", ")", "{", "var", "result", "=", "simpleType_jsonSchema", ".", "call", "(", "this", ",", "name", ")", ";", "result", ".", "type", "=", "'string'", ";", "result", ".", "pattern", "=", "'^[0-9a-fA-F]{24}$'", ";", ...
objectId_jsonSchema - returns the jsonSchema for ObjectId parameters @memberof mongoose.Schema.Types.ObjectId @param {String} name the name of parameter @return {object} the jsonSchema for parameter
[ "objectId_jsonSchema", "-", "returns", "the", "jsonSchema", "for", "ObjectId", "parameters" ]
b1a844644553420d2dad341bd55cfce966922ca0
https://github.com/DScheglov/mongoose-schema-jsonschema/blob/b1a844644553420d2dad341bd55cfce966922ca0/lib/types.js#L36-L44
train