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
mono-js/mono
lib/conf.js
customizer
function customizer(objValue, srcValue) { if (isUndefined(objValue) && !isUndefined(srcValue)) return srcValue if (isArray(objValue) && isArray(srcValue)) return srcValue if (isRegExp(objValue) || isRegExp(srcValue)) return srcValue if (isObject(objValue) || isObject(srcValue)) return mergeWith(objValue, srcValue, ...
javascript
function customizer(objValue, srcValue) { if (isUndefined(objValue) && !isUndefined(srcValue)) return srcValue if (isArray(objValue) && isArray(srcValue)) return srcValue if (isRegExp(objValue) || isRegExp(srcValue)) return srcValue if (isObject(objValue) || isObject(srcValue)) return mergeWith(objValue, srcValue, ...
[ "function", "customizer", "(", "objValue", ",", "srcValue", ")", "{", "if", "(", "isUndefined", "(", "objValue", ")", "&&", "!", "isUndefined", "(", "srcValue", ")", ")", "return", "srcValue", "if", "(", "isArray", "(", "objValue", ")", "&&", "isArray", ...
Customizer method to merge sources
[ "Customizer", "method", "to", "merge", "sources" ]
8b2211c316b8067345d9299e1d648dfc76ba95c1
https://github.com/mono-js/mono/blob/8b2211c316b8067345d9299e1d648dfc76ba95c1/lib/conf.js#L8-L13
train
kevinsqi/react-piano
src/MidiNumbers.js
buildMidiNumberAttributes
function buildMidiNumberAttributes(midiNumber) { const pitchIndex = (midiNumber - MIDI_NUMBER_C0) % NOTES_IN_OCTAVE; const octave = Math.floor((midiNumber - MIDI_NUMBER_C0) / NOTES_IN_OCTAVE); const pitchName = SORTED_PITCHES[pitchIndex]; return { note: `${pitchName}${octave}`, pitchName, octave, ...
javascript
function buildMidiNumberAttributes(midiNumber) { const pitchIndex = (midiNumber - MIDI_NUMBER_C0) % NOTES_IN_OCTAVE; const octave = Math.floor((midiNumber - MIDI_NUMBER_C0) / NOTES_IN_OCTAVE); const pitchName = SORTED_PITCHES[pitchIndex]; return { note: `${pitchName}${octave}`, pitchName, octave, ...
[ "function", "buildMidiNumberAttributes", "(", "midiNumber", ")", "{", "const", "pitchIndex", "=", "(", "midiNumber", "-", "MIDI_NUMBER_C0", ")", "%", "NOTES_IN_OCTAVE", ";", "const", "octave", "=", "Math", ".", "floor", "(", "(", "midiNumber", "-", "MIDI_NUMBER_...
Build cache for getAttributes
[ "Build", "cache", "for", "getAttributes" ]
d5ef9b59e3fed2ae6f9fda6244ac2ba4659ece10
https://github.com/kevinsqi/react-piano/blob/d5ef9b59e3fed2ae6f9fda6244ac2ba4659ece10/src/MidiNumbers.js#L57-L68
train
EightShapes/esds-build
tasks/copy.js
getCompiledChildModuleDocsPath
function getCompiledChildModuleDocsPath(moduleName) { let rootPath = c.rootPath; if (process.cwd() !== c.rootPath) { rootPath = path.join(process.cwd(), c.rootPath); } const childModuleRootPath = path.join(rootPath, c.dependenciesPath, moduleName), cmc = config.get(childModuleRootPat...
javascript
function getCompiledChildModuleDocsPath(moduleName) { let rootPath = c.rootPath; if (process.cwd() !== c.rootPath) { rootPath = path.join(process.cwd(), c.rootPath); } const childModuleRootPath = path.join(rootPath, c.dependenciesPath, moduleName), cmc = config.get(childModuleRootPat...
[ "function", "getCompiledChildModuleDocsPath", "(", "moduleName", ")", "{", "let", "rootPath", "=", "c", ".", "rootPath", ";", "if", "(", "process", ".", "cwd", "(", ")", "!==", "c", ".", "rootPath", ")", "{", "rootPath", "=", "path", ".", "join", "(", ...
CHILD MODULE AUTO-COPYING Copying doc pages from a child module
[ "CHILD", "MODULE", "AUTO", "-", "COPYING", "Copying", "doc", "pages", "from", "a", "child", "module" ]
3e8519e5a0ef5fb589726b64cf292f07fd18b0b5
https://github.com/EightShapes/esds-build/blob/3e8519e5a0ef5fb589726b64cf292f07fd18b0b5/tasks/copy.js#L66-L75
train
NodeRedis/node-redis-parser
lib/parser.js
parseSimpleNumbers
function parseSimpleNumbers (parser) { const length = parser.buffer.length - 1 var offset = parser.offset var number = 0 var sign = 1 if (parser.buffer[offset] === 45) { sign = -1 offset++ } while (offset < length) { const c1 = parser.buffer[offset++] if (c1 === 13) { // \r\n parse...
javascript
function parseSimpleNumbers (parser) { const length = parser.buffer.length - 1 var offset = parser.offset var number = 0 var sign = 1 if (parser.buffer[offset] === 45) { sign = -1 offset++ } while (offset < length) { const c1 = parser.buffer[offset++] if (c1 === 13) { // \r\n parse...
[ "function", "parseSimpleNumbers", "(", "parser", ")", "{", "const", "length", "=", "parser", ".", "buffer", ".", "length", "-", "1", "var", "offset", "=", "parser", ".", "offset", "var", "number", "=", "0", "var", "sign", "=", "1", "if", "(", "parser",...
Used for integer numbers only @param {JavascriptRedisParser} parser @returns {undefined|number}
[ "Used", "for", "integer", "numbers", "only" ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L20-L39
train
NodeRedis/node-redis-parser
lib/parser.js
parseStringNumbers
function parseStringNumbers (parser) { const length = parser.buffer.length - 1 var offset = parser.offset var number = 0 var res = '' if (parser.buffer[offset] === 45) { res += '-' offset++ } while (offset < length) { var c1 = parser.buffer[offset++] if (c1 === 13) { // \r\n parser...
javascript
function parseStringNumbers (parser) { const length = parser.buffer.length - 1 var offset = parser.offset var number = 0 var res = '' if (parser.buffer[offset] === 45) { res += '-' offset++ } while (offset < length) { var c1 = parser.buffer[offset++] if (c1 === 13) { // \r\n parser...
[ "function", "parseStringNumbers", "(", "parser", ")", "{", "const", "length", "=", "parser", ".", "buffer", ".", "length", "-", "1", "var", "offset", "=", "parser", ".", "offset", "var", "number", "=", "0", "var", "res", "=", "''", "if", "(", "parser",...
Used for integer numbers in case of the returnNumbers option Reading the string as parts of n SMI is more efficient than using a string directly. @param {JavascriptRedisParser} parser @returns {undefined|string}
[ "Used", "for", "integer", "numbers", "in", "case", "of", "the", "returnNumbers", "option" ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L50-L78
train
NodeRedis/node-redis-parser
lib/parser.js
parseSimpleString
function parseSimpleString (parser) { const start = parser.offset const buffer = parser.buffer const length = buffer.length - 1 var offset = start while (offset < length) { if (buffer[offset++] === 13) { // \r\n parser.offset = offset + 1 if (parser.optionReturnBuffers === true) { ret...
javascript
function parseSimpleString (parser) { const start = parser.offset const buffer = parser.buffer const length = buffer.length - 1 var offset = start while (offset < length) { if (buffer[offset++] === 13) { // \r\n parser.offset = offset + 1 if (parser.optionReturnBuffers === true) { ret...
[ "function", "parseSimpleString", "(", "parser", ")", "{", "const", "start", "=", "parser", ".", "offset", "const", "buffer", "=", "parser", ".", "buffer", "const", "length", "=", "buffer", ".", "length", "-", "1", "var", "offset", "=", "start", "while", ...
Parse a '+' redis simple string response but forward the offsets onto convertBufferRange to generate a string. @param {JavascriptRedisParser} parser @returns {undefined|string|Buffer}
[ "Parse", "a", "+", "redis", "simple", "string", "response", "but", "forward", "the", "offsets", "onto", "convertBufferRange", "to", "generate", "a", "string", "." ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L86-L101
train
NodeRedis/node-redis-parser
lib/parser.js
parseLength
function parseLength (parser) { const length = parser.buffer.length - 1 var offset = parser.offset var number = 0 while (offset < length) { const c1 = parser.buffer[offset++] if (c1 === 13) { parser.offset = offset + 1 return number } number = (number * 10) + (c1 - 48) } }
javascript
function parseLength (parser) { const length = parser.buffer.length - 1 var offset = parser.offset var number = 0 while (offset < length) { const c1 = parser.buffer[offset++] if (c1 === 13) { parser.offset = offset + 1 return number } number = (number * 10) + (c1 - 48) } }
[ "function", "parseLength", "(", "parser", ")", "{", "const", "length", "=", "parser", ".", "buffer", ".", "length", "-", "1", "var", "offset", "=", "parser", ".", "offset", "var", "number", "=", "0", "while", "(", "offset", "<", "length", ")", "{", "...
Returns the read length @param {JavascriptRedisParser} parser @returns {undefined|number}
[ "Returns", "the", "read", "length" ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L108-L121
train
NodeRedis/node-redis-parser
lib/parser.js
parseError
function parseError (parser) { var string = parseSimpleString(parser) if (string !== undefined) { if (parser.optionReturnBuffers === true) { string = string.toString() } return new ReplyError(string) } }
javascript
function parseError (parser) { var string = parseSimpleString(parser) if (string !== undefined) { if (parser.optionReturnBuffers === true) { string = string.toString() } return new ReplyError(string) } }
[ "function", "parseError", "(", "parser", ")", "{", "var", "string", "=", "parseSimpleString", "(", "parser", ")", "if", "(", "string", "!==", "undefined", ")", "{", "if", "(", "parser", ".", "optionReturnBuffers", "===", "true", ")", "{", "string", "=", ...
Parse a '-' redis error response @param {JavascriptRedisParser} parser @returns {ReplyError}
[ "Parse", "a", "-", "redis", "error", "response" ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L173-L181
train
NodeRedis/node-redis-parser
lib/parser.js
handleError
function handleError (parser, type) { const err = new ParserError( 'Protocol error, got ' + JSON.stringify(String.fromCharCode(type)) + ' as reply type byte', JSON.stringify(parser.buffer), parser.offset ) parser.buffer = null parser.returnFatalError(err) }
javascript
function handleError (parser, type) { const err = new ParserError( 'Protocol error, got ' + JSON.stringify(String.fromCharCode(type)) + ' as reply type byte', JSON.stringify(parser.buffer), parser.offset ) parser.buffer = null parser.returnFatalError(err) }
[ "function", "handleError", "(", "parser", ",", "type", ")", "{", "const", "err", "=", "new", "ParserError", "(", "'Protocol error, got '", "+", "JSON", ".", "stringify", "(", "String", ".", "fromCharCode", "(", "type", ")", ")", "+", "' as reply type byte'", ...
Parsing error handler, resets parser buffer @param {JavascriptRedisParser} parser @param {number} type @returns {undefined}
[ "Parsing", "error", "handler", "resets", "parser", "buffer" ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L189-L197
train
NodeRedis/node-redis-parser
lib/parser.js
pushArrayCache
function pushArrayCache (parser, array, pos) { parser.arrayCache.push(array) parser.arrayPos.push(pos) }
javascript
function pushArrayCache (parser, array, pos) { parser.arrayCache.push(array) parser.arrayPos.push(pos) }
[ "function", "pushArrayCache", "(", "parser", ",", "array", ",", "pos", ")", "{", "parser", ".", "arrayCache", ".", "push", "(", "array", ")", "parser", ".", "arrayPos", ".", "push", "(", "pos", ")", "}" ]
Push a partly parsed array to the stack @param {JavascriptRedisParser} parser @param {any[]} array @param {number} pos @returns {undefined}
[ "Push", "a", "partly", "parsed", "array", "to", "the", "stack" ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L224-L227
train
NodeRedis/node-redis-parser
lib/parser.js
parseArrayChunks
function parseArrayChunks (parser) { var arr = parser.arrayCache.pop() var pos = parser.arrayPos.pop() if (parser.arrayCache.length) { const res = parseArrayChunks(parser) if (res === undefined) { pushArrayCache(parser, arr, pos) return } arr[pos++] = res } return parseArrayElement...
javascript
function parseArrayChunks (parser) { var arr = parser.arrayCache.pop() var pos = parser.arrayPos.pop() if (parser.arrayCache.length) { const res = parseArrayChunks(parser) if (res === undefined) { pushArrayCache(parser, arr, pos) return } arr[pos++] = res } return parseArrayElement...
[ "function", "parseArrayChunks", "(", "parser", ")", "{", "var", "arr", "=", "parser", ".", "arrayCache", ".", "pop", "(", ")", "var", "pos", "=", "parser", ".", "arrayPos", ".", "pop", "(", ")", "if", "(", "parser", ".", "arrayCache", ".", "length", ...
Parse chunked redis array response @param {JavascriptRedisParser} parser @returns {undefined|any[]}
[ "Parse", "chunked", "redis", "array", "response" ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L234-L246
train
NodeRedis/node-redis-parser
lib/parser.js
parseArrayElements
function parseArrayElements (parser, responses, i) { const bufferLength = parser.buffer.length while (i < responses.length) { const offset = parser.offset if (parser.offset >= bufferLength) { pushArrayCache(parser, responses, i) return } const response = parseType(parser, parser.buffer[p...
javascript
function parseArrayElements (parser, responses, i) { const bufferLength = parser.buffer.length while (i < responses.length) { const offset = parser.offset if (parser.offset >= bufferLength) { pushArrayCache(parser, responses, i) return } const response = parseType(parser, parser.buffer[p...
[ "function", "parseArrayElements", "(", "parser", ",", "responses", ",", "i", ")", "{", "const", "bufferLength", "=", "parser", ".", "buffer", ".", "length", "while", "(", "i", "<", "responses", ".", "length", ")", "{", "const", "offset", "=", "parser", "...
Parse redis array response elements @param {JavascriptRedisParser} parser @param {Array} responses @param {number} i @returns {undefined|null|any[]}
[ "Parse", "redis", "array", "response", "elements" ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L255-L276
train
NodeRedis/node-redis-parser
lib/parser.js
decreaseBufferPool
function decreaseBufferPool () { if (bufferPool.length > 50 * 1024) { if (counter === 1 || notDecreased > counter * 2) { const minSliceLen = Math.floor(bufferPool.length / 10) const sliceLength = minSliceLen < bufferOffset ? bufferOffset : minSliceLen bufferOffset = 0 buffe...
javascript
function decreaseBufferPool () { if (bufferPool.length > 50 * 1024) { if (counter === 1 || notDecreased > counter * 2) { const minSliceLen = Math.floor(bufferPool.length / 10) const sliceLength = minSliceLen < bufferOffset ? bufferOffset : minSliceLen bufferOffset = 0 buffe...
[ "function", "decreaseBufferPool", "(", ")", "{", "if", "(", "bufferPool", ".", "length", ">", "50", "*", "1024", ")", "{", "if", "(", "counter", "===", "1", "||", "notDecreased", ">", "counter", "*", "2", ")", "{", "const", "minSliceLen", "=", "Math", ...
Decrease the bufferPool size over time Balance between increasing and decreasing the bufferPool. Decrease the bufferPool by 10% by removing the first 10% of the current pool. @returns {undefined}
[ "Decrease", "the", "bufferPool", "size", "over", "time" ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L315-L334
train
NodeRedis/node-redis-parser
lib/parser.js
resizeBuffer
function resizeBuffer (length) { if (bufferPool.length < length + bufferOffset) { const multiplier = length > 1024 * 1024 * 75 ? 2 : 3 if (bufferOffset > 1024 * 1024 * 111) { bufferOffset = 1024 * 1024 * 50 } bufferPool = Buffer.allocUnsafe(length * multiplier + bufferOffset) bufferOffset = ...
javascript
function resizeBuffer (length) { if (bufferPool.length < length + bufferOffset) { const multiplier = length > 1024 * 1024 * 75 ? 2 : 3 if (bufferOffset > 1024 * 1024 * 111) { bufferOffset = 1024 * 1024 * 50 } bufferPool = Buffer.allocUnsafe(length * multiplier + bufferOffset) bufferOffset = ...
[ "function", "resizeBuffer", "(", "length", ")", "{", "if", "(", "bufferPool", ".", "length", "<", "length", "+", "bufferOffset", ")", "{", "const", "multiplier", "=", "length", ">", "1024", "*", "1024", "*", "75", "?", "2", ":", "3", "if", "(", "buff...
Check if the requested size fits in the current bufferPool. If it does not, reset and increase the bufferPool accordingly. @param {number} length @returns {undefined}
[ "Check", "if", "the", "requested", "size", "fits", "in", "the", "current", "bufferPool", ".", "If", "it", "does", "not", "reset", "and", "increase", "the", "bufferPool", "accordingly", "." ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L343-L356
train
NodeRedis/node-redis-parser
lib/parser.js
concatBulkString
function concatBulkString (parser) { const list = parser.bufferCache const oldOffset = parser.offset var chunks = list.length var offset = parser.bigStrSize - parser.totalChunkSize parser.offset = offset if (offset <= 2) { if (chunks === 2) { return list[0].toString('utf8', oldOffset, list[0].leng...
javascript
function concatBulkString (parser) { const list = parser.bufferCache const oldOffset = parser.offset var chunks = list.length var offset = parser.bigStrSize - parser.totalChunkSize parser.offset = offset if (offset <= 2) { if (chunks === 2) { return list[0].toString('utf8', oldOffset, list[0].leng...
[ "function", "concatBulkString", "(", "parser", ")", "{", "const", "list", "=", "parser", ".", "bufferCache", "const", "oldOffset", "=", "parser", ".", "offset", "var", "chunks", "=", "list", ".", "length", "var", "offset", "=", "parser", ".", "bigStrSize", ...
Concat a bulk string containing multiple chunks Notes: 1) The first chunk might contain the whole bulk string including the \r 2) We are only safe to fully add up elements that are neither the first nor any of the last two elements @param {JavascriptRedisParser} parser @returns {String}
[ "Concat", "a", "bulk", "string", "containing", "multiple", "chunks" ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L368-L387
train
NodeRedis/node-redis-parser
lib/parser.js
concatBulkBuffer
function concatBulkBuffer (parser) { const list = parser.bufferCache const oldOffset = parser.offset const length = parser.bigStrSize - oldOffset - 2 var chunks = list.length var offset = parser.bigStrSize - parser.totalChunkSize parser.offset = offset if (offset <= 2) { if (chunks === 2) { retu...
javascript
function concatBulkBuffer (parser) { const list = parser.bufferCache const oldOffset = parser.offset const length = parser.bigStrSize - oldOffset - 2 var chunks = list.length var offset = parser.bigStrSize - parser.totalChunkSize parser.offset = offset if (offset <= 2) { if (chunks === 2) { retu...
[ "function", "concatBulkBuffer", "(", "parser", ")", "{", "const", "list", "=", "parser", ".", "bufferCache", "const", "oldOffset", "=", "parser", ".", "offset", "const", "length", "=", "parser", ".", "bigStrSize", "-", "oldOffset", "-", "2", "var", "chunks",...
Concat the collected chunks from parser.bufferCache. Increases the bufferPool size beforehand if necessary. @param {JavascriptRedisParser} parser @returns {Buffer}
[ "Concat", "the", "collected", "chunks", "from", "parser", ".", "bufferCache", "." ]
44ef4189b5da92ac301729cd5fc41079017544fd
https://github.com/NodeRedis/node-redis-parser/blob/44ef4189b5da92ac301729cd5fc41079017544fd/lib/parser.js#L397-L422
train
endlessm/electron-installer-flatpak
src/installer.js
function (options, callback) { var licenseSrc = path.join(options.src, 'LICENSE') try { fs.accessSync(licenseSrc) } catch (err) { try { licenseSrc = path.join(options.src, 'LICENSE.txt') fs.accessSync(licenseSrc) } catch (err) { licenseSrc = path.join(options.src, 'LICENSE.md') ...
javascript
function (options, callback) { var licenseSrc = path.join(options.src, 'LICENSE') try { fs.accessSync(licenseSrc) } catch (err) { try { licenseSrc = path.join(options.src, 'LICENSE.txt') fs.accessSync(licenseSrc) } catch (err) { licenseSrc = path.join(options.src, 'LICENSE.md') ...
[ "function", "(", "options", ",", "callback", ")", "{", "var", "licenseSrc", "=", "path", ".", "join", "(", "options", ".", "src", ",", "'LICENSE'", ")", "try", "{", "fs", ".", "accessSync", "(", "licenseSrc", ")", "}", "catch", "(", "err", ")", "{", ...
Read `LICENSE` from the root of the app.
[ "Read", "LICENSE", "from", "the", "root", "of", "the", "app", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L75-L91
train
endlessm/electron-installer-flatpak
src/installer.js
function (data, callback) { async.parallel([ async.apply(readMeta, data) ], function (err, results) { var pkg = results[0] || {} var defaults = { id: getAppId(pkg.name, pkg.homepage), productName: pkg.productName || pkg.name, genericName: pkg.genericName || pkg.productName || pkg.name...
javascript
function (data, callback) { async.parallel([ async.apply(readMeta, data) ], function (err, results) { var pkg = results[0] || {} var defaults = { id: getAppId(pkg.name, pkg.homepage), productName: pkg.productName || pkg.name, genericName: pkg.genericName || pkg.productName || pkg.name...
[ "function", "(", "data", ",", "callback", ")", "{", "async", ".", "parallel", "(", "[", "async", ".", "apply", "(", "readMeta", ",", "data", ")", "]", ",", "function", "(", "err", ",", "results", ")", "{", "var", "pkg", "=", "results", "[", "0", ...
Get the hash of default options for the installer. Some come from the info read from `package.json`, and some are hardcoded.
[ "Get", "the", "hash", "of", "default", "options", "for", "the", "installer", ".", "Some", "come", "from", "the", "info", "read", "from", "package", ".", "json", "and", "some", "are", "hardcoded", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L97-L154
train
endlessm/electron-installer-flatpak
src/installer.js
function (data, defaults, callback) { // Flatten everything for ease of use. var options = _.defaults({}, data, data.options, defaults) callback(null, options) }
javascript
function (data, defaults, callback) { // Flatten everything for ease of use. var options = _.defaults({}, data, data.options, defaults) callback(null, options) }
[ "function", "(", "data", ",", "defaults", ",", "callback", ")", "{", "// Flatten everything for ease of use.", "var", "options", "=", "_", ".", "defaults", "(", "{", "}", ",", "data", ",", "data", ".", "options", ",", "defaults", ")", "callback", "(", "nul...
Get the hash of options for the installer.
[ "Get", "the", "hash", "of", "options", "for", "the", "installer", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L159-L164
train
endlessm/electron-installer-flatpak
src/installer.js
function (options, file, callback) { options.logger('Generating template from ' + file) async.waterfall([ async.apply(fs.readFile, file), function (template, callback) { var result = _.template(template)(options) options.logger('Generated template from ' + file + '\n' + result) callback(n...
javascript
function (options, file, callback) { options.logger('Generating template from ' + file) async.waterfall([ async.apply(fs.readFile, file), function (template, callback) { var result = _.template(template)(options) options.logger('Generated template from ' + file + '\n' + result) callback(n...
[ "function", "(", "options", ",", "file", ",", "callback", ")", "{", "options", ".", "logger", "(", "'Generating template from '", "+", "file", ")", "async", ".", "waterfall", "(", "[", "async", ".", "apply", "(", "fs", ".", "readFile", ",", "file", ")", ...
Fill in a template with the hash of options.
[ "Fill", "in", "a", "template", "with", "the", "hash", "of", "options", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L169-L180
train
endlessm/electron-installer-flatpak
src/installer.js
function (options, dir, callback) { var desktopSrc = path.resolve(__dirname, '../resources/desktop.ejs') var desktopDest = path.join(dir, 'share/applications', options.id + '.desktop') options.logger('Creating desktop file at ' + desktopDest) async.waterfall([ async.apply(generateTemplate, options, desktop...
javascript
function (options, dir, callback) { var desktopSrc = path.resolve(__dirname, '../resources/desktop.ejs') var desktopDest = path.join(dir, 'share/applications', options.id + '.desktop') options.logger('Creating desktop file at ' + desktopDest) async.waterfall([ async.apply(generateTemplate, options, desktop...
[ "function", "(", "options", ",", "dir", ",", "callback", ")", "{", "var", "desktopSrc", "=", "path", ".", "resolve", "(", "__dirname", ",", "'../resources/desktop.ejs'", ")", "var", "desktopDest", "=", "path", ".", "join", "(", "dir", ",", "'share/applicatio...
Create the desktop file for the package. See: http://standards.freedesktop.org/desktop-entry-spec/latest/
[ "Create", "the", "desktop", "file", "for", "the", "package", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L187-L198
train
endlessm/electron-installer-flatpak
src/installer.js
function (options, dir, callback) { var iconFile = path.join(dir, getPixmapPath(options)) options.logger('Creating icon file at ' + iconFile) fs.copy(options.icon, iconFile, function (err) { callback(err && new Error('Error creating icon file: ' + (err.message || err))) }) }
javascript
function (options, dir, callback) { var iconFile = path.join(dir, getPixmapPath(options)) options.logger('Creating icon file at ' + iconFile) fs.copy(options.icon, iconFile, function (err) { callback(err && new Error('Error creating icon file: ' + (err.message || err))) }) }
[ "function", "(", "options", ",", "dir", ",", "callback", ")", "{", "var", "iconFile", "=", "path", ".", "join", "(", "dir", ",", "getPixmapPath", "(", "options", ")", ")", "options", ".", "logger", "(", "'Creating icon file at '", "+", "iconFile", ")", "...
Create pixmap icon for the package.
[ "Create", "pixmap", "icon", "for", "the", "package", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L203-L210
train
endlessm/electron-installer-flatpak
src/installer.js
function (options, dir, callback) { async.forEachOf(options.icon, function (icon, resolution, callback) { var iconFile = path.join(dir, 'share/icons/hicolor', resolution, 'apps', options.id + '.png') options.logger('Creating icon file at ' + iconFile) fs.copy(icon, iconFile, callback) }, function (err)...
javascript
function (options, dir, callback) { async.forEachOf(options.icon, function (icon, resolution, callback) { var iconFile = path.join(dir, 'share/icons/hicolor', resolution, 'apps', options.id + '.png') options.logger('Creating icon file at ' + iconFile) fs.copy(icon, iconFile, callback) }, function (err)...
[ "function", "(", "options", ",", "dir", ",", "callback", ")", "{", "async", ".", "forEachOf", "(", "options", ".", "icon", ",", "function", "(", "icon", ",", "resolution", ",", "callback", ")", "{", "var", "iconFile", "=", "path", ".", "join", "(", "...
Create hicolor icon for the package.
[ "Create", "hicolor", "icon", "for", "the", "package", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L215-L224
train
endlessm/electron-installer-flatpak
src/installer.js
function (options, dir, callback) { if (_.isObject(options.icon)) { createHicolorIcon(options, dir, callback) } else if (options.icon) { createPixmapIcon(options, dir, callback) } else { callback() } }
javascript
function (options, dir, callback) { if (_.isObject(options.icon)) { createHicolorIcon(options, dir, callback) } else if (options.icon) { createPixmapIcon(options, dir, callback) } else { callback() } }
[ "function", "(", "options", ",", "dir", ",", "callback", ")", "{", "if", "(", "_", ".", "isObject", "(", "options", ".", "icon", ")", ")", "{", "createHicolorIcon", "(", "options", ",", "dir", ",", "callback", ")", "}", "else", "if", "(", "options", ...
Create icon for the package.
[ "Create", "icon", "for", "the", "package", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L229-L237
train
endlessm/electron-installer-flatpak
src/installer.js
function (options, dir, callback) { var copyrightFile = path.join(dir, 'share/doc', options.id, 'copyright') options.logger('Creating copyright file at ' + copyrightFile) async.waterfall([ async.apply(readLicense, options), async.apply(fs.outputFile, copyrightFile) ], function (err) { callback(err ...
javascript
function (options, dir, callback) { var copyrightFile = path.join(dir, 'share/doc', options.id, 'copyright') options.logger('Creating copyright file at ' + copyrightFile) async.waterfall([ async.apply(readLicense, options), async.apply(fs.outputFile, copyrightFile) ], function (err) { callback(err ...
[ "function", "(", "options", ",", "dir", ",", "callback", ")", "{", "var", "copyrightFile", "=", "path", ".", "join", "(", "dir", ",", "'share/doc'", ",", "options", ".", "id", ",", "'copyright'", ")", "options", ".", "logger", "(", "'Creating copyright fil...
Create copyright for the package.
[ "Create", "copyright", "for", "the", "package", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L242-L252
train
endlessm/electron-installer-flatpak
src/installer.js
function (options, dir, callback) { var applicationDir = path.join(dir, 'lib', options.id) options.logger('Copying application to ' + applicationDir) async.waterfall([ async.apply(fs.ensureDir, applicationDir), async.apply(fs.copy, options.src, applicationDir) ], function (err) { callback(err && ne...
javascript
function (options, dir, callback) { var applicationDir = path.join(dir, 'lib', options.id) options.logger('Copying application to ' + applicationDir) async.waterfall([ async.apply(fs.ensureDir, applicationDir), async.apply(fs.copy, options.src, applicationDir) ], function (err) { callback(err && ne...
[ "function", "(", "options", ",", "dir", ",", "callback", ")", "{", "var", "applicationDir", "=", "path", ".", "join", "(", "dir", ",", "'lib'", ",", "options", ".", "id", ")", "options", ".", "logger", "(", "'Copying application to '", "+", "applicationDir...
Copy the application into the package.
[ "Copy", "the", "application", "into", "the", "package", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L257-L267
train
endlessm/electron-installer-flatpak
src/installer.js
function (options, callback) { options.logger('Creating temporary directory') async.waterfall([ async.apply(temp.mkdir, 'electron-'), function (dir, callback) { dir = path.join(dir, options.id + '_' + options.version + '_' + options.arch) fs.ensureDir(dir, callback) } ], function (err, di...
javascript
function (options, callback) { options.logger('Creating temporary directory') async.waterfall([ async.apply(temp.mkdir, 'electron-'), function (dir, callback) { dir = path.join(dir, options.id + '_' + options.version + '_' + options.arch) fs.ensureDir(dir, callback) } ], function (err, di...
[ "function", "(", "options", ",", "callback", ")", "{", "options", ".", "logger", "(", "'Creating temporary directory'", ")", "async", ".", "waterfall", "(", "[", "async", ".", "apply", "(", "temp", ".", "mkdir", ",", "'electron-'", ")", ",", "function", "(...
Create temporary directory where the contents of the package will live.
[ "Create", "temporary", "directory", "where", "the", "contents", "of", "the", "package", "will", "live", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L272-L284
train
endlessm/electron-installer-flatpak
src/installer.js
function (options, dir, callback) { options.logger('Creating contents of package') async.parallel([ async.apply(createDesktop, options, dir), async.apply(createIcon, options, dir), async.apply(createCopyright, options, dir), async.apply(createApplication, options, dir) ], function (err) { cal...
javascript
function (options, dir, callback) { options.logger('Creating contents of package') async.parallel([ async.apply(createDesktop, options, dir), async.apply(createIcon, options, dir), async.apply(createCopyright, options, dir), async.apply(createApplication, options, dir) ], function (err) { cal...
[ "function", "(", "options", ",", "dir", ",", "callback", ")", "{", "options", ".", "logger", "(", "'Creating contents of package'", ")", "async", ".", "parallel", "(", "[", "async", ".", "apply", "(", "createDesktop", ",", "options", ",", "dir", ")", ",", ...
Create the contents of the package.
[ "Create", "the", "contents", "of", "the", "package", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L289-L300
train
endlessm/electron-installer-flatpak
src/installer.js
function (options, dir, callback) { var name = _.template('<%= id %>_<%= branch %>_<%= arch %>.flatpak')(options) var dest = options.rename(options.dest, name) options.logger('Creating package at ' + dest) var extraExports = [] if (options.icon && !_.isObject(options.icon)) extraExports.push(getPixmapPath(opt...
javascript
function (options, dir, callback) { var name = _.template('<%= id %>_<%= branch %>_<%= arch %>.flatpak')(options) var dest = options.rename(options.dest, name) options.logger('Creating package at ' + dest) var extraExports = [] if (options.icon && !_.isObject(options.icon)) extraExports.push(getPixmapPath(opt...
[ "function", "(", "options", ",", "dir", ",", "callback", ")", "{", "var", "name", "=", "_", ".", "template", "(", "'<%= id %>_<%= branch %>_<%= arch %>.flatpak'", ")", "(", "options", ")", "var", "dest", "=", "options", ".", "rename", "(", "options", ".", ...
Bundle everything using `flatpak-bundler`.
[ "Bundle", "everything", "using", "flatpak", "-", "bundler", "." ]
589fb44dbd8f503e636ce5d6e351c4856dcc4be9
https://github.com/endlessm/electron-installer-flatpak/blob/589fb44dbd8f503e636ce5d6e351c4856dcc4be9/src/installer.js#L305-L342
train
brigand/babel-plugin-flow-react-proptypes
src/makePropTypesAst.js
makeShapeAstForShapeIntersectRuntime
function makeShapeAstForShapeIntersectRuntime(propTypeData) { const runtimeMerge = makeObjectMergeAstForShapeIntersectRuntime(propTypeData); return t.callExpression( t.memberExpression( makePropTypeImportNode(), t.identifier('shape'), ), [runtimeMerge], ); }
javascript
function makeShapeAstForShapeIntersectRuntime(propTypeData) { const runtimeMerge = makeObjectMergeAstForShapeIntersectRuntime(propTypeData); return t.callExpression( t.memberExpression( makePropTypeImportNode(), t.identifier('shape'), ), [runtimeMerge], ); }
[ "function", "makeShapeAstForShapeIntersectRuntime", "(", "propTypeData", ")", "{", "const", "runtimeMerge", "=", "makeObjectMergeAstForShapeIntersectRuntime", "(", "propTypeData", ")", ";", "return", "t", ".", "callExpression", "(", "t", ".", "memberExpression", "(", "m...
Like makeShapeAstForShapeIntersectRuntime, but wraps the props in a shape. This is useful for nested uses.
[ "Like", "makeShapeAstForShapeIntersectRuntime", "but", "wraps", "the", "props", "in", "a", "shape", "." ]
d39eef29755af43e769ebf19dccbd13c6f316ffb
https://github.com/brigand/babel-plugin-flow-react-proptypes/blob/d39eef29755af43e769ebf19dccbd13c6f316ffb/src/makePropTypesAst.js#L182-L191
train
productboard/webpack-deploy
tasks/rollbar-source-map.js
findByHash
function findByHash(config, hash) { const re = new RegExp(injectHashIntoPath(config.sourceMapPath, hash)); return glob .sync('./**') .filter(file => re.test(file)) .map(sourceMapPath => { // strip relative path characters const sourceMapPathMatch = sourceMapPath.match(re); if (source...
javascript
function findByHash(config, hash) { const re = new RegExp(injectHashIntoPath(config.sourceMapPath, hash)); return glob .sync('./**') .filter(file => re.test(file)) .map(sourceMapPath => { // strip relative path characters const sourceMapPathMatch = sourceMapPath.match(re); if (source...
[ "function", "findByHash", "(", "config", ",", "hash", ")", "{", "const", "re", "=", "new", "RegExp", "(", "injectHashIntoPath", "(", "config", ".", "sourceMapPath", ",", "hash", ")", ")", ";", "return", "glob", ".", "sync", "(", "'./**'", ")", ".", "fi...
Finds corresponding hashed source map file name
[ "Finds", "corresponding", "hashed", "source", "map", "file", "name" ]
5d14526118ffb68a1310e3b366364355f12e2f7a
https://github.com/productboard/webpack-deploy/blob/5d14526118ffb68a1310e3b366364355f12e2f7a/tasks/rollbar-source-map.js#L59-L82
train
pillarjs/parseurl
index.js
parseurl
function parseurl (req) { var url = req.url if (url === undefined) { // URL is undefined return undefined } var parsed = req._parsedUrl if (fresh(url, parsed)) { // Return cached URL parse return parsed } // Parse the URL parsed = fastparse(url) parsed._raw = url return (req._pa...
javascript
function parseurl (req) { var url = req.url if (url === undefined) { // URL is undefined return undefined } var parsed = req._parsedUrl if (fresh(url, parsed)) { // Return cached URL parse return parsed } // Parse the URL parsed = fastparse(url) parsed._raw = url return (req._pa...
[ "function", "parseurl", "(", "req", ")", "{", "var", "url", "=", "req", ".", "url", "if", "(", "url", "===", "undefined", ")", "{", "// URL is undefined", "return", "undefined", "}", "var", "parsed", "=", "req", ".", "_parsedUrl", "if", "(", "fresh", "...
Parse the `req` url with memoization. @param {ServerRequest} req @return {Object} @public
[ "Parse", "the", "req", "url", "with", "memoization", "." ]
0a5323370b02f4eff4069472d1e96a0094aef621
https://github.com/pillarjs/parseurl/blob/0a5323370b02f4eff4069472d1e96a0094aef621/index.js#L35-L55
train
pillarjs/parseurl
index.js
originalurl
function originalurl (req) { var url = req.originalUrl if (typeof url !== 'string') { // Fallback return parseurl(req) } var parsed = req._parsedOriginalUrl if (fresh(url, parsed)) { // Return cached URL parse return parsed } // Parse the URL parsed = fastparse(url) parsed._raw = u...
javascript
function originalurl (req) { var url = req.originalUrl if (typeof url !== 'string') { // Fallback return parseurl(req) } var parsed = req._parsedOriginalUrl if (fresh(url, parsed)) { // Return cached URL parse return parsed } // Parse the URL parsed = fastparse(url) parsed._raw = u...
[ "function", "originalurl", "(", "req", ")", "{", "var", "url", "=", "req", ".", "originalUrl", "if", "(", "typeof", "url", "!==", "'string'", ")", "{", "// Fallback", "return", "parseurl", "(", "req", ")", "}", "var", "parsed", "=", "req", ".", "_parse...
Parse the `req` original url with fallback and memoization. @param {ServerRequest} req @return {Object} @public
[ "Parse", "the", "req", "original", "url", "with", "fallback", "and", "memoization", "." ]
0a5323370b02f4eff4069472d1e96a0094aef621
https://github.com/pillarjs/parseurl/blob/0a5323370b02f4eff4069472d1e96a0094aef621/index.js#L65-L85
train
pillarjs/parseurl
index.js
fastparse
function fastparse (str) { if (typeof str !== 'string' || str.charCodeAt(0) !== 0x2f /* / */) { return parse(str) } var pathname = str var query = null var search = null // This takes the regexp from https://github.com/joyent/node/pull/7878 // Which is /^(\/[^?#\s]*)(\?[^#\s]*)?$/ // And unrolls i...
javascript
function fastparse (str) { if (typeof str !== 'string' || str.charCodeAt(0) !== 0x2f /* / */) { return parse(str) } var pathname = str var query = null var search = null // This takes the regexp from https://github.com/joyent/node/pull/7878 // Which is /^(\/[^?#\s]*)(\?[^#\s]*)?$/ // And unrolls i...
[ "function", "fastparse", "(", "str", ")", "{", "if", "(", "typeof", "str", "!==", "'string'", "||", "str", ".", "charCodeAt", "(", "0", ")", "!==", "0x2f", "/* / */", ")", "{", "return", "parse", "(", "str", ")", "}", "var", "pathname", "=", "str", ...
Parse the `str` url with fast-path short-cut. @param {string} str @return {Object} @private
[ "Parse", "the", "str", "url", "with", "fast", "-", "path", "short", "-", "cut", "." ]
0a5323370b02f4eff4069472d1e96a0094aef621
https://github.com/pillarjs/parseurl/blob/0a5323370b02f4eff4069472d1e96a0094aef621/index.js#L95-L142
train
pillarjs/parseurl
index.js
fresh
function fresh (url, parsedUrl) { return typeof parsedUrl === 'object' && parsedUrl !== null && (Url === undefined || parsedUrl instanceof Url) && parsedUrl._raw === url }
javascript
function fresh (url, parsedUrl) { return typeof parsedUrl === 'object' && parsedUrl !== null && (Url === undefined || parsedUrl instanceof Url) && parsedUrl._raw === url }
[ "function", "fresh", "(", "url", ",", "parsedUrl", ")", "{", "return", "typeof", "parsedUrl", "===", "'object'", "&&", "parsedUrl", "!==", "null", "&&", "(", "Url", "===", "undefined", "||", "parsedUrl", "instanceof", "Url", ")", "&&", "parsedUrl", ".", "_...
Determine if parsed is still fresh for url. @param {string} url @param {object} parsedUrl @return {boolean} @private
[ "Determine", "if", "parsed", "is", "still", "fresh", "for", "url", "." ]
0a5323370b02f4eff4069472d1e96a0094aef621
https://github.com/pillarjs/parseurl/blob/0a5323370b02f4eff4069472d1e96a0094aef621/index.js#L153-L158
train
uPortal-contrib/uPortal-web-components
@uportal/esco-content-menu/src/services/portlet-registry-to-array.js
customUnique
function customUnique(array) { const unique = uniqBy(array, 'fname'); // we construct unique portlets array will all linked categories (reversing category and portlets child) unique.forEach((elem) => { const dupl = array.filter((e) => e.fname === elem.fname); const allCategories = dupl.flatMap(({categorie...
javascript
function customUnique(array) { const unique = uniqBy(array, 'fname'); // we construct unique portlets array will all linked categories (reversing category and portlets child) unique.forEach((elem) => { const dupl = array.filter((e) => e.fname === elem.fname); const allCategories = dupl.flatMap(({categorie...
[ "function", "customUnique", "(", "array", ")", "{", "const", "unique", "=", "uniqBy", "(", "array", ",", "'fname'", ")", ";", "// we construct unique portlets array will all linked categories (reversing category and portlets child)", "unique", ".", "forEach", "(", "(", "e...
Custom function to remove duplicates portlet on fname, but with merging categories. @param {Array<Portlet>} array - Portlet List with duplicates. @return {Array<Portlet>} Portlet List without duplicates.
[ "Custom", "function", "to", "remove", "duplicates", "portlet", "on", "fname", "but", "with", "merging", "categories", "." ]
943e1e8daf6960232712c27491d09bc0c31c60a0
https://github.com/uPortal-contrib/uPortal-web-components/blob/943e1e8daf6960232712c27491d09bc0c31c60a0/@uportal/esco-content-menu/src/services/portlet-registry-to-array.js#L57-L66
train
byte-foundry/plumin.js
src/Font.js
function( buffer, enFamilyName, noMerge) { //cancelling in browser merge clearTimeout(this.mergeTimeout); if ( !enFamilyName ) { enFamilyName = this.ot.getEnglishName('fontFamily'); } if ( this.fontMap[ enFamilyName ] ) { document.fonts.delete( this.fontMap[ enFamilyName ] ); } var fontf...
javascript
function( buffer, enFamilyName, noMerge) { //cancelling in browser merge clearTimeout(this.mergeTimeout); if ( !enFamilyName ) { enFamilyName = this.ot.getEnglishName('fontFamily'); } if ( this.fontMap[ enFamilyName ] ) { document.fonts.delete( this.fontMap[ enFamilyName ] ); } var fontf...
[ "function", "(", "buffer", ",", "enFamilyName", ",", "noMerge", ")", "{", "//cancelling in browser merge", "clearTimeout", "(", "this", ".", "mergeTimeout", ")", ";", "if", "(", "!", "enFamilyName", ")", "{", "enFamilyName", "=", "this", ".", "ot", ".", "get...
CSS font loading, lightning fast
[ "CSS", "font", "loading", "lightning", "fast" ]
cce40c03f51f16638332c2c27a42f236feaaf3e3
https://github.com/byte-foundry/plumin.js/blob/cce40c03f51f16638332c2c27a42f236feaaf3e3/src/Font.js#L286-L334
train
trilogy-group/ignite-chute-opensource-json-schema-defaults
lib/defaults.js
function(target, source) { target = cloneJSON(target); for (var key in source) { if (source.hasOwnProperty(key)) { if (isObject(target[key]) && isObject(source[key])) { target[key] = merge(target[key], source[key]); } else { target[key] = source[key]; } }...
javascript
function(target, source) { target = cloneJSON(target); for (var key in source) { if (source.hasOwnProperty(key)) { if (isObject(target[key]) && isObject(source[key])) { target[key] = merge(target[key], source[key]); } else { target[key] = source[key]; } }...
[ "function", "(", "target", ",", "source", ")", "{", "target", "=", "cloneJSON", "(", "target", ")", ";", "for", "(", "var", "key", "in", "source", ")", "{", "if", "(", "source", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "if", "(", "isObject...
returns a result of deep merge of two objects @param {Object} target @param {Object} source @return {Object}
[ "returns", "a", "result", "of", "deep", "merge", "of", "two", "objects" ]
0c448d7939c9021dd66f54e5f9f1697153bbc570
https://github.com/trilogy-group/ignite-chute-opensource-json-schema-defaults/blob/0c448d7939c9021dd66f54e5f9f1697153bbc570/lib/defaults.js#L54-L67
train
trilogy-group/ignite-chute-opensource-json-schema-defaults
lib/defaults.js
function(path, definitions) { path = path.replace(/^#\/definitions\//, '').split('/'); var find = function(path, root) { var key = path.shift(); if (!root[key]) { return {}; } else if (!path.length) { return root[key]; } else { return find(path, root[key]); ...
javascript
function(path, definitions) { path = path.replace(/^#\/definitions\//, '').split('/'); var find = function(path, root) { var key = path.shift(); if (!root[key]) { return {}; } else if (!path.length) { return root[key]; } else { return find(path, root[key]); ...
[ "function", "(", "path", ",", "definitions", ")", "{", "path", "=", "path", ".", "replace", "(", "/", "^#\\/definitions\\/", "/", ",", "''", ")", ".", "split", "(", "'/'", ")", ";", "var", "find", "=", "function", "(", "path", ",", "root", ")", "{"...
get object by reference. works only with local references that points on definitions object @param {String} path @param {Object} definitions @return {Object}
[ "get", "object", "by", "reference", ".", "works", "only", "with", "local", "references", "that", "points", "on", "definitions", "object" ]
0c448d7939c9021dd66f54e5f9f1697153bbc570
https://github.com/trilogy-group/ignite-chute-opensource-json-schema-defaults/blob/0c448d7939c9021dd66f54e5f9f1697153bbc570/lib/defaults.js#L78-L98
train
trilogy-group/ignite-chute-opensource-json-schema-defaults
lib/defaults.js
function(schema, definitions) { if (typeof schema['default'] !== 'undefined') { return schema['default']; } else if (typeof schema.allOf !== 'undefined') { var mergedItem = mergeAllOf(schema.allOf, definitions); return defaults(mergedItem, definitions); } else if (typeof schema.$ref !...
javascript
function(schema, definitions) { if (typeof schema['default'] !== 'undefined') { return schema['default']; } else if (typeof schema.allOf !== 'undefined') { var mergedItem = mergeAllOf(schema.allOf, definitions); return defaults(mergedItem, definitions); } else if (typeof schema.$ref !...
[ "function", "(", "schema", ",", "definitions", ")", "{", "if", "(", "typeof", "schema", "[", "'default'", "]", "!==", "'undefined'", ")", "{", "return", "schema", "[", "'default'", "]", ";", "}", "else", "if", "(", "typeof", "schema", ".", "allOf", "!=...
returns a object that built with default values from json schema @param {Object} schema @param {Object} definitions @return {Object}
[ "returns", "a", "object", "that", "built", "with", "default", "values", "from", "json", "schema" ]
0c448d7939c9021dd66f54e5f9f1697153bbc570
https://github.com/trilogy-group/ignite-chute-opensource-json-schema-defaults/blob/0c448d7939c9021dd66f54e5f9f1697153bbc570/lib/defaults.js#L133-L201
train
wooorm/lowlight
lib/core.js
highlight
function highlight(language, value, options) { var settings = options || {} var prefix = settings.prefix if (prefix === null || prefix === undefined) { prefix = defaultPrefix } return normalize(coreHighlight(language, value, true, prefix)) }
javascript
function highlight(language, value, options) { var settings = options || {} var prefix = settings.prefix if (prefix === null || prefix === undefined) { prefix = defaultPrefix } return normalize(coreHighlight(language, value, true, prefix)) }
[ "function", "highlight", "(", "language", ",", "value", ",", "options", ")", "{", "var", "settings", "=", "options", "||", "{", "}", "var", "prefix", "=", "settings", ".", "prefix", "if", "(", "prefix", "===", "null", "||", "prefix", "===", "undefined", ...
Highlighting `value` in the language `language`.
[ "Highlighting", "value", "in", "the", "language", "language", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L100-L109
train
wooorm/lowlight
lib/core.js
registerLanguage
function registerLanguage(name, syntax) { var lang = syntax(low) languages[name] = lang languageNames.push(name) if (lang.aliases) { registerAlias(name, lang.aliases) } }
javascript
function registerLanguage(name, syntax) { var lang = syntax(low) languages[name] = lang languageNames.push(name) if (lang.aliases) { registerAlias(name, lang.aliases) } }
[ "function", "registerLanguage", "(", "name", ",", "syntax", ")", "{", "var", "lang", "=", "syntax", "(", "low", ")", "languages", "[", "name", "]", "=", "lang", "languageNames", ".", "push", "(", "name", ")", "if", "(", "lang", ".", "aliases", ")", "...
Register a language.
[ "Register", "a", "language", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L112-L122
train
wooorm/lowlight
lib/core.js
registerAlias
function registerAlias(name, alias) { var map = name var key var list var length var index if (alias) { map = {} map[name] = alias } for (key in map) { list = map[key] list = typeof list === 'string' ? [list] : list length = list.length index = -1 while (++index < length) ...
javascript
function registerAlias(name, alias) { var map = name var key var list var length var index if (alias) { map = {} map[name] = alias } for (key in map) { list = map[key] list = typeof list === 'string' ? [list] : list length = list.length index = -1 while (++index < length) ...
[ "function", "registerAlias", "(", "name", ",", "alias", ")", "{", "var", "map", "=", "name", "var", "key", "var", "list", "var", "length", "var", "index", "if", "(", "alias", ")", "{", "map", "=", "{", "}", "map", "[", "name", "]", "=", "alias", ...
Register more aliases for an already registered language.
[ "Register", "more", "aliases", "for", "an", "already", "registered", "language", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L130-L152
train
wooorm/lowlight
lib/core.js
processLexeme
function processLexeme(buffer, lexeme) { var newMode var endMode var origin modeBuffer += buffer if (lexeme === undefined) { addSiblings(processBuffer(), currentChildren) return 0 } newMode = subMode(lexeme, top) if (newMode) { addSiblings(processBuffer(), currentC...
javascript
function processLexeme(buffer, lexeme) { var newMode var endMode var origin modeBuffer += buffer if (lexeme === undefined) { addSiblings(processBuffer(), currentChildren) return 0 } newMode = subMode(lexeme, top) if (newMode) { addSiblings(processBuffer(), currentC...
[ "function", "processLexeme", "(", "buffer", ",", "lexeme", ")", "{", "var", "newMode", "var", "endMode", "var", "origin", "modeBuffer", "+=", "buffer", "if", "(", "lexeme", "===", "undefined", ")", "{", "addSiblings", "(", "processBuffer", "(", ")", ",", "...
Process a lexeme. Returns next position.
[ "Process", "a", "lexeme", ".", "Returns", "next", "position", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L231-L302
train
wooorm/lowlight
lib/core.js
startNewMode
function startNewMode(mode, lexeme) { var node if (mode.className) { node = build(mode.className, []) } if (mode.returnBegin) { modeBuffer = '' } else if (mode.excludeBegin) { addText(lexeme, currentChildren) modeBuffer = '' } else { modeBuffer = lexeme } ...
javascript
function startNewMode(mode, lexeme) { var node if (mode.className) { node = build(mode.className, []) } if (mode.returnBegin) { modeBuffer = '' } else if (mode.excludeBegin) { addText(lexeme, currentChildren) modeBuffer = '' } else { modeBuffer = lexeme } ...
[ "function", "startNewMode", "(", "mode", ",", "lexeme", ")", "{", "var", "node", "if", "(", "mode", ".", "className", ")", "{", "node", "=", "build", "(", "mode", ".", "className", ",", "[", "]", ")", "}", "if", "(", "mode", ".", "returnBegin", ")"...
Start a new mode with a `lexeme` to process.
[ "Start", "a", "new", "mode", "with", "a", "lexeme", "to", "process", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L305-L330
train
wooorm/lowlight
lib/core.js
processKeywords
function processKeywords() { var nodes = [] var lastIndex var keyword var node var submatch if (!top.keywords) { return addText(modeBuffer, nodes) } lastIndex = 0 top.lexemesRe.lastIndex = 0 keyword = top.lexemesRe.exec(modeBuffer) while (keyword) { addText(m...
javascript
function processKeywords() { var nodes = [] var lastIndex var keyword var node var submatch if (!top.keywords) { return addText(modeBuffer, nodes) } lastIndex = 0 top.lexemesRe.lastIndex = 0 keyword = top.lexemesRe.exec(modeBuffer) while (keyword) { addText(m...
[ "function", "processKeywords", "(", ")", "{", "var", "nodes", "=", "[", "]", "var", "lastIndex", "var", "keyword", "var", "node", "var", "submatch", "if", "(", "!", "top", ".", "keywords", ")", "{", "return", "addText", "(", "modeBuffer", ",", "nodes", ...
Process keywords. Returns nodes.
[ "Process", "keywords", ".", "Returns", "nodes", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L380-L421
train
wooorm/lowlight
lib/core.js
addSiblings
function addSiblings(siblings, nodes) { var length = siblings.length var index = -1 var sibling while (++index < length) { sibling = siblings[index] if (sibling.type === 'text') { addText(sibling.value, nodes) } else { nodes.push(sibling) } } }
javascript
function addSiblings(siblings, nodes) { var length = siblings.length var index = -1 var sibling while (++index < length) { sibling = siblings[index] if (sibling.type === 'text') { addText(sibling.value, nodes) } else { nodes.push(sibling) } } }
[ "function", "addSiblings", "(", "siblings", ",", "nodes", ")", "{", "var", "length", "=", "siblings", ".", "length", "var", "index", "=", "-", "1", "var", "sibling", "while", "(", "++", "index", "<", "length", ")", "{", "sibling", "=", "siblings", "[",...
Add siblings.
[ "Add", "siblings", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L424-L438
train
wooorm/lowlight
lib/core.js
addText
function addText(value, nodes) { var tail if (value) { tail = nodes[nodes.length - 1] if (tail && tail.type === 'text') { tail.value += value } else { nodes.push(buildText(value)) } } return nodes }
javascript
function addText(value, nodes) { var tail if (value) { tail = nodes[nodes.length - 1] if (tail && tail.type === 'text') { tail.value += value } else { nodes.push(buildText(value)) } } return nodes }
[ "function", "addText", "(", "value", ",", "nodes", ")", "{", "var", "tail", "if", "(", "value", ")", "{", "tail", "=", "nodes", "[", "nodes", ".", "length", "-", "1", "]", "if", "(", "tail", "&&", "tail", ".", "type", "===", "'text'", ")", "{", ...
Add a text.
[ "Add", "a", "text", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L441-L455
train
wooorm/lowlight
lib/core.js
build
function build(name, contents, noPrefix) { return { type: 'element', tagName: 'span', properties: { className: [(noPrefix ? '' : prefix) + name] }, children: contents } }
javascript
function build(name, contents, noPrefix) { return { type: 'element', tagName: 'span', properties: { className: [(noPrefix ? '' : prefix) + name] }, children: contents } }
[ "function", "build", "(", "name", ",", "contents", ",", "noPrefix", ")", "{", "return", "{", "type", ":", "'element'", ",", "tagName", ":", "'span'", ",", "properties", ":", "{", "className", ":", "[", "(", "noPrefix", "?", "''", ":", "prefix", ")", ...
Build a span.
[ "Build", "a", "span", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L463-L472
train
wooorm/lowlight
lib/core.js
keywordMatch
function keywordMatch(mode, keywords) { var keyword = keywords[0] if (language[keyInsensitive]) { keyword = keyword.toLowerCase() } return own.call(mode.keywords, keyword) && mode.keywords[keyword] }
javascript
function keywordMatch(mode, keywords) { var keyword = keywords[0] if (language[keyInsensitive]) { keyword = keyword.toLowerCase() } return own.call(mode.keywords, keyword) && mode.keywords[keyword] }
[ "function", "keywordMatch", "(", "mode", ",", "keywords", ")", "{", "var", "keyword", "=", "keywords", "[", "0", "]", "if", "(", "language", "[", "keyInsensitive", "]", ")", "{", "keyword", "=", "keyword", ".", "toLowerCase", "(", ")", "}", "return", "...
Check if the first word in `keywords` is a keyword.
[ "Check", "if", "the", "first", "word", "in", "keywords", "is", "a", "keyword", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L475-L483
train
wooorm/lowlight
lib/core.js
endOfMode
function endOfMode(mode, lexeme) { if (test(mode.endRe, lexeme)) { while (mode.endsParent && mode.parent) { mode = mode.parent } return mode } if (mode.endsWithParent) { return endOfMode(mode.parent, lexeme) } }
javascript
function endOfMode(mode, lexeme) { if (test(mode.endRe, lexeme)) { while (mode.endsParent && mode.parent) { mode = mode.parent } return mode } if (mode.endsWithParent) { return endOfMode(mode.parent, lexeme) } }
[ "function", "endOfMode", "(", "mode", ",", "lexeme", ")", "{", "if", "(", "test", "(", "mode", ".", "endRe", ",", "lexeme", ")", ")", "{", "while", "(", "mode", ".", "endsParent", "&&", "mode", ".", "parent", ")", "{", "mode", "=", "mode", ".", "...
Check if `lexeme` ends `mode`.
[ "Check", "if", "lexeme", "ends", "mode", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L491-L503
train
wooorm/lowlight
lib/core.js
subMode
function subMode(lexeme, mode) { var values = mode.contains var length = values.length var index = -1 while (++index < length) { if (test(values[index].beginRe, lexeme)) { return values[index] } } }
javascript
function subMode(lexeme, mode) { var values = mode.contains var length = values.length var index = -1 while (++index < length) { if (test(values[index].beginRe, lexeme)) { return values[index] } } }
[ "function", "subMode", "(", "lexeme", ",", "mode", ")", "{", "var", "values", "=", "mode", ".", "contains", "var", "length", "=", "values", ".", "length", "var", "index", "=", "-", "1", "while", "(", "++", "index", "<", "length", ")", "{", "if", "(...
Check a sub-mode.
[ "Check", "a", "sub", "-", "mode", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L506-L516
train
wooorm/lowlight
lib/core.js
compileLanguage
function compileLanguage(language) { compileMode(language) // Compile a language mode, optionally with a parent. function compileMode(mode, parent) { var compiledKeywords = {} var terminators if (mode.compiled) { return } mode.compiled = true mode.keywords = mode.keywords || mode...
javascript
function compileLanguage(language) { compileMode(language) // Compile a language mode, optionally with a parent. function compileMode(mode, parent) { var compiledKeywords = {} var terminators if (mode.compiled) { return } mode.compiled = true mode.keywords = mode.keywords || mode...
[ "function", "compileLanguage", "(", "language", ")", "{", "compileMode", "(", "language", ")", "// Compile a language mode, optionally with a parent.", "function", "compileMode", "(", "mode", ",", "parent", ")", "{", "var", "compiledKeywords", "=", "{", "}", "var", ...
Compile a language.
[ "Compile", "a", "language", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L550-L685
train
wooorm/lowlight
lib/core.js
flatten
function flatten(className, value) { var pairs var pair var index var length if (language[keyInsensitive]) { value = value.toLowerCase() } pairs = value.split(space) length = pairs.length index = -1 while (++index < length) { pair = pairs[in...
javascript
function flatten(className, value) { var pairs var pair var index var length if (language[keyInsensitive]) { value = value.toLowerCase() } pairs = value.split(space) length = pairs.length index = -1 while (++index < length) { pair = pairs[in...
[ "function", "flatten", "(", "className", ",", "value", ")", "{", "var", "pairs", "var", "pair", "var", "index", "var", "length", "if", "(", "language", "[", "keyInsensitive", "]", ")", "{", "value", "=", "value", ".", "toLowerCase", "(", ")", "}", "pai...
Flatten a classname.
[ "Flatten", "a", "classname", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L651-L670
train
wooorm/lowlight
lib/core.js
normalize
function normalize(result) { return { relevance: result.relevance || 0, language: result.language || null, value: result.value || [] } }
javascript
function normalize(result) { return { relevance: result.relevance || 0, language: result.language || null, value: result.value || [] } }
[ "function", "normalize", "(", "result", ")", "{", "return", "{", "relevance", ":", "result", ".", "relevance", "||", "0", ",", "language", ":", "result", ".", "language", "||", "null", ",", "value", ":", "result", ".", "value", "||", "[", "]", "}", "...
Normalize a syntax result.
[ "Normalize", "a", "syntax", "result", "." ]
2eea3acec5882038908d37d6abd5ad9ca351b65c
https://github.com/wooorm/lowlight/blob/2eea3acec5882038908d37d6abd5ad9ca351b65c/lib/core.js#L688-L694
train
rxaviers/cldrjs
build/compare-size.js
function(cache) { var tips = cache[""].tips; // Sort labels: metadata, then branch tips by first add, // then user entries by first add, then last run // Then return without metadata return Object.keys(cache) .sort(function(a, b) { var keys = Object.keys(cache); ret...
javascript
function(cache) { var tips = cache[""].tips; // Sort labels: metadata, then branch tips by first add, // then user entries by first add, then last run // Then return without metadata return Object.keys(cache) .sort(function(a, b) { var keys = Object.keys(cache); ret...
[ "function", "(", "cache", ")", "{", "var", "tips", "=", "cache", "[", "\"\"", "]", ".", "tips", ";", "// Sort labels: metadata, then branch tips by first add,\r", "// then user entries by first add, then last run\r", "// Then return without metadata\r", "return", "Object", "....
Label sequence helper
[ "Label", "sequence", "helper" ]
9efaa3c9902f0a740057af40a976ec0258feaf33
https://github.com/rxaviers/cldrjs/blob/9efaa3c9902f0a740057af40a976ec0258feaf33/build/compare-size.js#L103-L121
train
rxaviers/cldrjs
build/compare-size.js
function(delta) { var color = "green"; if (delta > 0) { delta = "+" + delta; color = "red"; } else if (!delta) { delta = delta === 0 ? "=" : "?"; color = "grey"; } return chalk[color](delta); }
javascript
function(delta) { var color = "green"; if (delta > 0) { delta = "+" + delta; color = "red"; } else if (!delta) { delta = delta === 0 ? "=" : "?"; color = "grey"; } return chalk[color](delta); }
[ "function", "(", "delta", ")", "{", "var", "color", "=", "\"green\"", ";", "if", "(", "delta", ">", "0", ")", "{", "delta", "=", "\"+\"", "+", "delta", ";", "color", "=", "\"red\"", ";", "}", "else", "if", "(", "!", "delta", ")", "{", "delta", ...
Color-coded size difference
[ "Color", "-", "coded", "size", "difference" ]
9efaa3c9902f0a740057af40a976ec0258feaf33
https://github.com/rxaviers/cldrjs/blob/9efaa3c9902f0a740057af40a976ec0258feaf33/build/compare-size.js#L131-L143
train
rxaviers/cldrjs
build/compare-size.js
function(src) { var cache; try { cache = fs.existsSync(src) ? file.readJSON(src) : undefined; } catch (e) { debug(e); } // Progressively upgrade `cache`, which is one of: // empty // {} // { file: size [,...] } // { "": { tips: { label: SHA1, ... } }, label...
javascript
function(src) { var cache; try { cache = fs.existsSync(src) ? file.readJSON(src) : undefined; } catch (e) { debug(e); } // Progressively upgrade `cache`, which is one of: // empty // {} // { file: size [,...] } // { "": { tips: { label: SHA1, ... } }, label...
[ "function", "(", "src", ")", "{", "var", "cache", ";", "try", "{", "cache", "=", "fs", ".", "existsSync", "(", "src", ")", "?", "file", ".", "readJSON", "(", "src", ")", ":", "undefined", ";", "}", "catch", "(", "e", ")", "{", "debug", "(", "e"...
Size cache helper
[ "Size", "cache", "helper" ]
9efaa3c9902f0a740057af40a976ec0258feaf33
https://github.com/rxaviers/cldrjs/blob/9efaa3c9902f0a740057af40a976ec0258feaf33/build/compare-size.js#L146-L200
train
rxaviers/cldrjs
build/compare-size.js
function(task, compressors) { var sizes = {}, files = processPatterns(task.files, function(pattern) { // Find all matching files for this pattern. return glob.sync(pattern, { filter: "isFile" }); }); files.forEach(function(src) { var contents = file.read(src), ...
javascript
function(task, compressors) { var sizes = {}, files = processPatterns(task.files, function(pattern) { // Find all matching files for this pattern. return glob.sync(pattern, { filter: "isFile" }); }); files.forEach(function(src) { var contents = file.read(src), ...
[ "function", "(", "task", ",", "compressors", ")", "{", "var", "sizes", "=", "{", "}", ",", "files", "=", "processPatterns", "(", "task", ".", "files", ",", "function", "(", "pattern", ")", "{", "// Find all matching files for this pattern.\r", "return", "glob"...
Files helper.
[ "Files", "helper", "." ]
9efaa3c9902f0a740057af40a976ec0258feaf33
https://github.com/rxaviers/cldrjs/blob/9efaa3c9902f0a740057af40a976ec0258feaf33/build/compare-size.js#L203-L221
train
rxaviers/cldrjs
build/compare-size.js
function(done) { debug("Running `git branch` command..."); exec( "git branch --no-color --verbose --no-abbrev --contains HEAD", function(err, stdout) { var status = {}, matches = /^\* (.+?)\s+([0-9a-f]{8,})/im.exec(stdout); if (err || !matches) { done(er...
javascript
function(done) { debug("Running `git branch` command..."); exec( "git branch --no-color --verbose --no-abbrev --contains HEAD", function(err, stdout) { var status = {}, matches = /^\* (.+?)\s+([0-9a-f]{8,})/im.exec(stdout); if (err || !matches) { done(er...
[ "function", "(", "done", ")", "{", "debug", "(", "\"Running `git branch` command...\"", ")", ";", "exec", "(", "\"git branch --no-color --verbose --no-abbrev --contains HEAD\"", ",", "function", "(", "err", ",", "stdout", ")", "{", "var", "status", "=", "{", "}", ...
git helper.
[ "git", "helper", "." ]
9efaa3c9902f0a740057af40a976ec0258feaf33
https://github.com/rxaviers/cldrjs/blob/9efaa3c9902f0a740057af40a976ec0258feaf33/build/compare-size.js#L224-L246
train
rxaviers/cldrjs
build/compare-size.js
compareSizes
function compareSizes(task) { var compressors = task.options.compress, newsizes = helpers.sizes(task, compressors), files = Object.keys(newsizes), sizecache = defaultCache, cache = helpers.get_cache(sizecache), tips = cache[""].tips, labels = helpers.sorted_labels(cache); // Obtain...
javascript
function compareSizes(task) { var compressors = task.options.compress, newsizes = helpers.sizes(task, compressors), files = Object.keys(newsizes), sizecache = defaultCache, cache = helpers.get_cache(sizecache), tips = cache[""].tips, labels = helpers.sorted_labels(cache); // Obtain...
[ "function", "compareSizes", "(", "task", ")", "{", "var", "compressors", "=", "task", ".", "options", ".", "compress", ",", "newsizes", "=", "helpers", ".", "sizes", "(", "task", ",", "compressors", ")", ",", "files", "=", "Object", ".", "keys", "(", "...
Compare size to saved sizes Derived and adapted from Corey Frang's original `sizer`
[ "Compare", "size", "to", "saved", "sizes", "Derived", "and", "adapted", "from", "Corey", "Frang", "s", "original", "sizer" ]
9efaa3c9902f0a740057af40a976ec0258feaf33
https://github.com/rxaviers/cldrjs/blob/9efaa3c9902f0a740057af40a976ec0258feaf33/build/compare-size.js#L251-L337
train
kaisalmen/WWOBJLoader
src/loaders/support/LoaderWorkerSupport.js
function ( functionCodeBuilder, parserName, libLocations, libPath, runnerImpl ) { if ( THREE.LoaderSupport.Validator.isValid( this.loaderWorker.worker ) ) return; if ( this.logging.enabled ) { console.info( 'WorkerSupport: Building worker code...' ); console.time( 'buildWebWorkerCode' ); } if ( THREE.L...
javascript
function ( functionCodeBuilder, parserName, libLocations, libPath, runnerImpl ) { if ( THREE.LoaderSupport.Validator.isValid( this.loaderWorker.worker ) ) return; if ( this.logging.enabled ) { console.info( 'WorkerSupport: Building worker code...' ); console.time( 'buildWebWorkerCode' ); } if ( THREE.L...
[ "function", "(", "functionCodeBuilder", ",", "parserName", ",", "libLocations", ",", "libPath", ",", "runnerImpl", ")", "{", "if", "(", "THREE", ".", "LoaderSupport", ".", "Validator", ".", "isValid", "(", "this", ".", "loaderWorker", ".", "worker", ")", ")"...
Validate the status of worker code and the derived worker. @param {Function} functionCodeBuilder Function that is invoked with funcBuildObject and funcBuildSingleton that allows stringification of objects and singletons. @param {String} parserName Name of the Parser object @param {String[]} libLocations URL of librari...
[ "Validate", "the", "status", "of", "worker", "code", "and", "the", "derived", "worker", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/support/LoaderWorkerSupport.js#L54-L118
train
kaisalmen/WWOBJLoader
src/loaders/support/LoaderWorkerSupport.js
function ( e ) { var payload = e.data; switch ( payload.cmd ) { case 'meshData': case 'materialData': case 'imageData': this.runtimeRef.callbacks.meshBuilder( payload ); break; case 'complete': this.runtimeRef.queuedMessage = null; this.started = false; this.runtimeRef.callbacks.onL...
javascript
function ( e ) { var payload = e.data; switch ( payload.cmd ) { case 'meshData': case 'materialData': case 'imageData': this.runtimeRef.callbacks.meshBuilder( payload ); break; case 'complete': this.runtimeRef.queuedMessage = null; this.started = false; this.runtimeRef.callbacks.onL...
[ "function", "(", "e", ")", "{", "var", "payload", "=", "e", ".", "data", ";", "switch", "(", "payload", ".", "cmd", ")", "{", "case", "'meshData'", ":", "case", "'materialData'", ":", "case", "'imageData'", ":", "this", ".", "runtimeRef", ".", "callbac...
Executed in worker scope
[ "Executed", "in", "worker", "scope" ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/support/LoaderWorkerSupport.js#L222-L263
train
kaisalmen/WWOBJLoader
src/loaders/support/LoaderWorkerSupport.js
function ( parser, params ) { var property, funcName, values; for ( property in params ) { funcName = 'set' + property.substring( 0, 1 ).toLocaleUpperCase() + property.substring( 1 ); values = params[ property ]; if ( typeof parser[ funcName ] === 'function' ) { parser[ funcName ]( values ); } el...
javascript
function ( parser, params ) { var property, funcName, values; for ( property in params ) { funcName = 'set' + property.substring( 0, 1 ).toLocaleUpperCase() + property.substring( 1 ); values = params[ property ]; if ( typeof parser[ funcName ] === 'function' ) { parser[ funcName ]( values ); } el...
[ "function", "(", "parser", ",", "params", ")", "{", "var", "property", ",", "funcName", ",", "values", ";", "for", "(", "property", "in", "params", ")", "{", "funcName", "=", "'set'", "+", "property", ".", "substring", "(", "0", ",", "1", ")", ".", ...
Applies values from parameter object via set functions or via direct assignment. @param {Object} parser The parser instance @param {Object} params The parameter object
[ "Applies", "values", "from", "parameter", "object", "via", "set", "functions", "or", "via", "direct", "assignment", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/support/LoaderWorkerSupport.js#L550-L566
train
kaisalmen/WWOBJLoader
src/loaders/support/LoaderWorkerSupport.js
function ( payload ) { if ( payload.cmd === 'run' ) { var self = this.getParentScope(); var callbacks = { callbackOnAssetAvailable: function ( payload ) { self.postMessage( payload ); }, callbackOnProgress: function ( text ) { if ( payload.logging.enabled && payload.logging.debug ) consol...
javascript
function ( payload ) { if ( payload.cmd === 'run' ) { var self = this.getParentScope(); var callbacks = { callbackOnAssetAvailable: function ( payload ) { self.postMessage( payload ); }, callbackOnProgress: function ( text ) { if ( payload.logging.enabled && payload.logging.debug ) consol...
[ "function", "(", "payload", ")", "{", "if", "(", "payload", ".", "cmd", "===", "'run'", ")", "{", "var", "self", "=", "this", ".", "getParentScope", "(", ")", ";", "var", "callbacks", "=", "{", "callbackOnAssetAvailable", ":", "function", "(", "payload",...
Configures the Parser implementation according the supplied configuration object. @param {Object} payload Raw mesh description (buffers, params, materials) used to build one to many meshes.
[ "Configures", "the", "Parser", "implementation", "according", "the", "supplied", "configuration", "object", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/support/LoaderWorkerSupport.js#L573-L607
train
kaisalmen/WWOBJLoader
src/loaders/OBJLoader2.js
function ( url, onLoad, onProgress, onError, onMeshAlter, useAsync ) { var resource = new THREE.LoaderSupport.ResourceDescriptor( url, 'OBJ' ); this._loadObj( resource, onLoad, onProgress, onError, onMeshAlter, useAsync ); }
javascript
function ( url, onLoad, onProgress, onError, onMeshAlter, useAsync ) { var resource = new THREE.LoaderSupport.ResourceDescriptor( url, 'OBJ' ); this._loadObj( resource, onLoad, onProgress, onError, onMeshAlter, useAsync ); }
[ "function", "(", "url", ",", "onLoad", ",", "onProgress", ",", "onError", ",", "onMeshAlter", ",", "useAsync", ")", "{", "var", "resource", "=", "new", "THREE", ".", "LoaderSupport", ".", "ResourceDescriptor", "(", "url", ",", "'OBJ'", ")", ";", "this", ...
Use this convenient method to load a file at the given URL. By default the fileLoader uses an ArrayBuffer. @param {string} url A string containing the path/URL of the file to be loaded. @param {callback} onLoad A function to be called after loading is successfully completed. The function receives loaded Object3D as an...
[ "Use", "this", "convenient", "method", "to", "load", "a", "file", "at", "the", "given", "URL", ".", "By", "default", "the", "fileLoader", "uses", "an", "ArrayBuffer", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/OBJLoader2.js#L196-L199
train
kaisalmen/WWOBJLoader
src/loaders/OBJLoader2.js
function ( prepData, workerSupportExternal ) { this._applyPrepData( prepData ); var available = prepData.checkResourceDescriptorFiles( prepData.resources, [ { ext: "obj", type: "ArrayBuffer", ignore: false }, { ext: "mtl", type: "String", ignore: false }, { ext: "zip", type: "String", ignore: true } ...
javascript
function ( prepData, workerSupportExternal ) { this._applyPrepData( prepData ); var available = prepData.checkResourceDescriptorFiles( prepData.resources, [ { ext: "obj", type: "ArrayBuffer", ignore: false }, { ext: "mtl", type: "String", ignore: false }, { ext: "zip", type: "String", ignore: true } ...
[ "function", "(", "prepData", ",", "workerSupportExternal", ")", "{", "this", ".", "_applyPrepData", "(", "prepData", ")", ";", "var", "available", "=", "prepData", ".", "checkResourceDescriptorFiles", "(", "prepData", ".", "resources", ",", "[", "{", "ext", ":...
Run the loader according the provided instructions. @param {THREE.LoaderSupport.PrepData} prepData All parameters and resources required for execution @param {THREE.LoaderSupport.WorkerSupport} [workerSupportExternal] Use pre-existing WorkerSupport
[ "Run", "the", "loader", "according", "the", "provided", "instructions", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/OBJLoader2.js#L286-L310
train
kaisalmen/WWOBJLoader
src/loaders/OBJLoader2.js
function ( content ) { // fast-fail in case of illegal data if ( content === null || content === undefined ) { throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing'; } if ( this.logging.enabled ) console.time( 'OBJLoader2 parse: ' + this.modelName ); this.meshBuilder.i...
javascript
function ( content ) { // fast-fail in case of illegal data if ( content === null || content === undefined ) { throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing'; } if ( this.logging.enabled ) console.time( 'OBJLoader2 parse: ' + this.modelName ); this.meshBuilder.i...
[ "function", "(", "content", ")", "{", "// fast-fail in case of illegal data", "if", "(", "content", "===", "null", "||", "content", "===", "undefined", ")", "{", "throw", "'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing'", ";", "}", "if", ...
Parses OBJ data synchronously from arraybuffer or string. @param {arraybuffer|string} content OBJ data as Uint8Array or String
[ "Parses", "OBJ", "data", "synchronously", "from", "arraybuffer", "or", "string", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/OBJLoader2.js#L334-L390
train
kaisalmen/WWOBJLoader
src/loaders/OBJLoader2.js
function ( content, onLoad ) { var scope = this; var measureTime = false; var scopedOnLoad = function () { onLoad( { detail: { loaderRootNode: scope.loaderRootNode, modelName: scope.modelName, instanceNo: scope.instanceNo } } ); if ( measureTime && scope.logging.enable...
javascript
function ( content, onLoad ) { var scope = this; var measureTime = false; var scopedOnLoad = function () { onLoad( { detail: { loaderRootNode: scope.loaderRootNode, modelName: scope.modelName, instanceNo: scope.instanceNo } } ); if ( measureTime && scope.logging.enable...
[ "function", "(", "content", ",", "onLoad", ")", "{", "var", "scope", "=", "this", ";", "var", "measureTime", "=", "false", ";", "var", "scopedOnLoad", "=", "function", "(", ")", "{", "onLoad", "(", "{", "detail", ":", "{", "loaderRootNode", ":", "scope...
Parses OBJ content asynchronously from arraybuffer. @param {arraybuffer} content OBJ data as Uint8Array @param {callback} onLoad Called after worker successfully completed loading
[ "Parses", "OBJ", "content", "asynchronously", "from", "arraybuffer", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/OBJLoader2.js#L398-L478
train
kaisalmen/WWOBJLoader
src/loaders/OBJLoader2.js
function ( url, content, onLoad, onProgress, onError, crossOrigin, materialOptions ) { var resource = new THREE.LoaderSupport.ResourceDescriptor( url, 'MTL' ); resource.setContent( content ); this._loadMtl( resource, onLoad, onProgress, onError, crossOrigin, materialOptions ); }
javascript
function ( url, content, onLoad, onProgress, onError, crossOrigin, materialOptions ) { var resource = new THREE.LoaderSupport.ResourceDescriptor( url, 'MTL' ); resource.setContent( content ); this._loadMtl( resource, onLoad, onProgress, onError, crossOrigin, materialOptions ); }
[ "function", "(", "url", ",", "content", ",", "onLoad", ",", "onProgress", ",", "onError", ",", "crossOrigin", ",", "materialOptions", ")", "{", "var", "resource", "=", "new", "THREE", ".", "LoaderSupport", ".", "ResourceDescriptor", "(", "url", ",", "'MTL'",...
Utility method for loading an mtl file according resource description. Provide url or content. @param {string} url URL to the file @param {Object} content The file content as arraybuffer or text @param {function} onLoad Callback to be called after successful load @param {callback} [onProgress] A function to be called ...
[ "Utility", "method", "for", "loading", "an", "mtl", "file", "according", "resource", "description", ".", "Provide", "url", "or", "content", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/OBJLoader2.js#L491-L495
train
kaisalmen/WWOBJLoader
src/loaders/OBJLoader2.js
function ( arrayBuffer ) { if ( this.logging.enabled ) console.time( 'OBJLoader2.Parser.parse' ); this.configure(); var arrayBufferView = new Uint8Array( arrayBuffer ); this.contentRef = arrayBufferView; var length = arrayBufferView.byteLength; this.globalCounts.totalBytes = length; var buffer = new Arra...
javascript
function ( arrayBuffer ) { if ( this.logging.enabled ) console.time( 'OBJLoader2.Parser.parse' ); this.configure(); var arrayBufferView = new Uint8Array( arrayBuffer ); this.contentRef = arrayBufferView; var length = arrayBufferView.byteLength; this.globalCounts.totalBytes = length; var buffer = new Arra...
[ "function", "(", "arrayBuffer", ")", "{", "if", "(", "this", ".", "logging", ".", "enabled", ")", "console", ".", "time", "(", "'OBJLoader2.Parser.parse'", ")", ";", "this", ".", "configure", "(", ")", ";", "var", "arrayBufferView", "=", "new", "Uint8Array...
Parse the provided arraybuffer @param {Uint8Array} arrayBuffer OBJ data as Uint8Array
[ "Parse", "the", "provided", "arraybuffer" ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/OBJLoader2.js#L783-L831
train
kaisalmen/WWOBJLoader
src/loaders/OBJLoader2.js
function ( text ) { if ( this.logging.enabled ) console.time( 'OBJLoader2.Parser.parseText' ); this.configure(); this.legacyMode = true; this.contentRef = text; var length = text.length; this.globalCounts.totalBytes = length; var buffer = new Array( 128 ); for ( var char, word = '', bufferPointer = 0,...
javascript
function ( text ) { if ( this.logging.enabled ) console.time( 'OBJLoader2.Parser.parseText' ); this.configure(); this.legacyMode = true; this.contentRef = text; var length = text.length; this.globalCounts.totalBytes = length; var buffer = new Array( 128 ); for ( var char, word = '', bufferPointer = 0,...
[ "function", "(", "text", ")", "{", "if", "(", "this", ".", "logging", ".", "enabled", ")", "console", ".", "time", "(", "'OBJLoader2.Parser.parseText'", ")", ";", "this", ".", "configure", "(", ")", ";", "this", ".", "legacyMode", "=", "true", ";", "th...
Parse the provided text @param {string} text OBJ data as string
[ "Parse", "the", "provided", "text" ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/OBJLoader2.js#L838-L881
train
kaisalmen/WWOBJLoader
src/loaders/OBJLoader2.js
function () { var meshOutputGroupTemp = []; var meshOutputGroup; var absoluteVertexCount = 0; var absoluteIndexMappingsCount = 0; var absoluteIndexCount = 0; var absoluteColorCount = 0; var absoluteNormalCount = 0; var absoluteUvCount = 0; var indices; for ( var name in this.rawMesh.subGroups ) { ...
javascript
function () { var meshOutputGroupTemp = []; var meshOutputGroup; var absoluteVertexCount = 0; var absoluteIndexMappingsCount = 0; var absoluteIndexCount = 0; var absoluteColorCount = 0; var absoluteNormalCount = 0; var absoluteUvCount = 0; var indices; for ( var name in this.rawMesh.subGroups ) { ...
[ "function", "(", ")", "{", "var", "meshOutputGroupTemp", "=", "[", "]", ";", "var", "meshOutputGroup", ";", "var", "absoluteVertexCount", "=", "0", ";", "var", "absoluteIndexMappingsCount", "=", "0", ";", "var", "absoluteIndexCount", "=", "0", ";", "var", "a...
Clear any empty subGroup and calculate absolute vertex, normal and uv counts
[ "Clear", "any", "empty", "subGroup", "and", "calculate", "absolute", "vertex", "normal", "and", "uv", "counts" ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/OBJLoader2.js#L1188-L1238
train
kaisalmen/WWOBJLoader
src/loaders/support/LoaderBuilder.js
function () { var materialsJSON = {}; var material; for ( var materialName in this.materials ) { material = this.materials[ materialName ]; materialsJSON[ materialName ] = material.toJSON(); } return materialsJSON; }
javascript
function () { var materialsJSON = {}; var material; for ( var materialName in this.materials ) { material = this.materials[ materialName ]; materialsJSON[ materialName ] = material.toJSON(); } return materialsJSON; }
[ "function", "(", ")", "{", "var", "materialsJSON", "=", "{", "}", ";", "var", "material", ";", "for", "(", "var", "materialName", "in", "this", ".", "materials", ")", "{", "material", "=", "this", ".", "materials", "[", "materialName", "]", ";", "mater...
Returns the mapping object of material name and corresponding jsonified material. @returns {Object} Map of Materials in JSON representation
[ "Returns", "the", "mapping", "object", "of", "material", "name", "and", "corresponding", "jsonified", "material", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/support/LoaderBuilder.js#L347-L357
train
kaisalmen/WWOBJLoader
src/loaders/support/LoaderWorkerDirector.js
function ( globalCallbacks, maxQueueSize, maxWebWorkers ) { if ( THREE.LoaderSupport.Validator.isValid( globalCallbacks ) ) this.workerDescription.globalCallbacks = globalCallbacks; this.maxQueueSize = Math.min( maxQueueSize, THREE.LoaderSupport.WorkerDirector.MAX_QUEUE_SIZE ); this.maxWebWorkers = Math.min( maxW...
javascript
function ( globalCallbacks, maxQueueSize, maxWebWorkers ) { if ( THREE.LoaderSupport.Validator.isValid( globalCallbacks ) ) this.workerDescription.globalCallbacks = globalCallbacks; this.maxQueueSize = Math.min( maxQueueSize, THREE.LoaderSupport.WorkerDirector.MAX_QUEUE_SIZE ); this.maxWebWorkers = Math.min( maxW...
[ "function", "(", "globalCallbacks", ",", "maxQueueSize", ",", "maxWebWorkers", ")", "{", "if", "(", "THREE", ".", "LoaderSupport", ".", "Validator", ".", "isValid", "(", "globalCallbacks", ")", ")", "this", ".", "workerDescription", ".", "globalCallbacks", "=", ...
Create or destroy workers according limits. Set the name and register callbacks for dynamically created web workers. @param {THREE.OBJLoader2.WWOBJLoader2.PrepDataCallbacks} globalCallbacks Register global callbacks used by all web workers @param {number} maxQueueSize Set the maximum size of the instruction queue (1-...
[ "Create", "or", "destroy", "workers", "according", "limits", ".", "Set", "the", "name", "and", "register", "callbacks", "for", "dynamically", "created", "web", "workers", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/support/LoaderWorkerDirector.js#L102-L125
train
kaisalmen/WWOBJLoader
src/loaders/support/LoaderWorkerDirector.js
function () { var wsKeys = Object.keys( this.workerDescription.workerSupports ); return ( ( this.instructionQueue.length > 0 && this.instructionQueuePointer < this.instructionQueue.length ) || wsKeys.length > 0 ); }
javascript
function () { var wsKeys = Object.keys( this.workerDescription.workerSupports ); return ( ( this.instructionQueue.length > 0 && this.instructionQueuePointer < this.instructionQueue.length ) || wsKeys.length > 0 ); }
[ "function", "(", ")", "{", "var", "wsKeys", "=", "Object", ".", "keys", "(", "this", ".", "workerDescription", ".", "workerSupports", ")", ";", "return", "(", "(", "this", ".", "instructionQueue", ".", "length", ">", "0", "&&", "this", ".", "instructionQ...
Returns if any workers are running. @returns {boolean}
[ "Returns", "if", "any", "workers", "are", "running", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/support/LoaderWorkerDirector.js#L143-L146
train
kaisalmen/WWOBJLoader
src/loaders/support/LoaderWorkerDirector.js
function () { var prepData, supportDesc; for ( var instanceNo in this.workerDescription.workerSupports ) { supportDesc = this.workerDescription.workerSupports[ instanceNo ]; if ( ! supportDesc.inUse ) { if ( this.instructionQueuePointer < this.instructionQueue.length ) { prepData = this.instructio...
javascript
function () { var prepData, supportDesc; for ( var instanceNo in this.workerDescription.workerSupports ) { supportDesc = this.workerDescription.workerSupports[ instanceNo ]; if ( ! supportDesc.inUse ) { if ( this.instructionQueuePointer < this.instructionQueue.length ) { prepData = this.instructio...
[ "function", "(", ")", "{", "var", "prepData", ",", "supportDesc", ";", "for", "(", "var", "instanceNo", "in", "this", ".", "workerDescription", ".", "workerSupports", ")", "{", "supportDesc", "=", "this", ".", "workerDescription", ".", "workerSupports", "[", ...
Process the instructionQueue until it is depleted.
[ "Process", "the", "instructionQueue", "until", "it", "is", "depleted", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/support/LoaderWorkerDirector.js#L151-L180
train
kaisalmen/WWOBJLoader
src/loaders/support/LoaderWorkerDirector.js
function ( callbackOnFinishedProcessing ) { if ( this.logging.enabled ) console.info( 'WorkerDirector received the deregister call. Terminating all workers!' ); this.instructionQueuePointer = this.instructionQueue.length; this.callbackOnFinishedProcessing = THREE.LoaderSupport.Validator.verifyInput( callbackOnFi...
javascript
function ( callbackOnFinishedProcessing ) { if ( this.logging.enabled ) console.info( 'WorkerDirector received the deregister call. Terminating all workers!' ); this.instructionQueuePointer = this.instructionQueue.length; this.callbackOnFinishedProcessing = THREE.LoaderSupport.Validator.verifyInput( callbackOnFi...
[ "function", "(", "callbackOnFinishedProcessing", ")", "{", "if", "(", "this", ".", "logging", ".", "enabled", ")", "console", ".", "info", "(", "'WorkerDirector received the deregister call. Terminating all workers!'", ")", ";", "this", ".", "instructionQueuePointer", "...
Terminate all workers. @param {callback} callbackOnFinishedProcessing Function called once all workers finished processing.
[ "Terminate", "all", "workers", "." ]
729c1f1549db24c22c0bc202d7295edbc655c7bc
https://github.com/kaisalmen/WWOBJLoader/blob/729c1f1549db24c22c0bc202d7295edbc655c7bc/src/loaders/support/LoaderWorkerDirector.js#L293-L304
train
blankapp/ui
docs/themes/landscape/source/fancybox/helpers/jquery.fancybox-thumbs.js
function ( item ) { // function to obtain the URL of the thumbnail image var href; if (item.element) { href = $(item.element).find('img').attr('src'); } if (!href && item.type === 'image' && item.href) { href = item.href; } return href; }
javascript
function ( item ) { // function to obtain the URL of the thumbnail image var href; if (item.element) { href = $(item.element).find('img').attr('src'); } if (!href && item.type === 'image' && item.href) { href = item.href; } return href; }
[ "function", "(", "item", ")", "{", "// function to obtain the URL of the thumbnail image", "var", "href", ";", "if", "(", "item", ".", "element", ")", "{", "href", "=", "$", "(", "item", ".", "element", ")", ".", "find", "(", "'img'", ")", ".", "attr", "...
'top' or 'bottom'
[ "top", "or", "bottom" ]
3e9347658754d6bc3aef4a1a7b5014e699346636
https://github.com/blankapp/ui/blob/3e9347658754d6bc3aef4a1a7b5014e699346636/docs/themes/landscape/source/fancybox/helpers/jquery.fancybox-thumbs.js#L27-L39
train
blankapp/ui
docs/themes/landscape/source/fancybox/helpers/jquery.fancybox-media.js
function( url, rez, params ) { params = params || ''; if ( $.type( params ) === "object" ) { params = $.param(params, true); } $.each(rez, function(key, value) { url = url.replace( '$' + key, value || '' ); }); if (params.length) { url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params; ...
javascript
function( url, rez, params ) { params = params || ''; if ( $.type( params ) === "object" ) { params = $.param(params, true); } $.each(rez, function(key, value) { url = url.replace( '$' + key, value || '' ); }); if (params.length) { url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params; ...
[ "function", "(", "url", ",", "rez", ",", "params", ")", "{", "params", "=", "params", "||", "''", ";", "if", "(", "$", ".", "type", "(", "params", ")", "===", "\"object\"", ")", "{", "params", "=", "$", ".", "param", "(", "params", ",", "true", ...
Shortcut for fancyBox object
[ "Shortcut", "for", "fancyBox", "object" ]
3e9347658754d6bc3aef4a1a7b5014e699346636
https://github.com/blankapp/ui/blob/3e9347658754d6bc3aef4a1a7b5014e699346636/docs/themes/landscape/source/fancybox/helpers/jquery.fancybox-media.js#L70-L86
train
buunguyen/mongoose-deep-populate
lib/plugin.js
createMongoosePromise
function createMongoosePromise(resolver) { var promise // mongoose 5 and up if (parseInt(mongoose.version) >= 5) { promise = new mongoose.Promise(resolver) } // mongoose 4.1 and up else if (mongoose.Promise.ES6) { promise = new mongoose.Promise.ES6(resolver) } // backward co...
javascript
function createMongoosePromise(resolver) { var promise // mongoose 5 and up if (parseInt(mongoose.version) >= 5) { promise = new mongoose.Promise(resolver) } // mongoose 4.1 and up else if (mongoose.Promise.ES6) { promise = new mongoose.Promise.ES6(resolver) } // backward co...
[ "function", "createMongoosePromise", "(", "resolver", ")", "{", "var", "promise", "// mongoose 5 and up", "if", "(", "parseInt", "(", "mongoose", ".", "version", ")", ">=", "5", ")", "{", "promise", "=", "new", "mongoose", ".", "Promise", "(", "resolver", ")...
Creates a Mongoose promise.
[ "Creates", "a", "Mongoose", "promise", "." ]
4f7ee2f47743b00eb6431512660d067bc481144c
https://github.com/buunguyen/mongoose-deep-populate/blob/4f7ee2f47743b00eb6431512660d067bc481144c/lib/plugin.js#L89-L107
train
buunguyen/mongoose-deep-populate
lib/plugin.js
deepPopulatePlugin
function deepPopulatePlugin(schema, defaultOptions) { schema._defaultDeepPopulateOptions = defaultOptions = defaultOptions || {} /** * Populates this document with the specified paths. * @param paths the paths to be populated. * @param options (optional) the population options. * @param cb ...
javascript
function deepPopulatePlugin(schema, defaultOptions) { schema._defaultDeepPopulateOptions = defaultOptions = defaultOptions || {} /** * Populates this document with the specified paths. * @param paths the paths to be populated. * @param options (optional) the population options. * @param cb ...
[ "function", "deepPopulatePlugin", "(", "schema", ",", "defaultOptions", ")", "{", "schema", ".", "_defaultDeepPopulateOptions", "=", "defaultOptions", "=", "defaultOptions", "||", "{", "}", "/**\n * Populates this document with the specified paths.\n * @param paths the pa...
Invoked by Mongoose to executes the plugin on the specified schema.
[ "Invoked", "by", "Mongoose", "to", "executes", "the", "plugin", "on", "the", "specified", "schema", "." ]
4f7ee2f47743b00eb6431512660d067bc481144c
https://github.com/buunguyen/mongoose-deep-populate/blob/4f7ee2f47743b00eb6431512660d067bc481144c/lib/plugin.js#L112-L158
train
benjamn/reify
lib/utils.js
findPossibleIndexes
function findPossibleIndexes(code, identifiers, filter) { const possibleIndexes = []; if (identifiers.length === 0) { return possibleIndexes; } const pattern = new RegExp( "\\b(?:" + identifiers.join("|") + ")\\b", "g" ); let match; pattern.lastIndex = 0; while ((match = pattern.exec(code...
javascript
function findPossibleIndexes(code, identifiers, filter) { const possibleIndexes = []; if (identifiers.length === 0) { return possibleIndexes; } const pattern = new RegExp( "\\b(?:" + identifiers.join("|") + ")\\b", "g" ); let match; pattern.lastIndex = 0; while ((match = pattern.exec(code...
[ "function", "findPossibleIndexes", "(", "code", ",", "identifiers", ",", "filter", ")", "{", "const", "possibleIndexes", "=", "[", "]", ";", "if", "(", "identifiers", ".", "length", "===", "0", ")", "{", "return", "possibleIndexes", ";", "}", "const", "pat...
Returns a sorted array of possible indexes within the code string where any identifier in the identifiers array might appear. This information can be used to optimize AST traversal by allowing subtrees to be ignored if they don't contain any possible indexes.
[ "Returns", "a", "sorted", "array", "of", "possible", "indexes", "within", "the", "code", "string", "where", "any", "identifier", "in", "the", "identifiers", "array", "might", "appear", ".", "This", "information", "can", "be", "used", "to", "optimize", "AST", ...
9b7321db373a8e5cba3309c10fc42a63856d51c1
https://github.com/benjamn/reify/blob/9b7321db373a8e5cba3309c10fc42a63856d51c1/lib/utils.js#L98-L119
train
benjamn/reify
lib/runtime/index.js
moduleExport
function moduleExport(getters, constant) { utils.setESModule(this.exports); var entry = Entry.getOrCreate(this.id, this); entry.addGetters(getters, constant); if (this.loaded) { // If the module has already been evaluated, then we need to trigger // another round of entry.runSetters calls, which begins ...
javascript
function moduleExport(getters, constant) { utils.setESModule(this.exports); var entry = Entry.getOrCreate(this.id, this); entry.addGetters(getters, constant); if (this.loaded) { // If the module has already been evaluated, then we need to trigger // another round of entry.runSetters calls, which begins ...
[ "function", "moduleExport", "(", "getters", ",", "constant", ")", "{", "utils", ".", "setESModule", "(", "this", ".", "exports", ")", ";", "var", "entry", "=", "Entry", ".", "getOrCreate", "(", "this", ".", "id", ",", "this", ")", ";", "entry", ".", ...
Register getter functions for local variables in the scope of an export statement. Pass true as the second argument to indicate that the getter functions always return the same values.
[ "Register", "getter", "functions", "for", "local", "variables", "in", "the", "scope", "of", "an", "export", "statement", ".", "Pass", "true", "as", "the", "second", "argument", "to", "indicate", "that", "the", "getter", "functions", "always", "return", "the", ...
9b7321db373a8e5cba3309c10fc42a63856d51c1
https://github.com/benjamn/reify/blob/9b7321db373a8e5cba3309c10fc42a63856d51c1/lib/runtime/index.js#L67-L77
train
zalando-incubator/tessellate
packages/tessellate-request/webpack.config.js
nodeModules
function nodeModules() { return fs.readdirSync('node_modules') .filter(dir => ['.bin'].indexOf(dir) === -1) .reduce((modules, m) => { modules[m] = 'commonjs2 ' + m return modules }, {}) }
javascript
function nodeModules() { return fs.readdirSync('node_modules') .filter(dir => ['.bin'].indexOf(dir) === -1) .reduce((modules, m) => { modules[m] = 'commonjs2 ' + m return modules }, {}) }
[ "function", "nodeModules", "(", ")", "{", "return", "fs", ".", "readdirSync", "(", "'node_modules'", ")", ".", "filter", "(", "dir", "=>", "[", "'.bin'", "]", ".", "indexOf", "(", "dir", ")", "===", "-", "1", ")", ".", "reduce", "(", "(", "modules", ...
Externalize node_modules.
[ "Externalize", "node_modules", "." ]
6f6528af24705bcb04789cc19b434a4eefe84a73
https://github.com/zalando-incubator/tessellate/blob/6f6528af24705bcb04789cc19b434a4eefe84a73/packages/tessellate-request/webpack.config.js#L8-L15
train
medikoo/cli-color
slice.js
function (seq, begin, end) { var sliced = seq.reduce( function (state, chunk) { var index = state.index; if (chunk instanceof Token) { var code = sgr.extractCode(chunk.token); if (index <= begin) { if (code in sgr.openers) { sgr.openStyle(state.preOpeners, code); } if (code in sg...
javascript
function (seq, begin, end) { var sliced = seq.reduce( function (state, chunk) { var index = state.index; if (chunk instanceof Token) { var code = sgr.extractCode(chunk.token); if (index <= begin) { if (code in sgr.openers) { sgr.openStyle(state.preOpeners, code); } if (code in sg...
[ "function", "(", "seq", ",", "begin", ",", "end", ")", "{", "var", "sliced", "=", "seq", ".", "reduce", "(", "function", "(", "state", ",", "chunk", ")", "{", "var", "index", "=", "state", ".", "index", ";", "if", "(", "chunk", "instanceof", "Token...
eslint-disable-next-line max-lines-per-function
[ "eslint", "-", "disable", "-", "next", "-", "line", "max", "-", "lines", "-", "per", "-", "function" ]
930da00833a387d7817564bb00c48966792d2896
https://github.com/medikoo/cli-color/blob/930da00833a387d7817564bb00c48966792d2896/slice.js#L43-L109
train
frontarm/mdx-util
packages/mdx.macro/mdx.macro.js
transform
function transform({ babel, filename, documentFilename }) { if (!filename) { throw new Error( `You must pass a filename to importMDX(). Please see the mdx.macro documentation`, ) } let documentPath = path.join(filename, '..', documentFilename); let imports = `import React from 'react'\nimport { MD...
javascript
function transform({ babel, filename, documentFilename }) { if (!filename) { throw new Error( `You must pass a filename to importMDX(). Please see the mdx.macro documentation`, ) } let documentPath = path.join(filename, '..', documentFilename); let imports = `import React from 'react'\nimport { MD...
[ "function", "transform", "(", "{", "babel", ",", "filename", ",", "documentFilename", "}", ")", "{", "if", "(", "!", "filename", ")", "{", "throw", "new", "Error", "(", "`", "`", ",", ")", "}", "let", "documentPath", "=", "path", ".", "join", "(", ...
Find the import filename,
[ "Find", "the", "import", "filename" ]
319228aa2bfd0e6ebf6bff38f7d73b8412933161
https://github.com/frontarm/mdx-util/blob/319228aa2bfd0e6ebf6bff38f7d73b8412933161/packages/mdx.macro/mdx.macro.js#L110-L137
train
frontarm/mdx-util
deprecated-packages/mdxc/src/jsx_inline.js
parseJSXContent
function parseJSXContent(state, start, type) { var text, result, max = state.posMax, prevPos, oldPos = state.pos; state.pos = start; while (state.pos < max) { text = state.src.slice(state.pos) result = JSX_INLINE_CLOSE_TAG_PARSER.parse(text) prevPos = state.pos; state.md...
javascript
function parseJSXContent(state, start, type) { var text, result, max = state.posMax, prevPos, oldPos = state.pos; state.pos = start; while (state.pos < max) { text = state.src.slice(state.pos) result = JSX_INLINE_CLOSE_TAG_PARSER.parse(text) prevPos = state.pos; state.md...
[ "function", "parseJSXContent", "(", "state", ",", "start", ",", "type", ")", "{", "var", "text", ",", "result", ",", "max", "=", "state", ".", "posMax", ",", "prevPos", ",", "oldPos", "=", "state", ".", "pos", ";", "state", ".", "pos", "=", "start", ...
Iterate through a JSX tag's content until the closing tag is found, making sure to skip nested JSX and to not match closing tags in code blocks.
[ "Iterate", "through", "a", "JSX", "tag", "s", "content", "until", "the", "closing", "tag", "is", "found", "making", "sure", "to", "skip", "nested", "JSX", "and", "to", "not", "match", "closing", "tags", "in", "code", "blocks", "." ]
319228aa2bfd0e6ebf6bff38f7d73b8412933161
https://github.com/frontarm/mdx-util/blob/319228aa2bfd0e6ebf6bff38f7d73b8412933161/deprecated-packages/mdxc/src/jsx_inline.js#L10-L35
train
fortunejs/fortune
lib/request/check_links.js
checkLinks
function checkLinks (transaction, record, fields, links, meta) { var Promise = promise.Promise var enforceLinks = this.options.settings.enforceLinks return Promise.all(map(links, function (field) { var ids = Array.isArray(record[field]) ? record[field] : !record.hasOwnProperty(field) || record[field] =...
javascript
function checkLinks (transaction, record, fields, links, meta) { var Promise = promise.Promise var enforceLinks = this.options.settings.enforceLinks return Promise.all(map(links, function (field) { var ids = Array.isArray(record[field]) ? record[field] : !record.hasOwnProperty(field) || record[field] =...
[ "function", "checkLinks", "(", "transaction", ",", "record", ",", "fields", ",", "links", ",", "meta", ")", "{", "var", "Promise", "=", "promise", ".", "Promise", "var", "enforceLinks", "=", "this", ".", "options", ".", "settings", ".", "enforceLinks", "re...
Ensure referential integrity by checking if related records exist. @param {Object} transaction @param {Object} record @param {Object} fields @param {String[]} links - An array of strings indicating which fields are links. Need to pass this so that it doesn't get computed each time. @param {Object} [meta] @return {Prom...
[ "Ensure", "referential", "integrity", "by", "checking", "if", "related", "records", "exist", "." ]
cccc0d1ba67916a97c3905dd30d3478265ba9ced
https://github.com/fortunejs/fortune/blob/cccc0d1ba67916a97c3905dd30d3478265ba9ced/lib/request/check_links.js#L32-L85
train
fortunejs/fortune
lib/request/update.js
validateUpdates
function validateUpdates (updates, meta) { var language = meta.language var i, j, update if (!updates || !updates.length) throw new BadRequestError( message('UpdateRecordsInvalid', language)) for (i = 0, j = updates.length; i < j; i++) { update = updates[i] if (!update[primaryKey]) thr...
javascript
function validateUpdates (updates, meta) { var language = meta.language var i, j, update if (!updates || !updates.length) throw new BadRequestError( message('UpdateRecordsInvalid', language)) for (i = 0, j = updates.length; i < j; i++) { update = updates[i] if (!update[primaryKey]) thr...
[ "function", "validateUpdates", "(", "updates", ",", "meta", ")", "{", "var", "language", "=", "meta", ".", "language", "var", "i", ",", "j", ",", "update", "if", "(", "!", "updates", "||", "!", "updates", ".", "length", ")", "throw", "new", "BadRequest...
Validate updates.
[ "Validate", "updates", "." ]
cccc0d1ba67916a97c3905dd30d3478265ba9ced
https://github.com/fortunejs/fortune/blob/cccc0d1ba67916a97c3905dd30d3478265ba9ced/lib/request/update.js#L363-L377
train
fortunejs/fortune
lib/adapter/singleton.js
AdapterSingleton
function AdapterSingleton (properties) { var CustomAdapter, input input = Array.isArray(properties.adapter) ? properties.adapter : [ properties.adapter ] if (typeof input[0] !== 'function') throw new TypeError('The adapter must be a function.') CustomAdapter = Adapter.prototype .isPrototypeOf(inp...
javascript
function AdapterSingleton (properties) { var CustomAdapter, input input = Array.isArray(properties.adapter) ? properties.adapter : [ properties.adapter ] if (typeof input[0] !== 'function') throw new TypeError('The adapter must be a function.') CustomAdapter = Adapter.prototype .isPrototypeOf(inp...
[ "function", "AdapterSingleton", "(", "properties", ")", "{", "var", "CustomAdapter", ",", "input", "input", "=", "Array", ".", "isArray", "(", "properties", ".", "adapter", ")", "?", "properties", ".", "adapter", ":", "[", "properties", ".", "adapter", "]", ...
A singleton for the adapter. For internal use.
[ "A", "singleton", "for", "the", "adapter", ".", "For", "internal", "use", "." ]
cccc0d1ba67916a97c3905dd30d3478265ba9ced
https://github.com/fortunejs/fortune/blob/cccc0d1ba67916a97c3905dd30d3478265ba9ced/lib/adapter/singleton.js#L13-L38
train
fortunejs/fortune
lib/record_type/validate.js
validateField
function validateField (fields, key) { var value = fields[key] = castShorthand(fields[key]) if (typeof value !== 'object') throw new TypeError('The definition of "' + key + '" must be an object.') if (key === primaryKey) throw new Error('Can not define primary key "' + primaryKey + '".') if (key in p...
javascript
function validateField (fields, key) { var value = fields[key] = castShorthand(fields[key]) if (typeof value !== 'object') throw new TypeError('The definition of "' + key + '" must be an object.') if (key === primaryKey) throw new Error('Can not define primary key "' + primaryKey + '".') if (key in p...
[ "function", "validateField", "(", "fields", ",", "key", ")", "{", "var", "value", "=", "fields", "[", "key", "]", "=", "castShorthand", "(", "fields", "[", "key", "]", ")", "if", "(", "typeof", "value", "!==", "'object'", ")", "throw", "new", "TypeErro...
Parse a field definition. @param {Object} fields @param {String} key
[ "Parse", "a", "field", "definition", "." ]
cccc0d1ba67916a97c3905dd30d3478265ba9ced
https://github.com/fortunejs/fortune/blob/cccc0d1ba67916a97c3905dd30d3478265ba9ced/lib/record_type/validate.js#L45-L111
train
fortunejs/fortune
lib/record_type/validate.js
castShorthand
function castShorthand (value) { var obj if (typeof value === 'string') obj = { link: value } else if (typeof value === 'function') obj = { type: value } else if (Array.isArray(value)) { obj = {} if (value[1]) obj.inverse = value[1] else obj.isArray = true // Extract type or link. if (Arr...
javascript
function castShorthand (value) { var obj if (typeof value === 'string') obj = { link: value } else if (typeof value === 'function') obj = { type: value } else if (Array.isArray(value)) { obj = {} if (value[1]) obj.inverse = value[1] else obj.isArray = true // Extract type or link. if (Arr...
[ "function", "castShorthand", "(", "value", ")", "{", "var", "obj", "if", "(", "typeof", "value", "===", "'string'", ")", "obj", "=", "{", "link", ":", "value", "}", "else", "if", "(", "typeof", "value", "===", "'function'", ")", "obj", "=", "{", "typ...
Cast shorthand definition to standard definition. @param {*} value @return {Object}
[ "Cast", "shorthand", "definition", "to", "standard", "definition", "." ]
cccc0d1ba67916a97c3905dd30d3478265ba9ced
https://github.com/fortunejs/fortune/blob/cccc0d1ba67916a97c3905dd30d3478265ba9ced/lib/record_type/validate.js#L120-L144
train
fortunejs/fortune
lib/common/message.js
message
function message (id, language, data) { var genericMessage = 'GenericError' var self = this || message var str, key, subtag if (!self.hasOwnProperty(language)) { subtag = language && language.match(/.+?(?=-)/) if (subtag) subtag = subtag[0] if (self.hasOwnProperty(subtag)) language = subtag els...
javascript
function message (id, language, data) { var genericMessage = 'GenericError' var self = this || message var str, key, subtag if (!self.hasOwnProperty(language)) { subtag = language && language.match(/.+?(?=-)/) if (subtag) subtag = subtag[0] if (self.hasOwnProperty(subtag)) language = subtag els...
[ "function", "message", "(", "id", ",", "language", ",", "data", ")", "{", "var", "genericMessage", "=", "'GenericError'", "var", "self", "=", "this", "||", "message", "var", "str", ",", "key", ",", "subtag", "if", "(", "!", "self", ".", "hasOwnProperty",...
Message function for i18n. @param {String} id @param {String} language @param {Object} [data] @return {String}
[ "Message", "function", "for", "i18n", "." ]
cccc0d1ba67916a97c3905dd30d3478265ba9ced
https://github.com/fortunejs/fortune/blob/cccc0d1ba67916a97c3905dd30d3478265ba9ced/lib/common/message.js#L22-L46
train
fortunejs/fortune
lib/common/deep_equal.js
deepEqual
function deepEqual (a, b) { var key, value, compare, aLength = 0, bLength = 0 // If they are the same object, don't need to go further. if (a === b) return true // Both objects must be defined. if (!a || !b) return false // Objects must be of the same type. if (a.prototype !== b.prototype) return false...
javascript
function deepEqual (a, b) { var key, value, compare, aLength = 0, bLength = 0 // If they are the same object, don't need to go further. if (a === b) return true // Both objects must be defined. if (!a || !b) return false // Objects must be of the same type. if (a.prototype !== b.prototype) return false...
[ "function", "deepEqual", "(", "a", ",", "b", ")", "{", "var", "key", ",", "value", ",", "compare", ",", "aLength", "=", "0", ",", "bLength", "=", "0", "// If they are the same object, don't need to go further.", "if", "(", "a", "===", "b", ")", "return", "...
A fast recursive equality check, which covers limited use cases. @param {Object} @param {Object} @return {Boolean}
[ "A", "fast", "recursive", "equality", "check", "which", "covers", "limited", "use", "cases", "." ]
cccc0d1ba67916a97c3905dd30d3478265ba9ced
https://github.com/fortunejs/fortune/blob/cccc0d1ba67916a97c3905dd30d3478265ba9ced/lib/common/deep_equal.js#L10-L53
train
mapbox/preprocessorcerer
preprocessors/togeojson-gpx.preprocessor.js
createIndices
function createIndices(callback) { const q = queue(); geojson_files.forEach((gj) => { q.defer(createIndex, gj); }); q.awaitAll((err) => { if (err) return callback(err); return callback(); }); }
javascript
function createIndices(callback) { const q = queue(); geojson_files.forEach((gj) => { q.defer(createIndex, gj); }); q.awaitAll((err) => { if (err) return callback(err); return callback(); }); }
[ "function", "createIndices", "(", "callback", ")", "{", "const", "q", "=", "queue", "(", ")", ";", "geojson_files", ".", "forEach", "(", "(", "gj", ")", "=>", "{", "q", ".", "defer", "(", "createIndex", ",", "gj", ")", ";", "}", ")", ";", "q", "....
create mapnik index for each geojson layer
[ "create", "mapnik", "index", "for", "each", "geojson", "layer" ]
9c0c3f6e8e33692792bd66ff1d4596f91aba1fa3
https://github.com/mapbox/preprocessorcerer/blob/9c0c3f6e8e33692792bd66ff1d4596f91aba1fa3/preprocessors/togeojson-gpx.preprocessor.js#L121-L131
train
mapbox/preprocessorcerer
preprocessors/togeojson-kml.preprocessor.js
archiveOriginal
function archiveOriginal(callback) { const archivedOriginal = path.join(outdirectory, '/archived.kml'); const infileContents = fs.readFileSync(infile); fs.writeFile(archivedOriginal, infileContents, (err) => { if (err) return callback(err); return callback(); }); }
javascript
function archiveOriginal(callback) { const archivedOriginal = path.join(outdirectory, '/archived.kml'); const infileContents = fs.readFileSync(infile); fs.writeFile(archivedOriginal, infileContents, (err) => { if (err) return callback(err); return callback(); }); }
[ "function", "archiveOriginal", "(", "callback", ")", "{", "const", "archivedOriginal", "=", "path", ".", "join", "(", "outdirectory", ",", "'/archived.kml'", ")", ";", "const", "infileContents", "=", "fs", ".", "readFileSync", "(", "infile", ")", ";", "fs", ...
Archive original kml file
[ "Archive", "original", "kml", "file" ]
9c0c3f6e8e33692792bd66ff1d4596f91aba1fa3
https://github.com/mapbox/preprocessorcerer/blob/9c0c3f6e8e33692792bd66ff1d4596f91aba1fa3/preprocessors/togeojson-kml.preprocessor.js#L121-L129
train
mapbox/preprocessorcerer
preprocessors/index.js
applicable
function applicable(filepath, info, callback) { const q = queue(); preprocessors.forEach((preprocessor) => { q.defer(preprocessor.criteria, filepath, info); }); q.awaitAll((err, results) => { if (err) return callback(err); callback(null, preprocessors.filter((preprocessor, i) => { return !!re...
javascript
function applicable(filepath, info, callback) { const q = queue(); preprocessors.forEach((preprocessor) => { q.defer(preprocessor.criteria, filepath, info); }); q.awaitAll((err, results) => { if (err) return callback(err); callback(null, preprocessors.filter((preprocessor, i) => { return !!re...
[ "function", "applicable", "(", "filepath", ",", "info", ",", "callback", ")", "{", "const", "q", "=", "queue", "(", ")", ";", "preprocessors", ".", "forEach", "(", "(", "preprocessor", ")", "=>", "{", "q", ".", "defer", "(", "preprocessor", ".", "crite...
A function that checks a file against each preprocessor's criteria callback returns only those applicable to this file
[ "A", "function", "that", "checks", "a", "file", "against", "each", "preprocessor", "s", "criteria", "callback", "returns", "only", "those", "applicable", "to", "this", "file" ]
9c0c3f6e8e33692792bd66ff1d4596f91aba1fa3
https://github.com/mapbox/preprocessorcerer/blob/9c0c3f6e8e33692792bd66ff1d4596f91aba1fa3/preprocessors/index.js#L39-L51
train
mapbox/preprocessorcerer
preprocessors/index.js
descriptions
function descriptions(filepath, info, callback) { applicable(filepath, info, (err, preprocessors) => { if (err) return callback(err); callback(null, preprocessors.map((preprocessor) => { return preprocessor.description; })); }); }
javascript
function descriptions(filepath, info, callback) { applicable(filepath, info, (err, preprocessors) => { if (err) return callback(err); callback(null, preprocessors.map((preprocessor) => { return preprocessor.description; })); }); }
[ "function", "descriptions", "(", "filepath", ",", "info", ",", "callback", ")", "{", "applicable", "(", "filepath", ",", "info", ",", "(", "err", ",", "preprocessors", ")", "=>", "{", "if", "(", "err", ")", "return", "callback", "(", "err", ")", ";", ...
Just maps applicable preprocessors into a list of descriptions
[ "Just", "maps", "applicable", "preprocessors", "into", "a", "list", "of", "descriptions" ]
9c0c3f6e8e33692792bd66ff1d4596f91aba1fa3
https://github.com/mapbox/preprocessorcerer/blob/9c0c3f6e8e33692792bd66ff1d4596f91aba1fa3/preprocessors/index.js#L54-L61
train
mapbox/preprocessorcerer
preprocessors/index.js
newfile
function newfile(filepath) { let dir = path.dirname(filepath); if (path.extname(filepath) === '.shp') dir = path.resolve(dir, '..'); const name = crypto.randomBytes(8).toString('hex'); return path.join(dir, name); }
javascript
function newfile(filepath) { let dir = path.dirname(filepath); if (path.extname(filepath) === '.shp') dir = path.resolve(dir, '..'); const name = crypto.randomBytes(8).toString('hex'); return path.join(dir, name); }
[ "function", "newfile", "(", "filepath", ")", "{", "let", "dir", "=", "path", ".", "dirname", "(", "filepath", ")", ";", "if", "(", "path", ".", "extname", "(", "filepath", ")", "===", "'.shp'", ")", "dir", "=", "path", ".", "resolve", "(", "dir", "...
A function that hands out a new filepath in the same directory as the given file
[ "A", "function", "that", "hands", "out", "a", "new", "filepath", "in", "the", "same", "directory", "as", "the", "given", "file" ]
9c0c3f6e8e33692792bd66ff1d4596f91aba1fa3
https://github.com/mapbox/preprocessorcerer/blob/9c0c3f6e8e33692792bd66ff1d4596f91aba1fa3/preprocessors/index.js#L64-L69
train