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
prebid/Prebid.js
modules/prebidServerBidAdapter/index.js
doBidderSync
function doBidderSync(type, url, bidder, done) { if (!url) { utils.logError(`No sync url for bidder "${bidder}": ${url}`); done(); } else if (type === 'image' || type === 'redirect') { utils.logMessage(`Invoking image pixel user sync for bidder: "${bidder}"`); utils.triggerPixel(url, done); } else...
javascript
function doBidderSync(type, url, bidder, done) { if (!url) { utils.logError(`No sync url for bidder "${bidder}": ${url}`); done(); } else if (type === 'image' || type === 'redirect') { utils.logMessage(`Invoking image pixel user sync for bidder: "${bidder}"`); utils.triggerPixel(url, done); } else...
[ "function", "doBidderSync", "(", "type", ",", "url", ",", "bidder", ",", "done", ")", "{", "if", "(", "!", "url", ")", "{", "utils", ".", "logError", "(", "`", "${", "bidder", "}", "${", "url", "}", "`", ")", ";", "done", "(", ")", ";", "}", ...
Run a cookie sync for the given type, url, and bidder @param {string} type the type of sync, "image", "redirect", "iframe" @param {string} url the url to sync @param {string} bidder name of bidder doing sync for @param {function} done an exit callback; to signify this pixel has either: finished rendering or something ...
[ "Run", "a", "cookie", "sync", "for", "the", "given", "type", "url", "and", "bidder" ]
bd1636ada243f30c309bd8212e4446d39d86659b
https://github.com/prebid/Prebid.js/blob/bd1636ada243f30c309bd8212e4446d39d86659b/modules/prebidServerBidAdapter/index.js#L205-L219
train
prebid/Prebid.js
modules/prebidServerBidAdapter/index.js
doClientSideSyncs
function doClientSideSyncs(bidders) { bidders.forEach(bidder => { let clientAdapter = adapterManager.getBidAdapter(bidder); if (clientAdapter && clientAdapter.registerSyncs) { clientAdapter.registerSyncs([]); } }); }
javascript
function doClientSideSyncs(bidders) { bidders.forEach(bidder => { let clientAdapter = adapterManager.getBidAdapter(bidder); if (clientAdapter && clientAdapter.registerSyncs) { clientAdapter.registerSyncs([]); } }); }
[ "function", "doClientSideSyncs", "(", "bidders", ")", "{", "bidders", ".", "forEach", "(", "bidder", "=>", "{", "let", "clientAdapter", "=", "adapterManager", ".", "getBidAdapter", "(", "bidder", ")", ";", "if", "(", "clientAdapter", "&&", "clientAdapter", "."...
Do client-side syncs for bidders. @param {Array} bidders a list of bidder names
[ "Do", "client", "-", "side", "syncs", "for", "bidders", "." ]
bd1636ada243f30c309bd8212e4446d39d86659b
https://github.com/prebid/Prebid.js/blob/bd1636ada243f30c309bd8212e4446d39d86659b/modules/prebidServerBidAdapter/index.js#L226-L233
train
prebid/Prebid.js
gulpHelpers.js
isModuleDirectory
function isModuleDirectory(filePath) { try { const manifestPath = path.join(filePath, MANIFEST); if (fs.statSync(manifestPath).isFile()) { const module = require(manifestPath); return module && module.main; } } catch (error) {} }
javascript
function isModuleDirectory(filePath) { try { const manifestPath = path.join(filePath, MANIFEST); if (fs.statSync(manifestPath).isFile()) { const module = require(manifestPath); return module && module.main; } } catch (error) {} }
[ "function", "isModuleDirectory", "(", "filePath", ")", "{", "try", "{", "const", "manifestPath", "=", "path", ".", "join", "(", "filePath", ",", "MANIFEST", ")", ";", "if", "(", "fs", ".", "statSync", "(", "manifestPath", ")", ".", "isFile", "(", ")", ...
get only subdirectories that contain package.json with 'main' property
[ "get", "only", "subdirectories", "that", "contain", "package", ".", "json", "with", "main", "property" ]
bd1636ada243f30c309bd8212e4446d39d86659b
https://github.com/prebid/Prebid.js/blob/bd1636ada243f30c309bd8212e4446d39d86659b/gulpHelpers.js#L16-L24
train
prebid/Prebid.js
modules/dfpAdServerVideo.js
buildUrlFromAdserverUrlComponents
function buildUrlFromAdserverUrlComponents(components, bid, options) { const descriptionUrl = getDescriptionUrl(bid, components, 'search'); if (descriptionUrl) { components.search.description_url = descriptionUrl; } const encodedCustomParams = getCustParams(bid, options); components.search.cust_params = (compo...
javascript
function buildUrlFromAdserverUrlComponents(components, bid, options) { const descriptionUrl = getDescriptionUrl(bid, components, 'search'); if (descriptionUrl) { components.search.description_url = descriptionUrl; } const encodedCustomParams = getCustParams(bid, options); components.search.cust_params = (compo...
[ "function", "buildUrlFromAdserverUrlComponents", "(", "components", ",", "bid", ",", "options", ")", "{", "const", "descriptionUrl", "=", "getDescriptionUrl", "(", "bid", ",", "components", ",", "'search'", ")", ";", "if", "(", "descriptionUrl", ")", "{", "compo...
Builds a video url from a base dfp video url and a winning bid, appending Prebid-specific key-values. @param {Object} components base video adserver url parsed into components object @param {AdapterBidResponse} bid winning bid object to append parameters from @param {Object} options Options which should be used to cons...
[ "Builds", "a", "video", "url", "from", "a", "base", "dfp", "video", "url", "and", "a", "winning", "bid", "appending", "Prebid", "-", "specific", "key", "-", "values", "." ]
bd1636ada243f30c309bd8212e4446d39d86659b
https://github.com/prebid/Prebid.js/blob/bd1636ada243f30c309bd8212e4446d39d86659b/modules/dfpAdServerVideo.js#L114-L122
train
prebid/Prebid.js
modules/dfpAdServerVideo.js
getDescriptionUrl
function getDescriptionUrl(bid, components, prop) { if (config.getConfig('cache.url')) { return; } if (!deepAccess(components, `${prop}.description_url`)) { const vastUrl = bid && bid.vastUrl; if (vastUrl) { return encodeURIComponent(vastUrl); } } else { logError(`input cannnot contain description_ur...
javascript
function getDescriptionUrl(bid, components, prop) { if (config.getConfig('cache.url')) { return; } if (!deepAccess(components, `${prop}.description_url`)) { const vastUrl = bid && bid.vastUrl; if (vastUrl) { return encodeURIComponent(vastUrl); } } else { logError(`input cannnot contain description_ur...
[ "function", "getDescriptionUrl", "(", "bid", ",", "components", ",", "prop", ")", "{", "if", "(", "config", ".", "getConfig", "(", "'cache.url'", ")", ")", "{", "return", ";", "}", "if", "(", "!", "deepAccess", "(", "components", ",", "`", "${", "prop"...
Returns the encoded vast url if it exists on a bid object, only if prebid-cache is disabled, and description_url is not already set on a given input @param {AdapterBidResponse} bid object to check for vast url @param {Object} components the object to check that description_url is NOT set on @param {string} prop the pro...
[ "Returns", "the", "encoded", "vast", "url", "if", "it", "exists", "on", "a", "bid", "object", "only", "if", "prebid", "-", "cache", "is", "disabled", "and", "description_url", "is", "not", "already", "set", "on", "a", "given", "input" ]
bd1636ada243f30c309bd8212e4446d39d86659b
https://github.com/prebid/Prebid.js/blob/bd1636ada243f30c309bd8212e4446d39d86659b/modules/dfpAdServerVideo.js#L132-L141
train
prebid/Prebid.js
modules/dfpAdServerVideo.js
getCustParams
function getCustParams(bid, options) { const adserverTargeting = (bid && bid.adserverTargeting) || {}; let allTargetingData = {}; const adUnit = options && options.adUnit; if (adUnit) { let allTargeting = targeting.getAllTargeting(adUnit.code); allTargetingData = (allTargeting) ? allTargeting[adUnit.co...
javascript
function getCustParams(bid, options) { const adserverTargeting = (bid && bid.adserverTargeting) || {}; let allTargetingData = {}; const adUnit = options && options.adUnit; if (adUnit) { let allTargeting = targeting.getAllTargeting(adUnit.code); allTargetingData = (allTargeting) ? allTargeting[adUnit.co...
[ "function", "getCustParams", "(", "bid", ",", "options", ")", "{", "const", "adserverTargeting", "=", "(", "bid", "&&", "bid", ".", "adserverTargeting", ")", "||", "{", "}", ";", "let", "allTargetingData", "=", "{", "}", ";", "const", "adUnit", "=", "opt...
Returns the encoded `cust_params` from the bid.adserverTargeting and adds the `hb_uuid`, and `hb_cache_id`. Optionally the options.params.cust_params @param {AdapterBidResponse} bid @param {Object} options this is the options passed in from the `buildDfpVideoUrl` function @return {Object} Encoded key value pairs for cu...
[ "Returns", "the", "encoded", "cust_params", "from", "the", "bid", ".", "adserverTargeting", "and", "adds", "the", "hb_uuid", "and", "hb_cache_id", ".", "Optionally", "the", "options", ".", "params", ".", "cust_params" ]
bd1636ada243f30c309bd8212e4446d39d86659b
https://github.com/prebid/Prebid.js/blob/bd1636ada243f30c309bd8212e4446d39d86659b/modules/dfpAdServerVideo.js#L149-L170
train
prebid/Prebid.js
modules/pubCommonId.js
readValue
function readValue(name) { let value; if (pubcidConfig.typeEnabled === COOKIE) { value = getCookie(name); } else if (pubcidConfig.typeEnabled === LOCAL_STORAGE) { value = getStorageItem(name); if (!value) { value = getCookie(name); } } if (value === 'undefined' || value === 'null') { re...
javascript
function readValue(name) { let value; if (pubcidConfig.typeEnabled === COOKIE) { value = getCookie(name); } else if (pubcidConfig.typeEnabled === LOCAL_STORAGE) { value = getStorageItem(name); if (!value) { value = getCookie(name); } } if (value === 'undefined' || value === 'null') { re...
[ "function", "readValue", "(", "name", ")", "{", "let", "value", ";", "if", "(", "pubcidConfig", ".", "typeEnabled", "===", "COOKIE", ")", "{", "value", "=", "getCookie", "(", "name", ")", ";", "}", "else", "if", "(", "pubcidConfig", ".", "typeEnabled", ...
Read a value either from cookie or local storage @param {string} name Name of the item @returns {string|null} a string if item exists
[ "Read", "a", "value", "either", "from", "cookie", "or", "local", "storage" ]
bd1636ada243f30c309bd8212e4446d39d86659b
https://github.com/prebid/Prebid.js/blob/bd1636ada243f30c309bd8212e4446d39d86659b/modules/pubCommonId.js#L94-L108
train
prebid/Prebid.js
modules/pubCommonId.js
writeValue
function writeValue(name, value, expInterval) { if (name && value) { if (pubcidConfig.typeEnabled === COOKIE) { setCookie(name, value, expInterval); } else if (pubcidConfig.typeEnabled === LOCAL_STORAGE) { setStorageItem(name, value, expInterval); } } }
javascript
function writeValue(name, value, expInterval) { if (name && value) { if (pubcidConfig.typeEnabled === COOKIE) { setCookie(name, value, expInterval); } else if (pubcidConfig.typeEnabled === LOCAL_STORAGE) { setStorageItem(name, value, expInterval); } } }
[ "function", "writeValue", "(", "name", ",", "value", ",", "expInterval", ")", "{", "if", "(", "name", "&&", "value", ")", "{", "if", "(", "pubcidConfig", ".", "typeEnabled", "===", "COOKIE", ")", "{", "setCookie", "(", "name", ",", "value", ",", "expIn...
Write a value to either cookies or local storage @param {string} name Name of the item @param {string} value Value to be stored @param {number} expInterval Expiry time in minutes
[ "Write", "a", "value", "to", "either", "cookies", "or", "local", "storage" ]
bd1636ada243f30c309bd8212e4446d39d86659b
https://github.com/prebid/Prebid.js/blob/bd1636ada243f30c309bd8212e4446d39d86659b/modules/pubCommonId.js#L116-L124
train
Codeception/CodeceptJS
lib/pause.js
function () { next = false; // add listener to all next steps to provide next() functionality event.dispatcher.on(event.step.after, () => { recorder.add('Start next pause session', () => { if (!next) return; return pauseSession(); }); }); recorder.add('Start new session', pauseSession); }
javascript
function () { next = false; // add listener to all next steps to provide next() functionality event.dispatcher.on(event.step.after, () => { recorder.add('Start next pause session', () => { if (!next) return; return pauseSession(); }); }); recorder.add('Start new session', pauseSession); }
[ "function", "(", ")", "{", "next", "=", "false", ";", "// add listener to all next steps to provide next() functionality", "event", ".", "dispatcher", ".", "on", "(", "event", ".", "step", ".", "after", ",", "(", ")", "=>", "{", "recorder", ".", "add", "(", ...
Pauses test execution and starts interactive shell
[ "Pauses", "test", "execution", "and", "starts", "interactive", "shell" ]
314fcc13ed4ddbe80f8af3b6fb44712ff3aee12d
https://github.com/Codeception/CodeceptJS/blob/314fcc13ed4ddbe80f8af3b6fb44712ff3aee12d/lib/pause.js#L19-L29
train
Codeception/CodeceptJS
lib/colorUtils.js
convertColorToRGBA
function convertColorToRGBA(color) { const cstr = `${color}`.toLowerCase().trim() || ''; if (!/^rgba?\(.+?\)$/.test(cstr)) { // Convert both color names and hex colors to rgba const hexColor = convertColorNameToHex(color); return convertHexColorToRgba(hexColor); } // Convert rgb to rgba const ch...
javascript
function convertColorToRGBA(color) { const cstr = `${color}`.toLowerCase().trim() || ''; if (!/^rgba?\(.+?\)$/.test(cstr)) { // Convert both color names and hex colors to rgba const hexColor = convertColorNameToHex(color); return convertHexColorToRgba(hexColor); } // Convert rgb to rgba const ch...
[ "function", "convertColorToRGBA", "(", "color", ")", "{", "const", "cstr", "=", "`", "${", "color", "}", "`", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", "||", "''", ";", "if", "(", "!", "/", "^rgba?\\(.+?\\)$", "/", ".", "test", "(", "cst...
Convert a colour to a normalised RGBA format Required due to the different color formats returned by different web drivers. Examples: rgb(85,0,0) => rgba(85, 0, 0, 1) @param {string} color Color as a string, i.e. rgb(85,0,0)
[ "Convert", "a", "colour", "to", "a", "normalised", "RGBA", "format", "Required", "due", "to", "the", "different", "color", "formats", "returned", "by", "different", "web", "drivers", "." ]
314fcc13ed4ddbe80f8af3b6fb44712ff3aee12d
https://github.com/Codeception/CodeceptJS/blob/314fcc13ed4ddbe80f8af3b6fb44712ff3aee12d/lib/colorUtils.js#L194-L219
train
Codeception/CodeceptJS
lib/command/run-multiple.js
replaceValue
function replaceValue(obj, key, value) { if (!obj) return; if (obj instanceof Array) { for (const i in obj) { replaceValue(obj[i], key, value); } } if (obj[key]) obj[key] = value; if (typeof obj === 'object' && obj !== null) { const children = Object.keys(obj); for (let childIndex = 0; c...
javascript
function replaceValue(obj, key, value) { if (!obj) return; if (obj instanceof Array) { for (const i in obj) { replaceValue(obj[i], key, value); } } if (obj[key]) obj[key] = value; if (typeof obj === 'object' && obj !== null) { const children = Object.keys(obj); for (let childIndex = 0; c...
[ "function", "replaceValue", "(", "obj", ",", "key", ",", "value", ")", "{", "if", "(", "!", "obj", ")", "return", ";", "if", "(", "obj", "instanceof", "Array", ")", "{", "for", "(", "const", "i", "in", "obj", ")", "{", "replaceValue", "(", "obj", ...
search key in object recursive and replace value in it
[ "search", "key", "in", "object", "recursive", "and", "replace", "value", "in", "it" ]
314fcc13ed4ddbe80f8af3b6fb44712ff3aee12d
https://github.com/Codeception/CodeceptJS/blob/314fcc13ed4ddbe80f8af3b6fb44712ff3aee12d/lib/command/run-multiple.js#L186-L201
train
Codeception/CodeceptJS
lib/assert/error.js
AssertionFailedError
function AssertionFailedError(params, template) { this.params = params; this.template = template; // this.message = "AssertionFailedError"; let stack = new Error().stack; // this.showDiff = true; stack = stack ? stack.split('\n').filter(line => // @todo cut assert things nicer line.indexOf('lib/asse...
javascript
function AssertionFailedError(params, template) { this.params = params; this.template = template; // this.message = "AssertionFailedError"; let stack = new Error().stack; // this.showDiff = true; stack = stack ? stack.split('\n').filter(line => // @todo cut assert things nicer line.indexOf('lib/asse...
[ "function", "AssertionFailedError", "(", "params", ",", "template", ")", "{", "this", ".", "params", "=", "params", ";", "this", ".", "template", "=", "template", ";", "// this.message = \"AssertionFailedError\";", "let", "stack", "=", "new", "Error", "(", ")", ...
Assertion errors, can provide a detailed error messages. inspect() and cliMessage() added to display errors with params.
[ "Assertion", "errors", "can", "provide", "a", "detailed", "error", "messages", "." ]
314fcc13ed4ddbe80f8af3b6fb44712ff3aee12d
https://github.com/Codeception/CodeceptJS/blob/314fcc13ed4ddbe80f8af3b6fb44712ff3aee12d/lib/assert/error.js#L8-L29
train
Codeception/CodeceptJS
lib/helper/Appium.js
onlyForApps
function onlyForApps(expectedPlatform) { const stack = new Error().stack || ''; const re = /Appium.(\w+)/g; const caller = stack.split('\n')[2].trim(); const m = re.exec(caller); if (!m) { throw new Error(`Invalid caller ${caller}`); } const callerName = m[1] || m[2]; if (!expectedPlatform) { ...
javascript
function onlyForApps(expectedPlatform) { const stack = new Error().stack || ''; const re = /Appium.(\w+)/g; const caller = stack.split('\n')[2].trim(); const m = re.exec(caller); if (!m) { throw new Error(`Invalid caller ${caller}`); } const callerName = m[1] || m[2]; if (!expectedPlatform) { ...
[ "function", "onlyForApps", "(", "expectedPlatform", ")", "{", "const", "stack", "=", "new", "Error", "(", ")", ".", "stack", "||", "''", ";", "const", "re", "=", "/", "Appium.(\\w+)", "/", "g", ";", "const", "caller", "=", "stack", ".", "split", "(", ...
in the end of a file
[ "in", "the", "end", "of", "a", "file" ]
314fcc13ed4ddbe80f8af3b6fb44712ff3aee12d
https://github.com/Codeception/CodeceptJS/blob/314fcc13ed4ddbe80f8af3b6fb44712ff3aee12d/lib/helper/Appium.js#L1433-L1451
train
kangax/html-minifier
benchmark.js
function(done) { gzip(info.filePath, info.gzFilePath, function() { info.gzTime = Date.now(); // Open and read the size of the minified+gzip output readSize(info.gzFilePath, function(size) { info.gzSize = size; done(); }); })...
javascript
function(done) { gzip(info.filePath, info.gzFilePath, function() { info.gzTime = Date.now(); // Open and read the size of the minified+gzip output readSize(info.gzFilePath, function(size) { info.gzSize = size; done(); }); })...
[ "function", "(", "done", ")", "{", "gzip", "(", "info", ".", "filePath", ",", "info", ".", "gzFilePath", ",", "function", "(", ")", "{", "info", ".", "gzTime", "=", "Date", ".", "now", "(", ")", ";", "// Open and read the size of the minified+gzip output", ...
Apply Gzip on minified output
[ "Apply", "Gzip", "on", "minified", "output" ]
51ce10f4daedb1de483ffbcccecc41be1c873da2
https://github.com/kangax/html-minifier/blob/51ce10f4daedb1de483ffbcccecc41be1c873da2/benchmark.js#L226-L235
train
kangax/html-minifier
benchmark.js
function(done) { readBuffer(info.filePath, function(data) { lzma.compress(data, 1, function(result, error) { if (error) { throw error; } writeBuffer(info.lzFilePath, new Buffer(result), function() { info.lzTime = Date.now();...
javascript
function(done) { readBuffer(info.filePath, function(data) { lzma.compress(data, 1, function(result, error) { if (error) { throw error; } writeBuffer(info.lzFilePath, new Buffer(result), function() { info.lzTime = Date.now();...
[ "function", "(", "done", ")", "{", "readBuffer", "(", "info", ".", "filePath", ",", "function", "(", "data", ")", "{", "lzma", ".", "compress", "(", "data", ",", "1", ",", "function", "(", "result", ",", "error", ")", "{", "if", "(", "error", ")", ...
Apply LZMA on minified output
[ "Apply", "LZMA", "on", "minified", "output" ]
51ce10f4daedb1de483ffbcccecc41be1c873da2
https://github.com/kangax/html-minifier/blob/51ce10f4daedb1de483ffbcccecc41be1c873da2/benchmark.js#L237-L253
train
kangax/html-minifier
src/htmlminifier.js
trimTrailingWhitespace
function trimTrailingWhitespace(index, nextTag) { for (var endTag = null; index >= 0 && _canTrimWhitespace(endTag); index--) { var str = buffer[index]; var match = str.match(/^<\/([\w:-]+)>$/); if (match) { endTag = match[1]; } else if (/>$/.test(str) || (buffer[index] = collap...
javascript
function trimTrailingWhitespace(index, nextTag) { for (var endTag = null; index >= 0 && _canTrimWhitespace(endTag); index--) { var str = buffer[index]; var match = str.match(/^<\/([\w:-]+)>$/); if (match) { endTag = match[1]; } else if (/>$/.test(str) || (buffer[index] = collap...
[ "function", "trimTrailingWhitespace", "(", "index", ",", "nextTag", ")", "{", "for", "(", "var", "endTag", "=", "null", ";", "index", ">=", "0", "&&", "_canTrimWhitespace", "(", "endTag", ")", ";", "index", "--", ")", "{", "var", "str", "=", "buffer", ...
look for trailing whitespaces, bypass any inline tags
[ "look", "for", "trailing", "whitespaces", "bypass", "any", "inline", "tags" ]
51ce10f4daedb1de483ffbcccecc41be1c873da2
https://github.com/kangax/html-minifier/blob/51ce10f4daedb1de483ffbcccecc41be1c873da2/src/htmlminifier.js#L953-L964
train
kangax/html-minifier
src/htmlminifier.js
squashTrailingWhitespace
function squashTrailingWhitespace(nextTag) { var charsIndex = buffer.length - 1; if (buffer.length > 1) { var item = buffer[buffer.length - 1]; if (/^(?:<!|$)/.test(item) && item.indexOf(uidIgnore) === -1) { charsIndex--; } } trimTrailingWhitespace(charsIndex, nextTag); }
javascript
function squashTrailingWhitespace(nextTag) { var charsIndex = buffer.length - 1; if (buffer.length > 1) { var item = buffer[buffer.length - 1]; if (/^(?:<!|$)/.test(item) && item.indexOf(uidIgnore) === -1) { charsIndex--; } } trimTrailingWhitespace(charsIndex, nextTag); }
[ "function", "squashTrailingWhitespace", "(", "nextTag", ")", "{", "var", "charsIndex", "=", "buffer", ".", "length", "-", "1", ";", "if", "(", "buffer", ".", "length", ">", "1", ")", "{", "var", "item", "=", "buffer", "[", "buffer", ".", "length", "-",...
look for trailing whitespaces from previously processed text which may not be trimmed due to a following comment or an empty element which has now been removed
[ "look", "for", "trailing", "whitespaces", "from", "previously", "processed", "text", "which", "may", "not", "be", "trimmed", "due", "to", "a", "following", "comment", "or", "an", "empty", "element", "which", "has", "now", "been", "removed" ]
51ce10f4daedb1de483ffbcccecc41be1c873da2
https://github.com/kangax/html-minifier/blob/51ce10f4daedb1de483ffbcccecc41be1c873da2/src/htmlminifier.js#L969-L978
train
developit/preact-cli
packages/cli/lib/lib/webpack/run-webpack.js
stripLoaderPrefix
function stripLoaderPrefix(str) { if (typeof str === 'string') { str = str.replace( /(?:(\()|(^|\b|@))(\.\/~|\.{0,2}\/(?:[^\s]+\/)?node_modules)\/\w+-loader(\/[^?!]+)?(\?\?[\w_.-]+|\?({[\s\S]*?})?)?!/g, '$1' ); str = str.replace(/(\.?\.?(?:\/[^/ ]+)+)\s+\(\1\)/g, '$1'); str = replaceAll(str, process.cwd(...
javascript
function stripLoaderPrefix(str) { if (typeof str === 'string') { str = str.replace( /(?:(\()|(^|\b|@))(\.\/~|\.{0,2}\/(?:[^\s]+\/)?node_modules)\/\w+-loader(\/[^?!]+)?(\?\?[\w_.-]+|\?({[\s\S]*?})?)?!/g, '$1' ); str = str.replace(/(\.?\.?(?:\/[^/ ]+)+)\s+\(\1\)/g, '$1'); str = replaceAll(str, process.cwd(...
[ "function", "stripLoaderPrefix", "(", "str", ")", "{", "if", "(", "typeof", "str", "===", "'string'", ")", "{", "str", "=", "str", ".", "replace", "(", "/", "(?:(\\()|(^|\\b|@))(\\.\\/~|\\.{0,2}\\/(?:[^\\s]+\\/)?node_modules)\\/\\w+-loader(\\/[^?!]+)?(\\?\\?[\\w_.-]+|\\?({[...
Removes all loaders from any resource identifiers found in a string
[ "Removes", "all", "loaders", "from", "any", "resource", "identifiers", "found", "in", "a", "string" ]
a5968ebab794c363883ca71a053d6ce7d75abe06
https://github.com/developit/preact-cli/blob/a5968ebab794c363883ca71a053d6ce7d75abe06/packages/cli/lib/lib/webpack/run-webpack.js#L199-L210
train
cssnano/cssnano
packages/postcss-merge-rules/src/index.js
intersect
function intersect(a, b, not) { return a.filter((c) => { const index = ~indexOfDeclaration(b, c); return not ? !index : index; }); }
javascript
function intersect(a, b, not) { return a.filter((c) => { const index = ~indexOfDeclaration(b, c); return not ? !index : index; }); }
[ "function", "intersect", "(", "a", ",", "b", ",", "not", ")", "{", "return", "a", ".", "filter", "(", "(", "c", ")", "=>", "{", "const", "index", "=", "~", "indexOfDeclaration", "(", "b", ",", "c", ")", ";", "return", "not", "?", "!", "index", ...
Returns filtered array of matched or unmatched declarations @param {postcss.Declaration[]} a @param {postcss.Declaration[]} b @param {boolean} [not=false] @return {postcss.Declaration[]}
[ "Returns", "filtered", "array", "of", "matched", "or", "unmatched", "declarations" ]
29bf15a0d83b8e4b799dd07de70e1ef16dcfce74
https://github.com/cssnano/cssnano/blob/29bf15a0d83b8e4b799dd07de70e1ef16dcfce74/packages/postcss-merge-rules/src/index.js#L37-L42
train
cssnano/cssnano
packages/postcss-merge-rules/src/lib/ensureCompatibility.js
isSupportedCached
function isSupportedCached(feature, browsers) { const key = JSON.stringify({ feature, browsers }); let result = isSupportedCache[key]; if (!result) { result = isSupported(feature, browsers); isSupportedCache[key] = result; } return result; }
javascript
function isSupportedCached(feature, browsers) { const key = JSON.stringify({ feature, browsers }); let result = isSupportedCache[key]; if (!result) { result = isSupported(feature, browsers); isSupportedCache[key] = result; } return result; }
[ "function", "isSupportedCached", "(", "feature", ",", "browsers", ")", "{", "const", "key", "=", "JSON", ".", "stringify", "(", "{", "feature", ",", "browsers", "}", ")", ";", "let", "result", "=", "isSupportedCache", "[", "key", "]", ";", "if", "(", "...
Move to util in future
[ "Move", "to", "util", "in", "future" ]
29bf15a0d83b8e4b799dd07de70e1ef16dcfce74
https://github.com/cssnano/cssnano/blob/29bf15a0d83b8e4b799dd07de70e1ef16dcfce74/packages/postcss-merge-rules/src/lib/ensureCompatibility.js#L66-L76
train
cssnano/cssnano
packages/postcss-merge-longhand/src/lib/decl/columns.js
normalize
function normalize(values) { if (values[0].toLowerCase() === auto) { return values[1]; } if (values[1].toLowerCase() === auto) { return values[0]; } if ( values[0].toLowerCase() === inherit && values[1].toLowerCase() === inherit ) { return inherit; } return values.join(' '); }
javascript
function normalize(values) { if (values[0].toLowerCase() === auto) { return values[1]; } if (values[1].toLowerCase() === auto) { return values[0]; } if ( values[0].toLowerCase() === inherit && values[1].toLowerCase() === inherit ) { return inherit; } return values.join(' '); }
[ "function", "normalize", "(", "values", ")", "{", "if", "(", "values", "[", "0", "]", ".", "toLowerCase", "(", ")", "===", "auto", ")", "{", "return", "values", "[", "1", "]", ";", "}", "if", "(", "values", "[", "1", "]", ".", "toLowerCase", "(",...
Normalize a columns shorthand definition. Both of the longhand properties' initial values are 'auto', and as per the spec, omitted values are set to their initial values. Thus, we can remove any 'auto' definition when there are two values. Specification link: https://www.w3.org/TR/css3-multicol/
[ "Normalize", "a", "columns", "shorthand", "definition", ".", "Both", "of", "the", "longhand", "properties", "initial", "values", "are", "auto", "and", "as", "per", "the", "spec", "omitted", "values", "are", "set", "to", "their", "initial", "values", ".", "Th...
29bf15a0d83b8e4b799dd07de70e1ef16dcfce74
https://github.com/cssnano/cssnano/blob/29bf15a0d83b8e4b799dd07de70e1ef16dcfce74/packages/postcss-merge-longhand/src/lib/decl/columns.js#L26-L43
train
cssnano/cssnano
packages/postcss-discard-unused/src/index.js
filterFont
function filterFont({ atRules, values }) { values = uniqs(values); atRules.forEach((r) => { const families = r.nodes.filter(({ prop }) => prop === 'font-family'); // Discard the @font-face if it has no font-family if (!families.length) { return r.remove(); } families.forEach((family) => ...
javascript
function filterFont({ atRules, values }) { values = uniqs(values); atRules.forEach((r) => { const families = r.nodes.filter(({ prop }) => prop === 'font-family'); // Discard the @font-face if it has no font-family if (!families.length) { return r.remove(); } families.forEach((family) => ...
[ "function", "filterFont", "(", "{", "atRules", ",", "values", "}", ")", "{", "values", "=", "uniqs", "(", "values", ")", ";", "atRules", ".", "forEach", "(", "(", "r", ")", "=>", "{", "const", "families", "=", "r", ".", "nodes", ".", "filter", "(",...
fonts have slightly different logic
[ "fonts", "have", "slightly", "different", "logic" ]
29bf15a0d83b8e4b799dd07de70e1ef16dcfce74
https://github.com/cssnano/cssnano/blob/29bf15a0d83b8e4b799dd07de70e1ef16dcfce74/packages/postcss-discard-unused/src/index.js#L48-L64
train
jaredhanson/passport
lib/strategies/session.js
SessionStrategy
function SessionStrategy(options, deserializeUser) { if (typeof options == 'function') { deserializeUser = options; options = undefined; } options = options || {}; Strategy.call(this); this.name = 'session'; this._deserializeUser = deserializeUser; }
javascript
function SessionStrategy(options, deserializeUser) { if (typeof options == 'function') { deserializeUser = options; options = undefined; } options = options || {}; Strategy.call(this); this.name = 'session'; this._deserializeUser = deserializeUser; }
[ "function", "SessionStrategy", "(", "options", ",", "deserializeUser", ")", "{", "if", "(", "typeof", "options", "==", "'function'", ")", "{", "deserializeUser", "=", "options", ";", "options", "=", "undefined", ";", "}", "options", "=", "options", "||", "{"...
`SessionStrategy` constructor. @api public
[ "SessionStrategy", "constructor", "." ]
882d65e69d5b56c6b88dd0248891af9e0d80244b
https://github.com/jaredhanson/passport/blob/882d65e69d5b56c6b88dd0248891af9e0d80244b/lib/strategies/session.js#L14-L24
train
jaredhanson/passport
lib/authenticator.js
Authenticator
function Authenticator() { this._key = 'passport'; this._strategies = {}; this._serializers = []; this._deserializers = []; this._infoTransformers = []; this._framework = null; this._userProperty = 'user'; this.init(); }
javascript
function Authenticator() { this._key = 'passport'; this._strategies = {}; this._serializers = []; this._deserializers = []; this._infoTransformers = []; this._framework = null; this._userProperty = 'user'; this.init(); }
[ "function", "Authenticator", "(", ")", "{", "this", ".", "_key", "=", "'passport'", ";", "this", ".", "_strategies", "=", "{", "}", ";", "this", ".", "_serializers", "=", "[", "]", ";", "this", ".", "_deserializers", "=", "[", "]", ";", "this", ".", ...
`Authenticator` constructor. @api public
[ "Authenticator", "constructor", "." ]
882d65e69d5b56c6b88dd0248891af9e0d80244b
https://github.com/jaredhanson/passport/blob/882d65e69d5b56c6b88dd0248891af9e0d80244b/lib/authenticator.js#L13-L23
train
Microsoft/botbuilder-tools
packages/LUIS/bin/help.js
getHelpContents
async function getHelpContents(args, output) { if ('!' in args) { return getAllCommands(process.stdout); } if (args._.length == 0) { return getGeneralHelpContents(output); } else if (args._.length == 1) { return getVerbHelp(args._[0], output); } else if (args._.length >=...
javascript
async function getHelpContents(args, output) { if ('!' in args) { return getAllCommands(process.stdout); } if (args._.length == 0) { return getGeneralHelpContents(output); } else if (args._.length == 1) { return getVerbHelp(args._[0], output); } else if (args._.length >=...
[ "async", "function", "getHelpContents", "(", "args", ",", "output", ")", "{", "if", "(", "'!'", "in", "args", ")", "{", "return", "getAllCommands", "(", "process", ".", "stdout", ")", ";", "}", "if", "(", "args", ".", "_", ".", "length", "==", "0", ...
Retrieves help content vie the luis.json from the arguments input by the user. @param args The arguments input by the user @returns {Promise<*>}1]
[ "Retrieves", "help", "content", "vie", "the", "luis", ".", "json", "from", "the", "arguments", "input", "by", "the", "user", "." ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/LUIS/bin/help.js#L78-L100
train
Microsoft/botbuilder-tools
packages/LUIS/bin/help.js
getGeneralHelpContents
function getGeneralHelpContents() { let options = { head: chalk.bold(`Available actions are:`), table: [ [chalk.cyan.bold("add"), "add a resource"], [chalk.cyan.bold("clone"), "clone a resource"], [chalk.cyan.bold("delete"), "delete a resource"], [chal...
javascript
function getGeneralHelpContents() { let options = { head: chalk.bold(`Available actions are:`), table: [ [chalk.cyan.bold("add"), "add a resource"], [chalk.cyan.bold("clone"), "clone a resource"], [chalk.cyan.bold("delete"), "delete a resource"], [chal...
[ "function", "getGeneralHelpContents", "(", ")", "{", "let", "options", "=", "{", "head", ":", "chalk", ".", "bold", "(", "`", "`", ")", ",", "table", ":", "[", "[", "chalk", ".", "cyan", ".", "bold", "(", "\"add\"", ")", ",", "\"add a resource\"", "]...
General help contents @returns {*[]}
[ "General", "help", "contents" ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/LUIS/bin/help.js#L133-L161
train
Microsoft/botbuilder-tools
packages/LUIS/bin/help.js
getAllCommands
function getAllCommands() { let resourceTypes = []; let tables = {}; operations.forEach((operation) => { let opCategory = operation.target[0]; if (resourceTypes.indexOf(opCategory) < 0) { resourceTypes.push(opCategory); tables[opCategory] = []; } table...
javascript
function getAllCommands() { let resourceTypes = []; let tables = {}; operations.forEach((operation) => { let opCategory = operation.target[0]; if (resourceTypes.indexOf(opCategory) < 0) { resourceTypes.push(opCategory); tables[opCategory] = []; } table...
[ "function", "getAllCommands", "(", ")", "{", "let", "resourceTypes", "=", "[", "]", ";", "let", "tables", "=", "{", "}", ";", "operations", ".", "forEach", "(", "(", "operation", ")", "=>", "{", "let", "opCategory", "=", "operation", ".", "target", "["...
Walks the luis.json and pulls out all commands that are supported. @returns {*[]}
[ "Walks", "the", "luis", ".", "json", "and", "pulls", "out", "all", "commands", "that", "are", "supported", "." ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/LUIS/bin/help.js#L239-L263
train
Microsoft/botbuilder-tools
packages/LUIS/bin/luis.js
getFileInput
async function getFileInput(args) { if (typeof args.in !== 'string') { return null; } // Let any errors fall through to the runProgram() promise return JSON.parse(await txtfile.read(path.resolve(args.in))); }
javascript
async function getFileInput(args) { if (typeof args.in !== 'string') { return null; } // Let any errors fall through to the runProgram() promise return JSON.parse(await txtfile.read(path.resolve(args.in))); }
[ "async", "function", "getFileInput", "(", "args", ")", "{", "if", "(", "typeof", "args", ".", "in", "!==", "'string'", ")", "{", "return", "null", ";", "}", "// Let any errors fall through to the runProgram() promise", "return", "JSON", ".", "parse", "(", "await...
Retrieves the input file to send as the body of the request. @param args @returns {Promise<*>}
[ "Retrieves", "the", "input", "file", "to", "send", "as", "the", "body", "of", "the", "request", "." ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/LUIS/bin/luis.js#L898-L904
train
Microsoft/botbuilder-tools
packages/LUIS/bin/luis.js
composeConfig
async function composeConfig() { const { LUIS_APP_ID, LUIS_AUTHORING_KEY, LUIS_VERSION_ID, LUIS_REGION } = process.env; const { appId: args_appId, authoringKey: args_authoringKey, versionId: args_versionId, region: args_region } = args; let luisrcJson = {}; let conf...
javascript
async function composeConfig() { const { LUIS_APP_ID, LUIS_AUTHORING_KEY, LUIS_VERSION_ID, LUIS_REGION } = process.env; const { appId: args_appId, authoringKey: args_authoringKey, versionId: args_versionId, region: args_region } = args; let luisrcJson = {}; let conf...
[ "async", "function", "composeConfig", "(", ")", "{", "const", "{", "LUIS_APP_ID", ",", "LUIS_AUTHORING_KEY", ",", "LUIS_VERSION_ID", ",", "LUIS_REGION", "}", "=", "process", ".", "env", ";", "const", "{", "appId", ":", "args_appId", ",", "authoringKey", ":", ...
Composes the config from the 3 sources that it may reside. Precedence is 1. Arguments, 2. luisrc and 3. env variables @returns {Promise<*>}
[ "Composes", "the", "config", "from", "the", "3", "sources", "that", "it", "may", "reside", ".", "Precedence", "is", "1", ".", "Arguments", "2", ".", "luisrc", "and", "3", ".", "env", "variables" ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/LUIS/bin/luis.js#L912-L938
train
Microsoft/botbuilder-tools
packages/QnAMaker/bin/qnamaker.js
composeConfig
async function composeConfig() { const {QNAMAKER_SUBSCRIPTION_KEY, QNAMAKER_HOSTNAME, QNAMAKER_ENDPOINTKEY, QNAMAKER_KBID} = process.env; const {subscriptionKey, hostname, endpointKey, kbId} = args; let qnamakerrcJson = {}; let config; try { await fs.access(path.join(process.cwd(), '.qnamak...
javascript
async function composeConfig() { const {QNAMAKER_SUBSCRIPTION_KEY, QNAMAKER_HOSTNAME, QNAMAKER_ENDPOINTKEY, QNAMAKER_KBID} = process.env; const {subscriptionKey, hostname, endpointKey, kbId} = args; let qnamakerrcJson = {}; let config; try { await fs.access(path.join(process.cwd(), '.qnamak...
[ "async", "function", "composeConfig", "(", ")", "{", "const", "{", "QNAMAKER_SUBSCRIPTION_KEY", ",", "QNAMAKER_HOSTNAME", ",", "QNAMAKER_ENDPOINTKEY", ",", "QNAMAKER_KBID", "}", "=", "process", ".", "env", ";", "const", "{", "subscriptionKey", ",", "hostname", ","...
Composes the config from the 3 sources that it may reside. Precedence is 1. Arguments, 2. qnamakerrc and 3. env variables @returns {Promise<*>}
[ "Composes", "the", "config", "from", "the", "3", "sources", "that", "it", "may", "reside", ".", "Precedence", "is", "1", ".", "Arguments", "2", ".", "qnamakerrc", "and", "3", ".", "env", "variables" ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/QnAMaker/bin/qnamaker.js#L345-L365
train
Microsoft/botbuilder-tools
packages/QnAMaker/bin/qnamaker.js
handleError
async function handleError(error) { process.stderr.write('\n' + chalk.red.bold(error + '\n\n')); await help(args); return 1; }
javascript
async function handleError(error) { process.stderr.write('\n' + chalk.red.bold(error + '\n\n')); await help(args); return 1; }
[ "async", "function", "handleError", "(", "error", ")", "{", "process", ".", "stderr", ".", "write", "(", "'\\n'", "+", "chalk", ".", "red", ".", "bold", "(", "error", "+", "'\\n\\n'", ")", ")", ";", "await", "help", "(", "args", ")", ";", "return", ...
Exits with a non-zero status and prints the error if present or displays the help @param error
[ "Exits", "with", "a", "non", "-", "zero", "status", "and", "prints", "the", "error", "if", "present", "or", "displays", "the", "help" ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/QnAMaker/bin/qnamaker.js#L454-L458
train
Microsoft/botbuilder-tools
packages/Chatdown/bin/chatdown.js
processFiles
async function processFiles(inputDir, outputDir) { return new Promise(async (resolve, reject) => { let files = glob.sync(inputDir, { "ignore": ["**/node_modules/**"] }); for (let i = 0; i < files.length; i++) { try { let fileName = files[i]; if (files[i].l...
javascript
async function processFiles(inputDir, outputDir) { return new Promise(async (resolve, reject) => { let files = glob.sync(inputDir, { "ignore": ["**/node_modules/**"] }); for (let i = 0; i < files.length; i++) { try { let fileName = files[i]; if (files[i].l...
[ "async", "function", "processFiles", "(", "inputDir", ",", "outputDir", ")", "{", "return", "new", "Promise", "(", "async", "(", "resolve", ",", "reject", ")", "=>", "{", "let", "files", "=", "glob", ".", "sync", "(", "inputDir", ",", "{", "\"ignore\"", ...
Processes multiple files, and writes them to the output directory. @param {string} inputDir String representing a glob that specifies the input directory @param {string} outputDir String representing the output directory for the processesd files @returns {Promise<string>|boolean} The length of the files array that was...
[ "Processes", "multiple", "files", "and", "writes", "them", "to", "the", "output", "directory", "." ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/Chatdown/bin/chatdown.js#L86-L107
train
Microsoft/botbuilder-tools
packages/Chatdown/bin/chatdown.js
runProgram
async function runProgram() { const args = minimist(process.argv.slice(2)); if (args.prefix) { intercept(function(txt) { return `[${pkg.name}]\n${txt}`; }); } let latest = await latestVersion(pkg.name, { version: `>${pkg.version}` }) .catch(error => ...
javascript
async function runProgram() { const args = minimist(process.argv.slice(2)); if (args.prefix) { intercept(function(txt) { return `[${pkg.name}]\n${txt}`; }); } let latest = await latestVersion(pkg.name, { version: `>${pkg.version}` }) .catch(error => ...
[ "async", "function", "runProgram", "(", ")", "{", "const", "args", "=", "minimist", "(", "process", ".", "argv", ".", "slice", "(", "2", ")", ")", ";", "if", "(", "args", ".", "prefix", ")", "{", "intercept", "(", "function", "(", "txt", ")", "{", ...
Runs the program @returns {Promise<void>}
[ "Runs", "the", "program" ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/Chatdown/bin/chatdown.js#L113-L170
train
Microsoft/botbuilder-tools
packages/Chatdown/bin/chatdown.js
exitWithError
function exitWithError(error) { if (error instanceof Error) { process.stderr.write(chalk.red(error)); } else { help(); } process.exit(1); }
javascript
function exitWithError(error) { if (error instanceof Error) { process.stderr.write(chalk.red(error)); } else { help(); } process.exit(1); }
[ "function", "exitWithError", "(", "error", ")", "{", "if", "(", "error", "instanceof", "Error", ")", "{", "process", ".", "stderr", ".", "write", "(", "chalk", ".", "red", "(", "error", ")", ")", ";", "}", "else", "{", "help", "(", ")", ";", "}", ...
Utility function that exist the process with an optional error. If an Error is received, the error message is written to stdout, otherwise, the help content are displayed. @param {*} error Either an instance of Error or null
[ "Utility", "function", "that", "exist", "the", "process", "with", "an", "optional", "error", ".", "If", "an", "Error", "is", "received", "the", "error", "message", "is", "written", "to", "stdout", "otherwise", "the", "help", "content", "are", "displayed", "....
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/Chatdown/bin/chatdown.js#L180-L187
train
Microsoft/botbuilder-tools
packages/QnAMaker/lib/help.js
getHelpContents
async function getHelpContents(args, output) { if ('!' in args) { return getAllCommands(output); } if (args._.length == 0) { return getGeneralHelpContents(output); } else if (args._.length == 1) { return getVerbHelp(args._[0], output); } else if (args._.length >= 2) { ...
javascript
async function getHelpContents(args, output) { if ('!' in args) { return getAllCommands(output); } if (args._.length == 0) { return getGeneralHelpContents(output); } else if (args._.length == 1) { return getVerbHelp(args._[0], output); } else if (args._.length >= 2) { ...
[ "async", "function", "getHelpContents", "(", "args", ",", "output", ")", "{", "if", "(", "'!'", "in", "args", ")", "{", "return", "getAllCommands", "(", "output", ")", ";", "}", "if", "(", "args", ".", "_", ".", "length", "==", "0", ")", "{", "retu...
Retrieves help content vie the qnamaker.json from the arguments input by the user. @param args The arguments input by the user @returns {Promise<*>}
[ "Retrieves", "help", "content", "vie", "the", "qnamaker", ".", "json", "from", "the", "arguments", "input", "by", "the", "user", "." ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/QnAMaker/lib/help.js#L78-L106
train
Microsoft/botbuilder-tools
packages/QnAMaker/lib/help.js
getAllCommands
function getAllCommands() { let resourceTypes = []; let tables = {}; Object.keys(manifest).forEach(key => { const { [key]: category } = manifest; Object.keys(category.operations).forEach((operationKey) => { let operation = category.operations[operationKey]; let opCate...
javascript
function getAllCommands() { let resourceTypes = []; let tables = {}; Object.keys(manifest).forEach(key => { const { [key]: category } = manifest; Object.keys(category.operations).forEach((operationKey) => { let operation = category.operations[operationKey]; let opCate...
[ "function", "getAllCommands", "(", ")", "{", "let", "resourceTypes", "=", "[", "]", ";", "let", "tables", "=", "{", "}", ";", "Object", ".", "keys", "(", "manifest", ")", ".", "forEach", "(", "key", "=>", "{", "const", "{", "[", "key", "]", ":", ...
Walks the qnamaker.json and pulls out all commands that are supported. @returns {*[]}
[ "Walks", "the", "qnamaker", ".", "json", "and", "pulls", "out", "all", "commands", "that", "are", "supported", "." ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/QnAMaker/lib/help.js#L230-L258
train
Microsoft/botbuilder-tools
packages/Chatdown/lib/index.js
createConversationUpdate
function createConversationUpdate(args, membersAdded, membersRemoved) { let conversationUpdateActivity = createActivity({ type: activitytypes.conversationupdate, recipient: args[args.botId], conversationId: args.conversation.id }); conversationUpdateActivity.membersAdded = membersAdd...
javascript
function createConversationUpdate(args, membersAdded, membersRemoved) { let conversationUpdateActivity = createActivity({ type: activitytypes.conversationupdate, recipient: args[args.botId], conversationId: args.conversation.id }); conversationUpdateActivity.membersAdded = membersAdd...
[ "function", "createConversationUpdate", "(", "args", ",", "membersAdded", ",", "membersRemoved", ")", "{", "let", "conversationUpdateActivity", "=", "createActivity", "(", "{", "type", ":", "activitytypes", ".", "conversationupdate", ",", "recipient", ":", "args", "...
create ConversationUpdate Activity @param {*} args @param {ChannelAccount} from @param {ChannelAccount[]} membersAdded @param {ChannelAccount[]} membersRemoved
[ "create", "ConversationUpdate", "Activity" ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/Chatdown/lib/index.js#L177-L187
train
Microsoft/botbuilder-tools
packages/Chatdown/lib/index.js
addAttachment
async function addAttachment(activity, arg) { let parts = arg.trim().split(' '); let contentUrl = parts[0].trim(); let contentType = (parts.length > 1) ? parts[1].trim() : undefined; if (contentType) { contentType = contentType.toLowerCase(); if (cardContentTypes[contentType]) ...
javascript
async function addAttachment(activity, arg) { let parts = arg.trim().split(' '); let contentUrl = parts[0].trim(); let contentType = (parts.length > 1) ? parts[1].trim() : undefined; if (contentType) { contentType = contentType.toLowerCase(); if (cardContentTypes[contentType]) ...
[ "async", "function", "addAttachment", "(", "activity", ",", "arg", ")", "{", "let", "parts", "=", "arg", ".", "trim", "(", ")", ".", "split", "(", "' '", ")", ";", "let", "contentUrl", "=", "parts", "[", "0", "]", ".", "trim", "(", ")", ";", "let...
Adds an attachment to the activity. If a mimetype is specified, it is used as is. Otherwise, it is derived from the file extension. @param {Activity} activity The activity to add the attachment to @param {*} contentUrl contenturl @param {*} contentType contentType @returns {Promise<number>} The new number of attachme...
[ "Adds", "an", "attachment", "to", "the", "activity", ".", "If", "a", "mimetype", "is", "specified", "it", "is", "used", "as", "is", ".", "Otherwise", "it", "is", "derived", "from", "the", "file", "extension", "." ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/Chatdown/lib/index.js#L468-L505
train
Microsoft/botbuilder-tools
packages/Chatdown/lib/index.js
readAttachmentFile
async function readAttachmentFile(fileLocation, contentType) { let resolvedFileLocation = path.join(workingDirectory, fileLocation); let exists = fs.pathExistsSync(resolvedFileLocation); // fallback to cwd if (!exists) { resolvedFileLocation = path.resolve(fileLocation); } // Throws if ...
javascript
async function readAttachmentFile(fileLocation, contentType) { let resolvedFileLocation = path.join(workingDirectory, fileLocation); let exists = fs.pathExistsSync(resolvedFileLocation); // fallback to cwd if (!exists) { resolvedFileLocation = path.resolve(fileLocation); } // Throws if ...
[ "async", "function", "readAttachmentFile", "(", "fileLocation", ",", "contentType", ")", "{", "let", "resolvedFileLocation", "=", "path", ".", "join", "(", "workingDirectory", ",", "fileLocation", ")", ";", "let", "exists", "=", "fs", ".", "pathExistsSync", "(",...
Utility function for reading the attachment @param fileLocation @param contentType @returns {*}
[ "Utility", "function", "for", "reading", "the", "attachment" ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/Chatdown/lib/index.js#L514-L528
train
Microsoft/botbuilder-tools
packages/Chatdown/lib/index.js
createActivity
function createActivity({ type = ActivityTypes.Message, recipient, from, conversationId }) { const activity = new Activity({ from, recipient, type, id: '' + activityId++ }); activity.conversation = new ConversationAccount({ id: conversationId }); return activity; }
javascript
function createActivity({ type = ActivityTypes.Message, recipient, from, conversationId }) { const activity = new Activity({ from, recipient, type, id: '' + activityId++ }); activity.conversation = new ConversationAccount({ id: conversationId }); return activity; }
[ "function", "createActivity", "(", "{", "type", "=", "ActivityTypes", ".", "Message", ",", "recipient", ",", "from", ",", "conversationId", "}", ")", "{", "const", "activity", "=", "new", "Activity", "(", "{", "from", ",", "recipient", ",", "type", ",", ...
Utility for creating a new serializable Activity. @param {ActivityTypes} type The Activity type @param {string} to The recipient of the Activity @param {string} from The sender of the Activity @param {string} conversationId The id of the conversation @returns {Activity} The newly created activity
[ "Utility", "for", "creating", "a", "new", "serializable", "Activity", "." ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/Chatdown/lib/index.js#L539-L543
train
Microsoft/botbuilder-tools
packages/QnAMaker/lib/utils/insertParametersFromObject.js
insertParametersFromObject
function insertParametersFromObject(parameterizedString, sourceObj) { let result; let payload = parameterizedString; while ((result = tokenRegExp.exec(parameterizedString))) { const token = result[1]; const propertyName = token.replace(/[{}]/g, ''); if (!(propertyName in sourceObj)) ...
javascript
function insertParametersFromObject(parameterizedString, sourceObj) { let result; let payload = parameterizedString; while ((result = tokenRegExp.exec(parameterizedString))) { const token = result[1]; const propertyName = token.replace(/[{}]/g, ''); if (!(propertyName in sourceObj)) ...
[ "function", "insertParametersFromObject", "(", "parameterizedString", ",", "sourceObj", ")", "{", "let", "result", ";", "let", "payload", "=", "parameterizedString", ";", "while", "(", "(", "result", "=", "tokenRegExp", ".", "exec", "(", "parameterizedString", ")"...
Replaces parameterized strings with the value from the corresponding source object's property. @param parameterizedString {string} The String containing parameters represented by braces @param sourceObj {*} The object containing the properties to transfer. @returns {string} The string containing the replaced parameter...
[ "Replaces", "parameterized", "strings", "with", "the", "value", "from", "the", "corresponding", "source", "object", "s", "property", "." ]
917d4271f624f10bb3a9e6bcc26fb5de587e37e6
https://github.com/Microsoft/botbuilder-tools/blob/917d4271f624f10bb3a9e6bcc26fb5de587e37e6/packages/QnAMaker/lib/utils/insertParametersFromObject.js#L15-L27
train
chimurai/http-proxy-middleware
dist/path-rewriter.js
createPathRewriter
function createPathRewriter(rewriteConfig) { let rulesCache; if (!isValidRewriteConfig(rewriteConfig)) { return; } if (_.isFunction(rewriteConfig)) { const customRewriteFn = rewriteConfig; return customRewriteFn; } else { rulesCache = parsePathRewriteRules(rewrite...
javascript
function createPathRewriter(rewriteConfig) { let rulesCache; if (!isValidRewriteConfig(rewriteConfig)) { return; } if (_.isFunction(rewriteConfig)) { const customRewriteFn = rewriteConfig; return customRewriteFn; } else { rulesCache = parsePathRewriteRules(rewrite...
[ "function", "createPathRewriter", "(", "rewriteConfig", ")", "{", "let", "rulesCache", ";", "if", "(", "!", "isValidRewriteConfig", "(", "rewriteConfig", ")", ")", "{", "return", ";", "}", "if", "(", "_", ".", "isFunction", "(", "rewriteConfig", ")", ")", ...
Create rewrite function, to cache parsed rewrite rules. @param {Object} rewriteConfig @return {Function} Function to rewrite paths; This function should accept `path` (request.url) as parameter
[ "Create", "rewrite", "function", "to", "cache", "parsed", "rewrite", "rules", "." ]
b13302c87a04bf7adc4c2547affaaeeb7ecb0c42
https://github.com/chimurai/http-proxy-middleware/blob/b13302c87a04bf7adc4c2547affaaeeb7ecb0c42/dist/path-rewriter.js#L13-L37
train
peterbraden/node-opencv
examples/write-video.js
function () { vid2.read(function (err, m2) { if (writer2 === null) writer2 = new cv.VideoWriter(filename2, 'DIVX', vid2.getFPS(), m2.size(), true); x++; writer2.write(m2, function(err){ if (x < 100) { iter(); } else { vid2.release(); writer2.release(); } }); m2.release(); delete m2; }); }
javascript
function () { vid2.read(function (err, m2) { if (writer2 === null) writer2 = new cv.VideoWriter(filename2, 'DIVX', vid2.getFPS(), m2.size(), true); x++; writer2.write(m2, function(err){ if (x < 100) { iter(); } else { vid2.release(); writer2.release(); } }); m2.release(); delete m2; }); }
[ "function", "(", ")", "{", "vid2", ".", "read", "(", "function", "(", "err", ",", "m2", ")", "{", "if", "(", "writer2", "===", "null", ")", "writer2", "=", "new", "cv", ".", "VideoWriter", "(", "filename2", ",", "'DIVX'", ",", "vid2", ".", "getFPS"...
do the same write async
[ "do", "the", "same", "write", "async" ]
db093cb2ec422e507a61e79dd490126060a7e7d0
https://github.com/peterbraden/node-opencv/blob/db093cb2ec422e507a61e79dd490126060a7e7d0/examples/write-video.js#L39-L56
train
cornerstonejs/cornerstone
src/falseColorMapping.js
getPixelValues
function getPixelValues (pixelData) { let minPixelValue = Number.MAX_VALUE; let maxPixelValue = Number.MIN_VALUE; const len = pixelData.length; let pixel; for (let i = 0; i < len; i++) { pixel = pixelData[i]; minPixelValue = minPixelValue < pixel ? minPixelValue : pixel; maxPixelValue = maxPixelV...
javascript
function getPixelValues (pixelData) { let minPixelValue = Number.MAX_VALUE; let maxPixelValue = Number.MIN_VALUE; const len = pixelData.length; let pixel; for (let i = 0; i < len; i++) { pixel = pixelData[i]; minPixelValue = minPixelValue < pixel ? minPixelValue : pixel; maxPixelValue = maxPixelV...
[ "function", "getPixelValues", "(", "pixelData", ")", "{", "let", "minPixelValue", "=", "Number", ".", "MAX_VALUE", ";", "let", "maxPixelValue", "=", "Number", ".", "MIN_VALUE", ";", "const", "len", "=", "pixelData", ".", "length", ";", "let", "pixel", ";", ...
Retrieves the minimum and maximum pixel values from an Array of pixel data @param {Array} pixelData The input pixel data array @returns {{minPixelValue: Number, maxPixelValue: Number}} The minimum and maximum pixel values in the input Array
[ "Retrieves", "the", "minimum", "and", "maximum", "pixel", "values", "from", "an", "Array", "of", "pixel", "data" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/falseColorMapping.js#L12-L28
train
cornerstonejs/cornerstone
src/falseColorMapping.js
getRestoreImageMethod
function getRestoreImageMethod (image) { if (image.restore) { return image.restore; } const color = image.color; const rgba = image.rgba; const cachedLut = image.cachedLut; const slope = image.slope; const windowWidth = image.windowWidth; const windowCenter = image.windowCenter; const minPixelVal...
javascript
function getRestoreImageMethod (image) { if (image.restore) { return image.restore; } const color = image.color; const rgba = image.rgba; const cachedLut = image.cachedLut; const slope = image.slope; const windowWidth = image.windowWidth; const windowCenter = image.windowCenter; const minPixelVal...
[ "function", "getRestoreImageMethod", "(", "image", ")", "{", "if", "(", "image", ".", "restore", ")", "{", "return", "image", ".", "restore", ";", "}", "const", "color", "=", "image", ".", "color", ";", "const", "rgba", "=", "image", ".", "rgba", ";", ...
Retrieve a function that will allow an image object to be reset to its original form after a false color mapping transformation @param {Image} image A Cornerstone Image Object @return {Function} A function for resetting an Image Object to its original form
[ "Retrieve", "a", "function", "that", "will", "allow", "an", "image", "object", "to", "be", "reset", "to", "its", "original", "form", "after", "a", "false", "color", "mapping", "transformation" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/falseColorMapping.js#L38-L73
train
cornerstonejs/cornerstone
src/falseColorMapping.js
restoreImage
function restoreImage (image) { if (image.restore && (typeof image.restore === 'function')) { image.restore(); return true; } return false; }
javascript
function restoreImage (image) { if (image.restore && (typeof image.restore === 'function')) { image.restore(); return true; } return false; }
[ "function", "restoreImage", "(", "image", ")", "{", "if", "(", "image", ".", "restore", "&&", "(", "typeof", "image", ".", "restore", "===", "'function'", ")", ")", "{", "image", ".", "restore", "(", ")", ";", "return", "true", ";", "}", "return", "f...
Restores a false color image to its original version @param {Image} image A Cornerstone Image Object @returns {Boolean} True if the image object had a valid restore function, which was run. Otherwise, false.
[ "Restores", "a", "false", "color", "image", "to", "its", "original", "version" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/falseColorMapping.js#L99-L107
train
cornerstonejs/cornerstone
src/falseColorMapping.js
convertImageToFalseColorImage
function convertImageToFalseColorImage (image, colormap) { if (image.color && !image.falseColor) { throw new Error('Color transforms are not implemented yet'); } // User can pass a colormap id or a colormap object colormap = ensuresColormap(colormap); const colormapId = colormap.getId(); // Doesn't d...
javascript
function convertImageToFalseColorImage (image, colormap) { if (image.color && !image.falseColor) { throw new Error('Color transforms are not implemented yet'); } // User can pass a colormap id or a colormap object colormap = ensuresColormap(colormap); const colormapId = colormap.getId(); // Doesn't d...
[ "function", "convertImageToFalseColorImage", "(", "image", ",", "colormap", ")", "{", "if", "(", "image", ".", "color", "&&", "!", "image", ".", "falseColor", ")", "{", "throw", "new", "Error", "(", "'Color transforms are not implemented yet'", ")", ";", "}", ...
Convert an image to a false color image @param {Image} image A Cornerstone Image Object @param {String|Object} colormap - it can be a colormap object or a colormap id (string) @returns {Boolean} - Whether or not the image has been converted to a false color image
[ "Convert", "an", "image", "to", "a", "false", "color", "image" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/falseColorMapping.js#L117-L168
train
cornerstonejs/cornerstone
src/falseColorMapping.js
convertToFalseColorImage
function convertToFalseColorImage (element, colormap) { const enabledElement = getEnabledElement(element); return convertImageToFalseColorImage(enabledElement.image, colormap); }
javascript
function convertToFalseColorImage (element, colormap) { const enabledElement = getEnabledElement(element); return convertImageToFalseColorImage(enabledElement.image, colormap); }
[ "function", "convertToFalseColorImage", "(", "element", ",", "colormap", ")", "{", "const", "enabledElement", "=", "getEnabledElement", "(", "element", ")", ";", "return", "convertImageToFalseColorImage", "(", "enabledElement", ".", "image", ",", "colormap", ")", ";...
Convert the image of a element to a false color image @param {HTMLElement} element The Cornerstone element @param {*} colormap - it can be a colormap object or a colormap id (string) @returns {void}
[ "Convert", "the", "image", "of", "a", "element", "to", "a", "false", "color", "image" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/falseColorMapping.js#L178-L183
train
cornerstonejs/cornerstone
src/webgl/createProgramFromString.js
compileShader
function compileShader (gl, shaderSource, shaderType) { // Create the shader object const shader = gl.createShader(shaderType); // Set the shader source code. gl.shaderSource(shader, shaderSource); // Compile the shader gl.compileShader(shader); // Check if it compiled const success = gl.getShaderPa...
javascript
function compileShader (gl, shaderSource, shaderType) { // Create the shader object const shader = gl.createShader(shaderType); // Set the shader source code. gl.shaderSource(shader, shaderSource); // Compile the shader gl.compileShader(shader); // Check if it compiled const success = gl.getShaderPa...
[ "function", "compileShader", "(", "gl", ",", "shaderSource", ",", "shaderType", ")", "{", "// Create the shader object", "const", "shader", "=", "gl", ".", "createShader", "(", "shaderType", ")", ";", "// Set the shader source code.", "gl", ".", "shaderSource", "(",...
Creates and compiles a shader. @param {!WebGLRenderingContext} gl The WebGL Context. @param {string} shaderSource The GLSL source code for the shader. @param {number} shaderType The type of shader, VERTEX_SHADER or FRAGMENT_SHADER. @return {!WebGLShader} The shader. @memberof WebGLRendering
[ "Creates", "and", "compiles", "a", "shader", "." ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/webgl/createProgramFromString.js#L11-L33
train
cornerstonejs/cornerstone
src/webgl/createProgramFromString.js
createProgram
function createProgram (gl, vertexShader, fragmentShader) { // Create a program. const program = gl.createProgram(); // Attach the shaders. gl.attachShader(program, vertexShader); gl.attachShader(program, fragmentShader); // Link the program. gl.linkProgram(program); // Check if it linked. const s...
javascript
function createProgram (gl, vertexShader, fragmentShader) { // Create a program. const program = gl.createProgram(); // Attach the shaders. gl.attachShader(program, vertexShader); gl.attachShader(program, fragmentShader); // Link the program. gl.linkProgram(program); // Check if it linked. const s...
[ "function", "createProgram", "(", "gl", ",", "vertexShader", ",", "fragmentShader", ")", "{", "// Create a program.", "const", "program", "=", "gl", ".", "createProgram", "(", ")", ";", "// Attach the shaders.", "gl", ".", "attachShader", "(", "program", ",", "v...
Creates a program from 2 shaders. @param {!WebGLRenderingContext} gl The WebGL context. @param {!WebGLShader} vertexShader A vertex shader. @param {!WebGLShader} fragmentShader A fragment shader. @return {!WebGLProgram} A program. @memberof WebGLRendering
[ "Creates", "a", "program", "from", "2", "shaders", "." ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/webgl/createProgramFromString.js#L44-L67
train
cornerstonejs/cornerstone
src/internal/getDefaultViewport.js
createViewport
function createViewport () { const displayedArea = createDefaultDisplayedArea(); return { scale: 1, translation: { x: 0, y: 0 }, voi: { windowWidth: undefined, windowCenter: undefined }, invert: false, pixelReplication: false, rotation: 0, hflip: false, ...
javascript
function createViewport () { const displayedArea = createDefaultDisplayedArea(); return { scale: 1, translation: { x: 0, y: 0 }, voi: { windowWidth: undefined, windowCenter: undefined }, invert: false, pixelReplication: false, rotation: 0, hflip: false, ...
[ "function", "createViewport", "(", ")", "{", "const", "displayedArea", "=", "createDefaultDisplayedArea", "(", ")", ";", "return", "{", "scale", ":", "1", ",", "translation", ":", "{", "x", ":", "0", ",", "y", ":", "0", "}", ",", "voi", ":", "{", "wi...
Creates a new viewport object containing default values @returns {Viewport} viewport object @memberof Internal
[ "Creates", "a", "new", "viewport", "object", "containing", "default", "values" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/internal/getDefaultViewport.js#L10-L34
train
cornerstonejs/cornerstone
src/colors/lookupTable.js
linearIndexLookupMain
function linearIndexLookupMain (v, p) { let dIndex; // NOTE: Added Math.floor since values were not integers? Check VTK source if (v < p.Range[0]) { dIndex = p.MaxIndex + BELOW_RANGE_COLOR_INDEX + 1.5; } else if (v > p.Range[1]) { dIndex = p.MaxIndex + ABOVE_RANGE_COLOR_INDEX + 1.5; } else { dInd...
javascript
function linearIndexLookupMain (v, p) { let dIndex; // NOTE: Added Math.floor since values were not integers? Check VTK source if (v < p.Range[0]) { dIndex = p.MaxIndex + BELOW_RANGE_COLOR_INDEX + 1.5; } else if (v > p.Range[1]) { dIndex = p.MaxIndex + ABOVE_RANGE_COLOR_INDEX + 1.5; } else { dInd...
[ "function", "linearIndexLookupMain", "(", "v", ",", "p", ")", "{", "let", "dIndex", ";", "// NOTE: Added Math.floor since values were not integers? Check VTK source", "if", "(", "v", "<", "p", ".", "Range", "[", "0", "]", ")", "{", "dIndex", "=", "p", ".", "Ma...
Maps a value to an index in the table @param {Number} v A double value which table index will be returned. @param {any} p An object that contains the Table "Range", the table "MaxIndex", A "Shift" from first value in the table and the table "Scale" value @returns {Number} The mapped index in the table @memberof Colors
[ "Maps", "a", "value", "to", "an", "index", "in", "the", "table" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/colors/lookupTable.js#L93-L106
train
cornerstonejs/cornerstone
src/internal/computeAutoVoi.js
hasVoi
function hasVoi (viewport) { const hasLut = viewport.voiLUT && viewport.voiLUT.lut && viewport.voiLUT.lut.length > 0; return hasLut || (viewport.voi.windowWidth !== undefined && viewport.voi.windowCenter !== undefined); }
javascript
function hasVoi (viewport) { const hasLut = viewport.voiLUT && viewport.voiLUT.lut && viewport.voiLUT.lut.length > 0; return hasLut || (viewport.voi.windowWidth !== undefined && viewport.voi.windowCenter !== undefined); }
[ "function", "hasVoi", "(", "viewport", ")", "{", "const", "hasLut", "=", "viewport", ".", "voiLUT", "&&", "viewport", ".", "voiLUT", ".", "lut", "&&", "viewport", ".", "voiLUT", ".", "lut", ".", "length", ">", "0", ";", "return", "hasLut", "||", "(", ...
Check if viewport has voi LUT data @param {any} viewport The viewport to check for voi LUT data @returns {Boolean} true viewport has LUT data (Window Width/Window Center or voiLUT). Otherwise, false. @memberof Internal
[ "Check", "if", "viewport", "has", "voi", "LUT", "data" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/internal/computeAutoVoi.js#L36-L40
train
cornerstonejs/cornerstone
src/webgl/textureCache.js
compare
function compare (a, b) { if (a.timeStamp > b.timeStamp) { return -1; } if (a.timeStamp < b.timeStamp) { return 1; } return 0; }
javascript
function compare (a, b) { if (a.timeStamp > b.timeStamp) { return -1; } if (a.timeStamp < b.timeStamp) { return 1; } return 0; }
[ "function", "compare", "(", "a", ",", "b", ")", "{", "if", "(", "a", ".", "timeStamp", ">", "b", ".", "timeStamp", ")", "{", "return", "-", "1", ";", "}", "if", "(", "a", ".", "timeStamp", "<", "b", ".", "timeStamp", ")", "{", "return", "1", ...
Cache size has been exceeded, create list of images sorted by timeStamp So we can purge the least recently used image
[ "Cache", "size", "has", "been", "exceeded", "create", "list", "of", "images", "sorted", "by", "timeStamp", "So", "we", "can", "purge", "the", "least", "recently", "used", "image" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/webgl/textureCache.js#L32-L41
train
cornerstonejs/cornerstone
src/webgl/renderer.js
getImageDataType
function getImageDataType (image) { if (image.color) { return 'rgb'; } const pixelData = image.getPixelData(); if (pixelData instanceof Int16Array) { return 'int16'; } if (pixelData instanceof Uint16Array) { return 'uint16'; } if (pixelData instanceof Int8Array) { return 'int8'; } ...
javascript
function getImageDataType (image) { if (image.color) { return 'rgb'; } const pixelData = image.getPixelData(); if (pixelData instanceof Int16Array) { return 'int16'; } if (pixelData instanceof Uint16Array) { return 'uint16'; } if (pixelData instanceof Int8Array) { return 'int8'; } ...
[ "function", "getImageDataType", "(", "image", ")", "{", "if", "(", "image", ".", "color", ")", "{", "return", "'rgb'", ";", "}", "const", "pixelData", "=", "image", ".", "getPixelData", "(", ")", ";", "if", "(", "pixelData", "instanceof", "Int16Array", "...
Returns the image data type as a string representation. @param {any} image The cornerstone image object @returns {string} image data type (rgb, iint16, uint16, int8 and uint8) @memberof WebGLRendering
[ "Returns", "the", "image", "data", "type", "as", "a", "string", "representation", "." ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/webgl/renderer.js#L119-L139
train
cornerstonejs/cornerstone
src/imageCache.js
purgeCacheIfNecessary
function purgeCacheIfNecessary () { // If max cache size has not been exceeded, do nothing if (cacheSizeInBytes <= maximumSizeInBytes) { return; } // Cache size has been exceeded, create list of images sorted by timeStamp // So we can purge the least recently used image function compare (a, b) { if...
javascript
function purgeCacheIfNecessary () { // If max cache size has not been exceeded, do nothing if (cacheSizeInBytes <= maximumSizeInBytes) { return; } // Cache size has been exceeded, create list of images sorted by timeStamp // So we can purge the least recently used image function compare (a, b) { if...
[ "function", "purgeCacheIfNecessary", "(", ")", "{", "// If max cache size has not been exceeded, do nothing", "if", "(", "cacheSizeInBytes", "<=", "maximumSizeInBytes", ")", "{", "return", ";", "}", "// Cache size has been exceeded, create list of images sorted by timeStamp", "// S...
Purges the cache if size exceeds maximum @returns {void}
[ "Purges", "the", "cache", "if", "size", "exceeds", "maximum" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/imageCache.js#L42-L75
train
cornerstonejs/cornerstone
src/internal/getCanvas.js
createCanvas
function createCanvas (element) { const canvas = document.createElement('canvas'); canvas.style.display = 'block'; canvas.classList.add(CANVAS_CSS_CLASS); element.appendChild(canvas); return canvas; }
javascript
function createCanvas (element) { const canvas = document.createElement('canvas'); canvas.style.display = 'block'; canvas.classList.add(CANVAS_CSS_CLASS); element.appendChild(canvas); return canvas; }
[ "function", "createCanvas", "(", "element", ")", "{", "const", "canvas", "=", "document", ".", "createElement", "(", "'canvas'", ")", ";", "canvas", ".", "style", ".", "display", "=", "'block'", ";", "canvas", ".", "classList", ".", "add", "(", "CANVAS_CSS...
Create a canvas and append it to the element @param {HTMLElement} element An HTML Element @return {HTMLElement} canvas A Canvas DOM element
[ "Create", "a", "canvas", "and", "append", "it", "to", "the", "element" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/internal/getCanvas.js#L9-L17
train
cornerstonejs/cornerstone
src/internal/getVOILut.js
generateNonLinearVOILUT
function generateNonLinearVOILUT (voiLUT) { // We don't trust the voiLUT.numBitsPerEntry, mainly thanks to Agfa! const bitsPerEntry = Math.max(...voiLUT.lut).toString(2).length; const shift = bitsPerEntry - 8; const minValue = voiLUT.lut[0] >> shift; const maxValue = voiLUT.lut[voiLUT.lut.length - 1] >> shift...
javascript
function generateNonLinearVOILUT (voiLUT) { // We don't trust the voiLUT.numBitsPerEntry, mainly thanks to Agfa! const bitsPerEntry = Math.max(...voiLUT.lut).toString(2).length; const shift = bitsPerEntry - 8; const minValue = voiLUT.lut[0] >> shift; const maxValue = voiLUT.lut[voiLUT.lut.length - 1] >> shift...
[ "function", "generateNonLinearVOILUT", "(", "voiLUT", ")", "{", "// We don't trust the voiLUT.numBitsPerEntry, mainly thanks to Agfa!", "const", "bitsPerEntry", "=", "Math", ".", "max", "(", "...", "voiLUT", ".", "lut", ")", ".", "toString", "(", "2", ")", ".", "len...
Generate a non-linear volume of interest lookup table @param {LUT} voiLUT Volume of Interest Lookup Table Object @returns {VOILUTFunction} VOI LUT mapping function @memberof VOILUT
[ "Generate", "a", "non", "-", "linear", "volume", "of", "interest", "lookup", "table" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/internal/getVOILut.js#L38-L55
train
cornerstonejs/cornerstone
src/internal/drawCompositeImage.js
syncViewports
function syncViewports (layers, activeLayer) { // If we intend to keep the viewport's scale, translation and rotation in sync, // loop through the layers layers.forEach((layer) => { // Don't do anything to the active layer // Don't do anything if this layer has no viewport if (layer === activeLayer ||...
javascript
function syncViewports (layers, activeLayer) { // If we intend to keep the viewport's scale, translation and rotation in sync, // loop through the layers layers.forEach((layer) => { // Don't do anything to the active layer // Don't do anything if this layer has no viewport if (layer === activeLayer ||...
[ "function", "syncViewports", "(", "layers", ",", "activeLayer", ")", "{", "// If we intend to keep the viewport's scale, translation and rotation in sync,", "// loop through the layers", "layers", ".", "forEach", "(", "(", "layer", ")", "=>", "{", "// Don't do anything to the a...
Sync all viewports based on active layer's viewport
[ "Sync", "all", "viewports", "based", "on", "active", "layer", "s", "viewport" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/internal/drawCompositeImage.js#L30-L59
train
cornerstonejs/cornerstone
src/internal/drawCompositeImage.js
renderLayers
function renderLayers (context, layers, invalidated) { // Loop through each layer and draw it to the canvas layers.forEach((layer, index) => { if (!layer.image) { return; } context.save(); // Set the layer's canvas to the pixel coordinate system layer.canvas = context.canvas; setToPi...
javascript
function renderLayers (context, layers, invalidated) { // Loop through each layer and draw it to the canvas layers.forEach((layer, index) => { if (!layer.image) { return; } context.save(); // Set the layer's canvas to the pixel coordinate system layer.canvas = context.canvas; setToPi...
[ "function", "renderLayers", "(", "context", ",", "layers", ",", "invalidated", ")", "{", "// Loop through each layer and draw it to the canvas", "layers", ".", "forEach", "(", "(", "layer", ",", "index", ")", "=>", "{", "if", "(", "!", "layer", ".", "image", "...
Internal function to render all layers for a Cornerstone enabled element @param {CanvasRenderingContext2D} context Canvas context to draw upon @param {EnabledElementLayer[]} layers The array of all layers for this enabled element @param {Boolean} invalidated A boolean whether or not this image has been invalidated and...
[ "Internal", "function", "to", "render", "all", "layers", "for", "a", "Cornerstone", "enabled", "element" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/internal/drawCompositeImage.js#L70-L128
train
cornerstonejs/cornerstone
src/colors/colormap.js
createLinearSegmentedColormap
function createLinearSegmentedColormap (segmentedData, N, gamma) { let i; const lut = []; N = N === null ? 256 : N; gamma = gamma === null ? 1 : gamma; const redLut = makeMappingArray(N, segmentedData.red, gamma); const greenLut = makeMappingArray(N, segmentedData.green, gamma); const blueLut = makeMapp...
javascript
function createLinearSegmentedColormap (segmentedData, N, gamma) { let i; const lut = []; N = N === null ? 256 : N; gamma = gamma === null ? 1 : gamma; const redLut = makeMappingArray(N, segmentedData.red, gamma); const greenLut = makeMappingArray(N, segmentedData.green, gamma); const blueLut = makeMapp...
[ "function", "createLinearSegmentedColormap", "(", "segmentedData", ",", "N", ",", "gamma", ")", "{", "let", "i", ";", "const", "lut", "=", "[", "]", ";", "N", "=", "N", "===", "null", "?", "256", ":", "N", ";", "gamma", "=", "gamma", "===", "null", ...
Creates a Colormap based on lookup tables using linear segments. @param {{red:Array, green:Array, blue:Array}} segmentedData An object with a red, green and blue entries. Each entry should be a list of x, y0, y1 tuples, forming rows in a table. @param {Number} N The number of elements in the result Colormap @param {any...
[ "Creates", "a", "Colormap", "based", "on", "lookup", "tables", "using", "linear", "segments", "." ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/colors/colormap.js#L619-L640
train
cornerstonejs/cornerstone
src/resize.js
setCanvasSize
function setCanvasSize (element, canvas) { // The device pixel ratio is 1.0 for normal displays and > 1.0 // For high DPI displays like Retina /* This functionality is disabled due to buggy behavior on systems with mixed DPI's. If the canvas is created on a display with high DPI (e.g. 2.0) and the...
javascript
function setCanvasSize (element, canvas) { // The device pixel ratio is 1.0 for normal displays and > 1.0 // For high DPI displays like Retina /* This functionality is disabled due to buggy behavior on systems with mixed DPI's. If the canvas is created on a display with high DPI (e.g. 2.0) and the...
[ "function", "setCanvasSize", "(", "element", ",", "canvas", ")", "{", "// The device pixel ratio is 1.0 for normal displays and > 1.0\r", "// For high DPI displays like Retina\r", "/*\r\n\r\n This functionality is disabled due to buggy behavior on systems with mixed DPI's. If the canvas\r\n ...
This module is responsible for enabling an element to display images with cornerstone @param {HTMLElement} element The DOM element enabled for Cornerstone @param {HTMLElement} canvas The Canvas DOM element within the DOM element enabled for Cornerstone @returns {void}
[ "This", "module", "is", "responsible", "for", "enabling", "an", "element", "to", "display", "images", "with", "cornerstone" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/resize.js#L15-L47
train
cornerstonejs/cornerstone
src/resize.js
wasFitToWindow
function wasFitToWindow (enabledElement, oldCanvasWidth, oldCanvasHeight) { const scale = enabledElement.viewport.scale; const imageSize = getImageSize(enabledElement.image, enabledElement.viewport.rotation); const imageWidth = Math.round(imageSize.width * scale); const imageHeight = Math.round(imageSize.he...
javascript
function wasFitToWindow (enabledElement, oldCanvasWidth, oldCanvasHeight) { const scale = enabledElement.viewport.scale; const imageSize = getImageSize(enabledElement.image, enabledElement.viewport.rotation); const imageWidth = Math.round(imageSize.width * scale); const imageHeight = Math.round(imageSize.he...
[ "function", "wasFitToWindow", "(", "enabledElement", ",", "oldCanvasWidth", ",", "oldCanvasHeight", ")", "{", "const", "scale", "=", "enabledElement", ".", "viewport", ".", "scale", ";", "const", "imageSize", "=", "getImageSize", "(", "enabledElement", ".", "image...
Checks if the image of a given enabled element fitted the window before the resize @param {EnabledElement} enabledElement The Cornerstone Enabled Element @param {number} oldCanvasWidth The width of the canvas before the resize @param {number} oldCanvasHeight The height of the canvas before the resize @return {Boolean}...
[ "Checks", "if", "the", "image", "of", "a", "given", "enabled", "element", "fitted", "the", "window", "before", "the", "resize" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/resize.js#L58-L69
train
cornerstonejs/cornerstone
src/resize.js
relativeRescale
function relativeRescale (enabledElement, oldCanvasWidth, oldCanvasHeight) { const scale = enabledElement.viewport.scale; const canvasWidth = enabledElement.canvas.width; const canvasHeight = enabledElement.canvas.height; const relWidthChange = canvasWidth / oldCanvasWidth; const relHeightChange = canvas...
javascript
function relativeRescale (enabledElement, oldCanvasWidth, oldCanvasHeight) { const scale = enabledElement.viewport.scale; const canvasWidth = enabledElement.canvas.width; const canvasHeight = enabledElement.canvas.height; const relWidthChange = canvasWidth / oldCanvasWidth; const relHeightChange = canvas...
[ "function", "relativeRescale", "(", "enabledElement", ",", "oldCanvasWidth", ",", "oldCanvasHeight", ")", "{", "const", "scale", "=", "enabledElement", ".", "viewport", ".", "scale", ";", "const", "canvasWidth", "=", "enabledElement", ".", "canvas", ".", "width", ...
Rescale the image relative to the changed size of the canvas @param {EnabledElement} enabledElement The Cornerstone Enabled Element @param {number} oldCanvasWidth The width of the canvas before the resize @param {number} oldCanvasHeight The height of the canvas before the resize @return {void}
[ "Rescale", "the", "image", "relative", "to", "the", "changed", "size", "of", "the", "canvas" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/resize.js#L79-L88
train
cornerstonejs/cornerstone
src/imageLoader.js
loadImageFromImageLoader
function loadImageFromImageLoader (imageId, options) { const colonIndex = imageId.indexOf(':'); const scheme = imageId.substring(0, colonIndex); const loader = imageLoaders[scheme]; if (loader === undefined || loader === null) { if (unknownImageLoader !== undefined) { return unknownImageLoader...
javascript
function loadImageFromImageLoader (imageId, options) { const colonIndex = imageId.indexOf(':'); const scheme = imageId.substring(0, colonIndex); const loader = imageLoaders[scheme]; if (loader === undefined || loader === null) { if (unknownImageLoader !== undefined) { return unknownImageLoader...
[ "function", "loadImageFromImageLoader", "(", "imageId", ",", "options", ")", "{", "const", "colonIndex", "=", "imageId", ".", "indexOf", "(", "':'", ")", ";", "const", "scheme", "=", "imageId", ".", "substring", "(", "0", ",", "colonIndex", ")", ";", "cons...
Load an image using a registered Cornerstone Image Loader. The image loader that is used will be determined by the image loader scheme matching against the imageId. @param {String} imageId A Cornerstone Image Object's imageId @param {Object} [options] Options to be passed to the Image Loader @returns {ImageLoadObjec...
[ "Load", "an", "image", "using", "a", "registered", "Cornerstone", "Image", "Loader", "." ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/imageLoader.js#L27-L55
train
cornerstonejs/cornerstone
src/metaData.js
getMetaData
function getMetaData (type, imageId) { // Invoke each provider in priority order until one returns something for (let i = 0; i < providers.length; i++) { const result = providers[i].provider(type, imageId); if (result !== undefined) { return result; } } }
javascript
function getMetaData (type, imageId) { // Invoke each provider in priority order until one returns something for (let i = 0; i < providers.length; i++) { const result = providers[i].provider(type, imageId); if (result !== undefined) { return result; } } }
[ "function", "getMetaData", "(", "type", ",", "imageId", ")", "{", "// Invoke each provider in priority order until one returns something", "for", "(", "let", "i", "=", "0", ";", "i", "<", "providers", ".", "length", ";", "i", "++", ")", "{", "const", "result", ...
Gets metadata from the registered metadata providers. Will call each one from highest priority to lowest until one responds @param {String} type The type of metadata requested from the metadata store @param {String} imageId The Cornerstone Image Object's imageId @returns {*} The metadata retrieved from the metadata ...
[ "Gets", "metadata", "from", "the", "registered", "metadata", "providers", ".", "Will", "call", "each", "one", "from", "highest", "priority", "to", "lowest", "until", "one", "responds" ]
f3b4accef3a700b0719e8373c08c414a1448b563
https://github.com/cornerstonejs/cornerstone/blob/f3b4accef3a700b0719e8373c08c414a1448b563/src/metaData.js#L63-L72
train
wenzhixin/multiple-select
tools/template.js
run
async function run () { if (options.help || Object.keys(options).length === 1) { showHelp() return } if (!options.name) { console.error('You need to input -n, --name argv') return } if (!options.title) { options.title = options.name.split('-').join(' ') } let content = (await fs.readF...
javascript
async function run () { if (options.help || Object.keys(options).length === 1) { showHelp() return } if (!options.name) { console.error('You need to input -n, --name argv') return } if (!options.title) { options.title = options.name.split('-').join(' ') } let content = (await fs.readF...
[ "async", "function", "run", "(", ")", "{", "if", "(", "options", ".", "help", "||", "Object", ".", "keys", "(", "options", ")", ".", "length", "===", "1", ")", "{", "showHelp", "(", ")", "return", "}", "if", "(", "!", "options", ".", "name", ")",...
Perform document file writing. @returns {void}
[ "Perform", "document", "file", "writing", "." ]
063f343a88156979e5747088aa6364bc400c5a51
https://github.com/wenzhixin/multiple-select/blob/063f343a88156979e5747088aa6364bc400c5a51/tools/template.js#L36-L59
train
epoberezkin/ajv
lib/keyword.js
addKeyword
function addKeyword(keyword, definition) { /* jshint validthis: true */ /* eslint no-shadow: 0 */ var RULES = this.RULES; if (RULES.keywords[keyword]) throw new Error('Keyword ' + keyword + ' is already defined'); if (!IDENTIFIER.test(keyword)) throw new Error('Keyword ' + keyword + ' is not a valid ...
javascript
function addKeyword(keyword, definition) { /* jshint validthis: true */ /* eslint no-shadow: 0 */ var RULES = this.RULES; if (RULES.keywords[keyword]) throw new Error('Keyword ' + keyword + ' is already defined'); if (!IDENTIFIER.test(keyword)) throw new Error('Keyword ' + keyword + ' is not a valid ...
[ "function", "addKeyword", "(", "keyword", ",", "definition", ")", "{", "/* jshint validthis: true */", "/* eslint no-shadow: 0 */", "var", "RULES", "=", "this", ".", "RULES", ";", "if", "(", "RULES", ".", "keywords", "[", "keyword", "]", ")", "throw", "new", "...
Define custom keyword @this Ajv @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. @return {Ajv} this fo...
[ "Define", "custom", "keyword" ]
ab841b462ec4baff37d2a7319cef13820b53d963
https://github.com/epoberezkin/ajv/blob/ab841b462ec4baff37d2a7319cef13820b53d963/lib/keyword.js#L22-L87
train
epoberezkin/ajv
lib/keyword.js
validateKeyword
function validateKeyword(definition, throwError) { validateKeyword.errors = null; var v = this._validateKeyword = this._validateKeyword || this.compile(definitionSchema, true); if (v(definition)) return true; validateKeyword.errors = v.errors; if (throwError) throw new E...
javascript
function validateKeyword(definition, throwError) { validateKeyword.errors = null; var v = this._validateKeyword = this._validateKeyword || this.compile(definitionSchema, true); if (v(definition)) return true; validateKeyword.errors = v.errors; if (throwError) throw new E...
[ "function", "validateKeyword", "(", "definition", ",", "throwError", ")", "{", "validateKeyword", ".", "errors", "=", "null", ";", "var", "v", "=", "this", ".", "_validateKeyword", "=", "this", ".", "_validateKeyword", "||", "this", ".", "compile", "(", "def...
Validate keyword definition @this Ajv @param {Object} definition keyword definition object. @param {Boolean} throwError true to throw exception if definition is invalid @return {boolean} validation result
[ "Validate", "keyword", "definition" ]
ab841b462ec4baff37d2a7319cef13820b53d963
https://github.com/epoberezkin/ajv/blob/ab841b462ec4baff37d2a7319cef13820b53d963/lib/keyword.js#L135-L146
train
epoberezkin/ajv
lib/compile/resolve.js
resolveSchema
function resolveSchema(root, ref) { /* jshint validthis: true */ var p = URI.parse(ref) , refPath = _getFullPath(p) , baseId = getFullPath(this._getId(root.schema)); if (Object.keys(root.schema).length === 0 || refPath !== baseId) { var id = normalizeId(refPath); var refVal = this._refs[id]; i...
javascript
function resolveSchema(root, ref) { /* jshint validthis: true */ var p = URI.parse(ref) , refPath = _getFullPath(p) , baseId = getFullPath(this._getId(root.schema)); if (Object.keys(root.schema).length === 0 || refPath !== baseId) { var id = normalizeId(refPath); var refVal = this._refs[id]; i...
[ "function", "resolveSchema", "(", "root", ",", "ref", ")", "{", "/* jshint validthis: true */", "var", "p", "=", "URI", ".", "parse", "(", "ref", ")", ",", "refPath", "=", "_getFullPath", "(", "p", ")", ",", "baseId", "=", "getFullPath", "(", "this", "."...
Resolve schema, its root and baseId @this Ajv @param {Object} root root object with properties schema, refVal, refs @param {String} ref reference to resolve @return {Object} object with properties schema, root, baseId
[ "Resolve", "schema", "its", "root", "and", "baseId" ]
ab841b462ec4baff37d2a7319cef13820b53d963
https://github.com/epoberezkin/ajv/blob/ab841b462ec4baff37d2a7319cef13820b53d963/lib/compile/resolve.js#L68-L96
train
epoberezkin/ajv
lib/ajv.js
compile
function compile(schema, _meta) { var schemaObj = this._addSchema(schema, undefined, _meta); return schemaObj.validate || this._compile(schemaObj); }
javascript
function compile(schema, _meta) { var schemaObj = this._addSchema(schema, undefined, _meta); return schemaObj.validate || this._compile(schemaObj); }
[ "function", "compile", "(", "schema", ",", "_meta", ")", "{", "var", "schemaObj", "=", "this", ".", "_addSchema", "(", "schema", ",", "undefined", ",", "_meta", ")", ";", "return", "schemaObj", ".", "validate", "||", "this", ".", "_compile", "(", "schema...
Create validating function for passed schema. @this Ajv @param {Object} schema schema object @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords. @return {Function} validating function
[ "Create", "validating", "function", "for", "passed", "schema", "." ]
ab841b462ec4baff37d2a7319cef13820b53d963
https://github.com/epoberezkin/ajv/blob/ab841b462ec4baff37d2a7319cef13820b53d963/lib/ajv.js#L111-L114
train
epoberezkin/ajv
lib/ajv.js
addSchema
function addSchema(schema, key, _skipValidation, _meta) { if (Array.isArray(schema)){ for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta); return this; } var id = this._getId(schema); if (id !== undefined && typeof id != 'string') throw new Error('schema ...
javascript
function addSchema(schema, key, _skipValidation, _meta) { if (Array.isArray(schema)){ for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta); return this; } var id = this._getId(schema); if (id !== undefined && typeof id != 'string') throw new Error('schema ...
[ "function", "addSchema", "(", "schema", ",", "key", ",", "_skipValidation", ",", "_meta", ")", "{", "if", "(", "Array", ".", "isArray", "(", "schema", ")", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "schema", ".", "length", ";", "...
Adds schema to the instance. @this Ajv @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` an...
[ "Adds", "schema", "to", "the", "instance", "." ]
ab841b462ec4baff37d2a7319cef13820b53d963
https://github.com/epoberezkin/ajv/blob/ab841b462ec4baff37d2a7319cef13820b53d963/lib/ajv.js#L126-L138
train
epoberezkin/ajv
lib/ajv.js
getSchema
function getSchema(keyRef) { var schemaObj = _getSchemaObj(this, keyRef); switch (typeof schemaObj) { case 'object': return schemaObj.validate || this._compile(schemaObj); case 'string': return this.getSchema(schemaObj); case 'undefined': return _getSchemaFragment(this, keyRef); } }
javascript
function getSchema(keyRef) { var schemaObj = _getSchemaObj(this, keyRef); switch (typeof schemaObj) { case 'object': return schemaObj.validate || this._compile(schemaObj); case 'string': return this.getSchema(schemaObj); case 'undefined': return _getSchemaFragment(this, keyRef); } }
[ "function", "getSchema", "(", "keyRef", ")", "{", "var", "schemaObj", "=", "_getSchemaObj", "(", "this", ",", "keyRef", ")", ";", "switch", "(", "typeof", "schemaObj", ")", "{", "case", "'object'", ":", "return", "schemaObj", ".", "validate", "||", "this",...
Get compiled schema from the instance by `key` or `ref`. @this Ajv @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id). @return {Function} schema validating function (with property `schema`).
[ "Get", "compiled", "schema", "from", "the", "instance", "by", "key", "or", "ref", "." ]
ab841b462ec4baff37d2a7319cef13820b53d963
https://github.com/epoberezkin/ajv/blob/ab841b462ec4baff37d2a7319cef13820b53d963/lib/ajv.js#L200-L207
train
epoberezkin/ajv
lib/ajv.js
errorsText
function errorsText(errors, options) { errors = errors || this.errors; if (!errors) return 'No errors'; options = options || {}; var separator = options.separator === undefined ? ', ' : options.separator; var dataVar = options.dataVar === undefined ? 'data' : options.dataVar; var text = ''; for (var i=0;...
javascript
function errorsText(errors, options) { errors = errors || this.errors; if (!errors) return 'No errors'; options = options || {}; var separator = options.separator === undefined ? ', ' : options.separator; var dataVar = options.dataVar === undefined ? 'data' : options.dataVar; var text = ''; for (var i=0;...
[ "function", "errorsText", "(", "errors", ",", "options", ")", "{", "errors", "=", "errors", "||", "this", ".", "errors", ";", "if", "(", "!", "errors", ")", "return", "'No errors'", ";", "options", "=", "options", "||", "{", "}", ";", "var", "separator...
Convert array of error message objects to string @this Ajv @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used. @param {Object} options optional options with properties `separator` and `dataVar`. @return {String} human readable string with all errors de...
[ "Convert", "array", "of", "error", "message", "objects", "to", "string" ]
ab841b462ec4baff37d2a7319cef13820b53d963
https://github.com/epoberezkin/ajv/blob/ab841b462ec4baff37d2a7319cef13820b53d963/lib/ajv.js#L410-L423
train
epoberezkin/ajv
lib/ajv.js
addFormat
function addFormat(name, format) { if (typeof format == 'string') format = new RegExp(format); this._formats[name] = format; return this; }
javascript
function addFormat(name, format) { if (typeof format == 'string') format = new RegExp(format); this._formats[name] = format; return this; }
[ "function", "addFormat", "(", "name", ",", "format", ")", "{", "if", "(", "typeof", "format", "==", "'string'", ")", "format", "=", "new", "RegExp", "(", "format", ")", ";", "this", ".", "_formats", "[", "name", "]", "=", "format", ";", "return", "th...
Add custom format @this Ajv @param {String} name format name @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid) @return {Ajv} this for method chaining
[ "Add", "custom", "format" ]
ab841b462ec4baff37d2a7319cef13820b53d963
https://github.com/epoberezkin/ajv/blob/ab841b462ec4baff37d2a7319cef13820b53d963/lib/ajv.js#L433-L437
train
epoberezkin/ajv
lib/compile/index.js
checkCompiling
function checkCompiling(schema, root, baseId) { /* jshint validthis: true */ var index = compIndex.call(this, schema, root, baseId); if (index >= 0) return { index: index, compiling: true }; index = this._compilations.length; this._compilations[index] = { schema: schema, root: root, baseId: baseId...
javascript
function checkCompiling(schema, root, baseId) { /* jshint validthis: true */ var index = compIndex.call(this, schema, root, baseId); if (index >= 0) return { index: index, compiling: true }; index = this._compilations.length; this._compilations[index] = { schema: schema, root: root, baseId: baseId...
[ "function", "checkCompiling", "(", "schema", ",", "root", ",", "baseId", ")", "{", "/* jshint validthis: true */", "var", "index", "=", "compIndex", ".", "call", "(", "this", ",", "schema", ",", "root", ",", "baseId", ")", ";", "if", "(", "index", ">=", ...
Checks if the schema is currently compiled @this Ajv @param {Object} schema schema to compile @param {Object} root root object @param {String} baseId base schema ID @return {Object} object with properties "index" (compilation index) and "compiling" (boolean)
[ "Checks", "if", "the", "schema", "is", "currently", "compiled" ]
ab841b462ec4baff37d2a7319cef13820b53d963
https://github.com/epoberezkin/ajv/blob/ab841b462ec4baff37d2a7319cef13820b53d963/lib/compile/index.js#L315-L326
train
epoberezkin/ajv
lib/compile/index.js
endCompiling
function endCompiling(schema, root, baseId) { /* jshint validthis: true */ var i = compIndex.call(this, schema, root, baseId); if (i >= 0) this._compilations.splice(i, 1); }
javascript
function endCompiling(schema, root, baseId) { /* jshint validthis: true */ var i = compIndex.call(this, schema, root, baseId); if (i >= 0) this._compilations.splice(i, 1); }
[ "function", "endCompiling", "(", "schema", ",", "root", ",", "baseId", ")", "{", "/* jshint validthis: true */", "var", "i", "=", "compIndex", ".", "call", "(", "this", ",", "schema", ",", "root", ",", "baseId", ")", ";", "if", "(", "i", ">=", "0", ")"...
Removes the schema from the currently compiled list @this Ajv @param {Object} schema schema to compile @param {Object} root root object @param {String} baseId base schema ID
[ "Removes", "the", "schema", "from", "the", "currently", "compiled", "list" ]
ab841b462ec4baff37d2a7319cef13820b53d963
https://github.com/epoberezkin/ajv/blob/ab841b462ec4baff37d2a7319cef13820b53d963/lib/compile/index.js#L336-L340
train
epoberezkin/ajv
lib/compile/index.js
compIndex
function compIndex(schema, root, baseId) { /* jshint validthis: true */ for (var i=0; i<this._compilations.length; i++) { var c = this._compilations[i]; if (c.schema == schema && c.root == root && c.baseId == baseId) return i; } return -1; }
javascript
function compIndex(schema, root, baseId) { /* jshint validthis: true */ for (var i=0; i<this._compilations.length; i++) { var c = this._compilations[i]; if (c.schema == schema && c.root == root && c.baseId == baseId) return i; } return -1; }
[ "function", "compIndex", "(", "schema", ",", "root", ",", "baseId", ")", "{", "/* jshint validthis: true */", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "_compilations", ".", "length", ";", "i", "++", ")", "{", "var", "c", "=", "th...
Index of schema compilation in the currently compiled list @this Ajv @param {Object} schema schema to compile @param {Object} root root object @param {String} baseId base schema ID @return {Integer} compilation index
[ "Index", "of", "schema", "compilation", "in", "the", "currently", "compiled", "list" ]
ab841b462ec4baff37d2a7319cef13820b53d963
https://github.com/epoberezkin/ajv/blob/ab841b462ec4baff37d2a7319cef13820b53d963/lib/compile/index.js#L351-L358
train
epoberezkin/ajv
lib/compile/async.js
compileAsync
function compileAsync(schema, meta, callback) { /* eslint no-shadow: 0 */ /* global Promise */ /* jshint validthis: true */ var self = this; if (typeof this._opts.loadSchema != 'function') throw new Error('options.loadSchema should be a function'); if (typeof meta == 'function') { callback = meta; ...
javascript
function compileAsync(schema, meta, callback) { /* eslint no-shadow: 0 */ /* global Promise */ /* jshint validthis: true */ var self = this; if (typeof this._opts.loadSchema != 'function') throw new Error('options.loadSchema should be a function'); if (typeof meta == 'function') { callback = meta; ...
[ "function", "compileAsync", "(", "schema", ",", "meta", ",", "callback", ")", "{", "/* eslint no-shadow: 0 */", "/* global Promise */", "/* jshint validthis: true */", "var", "self", "=", "this", ";", "if", "(", "typeof", "this", ".", "_opts", ".", "loadSchema", "...
Creates validating function for passed schema with asynchronous loading of missing schemas. `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema. @this Ajv @param {Object} schema schema object @param {Boolean} meta optional true to compile meta-schema; t...
[ "Creates", "validating", "function", "for", "passed", "schema", "with", "asynchronous", "loading", "of", "missing", "schemas", ".", "loadSchema", "option", "should", "be", "a", "function", "that", "accepts", "schema", "uri", "and", "returns", "promise", "that", ...
ab841b462ec4baff37d2a7319cef13820b53d963
https://github.com/epoberezkin/ajv/blob/ab841b462ec4baff37d2a7319cef13820b53d963/lib/compile/async.js#L17-L90
train
jdorn/json-editor
dist/jsoneditor.js
function() { var self = this, vars, j; // If this editor needs to be rendered by a macro template if(this.template) { vars = this.getWatchedFieldValues(); this.setValue(this.template(vars),false,true); } this._super(); }
javascript
function() { var self = this, vars, j; // If this editor needs to be rendered by a macro template if(this.template) { vars = this.getWatchedFieldValues(); this.setValue(this.template(vars),false,true); } this._super(); }
[ "function", "(", ")", "{", "var", "self", "=", "this", ",", "vars", ",", "j", ";", "// If this editor needs to be rendered by a macro template", "if", "(", "this", ".", "template", ")", "{", "vars", "=", "this", ".", "getWatchedFieldValues", "(", ")", ";", "...
Re-calculates the value if needed
[ "Re", "-", "calculates", "the", "value", "if", "needed" ]
682120870a9c7df36bd79969c5b883e0a189d92d
https://github.com/jdorn/json-editor/blob/682120870a9c7df36bd79969c5b883e0a189d92d/dist/jsoneditor.js#L2285-L2295
train
maptalks/maptalks.js
src/geometry/ext/Geometry.Events.js
function (event, type) { if (!this.getMap()) { return; } const eventType = type || this._getEventTypeToFire(event); if (eventType === 'contextmenu' && this.listens('contextmenu')) { stopPropagation(event); preventDefault(event); } const...
javascript
function (event, type) { if (!this.getMap()) { return; } const eventType = type || this._getEventTypeToFire(event); if (eventType === 'contextmenu' && this.listens('contextmenu')) { stopPropagation(event); preventDefault(event); } const...
[ "function", "(", "event", ",", "type", ")", "{", "if", "(", "!", "this", ".", "getMap", "(", ")", ")", "{", "return", ";", "}", "const", "eventType", "=", "type", "||", "this", ".", "_getEventTypeToFire", "(", "event", ")", ";", "if", "(", "eventTy...
The event handler for all the events. @param {Event} event - dom event @private
[ "The", "event", "handler", "for", "all", "the", "events", "." ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/geometry/ext/Geometry.Events.js#L10-L21
train
maptalks/maptalks.js
src/geometry/ext/Geometry.Events.js
function (e) { const map = this.getMap(); const eventParam = { 'domEvent': e }; const actual = e.touches && e.touches.length > 0 ? e.touches[0] : e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches[0] : e; if (actual) { const containerPoint...
javascript
function (e) { const map = this.getMap(); const eventParam = { 'domEvent': e }; const actual = e.touches && e.touches.length > 0 ? e.touches[0] : e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches[0] : e; if (actual) { const containerPoint...
[ "function", "(", "e", ")", "{", "const", "map", "=", "this", ".", "getMap", "(", ")", ";", "const", "eventParam", "=", "{", "'domEvent'", ":", "e", "}", ";", "const", "actual", "=", "e", ".", "touches", "&&", "e", ".", "touches", ".", "length", "...
Generate event parameters @param {Event} event - dom event @return {Object} @private
[ "Generate", "event", "parameters" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/geometry/ext/Geometry.Events.js#L40-L54
train
maptalks/maptalks.js
src/map/Map.Topo.js
function (coord1, coord2) { if (!this.getProjection()) { return null; } const p1 = new Coordinate(coord1), p2 = new Coordinate(coord2); if (p1.equals(p2)) { return 0; } return this.getProjection().measureLength(p1, p2); }
javascript
function (coord1, coord2) { if (!this.getProjection()) { return null; } const p1 = new Coordinate(coord1), p2 = new Coordinate(coord2); if (p1.equals(p2)) { return 0; } return this.getProjection().measureLength(p1, p2); }
[ "function", "(", "coord1", ",", "coord2", ")", "{", "if", "(", "!", "this", ".", "getProjection", "(", ")", ")", "{", "return", "null", ";", "}", "const", "p1", "=", "new", "Coordinate", "(", "coord1", ")", ",", "p2", "=", "new", "Coordinate", "(",...
Caculate distance of two coordinates. @param {Number[]|Coordinate} coord1 - coordinate 1 @param {Number[]|Coordinate} coord2 - coordinate 2 @return {Number} distance, unit is meter @example var distance = map.computeLength([0, 0], [0, 20]);
[ "Caculate", "distance", "of", "two", "coordinates", "." ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/map/Map.Topo.js#L18-L28
train
maptalks/maptalks.js
src/map/Map.Topo.js
function (opts, callback) { if (!opts) { return this; } const reqLayers = opts['layers']; if (!isArrayHasData(reqLayers)) { return this; } const layers = []; for (let i = 0, len = reqLayers.length; i < len; i++) { if (isString(r...
javascript
function (opts, callback) { if (!opts) { return this; } const reqLayers = opts['layers']; if (!isArrayHasData(reqLayers)) { return this; } const layers = []; for (let i = 0, len = reqLayers.length; i < len; i++) { if (isString(r...
[ "function", "(", "opts", ",", "callback", ")", "{", "if", "(", "!", "opts", ")", "{", "return", "this", ";", "}", "const", "reqLayers", "=", "opts", "[", "'layers'", "]", ";", "if", "(", "!", "isArrayHasData", "(", "reqLayers", ")", ")", "{", "retu...
Identify the geometries on the given coordinate. @param {Object} opts - the identify options @param {Coordinate} opts.coordinate - coordinate to identify @param {Object} opts.layers - the layers to perform identify on. @param {Function} [opts.filter=null] - filter function of the result geometries, return fals...
[ "Identify", "the", "geometries", "on", "the", "given", "coordinate", "." ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/map/Map.Topo.js#L69-L107
train
maptalks/maptalks.js
src/geometry/ext/Geometry.Animation.js
function (styles, options, step) { if (this._animPlayer) { this._animPlayer.finish(); } if (isFunction(options)) { step = options; } if (!options) { options = {}; } const map = this.getMap(), projection = this._getPr...
javascript
function (styles, options, step) { if (this._animPlayer) { this._animPlayer.finish(); } if (isFunction(options)) { step = options; } if (!options) { options = {}; } const map = this.getMap(), projection = this._getPr...
[ "function", "(", "styles", ",", "options", ",", "step", ")", "{", "if", "(", "this", ".", "_animPlayer", ")", "{", "this", ".", "_animPlayer", ".", "finish", "(", ")", ";", "}", "if", "(", "isFunction", "(", "options", ")", ")", "{", "step", "=", ...
Animate the geometry @param {Object} styles - styles to animate @param {Object} [options=null] - animation options @param {NUmber} [options.duration=1000] - duration @param {Number} [options.startTime=null] - time to start animation in ms @param {String} [options.easing=linear] - anima...
[ "Animate", "the", "geometry" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/geometry/ext/Geometry.Animation.js#L33-L106
train
maptalks/maptalks.js
src/geometry/ext/Geometry.Animation.js
function (styles) { const symbol = this._getInternalSymbol(); const stylesToAnimate = {}; for (const p in styles) { if (styles.hasOwnProperty(p)) { const v = styles[p]; if (p !== 'translate' && p !== 'symbol') { //this.getRadius() /...
javascript
function (styles) { const symbol = this._getInternalSymbol(); const stylesToAnimate = {}; for (const p in styles) { if (styles.hasOwnProperty(p)) { const v = styles[p]; if (p !== 'translate' && p !== 'symbol') { //this.getRadius() /...
[ "function", "(", "styles", ")", "{", "const", "symbol", "=", "this", ".", "_getInternalSymbol", "(", ")", ";", "const", "stylesToAnimate", "=", "{", "}", ";", "for", "(", "const", "p", "in", "styles", ")", "{", "if", "(", "styles", ".", "hasOwnProperty...
Prepare styles for animation @return {Object} styles @private
[ "Prepare", "styles", "for", "animation" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/geometry/ext/Geometry.Animation.js#L112-L162
train
maptalks/maptalks.js
src/core/Ajax.js
function (url, options, cb) { if (isFunction(options)) { const t = cb; cb = options; options = t; } if (IS_NODE && Ajax.get.node) { return Ajax.get.node(url, cb, options); } const client = Ajax._getClient(cb); client.open('G...
javascript
function (url, options, cb) { if (isFunction(options)) { const t = cb; cb = options; options = t; } if (IS_NODE && Ajax.get.node) { return Ajax.get.node(url, cb, options); } const client = Ajax._getClient(cb); client.open('G...
[ "function", "(", "url", ",", "options", ",", "cb", ")", "{", "if", "(", "isFunction", "(", "options", ")", ")", "{", "const", "t", "=", "cb", ";", "cb", "=", "options", ";", "options", "=", "t", ";", "}", "if", "(", "IS_NODE", "&&", "Ajax", "."...
Fetch remote resource by HTTP "GET" method @param {String} url - resource url @param {Object} [options=null] - request options @param {Object} [options.headers=null] - HTTP headers @param {String} [options.responseType=null] - responseType @param {String} [options.credentials=null] - if with credentials...
[ "Fetch", "remote", "resource", "by", "HTTP", "GET", "method" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/core/Ajax.js#L62-L84
train
maptalks/maptalks.js
src/core/Ajax.js
function (url, options, cb) { let postData; if (!isString(url)) { //for compatible //options, postData, cb const t = cb; postData = options; options = url; url = options.url; cb = t; } else { if (isFu...
javascript
function (url, options, cb) { let postData; if (!isString(url)) { //for compatible //options, postData, cb const t = cb; postData = options; options = url; url = options.url; cb = t; } else { if (isFu...
[ "function", "(", "url", ",", "options", ",", "cb", ")", "{", "let", "postData", ";", "if", "(", "!", "isString", "(", "url", ")", ")", "{", "//for compatible", "//options, postData, cb", "const", "t", "=", "cb", ";", "postData", "=", "options", ";", "o...
Fetch remote resource by HTTP "POST" method @param {String} url - resource url @param {Object} options - request options @param {String|Object} options.postData - post data @param {Object} [options.headers=null] - HTTP headers @param {Function} cb - callback function when completed @return {Ajax} Ajax @e...
[ "Fetch", "remote", "resource", "by", "HTTP", "POST", "method" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/core/Ajax.js#L111-L154
train
maptalks/maptalks.js
src/map/Map.Pan.js
function (coordinate, options = {}, step) { if (!coordinate) { return this; } if (isFunction(options)) { step = options; options = {}; } coordinate = new Coordinate(coordinate); if (typeof (options['animation']) === 'undefined' || optio...
javascript
function (coordinate, options = {}, step) { if (!coordinate) { return this; } if (isFunction(options)) { step = options; options = {}; } coordinate = new Coordinate(coordinate); if (typeof (options['animation']) === 'undefined' || optio...
[ "function", "(", "coordinate", ",", "options", "=", "{", "}", ",", "step", ")", "{", "if", "(", "!", "coordinate", ")", "{", "return", "this", ";", "}", "if", "(", "isFunction", "(", "options", ")", ")", "{", "step", "=", "options", ";", "options",...
Pan to the given coordinate @param {Coordinate} coordinate - coordinate to pan to @param {Object} [options=null] - pan options @param {Boolean} [options.animation=null] - whether pan with animation @param {Boolean} [options.duration=600] - pan animation duration @return {Map} this
[ "Pan", "to", "the", "given", "coordinate" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/map/Map.Pan.js#L16-L31
train
maptalks/maptalks.js
src/map/Map.Pan.js
function (offset, options = {}, step) { if (!offset) { return this; } if (isFunction(options)) { step = options; options = {}; } offset = new Point(offset); this.onMoveStart(); if (typeof (options['animation']) === 'undefined' |...
javascript
function (offset, options = {}, step) { if (!offset) { return this; } if (isFunction(options)) { step = options; options = {}; } offset = new Point(offset); this.onMoveStart(); if (typeof (options['animation']) === 'undefined' |...
[ "function", "(", "offset", ",", "options", "=", "{", "}", ",", "step", ")", "{", "if", "(", "!", "offset", ")", "{", "return", "this", ";", "}", "if", "(", "isFunction", "(", "options", ")", ")", "{", "step", "=", "options", ";", "options", "=", ...
Pan the map by the give point @param {Point} point - distance to pan, in pixel @param {Object} [options=null] - pan options @param {Boolean} [options.animation=null] - whether pan with animation @param {Boolean} [options.duration=600] - pan animation duration @return {Map} this
[ "Pan", "the", "map", "by", "the", "give", "point" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/map/Map.Pan.js#L41-L60
train
maptalks/maptalks.js
src/geo/measurer/Sphere.js
rhumbBearing
function rhumbBearing(start, end, options = {}) { let bear360; if (options.final) bear360 = calculateRhumbBearing(end, start); else bear360 = calculateRhumbBearing(start, end); const bear180 = (bear360 > 180) ? -(360 - bear360) : bear360; return bear180; }
javascript
function rhumbBearing(start, end, options = {}) { let bear360; if (options.final) bear360 = calculateRhumbBearing(end, start); else bear360 = calculateRhumbBearing(start, end); const bear180 = (bear360 > 180) ? -(360 - bear360) : bear360; return bear180; }
[ "function", "rhumbBearing", "(", "start", ",", "end", ",", "options", "=", "{", "}", ")", "{", "let", "bear360", ";", "if", "(", "options", ".", "final", ")", "bear360", "=", "calculateRhumbBearing", "(", "end", ",", "start", ")", ";", "else", "bear360...
from turf.js
[ "from", "turf", ".", "js" ]
8ee32cb20c5ea79dd687e1076c1310a288955792
https://github.com/maptalks/maptalks.js/blob/8ee32cb20c5ea79dd687e1076c1310a288955792/src/geo/measurer/Sphere.js#L117-L125
train
CreateJS/TweenJS
build/updates/builder.js
function (helpers) { Y.log('Importing helpers: ' + helpers, 'info', 'builder'); helpers.forEach(function (imp) { if (!Y.Files.exists(imp) || Y.Files.exists(path.join(process.cwd(), imp))) { imp = path.join(process.cwd(), imp); } ...
javascript
function (helpers) { Y.log('Importing helpers: ' + helpers, 'info', 'builder'); helpers.forEach(function (imp) { if (!Y.Files.exists(imp) || Y.Files.exists(path.join(process.cwd(), imp))) { imp = path.join(process.cwd(), imp); } ...
[ "function", "(", "helpers", ")", "{", "Y", ".", "log", "(", "'Importing helpers: '", "+", "helpers", ",", "'info'", ",", "'builder'", ")", ";", "helpers", ".", "forEach", "(", "function", "(", "imp", ")", "{", "if", "(", "!", "Y", ".", "Files", ".", ...
Register a `Y.Handlebars` helper method @method _addHelpers @param {Object} helpers Object containing a hash of names and functions
[ "Register", "a", "Y", ".", "Handlebars", "helper", "method" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L125-L136
train
CreateJS/TweenJS
build/updates/builder.js
function (md) { var html = marked(md, this.options.markdown); //Only reprocess if helpers were asked for if (this.options.helpers || (html.indexOf('{{#crossLink') > -1)) { //console.log('MD: ', html); try { // marked auto-escapes qu...
javascript
function (md) { var html = marked(md, this.options.markdown); //Only reprocess if helpers were asked for if (this.options.helpers || (html.indexOf('{{#crossLink') > -1)) { //console.log('MD: ', html); try { // marked auto-escapes qu...
[ "function", "(", "md", ")", "{", "var", "html", "=", "marked", "(", "md", ",", "this", ".", "options", ".", "markdown", ")", ";", "//Only reprocess if helpers were asked for", "if", "(", "this", ".", "options", ".", "helpers", "||", "(", "html", ".", "in...
Wrapper around the Markdown parser so it can be normalized or even side stepped @method markdown @private @param {String} md The Markdown string to parse @return {HTML} The rendered HTML
[ "Wrapper", "around", "the", "Markdown", "parser", "so", "it", "can", "be", "normalized", "or", "even", "side", "stepped" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L144-L162
train
CreateJS/TweenJS
build/updates/builder.js
function () { var self = this; Y.log('External data received, mixing', 'info', 'builder'); self.options.externalData.forEach(function (exData) { ['files', 'classes', 'modules'].forEach(function (k) { Y.each(exData[k], function (item, key) { ...
javascript
function () { var self = this; Y.log('External data received, mixing', 'info', 'builder'); self.options.externalData.forEach(function (exData) { ['files', 'classes', 'modules'].forEach(function (k) { Y.each(exData[k], function (item, key) { ...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "Y", ".", "log", "(", "'External data received, mixing'", ",", "'info'", ",", "'builder'", ")", ";", "self", ".", "options", ".", "externalData", ".", "forEach", "(", "function", "(", "exData", ...
Mixes the various external data soures together into the local data, augmenting it with flags. @method _mixExternal @private
[ "Mixes", "the", "various", "external", "data", "soures", "together", "into", "the", "local", "data", "augmenting", "it", "with", "flags", "." ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L330-L371
train
CreateJS/TweenJS
build/updates/builder.js
function (cb) { var self = this, info = self.options.external; if (!info) { cb(); return; } if (!info.merge) { info.merge = 'mix'; } if (!info.data) { Y.log('External ...
javascript
function (cb) { var self = this, info = self.options.external; if (!info) { cb(); return; } if (!info.merge) { info.merge = 'mix'; } if (!info.data) { Y.log('External ...
[ "function", "(", "cb", ")", "{", "var", "self", "=", "this", ",", "info", "=", "self", ".", "options", ".", "external", ";", "if", "(", "!", "info", ")", "{", "cb", "(", ")", ";", "return", ";", "}", "if", "(", "!", "info", ".", "merge", ")",...
Fetches the remote data and fires the callback when it's all complete @method mixExternal @param {Callback} cb The callback to execute when complete @async
[ "Fetches", "the", "remote", "data", "and", "fires", "the", "callback", "when", "it", "s", "all", "complete" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L378-L438
train
CreateJS/TweenJS
build/updates/builder.js
function () { var obj = { meta: { yuiSeedUrl: 'http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js', yuiGridsUrl: 'http://yui.yahooapis.com/3.5.0/build/cssgrids/cssgrids-min.css' } }; if (!this._meta) { ...
javascript
function () { var obj = { meta: { yuiSeedUrl: 'http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js', yuiGridsUrl: 'http://yui.yahooapis.com/3.5.0/build/cssgrids/cssgrids-min.css' } }; if (!this._meta) { ...
[ "function", "(", ")", "{", "var", "obj", "=", "{", "meta", ":", "{", "yuiSeedUrl", ":", "'http://yui.yahooapis.com/3.5.0/build/yui/yui-min.js'", ",", "yuiGridsUrl", ":", "'http://yui.yahooapis.com/3.5.0/build/cssgrids/cssgrids-min.css'", "}", "}", ";", "if", "(", "!", ...
Prep the meta data to be fed to Selleck @method getProjectMeta @return {Object} The project metadata
[ "Prep", "the", "meta", "data", "to", "be", "fed", "to", "Selleck" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L457-L494
train
CreateJS/TweenJS
build/updates/builder.js
function (opts) { opts.meta.classes = []; Y.each(this.data.classes, function (v) { if (v.external) { return; } opts.meta.classes.push({ displayName: v.name, name: v.name, ...
javascript
function (opts) { opts.meta.classes = []; Y.each(this.data.classes, function (v) { if (v.external) { return; } opts.meta.classes.push({ displayName: v.name, name: v.name, ...
[ "function", "(", "opts", ")", "{", "opts", ".", "meta", ".", "classes", "=", "[", "]", ";", "Y", ".", "each", "(", "this", ".", "data", ".", "classes", ",", "function", "(", "v", ")", "{", "if", "(", "v", ".", "external", ")", "{", "return", ...
Populate the meta data for classes @method populateClasses @param {Object} opts The original options @return {Object} The modified options
[ "Populate", "the", "meta", "data", "for", "classes" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L501-L518
train
CreateJS/TweenJS
build/updates/builder.js
function (opts) { var self = this; opts.meta.modules = []; opts.meta.allModules = []; Y.each(this.data.modules, function (v) { if (v.external) { return; } opts.meta.allModules.push({ d...
javascript
function (opts) { var self = this; opts.meta.modules = []; opts.meta.allModules = []; Y.each(this.data.modules, function (v) { if (v.external) { return; } opts.meta.allModules.push({ d...
[ "function", "(", "opts", ")", "{", "var", "self", "=", "this", ";", "opts", ".", "meta", ".", "modules", "=", "[", "]", ";", "opts", ".", "meta", ".", "allModules", "=", "[", "]", ";", "Y", ".", "each", "(", "this", ".", "data", ".", "modules",...
Populate the meta data for modules @method populateModules @param {Object} opts The original options @return {Object} The modified options
[ "Populate", "the", "meta", "data", "for", "modules" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L525-L564
train
CreateJS/TweenJS
build/updates/builder.js
function (opts) { var self = this; opts.meta.files = []; Y.each(this.data.files, function (v) { if (v.external) { return; } opts.meta.files.push({ displayName: v.name, name: se...
javascript
function (opts) { var self = this; opts.meta.files = []; Y.each(this.data.files, function (v) { if (v.external) { return; } opts.meta.files.push({ displayName: v.name, name: se...
[ "function", "(", "opts", ")", "{", "var", "self", "=", "this", ";", "opts", ".", "meta", ".", "files", "=", "[", "]", ";", "Y", ".", "each", "(", "this", ".", "data", ".", "files", ",", "function", "(", "v", ")", "{", "if", "(", "v", ".", "...
Populate the meta data for files @method populateFiles @param {Object} opts The original options @return {Object} The modified options
[ "Populate", "the", "meta", "data", "for", "files" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L571-L621
train
CreateJS/TweenJS
build/updates/builder.js
function (a) { var self = this; if (a.file && a.line && !self.options.nocode) { a.foundAt = '../files/' + self.filterFileName(a.file) + '.html#l' + a.line; if (a.path) { a.foundAt = a.path + '#l' + a.line; } } ...
javascript
function (a) { var self = this; if (a.file && a.line && !self.options.nocode) { a.foundAt = '../files/' + self.filterFileName(a.file) + '.html#l' + a.line; if (a.path) { a.foundAt = a.path + '#l' + a.line; } } ...
[ "function", "(", "a", ")", "{", "var", "self", "=", "this", ";", "if", "(", "a", ".", "file", "&&", "a", ".", "line", "&&", "!", "self", ".", "options", ".", "nocode", ")", "{", "a", ".", "foundAt", "=", "'../files/'", "+", "self", ".", "filter...
Parses file and line number from an item object and build's an HREF @method addFoundAt @param {Object} a The item to parse @return {String} The parsed HREF
[ "Parses", "file", "and", "line", "number", "from", "an", "item", "object", "and", "build", "s", "an", "HREF" ]
5678f99ce876a62b2b7f7ad686d0e5b2531def3a
https://github.com/CreateJS/TweenJS/blob/5678f99ce876a62b2b7f7ad686d0e5b2531def3a/build/updates/builder.js#L628-L637
train