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
yuku/jquery-textcomplete
src/adapter.js
function () { var position = this._getCaretRelativePosition(); var offset = this.$el.offset(); // Calculate the left top corner of `this.option.appendTo` element. var $parent = this.option.appendTo; if ($parent) { if (!($parent instanceof $)) { $parent = $($parent); } va...
javascript
function () { var position = this._getCaretRelativePosition(); var offset = this.$el.offset(); // Calculate the left top corner of `this.option.appendTo` element. var $parent = this.option.appendTo; if ($parent) { if (!($parent instanceof $)) { $parent = $($parent); } va...
[ "function", "(", ")", "{", "var", "position", "=", "this", ".", "_getCaretRelativePosition", "(", ")", ";", "var", "offset", "=", "this", ".", "$el", ".", "offset", "(", ")", ";", "// Calculate the left top corner of `this.option.appendTo` element.", "var", "$pare...
Returns the caret's relative coordinates from body's left top corner.
[ "Returns", "the", "caret", "s", "relative", "coordinates", "from", "body", "s", "left", "top", "corner", "." ]
3aa8a1b2e74a451f0017ce700ebcf2c405a25184
https://github.com/yuku/jquery-textcomplete/blob/3aa8a1b2e74a451f0017ce700ebcf2c405a25184/src/adapter.js#L79-L95
train
yuku/jquery-textcomplete
src/completer.js
function (text, skipUnchangedTerm) { if (!this.dropdown) { this.initialize(); } text != null || (text = this.adapter.getTextFromHeadToCaret()); var searchQuery = this._extractSearchQuery(text); if (searchQuery.length) { var term = searchQuery[1]; // Ignore shift-key, ctrl-key and...
javascript
function (text, skipUnchangedTerm) { if (!this.dropdown) { this.initialize(); } text != null || (text = this.adapter.getTextFromHeadToCaret()); var searchQuery = this._extractSearchQuery(text); if (searchQuery.length) { var term = searchQuery[1]; // Ignore shift-key, ctrl-key and...
[ "function", "(", "text", ",", "skipUnchangedTerm", ")", "{", "if", "(", "!", "this", ".", "dropdown", ")", "{", "this", ".", "initialize", "(", ")", ";", "}", "text", "!=", "null", "||", "(", "text", "=", "this", ".", "adapter", ".", "getTextFromHead...
Invoke textcomplete.
[ "Invoke", "textcomplete", "." ]
3aa8a1b2e74a451f0017ce700ebcf2c405a25184
https://github.com/yuku/jquery-textcomplete/blob/3aa8a1b2e74a451f0017ce700ebcf2c405a25184/src/completer.js#L182-L196
train
yuku/jquery-textcomplete
src/completer.js
function (value, strategy, e) { this._term = null; this.adapter.select(value, strategy, e); this.fire('change').fire('textComplete:select', value, strategy); this.adapter.focus(); }
javascript
function (value, strategy, e) { this._term = null; this.adapter.select(value, strategy, e); this.fire('change').fire('textComplete:select', value, strategy); this.adapter.focus(); }
[ "function", "(", "value", ",", "strategy", ",", "e", ")", "{", "this", ".", "_term", "=", "null", ";", "this", ".", "adapter", ".", "select", "(", "value", ",", "strategy", ",", "e", ")", ";", "this", ".", "fire", "(", "'change'", ")", ".", "fire...
Insert the value into adapter view. It is called when the dropdown is clicked or selected. value - The selected element of the array callbacked from search func. strategy - The Strategy object. e - Click or keydown event object.
[ "Insert", "the", "value", "into", "adapter", "view", ".", "It", "is", "called", "when", "the", "dropdown", "is", "clicked", "or", "selected", ".", "value", "-", "The", "selected", "element", "of", "the", "array", "callbacked", "from", "search", "func", "."...
3aa8a1b2e74a451f0017ce700ebcf2c405a25184
https://github.com/yuku/jquery-textcomplete/blob/3aa8a1b2e74a451f0017ce700ebcf2c405a25184/src/completer.js#L214-L219
train
yuku/jquery-textcomplete
src/completer.js
function (text) { for (var i = 0; i < this.strategies.length; i++) { var strategy = this.strategies[i]; var context = strategy.context(text); if (context || context === '') { var matchRegexp = $.isFunction(strategy.match) ? strategy.match(text) : strategy.match; if (isS...
javascript
function (text) { for (var i = 0; i < this.strategies.length; i++) { var strategy = this.strategies[i]; var context = strategy.context(text); if (context || context === '') { var matchRegexp = $.isFunction(strategy.match) ? strategy.match(text) : strategy.match; if (isS...
[ "function", "(", "text", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "strategies", ".", "length", ";", "i", "++", ")", "{", "var", "strategy", "=", "this", ".", "strategies", "[", "i", "]", ";", "var", "context", "="...
Parse the given text and extract the first matching strategy. Returns an array including the strategy, the query term and the match object if the text matches an strategy; otherwise returns an empty array.
[ "Parse", "the", "given", "text", "and", "extract", "the", "first", "matching", "strategy", ".", "Returns", "an", "array", "including", "the", "strategy", "the", "query", "term", "and", "the", "match", "object", "if", "the", "text", "matches", "an", "strategy...
3aa8a1b2e74a451f0017ce700ebcf2c405a25184
https://github.com/yuku/jquery-textcomplete/blob/3aa8a1b2e74a451f0017ce700ebcf2c405a25184/src/completer.js#L234-L246
train
yeoman/environment
lib/environment.js
splitArgsFromString
function splitArgsFromString(argsString) { let result = []; const quoteSeparatedArgs = argsString.split(/(\x22[^\x22]*\x22)/).filter(x => x); quoteSeparatedArgs.forEach(arg => { if (arg.match('\x22')) { result.push(arg.replace(/\x22/g, '')); } else { result = result.concat(arg.trim().split(' '...
javascript
function splitArgsFromString(argsString) { let result = []; const quoteSeparatedArgs = argsString.split(/(\x22[^\x22]*\x22)/).filter(x => x); quoteSeparatedArgs.forEach(arg => { if (arg.match('\x22')) { result.push(arg.replace(/\x22/g, '')); } else { result = result.concat(arg.trim().split(' '...
[ "function", "splitArgsFromString", "(", "argsString", ")", "{", "let", "result", "=", "[", "]", ";", "const", "quoteSeparatedArgs", "=", "argsString", ".", "split", "(", "/", "(\\x22[^\\x22]*\\x22)", "/", ")", ".", "filter", "(", "x", "=>", "x", ")", ";", ...
Two-step argument splitting function that first splits arguments in quotes, and then splits up the remaining arguments if they are not part of a quote.
[ "Two", "-", "step", "argument", "splitting", "function", "that", "first", "splits", "arguments", "in", "quotes", "and", "then", "splits", "up", "the", "remaining", "arguments", "if", "they", "are", "not", "part", "of", "a", "quote", "." ]
c2143b40209b5358b709eb07698ba0b98de59da2
https://github.com/yeoman/environment/blob/c2143b40209b5358b709eb07698ba0b98de59da2/lib/environment.js#L21-L32
train
eggjs/egg-mock
lib/mock_httpclient.js
_request
function _request(url, opt) { opt = opt || {}; opt.method = (opt.method || 'GET').toUpperCase(); opt.headers = opt.headers || {}; if (matchUrl(url) && matchMethod(opt.method)) { const result = extend(true, {}, mockResult); const response = { status: result.status, ...
javascript
function _request(url, opt) { opt = opt || {}; opt.method = (opt.method || 'GET').toUpperCase(); opt.headers = opt.headers || {}; if (matchUrl(url) && matchMethod(opt.method)) { const result = extend(true, {}, mockResult); const response = { status: result.status, ...
[ "function", "_request", "(", "url", ",", "opt", ")", "{", "opt", "=", "opt", "||", "{", "}", ";", "opt", ".", "method", "=", "(", "opt", ".", "method", "||", "'GET'", ")", ".", "toUpperCase", "(", ")", ";", "opt", ".", "headers", "=", "opt", "....
support generator rather than callback and promise
[ "support", "generator", "rather", "than", "callback", "and", "promise" ]
b6549fa3e0bcf6d90cf6e2132734d6c1b03ddae3
https://github.com/eggjs/egg-mock/blob/b6549fa3e0bcf6d90cf6e2132734d6c1b03ddae3/lib/mock_httpclient.js#L74-L113
train
wilzbach/msa
src/views/canvas/CanvasSelection.js
function(data) { const seq = data.model.get("seq"); const selection = this._getSelection(data.model); // get the status of the upper and lower row const getNextPrev= this._getPrevNextSelection(data.model); const mPrevSel = getNextPrev[0]; const mNextSel = getNextPrev[1]; const boxWidth = th...
javascript
function(data) { const seq = data.model.get("seq"); const selection = this._getSelection(data.model); // get the status of the upper and lower row const getNextPrev= this._getPrevNextSelection(data.model); const mPrevSel = getNextPrev[0]; const mNextSel = getNextPrev[1]; const boxWidth = th...
[ "function", "(", "data", ")", "{", "const", "seq", "=", "data", ".", "model", ".", "get", "(", "\"seq\"", ")", ";", "const", "selection", "=", "this", ".", "_getSelection", "(", "data", ".", "model", ")", ";", "// get the status of the upper and lower row", ...
loops over all selection and calls the render method
[ "loops", "over", "all", "selection", "and", "calls", "the", "render", "method" ]
47042e8c3574fb62fad3b94de04183e5a0b09a97
https://github.com/wilzbach/msa/blob/47042e8c3574fb62fad3b94de04183e5a0b09a97/src/views/canvas/CanvasSelection.js#L41-L81
train
wilzbach/msa
src/views/canvas/CanvasSelection.js
function(data) { let xZero = data.xZero; const yZero = data.yZero; const n = data.n; const k = data.k; const selection = data.selection; // and checks the prev and next row for selection -> no borders in a selection const mPrevSel= data.mPrevSel; const mNextSel = data.mNextSel; //...
javascript
function(data) { let xZero = data.xZero; const yZero = data.yZero; const n = data.n; const k = data.k; const selection = data.selection; // and checks the prev and next row for selection -> no borders in a selection const mPrevSel= data.mPrevSel; const mNextSel = data.mNextSel; //...
[ "function", "(", "data", ")", "{", "let", "xZero", "=", "data", ".", "xZero", ";", "const", "yZero", "=", "data", ".", "yZero", ";", "const", "n", "=", "data", ".", "n", ";", "const", "k", "=", "data", ".", "k", ";", "const", "selection", "=", ...
draws a single user selection
[ "draws", "a", "single", "user", "selection" ]
47042e8c3574fb62fad3b94de04183e5a0b09a97
https://github.com/wilzbach/msa/blob/47042e8c3574fb62fad3b94de04183e5a0b09a97/src/views/canvas/CanvasSelection.js#L84-L154
train
wilzbach/msa
src/g/zoomer.js
function(model) { var maxLen = model.getMaxLength(); if (maxLen < 200 && model.length < 30) { this.defaults.boxRectWidth = this.defaults.boxRectHeight = 5; } return this; }
javascript
function(model) { var maxLen = model.getMaxLength(); if (maxLen < 200 && model.length < 30) { this.defaults.boxRectWidth = this.defaults.boxRectHeight = 5; } return this; }
[ "function", "(", "model", ")", "{", "var", "maxLen", "=", "model", ".", "getMaxLength", "(", ")", ";", "if", "(", "maxLen", "<", "200", "&&", "model", ".", "length", "<", "30", ")", "{", "this", ".", "defaults", ".", "boxRectWidth", "=", "this", "....
sets some defaults, depending on the model
[ "sets", "some", "defaults", "depending", "on", "the", "model" ]
47042e8c3574fb62fad3b94de04183e5a0b09a97
https://github.com/wilzbach/msa/blob/47042e8c3574fb62fad3b94de04183e5a0b09a97/src/g/zoomer.js#L70-L76
train
wilzbach/msa
src/g/zoomer.js
function(max) { // TODO! // make seqlogo height configurable var val = this.getMaxAlignmentHeight(); if (max !== undefined && max > 0) { val = Math.min(val, max); } return this.set("alignmentHeight", val); }
javascript
function(max) { // TODO! // make seqlogo height configurable var val = this.getMaxAlignmentHeight(); if (max !== undefined && max > 0) { val = Math.min(val, max); } return this.set("alignmentHeight", val); }
[ "function", "(", "max", ")", "{", "// TODO!", "// make seqlogo height configurable", "var", "val", "=", "this", ".", "getMaxAlignmentHeight", "(", ")", ";", "if", "(", "max", "!==", "undefined", "&&", "max", ">", "0", ")", "{", "val", "=", "Math", ".", "...
max is the maximal allowed height
[ "max", "is", "the", "maximal", "allowed", "height" ]
47042e8c3574fb62fad3b94de04183e5a0b09a97
https://github.com/wilzbach/msa/blob/47042e8c3574fb62fad3b94de04183e5a0b09a97/src/g/zoomer.js#L161-L170
train
izolate/html2pug
src/cli.js
main
async function main({ isFragment, needsHelp, showVersion, useTabs }) { /* eslint-disable no-console */ const stdin = await getStdin() if (showVersion) { return console.log(version) } if (needsHelp || !stdin) { return console.log(help) } const pug = html2pug(stdin, { isFragment, useTabs }) ret...
javascript
async function main({ isFragment, needsHelp, showVersion, useTabs }) { /* eslint-disable no-console */ const stdin = await getStdin() if (showVersion) { return console.log(version) } if (needsHelp || !stdin) { return console.log(help) } const pug = html2pug(stdin, { isFragment, useTabs }) ret...
[ "async", "function", "main", "(", "{", "isFragment", ",", "needsHelp", ",", "showVersion", ",", "useTabs", "}", ")", "{", "/* eslint-disable no-console */", "const", "stdin", "=", "await", "getStdin", "(", ")", "if", "(", "showVersion", ")", "{", "return", "...
Convert HTML from stdin to Pug
[ "Convert", "HTML", "from", "stdin", "to", "Pug" ]
79157c8fa1f7d2f4690a90dbccec8ae0efe6c8f9
https://github.com/izolate/html2pug/blob/79157c8fa1f7d2f4690a90dbccec8ae0efe6c8f9/src/cli.js#L28-L44
train
rmariuzzo/laravel-localization-loader
index.js
laravelLocalizationLoader
function laravelLocalizationLoader(source) { var isPHP = ~source.indexOf('<?php') if (isPHP) { return phpArrayLoader(source) } else { return jsonLoader(source) } }
javascript
function laravelLocalizationLoader(source) { var isPHP = ~source.indexOf('<?php') if (isPHP) { return phpArrayLoader(source) } else { return jsonLoader(source) } }
[ "function", "laravelLocalizationLoader", "(", "source", ")", "{", "var", "isPHP", "=", "~", "source", ".", "indexOf", "(", "'<?php'", ")", "if", "(", "isPHP", ")", "{", "return", "phpArrayLoader", "(", "source", ")", "}", "else", "{", "return", "jsonLoader...
The Laravel Localization loader. @param {string} source The source contents. @return {string} The parsed contents.
[ "The", "Laravel", "Localization", "loader", "." ]
0ae7f411ec7c7d5816f2e035d51cb0f443677693
https://github.com/rmariuzzo/laravel-localization-loader/blob/0ae7f411ec7c7d5816f2e035d51cb0f443677693/index.js#L23-L31
train
Charmatzis/react-leaflet-google
src/leaflet.google.js
createTile
function createTile(coords, done) { let key = this._tileCoordsToKey(coords); // console.log('Need:', key); if ( key in this._freshTiles ) { let tile = this._freshTiles[ key ].pop(); if ( !this._freshTiles[ key ].length ) { delete this._freshTiles[ key ]; } L.Util.request...
javascript
function createTile(coords, done) { let key = this._tileCoordsToKey(coords); // console.log('Need:', key); if ( key in this._freshTiles ) { let tile = this._freshTiles[ key ].pop(); if ( !this._freshTiles[ key ].length ) { delete this._freshTiles[ key ]; } L.Util.request...
[ "function", "createTile", "(", "coords", ",", "done", ")", "{", "let", "key", "=", "this", ".", "_tileCoordsToKey", "(", "coords", ")", ";", "// console.log('Need:', key);", "if", "(", "key", "in", "this", ".", "_freshTiles", ")", "{", "let", "tile", "=", ...
This will be used as this.createTile for 'roadmap', 'sat', 'terrain'
[ "This", "will", "be", "used", "as", "this", ".", "createTile", "for", "roadmap", "sat", "terrain" ]
4ac149142ac0d44e19855785d7b1e665d8e454a2
https://github.com/Charmatzis/react-leaflet-google/blob/4ac149142ac0d44e19855785d7b1e665d8e454a2/src/leaflet.google.js#L291-L323
train
Charmatzis/react-leaflet-google
src/leaflet.google.js
createTile
function createTile(coords, done) { let key = this._tileCoordsToKey(coords); let tileContainer = L.DomUtil.create("div"); tileContainer.dataset.pending = this._imagesPerTile; for ( let i = 0; i < this._imagesPerTile; i++ ) { let key2 = key + "/" + i; if ( key2 in this._freshTiles )...
javascript
function createTile(coords, done) { let key = this._tileCoordsToKey(coords); let tileContainer = L.DomUtil.create("div"); tileContainer.dataset.pending = this._imagesPerTile; for ( let i = 0; i < this._imagesPerTile; i++ ) { let key2 = key + "/" + i; if ( key2 in this._freshTiles )...
[ "function", "createTile", "(", "coords", ",", "done", ")", "{", "let", "key", "=", "this", ".", "_tileCoordsToKey", "(", "coords", ")", ";", "let", "tileContainer", "=", "L", ".", "DomUtil", ".", "create", "(", "\"div\"", ")", ";", "tileContainer", ".", ...
This will be used as this.createTile for 'hybrid'
[ "This", "will", "be", "used", "as", "this", ".", "createTile", "for", "hybrid" ]
4ac149142ac0d44e19855785d7b1e665d8e454a2
https://github.com/Charmatzis/react-leaflet-google/blob/4ac149142ac0d44e19855785d7b1e665d8e454a2/src/leaflet.google.js#L326-L368
train
mongodb-js/kerberos
lib/auth_processes/mongodb.js
performGssapiCanonicalizeHostName
function performGssapiCanonicalizeHostName(canonicalizeHostName, host, callback) { if (!canonicalizeHostName) return callback(); // Attempt to resolve the host name dns.resolveCname(host, (err, r) => { if (err) return callback(err); // Get the first resolve host id if (Array....
javascript
function performGssapiCanonicalizeHostName(canonicalizeHostName, host, callback) { if (!canonicalizeHostName) return callback(); // Attempt to resolve the host name dns.resolveCname(host, (err, r) => { if (err) return callback(err); // Get the first resolve host id if (Array....
[ "function", "performGssapiCanonicalizeHostName", "(", "canonicalizeHostName", ",", "host", ",", "callback", ")", "{", "if", "(", "!", "canonicalizeHostName", ")", "return", "callback", "(", ")", ";", "// Attempt to resolve the host name", "dns", ".", "resolveCname", "...
Canonicialize host name if needed
[ "Canonicialize", "host", "name", "if", "needed" ]
28fd17bf10ca29cf11650eb0165af1e07c19cab8
https://github.com/mongodb-js/kerberos/blob/28fd17bf10ca29cf11650eb0165af1e07c19cab8/lib/auth_processes/mongodb.js#L33-L47
train
mongodb-js/kerberos
lib/util.js
defineOperation
function defineOperation(fn, paramDefs) { return function() { const args = Array.prototype.slice.call(arguments); const params = []; for (let i = 0, argIdx = 0; i < paramDefs.length; ++i, ++argIdx) { const def = paramDefs[i]; let arg = args[argIdx]; if (def.hasOwnProperty('default') && ...
javascript
function defineOperation(fn, paramDefs) { return function() { const args = Array.prototype.slice.call(arguments); const params = []; for (let i = 0, argIdx = 0; i < paramDefs.length; ++i, ++argIdx) { const def = paramDefs[i]; let arg = args[argIdx]; if (def.hasOwnProperty('default') && ...
[ "function", "defineOperation", "(", "fn", ",", "paramDefs", ")", "{", "return", "function", "(", ")", "{", "const", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ";", "const", "params", "=", "[", "]", ";", ...
Monkey-patches an existing method to support parameter validation, as well as adding support for returning Promises if callbacks are not provided. @private @param {function} fn the function to override @param {Array<Object>} paramDefs the definitions of each parameter to the function
[ "Monkey", "-", "patches", "an", "existing", "method", "to", "support", "parameter", "validation", "as", "well", "as", "adding", "support", "for", "returning", "Promises", "if", "callbacks", "are", "not", "provided", "." ]
28fd17bf10ca29cf11650eb0165af1e07c19cab8
https://github.com/mongodb-js/kerberos/blob/28fd17bf10ca29cf11650eb0165af1e07c19cab8/lib/util.js#L39-L78
train
mapbox/decrypt-kms-env
index.js
decrypt
function decrypt(env, callback) { if (!env.AWS_DEFAULT_REGION) return callback(new Error('AWS_DEFAULT_REGION env var must be set')); var kms = new AWS.KMS({ region: env.AWS_DEFAULT_REGION, maxRetries: 10 }); var q = queue(); for (var key in env) { if (!(/^secure:/).test(env[key])) continue; q....
javascript
function decrypt(env, callback) { if (!env.AWS_DEFAULT_REGION) return callback(new Error('AWS_DEFAULT_REGION env var must be set')); var kms = new AWS.KMS({ region: env.AWS_DEFAULT_REGION, maxRetries: 10 }); var q = queue(); for (var key in env) { if (!(/^secure:/).test(env[key])) continue; q....
[ "function", "decrypt", "(", "env", ",", "callback", ")", "{", "if", "(", "!", "env", ".", "AWS_DEFAULT_REGION", ")", "return", "callback", "(", "new", "Error", "(", "'AWS_DEFAULT_REGION env var must be set'", ")", ")", ";", "var", "kms", "=", "new", "AWS", ...
Private decrypt function that does not scrub output. Not exposed as a public API. @param {object} env Object with variables to decrypt. @param {function} callback Callback function.
[ "Private", "decrypt", "function", "that", "does", "not", "scrub", "output", ".", "Not", "exposed", "as", "a", "public", "API", "." ]
5debeeac04f064ebb311df94652bf6ab7e5dd89b
https://github.com/mapbox/decrypt-kms-env/blob/5debeeac04f064ebb311df94652bf6ab7e5dd89b/index.js#L47-L69
train
jensarps/IDBWrapper
example/lib/requirejs/require.js
configurePackageDir
function configurePackageDir(pkgs, currentPackages, dir) { var i, location, pkgObj; for (i = 0; (pkgObj = currentPackages[i]); i++) { pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj; location = pkgObj.location; //Add dir to the path, but avoid paths ...
javascript
function configurePackageDir(pkgs, currentPackages, dir) { var i, location, pkgObj; for (i = 0; (pkgObj = currentPackages[i]); i++) { pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj; location = pkgObj.location; //Add dir to the path, but avoid paths ...
[ "function", "configurePackageDir", "(", "pkgs", ",", "currentPackages", ",", "dir", ")", "{", "var", "i", ",", "location", ",", "pkgObj", ";", "for", "(", "i", "=", "0", ";", "(", "pkgObj", "=", "currentPackages", "[", "i", "]", ")", ";", "i", "++", ...
Used to set up package paths from a packagePaths or packages config object. @param {Object} pkgs the object to store the new package config @param {Array} currentPackages an array of packages to configure @param {String} [dir] a prefix dir to use.
[ "Used", "to", "set", "up", "package", "paths", "from", "a", "packagePaths", "or", "packages", "config", "object", "." ]
f7e23b140506159ff926b19c6a526e51d87d1b93
https://github.com/jensarps/IDBWrapper/blob/f7e23b140506159ff926b19c6a526e51d87d1b93/example/lib/requirejs/require.js#L92-L120
train
jensarps/IDBWrapper
example/lib/requirejs/require.js
isPriorityDone
function isPriorityDone() { var priorityDone = true, priorityWait = config.priorityWait, priorityName, i; if (priorityWait) { for (i = 0; (priorityName = priorityWait[i]); i++) { if (!loaded[priorityName]) { ...
javascript
function isPriorityDone() { var priorityDone = true, priorityWait = config.priorityWait, priorityName, i; if (priorityWait) { for (i = 0; (priorityName = priorityWait[i]); i++) { if (!loaded[priorityName]) { ...
[ "function", "isPriorityDone", "(", ")", "{", "var", "priorityDone", "=", "true", ",", "priorityWait", "=", "config", ".", "priorityWait", ",", "priorityName", ",", "i", ";", "if", "(", "priorityWait", ")", "{", "for", "(", "i", "=", "0", ";", "(", "pri...
Determine if priority loading is done. If so clear the priorityWait
[ "Determine", "if", "priority", "loading", "is", "done", ".", "If", "so", "clear", "the", "priorityWait" ]
f7e23b140506159ff926b19c6a526e51d87d1b93
https://github.com/jensarps/IDBWrapper/blob/f7e23b140506159ff926b19c6a526e51d87d1b93/example/lib/requirejs/require.js#L358-L374
train
jensarps/IDBWrapper
example/lib/requirejs/require.js
updateNormalizedNames
function updateNormalizedNames(pluginName) { var oldFullName, oldModuleMap, moduleMap, fullName, callbacks, i, j, k, depArray, existingCallbacks, maps = normalizedWaiting[pluginName]; if (maps) { for (i = 0; (oldModuleMap = maps[i]); i++) { ...
javascript
function updateNormalizedNames(pluginName) { var oldFullName, oldModuleMap, moduleMap, fullName, callbacks, i, j, k, depArray, existingCallbacks, maps = normalizedWaiting[pluginName]; if (maps) { for (i = 0; (oldModuleMap = maps[i]); i++) { ...
[ "function", "updateNormalizedNames", "(", "pluginName", ")", "{", "var", "oldFullName", ",", "oldModuleMap", ",", "moduleMap", ",", "fullName", ",", "callbacks", ",", "i", ",", "j", ",", "k", ",", "depArray", ",", "existingCallbacks", ",", "maps", "=", "norm...
Used to update the normalized name for plugin-based dependencies after a plugin loads, since it can have its own normalization structure. @param {String} pluginName the normalized plugin module name.
[ "Used", "to", "update", "the", "normalized", "name", "for", "plugin", "-", "based", "dependencies", "after", "a", "plugin", "loads", "since", "it", "can", "have", "its", "own", "normalization", "structure", "." ]
f7e23b140506159ff926b19c6a526e51d87d1b93
https://github.com/jensarps/IDBWrapper/blob/f7e23b140506159ff926b19c6a526e51d87d1b93/example/lib/requirejs/require.js#L431-L479
train
joaonuno/flat-to-nested-js
index.js
FlatToNested
function FlatToNested(config) { this.config = config = config || {}; this.config.id = config.id || 'id'; this.config.parent = config.parent || 'parent'; this.config.children = config.children || 'children'; this.config.options = config.options || { deleteParent: true }; }
javascript
function FlatToNested(config) { this.config = config = config || {}; this.config.id = config.id || 'id'; this.config.parent = config.parent || 'parent'; this.config.children = config.children || 'children'; this.config.options = config.options || { deleteParent: true }; }
[ "function", "FlatToNested", "(", "config", ")", "{", "this", ".", "config", "=", "config", "=", "config", "||", "{", "}", ";", "this", ".", "config", ".", "id", "=", "config", ".", "id", "||", "'id'", ";", "this", ".", "config", ".", "parent", "=",...
Create a new FlatToNested object. @constructor @param {object} config The configuration object.
[ "Create", "a", "new", "FlatToNested", "object", "." ]
1d2748909d015d05940051f4e79c0fd819e210f7
https://github.com/joaonuno/flat-to-nested-js/blob/1d2748909d015d05940051f4e79c0fd819e210f7/index.js#L10-L16
train
lovell/farmhash
index.js
function (input) { if (typeof input === 'string') { return farmhash.Hash32String(input); } if (Buffer.isBuffer(input)) { return farmhash.Hash32Buffer(input); } throw new Error('Expected a String or Buffer for input'); }
javascript
function (input) { if (typeof input === 'string') { return farmhash.Hash32String(input); } if (Buffer.isBuffer(input)) { return farmhash.Hash32Buffer(input); } throw new Error('Expected a String or Buffer for input'); }
[ "function", "(", "input", ")", "{", "if", "(", "typeof", "input", "===", "'string'", ")", "{", "return", "farmhash", ".", "Hash32String", "(", "input", ")", ";", "}", "if", "(", "Buffer", ".", "isBuffer", "(", "input", ")", ")", "{", "return", "farmh...
Hash methods - platform dependent
[ "Hash", "methods", "-", "platform", "dependent" ]
742f3fa9120dbf8a455813820cf0c7116770be19
https://github.com/lovell/farmhash/blob/742f3fa9120dbf8a455813820cf0c7116770be19/index.js#L14-L22
train
lovell/farmhash
index.js
function (input) { if (typeof input === 'string') { return farmhash.Fingerprint32String(input); } if (Buffer.isBuffer(input)) { return farmhash.Fingerprint32Buffer(input); } throw new Error('Expected a String or Buffer for input'); }
javascript
function (input) { if (typeof input === 'string') { return farmhash.Fingerprint32String(input); } if (Buffer.isBuffer(input)) { return farmhash.Fingerprint32Buffer(input); } throw new Error('Expected a String or Buffer for input'); }
[ "function", "(", "input", ")", "{", "if", "(", "typeof", "input", "===", "'string'", ")", "{", "return", "farmhash", ".", "Fingerprint32String", "(", "input", ")", ";", "}", "if", "(", "Buffer", ".", "isBuffer", "(", "input", ")", ")", "{", "return", ...
Fingerprint methods - platform independent
[ "Fingerprint", "methods", "-", "platform", "independent" ]
742f3fa9120dbf8a455813820cf0c7116770be19
https://github.com/lovell/farmhash/blob/742f3fa9120dbf8a455813820cf0c7116770be19/index.js#L64-L72
train
luckymarmot/API-Flow
scripts/flow-runner.js
runSuite
function runSuite() { execFile(flow, [ 'status', '--color', 'always' ], (err, stdout) => { process.stdout.write('\x1Bc') /* eslint-disable no-console */ console.log(stdout) /* eslint-enable no-console */ }) }
javascript
function runSuite() { execFile(flow, [ 'status', '--color', 'always' ], (err, stdout) => { process.stdout.write('\x1Bc') /* eslint-disable no-console */ console.log(stdout) /* eslint-enable no-console */ }) }
[ "function", "runSuite", "(", ")", "{", "execFile", "(", "flow", ",", "[", "'status'", ",", "'--color'", ",", "'always'", "]", ",", "(", "err", ",", "stdout", ")", "=>", "{", "process", ".", "stdout", ".", "write", "(", "'\\x1Bc'", ")", "/* eslint-disab...
A helper function to run flow tests. Clears the window and the prints the status of flow. @returns {void} nothing
[ "A", "helper", "function", "to", "run", "flow", "tests", ".", "Clears", "the", "window", "and", "the", "prints", "the", "status", "of", "flow", "." ]
24cc71aec64ca6be2c8b7807c9f97041a52b8cdb
https://github.com/luckymarmot/API-Flow/blob/24cc71aec64ca6be2c8b7807c9f97041a52b8cdb/scripts/flow-runner.js#L10-L17
train
ajfisher/node-pixel
lib/pixel.js
create_gamma_table
function create_gamma_table(steps, gamma, warning) { // used to build a gamma table for a particular value if (! warning && gamma == GAMMA_DEFAULT && ! global.IS_TEST_MODE) { console.info("INFO: Default gamma behaviour is changing"); console.info("0.9 - gamma=1.0 - consistent with pre-gamma val...
javascript
function create_gamma_table(steps, gamma, warning) { // used to build a gamma table for a particular value if (! warning && gamma == GAMMA_DEFAULT && ! global.IS_TEST_MODE) { console.info("INFO: Default gamma behaviour is changing"); console.info("0.9 - gamma=1.0 - consistent with pre-gamma val...
[ "function", "create_gamma_table", "(", "steps", ",", "gamma", ",", "warning", ")", "{", "// used to build a gamma table for a particular value", "if", "(", "!", "warning", "&&", "gamma", "==", "GAMMA_DEFAULT", "&&", "!", "global", ".", "IS_TEST_MODE", ")", "{", "c...
helper function for building gamma values
[ "helper", "function", "for", "building", "gamma", "values" ]
bfce32df41a40a6b86b5f5d04f190dc9029d629c
https://github.com/ajfisher/node-pixel/blob/bfce32df41a40a6b86b5f5d04f190dc9029d629c/lib/pixel.js#L401-L417
train
ajfisher/node-pixel
examples/rainbow-static.js
colorWheel
function colorWheel( WheelPos ){ var r,g,b; WheelPos = 255 - WheelPos; if ( WheelPos < 85 ) { r = 255 - WheelPos * 3; g = 0; b = WheelPos * 3; } else if (WheelPos < 170) { WheelPos -= 85; r = 0; g = WheelPos * 3; ...
javascript
function colorWheel( WheelPos ){ var r,g,b; WheelPos = 255 - WheelPos; if ( WheelPos < 85 ) { r = 255 - WheelPos * 3; g = 0; b = WheelPos * 3; } else if (WheelPos < 170) { WheelPos -= 85; r = 0; g = WheelPos * 3; ...
[ "function", "colorWheel", "(", "WheelPos", ")", "{", "var", "r", ",", "g", ",", "b", ";", "WheelPos", "=", "255", "-", "WheelPos", ";", "if", "(", "WheelPos", "<", "85", ")", "{", "r", "=", "255", "-", "WheelPos", "*", "3", ";", "g", "=", "0", ...
Input a value 0 to 255 to get a color value. The colours are a transition r - g - b - back to r.
[ "Input", "a", "value", "0", "to", "255", "to", "get", "a", "color", "value", ".", "The", "colours", "are", "a", "transition", "r", "-", "g", "-", "b", "-", "back", "to", "r", "." ]
bfce32df41a40a6b86b5f5d04f190dc9029d629c
https://github.com/ajfisher/node-pixel/blob/bfce32df41a40a6b86b5f5d04f190dc9029d629c/examples/rainbow-static.js#L47-L68
train
eggjs/egg-logrotator
app/lib/rotator.js
renameOrDelete
async function renameOrDelete(srcPath, targetPath) { if (srcPath === targetPath) { return; } const srcExists = await fs.exists(srcPath); if (!srcExists) { return; } const targetExists = await fs.exists(targetPath); // if target file exists, then throw // because the target file always be renamed...
javascript
async function renameOrDelete(srcPath, targetPath) { if (srcPath === targetPath) { return; } const srcExists = await fs.exists(srcPath); if (!srcExists) { return; } const targetExists = await fs.exists(targetPath); // if target file exists, then throw // because the target file always be renamed...
[ "async", "function", "renameOrDelete", "(", "srcPath", ",", "targetPath", ")", "{", "if", "(", "srcPath", "===", "targetPath", ")", "{", "return", ";", "}", "const", "srcExists", "=", "await", "fs", ".", "exists", "(", "srcPath", ")", ";", "if", "(", "...
rename from srcPath to targetPath, for example foo.log.1 > foo.log.2
[ "rename", "from", "srcPath", "to", "targetPath", "for", "example", "foo", ".", "log", ".", "1", ">", "foo", ".", "log", ".", "2" ]
105616a372f563ae77a50ecb62b73c61d4c17fd5
https://github.com/eggjs/egg-logrotator/blob/105616a372f563ae77a50ecb62b73c61d4c17fd5/app/lib/rotator.js#L51-L67
train
infusion/Complex.js
complex.js
function(a, b) { var z = new Complex(a, b); // Infinity + Infinity = NaN if (this['isInfinite']() && z['isInfinite']()) { return Complex['NAN']; } // Infinity + z = Infinity { where z != Infinity } if (this['isInfinite']() || z['isInfinite']()) { return Complex['IN...
javascript
function(a, b) { var z = new Complex(a, b); // Infinity + Infinity = NaN if (this['isInfinite']() && z['isInfinite']()) { return Complex['NAN']; } // Infinity + z = Infinity { where z != Infinity } if (this['isInfinite']() || z['isInfinite']()) { return Complex['IN...
[ "function", "(", "a", ",", "b", ")", "{", "var", "z", "=", "new", "Complex", "(", "a", ",", "b", ")", ";", "// Infinity + Infinity = NaN", "if", "(", "this", "[", "'isInfinite'", "]", "(", ")", "&&", "z", "[", "'isInfinite'", "]", "(", ")", ")", ...
Adds two complex numbers @returns {Complex}
[ "Adds", "two", "complex", "numbers" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L315-L332
train
infusion/Complex.js
complex.js
function(a, b) { var z = new Complex(a, b); // Infinity * 0 = NaN if ((this['isInfinite']() && z['isZero']()) || (this['isZero']() && z['isInfinite']())) { return Complex['NAN']; } // Infinity * z = Infinity { where z != 0 } if (this['isInfinite']() || z['isInfinite']()) {...
javascript
function(a, b) { var z = new Complex(a, b); // Infinity * 0 = NaN if ((this['isInfinite']() && z['isZero']()) || (this['isZero']() && z['isInfinite']())) { return Complex['NAN']; } // Infinity * z = Infinity { where z != 0 } if (this['isInfinite']() || z['isInfinite']()) {...
[ "function", "(", "a", ",", "b", ")", "{", "var", "z", "=", "new", "Complex", "(", "a", ",", "b", ")", ";", "// Infinity * 0 = NaN", "if", "(", "(", "this", "[", "'isInfinite'", "]", "(", ")", "&&", "z", "[", "'isZero'", "]", "(", ")", ")", "||"...
Multiplies two complex numbers @returns {Complex}
[ "Multiplies", "two", "complex", "numbers" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L363-L385
train
infusion/Complex.js
complex.js
function(a, b) { var z = new Complex(a, b); // 0 / 0 = NaN and Infinity / Infinity = NaN if ((this['isZero']() && z['isZero']()) || (this['isInfinite']() && z['isInfinite']())) { return Complex['NAN']; } // Infinity / 0 = Infinity if (this['isInfinite']() || z['isZero']())...
javascript
function(a, b) { var z = new Complex(a, b); // 0 / 0 = NaN and Infinity / Infinity = NaN if ((this['isZero']() && z['isZero']()) || (this['isInfinite']() && z['isInfinite']())) { return Complex['NAN']; } // Infinity / 0 = Infinity if (this['isInfinite']() || z['isZero']())...
[ "function", "(", "a", ",", "b", ")", "{", "var", "z", "=", "new", "Complex", "(", "a", ",", "b", ")", ";", "// 0 / 0 = NaN and Infinity / Infinity = NaN", "if", "(", "(", "this", "[", "'isZero'", "]", "(", ")", "&&", "z", "[", "'isZero'", "]", "(", ...
Divides two complex numbers @returns {Complex}
[ "Divides", "two", "complex", "numbers" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L392-L441
train
infusion/Complex.js
complex.js
function(a, b) { var z = new Complex(a, b); a = this['re']; b = this['im']; if (z['isZero']()) { return Complex['ONE']; } // If the exponent is real if (z['im'] === 0) { if (b === 0 && a >= 0) { return new Complex(Math.pow(a, z['re']), 0); ...
javascript
function(a, b) { var z = new Complex(a, b); a = this['re']; b = this['im']; if (z['isZero']()) { return Complex['ONE']; } // If the exponent is real if (z['im'] === 0) { if (b === 0 && a >= 0) { return new Complex(Math.pow(a, z['re']), 0); ...
[ "function", "(", "a", ",", "b", ")", "{", "var", "z", "=", "new", "Complex", "(", "a", ",", "b", ")", ";", "a", "=", "this", "[", "'re'", "]", ";", "b", "=", "this", "[", "'im'", "]", ";", "if", "(", "z", "[", "'isZero'", "]", "(", ")", ...
Calculate the power of two complex numbers @returns {Complex}
[ "Calculate", "the", "power", "of", "two", "complex", "numbers" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L448-L512
train
infusion/Complex.js
complex.js
function() { var a = this['re']; var b = this['im']; var r = this['abs'](); var re, im; if (a >= 0) { if (b === 0) { return new Complex(Math.sqrt(a), 0); } re = 0.5 * Math.sqrt(2.0 * (r + a)); } else { re = Math.abs(b) / Math.sqrt(2 * (r...
javascript
function() { var a = this['re']; var b = this['im']; var r = this['abs'](); var re, im; if (a >= 0) { if (b === 0) { return new Complex(Math.sqrt(a), 0); } re = 0.5 * Math.sqrt(2.0 * (r + a)); } else { re = Math.abs(b) / Math.sqrt(2 * (r...
[ "function", "(", ")", "{", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "var", "r", "=", "this", "[", "'abs'", "]", "(", ")", ";", "var", "re", ",", "im", ";", "if", "(", "a", ">=", "0", ...
Calculate the complex square root @returns {Complex}
[ "Calculate", "the", "complex", "square", "root" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L519-L545
train
infusion/Complex.js
complex.js
function() { var tmp = Math.exp(this['re']); if (this['im'] === 0) { //return new Complex(tmp, 0); } return new Complex( tmp * Math.cos(this['im']), tmp * Math.sin(this['im'])); }
javascript
function() { var tmp = Math.exp(this['re']); if (this['im'] === 0) { //return new Complex(tmp, 0); } return new Complex( tmp * Math.cos(this['im']), tmp * Math.sin(this['im'])); }
[ "function", "(", ")", "{", "var", "tmp", "=", "Math", ".", "exp", "(", "this", "[", "'re'", "]", ")", ";", "if", "(", "this", "[", "'im'", "]", "===", "0", ")", "{", "//return new Complex(tmp, 0);", "}", "return", "new", "Complex", "(", "tmp", "*",...
Calculate the complex exponent @returns {Complex}
[ "Calculate", "the", "complex", "exponent" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L552-L562
train
infusion/Complex.js
complex.js
function() { /** * exp(a + i*b) - 1 = exp(a) * (cos(b) + j*sin(b)) - 1 = expm1(a)*cos(b) + cosm1(b) + j*exp(a)*sin(b) */ var a = this['re']; var b = this['im']; return new Complex( Math.expm1(a) * Math.cos(b) + cosm1(b), Math.exp(a) * Ma...
javascript
function() { /** * exp(a + i*b) - 1 = exp(a) * (cos(b) + j*sin(b)) - 1 = expm1(a)*cos(b) + cosm1(b) + j*exp(a)*sin(b) */ var a = this['re']; var b = this['im']; return new Complex( Math.expm1(a) * Math.cos(b) + cosm1(b), Math.exp(a) * Ma...
[ "function", "(", ")", "{", "/**\n * exp(a + i*b) - 1\n = exp(a) * (cos(b) + j*sin(b)) - 1\n = expm1(a)*cos(b) + cosm1(b) + j*exp(a)*sin(b)\n */", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "return"...
Calculate the complex exponent and subtracts one. This may be more accurate than `Complex(x).exp().sub(1)` if `x` is small. @returns {Complex}
[ "Calculate", "the", "complex", "exponent", "and", "subtracts", "one", "." ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L572-L586
train
infusion/Complex.js
complex.js
function() { var a = this['re']; var b = this['im']; if (b === 0 && a > 0) { //return new Complex(Math.log(a), 0); } return new Complex( logHypot(a, b), Math.atan2(b, a)); }
javascript
function() { var a = this['re']; var b = this['im']; if (b === 0 && a > 0) { //return new Complex(Math.log(a), 0); } return new Complex( logHypot(a, b), Math.atan2(b, a)); }
[ "function", "(", ")", "{", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "if", "(", "b", "===", "0", "&&", "a", ">", "0", ")", "{", "//return new Complex(Math.log(a), 0);", "}", "return", "new", "...
Calculate the natural log @returns {Complex}
[ "Calculate", "the", "natural", "log" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L593-L605
train
infusion/Complex.js
complex.js
function() { // sin(c) = (e^b - e^(-b)) / (2i) var a = this['re']; var b = this['im']; return new Complex( Math.sin(a) * cosh(b), Math.cos(a) * sinh(b)); }
javascript
function() { // sin(c) = (e^b - e^(-b)) / (2i) var a = this['re']; var b = this['im']; return new Complex( Math.sin(a) * cosh(b), Math.cos(a) * sinh(b)); }
[ "function", "(", ")", "{", "// sin(c) = (e^b - e^(-b)) / (2i)", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "return", "new", "Complex", "(", "Math", ".", "sin", "(", "a", ")", "*", "cosh", "(", "b...
Calculate the sine of the complex number @returns {Complex}
[ "Calculate", "the", "sine", "of", "the", "complex", "number" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L632-L642
train
infusion/Complex.js
complex.js
function() { // asin(c) = -i * log(ci + sqrt(1 - c^2)) var a = this['re']; var b = this['im']; var t1 = new Complex( b * b - a * a + 1, -2 * a * b)['sqrt'](); var t2 = new Complex( t1['re'] - b, t1['im'] + a)['log'](); retu...
javascript
function() { // asin(c) = -i * log(ci + sqrt(1 - c^2)) var a = this['re']; var b = this['im']; var t1 = new Complex( b * b - a * a + 1, -2 * a * b)['sqrt'](); var t2 = new Complex( t1['re'] - b, t1['im'] + a)['log'](); retu...
[ "function", "(", ")", "{", "// asin(c) = -i * log(ci + sqrt(1 - c^2))", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "var", "t1", "=", "new", "Complex", "(", "b", "*", "b", "-", "a", "*", "a", "+",...
Calculate the complex arcus sinus @returns {Complex}
[ "Calculate", "the", "complex", "arcus", "sinus" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L738-L754
train
infusion/Complex.js
complex.js
function() { // acos(c) = i * log(c - i * sqrt(1 - c^2)) var a = this['re']; var b = this['im']; var t1 = new Complex( b * b - a * a + 1, -2 * a * b)['sqrt'](); var t2 = new Complex( t1['re'] - b, t1['im'] + a)['log'](); re...
javascript
function() { // acos(c) = i * log(c - i * sqrt(1 - c^2)) var a = this['re']; var b = this['im']; var t1 = new Complex( b * b - a * a + 1, -2 * a * b)['sqrt'](); var t2 = new Complex( t1['re'] - b, t1['im'] + a)['log'](); re...
[ "function", "(", ")", "{", "// acos(c) = i * log(c - i * sqrt(1 - c^2))", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "var", "t1", "=", "new", "Complex", "(", "b", "*", "b", "-", "a", "*", "a", "+...
Calculate the complex arcus cosinus @returns {Complex}
[ "Calculate", "the", "complex", "arcus", "cosinus" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L761-L777
train
infusion/Complex.js
complex.js
function() { // atan(c) = i / 2 log((i + x) / (i - x)) var a = this['re']; var b = this['im']; if (a === 0) { if (b === 1) { return new Complex(0, Infinity); } if (b === -1) { return new Complex(0, -Infinity); } } var d = a * ...
javascript
function() { // atan(c) = i / 2 log((i + x) / (i - x)) var a = this['re']; var b = this['im']; if (a === 0) { if (b === 1) { return new Complex(0, Infinity); } if (b === -1) { return new Complex(0, -Infinity); } } var d = a * ...
[ "function", "(", ")", "{", "// atan(c) = i / 2 log((i + x) / (i - x))", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "if", "(", "a", "===", "0", ")", "{", "if", "(", "b", "===", "1", ")", "{", "r...
Calculate the complex arcus tangent @returns {Complex}
[ "Calculate", "the", "complex", "arcus", "tangent" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L784-L809
train
infusion/Complex.js
complex.js
function() { // acot(c) = i / 2 log((c - i) / (c + i)) var a = this['re']; var b = this['im']; if (b === 0) { return new Complex(Math.atan2(1, a), 0); } var d = a * a + b * b; return (d !== 0) ? new Complex( a / d, ...
javascript
function() { // acot(c) = i / 2 log((c - i) / (c + i)) var a = this['re']; var b = this['im']; if (b === 0) { return new Complex(Math.atan2(1, a), 0); } var d = a * a + b * b; return (d !== 0) ? new Complex( a / d, ...
[ "function", "(", ")", "{", "// acot(c) = i / 2 log((c - i) / (c + i))", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "if", "(", "b", "===", "0", ")", "{", "return", "new", "Complex", "(", "Math", "."...
Calculate the complex arcus cotangent @returns {Complex}
[ "Calculate", "the", "complex", "arcus", "cotangent" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L816-L835
train
infusion/Complex.js
complex.js
function() { // asec(c) = -i * log(1 / c + sqrt(1 - i / c^2)) var a = this['re']; var b = this['im']; if (a === 0 && b === 0) { return new Complex(0, Infinity); } var d = a * a + b * b; return (d !== 0) ? new Complex( a / d, ...
javascript
function() { // asec(c) = -i * log(1 / c + sqrt(1 - i / c^2)) var a = this['re']; var b = this['im']; if (a === 0 && b === 0) { return new Complex(0, Infinity); } var d = a * a + b * b; return (d !== 0) ? new Complex( a / d, ...
[ "function", "(", ")", "{", "// asec(c) = -i * log(1 / c + sqrt(1 - i / c^2))", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "if", "(", "a", "===", "0", "&&", "b", "===", "0", ")", "{", "return", "new...
Calculate the complex arcus secant @returns {Complex}
[ "Calculate", "the", "complex", "arcus", "secant" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L842-L861
train
infusion/Complex.js
complex.js
function() { // acsc(c) = -i * log(i / c + sqrt(1 - 1 / c^2)) var a = this['re']; var b = this['im']; if (a === 0 && b === 0) { return new Complex(Math.PI / 2, Infinity); } var d = a * a + b * b; return (d !== 0) ? new Complex( a ...
javascript
function() { // acsc(c) = -i * log(i / c + sqrt(1 - 1 / c^2)) var a = this['re']; var b = this['im']; if (a === 0 && b === 0) { return new Complex(Math.PI / 2, Infinity); } var d = a * a + b * b; return (d !== 0) ? new Complex( a ...
[ "function", "(", ")", "{", "// acsc(c) = -i * log(i / c + sqrt(1 - 1 / c^2))", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "if", "(", "a", "===", "0", "&&", "b", "===", "0", ")", "{", "return", "new...
Calculate the complex arcus cosecans @returns {Complex}
[ "Calculate", "the", "complex", "arcus", "cosecans" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L868-L887
train
infusion/Complex.js
complex.js
function() { // atanh(c) = log((1+c) / (1-c)) / 2 var a = this['re']; var b = this['im']; var noIM = a > 1 && b === 0; var oneMinus = 1 - a; var onePlus = 1 + a; var d = oneMinus * oneMinus + b * b; var x = (d !== 0) ? new Complex( ...
javascript
function() { // atanh(c) = log((1+c) / (1-c)) / 2 var a = this['re']; var b = this['im']; var noIM = a > 1 && b === 0; var oneMinus = 1 - a; var onePlus = 1 + a; var d = oneMinus * oneMinus + b * b; var x = (d !== 0) ? new Complex( ...
[ "function", "(", ")", "{", "// atanh(c) = log((1+c) / (1-c)) / 2", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "var", "noIM", "=", "a", ">", "1", "&&", "b", "===", "0", ";", "var", "oneMinus", "="...
Calculate the complex atanh @returns {Complex}
[ "Calculate", "the", "complex", "atanh" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L1045-L1072
train
infusion/Complex.js
complex.js
function() { // acoth(c) = log((c+1) / (c-1)) / 2 var a = this['re']; var b = this['im']; if (a === 0 && b === 0) { return new Complex(0, Math.PI / 2); } var d = a * a + b * b; return (d !== 0) ? new Complex( a / d, ...
javascript
function() { // acoth(c) = log((c+1) / (c-1)) / 2 var a = this['re']; var b = this['im']; if (a === 0 && b === 0) { return new Complex(0, Math.PI / 2); } var d = a * a + b * b; return (d !== 0) ? new Complex( a / d, ...
[ "function", "(", ")", "{", "// acoth(c) = log((c+1) / (c-1)) / 2", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "if", "(", "a", "===", "0", "&&", "b", "===", "0", ")", "{", "return", "new", "Comple...
Calculate the complex acoth @returns {Complex}
[ "Calculate", "the", "complex", "acoth" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L1079-L1098
train
infusion/Complex.js
complex.js
function() { // acsch(c) = log((1+sqrt(1+c^2))/c) var a = this['re']; var b = this['im']; if (b === 0) { return new Complex( (a !== 0) ? Math.log(a + Math.sqrt(a * a + 1)) : Infinity, 0); } var d = a * a + b * b; retu...
javascript
function() { // acsch(c) = log((1+sqrt(1+c^2))/c) var a = this['re']; var b = this['im']; if (b === 0) { return new Complex( (a !== 0) ? Math.log(a + Math.sqrt(a * a + 1)) : Infinity, 0); } var d = a * a + b * b; retu...
[ "function", "(", ")", "{", "// acsch(c) = log((1+sqrt(1+c^2))/c)", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "if", "(", "b", "===", "0", ")", "{", "return", "new", "Complex", "(", "(", "a", "!==...
Calculate the complex acsch @returns {Complex}
[ "Calculate", "the", "complex", "acsch" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L1105-L1128
train
infusion/Complex.js
complex.js
function() { // asech(c) = log((1+sqrt(1-c^2))/c) var a = this['re']; var b = this['im']; if (this['isZero']()) { return Complex['INFINITY']; } var d = a * a + b * b; return (d !== 0) ? new Complex( a / d, -b...
javascript
function() { // asech(c) = log((1+sqrt(1-c^2))/c) var a = this['re']; var b = this['im']; if (this['isZero']()) { return Complex['INFINITY']; } var d = a * a + b * b; return (d !== 0) ? new Complex( a / d, -b...
[ "function", "(", ")", "{", "// asech(c) = log((1+sqrt(1-c^2))/c)", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "if", "(", "this", "[", "'isZero'", "]", "(", ")", ")", "{", "return", "Complex", "[", ...
Calculate the complex asech @returns {Complex}
[ "Calculate", "the", "complex", "asech" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L1135-L1154
train
infusion/Complex.js
complex.js
function(places) { places = Math.pow(10, places || 0); return new Complex( Math.floor(this['re'] * places) / places, Math.floor(this['im'] * places) / places); }
javascript
function(places) { places = Math.pow(10, places || 0); return new Complex( Math.floor(this['re'] * places) / places, Math.floor(this['im'] * places) / places); }
[ "function", "(", "places", ")", "{", "places", "=", "Math", ".", "pow", "(", "10", ",", "places", "||", "0", ")", ";", "return", "new", "Complex", "(", "Math", ".", "floor", "(", "this", "[", "'re'", "]", "*", "places", ")", "/", "places", ",", ...
Floors the actual complex number @returns {Complex}
[ "Floors", "the", "actual", "complex", "number" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L1219-L1226
train
infusion/Complex.js
complex.js
function(a, b) { var z = new Complex(a, b); return Math.abs(z['re'] - this['re']) <= Complex['EPSILON'] && Math.abs(z['im'] - this['im']) <= Complex['EPSILON']; }
javascript
function(a, b) { var z = new Complex(a, b); return Math.abs(z['re'] - this['re']) <= Complex['EPSILON'] && Math.abs(z['im'] - this['im']) <= Complex['EPSILON']; }
[ "function", "(", "a", ",", "b", ")", "{", "var", "z", "=", "new", "Complex", "(", "a", ",", "b", ")", ";", "return", "Math", ".", "abs", "(", "z", "[", "'re'", "]", "-", "this", "[", "'re'", "]", ")", "<=", "Complex", "[", "'EPSILON'", "]", ...
Compares two complex numbers **Note:** new Complex(Infinity).equals(Infinity) === false @returns {boolean}
[ "Compares", "two", "complex", "numbers" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L1249-L1255
train
infusion/Complex.js
complex.js
function() { var a = this['re']; var b = this['im']; var ret = ''; if (this['isNaN']()) { return 'NaN'; } if (this['isZero']()) { return '0'; } if (this['isInfinite']()) { return 'Infinity'; } if (a !== 0) { ret += a; ...
javascript
function() { var a = this['re']; var b = this['im']; var ret = ''; if (this['isNaN']()) { return 'NaN'; } if (this['isZero']()) { return '0'; } if (this['isInfinite']()) { return 'Infinity'; } if (a !== 0) { ret += a; ...
[ "function", "(", ")", "{", "var", "a", "=", "this", "[", "'re'", "]", ";", "var", "b", "=", "this", "[", "'im'", "]", ";", "var", "ret", "=", "''", ";", "if", "(", "this", "[", "'isNaN'", "]", "(", ")", ")", "{", "return", "'NaN'", ";", "}"...
Gets a string of the actual complex number @returns {string}
[ "Gets", "a", "string", "of", "the", "actual", "complex", "number" ]
7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1
https://github.com/infusion/Complex.js/blob/7477f7b125dcd3a645b8ae4c818a14c1ed1c65b1/complex.js#L1272-L1314
train
jshttp/accepts
index.js
Accepts
function Accepts (req) { if (!(this instanceof Accepts)) { return new Accepts(req) } this.headers = req.headers this.negotiator = new Negotiator(req) }
javascript
function Accepts (req) { if (!(this instanceof Accepts)) { return new Accepts(req) } this.headers = req.headers this.negotiator = new Negotiator(req) }
[ "function", "Accepts", "(", "req", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Accepts", ")", ")", "{", "return", "new", "Accepts", "(", "req", ")", "}", "this", ".", "headers", "=", "req", ".", "headers", "this", ".", "negotiator", "=", ...
Create a new Accepts object for the given req. @param {object} req @public
[ "Create", "a", "new", "Accepts", "object", "for", "the", "given", "req", "." ]
2a6e060aebb52813fdb074e9e7f66da1cfa61902
https://github.com/jshttp/accepts/blob/2a6e060aebb52813fdb074e9e7f66da1cfa61902/index.js#L32-L39
train
ybogdanov/node-sync
examples/fiber.js
someAsyncFunction
function someAsyncFunction(file, callback) { // Here we just wrap the function body to make it synchronous inside // Sync will execute first argument 'fn' in synchronous way // and call second argument 'callback' when function returns // it also calls callback if exception will be thrown inside of 'fn' ...
javascript
function someAsyncFunction(file, callback) { // Here we just wrap the function body to make it synchronous inside // Sync will execute first argument 'fn' in synchronous way // and call second argument 'callback' when function returns // it also calls callback if exception will be thrown inside of 'fn' ...
[ "function", "someAsyncFunction", "(", "file", ",", "callback", ")", "{", "// Here we just wrap the function body to make it synchronous inside", "// Sync will execute first argument 'fn' in synchronous way", "// and call second argument 'callback' when function returns", "// it also calls call...
Simple asynchronous function with fiber inside example
[ "Simple", "asynchronous", "function", "with", "fiber", "inside", "example" ]
e977d68cf34eb207fce162e6a288eef2fb3f22d3
https://github.com/ybogdanov/node-sync/blob/e977d68cf34eb207fce162e6a288eef2fb3f22d3/examples/fiber.js#L12-L21
train
ybogdanov/node-sync
examples/async.js
asyncFunction
function asyncFunction(a, b, callback) { process.nextTick(function(){ callback(null, a + b); }) }
javascript
function asyncFunction(a, b, callback) { process.nextTick(function(){ callback(null, a + b); }) }
[ "function", "asyncFunction", "(", "a", ",", "b", ",", "callback", ")", "{", "process", ".", "nextTick", "(", "function", "(", ")", "{", "callback", "(", "null", ",", "a", "+", "b", ")", ";", "}", ")", "}" ]
Simple asynchronous function
[ "Simple", "asynchronous", "function" ]
e977d68cf34eb207fce162e6a288eef2fb3f22d3
https://github.com/ybogdanov/node-sync/blob/e977d68cf34eb207fce162e6a288eef2fb3f22d3/examples/async.js#L10-L14
train
ybogdanov/node-sync
lib/sync.js
function (callbackError, callbackResult, otherArgs) { // forbid to call twice if (syncCallback.called) return; syncCallback.called = true; if (callbackError) { err = callbackError; } else if (otherArgs) { // Support multiple callback resul...
javascript
function (callbackError, callbackResult, otherArgs) { // forbid to call twice if (syncCallback.called) return; syncCallback.called = true; if (callbackError) { err = callbackError; } else if (otherArgs) { // Support multiple callback resul...
[ "function", "(", "callbackError", ",", "callbackResult", ",", "otherArgs", ")", "{", "// forbid to call twice", "if", "(", "syncCallback", ".", "called", ")", "return", ";", "syncCallback", ".", "called", "=", "true", ";", "if", "(", "callbackError", ")", "{",...
Create virtual callback
[ "Create", "virtual", "callback" ]
e977d68cf34eb207fce162e6a288eef2fb3f22d3
https://github.com/ybogdanov/node-sync/blob/e977d68cf34eb207fce162e6a288eef2fb3f22d3/lib/sync.js#L38-L59
train
ybogdanov/node-sync
lib/sync.js
SyncFuture
function SyncFuture(timeout) { var self = this; this.resolved = false; this.fiber = Fiber.current; this.yielding = false; this.timeout = timeout; this.time = null; this._timeoutId = null; this._result = undefined; this._error = null; this._start = +new Date; Sy...
javascript
function SyncFuture(timeout) { var self = this; this.resolved = false; this.fiber = Fiber.current; this.yielding = false; this.timeout = timeout; this.time = null; this._timeoutId = null; this._result = undefined; this._error = null; this._start = +new Date; Sy...
[ "function", "SyncFuture", "(", "timeout", ")", "{", "var", "self", "=", "this", ";", "this", ".", "resolved", "=", "false", ";", "this", ".", "fiber", "=", "Fiber", ".", "current", ";", "this", ".", "yielding", "=", "false", ";", "this", ".", "timeou...
Future object itself
[ "Future", "object", "itself" ]
e977d68cf34eb207fce162e6a288eef2fb3f22d3
https://github.com/ybogdanov/node-sync/blob/e977d68cf34eb207fce162e6a288eef2fb3f22d3/lib/sync.js#L208-L309
train
icon-project/icon-sdk-js
lib/module/scryptsy/index.js
smix
function smix (B, Bi, r, N, V, XY) { var Xi = 0 var Yi = 128 * r var i B.copy(XY, Xi, Bi, Bi + Yi) for (i = 0; i < N; i++) { XY.copy(V, i * Yi, Xi, Xi + Yi) blockmix_salsa8(XY, Xi, Yi, r) if (tickCallback) tickCallback() } for (i = 0; i < N; i++) { var offset = Xi...
javascript
function smix (B, Bi, r, N, V, XY) { var Xi = 0 var Yi = 128 * r var i B.copy(XY, Xi, Bi, Bi + Yi) for (i = 0; i < N; i++) { XY.copy(V, i * Yi, Xi, Xi + Yi) blockmix_salsa8(XY, Xi, Yi, r) if (tickCallback) tickCallback() } for (i = 0; i < N; i++) { var offset = Xi...
[ "function", "smix", "(", "B", ",", "Bi", ",", "r", ",", "N", ",", "V", ",", "XY", ")", "{", "var", "Xi", "=", "0", "var", "Yi", "=", "128", "*", "r", "var", "i", "B", ".", "copy", "(", "XY", ",", "Xi", ",", "Bi", ",", "Bi", "+", "Yi", ...
all of these functions are actually moved to the top due to function hoisting
[ "all", "of", "these", "functions", "are", "actually", "moved", "to", "the", "top", "due", "to", "function", "hoisting" ]
65411d8f6240369dd2a5c23be87fdb22cebc82de
https://github.com/icon-project/icon-sdk-js/blob/65411d8f6240369dd2a5c23be87fdb22cebc82de/lib/module/scryptsy/index.js#L52-L76
train
nemtsov/json-mask
lib/filter.js
_arrayProperties
function _arrayProperties (arr, mask) { var obj = _properties({_: arr}, {_: { type: 'array', properties: mask }}) return obj && obj._ }
javascript
function _arrayProperties (arr, mask) { var obj = _properties({_: arr}, {_: { type: 'array', properties: mask }}) return obj && obj._ }
[ "function", "_arrayProperties", "(", "arr", ",", "mask", ")", "{", "var", "obj", "=", "_properties", "(", "{", "_", ":", "arr", "}", ",", "{", "_", ":", "{", "type", ":", "'array'", ",", "properties", ":", "mask", "}", "}", ")", "return", "obj", ...
wrap array & mask in a temp object; extract results from temp at the end
[ "wrap", "array", "&", "mask", "in", "a", "temp", "object", ";", "extract", "results", "from", "temp", "at", "the", "end" ]
9430f0b97d58d43ef33be23e1c7d4dd81e831834
https://github.com/nemtsov/json-mask/blob/9430f0b97d58d43ef33be23e1c7d4dd81e831834/lib/filter.js#L13-L19
train
keenwon/elint
src/utils/pad-end.js
padEnd
function padEnd (string, targetLength) { if (typeof string !== 'string' || typeof targetLength !== 'number') { return string } /* istanbul ignore next */ const fn = typeof String.prototype.padEnd === 'function' ? String.prototype.padEnd : polyfill return fn.call(string, targetLength) }
javascript
function padEnd (string, targetLength) { if (typeof string !== 'string' || typeof targetLength !== 'number') { return string } /* istanbul ignore next */ const fn = typeof String.prototype.padEnd === 'function' ? String.prototype.padEnd : polyfill return fn.call(string, targetLength) }
[ "function", "padEnd", "(", "string", ",", "targetLength", ")", "{", "if", "(", "typeof", "string", "!==", "'string'", "||", "typeof", "targetLength", "!==", "'number'", ")", "{", "return", "string", "}", "/* istanbul ignore next */", "const", "fn", "=", "typeo...
String.prototype.padEnd @param {string} string string @param {number} targetLength padding length @returns {string} string
[ "String", ".", "prototype", ".", "padEnd" ]
7bdb0c1a023dcbf305b2752e21f5cadec1fdd64d
https://github.com/keenwon/elint/blob/7bdb0c1a023dcbf305b2752e21f5cadec1fdd64d/src/utils/pad-end.js#L27-L39
train
keenwon/elint
src/preset/install-scripts.js
install
function install (presetName) { debug('run install from scripts, arguments: %o', arguments) const name = presetName || tryRequire(/elint-preset-/)[0] if (!name) { debug('can not fount preset, return') return } const nodeModulesDir = getNodeModulesDir() const keep = process.env.npm_config_keep || ...
javascript
function install (presetName) { debug('run install from scripts, arguments: %o', arguments) const name = presetName || tryRequire(/elint-preset-/)[0] if (!name) { debug('can not fount preset, return') return } const nodeModulesDir = getNodeModulesDir() const keep = process.env.npm_config_keep || ...
[ "function", "install", "(", "presetName", ")", "{", "debug", "(", "'run install from scripts, arguments: %o'", ",", "arguments", ")", "const", "name", "=", "presetName", "||", "tryRequire", "(", "/", "elint-preset-", "/", ")", "[", "0", "]", "if", "(", "!", ...
install preset from npm scripts @param {string} [presetName] preset name @returns {void}
[ "install", "preset", "from", "npm", "scripts" ]
7bdb0c1a023dcbf305b2752e21f5cadec1fdd64d
https://github.com/keenwon/elint/blob/7bdb0c1a023dcbf305b2752e21f5cadec1fdd64d/src/preset/install-scripts.js#L15-L30
train
sonnyp/JSON8
packages/patch/lib/buildRevertPatch.js
reverse
function reverse(patch, previous, idx) { const op = patch.op; const path = patch.path; if (op === "copy" || (op === "add" && previous === undefined)) { if (idx === undefined) return { op: "remove", path: path }; // for item pushed to array with - const tokens = decode(path); tokens[tokens.length...
javascript
function reverse(patch, previous, idx) { const op = patch.op; const path = patch.path; if (op === "copy" || (op === "add" && previous === undefined)) { if (idx === undefined) return { op: "remove", path: path }; // for item pushed to array with - const tokens = decode(path); tokens[tokens.length...
[ "function", "reverse", "(", "patch", ",", "previous", ",", "idx", ")", "{", "const", "op", "=", "patch", ".", "op", ";", "const", "path", "=", "patch", ".", "path", ";", "if", "(", "op", "===", "\"copy\"", "||", "(", "op", "===", "\"add\"", "&&", ...
Return the reverse operation to a JSON Patch operation @param {Object} patch - JSON Patch operation object @param {Any} previous - previous value for add and replace operations @param {Number} idx - index of the item for array @return {Object}
[ "Return", "the", "reverse", "operation", "to", "a", "JSON", "Patch", "operation" ]
4bbb0fe612a780a9834c79f2525d4a2267049ebe
https://github.com/sonnyp/JSON8/blob/4bbb0fe612a780a9834c79f2525d4a2267049ebe/packages/patch/lib/buildRevertPatch.js#L14-L31
train
sonnyp/JSON8
packages/patch/lib/apply.js
apply
function apply(doc, patch, options) { if (!Array.isArray(patch)) throw new Error("Invalid argument, patch must be an array"); const done = []; for (let i = 0, len = patch.length; i < len; i++) { const p = patch[i]; let r; try { r = run(doc, p); } catch (err) { // restore documen...
javascript
function apply(doc, patch, options) { if (!Array.isArray(patch)) throw new Error("Invalid argument, patch must be an array"); const done = []; for (let i = 0, len = patch.length; i < len; i++) { const p = patch[i]; let r; try { r = run(doc, p); } catch (err) { // restore documen...
[ "function", "apply", "(", "doc", ",", "patch", ",", "options", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "patch", ")", ")", "throw", "new", "Error", "(", "\"Invalid argument, patch must be an array\"", ")", ";", "const", "done", "=", "[", "...
Apply a JSON Patch to a JSON document @param {Any} doc - JSON document to apply the patch to @param {Array} patch - JSON Patch array @param {Object} options - options @param {Boolean} options.reversible - return an array to revert @return {PatchR...
[ "Apply", "a", "JSON", "Patch", "to", "a", "JSON", "document" ]
4bbb0fe612a780a9834c79f2525d4a2267049ebe
https://github.com/sonnyp/JSON8/blob/4bbb0fe612a780a9834c79f2525d4a2267049ebe/packages/patch/lib/apply.js#L57-L87
train
marook/osm-read
lib/proto/index.js
Blob
function Blob(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
javascript
function Blob(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
[ "function", "Blob", "(", "properties", ")", "{", "if", "(", "properties", ")", "for", "(", "var", "keys", "=", "Object", ".", "keys", "(", "properties", ")", ",", "i", "=", "0", ";", "i", "<", "keys", ".", "length", ";", "++", "i", ")", "if", "...
Properties of a Blob. @memberof OSMPBF @interface IBlob @property {Uint8Array|null} [raw] Blob raw @property {number|null} [rawSize] Blob rawSize @property {Uint8Array|null} [zlibData] Blob zlibData @property {Uint8Array|null} [lzmaData] Blob lzmaData @property {Uint8Array|null} [OBSOLETEBzip2Data] Blob OBSOLETEBzip2Da...
[ "Properties", "of", "a", "Blob", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/lib/proto/index.js#L42-L47
train
marook/osm-read
lib/proto/index.js
BlobHeader
function BlobHeader(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
javascript
function BlobHeader(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
[ "function", "BlobHeader", "(", "properties", ")", "{", "if", "(", "properties", ")", "for", "(", "var", "keys", "=", "Object", ".", "keys", "(", "properties", ")", ",", "i", "=", "0", ";", "i", "<", "keys", ".", "length", ";", "++", "i", ")", "if...
Properties of a BlobHeader. @memberof OSMPBF @interface IBlobHeader @property {string} type BlobHeader type @property {Uint8Array|null} [indexdata] BlobHeader indexdata @property {number} datasize BlobHeader datasize Constructs a new BlobHeader. @memberof OSMPBF @classdesc Represents a BlobHeader. @implements IBlobHe...
[ "Properties", "of", "a", "BlobHeader", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/lib/proto/index.js#L352-L357
train
marook/osm-read
lib/proto/index.js
HeaderBlock
function HeaderBlock(properties) { this.requiredFeatures = []; this.optionalFeatures = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] ...
javascript
function HeaderBlock(properties) { this.requiredFeatures = []; this.optionalFeatures = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] ...
[ "function", "HeaderBlock", "(", "properties", ")", "{", "this", ".", "requiredFeatures", "=", "[", "]", ";", "this", ".", "optionalFeatures", "=", "[", "]", ";", "if", "(", "properties", ")", "for", "(", "var", "keys", "=", "Object", ".", "keys", "(", ...
Properties of a HeaderBlock. @memberof OSMPBF @interface IHeaderBlock @property {OSMPBF.IHeaderBBox|null} [bbox] HeaderBlock bbox @property {Array.<string>|null} [requiredFeatures] HeaderBlock requiredFeatures @property {Array.<string>|null} [optionalFeatures] HeaderBlock optionalFeatures @property {string|null} [writi...
[ "Properties", "of", "a", "HeaderBlock", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/lib/proto/index.js#L598-L605
train
marook/osm-read
lib/proto/index.js
HeaderBBox
function HeaderBBox(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
javascript
function HeaderBBox(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
[ "function", "HeaderBBox", "(", "properties", ")", "{", "if", "(", "properties", ")", "for", "(", "var", "keys", "=", "Object", ".", "keys", "(", "properties", ")", ",", "i", "=", "0", ";", "i", "<", "keys", ".", "length", ";", "++", "i", ")", "if...
Properties of a HeaderBBox. @memberof OSMPBF @interface IHeaderBBox @property {number|Long} left HeaderBBox left @property {number|Long} right HeaderBBox right @property {number|Long} top HeaderBBox top @property {number|Long} bottom HeaderBBox bottom Constructs a new HeaderBBox. @memberof OSMPBF @classdesc Represent...
[ "Properties", "of", "a", "HeaderBBox", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/lib/proto/index.js#L1003-L1008
train
marook/osm-read
lib/proto/index.js
PrimitiveBlock
function PrimitiveBlock(properties) { this.primitivegroup = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
javascript
function PrimitiveBlock(properties) { this.primitivegroup = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
[ "function", "PrimitiveBlock", "(", "properties", ")", "{", "this", ".", "primitivegroup", "=", "[", "]", ";", "if", "(", "properties", ")", "for", "(", "var", "keys", "=", "Object", ".", "keys", "(", "properties", ")", ",", "i", "=", "0", ";", "i", ...
Properties of a PrimitiveBlock. @memberof OSMPBF @interface IPrimitiveBlock @property {OSMPBF.IStringTable} stringtable PrimitiveBlock stringtable @property {Array.<OSMPBF.IPrimitiveGroup>|null} [primitivegroup] PrimitiveBlock primitivegroup @property {number|null} [granularity] PrimitiveBlock granularity @property {nu...
[ "Properties", "of", "a", "PrimitiveBlock", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/lib/proto/index.js#L1315-L1321
train
marook/osm-read
lib/proto/index.js
PrimitiveGroup
function PrimitiveGroup(properties) { this.nodes = []; this.ways = []; this.relations = []; this.changesets = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] ...
javascript
function PrimitiveGroup(properties) { this.nodes = []; this.ways = []; this.relations = []; this.changesets = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] ...
[ "function", "PrimitiveGroup", "(", "properties", ")", "{", "this", ".", "nodes", "=", "[", "]", ";", "this", ".", "ways", "=", "[", "]", ";", "this", ".", "relations", "=", "[", "]", ";", "this", ".", "changesets", "=", "[", "]", ";", "if", "(", ...
Properties of a PrimitiveGroup. @memberof OSMPBF @interface IPrimitiveGroup @property {Array.<OSMPBF.INode>|null} [nodes] PrimitiveGroup nodes @property {OSMPBF.IDenseNodes|null} [dense] PrimitiveGroup dense @property {Array.<OSMPBF.IWay>|null} [ways] PrimitiveGroup ways @property {Array.<OSMPBF.IRelation>|null} [relat...
[ "Properties", "of", "a", "PrimitiveGroup", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/lib/proto/index.js#L1668-L1677
train
marook/osm-read
lib/proto/index.js
DenseInfo
function DenseInfo(properties) { this.version = []; this.timestamp = []; this.changeset = []; this.uid = []; this.userSid = []; this.visible = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys....
javascript
function DenseInfo(properties) { this.version = []; this.timestamp = []; this.changeset = []; this.uid = []; this.userSid = []; this.visible = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys....
[ "function", "DenseInfo", "(", "properties", ")", "{", "this", ".", "version", "=", "[", "]", ";", "this", ".", "timestamp", "=", "[", "]", ";", "this", ".", "changeset", "=", "[", "]", ";", "this", ".", "uid", "=", "[", "]", ";", "this", ".", "...
Properties of a DenseInfo. @memberof OSMPBF @interface IDenseInfo @property {Array.<number>|null} [version] DenseInfo version @property {Array.<number|Long>|null} [timestamp] DenseInfo timestamp @property {Array.<number|Long>|null} [changeset] DenseInfo changeset @property {Array.<number>|null} [uid] DenseInfo uid @pro...
[ "Properties", "of", "a", "DenseInfo", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/lib/proto/index.js#L2570-L2581
train
marook/osm-read
lib/proto/index.js
ChangeSet
function ChangeSet(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
javascript
function ChangeSet(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; }
[ "function", "ChangeSet", "(", "properties", ")", "{", "if", "(", "properties", ")", "for", "(", "var", "keys", "=", "Object", ".", "keys", "(", "properties", ")", ",", "i", "=", "0", ";", "i", "<", "keys", ".", "length", ";", "++", "i", ")", "if"...
Properties of a ChangeSet. @memberof OSMPBF @interface IChangeSet @property {number|Long} id ChangeSet id Constructs a new ChangeSet. @memberof OSMPBF @classdesc Represents a ChangeSet. @implements IChangeSet @constructor @param {OSMPBF.IChangeSet=} [properties] Properties to set
[ "Properties", "of", "a", "ChangeSet", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/lib/proto/index.js#L3027-L3032
train
marook/osm-read
lib/proto/index.js
Node
function Node(properties) { this.keys = []; this.vals = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; ...
javascript
function Node(properties) { this.keys = []; this.vals = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = properties[keys[i]]; ...
[ "function", "Node", "(", "properties", ")", "{", "this", ".", "keys", "=", "[", "]", ";", "this", ".", "vals", "=", "[", "]", ";", "if", "(", "properties", ")", "for", "(", "var", "keys", "=", "Object", ".", "keys", "(", "properties", ")", ",", ...
Properties of a Node. @memberof OSMPBF @interface INode @property {number|Long} id Node id @property {Array.<number>|null} [keys] Node keys @property {Array.<number>|null} [vals] Node vals @property {OSMPBF.IInfo|null} [info] Node info @property {number|Long} lat Node lat @property {number|Long} lon Node lon Construc...
[ "Properties", "of", "a", "Node", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/lib/proto/index.js#L3233-L3240
train
marook/osm-read
lib/proto/index.js
DenseNodes
function DenseNodes(properties) { this.id = []; this.lat = []; this.lon = []; this.keysVals = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) ...
javascript
function DenseNodes(properties) { this.id = []; this.lat = []; this.lon = []; this.keysVals = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) ...
[ "function", "DenseNodes", "(", "properties", ")", "{", "this", ".", "id", "=", "[", "]", ";", "this", ".", "lat", "=", "[", "]", ";", "this", ".", "lon", "=", "[", "]", ";", "this", ".", "keysVals", "=", "[", "]", ";", "if", "(", "properties", ...
Properties of a DenseNodes. @memberof OSMPBF @interface IDenseNodes @property {Array.<number|Long>|null} [id] DenseNodes id @property {OSMPBF.IDenseInfo|null} [denseinfo] DenseNodes denseinfo @property {Array.<number|Long>|null} [lat] DenseNodes lat @property {Array.<number|Long>|null} [lon] DenseNodes lon @property {A...
[ "Properties", "of", "a", "DenseNodes", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/lib/proto/index.js#L3627-L3636
train
marook/osm-read
lib/proto/index.js
Way
function Way(properties) { this.keys = []; this.vals = []; this.refs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = pr...
javascript
function Way(properties) { this.keys = []; this.vals = []; this.refs = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) this[keys[i]] = pr...
[ "function", "Way", "(", "properties", ")", "{", "this", ".", "keys", "=", "[", "]", ";", "this", ".", "vals", "=", "[", "]", ";", "this", ".", "refs", "=", "[", "]", ";", "if", "(", "properties", ")", "for", "(", "var", "keys", "=", "Object", ...
Properties of a Way. @memberof OSMPBF @interface IWay @property {number|Long} id Way id @property {Array.<number>|null} [keys] Way keys @property {Array.<number>|null} [vals] Way vals @property {OSMPBF.IInfo|null} [info] Way info @property {Array.<number|Long>|null} [refs] Way refs Constructs a new Way. @memberof OSM...
[ "Properties", "of", "a", "Way", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/lib/proto/index.js#L4035-L4043
train
marook/osm-read
lib/proto/index.js
Relation
function Relation(properties) { this.keys = []; this.vals = []; this.rolesSid = []; this.memids = []; this.types = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (pro...
javascript
function Relation(properties) { this.keys = []; this.vals = []; this.rolesSid = []; this.memids = []; this.types = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (pro...
[ "function", "Relation", "(", "properties", ")", "{", "this", ".", "keys", "=", "[", "]", ";", "this", ".", "vals", "=", "[", "]", ";", "this", ".", "rolesSid", "=", "[", "]", ";", "this", ".", "memids", "=", "[", "]", ";", "this", ".", "types",...
Properties of a Relation. @memberof OSMPBF @interface IRelation @property {number|Long} id Relation id @property {Array.<number>|null} [keys] Relation keys @property {Array.<number>|null} [vals] Relation vals @property {OSMPBF.IInfo|null} [info] Relation info @property {Array.<number>|null} [rolesSid] Relation rolesSid...
[ "Properties", "of", "a", "Relation", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/lib/proto/index.js#L4416-L4426
train
marook/osm-read
osm-read-pbf.js
inquire
function inquire(moduleName) { try { var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval if (mod && (mod.length || Object.keys(mod).length)) return mod; } catch (e) {} // eslint-disable-line no-empty return null; }
javascript
function inquire(moduleName) { try { var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval if (mod && (mod.length || Object.keys(mod).length)) return mod; } catch (e) {} // eslint-disable-line no-empty return null; }
[ "function", "inquire", "(", "moduleName", ")", "{", "try", "{", "var", "mod", "=", "eval", "(", "\"quire\"", ".", "replace", "(", "/", "^", "/", ",", "\"re\"", ")", ")", "(", "moduleName", ")", ";", "// eslint-disable-line no-eval\r", "if", "(", "mod", ...
Requires a module only if available. @memberof util @param {string} moduleName Module to require @returns {?Object} Required module if available and not empty, otherwise `null`
[ "Requires", "a", "module", "only", "if", "available", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/osm-read-pbf.js#L6387-L6394
train
marook/osm-read
osm-read-pbf.js
merge
function merge(dst, src, ifNotSet) { // used by converters for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) if (dst[keys[i]] === undefined || !ifNotSet) dst[keys[i]] = src[keys[i]]; return dst; }
javascript
function merge(dst, src, ifNotSet) { // used by converters for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) if (dst[keys[i]] === undefined || !ifNotSet) dst[keys[i]] = src[keys[i]]; return dst; }
[ "function", "merge", "(", "dst", ",", "src", ",", "ifNotSet", ")", "{", "// used by converters\r", "for", "(", "var", "keys", "=", "Object", ".", "keys", "(", "src", ")", ",", "i", "=", "0", ";", "i", "<", "keys", ".", "length", ";", "++", "i", "...
Merges the properties of the source object into the destination object. @memberof util @param {Object.<string,*>} dst Destination object @param {Object.<string,*>} src Source object @param {boolean} [ifNotSet=false] Merges only if the key is not already set @returns {Object.<string,*>} Destination object
[ "Merges", "the", "properties", "of", "the", "source", "object", "into", "the", "destination", "object", "." ]
a1530bfe40bb247af9648c7c86e8e96af6fd0882
https://github.com/marook/osm-read/blob/a1530bfe40bb247af9648c7c86e8e96af6fd0882/osm-read-pbf.js#L7684-L7689
train
ipfs/js-ipfs-merkle-dag
src/dag-node.js
toProtoBuf
function toProtoBuf (node) { const pbn = {} if (node.data && node.data.length > 0) { pbn.Data = node.data } else { pbn.Data = null // new Buffer(0) } if (node.links.length > 0) { pbn.Links = node.links.map((link) => { return { Hash: link.hash, Name: link.name, Tsize...
javascript
function toProtoBuf (node) { const pbn = {} if (node.data && node.data.length > 0) { pbn.Data = node.data } else { pbn.Data = null // new Buffer(0) } if (node.links.length > 0) { pbn.Links = node.links.map((link) => { return { Hash: link.hash, Name: link.name, Tsize...
[ "function", "toProtoBuf", "(", "node", ")", "{", "const", "pbn", "=", "{", "}", "if", "(", "node", ".", "data", "&&", "node", ".", "data", ".", "length", ">", "0", ")", "{", "pbn", ".", "Data", "=", "node", ".", "data", "}", "else", "{", "pbn",...
Helper method to get a protobuf object equivalent
[ "Helper", "method", "to", "get", "a", "protobuf", "object", "equivalent" ]
d510f2eae1d4817feb2d9aecb02918b4e06313a9
https://github.com/ipfs/js-ipfs-merkle-dag/blob/d510f2eae1d4817feb2d9aecb02918b4e06313a9/src/dag-node.js#L19-L41
train
JerryC8080/Memeye
src/dashboard/index.js
bindIndicators
function bindIndicators(indicator) { // Parent process will send three type of data const collectorHandler = { 'process': function (value) { indicator.rss = value.rss; indicator.heapTotal = value.heapTotal; indicator.heapUsed = value.heapUsed; }, 'os':...
javascript
function bindIndicators(indicator) { // Parent process will send three type of data const collectorHandler = { 'process': function (value) { indicator.rss = value.rss; indicator.heapTotal = value.heapTotal; indicator.heapUsed = value.heapUsed; }, 'os':...
[ "function", "bindIndicators", "(", "indicator", ")", "{", "// Parent process will send three type of data", "const", "collectorHandler", "=", "{", "'process'", ":", "function", "(", "value", ")", "{", "indicator", ".", "rss", "=", "value", ".", "rss", ";", "indica...
Bind process IPC channel to indicator
[ "Bind", "process", "IPC", "channel", "to", "indicator" ]
139f6d46ef74929a48fa6a00b01219b8aefa0fe6
https://github.com/JerryC8080/Memeye/blob/139f6d46ef74929a48fa6a00b01219b8aefa0fe6/src/dashboard/index.js#L35-L65
train
JerryC8080/Memeye
src/dashboard/index.js
bindSocket
function bindSocket(io, indicator) { Object.keys(indicator.watch).forEach((key) => { let eventName = indicator.watch[key]; indicator.on(eventName, (msg) => io.emit(eventName, msg)); }); }
javascript
function bindSocket(io, indicator) { Object.keys(indicator.watch).forEach((key) => { let eventName = indicator.watch[key]; indicator.on(eventName, (msg) => io.emit(eventName, msg)); }); }
[ "function", "bindSocket", "(", "io", ",", "indicator", ")", "{", "Object", ".", "keys", "(", "indicator", ".", "watch", ")", ".", "forEach", "(", "(", "key", ")", "=>", "{", "let", "eventName", "=", "indicator", ".", "watch", "[", "key", "]", ";", ...
Bind indicators to socket
[ "Bind", "indicators", "to", "socket" ]
139f6d46ef74929a48fa6a00b01219b8aefa0fe6
https://github.com/JerryC8080/Memeye/blob/139f6d46ef74929a48fa6a00b01219b8aefa0fe6/src/dashboard/index.js#L68-L73
train
fzaninotto/DependencyWheel
js/d3.dependencyWheel.js
function(opacity) { return function(g, i) { gEnter.selectAll(".chord") .filter(function(d) { return d.source.index != i && d.target.index != i; }) .transition() .style("opacity", opacity); var groups = []; gEnter...
javascript
function(opacity) { return function(g, i) { gEnter.selectAll(".chord") .filter(function(d) { return d.source.index != i && d.target.index != i; }) .transition() .style("opacity", opacity); var groups = []; gEnter...
[ "function", "(", "opacity", ")", "{", "return", "function", "(", "g", ",", "i", ")", "{", "gEnter", ".", "selectAll", "(", "\".chord\"", ")", ".", "filter", "(", "function", "(", "d", ")", "{", "return", "d", ".", "source", ".", "index", "!=", "i",...
Returns an event handler for fading a given chord group.
[ "Returns", "an", "event", "handler", "for", "fading", "a", "given", "chord", "group", "." ]
c7a1f4a1672dd903337d3c3d8c260a09fd8ee910
https://github.com/fzaninotto/DependencyWheel/blob/c7a1f4a1672dd903337d3c3d8c260a09fd8ee910/js/d3.dependencyWheel.js#L73-L103
train
choojs/wayfarer
index.js
Wayfarer
function Wayfarer (dft) { if (!(this instanceof Wayfarer)) return new Wayfarer(dft) var _default = (dft || '').replace(/^\//, '') var _trie = trie() emit._trie = _trie emit.on = on emit.emit = emit emit.match = match emit._wayfarer = true return emit // define a route // (str, fn) -> obj fun...
javascript
function Wayfarer (dft) { if (!(this instanceof Wayfarer)) return new Wayfarer(dft) var _default = (dft || '').replace(/^\//, '') var _trie = trie() emit._trie = _trie emit.on = on emit.emit = emit emit.match = match emit._wayfarer = true return emit // define a route // (str, fn) -> obj fun...
[ "function", "Wayfarer", "(", "dft", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Wayfarer", ")", ")", "return", "new", "Wayfarer", "(", "dft", ")", "var", "_default", "=", "(", "dft", "||", "''", ")", ".", "replace", "(", "/", "^\\/", "/",...
create a router str -> obj
[ "create", "a", "router", "str", "-", ">", "obj" ]
7f23ccdf2094443403902cde3ebc05828fa9b26b
https://github.com/choojs/wayfarer/blob/7f23ccdf2094443403902cde3ebc05828fa9b26b/index.js#L8-L77
train
kimmobrunfeldt/react-progressbar.js
tools/release.js
bumpVersion
function bumpVersion(files, bumpType) { status('Bump', bumpType, 'version to files:', files.join(' ')); if (config.dryRun) return '[not available in dry run]'; var newVersion; var originalVersion; files.forEach(function(fileName) { var filePath = path.join(projectRoot, fileName); v...
javascript
function bumpVersion(files, bumpType) { status('Bump', bumpType, 'version to files:', files.join(' ')); if (config.dryRun) return '[not available in dry run]'; var newVersion; var originalVersion; files.forEach(function(fileName) { var filePath = path.join(projectRoot, fileName); v...
[ "function", "bumpVersion", "(", "files", ",", "bumpType", ")", "{", "status", "(", "'Bump'", ",", "bumpType", ",", "'version to files:'", ",", "files", ".", "join", "(", "' '", ")", ")", ";", "if", "(", "config", ".", "dryRun", ")", "return", "'[not avai...
Bumps version in specified files. Files are assumed to contain JSON data which has "version" key following semantic versioning
[ "Bumps", "version", "in", "specified", "files", ".", "Files", "are", "assumed", "to", "contain", "JSON", "data", "which", "has", "version", "key", "following", "semantic", "versioning" ]
16d5cf0a289ee87111580fedb42c9e58aab32b08
https://github.com/kimmobrunfeldt/react-progressbar.js/blob/16d5cf0a289ee87111580fedb42c9e58aab32b08/tools/release.js#L150-L188
train
bastienmichaux/generator-jhipster-db-helper
generators/fix-entity/prompts.js
askForTableName
function askForTableName() { if (this.force) { return; } const validateTableName = dbh.validateTableName; const done = this.async(); this.prompt([ { type: 'input', name: 'dbhTableName', validate: ((input) => { const prodDatabaseTy...
javascript
function askForTableName() { if (this.force) { return; } const validateTableName = dbh.validateTableName; const done = this.async(); this.prompt([ { type: 'input', name: 'dbhTableName', validate: ((input) => { const prodDatabaseTy...
[ "function", "askForTableName", "(", ")", "{", "if", "(", "this", ".", "force", ")", "{", "return", ";", "}", "const", "validateTableName", "=", "dbh", ".", "validateTableName", ";", "const", "done", "=", "this", ".", "async", "(", ")", ";", "this", "."...
Ask the table name for an entity
[ "Ask", "the", "table", "name", "for", "an", "entity" ]
17912e83f0a36248d8c32bb2aa07c6d077be7d87
https://github.com/bastienmichaux/generator-jhipster-db-helper/blob/17912e83f0a36248d8c32bb2aa07c6d077be7d87/generators/fix-entity/prompts.js#L14-L37
train
bastienmichaux/generator-jhipster-db-helper
generators/fix-entity/prompts.js
askForColumnsName
function askForColumnsName() { // Don't ask columns name if there aren't any field // Or option --force if (this.fields === undefined || this.fields.length === 0 || this.force) { return; } this.log(chalk.green(`Asking column names for ${this.fields.length} field(s)`)); const done = this...
javascript
function askForColumnsName() { // Don't ask columns name if there aren't any field // Or option --force if (this.fields === undefined || this.fields.length === 0 || this.force) { return; } this.log(chalk.green(`Asking column names for ${this.fields.length} field(s)`)); const done = this...
[ "function", "askForColumnsName", "(", ")", "{", "// Don't ask columns name if there aren't any field", "// Or option --force", "if", "(", "this", ".", "fields", "===", "undefined", "||", "this", ".", "fields", ".", "length", "===", "0", "||", "this", ".", "force", ...
For each field of an entity, ask the actual column name
[ "For", "each", "field", "of", "an", "entity", "ask", "the", "actual", "column", "name" ]
17912e83f0a36248d8c32bb2aa07c6d077be7d87
https://github.com/bastienmichaux/generator-jhipster-db-helper/blob/17912e83f0a36248d8c32bb2aa07c6d077be7d87/generators/fix-entity/prompts.js#L65-L80
train
bastienmichaux/generator-jhipster-db-helper
generators/fix-entity/prompts.js
askForRelationshipsId
function askForRelationshipsId() { // Don't ask relationship id if there aren't any relationship // Or option --force if (this.relationships === undefined || this.relationships.length === 0 || this.force) { return; } // work only on owner relationship this.relationshipsPile = this.relat...
javascript
function askForRelationshipsId() { // Don't ask relationship id if there aren't any relationship // Or option --force if (this.relationships === undefined || this.relationships.length === 0 || this.force) { return; } // work only on owner relationship this.relationshipsPile = this.relat...
[ "function", "askForRelationshipsId", "(", ")", "{", "// Don't ask relationship id if there aren't any relationship", "// Or option --force", "if", "(", "this", ".", "relationships", "===", "undefined", "||", "this", ".", "relationships", ".", "length", "===", "0", "||", ...
For each relationship of entity, ask for actual column name
[ "For", "each", "relationship", "of", "entity", "ask", "for", "actual", "column", "name" ]
17912e83f0a36248d8c32bb2aa07c6d077be7d87
https://github.com/bastienmichaux/generator-jhipster-db-helper/blob/17912e83f0a36248d8c32bb2aa07c6d077be7d87/generators/fix-entity/prompts.js#L124-L147
train
joetidee/enzyme-react-intl
src/index.js
loadTranslation
function loadTranslation(localeFilePath) { if(typeof localeFilePath == "undefined"){ messages = defaultMessages; return null; } let fp = path.join(__dirname, localeFilePath); messages = require('jsonfile').readFileSync("." + fp); return messages; }
javascript
function loadTranslation(localeFilePath) { if(typeof localeFilePath == "undefined"){ messages = defaultMessages; return null; } let fp = path.join(__dirname, localeFilePath); messages = require('jsonfile').readFileSync("." + fp); return messages; }
[ "function", "loadTranslation", "(", "localeFilePath", ")", "{", "if", "(", "typeof", "localeFilePath", "==", "\"undefined\"", ")", "{", "messages", "=", "defaultMessages", ";", "return", "null", ";", "}", "let", "fp", "=", "path", ".", "join", "(", "__dirnam...
Loads translation file. @param {string} localeFilePath @return {object} messages
[ "Loads", "translation", "file", "." ]
1e96a0eb59239a6ac7dade34d38e71da49fd27b8
https://github.com/joetidee/enzyme-react-intl/blob/1e96a0eb59239a6ac7dade34d38e71da49fd27b8/src/index.js#L14-L22
train
joetidee/enzyme-react-intl
src/index.js
shallowWithIntl
function shallowWithIntl(node, options = { context: {}}) { const intlProvider = new IntlProvider({locale: locale, messages }, {}); const { intl } = intlProvider.getChildContext(); return shallow(React.cloneElement(node, { intl }), { ...options, context: { ...options.context, intl } }); }
javascript
function shallowWithIntl(node, options = { context: {}}) { const intlProvider = new IntlProvider({locale: locale, messages }, {}); const { intl } = intlProvider.getChildContext(); return shallow(React.cloneElement(node, { intl }), { ...options, context: { ...options.context, intl } }); }
[ "function", "shallowWithIntl", "(", "node", ",", "options", "=", "{", "context", ":", "{", "}", "}", ")", "{", "const", "intlProvider", "=", "new", "IntlProvider", "(", "{", "locale", ":", "locale", ",", "messages", "}", ",", "{", "}", ")", ";", "con...
Equivalent to enzyme's 'shallow' method. @param {string} node React Component that requires react-intl. @param {object} options enzyme.shallow options @return {object}
[ "Equivalent", "to", "enzyme", "s", "shallow", "method", "." ]
1e96a0eb59239a6ac7dade34d38e71da49fd27b8
https://github.com/joetidee/enzyme-react-intl/blob/1e96a0eb59239a6ac7dade34d38e71da49fd27b8/src/index.js#L45-L49
train
joetidee/enzyme-react-intl
src/index.js
mountWithIntl
function mountWithIntl (node, { context, childContextTypes } = {}) { const intlProvider = new IntlProvider({locale: locale, messages }, {}); const { intl } = intlProvider.getChildContext(); return mount(React.cloneElement(node, { intl }), { context: Object.assign({}, context, {intl}), c...
javascript
function mountWithIntl (node, { context, childContextTypes } = {}) { const intlProvider = new IntlProvider({locale: locale, messages }, {}); const { intl } = intlProvider.getChildContext(); return mount(React.cloneElement(node, { intl }), { context: Object.assign({}, context, {intl}), c...
[ "function", "mountWithIntl", "(", "node", ",", "{", "context", ",", "childContextTypes", "}", "=", "{", "}", ")", "{", "const", "intlProvider", "=", "new", "IntlProvider", "(", "{", "locale", ":", "locale", ",", "messages", "}", ",", "{", "}", ")", ";"...
Equivalent to enzyme's 'mount' method. @param {string} node React Component that requires react-intl. @return {object}
[ "Equivalent", "to", "enzyme", "s", "mount", "method", "." ]
1e96a0eb59239a6ac7dade34d38e71da49fd27b8
https://github.com/joetidee/enzyme-react-intl/blob/1e96a0eb59239a6ac7dade34d38e71da49fd27b8/src/index.js#L56-L63
train
joetidee/enzyme-react-intl
src/index.js
renderWithIntl
function renderWithIntl (node, { context, childContextTypes } = {}) { const intlProvider = new IntlProvider({locale: locale, messages }, {}); const { intl } = intlProvider.getChildContext(); return render(React.cloneElement(node, { intl }), { context: Object.assign({}, context, {intl}), ...
javascript
function renderWithIntl (node, { context, childContextTypes } = {}) { const intlProvider = new IntlProvider({locale: locale, messages }, {}); const { intl } = intlProvider.getChildContext(); return render(React.cloneElement(node, { intl }), { context: Object.assign({}, context, {intl}), ...
[ "function", "renderWithIntl", "(", "node", ",", "{", "context", ",", "childContextTypes", "}", "=", "{", "}", ")", "{", "const", "intlProvider", "=", "new", "IntlProvider", "(", "{", "locale", ":", "locale", ",", "messages", "}", ",", "{", "}", ")", ";...
Equivalent to enzyme's 'render' method. @param {string} node React Component that requires react-intl. @return {object}
[ "Equivalent", "to", "enzyme", "s", "render", "method", "." ]
1e96a0eb59239a6ac7dade34d38e71da49fd27b8
https://github.com/joetidee/enzyme-react-intl/blob/1e96a0eb59239a6ac7dade34d38e71da49fd27b8/src/index.js#L70-L77
train
mapbox/makizushi
index.js
getMarker
function getMarker(options, callback) { // prevent .parsedTint from being attached to options options = xtend({}, options); if (options.tint) { // Expand hex shorthand (3 chars) to 6, e.g. 333 => 333333. // This is not done upstream in `node-tint` as some such // shorthand cannot be ...
javascript
function getMarker(options, callback) { // prevent .parsedTint from being attached to options options = xtend({}, options); if (options.tint) { // Expand hex shorthand (3 chars) to 6, e.g. 333 => 333333. // This is not done upstream in `node-tint` as some such // shorthand cannot be ...
[ "function", "getMarker", "(", "options", ",", "callback", ")", "{", "// prevent .parsedTint from being attached to options", "options", "=", "xtend", "(", "{", "}", ",", "options", ")", ";", "if", "(", "options", ".", "tint", ")", "{", "// Expand hex shorthand (3 ...
Given a marker object like { base, tint, symbol, name } Call callback with buffer. @param {object} options @param {function} callback
[ "Given", "a", "marker", "object", "like" ]
8ffaa0415d78439d79ab3108ae36f845c789d475
https://github.com/mapbox/makizushi/blob/8ffaa0415d78439d79ab3108ae36f845c789d475/index.js#L39-L63
train
mapbox/makizushi
index.js
loadMaki
function loadMaki(options, callback) { var base = options.base + '-' + options.size + (options.retina ? '@2x' : ''), size = options.size, symbol = options.symbol + '-' + sizes[size] + (options.retina ? '@2x' : ''); if (!base || !size) { return callback(errcode('Marker is invalid because...
javascript
function loadMaki(options, callback) { var base = options.base + '-' + options.size + (options.retina ? '@2x' : ''), size = options.size, symbol = options.symbol + '-' + sizes[size] + (options.retina ? '@2x' : ''); if (!base || !size) { return callback(errcode('Marker is invalid because...
[ "function", "loadMaki", "(", "options", ",", "callback", ")", "{", "var", "base", "=", "options", ".", "base", "+", "'-'", "+", "options", ".", "size", "+", "(", "options", ".", "retina", "?", "'@2x'", ":", "''", ")", ",", "size", "=", "options", "...
Load & composite a marker from the maki icon set. @param {object} options @param {function} callback
[ "Load", "&", "composite", "a", "marker", "from", "the", "maki", "icon", "set", "." ]
8ffaa0415d78439d79ab3108ae36f845c789d475
https://github.com/mapbox/makizushi/blob/8ffaa0415d78439d79ab3108ae36f845c789d475/index.js#L71-L122
train
CSNW/sql-bricks
sql-bricks.js
argsToArray
function argsToArray(args) { if (_.isArray(args[0])) return args[0]; else if (typeof args[0] == 'string' && args[0].indexOf(',') > -1) return _.invoke(args[0].split(','), 'trim'); else return _.toArray(args); }
javascript
function argsToArray(args) { if (_.isArray(args[0])) return args[0]; else if (typeof args[0] == 'string' && args[0].indexOf(',') > -1) return _.invoke(args[0].split(','), 'trim'); else return _.toArray(args); }
[ "function", "argsToArray", "(", "args", ")", "{", "if", "(", "_", ".", "isArray", "(", "args", "[", "0", "]", ")", ")", "return", "args", "[", "0", "]", ";", "else", "if", "(", "typeof", "args", "[", "0", "]", "==", "'string'", "&&", "args", "[...
handle an array, a comma-delimited str or separate args
[ "handle", "an", "array", "a", "comma", "-", "delimited", "str", "or", "separate", "args" ]
087027d2f3738d769873b0c76ac9090697077b2b
https://github.com/CSNW/sql-bricks/blob/087027d2f3738d769873b0c76ac9090697077b2b/sql-bricks.js#L638-L645
train
jonsamwell/angular-auto-validate
dist/jcs-auto-validate.js
formatString
function formatString(string, params) { return string.replace(/{(\d+)}/g, function (match, number) { return typeof params[number] !== undefined ? params[number] : match; }); }
javascript
function formatString(string, params) { return string.replace(/{(\d+)}/g, function (match, number) { return typeof params[number] !== undefined ? params[number] : match; }); }
[ "function", "formatString", "(", "string", ",", "params", ")", "{", "return", "string", ".", "replace", "(", "/", "{(\\d+)}", "/", "g", ",", "function", "(", "match", ",", "number", ")", "{", "return", "typeof", "params", "[", "number", "]", "!==", "un...
Replaces string placeholders with corresponding template string
[ "Replaces", "string", "placeholders", "with", "corresponding", "template", "string" ]
ea8ccf4e312e8fdf1e73fb69e26846f57d5eb3ca
https://github.com/jonsamwell/angular-auto-validate/blob/ea8ccf4e312e8fdf1e73fb69e26846f57d5eb3ca/dist/jcs-auto-validate.js#L647-L651
train
jsdoc2md/dmd
helpers/helpers.js
tableHead
function tableHead () { var args = arrayify(arguments) var data = args.shift() if (!data) return args.pop() var cols = args var colHeaders = cols.map(function (col) { var spl = col.split('|') return spl[1] || spl[0] }) cols = cols.map(function (col) { return col.split('|')[0] }) var toSp...
javascript
function tableHead () { var args = arrayify(arguments) var data = args.shift() if (!data) return args.pop() var cols = args var colHeaders = cols.map(function (col) { var spl = col.split('|') return spl[1] || spl[0] }) cols = cols.map(function (col) { return col.split('|')[0] }) var toSp...
[ "function", "tableHead", "(", ")", "{", "var", "args", "=", "arrayify", "(", "arguments", ")", "var", "data", "=", "args", ".", "shift", "(", ")", "if", "(", "!", "data", ")", "return", "args", ".", "pop", "(", ")", "var", "cols", "=", "args", "v...
returns a gfm table header row.. only columns which contain data are included in the output
[ "returns", "a", "gfm", "table", "header", "row", "..", "only", "columns", "which", "contain", "data", "are", "included", "in", "the", "output" ]
a4b31ec41f3b3a523c354877ac488da33314fc1f
https://github.com/jsdoc2md/dmd/blob/a4b31ec41f3b3a523c354877ac488da33314fc1f/helpers/helpers.js#L62-L90
train
jsdoc2md/dmd
helpers/helpers.js
tableRow
function tableRow () { var args = arrayify(arguments) var rows = args.shift() if (!rows) return var options = args.pop() var cols = args var output = '' if (options.data) { var data = handlebars.createFrame(options.data) cols.forEach(function (col, index) { var colNumber = index + 1 d...
javascript
function tableRow () { var args = arrayify(arguments) var rows = args.shift() if (!rows) return var options = args.pop() var cols = args var output = '' if (options.data) { var data = handlebars.createFrame(options.data) cols.forEach(function (col, index) { var colNumber = index + 1 d...
[ "function", "tableRow", "(", ")", "{", "var", "args", "=", "arrayify", "(", "arguments", ")", "var", "rows", "=", "args", ".", "shift", "(", ")", "if", "(", "!", "rows", ")", "return", "var", "options", "=", "args", ".", "pop", "(", ")", "var", "...
returns a gfm table row.. only columns which contain data are included in the output
[ "returns", "a", "gfm", "table", "row", "..", "only", "columns", "which", "contain", "data", "are", "included", "in", "the", "output" ]
a4b31ec41f3b3a523c354877ac488da33314fc1f
https://github.com/jsdoc2md/dmd/blob/a4b31ec41f3b3a523c354877ac488da33314fc1f/helpers/helpers.js#L101-L120
train
jsdoc2md/dmd
helpers/helpers.js
_groupBy
function _groupBy (identifiers, groupByFields) { /* don't modify the input array */ groupByFields = groupByFields.slice(0) groupByFields.forEach(function (group) { var groupValues = identifiers .filter(function (identifier) { /* exclude constructors from grouping.. re-implement to work off a `n...
javascript
function _groupBy (identifiers, groupByFields) { /* don't modify the input array */ groupByFields = groupByFields.slice(0) groupByFields.forEach(function (group) { var groupValues = identifiers .filter(function (identifier) { /* exclude constructors from grouping.. re-implement to work off a `n...
[ "function", "_groupBy", "(", "identifiers", ",", "groupByFields", ")", "{", "/* don't modify the input array */", "groupByFields", "=", "groupByFields", ".", "slice", "(", "0", ")", "groupByFields", ".", "forEach", "(", "function", "(", "group", ")", "{", "var", ...
takes the children of this, groups them, inserts group headings..
[ "takes", "the", "children", "of", "this", "groups", "them", "inserts", "group", "headings", ".." ]
a4b31ec41f3b3a523c354877ac488da33314fc1f
https://github.com/jsdoc2md/dmd/blob/a4b31ec41f3b3a523c354877ac488da33314fc1f/helpers/helpers.js#L191-L234
train
jsdoc2md/dmd
helpers/helpers.js
kindInThisContext
function kindInThisContext (options) { if (this.kind === 'function' && this.memberof) { return 'method' } else if (this.kind === 'member' && !this.isEnum && this.memberof) { return 'property' } else if (this.kind === 'member' && this.isEnum && this.memberof) { return 'enum property' } else if (this....
javascript
function kindInThisContext (options) { if (this.kind === 'function' && this.memberof) { return 'method' } else if (this.kind === 'member' && !this.isEnum && this.memberof) { return 'property' } else if (this.kind === 'member' && this.isEnum && this.memberof) { return 'enum property' } else if (this....
[ "function", "kindInThisContext", "(", "options", ")", "{", "if", "(", "this", ".", "kind", "===", "'function'", "&&", "this", ".", "memberof", ")", "{", "return", "'method'", "}", "else", "if", "(", "this", ".", "kind", "===", "'member'", "&&", "!", "t...
returns a more appropriate 'kind', depending on context @return {string}
[ "returns", "a", "more", "appropriate", "kind", "depending", "on", "context" ]
a4b31ec41f3b3a523c354877ac488da33314fc1f
https://github.com/jsdoc2md/dmd/blob/a4b31ec41f3b3a523c354877ac488da33314fc1f/helpers/helpers.js#L250-L264
train
jsdoc2md/dmd
helpers/helpers.js
params
function params (options) { if (this.params) { var list = this.params.map(function (param) { var nameSplit = param.name.split('.') var name = nameSplit[nameSplit.length - 1] if (nameSplit.length > 1) name = '.' + name if (param.variable) name = '...' + name if (param.optional) name =...
javascript
function params (options) { if (this.params) { var list = this.params.map(function (param) { var nameSplit = param.name.split('.') var name = nameSplit[nameSplit.length - 1] if (nameSplit.length > 1) name = '.' + name if (param.variable) name = '...' + name if (param.optional) name =...
[ "function", "params", "(", "options", ")", "{", "if", "(", "this", ".", "params", ")", "{", "var", "list", "=", "this", ".", "params", ".", "map", "(", "function", "(", "param", ")", "{", "var", "nameSplit", "=", "param", ".", "name", ".", "split",...
block helper.. provides the data to render the @params tag
[ "block", "helper", "..", "provides", "the", "data", "to", "render", "the" ]
a4b31ec41f3b3a523c354877ac488da33314fc1f
https://github.com/jsdoc2md/dmd/blob/a4b31ec41f3b3a523c354877ac488da33314fc1f/helpers/helpers.js#L284-L302
train
jsdoc2md/dmd
helpers/selectors.js
identifier
function identifier (options) { var result = ddata._identifier(options) return result ? options.fn(result) : 'ERROR, Cannot find identifier.' }
javascript
function identifier (options) { var result = ddata._identifier(options) return result ? options.fn(result) : 'ERROR, Cannot find identifier.' }
[ "function", "identifier", "(", "options", ")", "{", "var", "result", "=", "ddata", ".", "_identifier", "(", "options", ")", "return", "result", "?", "options", ".", "fn", "(", "result", ")", ":", "'ERROR, Cannot find identifier.'", "}" ]
render the supplied block for the specified identifier @static
[ "render", "the", "supplied", "block", "for", "the", "specified", "identifier" ]
a4b31ec41f3b3a523c354877ac488da33314fc1f
https://github.com/jsdoc2md/dmd/blob/a4b31ec41f3b3a523c354877ac488da33314fc1f/helpers/selectors.js#L31-L34
train
jsdoc2md/dmd
helpers/selectors.js
class_
function class_ (options) { options.hash.kind = 'class' var result = ddata._identifier(options) return result ? options.fn(result) : 'ERROR, Cannot find class.' }
javascript
function class_ (options) { options.hash.kind = 'class' var result = ddata._identifier(options) return result ? options.fn(result) : 'ERROR, Cannot find class.' }
[ "function", "class_", "(", "options", ")", "{", "options", ".", "hash", ".", "kind", "=", "'class'", "var", "result", "=", "ddata", ".", "_identifier", "(", "options", ")", "return", "result", "?", "options", ".", "fn", "(", "result", ")", ":", "'ERROR...
render the supplied block for the specified class
[ "render", "the", "supplied", "block", "for", "the", "specified", "class" ]
a4b31ec41f3b3a523c354877ac488da33314fc1f
https://github.com/jsdoc2md/dmd/blob/a4b31ec41f3b3a523c354877ac488da33314fc1f/helpers/selectors.js#L83-L87
train
jsdoc2md/dmd
lib/dmd.js
dmd
function dmd (templateData, options) { options = new DmdOptions(options) if (skipCache(options)) { return generate(templateData, options) } else { const cached = dmd.cache.readSync([ templateData, options, dmdVersion ]) if (cached) { return cached } else { return generate(templateData,...
javascript
function dmd (templateData, options) { options = new DmdOptions(options) if (skipCache(options)) { return generate(templateData, options) } else { const cached = dmd.cache.readSync([ templateData, options, dmdVersion ]) if (cached) { return cached } else { return generate(templateData,...
[ "function", "dmd", "(", "templateData", ",", "options", ")", "{", "options", "=", "new", "DmdOptions", "(", "options", ")", "if", "(", "skipCache", "(", "options", ")", ")", "{", "return", "generate", "(", "templateData", ",", "options", ")", "}", "else"...
Transforms doclet data into markdown documentation. @param {object[]} @param [options] {module:dmd-options} - The render options @return {string} @alias module:dmd
[ "Transforms", "doclet", "data", "into", "markdown", "documentation", "." ]
a4b31ec41f3b3a523c354877ac488da33314fc1f
https://github.com/jsdoc2md/dmd/blob/a4b31ec41f3b3a523c354877ac488da33314fc1f/lib/dmd.js#L20-L32
train
jsdoc2md/dmd
helpers/ddata.js
_globals
function _globals (options) { options.hash.scope = 'global' return _identifiers(options).filter(function (identifier) { if (identifier.kind === 'external') { return identifier.description && identifier.description.length > 0 } else { return true } }) }
javascript
function _globals (options) { options.hash.scope = 'global' return _identifiers(options).filter(function (identifier) { if (identifier.kind === 'external') { return identifier.description && identifier.description.length > 0 } else { return true } }) }
[ "function", "_globals", "(", "options", ")", "{", "options", ".", "hash", ".", "scope", "=", "'global'", "return", "_identifiers", "(", "options", ")", ".", "filter", "(", "function", "(", "identifier", ")", "{", "if", "(", "identifier", ".", "kind", "==...
omits externals without a description @static
[ "omits", "externals", "without", "a", "description" ]
a4b31ec41f3b3a523c354877ac488da33314fc1f
https://github.com/jsdoc2md/dmd/blob/a4b31ec41f3b3a523c354877ac488da33314fc1f/helpers/ddata.js#L94-L103
train