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
words/lancaster-stemmer
index.js
acceptable
function acceptable(value) { return vowels.test(value.charAt(0)) ? value.length > 1 : value.length > 2 && vowels.test(value) }
javascript
function acceptable(value) { return vowels.test(value.charAt(0)) ? value.length > 1 : value.length > 2 && vowels.test(value) }
[ "function", "acceptable", "(", "value", ")", "{", "return", "vowels", ".", "test", "(", "value", ".", "charAt", "(", "0", ")", ")", "?", "value", ".", "length", ">", "1", ":", "value", ".", "length", ">", "2", "&&", "vowels", ".", "test", "(", "v...
Detect if a value is acceptable to return, or should be stemmed further.
[ "Detect", "if", "a", "value", "is", "acceptable", "to", "return", "or", "should", "be", "stemmed", "further", "." ]
3f29d76aa887b5ecbe88ea7a8a4eadab9b569c34
https://github.com/words/lancaster-stemmer/blob/3f29d76aa887b5ecbe88ea7a8a4eadab9b569c34/index.js#L221-L225
train
tymondesigns/angular-locker
dist/angular-locker.js
function (value) { if (! _defined(value)) return defaults; angular.forEach(value, function (val, key) { if (defaults.hasOwnProperty(key)) defaults[key] = val; }); }
javascript
function (value) { if (! _defined(value)) return defaults; angular.forEach(value, function (val, key) { if (defaults.hasOwnProperty(key)) defaults[key] = val; }); }
[ "function", "(", "value", ")", "{", "if", "(", "!", "_defined", "(", "value", ")", ")", "return", "defaults", ";", "angular", ".", "forEach", "(", "value", ",", "function", "(", "val", ",", "key", ")", "{", "if", "(", "defaults", ".", "hasOwnProperty...
Allow the defaults to be specified via the `lockerProvider` @param {Object} value The defaults to override
[ "Allow", "the", "defaults", "to", "be", "specified", "via", "the", "lockerProvider" ]
8e92915a1baddfb07d15676f73a900fdb8417cab
https://github.com/tymondesigns/angular-locker/blob/8e92915a1baddfb07d15676f73a900fdb8417cab/dist/angular-locker.js#L90-L96
train
tymondesigns/angular-locker
dist/angular-locker.js
function (key, value, def) { if (! this.has(key)) { this.put(key, value, def); return true; } return false; }
javascript
function (key, value, def) { if (! this.has(key)) { this.put(key, value, def); return true; } return false; }
[ "function", "(", "key", ",", "value", ",", "def", ")", "{", "if", "(", "!", "this", ".", "has", "(", "key", ")", ")", "{", "this", ".", "put", "(", "key", ",", "value", ",", "def", ")", ";", "return", "true", ";", "}", "return", "false", ";",...
Add an item to storage if it doesn't already exist @public @param {Mixed} key The key to add @param {Mixed} value The value to add @param {Mixed} def The default to pass to function if doesn't already exist @return {Boolean}
[ "Add", "an", "item", "to", "storage", "if", "it", "doesn", "t", "already", "exist" ]
8e92915a1baddfb07d15676f73a900fdb8417cab
https://github.com/tymondesigns/angular-locker/blob/8e92915a1baddfb07d15676f73a900fdb8417cab/dist/angular-locker.js#L420-L427
train
tymondesigns/angular-locker
dist/angular-locker.js
function (key, def) { if (angular.isArray(key)) { var items = {}; angular.forEach(key, function (k) { if (this.has(k)) items[k] = this._getItem(k); }, this); ...
javascript
function (key, def) { if (angular.isArray(key)) { var items = {}; angular.forEach(key, function (k) { if (this.has(k)) items[k] = this._getItem(k); }, this); ...
[ "function", "(", "key", ",", "def", ")", "{", "if", "(", "angular", ".", "isArray", "(", "key", ")", ")", "{", "var", "items", "=", "{", "}", ";", "angular", ".", "forEach", "(", "key", ",", "function", "(", "k", ")", "{", "if", "(", "this", ...
Retrieve the specified item from storage @public @param {String|Array} key The key to get @param {Mixed} def The default value if it does not exist @return {Mixed}
[ "Retrieve", "the", "specified", "item", "from", "storage" ]
8e92915a1baddfb07d15676f73a900fdb8417cab
https://github.com/tymondesigns/angular-locker/blob/8e92915a1baddfb07d15676f73a900fdb8417cab/dist/angular-locker.js#L439-L452
train
STRML/JSXHint
jsxhint.js
transformJSX
function transformJSX(fileStream, fileName, opts, cb){ // Allow omitting filename if (typeof fileName === "object"){ cb = opts; opts = fileName; fileName = fileStream; } if (!babel && (opts['--babel'] || opts['--babel-experimental'])) { throw new Error("Optional babel parser not installed. Ple...
javascript
function transformJSX(fileStream, fileName, opts, cb){ // Allow omitting filename if (typeof fileName === "object"){ cb = opts; opts = fileName; fileName = fileStream; } if (!babel && (opts['--babel'] || opts['--babel-experimental'])) { throw new Error("Optional babel parser not installed. Ple...
[ "function", "transformJSX", "(", "fileStream", ",", "fileName", ",", "opts", ",", "cb", ")", "{", "// Allow omitting filename", "if", "(", "typeof", "fileName", "===", "\"object\"", ")", "{", "cb", "=", "opts", ";", "opts", "=", "fileName", ";", "fileName", ...
Transform a JSX file into a JS file for linting. @async @param {String} fileStream Readable stream containing file contents. @param {String} fileName Name of the file; "stdin" if reading from stdio. @param {Object} opts Options. @param {Function} cb The callback to call when it's ready.
[ "Transform", "a", "JSX", "file", "into", "a", "JS", "file", "for", "linting", "." ]
52dd5299903a4fc9d733da9c2e568f8de1c10c5d
https://github.com/STRML/JSXHint/blob/52dd5299903a4fc9d733da9c2e568f8de1c10c5d/jsxhint.js#L34-L72
train
STRML/JSXHint
cli.js
showHelp
function showHelp(){ var jshint_proc = fork(require.resolve('jshint/bin/jshint'), ['-h'], {silent: true}); var ts = through(function write(chunk){ this.queue(chunk.toString().replace(/(jshint)\b/g, 'jsxhint')); }, function end() { // This feels like a hack. There might be a better way to do this. this...
javascript
function showHelp(){ var jshint_proc = fork(require.resolve('jshint/bin/jshint'), ['-h'], {silent: true}); var ts = through(function write(chunk){ this.queue(chunk.toString().replace(/(jshint)\b/g, 'jsxhint')); }, function end() { // This feels like a hack. There might be a better way to do this. this...
[ "function", "showHelp", "(", ")", "{", "var", "jshint_proc", "=", "fork", "(", "require", ".", "resolve", "(", "'jshint/bin/jshint'", ")", ",", "[", "'-h'", "]", ",", "{", "silent", ":", "true", "}", ")", ";", "var", "ts", "=", "through", "(", "funct...
Intercept -h to show jshint help.
[ "Intercept", "-", "h", "to", "show", "jshint", "help", "." ]
52dd5299903a4fc9d733da9c2e568f8de1c10c5d
https://github.com/STRML/JSXHint/blob/52dd5299903a4fc9d733da9c2e568f8de1c10c5d/cli.js#L44-L69
train
STRML/JSXHint
cli.js
showVersion
function showVersion(){ var jshint_proc = fork(__dirname + '/node_modules/jshint/bin/jshint', ['-v'], {silent: true}); var ts = through(function write(chunk){ this.queue("JSXHint v" + require('./package.json').version + " (" + chunk.toString().replace("\n", "") + ")\n"); }); jshint_proc.stderr.pipe(ts...
javascript
function showVersion(){ var jshint_proc = fork(__dirname + '/node_modules/jshint/bin/jshint', ['-v'], {silent: true}); var ts = through(function write(chunk){ this.queue("JSXHint v" + require('./package.json').version + " (" + chunk.toString().replace("\n", "") + ")\n"); }); jshint_proc.stderr.pipe(ts...
[ "function", "showVersion", "(", ")", "{", "var", "jshint_proc", "=", "fork", "(", "__dirname", "+", "'/node_modules/jshint/bin/jshint'", ",", "[", "'-v'", "]", ",", "{", "silent", ":", "true", "}", ")", ";", "var", "ts", "=", "through", "(", "function", ...
Intercept -v, shows jsxhint and jshint versions.
[ "Intercept", "-", "v", "shows", "jsxhint", "and", "jshint", "versions", "." ]
52dd5299903a4fc9d733da9c2e568f8de1c10c5d
https://github.com/STRML/JSXHint/blob/52dd5299903a4fc9d733da9c2e568f8de1c10c5d/cli.js#L74-L81
train
STRML/JSXHint
cli.js
runGlob
function runGlob(args, opts, cb) { var dotIdx = args.indexOf('.'); if (dotIdx !== -1) { args.splice(dotIdx, 1); } glob(args, opts, function(err, globbed) { if (Array.isArray(globbed) && dotIdx !== -1) globbed.push('.'); cb(err, globbed); }); }
javascript
function runGlob(args, opts, cb) { var dotIdx = args.indexOf('.'); if (dotIdx !== -1) { args.splice(dotIdx, 1); } glob(args, opts, function(err, globbed) { if (Array.isArray(globbed) && dotIdx !== -1) globbed.push('.'); cb(err, globbed); }); }
[ "function", "runGlob", "(", "args", ",", "opts", ",", "cb", ")", "{", "var", "dotIdx", "=", "args", ".", "indexOf", "(", "'.'", ")", ";", "if", "(", "dotIdx", "!==", "-", "1", ")", "{", "args", ".", "splice", "(", "dotIdx", ",", "1", ")", ";", ...
Wrapper around globbing function. Ignores '.' which has special meaning in jshint. @param {Array} args File/glob list. @param {Object} opts Glob options. @param {Function} cb Callback.
[ "Wrapper", "around", "globbing", "function", ".", "Ignores", ".", "which", "has", "special", "meaning", "in", "jshint", "." ]
52dd5299903a4fc9d733da9c2e568f8de1c10c5d
https://github.com/STRML/JSXHint/blob/52dd5299903a4fc9d733da9c2e568f8de1c10c5d/cli.js#L89-L98
train
STRML/JSXHint
cli.js
run
function run(opts, cb){ opts.extensions = opts.extensions ? opts.extensions + ',.jsx' : '.jsx'; // glob-all fixes windows glob issues and provides array support // i.e. jsxhint ['jsx/**/*','!scripts/**/*','scripts/outlier.jsx'] runGlob(opts.args, {nodir: true}, function(err, globbed) { if (err) return cb(e...
javascript
function run(opts, cb){ opts.extensions = opts.extensions ? opts.extensions + ',.jsx' : '.jsx'; // glob-all fixes windows glob issues and provides array support // i.e. jsxhint ['jsx/**/*','!scripts/**/*','scripts/outlier.jsx'] runGlob(opts.args, {nodir: true}, function(err, globbed) { if (err) return cb(e...
[ "function", "run", "(", "opts", ",", "cb", ")", "{", "opts", ".", "extensions", "=", "opts", ".", "extensions", "?", "opts", ".", "extensions", "+", "',.jsx'", ":", "'.jsx'", ";", "// glob-all fixes windows glob issues and provides array support", "// i.e. jsxhint [...
Proxy run function. Reaches out to jsxhint to transform incoming stream or read files & transform. @param {Object} opts Opts as created by JSHint. @param {Function} cb Callback.
[ "Proxy", "run", "function", ".", "Reaches", "out", "to", "jsxhint", "to", "transform", "incoming", "stream", "or", "read", "files", "&", "transform", "." ]
52dd5299903a4fc9d733da9c2e568f8de1c10c5d
https://github.com/STRML/JSXHint/blob/52dd5299903a4fc9d733da9c2e568f8de1c10c5d/cli.js#L106-L125
train
STRML/JSXHint
cli.js
interceptReporter
function interceptReporter(reporter, filesMap){ if(!reporter) reporter = require('jshint/src/reporters/default').reporter; return function(results, data, opts){ if (filesMap) { results.forEach(function(result){ result.file = filesMap[result.file]; }); } return reporter(results, data,...
javascript
function interceptReporter(reporter, filesMap){ if(!reporter) reporter = require('jshint/src/reporters/default').reporter; return function(results, data, opts){ if (filesMap) { results.forEach(function(result){ result.file = filesMap[result.file]; }); } return reporter(results, data,...
[ "function", "interceptReporter", "(", "reporter", ",", "filesMap", ")", "{", "if", "(", "!", "reporter", ")", "reporter", "=", "require", "(", "'jshint/src/reporters/default'", ")", ".", "reporter", ";", "return", "function", "(", "results", ",", "data", ",", ...
Intercept configured reporter and change file names so it looks like nothing happened. @param {Reporter} reporter JSHint reporter @param {Object} filesMap Map related transformed files to original file paths. @return {Function} Wrapper around configured reporter. Same arity as reporter.
[ "Intercept", "configured", "reporter", "and", "change", "file", "names", "so", "it", "looks", "like", "nothing", "happened", "." ]
52dd5299903a4fc9d733da9c2e568f8de1c10c5d
https://github.com/STRML/JSXHint/blob/52dd5299903a4fc9d733da9c2e568f8de1c10c5d/cli.js#L134-L144
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (dimensions) { var _this = this; return new Promise(function (resolve, reject) { _this._paneDimensions = dimensions; _this.paneDimensions.next(dimensions); resolve(); }); }
javascript
function (dimensions) { var _this = this; return new Promise(function (resolve, reject) { _this._paneDimensions = dimensions; _this.paneDimensions.next(dimensions); resolve(); }); }
[ "function", "(", "dimensions", ")", "{", "var", "_this", "=", "this", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "_this", ".", "_paneDimensions", "=", "dimensions", ";", "_this", ".", "paneDimensions", ".", ...
set privew pane dimensions @param {?} dimensions @return {?}
[ "set", "privew", "pane", "dimensions" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L179-L186
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (positions) { var _this = this; this._points = positions; positions.forEach(function (position) { _this.positionChange(position); }); this.repositionEvent.next(positions); }
javascript
function (positions) { var _this = this; this._points = positions; positions.forEach(function (position) { _this.positionChange(position); }); this.repositionEvent.next(positions); }
[ "function", "(", "positions", ")", "{", "var", "_this", "=", "this", ";", "this", ".", "_points", "=", "positions", ";", "positions", ".", "forEach", "(", "function", "(", "position", ")", "{", "_this", ".", "positionChange", "(", "position", ")", ";", ...
repositions points externally @param {?} positions @return {?}
[ "repositions", "points", "externally" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L200-L207
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (positionChangeData) { var _this = this; // update positions according to current position change this.updatePosition(positionChangeData); // for each direction: // 1. filter the _points that have a role as the direction's limit ...
javascript
function (positionChangeData) { var _this = this; // update positions according to current position change this.updatePosition(positionChangeData); // for each direction: // 1. filter the _points that have a role as the direction's limit ...
[ "function", "(", "positionChangeData", ")", "{", "var", "_this", "=", "this", ";", "// update positions according to current position change", "this", ".", "updatePosition", "(", "positionChangeData", ")", ";", "// for each direction:", "// 1. filter the _points that have a rol...
updates limits and point positions and calls next on the observables @param {?} positionChangeData - position change event data @return {?}
[ "updates", "limits", "and", "point", "positions", "and", "calls", "next", "on", "the", "observables" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L222-L249
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (positionChange) { var _this = this; // finds the current position of the point by it's roles, than splices it for the new position or pushes it if it's not yet in the array /** @type {?} */ var index = this._points.findIndex(function (point) { ...
javascript
function (positionChange) { var _this = this; // finds the current position of the point by it's roles, than splices it for the new position or pushes it if it's not yet in the array /** @type {?} */ var index = this._points.findIndex(function (point) { ...
[ "function", "(", "positionChange", ")", "{", "var", "_this", "=", "this", ";", "// finds the current position of the point by it's roles, than splices it for the new position or pushes it if it's not yet in the array", "/** @type {?} */", "var", "index", "=", "this", ".", "_points"...
updates the position of the point @param {?} positionChange - position change event data @return {?}
[ "updates", "the", "position", "of", "the", "point" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L264-L277
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (positionChange) { var _this = this; /** @type {?} */ var pointLimits = this.limitDirections.filter(function (direction) { return !positionChange.roles.includes(direction); }); /** @type {?} */ v...
javascript
function (positionChange) { var _this = this; /** @type {?} */ var pointLimits = this.limitDirections.filter(function (direction) { return !positionChange.roles.includes(direction); }); /** @type {?} */ v...
[ "function", "(", "positionChange", ")", "{", "var", "_this", "=", "this", ";", "/** @type {?} */", "var", "pointLimits", "=", "this", ".", "limitDirections", ".", "filter", "(", "function", "(", "direction", ")", "{", "return", "!", "positionChange", ".", "r...
check if a position change event exceeds the limits @param {?} positionChange - position change event data @return {?} LimitException0
[ "check", "if", "a", "position", "change", "event", "exceeds", "the", "limits" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L293-L332
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (resizeRatios, initialPreviewDimensions, initialPositions) { var _this = this; // convert positions to ratio between position to initial pane dimension initialPositions = initialPositions.map(function (point) { return new PositionChangeData({ ...
javascript
function (resizeRatios, initialPreviewDimensions, initialPositions) { var _this = this; // convert positions to ratio between position to initial pane dimension initialPositions = initialPositions.map(function (point) { return new PositionChangeData({ ...
[ "function", "(", "resizeRatios", ",", "initialPreviewDimensions", ",", "initialPositions", ")", "{", "var", "_this", "=", "this", ";", "// convert positions to ratio between position to initial pane dimension", "initialPositions", "=", "initialPositions", ".", "map", "(", "...
rotate crop tool points clockwise @param {?} resizeRatios - ratio between the new dimensions and the previous @param {?} initialPreviewDimensions - preview pane dimensions before rotation @param {?} initialPositions - current positions before rotation @return {?}
[ "rotate", "crop", "tool", "points", "clockwise" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L353-L365
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (corner) { var _this = this; /** @type {?} */ var rotated = { x: this._paneDimensions.width * (1 - corner.y), y: this._paneDimensions.height * corner.x, roles: [] }; // ro...
javascript
function (corner) { var _this = this; /** @type {?} */ var rotated = { x: this._paneDimensions.width * (1 - corner.y), y: this._paneDimensions.height * corner.x, roles: [] }; // ro...
[ "function", "(", "corner", ")", "{", "var", "_this", "=", "this", ";", "/** @type {?} */", "var", "rotated", "=", "{", "x", ":", "this", ".", "_paneDimensions", ".", "width", "*", "(", "1", "-", "corner", ".", "y", ")", ",", "y", ":", "this", ".", ...
returns the corner positions after a 90 degrees clockwise rotation @private @param {?} corner @return {?}
[ "returns", "the", "corner", "positions", "after", "a", "90", "degrees", "clockwise", "rotation" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L381-L402
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (array1, array2) { return array1.every(function (element) { return array2.includes(element); }) && array1.length === array2.length; }
javascript
function (array1, array2) { return array1.every(function (element) { return array2.includes(element); }) && array1.length === array2.length; }
[ "function", "(", "array1", ",", "array2", ")", "{", "return", "array1", ".", "every", "(", "function", "(", "element", ")", "{", "return", "array2", ".", "includes", "(", "element", ")", ";", "}", ")", "&&", "array1", ".", "length", "===", "array2", ...
checks if two array contain the same values @param {?} array1 - array 1 @param {?} array2 - array 2 @return {?} boolean
[ "checks", "if", "two", "array", "contain", "the", "same", "values" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L421-L425
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (position) { /** @type {?} */ var positionChangeData = new PositionChangeData(position, this.limitRoles); /** @type {?} */ var limitException = this.limitsService.exceedsLimit(positionChangeData); if (limitException.exceeds) { ...
javascript
function (position) { /** @type {?} */ var positionChangeData = new PositionChangeData(position, this.limitRoles); /** @type {?} */ var limitException = this.limitsService.exceedsLimit(positionChangeData); if (limitException.exceeds) { ...
[ "function", "(", "position", ")", "{", "/** @type {?} */", "var", "positionChangeData", "=", "new", "PositionChangeData", "(", "position", ",", "this", ".", "limitRoles", ")", ";", "/** @type {?} */", "var", "limitException", "=", "this", ".", "limitsService", "."...
registers a position change on the limits service, and adjusts position if necessary @param {?} position - the current position of the point @return {?}
[ "registers", "a", "position", "change", "on", "the", "limits", "service", "and", "adjusts", "position", "if", "necessary" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L543-L556
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (limitException) { /** @type {?} */ var newPosition = { x: 0, y: 0 }; Object.keys(this.startPosition).forEach(function (axis) { newPosition[axis] = limitException.resetCoordinates[axis] +...
javascript
function (limitException) { /** @type {?} */ var newPosition = { x: 0, y: 0 }; Object.keys(this.startPosition).forEach(function (axis) { newPosition[axis] = limitException.resetCoordinates[axis] +...
[ "function", "(", "limitException", ")", "{", "/** @type {?} */", "var", "newPosition", "=", "{", "x", ":", "0", ",", "y", ":", "0", "}", ";", "Object", ".", "keys", "(", "this", ".", "startPosition", ")", ".", "forEach", "(", "function", "(", "axis", ...
adjusts the position of the point after a limit exception @private @param {?} limitException @return {?}
[ "adjusts", "the", "position", "of", "the", "point", "after", "a", "limit", "exception" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L572-L583
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (position) { /** @type {?} */ var positionChangeData = new PositionChangeData(position, this.limitRoles); /** @type {?} */ var limitException = this.limitsService.exceedsLimit(positionChangeData); if (limitException.exceeds) { ...
javascript
function (position) { /** @type {?} */ var positionChangeData = new PositionChangeData(position, this.limitRoles); /** @type {?} */ var limitException = this.limitsService.exceedsLimit(positionChangeData); if (limitException.exceeds) { ...
[ "function", "(", "position", ")", "{", "/** @type {?} */", "var", "positionChangeData", "=", "new", "PositionChangeData", "(", "position", ",", "this", ".", "limitRoles", ")", ";", "/** @type {?} */", "var", "limitException", "=", "this", ".", "limitsService", "."...
called on movement end, checks if last position exceeded the limits ad adjusts @param {?} position @return {?}
[ "called", "on", "movement", "end", "checks", "if", "last", "position", "exceeded", "the", "limits", "ad", "adjusts" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L597-L610
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (dimensions) { return { x: this.limitRoles.includes('left') ? 0 : dimensions.width - this.width / 2, y: this.limitRoles.includes('top') ? 0 : dimensions.height - this.height / 2 }; }
javascript
function (dimensions) { return { x: this.limitRoles.includes('left') ? 0 : dimensions.width - this.width / 2, y: this.limitRoles.includes('top') ? 0 : dimensions.height - this.height / 2 }; }
[ "function", "(", "dimensions", ")", "{", "return", "{", "x", ":", "this", ".", "limitRoles", ".", "includes", "(", "'left'", ")", "?", "0", ":", "dimensions", ".", "width", "-", "this", ".", "width", "/", "2", ",", "y", ":", "this", ".", "limitRole...
calculates the initial positions of the point by it's roles @private @param {?} dimensions - dimensions of the pane in which the point is located @return {?}
[ "calculates", "the", "initial", "positions", "of", "the", "point", "by", "it", "s", "roles" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L627-L632
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (position) { if (this._paneDimensions.width === 0 || this._paneDimensions.height === 0) { return position; } else { if (position.x > this._paneDimensions.width) { position.x = this._paneDimensions.wi...
javascript
function (position) { if (this._paneDimensions.width === 0 || this._paneDimensions.height === 0) { return position; } else { if (position.x > this._paneDimensions.width) { position.x = this._paneDimensions.wi...
[ "function", "(", "position", ")", "{", "if", "(", "this", ".", "_paneDimensions", ".", "width", "===", "0", "||", "this", ".", "_paneDimensions", ".", "height", "===", "0", ")", "{", "return", "position", ";", "}", "else", "{", "if", "(", "position", ...
returns a new point position if the movement exceeded the pane limit @private @param {?} position @return {?}
[ "returns", "a", "new", "point", "position", "if", "the", "movement", "exceeded", "the", "pane", "limit" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L676-L695
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function () { /** @type {?} */ var canvas = this.canvas.nativeElement; /** @type {?} */ var ctx = canvas.getContext('2d'); ctx.clearRect(0, 0, this.dimensions.width, this.dimensions.height); }
javascript
function () { /** @type {?} */ var canvas = this.canvas.nativeElement; /** @type {?} */ var ctx = canvas.getContext('2d'); ctx.clearRect(0, 0, this.dimensions.width, this.dimensions.height); }
[ "function", "(", ")", "{", "/** @type {?} */", "var", "canvas", "=", "this", ".", "canvas", ".", "nativeElement", ";", "/** @type {?} */", "var", "ctx", "=", "canvas", ".", "getContext", "(", "'2d'", ")", ";", "ctx", ".", "clearRect", "(", "0", ",", "0",...
clears the shape canvas @private @return {?}
[ "clears", "the", "shape", "canvas" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L864-L870
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function () { var _this = this; /** @type {?} */ var _points = Array.from(this._points); /** @type {?} */ var sortedPoints = []; /** @type {?} */ var sortOrder = { vertical: ['top', 'top',...
javascript
function () { var _this = this; /** @type {?} */ var _points = Array.from(this._points); /** @type {?} */ var sortedPoints = []; /** @type {?} */ var sortOrder = { vertical: ['top', 'top',...
[ "function", "(", ")", "{", "var", "_this", "=", "this", ";", "/** @type {?} */", "var", "_points", "=", "Array", ".", "from", "(", "this", ".", "_points", ")", ";", "/** @type {?} */", "var", "sortedPoints", "=", "[", "]", ";", "/** @type {?} */", "var", ...
sorts the array of points according to their clockwise alignment @private @return {?}
[ "sorts", "the", "array", "of", "points", "according", "to", "their", "clockwise", "alignment" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L884-L906
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function () { var _this = this; /** @type {?} */ var canvas = this.canvas.nativeElement; /** @type {?} */ var ctx = canvas.getContext('2d'); ctx.lineWidth = this.weight; ctx.strokeStyle = this.color; ...
javascript
function () { var _this = this; /** @type {?} */ var canvas = this.canvas.nativeElement; /** @type {?} */ var ctx = canvas.getContext('2d'); ctx.lineWidth = this.weight; ctx.strokeStyle = this.color; ...
[ "function", "(", ")", "{", "var", "_this", "=", "this", ";", "/** @type {?} */", "var", "canvas", "=", "this", ".", "canvas", ".", "nativeElement", ";", "/** @type {?} */", "var", "ctx", "=", "canvas", ".", "getContext", "(", "'2d'", ")", ";", "ctx", "."...
draws a line between the points according to their order @private @return {?}
[ "draws", "a", "line", "between", "the", "points", "according", "to", "their", "order" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L920-L943
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function () { return __awaiter(this, void 0, void 0, function () { var _this = this; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.applyFilter(false)]; ...
javascript
function () { return __awaiter(this, void 0, void 0, function () { var _this = this; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.applyFilter(false)]; ...
[ "function", "(", ")", "{", "return", "__awaiter", "(", "this", ",", "void", "0", ",", "void", "0", ",", "function", "(", ")", "{", "var", "_this", "=", "this", ";", "return", "__generator", "(", "this", ",", "function", "(", "_a", ")", "{", "switch...
applies the selected filter, and when done emits the resulted image @private @return {?}
[ "applies", "the", "selected", "filter", "and", "when", "done", "emits", "the", "resulted", "image" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L1234-L1261
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function () { var _this = this; /** @type {?} */ var data = { filter: this.selectedFilter }; /** @type {?} */ var bottomSheetRef = this.bottomSheet.open(NgxFilterMenuComponent, { data: data }); ...
javascript
function () { var _this = this; /** @type {?} */ var data = { filter: this.selectedFilter }; /** @type {?} */ var bottomSheetRef = this.bottomSheet.open(NgxFilterMenuComponent, { data: data }); ...
[ "function", "(", ")", "{", "var", "_this", "=", "this", ";", "/** @type {?} */", "var", "data", "=", "{", "filter", ":", "this", ".", "selectedFilter", "}", ";", "/** @type {?} */", "var", "bottomSheetRef", "=", "this", ".", "bottomSheet", ".", "open", "("...
open the bottom sheet for selecting filters, and applies the selected filter in preview mode @private @return {?}
[ "open", "the", "bottom", "sheet", "for", "selecting", "filters", "and", "applies", "the", "selected", "filter", "in", "preview", "mode" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L1275-L1287
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (file) { var _this = this; return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () { var imageSrc, err_3, img; var _this = this; return __gener...
javascript
function (file) { var _this = this; return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () { var imageSrc, err_3, img; var _this = this; return __gener...
[ "function", "(", "file", ")", "{", "var", "_this", "=", "this", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "return", "__awaiter", "(", "_this", ",", "void", "0", ",", "void", "0", ",", "function", "(", ...
read image from File object @private @param {?} file @return {?}
[ "read", "image", "from", "File", "object" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L1388-L1462
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
readFile
function readFile() { return new Promise(function (resolve, reject) { /** @type {?} */ var reader = new FileReader(); reader.onload = function (event) { resolve(reader.result); ...
javascript
function readFile() { return new Promise(function (resolve, reject) { /** @type {?} */ var reader = new FileReader(); reader.onload = function (event) { resolve(reader.result); ...
[ "function", "readFile", "(", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "/** @type {?} */", "var", "reader", "=", "new", "FileReader", "(", ")", ";", "reader", ".", "onload", "=", "function", "(", "eve...
read file from input field @return {?}
[ "read", "file", "from", "input", "field" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L1449-L1461
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function () { var _this = this; return new Promise(function (resolve, reject) { _this.processing.emit(true); setTimeout(function () { // load the image and compute the ratio of the old height to the new height, clone it, and...
javascript
function () { var _this = this; return new Promise(function (resolve, reject) { _this.processing.emit(true); setTimeout(function () { // load the image and compute the ratio of the old height to the new height, clone it, and...
[ "function", "(", ")", "{", "var", "_this", "=", "this", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "_this", ".", "processing", ".", "emit", "(", "true", ")", ";", "setTimeout", "(", "function", "(", ")"...
detects the contours of the document and @private @return {?}
[ "detects", "the", "contours", "of", "the", "document", "and" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L1538-L1584
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function () { var _this = this; return new Promise(function (resolve, reject) { _this.processing.emit(true); setTimeout(function () { /** @type {?} */ var dst = cv.imread(_this.editedImage); ...
javascript
function () { var _this = this; return new Promise(function (resolve, reject) { _this.processing.emit(true); setTimeout(function () { /** @type {?} */ var dst = cv.imread(_this.editedImage); ...
[ "function", "(", ")", "{", "var", "_this", "=", "this", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "_this", ".", "processing", ".", "emit", "(", "true", ")", ";", "setTimeout", "(", "function", "(", ")"...
apply perspective transform @private @return {?}
[ "apply", "perspective", "transform" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L1598-L1661
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (image) { var _this = this; return new Promise(function (resolve, reject) { _this.processing.emit(true); setTimeout(function () { /** @type {?} */ var src = cv.imread(image); ...
javascript
function (image) { var _this = this; return new Promise(function (resolve, reject) { _this.processing.emit(true); setTimeout(function () { /** @type {?} */ var src = cv.imread(image); ...
[ "function", "(", "image", ")", "{", "var", "_this", "=", "this", ";", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "_this", ".", "processing", ".", "emit", "(", "true", ")", ";", "setTimeout", "(", "function", ...
resize an image to fit constraints set in options.maxImageDimensions @private @param {?} image @return {?}
[ "resize", "an", "image", "to", "fit", "constraints", "set", "in", "options", ".", "maxImageDimensions" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L1774-L1814
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (width, height) { /** @type {?} */ var ratio = width / height; /** @type {?} */ var maxWidth = this.screenDimensions.width > this.maxPreviewWidth ? this.maxPreviewWidth : this.screenDimensions.width - 40; /** @t...
javascript
function (width, height) { /** @type {?} */ var ratio = width / height; /** @type {?} */ var maxWidth = this.screenDimensions.width > this.maxPreviewWidth ? this.maxPreviewWidth : this.screenDimensions.width - 40; /** @t...
[ "function", "(", "width", ",", "height", ")", "{", "/** @type {?} */", "var", "ratio", "=", "width", "/", "height", ";", "/** @type {?} */", "var", "maxWidth", "=", "this", ".", "screenDimensions", ".", "width", ">", "this", ".", "maxPreviewWidth", "?", "thi...
calculate dimensions of the preview canvas @private @param {?} width @param {?} height @return {?}
[ "calculate", "dimensions", "of", "the", "preview", "canvas" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L1908-L1927
train
roiperlman/ngx-document-scanner
dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js
function (roles) { var _this = this; return this.points.find(function (point) { return _this.limitsService.compareArray(point.roles, roles); }); }
javascript
function (roles) { var _this = this; return this.points.find(function (point) { return _this.limitsService.compareArray(point.roles, roles); }); }
[ "function", "(", "roles", ")", "{", "var", "_this", "=", "this", ";", "return", "this", ".", "points", ".", "find", "(", "function", "(", "point", ")", "{", "return", "_this", ".", "limitsService", ".", "compareArray", "(", "point", ".", "roles", ",", ...
returns a point by it's roles @private @param {?} roles - an array of roles by which the point will be fetched @return {?}
[ "returns", "a", "point", "by", "it", "s", "roles" ]
9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c
https://github.com/roiperlman/ngx-document-scanner/blob/9c90358267a8c0cdd3ffcc3e41ee6a059b12d67c/dist/ngx-document-scanner/bundles/ngx-document-scanner.umd.js#L1944-L1949
train
VKCOM/node-vk-call
lib/persistent_longpoll.js
longpollStream
function longpollStream(http, mutable) { return asyncMapRecover(function(creds) { return http({ timeout: LONGPOLL_TIMEOUT, url: makeUrl(assign({}, creds, mutable)) }).then(function(body) { return JSON.parse(body); }).catch((error) => { return Promise.reject({ type: ERROR_TY...
javascript
function longpollStream(http, mutable) { return asyncMapRecover(function(creds) { return http({ timeout: LONGPOLL_TIMEOUT, url: makeUrl(assign({}, creds, mutable)) }).then(function(body) { return JSON.parse(body); }).catch((error) => { return Promise.reject({ type: ERROR_TY...
[ "function", "longpollStream", "(", "http", ",", "mutable", ")", "{", "return", "asyncMapRecover", "(", "function", "(", "creds", ")", "{", "return", "http", "(", "{", "timeout", ":", "LONGPOLL_TIMEOUT", ",", "url", ":", "makeUrl", "(", "assign", "(", "{", ...
Stream that requests longpoll and processes its data. Can throw errors in case longpoll request returned error, or if failed parameter present in response.
[ "Stream", "that", "requests", "longpoll", "and", "processes", "its", "data", ".", "Can", "throw", "errors", "in", "case", "longpoll", "request", "returned", "error", "or", "if", "failed", "parameter", "present", "in", "response", "." ]
e829dca81c33908025a84e4f954bbddb210dfccc
https://github.com/VKCOM/node-vk-call/blob/e829dca81c33908025a84e4f954bbddb210dfccc/lib/persistent_longpoll.js#L44-L69
train
VKCOM/node-vk-call
lib/stream_utils.js
cacher
function cacher() { let cache = false; return function(read) { return function readable(end, cb) { if (end === null && cache) { cb(null, cache); } else { read(end, function (end, data) { cache = data; cb(end, data) }); } } } }
javascript
function cacher() { let cache = false; return function(read) { return function readable(end, cb) { if (end === null && cache) { cb(null, cache); } else { read(end, function (end, data) { cache = data; cb(end, data) }); } } } }
[ "function", "cacher", "(", ")", "{", "let", "cache", "=", "false", ";", "return", "function", "(", "read", ")", "{", "return", "function", "readable", "(", "end", ",", "cb", ")", "{", "if", "(", "end", "===", "null", "&&", "cache", ")", "{", "cb", ...
Through stream that remembers first value it got and repeats it, propagates errors in both ways.
[ "Through", "stream", "that", "remembers", "first", "value", "it", "got", "and", "repeats", "it", "propagates", "errors", "in", "both", "ways", "." ]
e829dca81c33908025a84e4f954bbddb210dfccc
https://github.com/VKCOM/node-vk-call/blob/e829dca81c33908025a84e4f954bbddb210dfccc/lib/stream_utils.js#L7-L21
train
creationix/nstore
lib/file.js
safe3
function safe3(fn) { var queue = Queue.new(); var safe = true; function checkQueue() { var next = queue.shift(); safe = false; fn(next[0], next[1], next[2], function (error, result) { next[3](error, result); if (queue.length > 0) { checkQueue(); } else { safe = true; ...
javascript
function safe3(fn) { var queue = Queue.new(); var safe = true; function checkQueue() { var next = queue.shift(); safe = false; fn(next[0], next[1], next[2], function (error, result) { next[3](error, result); if (queue.length > 0) { checkQueue(); } else { safe = true; ...
[ "function", "safe3", "(", "fn", ")", "{", "var", "queue", "=", "Queue", ".", "new", "(", ")", ";", "var", "safe", "=", "true", ";", "function", "checkQueue", "(", ")", "{", "var", "next", "=", "queue", ".", "shift", "(", ")", ";", "safe", "=", ...
Makes an async function that takes 3 arguments only execute one at a time.
[ "Makes", "an", "async", "function", "that", "takes", "3", "arguments", "only", "execute", "one", "at", "a", "time", "." ]
c5e6a8a2be364e9294bca0f9caf4d46fa5e3c6b1
https://github.com/creationix/nstore/blob/c5e6a8a2be364e9294bca0f9caf4d46fa5e3c6b1/lib/file.js#L57-L78
train
codemix/htmling
lib/optimiser.js
removeNestedBlocks
function removeNestedBlocks (ast) { var tagged; while((tagged = findNestedBlocks(ast)).length) { fast.forEach(tagged, function (item) { var node = item[0], parent = item[1], index = parent.body.indexOf(node); fast.apply(Array.prototype.splice, parent.body, fast.concat([index, 1],...
javascript
function removeNestedBlocks (ast) { var tagged; while((tagged = findNestedBlocks(ast)).length) { fast.forEach(tagged, function (item) { var node = item[0], parent = item[1], index = parent.body.indexOf(node); fast.apply(Array.prototype.splice, parent.body, fast.concat([index, 1],...
[ "function", "removeNestedBlocks", "(", "ast", ")", "{", "var", "tagged", ";", "while", "(", "(", "tagged", "=", "findNestedBlocks", "(", "ast", ")", ")", ".", "length", ")", "{", "fast", ".", "forEach", "(", "tagged", ",", "function", "(", "item", ")",...
Remove pointless nested BlockStatements that are caused by the compilation process.
[ "Remove", "pointless", "nested", "BlockStatements", "that", "are", "caused", "by", "the", "compilation", "process", "." ]
d1448b975f8b595a49aa5f8ea7006d48b7755b4c
https://github.com/codemix/htmling/blob/d1448b975f8b595a49aa5f8ea7006d48b7755b4c/lib/optimiser.js#L28-L39
train
codemix/htmling
lib/optimiser.js
findNestedBlocks
function findNestedBlocks (ast) { var tagged = []; traverse.traverse(ast, { enter: function (node, parent) { if (node.type === 'BlockStatement' && parent && parent.type === 'BlockStatement') { tagged.push([node, parent]); } } }); return tagged; }
javascript
function findNestedBlocks (ast) { var tagged = []; traverse.traverse(ast, { enter: function (node, parent) { if (node.type === 'BlockStatement' && parent && parent.type === 'BlockStatement') { tagged.push([node, parent]); } } }); return tagged; }
[ "function", "findNestedBlocks", "(", "ast", ")", "{", "var", "tagged", "=", "[", "]", ";", "traverse", ".", "traverse", "(", "ast", ",", "{", "enter", ":", "function", "(", "node", ",", "parent", ")", "{", "if", "(", "node", ".", "type", "===", "'B...
Find BlockStatements which are direct children of BlockStatements.
[ "Find", "BlockStatements", "which", "are", "direct", "children", "of", "BlockStatements", "." ]
d1448b975f8b595a49aa5f8ea7006d48b7755b4c
https://github.com/codemix/htmling/blob/d1448b975f8b595a49aa5f8ea7006d48b7755b4c/lib/optimiser.js#L44-L54
train
codemix/htmling
lib/optimiser.js
findHoistableFunctionDeclarations
function findHoistableFunctionDeclarations (ast) { var tagged = []; traverse.traverse(ast, { enter: function (node, parent) { if (node.type === 'FunctionDeclaration' && ~node.id.name.indexOf('$')) { tagged.push([node, parent]); } } }); return tagged; }
javascript
function findHoistableFunctionDeclarations (ast) { var tagged = []; traverse.traverse(ast, { enter: function (node, parent) { if (node.type === 'FunctionDeclaration' && ~node.id.name.indexOf('$')) { tagged.push([node, parent]); } } }); return tagged; }
[ "function", "findHoistableFunctionDeclarations", "(", "ast", ")", "{", "var", "tagged", "=", "[", "]", ";", "traverse", ".", "traverse", "(", "ast", ",", "{", "enter", ":", "function", "(", "node", ",", "parent", ")", "{", "if", "(", "node", ".", "type...
Find function declarations which can be hoisted,
[ "Find", "function", "declarations", "which", "can", "be", "hoisted" ]
d1448b975f8b595a49aa5f8ea7006d48b7755b4c
https://github.com/codemix/htmling/blob/d1448b975f8b595a49aa5f8ea7006d48b7755b4c/lib/optimiser.js#L74-L85
train
codemix/htmling
lib/optimiser.js
combineContiguousOutputStatements
function combineContiguousOutputStatements (ast) { traverse.traverse(ast, { enter: function (node, parent) { if (node.type !== 'BlockStatement') { return; } var prev = false; node.body = fast.reduce(node.body, function (body, statement) { if ( !body.length || ...
javascript
function combineContiguousOutputStatements (ast) { traverse.traverse(ast, { enter: function (node, parent) { if (node.type !== 'BlockStatement') { return; } var prev = false; node.body = fast.reduce(node.body, function (body, statement) { if ( !body.length || ...
[ "function", "combineContiguousOutputStatements", "(", "ast", ")", "{", "traverse", ".", "traverse", "(", "ast", ",", "{", "enter", ":", "function", "(", "node", ",", "parent", ")", "{", "if", "(", "node", ".", "type", "!==", "'BlockStatement'", ")", "{", ...
Turn sequential OutputStatements into one big one.
[ "Turn", "sequential", "OutputStatements", "into", "one", "big", "one", "." ]
d1448b975f8b595a49aa5f8ea7006d48b7755b4c
https://github.com/codemix/htmling/blob/d1448b975f8b595a49aa5f8ea7006d48b7755b4c/lib/optimiser.js#L132-L169
train
codemix/htmling
lib/optimiser.js
removeUnusedAssignmentExpressions
function removeUnusedAssignmentExpressions (ast) { var unused = findUnusedAssignmentExpressions(ast); traverse.traverse(ast, { enter: function (node, parent) { if (node.type !== 'BlockStatement') { return; } node.body = fast.filter(node.body, function (item) { return !~fast.ind...
javascript
function removeUnusedAssignmentExpressions (ast) { var unused = findUnusedAssignmentExpressions(ast); traverse.traverse(ast, { enter: function (node, parent) { if (node.type !== 'BlockStatement') { return; } node.body = fast.filter(node.body, function (item) { return !~fast.ind...
[ "function", "removeUnusedAssignmentExpressions", "(", "ast", ")", "{", "var", "unused", "=", "findUnusedAssignmentExpressions", "(", "ast", ")", ";", "traverse", ".", "traverse", "(", "ast", ",", "{", "enter", ":", "function", "(", "node", ",", "parent", ")", ...
If the result of an AssignmentExpression is not used, remove the expression entirely.
[ "If", "the", "result", "of", "an", "AssignmentExpression", "is", "not", "used", "remove", "the", "expression", "entirely", "." ]
d1448b975f8b595a49aa5f8ea7006d48b7755b4c
https://github.com/codemix/htmling/blob/d1448b975f8b595a49aa5f8ea7006d48b7755b4c/lib/optimiser.js#L231-L244
train
codemix/htmling
lib/optimiser.js
removeUnusedVariableDeclarators
function removeUnusedVariableDeclarators (ast) { var unused = findUnusedVariableDeclarators(ast); traverse.traverse(ast, { enter: function (node, parent) { if (node.type !== 'VariableDeclaration') { return; } node.declarations = fast.filter(node.declarations, function (item) { ...
javascript
function removeUnusedVariableDeclarators (ast) { var unused = findUnusedVariableDeclarators(ast); traverse.traverse(ast, { enter: function (node, parent) { if (node.type !== 'VariableDeclaration') { return; } node.declarations = fast.filter(node.declarations, function (item) { ...
[ "function", "removeUnusedVariableDeclarators", "(", "ast", ")", "{", "var", "unused", "=", "findUnusedVariableDeclarators", "(", "ast", ")", ";", "traverse", ".", "traverse", "(", "ast", ",", "{", "enter", ":", "function", "(", "node", ",", "parent", ")", "{...
If a variable is declared, but not used, remove it.
[ "If", "a", "variable", "is", "declared", "but", "not", "used", "remove", "it", "." ]
d1448b975f8b595a49aa5f8ea7006d48b7755b4c
https://github.com/codemix/htmling/blob/d1448b975f8b595a49aa5f8ea7006d48b7755b4c/lib/optimiser.js#L277-L290
train
codemix/htmling
lib/optimiser.js
findUnusedVariableDeclarators
function findUnusedVariableDeclarators (ast) { var unused = []; traverse.traverse(ast, { enter: function (node, parent) { var scope, refs; if (node.type === 'VariableDeclarator' && (scope = findScope(ast, node))) { refs = fast.filter(findVariableReferences(scope, node.id), function (item) { ...
javascript
function findUnusedVariableDeclarators (ast) { var unused = []; traverse.traverse(ast, { enter: function (node, parent) { var scope, refs; if (node.type === 'VariableDeclarator' && (scope = findScope(ast, node))) { refs = fast.filter(findVariableReferences(scope, node.id), function (item) { ...
[ "function", "findUnusedVariableDeclarators", "(", "ast", ")", "{", "var", "unused", "=", "[", "]", ";", "traverse", ".", "traverse", "(", "ast", ",", "{", "enter", ":", "function", "(", "node", ",", "parent", ")", "{", "var", "scope", ",", "refs", ";",...
Find declarators of unused variables.
[ "Find", "declarators", "of", "unused", "variables", "." ]
d1448b975f8b595a49aa5f8ea7006d48b7755b4c
https://github.com/codemix/htmling/blob/d1448b975f8b595a49aa5f8ea7006d48b7755b4c/lib/optimiser.js#L295-L312
train
codemix/htmling
lib/optimiser.js
findVariableReferences
function findVariableReferences (ast, identifier, skip) { var references = []; traverse.traverse(ast, { enter: function (node, parent) { if (node === skip) { this.skip(); } else if ( node.type === 'Identifier' && node.name === identifier.name && (parent.ty...
javascript
function findVariableReferences (ast, identifier, skip) { var references = []; traverse.traverse(ast, { enter: function (node, parent) { if (node === skip) { this.skip(); } else if ( node.type === 'Identifier' && node.name === identifier.name && (parent.ty...
[ "function", "findVariableReferences", "(", "ast", ",", "identifier", ",", "skip", ")", "{", "var", "references", "=", "[", "]", ";", "traverse", ".", "traverse", "(", "ast", ",", "{", "enter", ":", "function", "(", "node", ",", "parent", ")", "{", "if"...
Find references to a given identifier
[ "Find", "references", "to", "a", "given", "identifier" ]
d1448b975f8b595a49aa5f8ea7006d48b7755b4c
https://github.com/codemix/htmling/blob/d1448b975f8b595a49aa5f8ea7006d48b7755b4c/lib/optimiser.js#L317-L334
train
codemix/htmling
lib/optimiser.js
findScope
function findScope (ast, item) { var scopes = [], found = false; traverse.traverse(ast, { enter: function (node, parent) { if (node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression') { scopes.push(node); } else if (node === item) { found = scopes[scopes...
javascript
function findScope (ast, item) { var scopes = [], found = false; traverse.traverse(ast, { enter: function (node, parent) { if (node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression') { scopes.push(node); } else if (node === item) { found = scopes[scopes...
[ "function", "findScope", "(", "ast", ",", "item", ")", "{", "var", "scopes", "=", "[", "]", ",", "found", "=", "false", ";", "traverse", ".", "traverse", "(", "ast", ",", "{", "enter", ":", "function", "(", "node", ",", "parent", ")", "{", "if", ...
Find the scope for an item in the AST.
[ "Find", "the", "scope", "for", "an", "item", "in", "the", "AST", "." ]
d1448b975f8b595a49aa5f8ea7006d48b7755b4c
https://github.com/codemix/htmling/blob/d1448b975f8b595a49aa5f8ea7006d48b7755b4c/lib/optimiser.js#L339-L359
train
Dan503/mq-scss
gulp/tasks/release.js
getBumpType
function getBumpType(){ if (args.patch && args.minor || args.minor && args.major || args.major && args.patch) { throw '\nYou can not use more than one version bump type at a time\n'; } if (args.patch){ return 'patch'; } else if (args.minor){ return 'minor'; } else if (args.major) { return 'major'; } else...
javascript
function getBumpType(){ if (args.patch && args.minor || args.minor && args.major || args.major && args.patch) { throw '\nYou can not use more than one version bump type at a time\n'; } if (args.patch){ return 'patch'; } else if (args.minor){ return 'minor'; } else if (args.major) { return 'major'; } else...
[ "function", "getBumpType", "(", ")", "{", "if", "(", "args", ".", "patch", "&&", "args", ".", "minor", "||", "args", ".", "minor", "&&", "args", ".", "major", "||", "args", ".", "major", "&&", "args", ".", "patch", ")", "{", "throw", "'\\nYou can not...
SIMPLE VERSION BUMPING Bumping version number and tagging the repository with it. Please read http://semver.org/ You can use the commands gulp bump --patch # makes v0.1.0 → v0.1.1 gulp bump --minor # makes v0.1.1 → v0.2.0 gulp bump --major # makes v0.2.1 → v1.0.0 To bump the version numbers accordingly after ...
[ "SIMPLE", "VERSION", "BUMPING" ]
4676281b290e1fb7e2d524cc8f79f9acf69bc4cf
https://github.com/Dan503/mq-scss/blob/4676281b290e1fb7e2d524cc8f79f9acf69bc4cf/gulp/tasks/release.js#L47-L61
train
Dan503/mq-scss
gulp/tasks/release.js
bumpVersion
function bumpVersion(importance){ return function bump_version (done){ if (!importance) throw new Error(` An importance must be specified for a version bump to occur. Valid importances: "--patch", "--minor", "--major" `); // get all the files to bump version in return gulp.src('./package.json') // bump th...
javascript
function bumpVersion(importance){ return function bump_version (done){ if (!importance) throw new Error(` An importance must be specified for a version bump to occur. Valid importances: "--patch", "--minor", "--major" `); // get all the files to bump version in return gulp.src('./package.json') // bump th...
[ "function", "bumpVersion", "(", "importance", ")", "{", "return", "function", "bump_version", "(", "done", ")", "{", "if", "(", "!", "importance", ")", "throw", "new", "Error", "(", "`", "`", ")", ";", "// get all the files to bump version in", "return", "gulp...
Bump up the current version number
[ "Bump", "up", "the", "current", "version", "number" ]
4676281b290e1fb7e2d524cc8f79f9acf69bc4cf
https://github.com/Dan503/mq-scss/blob/4676281b290e1fb7e2d524cc8f79f9acf69bc4cf/gulp/tasks/release.js#L68-L83
train
Dan503/mq-scss
gulp/tasks/release.js
tag_version
function tag_version(){ return new Promise((resolve, reject)=>{ const pkg = reload('../../package.json'); const tag = `v${pkg.version}`; gutil.log('Tagging as: '+gutil.colors.cyan(tag)); git.tag(tag, `Tagging as ${tag}`, (err)=>{ checkError(err); resolve(tag); }) }) }
javascript
function tag_version(){ return new Promise((resolve, reject)=>{ const pkg = reload('../../package.json'); const tag = `v${pkg.version}`; gutil.log('Tagging as: '+gutil.colors.cyan(tag)); git.tag(tag, `Tagging as ${tag}`, (err)=>{ checkError(err); resolve(tag); }) }) }
[ "function", "tag_version", "(", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "const", "pkg", "=", "reload", "(", "'../../package.json'", ")", ";", "const", "tag", "=", "`", "${", "pkg", ".", "version", "}", ...
Tag current version number in git
[ "Tag", "current", "version", "number", "in", "git" ]
4676281b290e1fb7e2d524cc8f79f9acf69bc4cf
https://github.com/Dan503/mq-scss/blob/4676281b290e1fb7e2d524cc8f79f9acf69bc4cf/gulp/tasks/release.js#L86-L96
train
Dan503/mq-scss
gulp/tasks/release.js
release
function release(importance) { const version_bump = done => importance !== false ? gulp.series(bumpVersion(importance))(done) : done(); return done => gulp.series( () => check_out('develop'), version_bump, finish_release )(done); }
javascript
function release(importance) { const version_bump = done => importance !== false ? gulp.series(bumpVersion(importance))(done) : done(); return done => gulp.series( () => check_out('develop'), version_bump, finish_release )(done); }
[ "function", "release", "(", "importance", ")", "{", "const", "version_bump", "=", "done", "=>", "importance", "!==", "false", "?", "gulp", ".", "series", "(", "bumpVersion", "(", "importance", ")", ")", "(", "done", ")", ":", "done", "(", ")", ";", "re...
Do a full Git Flow release which can optionally include a version bump
[ "Do", "a", "full", "Git", "Flow", "release", "which", "can", "optionally", "include", "a", "version", "bump" ]
4676281b290e1fb7e2d524cc8f79f9acf69bc4cf
https://github.com/Dan503/mq-scss/blob/4676281b290e1fb7e2d524cc8f79f9acf69bc4cf/gulp/tasks/release.js#L129-L137
train
staruml/metadata-json
core/MetaModelManager.js
validateMetaType
function validateMetaType(name, metaType) { assert(_.isObject(metaType), ERR_METATYPE_OBJECT, { name: name }); assert(metaType.name, ERR_REQUIRE_FIELD, { metaType: metaType, field: "name" }); assert(metaType.kind === "enum" || metaType.kind === "class", ERR_METATYPE_KIND, { metaType: metaType })...
javascript
function validateMetaType(name, metaType) { assert(_.isObject(metaType), ERR_METATYPE_OBJECT, { name: name }); assert(metaType.name, ERR_REQUIRE_FIELD, { metaType: metaType, field: "name" }); assert(metaType.kind === "enum" || metaType.kind === "class", ERR_METATYPE_KIND, { metaType: metaType })...
[ "function", "validateMetaType", "(", "name", ",", "metaType", ")", "{", "assert", "(", "_", ".", "isObject", "(", "metaType", ")", ",", "ERR_METATYPE_OBJECT", ",", "{", "name", ":", "name", "}", ")", ";", "assert", "(", "metaType", ".", "name", ",", "E...
Validate MetaType Definition @param {Object} metaType
[ "Validate", "MetaType", "Definition" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/MetaModelManager.js#L64-L113
train
staruml/metadata-json
core/MetaModelManager.js
register
function register(metamodel) { var name, metaType; // Registering MetaTypes to global.meta for (name in metamodel) { if (metamodel.hasOwnProperty(name)) { metaType = metamodel[name]; metaType.name = name; // Check duplicated MetaType ...
javascript
function register(metamodel) { var name, metaType; // Registering MetaTypes to global.meta for (name in metamodel) { if (metamodel.hasOwnProperty(name)) { metaType = metamodel[name]; metaType.name = name; // Check duplicated MetaType ...
[ "function", "register", "(", "metamodel", ")", "{", "var", "name", ",", "metaType", ";", "// Registering MetaTypes to global.meta", "for", "(", "name", "in", "metamodel", ")", "{", "if", "(", "metamodel", ".", "hasOwnProperty", "(", "name", ")", ")", "{", "m...
Register Metamodel by Object @param {Object} metamodel
[ "Register", "Metamodel", "by", "Object" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/MetaModelManager.js#L119-L149
train
staruml/metadata-json
core/MetaModelManager.js
getMetaAttributes
function getMetaAttributes(typeName) { var metaClass = _global.meta[typeName], attrs = []; if (metaClass.super) { attrs = getMetaAttributes(metaClass.super); } if (metaClass.attributes) { var i, len, item; for (i = 0, len = metaClass.at...
javascript
function getMetaAttributes(typeName) { var metaClass = _global.meta[typeName], attrs = []; if (metaClass.super) { attrs = getMetaAttributes(metaClass.super); } if (metaClass.attributes) { var i, len, item; for (i = 0, len = metaClass.at...
[ "function", "getMetaAttributes", "(", "typeName", ")", "{", "var", "metaClass", "=", "_global", ".", "meta", "[", "typeName", "]", ",", "attrs", "=", "[", "]", ";", "if", "(", "metaClass", ".", "super", ")", "{", "attrs", "=", "getMetaAttributes", "(", ...
Return all meta-attributes @param {string} typeName @return {Array.<{name:string, kind:string, type:string}>}
[ "Return", "all", "meta", "-", "attributes" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/MetaModelManager.js#L156-L170
train
staruml/metadata-json
core/MetaModelManager.js
getViewTypeOf
function getViewTypeOf(typeName) { var metaClass = _global.meta[typeName]; if (metaClass) { return metaClass.view || null; } return null; }
javascript
function getViewTypeOf(typeName) { var metaClass = _global.meta[typeName]; if (metaClass) { return metaClass.view || null; } return null; }
[ "function", "getViewTypeOf", "(", "typeName", ")", "{", "var", "metaClass", "=", "_global", ".", "meta", "[", "typeName", "]", ";", "if", "(", "metaClass", ")", "{", "return", "metaClass", ".", "view", "||", "null", ";", "}", "return", "null", ";", "}"...
Return a corresponding view type of a given model type. @param {string} typeName @return {string}
[ "Return", "a", "corresponding", "view", "type", "of", "a", "given", "model", "type", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/MetaModelManager.js#L194-L200
train
staruml/metadata-json
core/MetaModelManager.js
getAvailableViewTypes
function getAvailableViewTypes(diagramTypeName) { var metaClass = _global.meta[diagramTypeName], views = []; if (metaClass.super) { views = getAvailableViewTypes(metaClass.super); } if (metaClass.views) { var i, len, item; for (i = 0, l...
javascript
function getAvailableViewTypes(diagramTypeName) { var metaClass = _global.meta[diagramTypeName], views = []; if (metaClass.super) { views = getAvailableViewTypes(metaClass.super); } if (metaClass.views) { var i, len, item; for (i = 0, l...
[ "function", "getAvailableViewTypes", "(", "diagramTypeName", ")", "{", "var", "metaClass", "=", "_global", ".", "meta", "[", "diagramTypeName", "]", ",", "views", "=", "[", "]", ";", "if", "(", "metaClass", ".", "super", ")", "{", "views", "=", "getAvailab...
Return all available view types of a diagram type. @param {string} diagramTypeName @return {Array.<string}>}
[ "Return", "all", "available", "view", "types", "of", "a", "diagram", "type", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/MetaModelManager.js#L207-L221
train
silexlabs/unifile
lib/unifile-dropbox.js
callAPI
function callAPI(session, path, data, subdomain = 'api', isJson = true, headers = null) { const authorization = 'Bearer ' + session.token; const reqOptions = { url: `https://${subdomain}.dropboxapi.com/2${path}`, method: 'POST', headers: { 'Authorization': authorization, 'User-Agent': 'Unifile' }, js...
javascript
function callAPI(session, path, data, subdomain = 'api', isJson = true, headers = null) { const authorization = 'Bearer ' + session.token; const reqOptions = { url: `https://${subdomain}.dropboxapi.com/2${path}`, method: 'POST', headers: { 'Authorization': authorization, 'User-Agent': 'Unifile' }, js...
[ "function", "callAPI", "(", "session", ",", "path", ",", "data", ",", "subdomain", "=", "'api'", ",", "isJson", "=", "true", ",", "headers", "=", "null", ")", "{", "const", "authorization", "=", "'Bearer '", "+", "session", ".", "token", ";", "const", ...
Make a call to the Dropbox API @param {Object} session - Dropbox session storage @param {string} path - End point path @param {Object} data - Data to pass. Convert to querystring if method is GET or to the request body @param {string} [subdomain=api] - Subdomain of the endpoint to call (api/content) @param {boolean} [i...
[ "Make", "a", "call", "to", "the", "Dropbox", "API" ]
bc0750736ccdb3f6cf620ad5063ee851ceeaf445
https://github.com/silexlabs/unifile/blob/bc0750736ccdb3f6cf620ad5063ee851ceeaf445/lib/unifile-dropbox.js#L27-L87
train
silexlabs/unifile
lib/unifile-dropbox.js
safeStringify
function safeStringify(v) { return JSON.stringify(v).replace(charsToEncode, function(c) { return '\\u' + ('000' + c.charCodeAt(0).toString(16)).slice(-4); } ); }
javascript
function safeStringify(v) { return JSON.stringify(v).replace(charsToEncode, function(c) { return '\\u' + ('000' + c.charCodeAt(0).toString(16)).slice(-4); } ); }
[ "function", "safeStringify", "(", "v", ")", "{", "return", "JSON", ".", "stringify", "(", "v", ")", ".", "replace", "(", "charsToEncode", ",", "function", "(", "c", ")", "{", "return", "'\\\\u'", "+", "(", "'000'", "+", "c", ".", "charCodeAt", "(", "...
Stringifies a JSON object and make it header-safe by encoding non-ASCII characters. @param {Object} v - JSON object to stringify @returns {String} the stringified object with special chars encoded @see https://www.dropboxforum.com/t5/API-support/HTTP-header-quot-Dropbox-API-Arg-quot-could-not-decode-input-as/td-p/173...
[ "Stringifies", "a", "JSON", "object", "and", "make", "it", "header", "-", "safe", "by", "encoding", "non", "-", "ASCII", "characters", "." ]
bc0750736ccdb3f6cf620ad5063ee851ceeaf445
https://github.com/silexlabs/unifile/blob/bc0750736ccdb3f6cf620ad5063ee851ceeaf445/lib/unifile-dropbox.js#L163-L169
train
staruml/metadata-json
lib/html.js
exportToHTML
function exportToHTML(targetDir, exportDiagram) { fs.ensureDirSync(targetDir); fs.ensureDirSync(targetDir + "/contents"); fs.ensureDirSync(targetDir + "/diagrams"); fs.copySync(__dirname + "/../resources/html/assets", targetDir + "/assets"); // Generate html documents try { var root = md...
javascript
function exportToHTML(targetDir, exportDiagram) { fs.ensureDirSync(targetDir); fs.ensureDirSync(targetDir + "/contents"); fs.ensureDirSync(targetDir + "/diagrams"); fs.copySync(__dirname + "/../resources/html/assets", targetDir + "/assets"); // Generate html documents try { var root = md...
[ "function", "exportToHTML", "(", "targetDir", ",", "exportDiagram", ")", "{", "fs", ".", "ensureDirSync", "(", "targetDir", ")", ";", "fs", ".", "ensureDirSync", "(", "targetDir", "+", "\"/contents\"", ")", ";", "fs", ".", "ensureDirSync", "(", "targetDir", ...
Export to HTML @param{string} targetDir Path where generated HTML files to be located @param{boolean} exportDiagram Indicate whether generate diagram images or not
[ "Export", "to", "HTML" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/lib/html.js#L102-L129
train
staruml/metadata-json
core/Validator.js
addRules
function addRules(rules) { _.each(rules, function (rule) { _global.rules[rule.id] = rule; }); }
javascript
function addRules(rules) { _.each(rules, function (rule) { _global.rules[rule.id] = rule; }); }
[ "function", "addRules", "(", "rules", ")", "{", "_", ".", "each", "(", "rules", ",", "function", "(", "rule", ")", "{", "_global", ".", "rules", "[", "rule", ".", "id", "]", "=", "rule", ";", "}", ")", ";", "}" ]
Add validation rules @param {Array.<Object>} rules
[ "Add", "validation", "rules" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Validator.js#L38-L42
train
staruml/metadata-json
examples/ex_canvas.js
getImageData
function getImageData(diagram, type) { // Make a new canvas element for making image data var canvasElement = new Canvas(500, 500, type), canvas = new mdjson.Graphics.Canvas(canvasElement.getContext("2d")), boundingBox = diagram.getBoundingBox(canvas), rectExpand = 10; /...
javascript
function getImageData(diagram, type) { // Make a new canvas element for making image data var canvasElement = new Canvas(500, 500, type), canvas = new mdjson.Graphics.Canvas(canvasElement.getContext("2d")), boundingBox = diagram.getBoundingBox(canvas), rectExpand = 10; /...
[ "function", "getImageData", "(", "diagram", ",", "type", ")", "{", "// Make a new canvas element for making image data", "var", "canvasElement", "=", "new", "Canvas", "(", "500", ",", "500", ",", "type", ")", ",", "canvas", "=", "new", "mdjson", ".", "Graphics",...
Get image data of diagram @param {Diagram} diagram @return {Buffer}
[ "Get", "image", "data", "of", "diagram" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/examples/ex_canvas.js#L10-L27
train
eeshi/node-scrapy
index.js
ScrapeError
function ScrapeError(msg, response, bodyString) { Error.call(this, msg); this.response = response; this.bodyString = bodyString; }
javascript
function ScrapeError(msg, response, bodyString) { Error.call(this, msg); this.response = response; this.bodyString = bodyString; }
[ "function", "ScrapeError", "(", "msg", ",", "response", ",", "bodyString", ")", "{", "Error", ".", "call", "(", "this", ",", "msg", ")", ";", "this", ".", "response", "=", "response", ";", "this", ".", "bodyString", "=", "bodyString", ";", "}" ]
Custom Error for node-scrapy
[ "Custom", "Error", "for", "node", "-", "scrapy" ]
071f29ac5cc6eab0e3f4919709002a3bdbfc19ad
https://github.com/eeshi/node-scrapy/blob/071f29ac5cc6eab0e3f4919709002a3bdbfc19ad/index.js#L70-L75
train
eeshi/node-scrapy
index.js
scrape
function scrape(url, model, options, cb) { /** * Make `options` argument optional */ if ('function' === typeof options) { /** * Interchange `cb`'s position and fill `options` with nice defaults */ cb = options; options = _.cloneDeep(DEFAULTS); } else { /** * Merge all op...
javascript
function scrape(url, model, options, cb) { /** * Make `options` argument optional */ if ('function' === typeof options) { /** * Interchange `cb`'s position and fill `options` with nice defaults */ cb = options; options = _.cloneDeep(DEFAULTS); } else { /** * Merge all op...
[ "function", "scrape", "(", "url", ",", "model", ",", "options", ",", "cb", ")", "{", "/**\n * Make `options` argument optional\n */", "if", "(", "'function'", "===", "typeof", "options", ")", "{", "/**\n * Interchange `cb`'s position and fill `options` with nice def...
Scrape a web page @param {string} url Valid URL to scrape @param {Object|string} model String or object describing the data to be extracted from the given url @param {Object} [options={}] Aditional options for request and cheerio @param {Function} cb Stan...
[ "Scrape", "a", "web", "page" ]
071f29ac5cc6eab0e3f4919709002a3bdbfc19ad
https://github.com/eeshi/node-scrapy/blob/071f29ac5cc6eab0e3f4919709002a3bdbfc19ad/index.js#L89-L142
train
eeshi/node-scrapy
index.js
parseBody
function parseBody(bodyString, model, options, cb) { var result; var dom; /** * Load the HTML and parse it with cheerio to create a DOM */ try { dom = cheerio.load(bodyString, options.cheerioOptions); } catch (err) { err.bodyString = bodyString; return cb(err); } result = getItem(dom...
javascript
function parseBody(bodyString, model, options, cb) { var result; var dom; /** * Load the HTML and parse it with cheerio to create a DOM */ try { dom = cheerio.load(bodyString, options.cheerioOptions); } catch (err) { err.bodyString = bodyString; return cb(err); } result = getItem(dom...
[ "function", "parseBody", "(", "bodyString", ",", "model", ",", "options", ",", "cb", ")", "{", "var", "result", ";", "var", "dom", ";", "/**\n * Load the HTML and parse it with cheerio to create a DOM\n */", "try", "{", "dom", "=", "cheerio", ".", "load", "(",...
Parse the HTML in search of each item in `model` @param {string} bodyString HTML content @param {Object|string} model Data model or string @param {Object} options Item defaults @param {Function} cb Callback @return {null}
[ "Parse", "the", "HTML", "in", "search", "of", "each", "item", "in", "model" ]
071f29ac5cc6eab0e3f4919709002a3bdbfc19ad
https://github.com/eeshi/node-scrapy/blob/071f29ac5cc6eab0e3f4919709002a3bdbfc19ad/index.js#L153-L178
train
eeshi/node-scrapy
index.js
getItem
function getItem(dom, item, defaults) { var data; var get; var trim; var nodes; var selector; /** * If the `item` itself is a selector, grab it as `selector` and set item to * a new empty object. */ if ('string' === typeof item) { selector = item; item = {}; /** * If not, it sho...
javascript
function getItem(dom, item, defaults) { var data; var get; var trim; var nodes; var selector; /** * If the `item` itself is a selector, grab it as `selector` and set item to * a new empty object. */ if ('string' === typeof item) { selector = item; item = {}; /** * If not, it sho...
[ "function", "getItem", "(", "dom", ",", "item", ",", "defaults", ")", "{", "var", "data", ";", "var", "get", ";", "var", "trim", ";", "var", "nodes", ";", "var", "selector", ";", "/**\n * If the `item` itself is a selector, grab it as `selector` and set item to\n ...
Given a `dom`, traverse it to get the desired item @param {Object} dom cheerio object @param {(string|Object)} item Can be a string holding the `selector`, an Object with multiple options, including `selector`, or an embedded Object with no `selector`. @param {Object} defaults Defaul...
[ "Given", "a", "dom", "traverse", "it", "to", "get", "the", "desired", "item" ]
071f29ac5cc6eab0e3f4919709002a3bdbfc19ad
https://github.com/eeshi/node-scrapy/blob/071f29ac5cc6eab0e3f4919709002a3bdbfc19ad/index.js#L188-L348
train
staruml/metadata-json
core/Core.js
getSuperType
function getSuperType(subType) { if (subType) { return _global.type[_global.meta[subType.name].super]; } else { return null; } }
javascript
function getSuperType(subType) { if (subType) { return _global.type[_global.meta[subType.name].super]; } else { return null; } }
[ "function", "getSuperType", "(", "subType", ")", "{", "if", "(", "subType", ")", "{", "return", "_global", ".", "type", "[", "_global", ".", "meta", "[", "subType", ".", "name", "]", ".", "super", "]", ";", "}", "else", "{", "return", "null", ";", ...
Return a super type of a given type. @param {constructor} subType @return {constructor} - superType of subType
[ "Return", "a", "super", "type", "of", "a", "given", "type", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Core.js#L3725-L3731
train
staruml/metadata-json
core/Core.js
getCommonType
function getCommonType(elems) { if (elems && elems.length > 0) { var commonType = elems[0].getClass(); while (!_.every(elems, function (e) { return (e instanceof commonType); })) { commonType = getSuperType(commonType); } return commonType; ...
javascript
function getCommonType(elems) { if (elems && elems.length > 0) { var commonType = elems[0].getClass(); while (!_.every(elems, function (e) { return (e instanceof commonType); })) { commonType = getSuperType(commonType); } return commonType; ...
[ "function", "getCommonType", "(", "elems", ")", "{", "if", "(", "elems", "&&", "elems", ".", "length", ">", "0", ")", "{", "var", "commonType", "=", "elems", "[", "0", "]", ".", "getClass", "(", ")", ";", "while", "(", "!", "_", ".", "every", "("...
Return a generalized type of given elements. @param {Array.<Element>} elems @return {constructor}
[ "Return", "a", "generalized", "type", "of", "given", "elements", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Core.js#L3739-L3749
train
staruml/metadata-json
core/Core.js
findByName
function findByName(array, name) { if (array && array.length > 0) { for (var i = 0, len = array.length; i < len; i++) { var elem = array[i]; if (elem.name == name) { return elem; } } } return null; }
javascript
function findByName(array, name) { if (array && array.length > 0) { for (var i = 0, len = array.length; i < len; i++) { var elem = array[i]; if (elem.name == name) { return elem; } } } return null; }
[ "function", "findByName", "(", "array", ",", "name", ")", "{", "if", "(", "array", "&&", "array", ".", "length", ">", "0", ")", "{", "for", "(", "var", "i", "=", "0", ",", "len", "=", "array", ".", "length", ";", "i", "<", "len", ";", "i", "+...
Find element by name in a given array. @param {Array.<Element>} array @param {string} name @return {Element}
[ "Find", "element", "by", "name", "in", "a", "given", "array", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Core.js#L3758-L3768
train
staruml/metadata-json
core/OperationBuilder.js
_getBase
function _getBase(name) { var operation = { id: IdGenerator.generateGuid(), time: getTimestamp(), name: name, bypass: false, ops: [] }; return operation; }
javascript
function _getBase(name) { var operation = { id: IdGenerator.generateGuid(), time: getTimestamp(), name: name, bypass: false, ops: [] }; return operation; }
[ "function", "_getBase", "(", "name", ")", "{", "var", "operation", "=", "{", "id", ":", "IdGenerator", ".", "generateGuid", "(", ")", ",", "time", ":", "getTimestamp", "(", ")", ",", "name", ":", "name", ",", "bypass", ":", "false", ",", "ops", ":", ...
Make and return a base operation object. @private @param {string} name Operation name @return {Object} Base operation object
[ "Make", "and", "return", "a", "base", "operation", "object", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/OperationBuilder.js#L89-L98
train
staruml/metadata-json
core/OperationBuilder.js
_getArray
function _getArray(elem, field) { var f = elem._id + "." + field; if (!_currentArray[f]) { _currentArray[f] = _.clone(elem[field]); } return _currentArray[f]; }
javascript
function _getArray(elem, field) { var f = elem._id + "." + field; if (!_currentArray[f]) { _currentArray[f] = _.clone(elem[field]); } return _currentArray[f]; }
[ "function", "_getArray", "(", "elem", ",", "field", ")", "{", "var", "f", "=", "elem", ".", "_id", "+", "\".\"", "+", "field", ";", "if", "(", "!", "_currentArray", "[", "f", "]", ")", "{", "_currentArray", "[", "f", "]", "=", "_", ".", "clone", ...
Return a copied array of array field of a particular element. It could be changed by `fieldInsert`, `fieldRemove`. The reason why using this is index value maybe incorrect when performing `fieldInsert` multiple times. @private @param {Element} elem An element @param {string} field Array field name @return {number}
[ "Return", "a", "copied", "array", "of", "array", "field", "of", "a", "particular", "element", ".", "It", "could", "be", "changed", "by", "fieldInsert", "fieldRemove", ".", "The", "reason", "why", "using", "this", "is", "index", "value", "maybe", "incorrect",...
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/OperationBuilder.js#L110-L116
train
staruml/metadata-json
core/OperationBuilder.js
begin
function begin(name, bypass) { _currentOperation = _getBase(name); if (bypass === true) { _currentOperation.bypass = true; } }
javascript
function begin(name, bypass) { _currentOperation = _getBase(name); if (bypass === true) { _currentOperation.bypass = true; } }
[ "function", "begin", "(", "name", ",", "bypass", ")", "{", "_currentOperation", "=", "_getBase", "(", "name", ")", ";", "if", "(", "bypass", "===", "true", ")", "{", "_currentOperation", ".", "bypass", "=", "true", ";", "}", "}" ]
Begin to make an operation. @param {string} opName Operation name
[ "Begin", "to", "make", "an", "operation", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/OperationBuilder.js#L123-L128
train
staruml/metadata-json
core/OperationBuilder.js
insert
function insert(elem) { try { $(exports).triggerHandler('insert', [elem]); } catch (err) { console.error(err); } var writer = new Writer(); elem.save(writer); _currentOperation.ops.push({op: OP_INSERT, arg: writer.current}); }
javascript
function insert(elem) { try { $(exports).triggerHandler('insert', [elem]); } catch (err) { console.error(err); } var writer = new Writer(); elem.save(writer); _currentOperation.ops.push({op: OP_INSERT, arg: writer.current}); }
[ "function", "insert", "(", "elem", ")", "{", "try", "{", "$", "(", "exports", ")", ".", "triggerHandler", "(", "'insert'", ",", "[", "elem", "]", ")", ";", "}", "catch", "(", "err", ")", "{", "console", ".", "error", "(", "err", ")", ";", "}", ...
Insert an element. @param {Element} elem
[ "Insert", "an", "element", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/OperationBuilder.js#L160-L169
train
staruml/metadata-json
core/OperationBuilder.js
remove
function remove(elem) { try { $(exports).triggerHandler('remove', [elem]); } catch (err) { console.error(err); } var writer = new Writer(); elem.save(writer); _currentOperation.ops.push({op: OP_REMOVE, arg: writer.current}); }
javascript
function remove(elem) { try { $(exports).triggerHandler('remove', [elem]); } catch (err) { console.error(err); } var writer = new Writer(); elem.save(writer); _currentOperation.ops.push({op: OP_REMOVE, arg: writer.current}); }
[ "function", "remove", "(", "elem", ")", "{", "try", "{", "$", "(", "exports", ")", ".", "triggerHandler", "(", "'remove'", ",", "[", "elem", "]", ")", ";", "}", "catch", "(", "err", ")", "{", "console", ".", "error", "(", "err", ")", ";", "}", ...
Remove an element. @param {Element} elem
[ "Remove", "an", "element", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/OperationBuilder.js#L176-L185
train
staruml/metadata-json
core/OperationBuilder.js
fieldAssign
function fieldAssign(elem, field, val) { try { $(exports).triggerHandler('fieldAssign', [elem, field, val]); } catch (err) { console.error(err); } var isCustomField = (elem[field] && elem[field].__read); var oldVal; if (isCustomField) { ...
javascript
function fieldAssign(elem, field, val) { try { $(exports).triggerHandler('fieldAssign', [elem, field, val]); } catch (err) { console.error(err); } var isCustomField = (elem[field] && elem[field].__read); var oldVal; if (isCustomField) { ...
[ "function", "fieldAssign", "(", "elem", ",", "field", ",", "val", ")", "{", "try", "{", "$", "(", "exports", ")", ".", "triggerHandler", "(", "'fieldAssign'", ",", "[", "elem", ",", "field", ",", "val", "]", ")", ";", "}", "catch", "(", "err", ")",...
Assign value to field. @param {Element} elem @param {string} field @param {?} val
[ "Assign", "value", "to", "field", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/OperationBuilder.js#L194-L216
train
staruml/metadata-json
core/OperationBuilder.js
fieldInsert
function fieldInsert(elem, field, val) { try { $(exports).triggerHandler('fieldInsert', [elem, field, val]); } catch (err) { console.error(err); } var array = _getArray(elem, field); array.push(val); _currentOperation.ops.push({ op: OP_...
javascript
function fieldInsert(elem, field, val) { try { $(exports).triggerHandler('fieldInsert', [elem, field, val]); } catch (err) { console.error(err); } var array = _getArray(elem, field); array.push(val); _currentOperation.ops.push({ op: OP_...
[ "function", "fieldInsert", "(", "elem", ",", "field", ",", "val", ")", "{", "try", "{", "$", "(", "exports", ")", ".", "triggerHandler", "(", "'fieldInsert'", ",", "[", "elem", ",", "field", ",", "val", "]", ")", ";", "}", "catch", "(", "err", ")",...
Insert an element to array field. @param {Element} elem @param {string} field @param {?} val
[ "Insert", "an", "element", "to", "array", "field", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/OperationBuilder.js#L225-L242
train
staruml/metadata-json
core/OperationBuilder.js
fieldReorder
function fieldReorder(elem, field, val, pos) { try { $(exports).triggerHandler('fieldReorder', [elem, field, val, pos]); } catch (err) { console.error(err); } _currentOperation.ops.push({ op: OP_FIELD_REORDER, arg: { _id: el...
javascript
function fieldReorder(elem, field, val, pos) { try { $(exports).triggerHandler('fieldReorder', [elem, field, val, pos]); } catch (err) { console.error(err); } _currentOperation.ops.push({ op: OP_FIELD_REORDER, arg: { _id: el...
[ "function", "fieldReorder", "(", "elem", ",", "field", ",", "val", ",", "pos", ")", "{", "try", "{", "$", "(", "exports", ")", ".", "triggerHandler", "(", "'fieldReorder'", ",", "[", "elem", ",", "field", ",", "val", ",", "pos", "]", ")", ";", "}",...
Change order of a value in array field. @param {Element} elem @param {string} field @param {?} val @param {number} pos Position to be placed
[ "Change", "order", "of", "a", "value", "in", "array", "field", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/OperationBuilder.js#L328-L343
train
staruml/metadata-json
core/OperationBuilder.js
fieldRelocate
function fieldRelocate(elem, field, oldParent, newParent) { try { $(exports).triggerHandler('fieldRelocate', [elem, field, oldParent, newParent]); } catch (err) { console.error(err); } _currentOperation.ops.push({ op: OP_FIELD_RELOCATE, arg...
javascript
function fieldRelocate(elem, field, oldParent, newParent) { try { $(exports).triggerHandler('fieldRelocate', [elem, field, oldParent, newParent]); } catch (err) { console.error(err); } _currentOperation.ops.push({ op: OP_FIELD_RELOCATE, arg...
[ "function", "fieldRelocate", "(", "elem", ",", "field", ",", "oldParent", ",", "newParent", ")", "{", "try", "{", "$", "(", "exports", ")", ".", "triggerHandler", "(", "'fieldRelocate'", ",", "[", "elem", ",", "field", ",", "oldParent", ",", "newParent", ...
Relocate an element to another parent. @param {Element} elem Element to be relocated @param {string} field Field name of parent @param {number} oldParent Current parent @param {number} newParent New parent to be located in
[ "Relocate", "an", "element", "to", "another", "parent", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/OperationBuilder.js#L353-L368
train
silexlabs/unifile
lib/unifile-github.js
paginate
function paginate(reqOptions, link, memo) { const links = link.split(/,\s*/); let matches; links.some(function(link) { matches = link.trim().match(/<(.+)>;\s*rel="next"/); return matches !== null; }); // End of pagination if(!matches) { return Promise.resolve(memo); } return new Promise(function(resolve, ...
javascript
function paginate(reqOptions, link, memo) { const links = link.split(/,\s*/); let matches; links.some(function(link) { matches = link.trim().match(/<(.+)>;\s*rel="next"/); return matches !== null; }); // End of pagination if(!matches) { return Promise.resolve(memo); } return new Promise(function(resolve, ...
[ "function", "paginate", "(", "reqOptions", ",", "link", ",", "memo", ")", "{", "const", "links", "=", "link", ".", "split", "(", "/", ",\\s*", "/", ")", ";", "let", "matches", ";", "links", ".", "some", "(", "function", "(", "link", ")", "{", "matc...
Handle GitHub pagination @param {Object} reqOptions - Options to pass to the request. Url will be overidden @param {string} link - Link header @param {Object[]} memo - Aggregator of result @return {Promise} a Promise of aggregated result @private
[ "Handle", "GitHub", "pagination" ]
bc0750736ccdb3f6cf620ad5063ee851ceeaf445
https://github.com/silexlabs/unifile/blob/bc0750736ccdb3f6cf620ad5063ee851ceeaf445/lib/unifile-github.js#L37-L54
train
silexlabs/unifile
lib/unifile-github.js
move
function move(src, dest, treeRes) { return treeRes.tree.map(function(file) { const regex = new RegExp('^' + src + '$|^' + src + '(/)'); // Overrides file path return Object.assign({}, file, {path: file.path.replace(regex, dest + '$1')}); }); }
javascript
function move(src, dest, treeRes) { return treeRes.tree.map(function(file) { const regex = new RegExp('^' + src + '$|^' + src + '(/)'); // Overrides file path return Object.assign({}, file, {path: file.path.replace(regex, dest + '$1')}); }); }
[ "function", "move", "(", "src", ",", "dest", ",", "treeRes", ")", "{", "return", "treeRes", ".", "tree", ".", "map", "(", "function", "(", "file", ")", "{", "const", "regex", "=", "new", "RegExp", "(", "'^'", "+", "src", "+", "'$|^'", "+", "src", ...
Move a folder or a file in a branch by transforming the given tree @param {string} src - Source path relative to branch root @param {string} dest - Destination path relative to branch root @param {Object} treeRes[].tree - Commit tree @param {string} [branch=master] - Branch containing file/folder @private
[ "Move", "a", "folder", "or", "a", "file", "in", "a", "branch", "by", "transforming", "the", "given", "tree" ]
bc0750736ccdb3f6cf620ad5063ee851ceeaf445
https://github.com/silexlabs/unifile/blob/bc0750736ccdb3f6cf620ad5063ee851ceeaf445/lib/unifile-github.js#L65-L71
train
staruml/metadata-json
core/PreferenceManager.js
validate
function validate(schema) { var key, item; for (key in schema) { if (schema.hasOwnProperty(key)) { item = schema[key]; if (!item.text) { console.error("[PreferenceManager] missing required field: 'text' of '" + key + "'"); }...
javascript
function validate(schema) { var key, item; for (key in schema) { if (schema.hasOwnProperty(key)) { item = schema[key]; if (!item.text) { console.error("[PreferenceManager] missing required field: 'text' of '" + key + "'"); }...
[ "function", "validate", "(", "schema", ")", "{", "var", "key", ",", "item", ";", "for", "(", "key", "in", "schema", ")", "{", "if", "(", "schema", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "item", "=", "schema", "[", "key", "]", ";", "if"...
Validate preference schema @param {Object} schema @return {boolean}
[ "Validate", "preference", "schema" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/PreferenceManager.js#L69-L101
train
staruml/metadata-json
core/PreferenceManager.js
register
function register(id, name, schema) { if (!id || !name || !schema) { console.error("register(): missing required parameters: id, name, or schema"); return; } if (validate(schema)) { _schemaMap[id] = { id: id, name: name, ...
javascript
function register(id, name, schema) { if (!id || !name || !schema) { console.error("register(): missing required parameters: id, name, or schema"); return; } if (validate(schema)) { _schemaMap[id] = { id: id, name: name, ...
[ "function", "register", "(", "id", ",", "name", ",", "schema", ")", "{", "if", "(", "!", "id", "||", "!", "name", "||", "!", "schema", ")", "{", "console", ".", "error", "(", "\"register(): missing required parameters: id, name, or schema\"", ")", ";", "retu...
Register preference schema @param {string} id @param {string} name @param {Object} schema
[ "Register", "preference", "schema" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/PreferenceManager.js#L109-L129
train
staruml/metadata-json
core/PreferenceManager.js
get
function get(key, defaultValue) { defaultValue = typeof defaultValue === "undefined" ? null : defaultValue; if (global.localStorage) { var _value = global.localStorage.getItem(key), value = null; if (_value) { try { value = JSON...
javascript
function get(key, defaultValue) { defaultValue = typeof defaultValue === "undefined" ? null : defaultValue; if (global.localStorage) { var _value = global.localStorage.getItem(key), value = null; if (_value) { try { value = JSON...
[ "function", "get", "(", "key", ",", "defaultValue", ")", "{", "defaultValue", "=", "typeof", "defaultValue", "===", "\"undefined\"", "?", "null", ":", "defaultValue", ";", "if", "(", "global", ".", "localStorage", ")", "{", "var", "_value", "=", "global", ...
Return value of key @param {string} key @param {?} defaultValue @return {?}
[ "Return", "value", "of", "key" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/PreferenceManager.js#L138-L161
train
staruml/metadata-json
core/PreferenceManager.js
set
function set(key, value) { if (global.localStorage) { var _value; try { _value = JSON.stringify(value); global.localStorage.setItem(key, _value); $(exports).triggerHandler("change", [key, value]); } catch (e) { c...
javascript
function set(key, value) { if (global.localStorage) { var _value; try { _value = JSON.stringify(value); global.localStorage.setItem(key, _value); $(exports).triggerHandler("change", [key, value]); } catch (e) { c...
[ "function", "set", "(", "key", ",", "value", ")", "{", "if", "(", "global", ".", "localStorage", ")", "{", "var", "_value", ";", "try", "{", "_value", "=", "JSON", ".", "stringify", "(", "value", ")", ";", "global", ".", "localStorage", ".", "setItem...
Change value of key @param {string} key @param {?} value
[ "Change", "value", "of", "key" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/PreferenceManager.js#L168-L179
train
staruml/metadata-json
lib/render.js
render
function render(templatePath, outputPath, element, options) { var template = fs.readFileSync(templatePath, 'utf8'), rendered = "", renderedOutput = ""; element = element || null; options = options || {}; _.extend(options, { mdjson : mdjson, filename : templatePath, ...
javascript
function render(templatePath, outputPath, element, options) { var template = fs.readFileSync(templatePath, 'utf8'), rendered = "", renderedOutput = ""; element = element || null; options = options || {}; _.extend(options, { mdjson : mdjson, filename : templatePath, ...
[ "function", "render", "(", "templatePath", ",", "outputPath", ",", "element", ",", "options", ")", "{", "var", "template", "=", "fs", ".", "readFileSync", "(", "templatePath", ",", "'utf8'", ")", ",", "rendered", "=", "\"\"", ",", "renderedOutput", "=", "\...
Render a template file with options and save to an output file @param{string} templatePath Path for a template file @param{string} outputPath Path for an output file. You can use ejs expression (e.g. `out/<% element.name %>.java`) @param{Element} element Element to be rendered @param{Object} options Options used for e...
[ "Render", "a", "template", "file", "with", "options", "and", "save", "to", "an", "output", "file" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/lib/render.js#L60-L85
train
staruml/metadata-json
lib/render.js
renderBulk
function renderBulk(templatePath, outputPath, elements, options, fn) { var template = fs.readFileSync(templatePath, 'utf8'), rendered = "", renderedOutput = ""; elements = elements || []; options = options || {}; // if elements parameter is selector expression, retrieve them from Repo...
javascript
function renderBulk(templatePath, outputPath, elements, options, fn) { var template = fs.readFileSync(templatePath, 'utf8'), rendered = "", renderedOutput = ""; elements = elements || []; options = options || {}; // if elements parameter is selector expression, retrieve them from Repo...
[ "function", "renderBulk", "(", "templatePath", ",", "outputPath", ",", "elements", ",", "options", ",", "fn", ")", "{", "var", "template", "=", "fs", ".", "readFileSync", "(", "templatePath", ",", "'utf8'", ")", ",", "rendered", "=", "\"\"", ",", "rendered...
Render a template file with a set of elements and save to multple output files at once @param{string} templatePath Path for a template file @param{string} outputPath Path for output file(s). You can use ejs expression (e.g. `out/<% element.name %>.java`) @param{Array.<Element> | string} elements Array of elements or s...
[ "Render", "a", "template", "file", "with", "a", "set", "of", "elements", "and", "save", "to", "multple", "output", "files", "at", "once" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/lib/render.js#L96-L137
train
staruml/metadata-json
uml/UML.js
function () { var tagArray = []; if (this.tags && this.tags.length > 0) { var i, len, tag; for (i = 0, len = this.tags.length; i < len; i++) { tag = this.tags[i]; switch (tag.kind) { case Core.TK_STRING: ...
javascript
function () { var tagArray = []; if (this.tags && this.tags.length > 0) { var i, len, tag; for (i = 0, len = this.tags.length; i < len; i++) { tag = this.tags[i]; switch (tag.kind) { case Core.TK_STRING: ...
[ "function", "(", ")", "{", "var", "tagArray", "=", "[", "]", ";", "if", "(", "this", ".", "tags", "&&", "this", ".", "tags", ".", "length", ">", "0", ")", "{", "var", "i", ",", "len", ",", "tag", ";", "for", "(", "i", "=", "0", ",", "len", ...
Return an array of tag strings @memberof UMLElementMixin @return {Array.<string>}
[ "Return", "an", "array", "of", "tag", "strings" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/uml/UML.js#L283-L311
train
staruml/metadata-json
lib/pdf.js
registerFont
function registerFont(folder) { var data = fs.readFileSync(folder + "/font.json", {encoding: "utf8"}); var fontArray = JSON.parse(data); for (var i = 0, len = fontArray.length; i < len; i++) { var font = fontArray[i]; font.path = folder; mdjson.Font.registerFont(font); } }
javascript
function registerFont(folder) { var data = fs.readFileSync(folder + "/font.json", {encoding: "utf8"}); var fontArray = JSON.parse(data); for (var i = 0, len = fontArray.length; i < len; i++) { var font = fontArray[i]; font.path = folder; mdjson.Font.registerFont(font); } }
[ "function", "registerFont", "(", "folder", ")", "{", "var", "data", "=", "fs", ".", "readFileSync", "(", "folder", "+", "\"/font.json\"", ",", "{", "encoding", ":", "\"utf8\"", "}", ")", ";", "var", "fontArray", "=", "JSON", ".", "parse", "(", "data", ...
Register a font @param {string} folder
[ "Register", "a", "font" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/lib/pdf.js#L45-L53
train
staruml/metadata-json
lib/pdf.js
exportToPDF
function exportToPDF(diagrams, fullPath, options) { var doc = new PDFDocument(options); _.each(mdjson.Font.files, function (path, name) { doc.registerFont(name, path); }); doc.pipe(fs.createWriteStream(fullPath)); var canvas = new mdjson.PDFGraphics.Canvas(doc); var i, len; for (i = ...
javascript
function exportToPDF(diagrams, fullPath, options) { var doc = new PDFDocument(options); _.each(mdjson.Font.files, function (path, name) { doc.registerFont(name, path); }); doc.pipe(fs.createWriteStream(fullPath)); var canvas = new mdjson.PDFGraphics.Canvas(doc); var i, len; for (i = ...
[ "function", "exportToPDF", "(", "diagrams", ",", "fullPath", ",", "options", ")", "{", "var", "doc", "=", "new", "PDFDocument", "(", "options", ")", ";", "_", ".", "each", "(", "mdjson", ".", "Font", ".", "files", ",", "function", "(", "path", ",", "...
Export diagrams to a PDF file @param{Array.<Diagram>} diagrams @param{string} fullPath @param{Object} options
[ "Export", "diagrams", "to", "a", "PDF", "file" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/lib/pdf.js#L61-L99
train
staruml/metadata-json
core/Repository.js
writeObject
function writeObject(elem) { var writer = new Core.Writer(); elem.save(writer); var data = JSON.stringify(writer.current, null, "\t"); return data; }
javascript
function writeObject(elem) { var writer = new Core.Writer(); elem.save(writer); var data = JSON.stringify(writer.current, null, "\t"); return data; }
[ "function", "writeObject", "(", "elem", ")", "{", "var", "writer", "=", "new", "Core", ".", "Writer", "(", ")", ";", "elem", ".", "save", "(", "writer", ")", ";", "var", "data", "=", "JSON", ".", "stringify", "(", "writer", ".", "current", ",", "nu...
Encode a given element to JSON data. @private @param {Core.Element} elem Element to be encoded @return {string} JSON-encoded data.
[ "Encode", "a", "given", "element", "to", "JSON", "data", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Repository.js#L653-L658
train
staruml/metadata-json
core/Repository.js
extractChanged
function extractChanged(operation) { var i, len, op, elem, changed = []; if (operation.ops.length > 0) { for (i = 0, len = operation.ops.length; i < len; i++) { op = operation.ops[i]; if (op._elem && op._elem._id) { elem = get(op._elem._id)...
javascript
function extractChanged(operation) { var i, len, op, elem, changed = []; if (operation.ops.length > 0) { for (i = 0, len = operation.ops.length; i < len; i++) { op = operation.ops[i]; if (op._elem && op._elem._id) { elem = get(op._elem._id)...
[ "function", "extractChanged", "(", "operation", ")", "{", "var", "i", ",", "len", ",", "op", ",", "elem", ",", "changed", "=", "[", "]", ";", "if", "(", "operation", ".", "ops", ".", "length", ">", "0", ")", "{", "for", "(", "i", "=", "0", ",",...
Extract changed elements from a given Operation @param {Operation} operation @return {Array.<Element>}
[ "Extract", "changed", "elements", "from", "a", "given", "Operation" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Repository.js#L932-L952
train
staruml/metadata-json
core/Repository.js
doOperation
function doOperation(operation) { if (operation.ops.length > 0) { try { $(exports).triggerHandler('beforeExecuteOperation', [operation]); _applyOperation(operation); if (operation.bypass !== true) { _undoStack.push(operation); ...
javascript
function doOperation(operation) { if (operation.ops.length > 0) { try { $(exports).triggerHandler('beforeExecuteOperation', [operation]); _applyOperation(operation); if (operation.bypass !== true) { _undoStack.push(operation); ...
[ "function", "doOperation", "(", "operation", ")", "{", "if", "(", "operation", ".", "ops", ".", "length", ">", "0", ")", "{", "try", "{", "$", "(", "exports", ")", ".", "triggerHandler", "(", "'beforeExecuteOperation'", ",", "[", "operation", "]", ")", ...
Do an Operation If operation.bypass == true, the operation will not be pushed to UndoStack. @param {Operation} operation
[ "Do", "an", "Operation", "If", "operation", ".", "bypass", "==", "true", "the", "operation", "will", "not", "be", "pushed", "to", "UndoStack", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Repository.js#L959-L973
train
staruml/metadata-json
core/Repository.js
select
function select(selector) { selector = selector || ""; // Parse selector into an array of terms var interm = selector .replace(/::/g, "\n::\n") .replace(/@/g, "\n@") .replace(/\./g, "\n.") .replace(/\[/g, "\n["); var i, len, s...
javascript
function select(selector) { selector = selector || ""; // Parse selector into an array of terms var interm = selector .replace(/::/g, "\n::\n") .replace(/@/g, "\n@") .replace(/\./g, "\n.") .replace(/\[/g, "\n["); var i, len, s...
[ "function", "select", "(", "selector", ")", "{", "selector", "=", "selector", "||", "\"\"", ";", "// Parse selector into an array of terms", "var", "interm", "=", "selector", ".", "replace", "(", "/", "::", "/", "g", ",", "\"\\n::\\n\"", ")", ".", "replace", ...
Return an array of elements selected by selector expression. This is a quite heavy operation, so you need to concern about performance. Selector expression - Children selector ex) Package1:: -- all children of Package1 - Type selector: "@<type>" ex) Package1::@UMLClass - Field selector: ".<field>" ex) Class1.attribu...
[ "Return", "an", "array", "of", "elements", "selected", "by", "selector", "expression", ".", "This", "is", "a", "quite", "heavy", "operation", "so", "you", "need", "to", "concern", "about", "performance", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Repository.js#L1083-L1193
train
staruml/metadata-json
core/Repository.js
find
function find(predicate) { var key, elem; for (key in _idMap) { if (_idMap.hasOwnProperty(key)) { elem = _idMap[key]; if (predicate(elem)) { return elem; } } } return null; }
javascript
function find(predicate) { var key, elem; for (key in _idMap) { if (_idMap.hasOwnProperty(key)) { elem = _idMap[key]; if (predicate(elem)) { return elem; } } } return null; }
[ "function", "find", "(", "predicate", ")", "{", "var", "key", ",", "elem", ";", "for", "(", "key", "in", "_idMap", ")", "{", "if", "(", "_idMap", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "elem", "=", "_idMap", "[", "key", "]", ";", "if",...
Find the first matched element satisfying the predicate. @param {function(Element):boolean} predicate A function to filter elements. @return {Element} A matched element.
[ "Find", "the", "first", "matched", "element", "satisfying", "the", "predicate", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Repository.js#L1242-L1253
train
staruml/metadata-json
core/Repository.js
findAll
function findAll(predicate) { var key, elem, result = []; for (key in _idMap) { if (_idMap.hasOwnProperty(key)) { elem = _idMap[key]; if (predicate(elem)) { result.push(elem); } } ...
javascript
function findAll(predicate) { var key, elem, result = []; for (key in _idMap) { if (_idMap.hasOwnProperty(key)) { elem = _idMap[key]; if (predicate(elem)) { result.push(elem); } } ...
[ "function", "findAll", "(", "predicate", ")", "{", "var", "key", ",", "elem", ",", "result", "=", "[", "]", ";", "for", "(", "key", "in", "_idMap", ")", "{", "if", "(", "_idMap", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "elem", "=", "_id...
Find all elements satisfying the predicate. @param {function(Element):boolean} predicate A function to filter elements. @return {Array.<Element>} All matched elements.
[ "Find", "all", "elements", "satisfying", "the", "predicate", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Repository.js#L1260-L1273
train
staruml/metadata-json
core/Repository.js
search
function search(keyword, typeFilter) { keyword = keyword.toLowerCase(); typeFilter = typeFilter || type.Element; var results = findAll(function (elem) { var name = elem.name ? elem.name.toLowerCase() : ""; return (name.indexOf(keyword) > -1 && elem instanceof typeFilter);...
javascript
function search(keyword, typeFilter) { keyword = keyword.toLowerCase(); typeFilter = typeFilter || type.Element; var results = findAll(function (elem) { var name = elem.name ? elem.name.toLowerCase() : ""; return (name.indexOf(keyword) > -1 && elem instanceof typeFilter);...
[ "function", "search", "(", "keyword", ",", "typeFilter", ")", "{", "keyword", "=", "keyword", ".", "toLowerCase", "(", ")", ";", "typeFilter", "=", "typeFilter", "||", "type", ".", "Element", ";", "var", "results", "=", "findAll", "(", "function", "(", "...
Search elements by keyword and type @param {string} keyword @param {constructor} typeFilter @return {Array.<Element>} elements
[ "Search", "elements", "by", "keyword", "and", "type" ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Repository.js#L1282-L1290
train
staruml/metadata-json
core/Repository.js
getRefsTo
function getRefsTo(elem, iterator) { var id, ref, obj, list = []; if (elem) { obj = _refMap[elem._id]; if (obj) { for (id in obj) { if (obj.hasOwnProperty(id)) { ref = _idMap[id]; ...
javascript
function getRefsTo(elem, iterator) { var id, ref, obj, list = []; if (elem) { obj = _refMap[elem._id]; if (obj) { for (id in obj) { if (obj.hasOwnProperty(id)) { ref = _idMap[id]; ...
[ "function", "getRefsTo", "(", "elem", ",", "iterator", ")", "{", "var", "id", ",", "ref", ",", "obj", ",", "list", "=", "[", "]", ";", "if", "(", "elem", ")", "{", "obj", "=", "_refMap", "[", "elem", ".", "_id", "]", ";", "if", "(", "obj", ")...
Return all elements referencing to the given element. @param {Core.Element} elem Element. (model element, view element, or diagram) @param {?function(Element):boolean} iterator if given, returns instances only satisfying iterator function. @return {Array<Core.Element>} Elements referencing to.
[ "Return", "all", "elements", "referencing", "to", "the", "given", "element", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Repository.js#L1316-L1337
train
staruml/metadata-json
core/Repository.js
getRelationshipsOf
function getRelationshipsOf(model, iterator) { var i, len, ref, refs = getRefsTo(model), results = []; function _add(rel) { if (!_.contains(results, rel)) { results.push(rel); } } for (i = 0, len = ...
javascript
function getRelationshipsOf(model, iterator) { var i, len, ref, refs = getRefsTo(model), results = []; function _add(rel) { if (!_.contains(results, rel)) { results.push(rel); } } for (i = 0, len = ...
[ "function", "getRelationshipsOf", "(", "model", ",", "iterator", ")", "{", "var", "i", ",", "len", ",", "ref", ",", "refs", "=", "getRefsTo", "(", "model", ")", ",", "results", "=", "[", "]", ";", "function", "_add", "(", "rel", ")", "{", "if", "("...
Return all instances of Relationship connected to the given model element. @param {Core.Model} model Model element. @param {?function(Element):boolean} iterator if given, returns instances only satisfying iterator function. @return {Array<Core.Model>} Instances of Relationship.
[ "Return", "all", "instances", "of", "Relationship", "connected", "to", "the", "given", "model", "element", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Repository.js#L1345-L1384
train
staruml/metadata-json
core/Repository.js
getViewsOf
function getViewsOf(model) { return getRefsTo(model, function (ref) { return (ref instanceof Core.View) && (ref.model === model); }); }
javascript
function getViewsOf(model) { return getRefsTo(model, function (ref) { return (ref instanceof Core.View) && (ref.model === model); }); }
[ "function", "getViewsOf", "(", "model", ")", "{", "return", "getRefsTo", "(", "model", ",", "function", "(", "ref", ")", "{", "return", "(", "ref", "instanceof", "Core", ".", "View", ")", "&&", "(", "ref", ".", "model", "===", "model", ")", ";", "}",...
Return all views associated with the given model. @param {Core.Model} model Model element. @return {Array<Core.View>} View elements associated with.
[ "Return", "all", "views", "associated", "with", "the", "given", "model", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Repository.js#L1391-L1395
train
staruml/metadata-json
core/Repository.js
getEdgeViewsOf
function getEdgeViewsOf(view) { return getRefsTo(view, function (ref) { return (ref instanceof Core.EdgeView) && (ref.head === view || ref.tail === view); }); }
javascript
function getEdgeViewsOf(view) { return getRefsTo(view, function (ref) { return (ref instanceof Core.EdgeView) && (ref.head === view || ref.tail === view); }); }
[ "function", "getEdgeViewsOf", "(", "view", ")", "{", "return", "getRefsTo", "(", "view", ",", "function", "(", "ref", ")", "{", "return", "(", "ref", "instanceof", "Core", ".", "EdgeView", ")", "&&", "(", "ref", ".", "head", "===", "view", "||", "ref",...
Return all instances of EdgeView linked to the given view. @param {Core.View} view View element. Typically an instance of NodeView. @return {Array<Core.EdgeView>} Instances of EdgeView linked to.
[ "Return", "all", "instances", "of", "EdgeView", "linked", "to", "the", "given", "view", "." ]
4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb
https://github.com/staruml/metadata-json/blob/4a6ea9b93dd426cc8e874daa3ca6aef72ac5bcbb/core/Repository.js#L1402-L1407
train
silexlabs/unifile
lib/unifile-ftp.js
getClient
function getClient(credentials) { return new Promise((resolve, reject) => { const ftp = new Ftp(credentials); ftp.once('connect', () => { resolve(ftp); }); }); }
javascript
function getClient(credentials) { return new Promise((resolve, reject) => { const ftp = new Ftp(credentials); ftp.once('connect', () => { resolve(ftp); }); }); }
[ "function", "getClient", "(", "credentials", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "const", "ftp", "=", "new", "Ftp", "(", "credentials", ")", ";", "ftp", ".", "once", "(", "'connect'", ",", "(", ")...
Initialize a new FTP client @param {Credentials} credentials - Access info for the FTP server @return {Promise<Ftp>} a promise for a FTP client
[ "Initialize", "a", "new", "FTP", "client" ]
bc0750736ccdb3f6cf620ad5063ee851ceeaf445
https://github.com/silexlabs/unifile/blob/bc0750736ccdb3f6cf620ad5063ee851ceeaf445/lib/unifile-ftp.js#L19-L26
train