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
phulas/x-ray-nightmare
index.js
driver
function driver(options, fn) { if ('function' == typeof options) fn = options, options = {}; options = options || {}; fn = fn || electron; var nightmare = new Nightmare(options); return function nightmare_driver(ctx, done) { if (ctx !=null) { debug('goingto %s', ctx.url); ...
javascript
function driver(options, fn) { if ('function' == typeof options) fn = options, options = {}; options = options || {}; fn = fn || electron; var nightmare = new Nightmare(options); return function nightmare_driver(ctx, done) { if (ctx !=null) { debug('goingto %s', ctx.url); ...
[ "function", "driver", "(", "options", ",", "fn", ")", "{", "if", "(", "'function'", "==", "typeof", "options", ")", "fn", "=", "options", ",", "options", "=", "{", "}", ";", "options", "=", "options", "||", "{", "}", ";", "fn", "=", "fn", "||", "...
Initialize the `driver` with the following `options` @param {Object} options @param {Function} fn @return {Function} @api public
[ "Initialize", "the", "driver", "with", "the", "following", "options" ]
d92f39a46e5e126254cdda6de34d39476fa1f6f8
https://github.com/phulas/x-ray-nightmare/blob/d92f39a46e5e126254cdda6de34d39476fa1f6f8/index.js#L26-L110
train
flux-capacitor/flux-capacitor
packages/flux-capacitor/lib/database/combineChangesets.js
combineChangesets
function combineChangesets (changesets) { const actions = changesets.map((changeset) => changeset.apply) const combinedAction = function () { const args = arguments return actions.reduce((promise, action) => ( promise.then(() => action.apply(null, args)) ), Promise.resolve()) } return creat...
javascript
function combineChangesets (changesets) { const actions = changesets.map((changeset) => changeset.apply) const combinedAction = function () { const args = arguments return actions.reduce((promise, action) => ( promise.then(() => action.apply(null, args)) ), Promise.resolve()) } return creat...
[ "function", "combineChangesets", "(", "changesets", ")", "{", "const", "actions", "=", "changesets", ".", "map", "(", "(", "changeset", ")", "=>", "changeset", ".", "apply", ")", "const", "combinedAction", "=", "function", "(", ")", "{", "const", "args", "...
Takes an array of changesets and returns a single changeset that contains all of the input changeset's DB operations. @param {Changeset[]} changesets @return {Changeset}
[ "Takes", "an", "array", "of", "changesets", "and", "returns", "a", "single", "changeset", "that", "contains", "all", "of", "the", "input", "changeset", "s", "DB", "operations", "." ]
66393138ecdff9c1ba81d88b53144220e593584f
https://github.com/flux-capacitor/flux-capacitor/blob/66393138ecdff9c1ba81d88b53144220e593584f/packages/flux-capacitor/lib/database/combineChangesets.js#L12-L24
train
igorski/zCanvas
src/Loader.js
isDataSource
function isDataSource( image ) { const source = (typeof image === "string" ? image : image.src).substr(0, 5); // base 64 string contains data-attribute, the MIME type and then the content, e.g. : // e.g. "data:image/png;base64," for a typical PNG, Blob string contains no MIME, e.g.: // blob:http://loc...
javascript
function isDataSource( image ) { const source = (typeof image === "string" ? image : image.src).substr(0, 5); // base 64 string contains data-attribute, the MIME type and then the content, e.g. : // e.g. "data:image/png;base64," for a typical PNG, Blob string contains no MIME, e.g.: // blob:http://loc...
[ "function", "isDataSource", "(", "image", ")", "{", "const", "source", "=", "(", "typeof", "image", "===", "\"string\"", "?", "image", ":", "image", ".", "src", ")", ".", "substr", "(", "0", ",", "5", ")", ";", "// base 64 string contains data-attribute, the...
checks whether the contents of an Image are either a base64 encoded string or a Blob @private @param {Image|string} image when string, it is the src attribute of an Image @return {boolean}
[ "checks", "whether", "the", "contents", "of", "an", "Image", "are", "either", "a", "base64", "encoded", "string", "or", "a", "Blob" ]
8b5cd8e195178a80a9bc4ace7ea0b94dfe6b3f82
https://github.com/igorski/zCanvas/blob/8b5cd8e195178a80a9bc4ace7ea0b94dfe6b3f82/src/Loader.js#L196-L204
train
HarasimowiczKamil/any-base
index.js
anyBase
function anyBase(srcAlphabet, dstAlphabet) { var converter = new Converter(srcAlphabet, dstAlphabet); /** * Convert function * * @param {string|Array} number * * @return {string|Array} number */ return function (number) { return converter.convert(number); } }
javascript
function anyBase(srcAlphabet, dstAlphabet) { var converter = new Converter(srcAlphabet, dstAlphabet); /** * Convert function * * @param {string|Array} number * * @return {string|Array} number */ return function (number) { return converter.convert(number); } }
[ "function", "anyBase", "(", "srcAlphabet", ",", "dstAlphabet", ")", "{", "var", "converter", "=", "new", "Converter", "(", "srcAlphabet", ",", "dstAlphabet", ")", ";", "/**\n * Convert function\n *\n * @param {string|Array} number\n *\n * @return {string|Arr...
Function get source and destination alphabet and return convert function @param {string|Array} srcAlphabet @param {string|Array} dstAlphabet @returns {function(number|Array)}
[ "Function", "get", "source", "and", "destination", "alphabet", "and", "return", "convert", "function" ]
7595a7398959618a93cb4edef0bae3e035eb3ce0
https://github.com/HarasimowiczKamil/any-base/blob/7595a7398959618a93cb4edef0bae3e035eb3ce0/index.js#L11-L23
train
Cloud9Trader/oanda-adapter
lib/utils.js
function (fn, context, rate, warningThreshold) { var queue = [], timeout; function next () { if (queue.length === 0) { timeout = null; return; } fn.apply(context, queue.shift()); timeout = setTimeout(next, ...
javascript
function (fn, context, rate, warningThreshold) { var queue = [], timeout; function next () { if (queue.length === 0) { timeout = null; return; } fn.apply(context, queue.shift()); timeout = setTimeout(next, ...
[ "function", "(", "fn", ",", "context", ",", "rate", ",", "warningThreshold", ")", "{", "var", "queue", "=", "[", "]", ",", "timeout", ";", "function", "next", "(", ")", "{", "if", "(", "queue", ".", "length", "===", "0", ")", "{", "timeout", "=", ...
Function wrapper will limit fn invocations to one per rate. All will be queued for delayed execution where limit is exceeded, with warning logged where delay exceeds warningThreshold
[ "Function", "wrapper", "will", "limit", "fn", "invocations", "to", "one", "per", "rate", ".", "All", "will", "be", "queued", "for", "delayed", "execution", "where", "limit", "is", "exceeded", "with", "warning", "logged", "where", "delay", "exceeds", "warningTh...
33dcc3955ec965b0d7724fd8804ac2f0bf6f89c1
https://github.com/Cloud9Trader/oanda-adapter/blob/33dcc3955ec965b0d7724fd8804ac2f0bf6f89c1/lib/utils.js#L5-L36
train
piecioshka/super-event-emitter
src/index.js
function (name, fn, ctx) { assert(isString(name), 'EventEmitter#on: name is not a string'); assert(isFunction(fn), 'EventEmitter#on: fn is not a function'); // If the context is not passed, use `this`. ctx = ctx || this; // Push to private lists of listeners. this._list...
javascript
function (name, fn, ctx) { assert(isString(name), 'EventEmitter#on: name is not a string'); assert(isFunction(fn), 'EventEmitter#on: fn is not a function'); // If the context is not passed, use `this`. ctx = ctx || this; // Push to private lists of listeners. this._list...
[ "function", "(", "name", ",", "fn", ",", "ctx", ")", "{", "assert", "(", "isString", "(", "name", ")", ",", "'EventEmitter#on: name is not a string'", ")", ";", "assert", "(", "isFunction", "(", "fn", ")", ",", "'EventEmitter#on: fn is not a function'", ")", "...
Register listener on concrete name with specified handler. @param {string} name @param {Function} fn @param {Object} [ctx]
[ "Register", "listener", "on", "concrete", "name", "with", "specified", "handler", "." ]
4115220f468721e0f8249fcbf37091557cbc6e09
https://github.com/piecioshka/super-event-emitter/blob/4115220f468721e0f8249fcbf37091557cbc6e09/src/index.js#L76-L91
train
piecioshka/super-event-emitter
src/index.js
function (name, fn, ctx) { // If the context is not passed, use `this`. ctx = ctx || this; var self = this; function onHandler() { fn.apply(ctx, arguments); self.off(name, onHandler); } this.on(name, onHandler, ctx); return this; }
javascript
function (name, fn, ctx) { // If the context is not passed, use `this`. ctx = ctx || this; var self = this; function onHandler() { fn.apply(ctx, arguments); self.off(name, onHandler); } this.on(name, onHandler, ctx); return this; }
[ "function", "(", "name", ",", "fn", ",", "ctx", ")", "{", "// If the context is not passed, use `this`.", "ctx", "=", "ctx", "||", "this", ";", "var", "self", "=", "this", ";", "function", "onHandler", "(", ")", "{", "fn", ".", "apply", "(", "ctx", ",", ...
Register listener. Remove them after once event triggered. @param {string} name @param {Function} fn @param {Object} [ctx]
[ "Register", "listener", ".", "Remove", "them", "after", "once", "event", "triggered", "." ]
4115220f468721e0f8249fcbf37091557cbc6e09
https://github.com/piecioshka/super-event-emitter/blob/4115220f468721e0f8249fcbf37091557cbc6e09/src/index.js#L101-L115
train
piecioshka/super-event-emitter
src/index.js
function (name, fn) { this._listeners = !name ? [] : filter(this._listeners, function (listener) { if (listener.name !== name) { return true; } else { if (isFunction(fn)) { return listener.fn ...
javascript
function (name, fn) { this._listeners = !name ? [] : filter(this._listeners, function (listener) { if (listener.name !== name) { return true; } else { if (isFunction(fn)) { return listener.fn ...
[ "function", "(", "name", ",", "fn", ")", "{", "this", ".", "_listeners", "=", "!", "name", "?", "[", "]", ":", "filter", "(", "this", ".", "_listeners", ",", "function", "(", "listener", ")", "{", "if", "(", "listener", ".", "name", "!==", "name", ...
Unregister listener. Remove concrete listener by name and itself definition. @param {string} [name] @param {Function} [fn]
[ "Unregister", "listener", ".", "Remove", "concrete", "listener", "by", "name", "and", "itself", "definition", "." ]
4115220f468721e0f8249fcbf37091557cbc6e09
https://github.com/piecioshka/super-event-emitter/blob/4115220f468721e0f8249fcbf37091557cbc6e09/src/index.js#L124-L140
train
piecioshka/super-event-emitter
src/index.js
function (name, params) { assert(isString(name), 'EventEmitter#emit: name is not a string'); forEach(this._listeners, function (event) { if (event.name === name) { event.fn.call(event.ctx, params); } // Special behaviour for wildcard - invoke each ev...
javascript
function (name, params) { assert(isString(name), 'EventEmitter#emit: name is not a string'); forEach(this._listeners, function (event) { if (event.name === name) { event.fn.call(event.ctx, params); } // Special behaviour for wildcard - invoke each ev...
[ "function", "(", "name", ",", "params", ")", "{", "assert", "(", "isString", "(", "name", ")", ",", "'EventEmitter#emit: name is not a string'", ")", ";", "forEach", "(", "this", ".", "_listeners", ",", "function", "(", "event", ")", "{", "if", "(", "event...
Trigger event. All of listeners waiting for emit event will be executed. @param {string} name @param {Object} [params]
[ "Trigger", "event", ".", "All", "of", "listeners", "waiting", "for", "emit", "event", "will", "be", "executed", "." ]
4115220f468721e0f8249fcbf37091557cbc6e09
https://github.com/piecioshka/super-event-emitter/blob/4115220f468721e0f8249fcbf37091557cbc6e09/src/index.js#L149-L166
train
stamoern/wdio-element-screenshot
src/index.js
getElementBoundingRect
function getElementBoundingRect(elementSelector) { /** * @param {Window} win * @param {Object} [dims] * @returns {Object} */ function computeFrameOffset(win, dims) { // initialize our result variable dims = dims || { left: win.pageXOffset, top: win.pag...
javascript
function getElementBoundingRect(elementSelector) { /** * @param {Window} win * @param {Object} [dims] * @returns {Object} */ function computeFrameOffset(win, dims) { // initialize our result variable dims = dims || { left: win.pageXOffset, top: win.pag...
[ "function", "getElementBoundingRect", "(", "elementSelector", ")", "{", "/**\n * @param {Window} win\n * @param {Object} [dims]\n * @returns {Object}\n */", "function", "computeFrameOffset", "(", "win", ",", "dims", ")", "{", "// initialize our result variable", "dims...
Gets the position and size of an element. This function is run in the browser so its scope must be contained. @param {String} elementSelector @returns {Object|undefined}
[ "Gets", "the", "position", "and", "size", "of", "an", "element", "." ]
afd26c3aff4c53f739b6381ad289544637aac7ce
https://github.com/stamoern/wdio-element-screenshot/blob/afd26c3aff4c53f739b6381ad289544637aac7ce/src/index.js#L96-L149
train
flux-capacitor/flux-capacitor
packages/flux-capacitor-reduxify/src/index.js
reduxifyReducer
function reduxifyReducer (reducer, collectionName = null) { return (state = [], action) => { const collection = createReduxifyCollection(state, collectionName) const changeset = reducer(collection, action) // the changesets returned by the reduxify collections are just plain synchronous methods retur...
javascript
function reduxifyReducer (reducer, collectionName = null) { return (state = [], action) => { const collection = createReduxifyCollection(state, collectionName) const changeset = reducer(collection, action) // the changesets returned by the reduxify collections are just plain synchronous methods retur...
[ "function", "reduxifyReducer", "(", "reducer", ",", "collectionName", "=", "null", ")", "{", "return", "(", "state", "=", "[", "]", ",", "action", ")", "=>", "{", "const", "collection", "=", "createReduxifyCollection", "(", "state", ",", "collectionName", ")...
Takes a rewinddb reducer and turns it into a redux-compatible reducer. @param {Function} reducer (Collection, Event) => Changeset @param {string} [collectionName] @param {Function} (Array<Object>, Action) => Array<Object>
[ "Takes", "a", "rewinddb", "reducer", "and", "turns", "it", "into", "a", "redux", "-", "compatible", "reducer", "." ]
66393138ecdff9c1ba81d88b53144220e593584f
https://github.com/flux-capacitor/flux-capacitor/blob/66393138ecdff9c1ba81d88b53144220e593584f/packages/flux-capacitor-reduxify/src/index.js#L12-L31
train
GitbookIO/slate-no-empty
src/index.js
NoEmpty
function NoEmpty(type) { type = typeof type == 'string' ? Block.create({ type, nodes: [ Text.create() ] }) : type; const onBeforeChange = (state) => { const { document } = state; // If document is not empty, it continues ...
javascript
function NoEmpty(type) { type = typeof type == 'string' ? Block.create({ type, nodes: [ Text.create() ] }) : type; const onBeforeChange = (state) => { const { document } = state; // If document is not empty, it continues ...
[ "function", "NoEmpty", "(", "type", ")", "{", "type", "=", "typeof", "type", "==", "'string'", "?", "Block", ".", "create", "(", "{", "type", ",", "nodes", ":", "[", "Text", ".", "create", "(", ")", "]", "}", ")", ":", "type", ";", "const", "onBe...
Plugin to prevent an empty document. @param {String|Block} type
[ "Plugin", "to", "prevent", "an", "empty", "document", "." ]
9a8f24e4bfe2fea5ab76d0f9e5955587550c3118
https://github.com/GitbookIO/slate-no-empty/blob/9a8f24e4bfe2fea5ab76d0f9e5955587550c3118/src/index.js#L8-L36
train
karma-runner/karma-dart
chrome-extension/background.js
onRequest
function onRequest (request, sender, sendResponse) { // Show the page action for the tab that the sender (content script) was on. chrome.pageAction.show(sender.tab.id) var files = request.files if (request.action === 'load') { var rules = [] for (var file in files) { var regex var isKnownF...
javascript
function onRequest (request, sender, sendResponse) { // Show the page action for the tab that the sender (content script) was on. chrome.pageAction.show(sender.tab.id) var files = request.files if (request.action === 'load') { var rules = [] for (var file in files) { var regex var isKnownF...
[ "function", "onRequest", "(", "request", ",", "sender", ",", "sendResponse", ")", "{", "// Show the page action for the tab that the sender (content script) was on.", "chrome", ".", "pageAction", ".", "show", "(", "sender", ".", "tab", ".", "id", ")", "var", "files", ...
Called when a message is passed.
[ "Called", "when", "a", "message", "is", "passed", "." ]
d5bd776928ff86978382c9522a618b468d2fba51
https://github.com/karma-runner/karma-dart/blob/d5bd776928ff86978382c9522a618b468d2fba51/chrome-extension/background.js#L7-L58
train
Cloud9Trader/oanda-adapter
lib/Events.js
waitFor
function waitFor (event, listener, context, wait) { var timeout; if (!wait) { throw new Error("[FATAL] waitFor called without wait time"); } var handler = function () { clearTimeout(timeout); listener.apply(context, arguments); }; timeout = setTimeout(function () { ...
javascript
function waitFor (event, listener, context, wait) { var timeout; if (!wait) { throw new Error("[FATAL] waitFor called without wait time"); } var handler = function () { clearTimeout(timeout); listener.apply(context, arguments); }; timeout = setTimeout(function () { ...
[ "function", "waitFor", "(", "event", ",", "listener", ",", "context", ",", "wait", ")", "{", "var", "timeout", ";", "if", "(", "!", "wait", ")", "{", "throw", "new", "Error", "(", "\"[FATAL] waitFor called without wait time\"", ")", ";", "}", "var", "handl...
Waits for wait ms for event to fire or calls listener with error, removing listener
[ "Waits", "for", "wait", "ms", "for", "event", "to", "fire", "or", "calls", "listener", "with", "error", "removing", "listener" ]
33dcc3955ec965b0d7724fd8804ac2f0bf6f89c1
https://github.com/Cloud9Trader/oanda-adapter/blob/33dcc3955ec965b0d7724fd8804ac2f0bf6f89c1/lib/Events.js#L20-L34
train
Cloud9Trader/oanda-adapter
lib/Events.js
listenFor
function listenFor (event, listener, context, duration) { setTimeout(function () { this.off(event, listener, context); }.bind(this), duration); this.on(event, listener, context); }
javascript
function listenFor (event, listener, context, duration) { setTimeout(function () { this.off(event, listener, context); }.bind(this), duration); this.on(event, listener, context); }
[ "function", "listenFor", "(", "event", ",", "listener", ",", "context", ",", "duration", ")", "{", "setTimeout", "(", "function", "(", ")", "{", "this", ".", "off", "(", "event", ",", "listener", ",", "context", ")", ";", "}", ".", "bind", "(", "this...
Listens for duration ms for events to fire, then removes listener
[ "Listens", "for", "duration", "ms", "for", "events", "to", "fire", "then", "removes", "listener" ]
33dcc3955ec965b0d7724fd8804ac2f0bf6f89c1
https://github.com/Cloud9Trader/oanda-adapter/blob/33dcc3955ec965b0d7724fd8804ac2f0bf6f89c1/lib/Events.js#L37-L42
train
flux-capacitor/flux-capacitor
packages/flux-capacitor-sequelize/lib/connectTo.js
connectTo
function connectTo (connectionSettings, createCollections) { const sequelize = new Sequelize(connectionSettings) const collections = createCollections(sequelize, createCollection) const database = { /** @property {Sequelize} connection */ connection: sequelize, /** @property {Object} collections ...
javascript
function connectTo (connectionSettings, createCollections) { const sequelize = new Sequelize(connectionSettings) const collections = createCollections(sequelize, createCollection) const database = { /** @property {Sequelize} connection */ connection: sequelize, /** @property {Object} collections ...
[ "function", "connectTo", "(", "connectionSettings", ",", "createCollections", ")", "{", "const", "sequelize", "=", "new", "Sequelize", "(", "connectionSettings", ")", "const", "collections", "=", "createCollections", "(", "sequelize", ",", "createCollection", ")", "...
Connect to a database using Sequelize ORM. @param {string|object} connectionSettings Connection URL like `sqlite://path/to/db.sqlite` or object: `{ database: string, host: string, dialect: string, ... }` @param {Function} createCollections (sequelize: Sequelize, createCollection: (name: string, model: Sequeliz...
[ "Connect", "to", "a", "database", "using", "Sequelize", "ORM", "." ]
66393138ecdff9c1ba81d88b53144220e593584f
https://github.com/flux-capacitor/flux-capacitor/blob/66393138ecdff9c1ba81d88b53144220e593584f/packages/flux-capacitor-sequelize/lib/connectTo.js#L17-L46
train
googlearchive/net-chromeify
examples/client/bundle.js
stringifyObject
function stringifyObject(obj, prefix) { var ret = [] , keys = objectKeys(obj) , key; for (var i = 0, len = keys.length; i < len; ++i) { key = keys[i]; ret.push(stringify(obj[key], prefix ? prefix + '[' + encodeURIComponent(key) + ']' : encodeURIComponent(key))); } return ret.join('&'...
javascript
function stringifyObject(obj, prefix) { var ret = [] , keys = objectKeys(obj) , key; for (var i = 0, len = keys.length; i < len; ++i) { key = keys[i]; ret.push(stringify(obj[key], prefix ? prefix + '[' + encodeURIComponent(key) + ']' : encodeURIComponent(key))); } return ret.join('&'...
[ "function", "stringifyObject", "(", "obj", ",", "prefix", ")", "{", "var", "ret", "=", "[", "]", ",", "keys", "=", "objectKeys", "(", "obj", ")", ",", "key", ";", "for", "(", "var", "i", "=", "0", ",", "len", "=", "keys", ".", "length", ";", "i...
Stringify the given `obj`. @param {Object} obj @param {String} prefix @return {String} @api private
[ "Stringify", "the", "given", "obj", "." ]
566cd7a24e03a5947e8851f338a9eee054a42824
https://github.com/googlearchive/net-chromeify/blob/566cd7a24e03a5947e8851f338a9eee054a42824/examples/client/bundle.js#L3905-L3916
train
Esri/geotrigger-js
geotrigger.js
function(target, obj){ for (var attr in obj) { if(obj.hasOwnProperty(attr)){ target[attr] = obj[attr]; } } return target; }
javascript
function(target, obj){ for (var attr in obj) { if(obj.hasOwnProperty(attr)){ target[attr] = obj[attr]; } } return target; }
[ "function", "(", "target", ",", "obj", ")", "{", "for", "(", "var", "attr", "in", "obj", ")", "{", "if", "(", "obj", ".", "hasOwnProperty", "(", "attr", ")", ")", "{", "target", "[", "attr", "]", "=", "obj", "[", "attr", "]", ";", "}", "}", "...
Merge Object 1 and Object 2. Properties from Object 2 will override properties in Object 1. Returns Object 1
[ "Merge", "Object", "1", "and", "Object", "2", ".", "Properties", "from", "Object", "2", "will", "override", "properties", "in", "Object", "1", ".", "Returns", "Object", "1" ]
35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26
https://github.com/Esri/geotrigger-js/blob/35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26/geotrigger.js#L355-L362
train
stefanjudis/credits
lib/analyzers/jspm/index.js
getCredits
function getCredits(projectPath, credits) { credits = credits || []; const jspmPath = path.join(projectPath, 'jspm_packages'); globby.sync([`${jspmPath}/npm/*/package.json`, `${jspmPath}/github/*/*/{package.json,bower.json}`]) .forEach(packagePath => { if (path.basename(packagePath) === 'bower.json') { re...
javascript
function getCredits(projectPath, credits) { credits = credits || []; const jspmPath = path.join(projectPath, 'jspm_packages'); globby.sync([`${jspmPath}/npm/*/package.json`, `${jspmPath}/github/*/*/{package.json,bower.json}`]) .forEach(packagePath => { if (path.basename(packagePath) === 'bower.json') { re...
[ "function", "getCredits", "(", "projectPath", ",", "credits", ")", "{", "credits", "=", "credits", "||", "[", "]", ";", "const", "jspmPath", "=", "path", ".", "join", "(", "projectPath", ",", "'jspm_packages'", ")", ";", "globby", ".", "sync", "(", "[", ...
Read project root and evaluate dependency credits for jspm modules @param {String} projectPath absolute path to project root @param {Array} credits list of credits to append to @return {Array} list of credits
[ "Read", "project", "root", "and", "evaluate", "dependency", "credits", "for", "jspm", "modules" ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/analyzers/jspm/index.js#L16-L30
train
stefanjudis/credits
lib/credit.js
getCredit
function getCredit(credits, author) { const credit = credits.filter(credit => { // Fallback to name when no email // is available if (credit.email && author.email) { return credit.email === author.email; } return credit.name === author.name; }); return credit.length > 0 ? credit[0] : false; }
javascript
function getCredit(credits, author) { const credit = credits.filter(credit => { // Fallback to name when no email // is available if (credit.email && author.email) { return credit.email === author.email; } return credit.name === author.name; }); return credit.length > 0 ? credit[0] : false; }
[ "function", "getCredit", "(", "credits", ",", "author", ")", "{", "const", "credit", "=", "credits", ".", "filter", "(", "credit", "=>", "{", "// Fallback to name when no email", "// is available", "if", "(", "credit", ".", "email", "&&", "author", ".", "email...
Get credit out of running credits list @param {Array} credits list of credits @param {Object} author author @return {Object|false} existing credit or false @tested
[ "Get", "credit", "out", "of", "running", "credits", "list" ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/credit.js#L13-L27
train
stefanjudis/credits
lib/credit.js
addCreditToCredits
function addCreditToCredits(credits, person, name) { let credit = getCredit(credits, person); if (!credit) { credit = person; credit.packages = []; credits.push(credit); } if (credit.packages.indexOf(name) === -1) { credit.packages.push(name); } return credits; }
javascript
function addCreditToCredits(credits, person, name) { let credit = getCredit(credits, person); if (!credit) { credit = person; credit.packages = []; credits.push(credit); } if (credit.packages.indexOf(name) === -1) { credit.packages.push(name); } return credits; }
[ "function", "addCreditToCredits", "(", "credits", ",", "person", ",", "name", ")", "{", "let", "credit", "=", "getCredit", "(", "credits", ",", "person", ")", ";", "if", "(", "!", "credit", ")", "{", "credit", "=", "person", ";", "credit", ".", "packag...
Add a credit to running credits list @param {Array} credits list of credits @param {Object} person person to give credit @param {String} name project name to attach to person @return {Array} list of credits @tested
[ "Add", "a", "credit", "to", "running", "credits", "list" ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/credit.js#L40-L55
train
florianheinemann/passwordless-redisstore
lib/redisstore.js
RedisStore
function RedisStore(port, host, options) { port = port || 6379; host = host || '127.0.0.1'; this._options = options || {}; this._options.redisstore = this._options.redisstore || {}; if(this._options.redisstore.database && !isNumber(this._options.redisstore.database)) { throw new Error('database has to be a numbe...
javascript
function RedisStore(port, host, options) { port = port || 6379; host = host || '127.0.0.1'; this._options = options || {}; this._options.redisstore = this._options.redisstore || {}; if(this._options.redisstore.database && !isNumber(this._options.redisstore.database)) { throw new Error('database has to be a numbe...
[ "function", "RedisStore", "(", "port", ",", "host", ",", "options", ")", "{", "port", "=", "port", "||", "6379", ";", "host", "=", "host", "||", "'127.0.0.1'", ";", "this", ".", "_options", "=", "options", "||", "{", "}", ";", "this", ".", "_options"...
Constructor of RedisStore @param {Number} [port] Port of the Redis server (default: 6379) @param {String} [host] Host, e.g. 127.0.0.1 (default: 127.0.0.1) @param {Object} [options] Combines both the options for the Redis client as well as the options for RedisStore. For the Redis options please refer back to the docume...
[ "Constructor", "of", "RedisStore" ]
021ffb1dca599884f35c2f7e3e4105799c9aba54
https://github.com/florianheinemann/passwordless-redisstore/blob/021ffb1dca599884f35c2f7e3e4105799c9aba54/lib/redisstore.js#L21-L38
train
7digital/7digital-api
lib/oauth.js
createOAuthWrapper
function createOAuthWrapper(oauthkey, oauthsecret, headers) { return new OAuthClient( 'https://api.7digital.com/1.2/oauth/requesttoken', accessTokenUrl, oauthkey, oauthsecret, '1.0', null, 'HMAC-SHA1', 32, headers); }
javascript
function createOAuthWrapper(oauthkey, oauthsecret, headers) { return new OAuthClient( 'https://api.7digital.com/1.2/oauth/requesttoken', accessTokenUrl, oauthkey, oauthsecret, '1.0', null, 'HMAC-SHA1', 32, headers); }
[ "function", "createOAuthWrapper", "(", "oauthkey", ",", "oauthsecret", ",", "headers", ")", "{", "return", "new", "OAuthClient", "(", "'https://api.7digital.com/1.2/oauth/requesttoken'", ",", "accessTokenUrl", ",", "oauthkey", ",", "oauthsecret", ",", "'1.0'", ",", "n...
Creates an OAuth v1 wrapper configured with the supplied key and secret and the necessary options for authenticating with the 7digital API. - @param {String} oauthkey - @param {String} oauthsecret - @return {OAuth}
[ "Creates", "an", "OAuth", "v1", "wrapper", "configured", "with", "the", "supplied", "key", "and", "secret", "and", "the", "necessary", "options", "for", "authenticating", "with", "the", "7digital", "API", ".", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/oauth.js#L17-L24
train
brettz9/miller-columns
dist/index-es.js
breadcrumb
function breadcrumb() { const $breadcrumb = $(`.${namespace}-breadcrumbs`).empty(); chain().each(function () { const $crumb = $(this); $(`<span class="${namespace}-breadcrumb">`).text($crumb.text().trim()).click(function () { $crumb.click(); }).append...
javascript
function breadcrumb() { const $breadcrumb = $(`.${namespace}-breadcrumbs`).empty(); chain().each(function () { const $crumb = $(this); $(`<span class="${namespace}-breadcrumb">`).text($crumb.text().trim()).click(function () { $crumb.click(); }).append...
[ "function", "breadcrumb", "(", ")", "{", "const", "$breadcrumb", "=", "$", "(", "`", "${", "namespace", "}", "`", ")", ".", "empty", "(", ")", ";", "chain", "(", ")", ".", "each", "(", "function", "(", ")", "{", "const", "$crumb", "=", "$", "(", ...
Add the breadcrumb path using the chain of selected items.
[ "Add", "the", "breadcrumb", "path", "using", "the", "chain", "of", "selected", "items", "." ]
98f0711d6ccdc198265c47290159a481145517e8
https://github.com/brettz9/miller-columns/blob/98f0711d6ccdc198265c47290159a481145517e8/dist/index-es.js#L120-L129
train
brettz9/miller-columns
dist/index-es.js
animation
function animation($column, $columns) { let width = 0; chain().not($column).each(function () { width += $(this).outerWidth(true); }); $columns.stop().animate({ scrollLeft: width }, settings.delay, function () { const last = $columns.find(`.${na...
javascript
function animation($column, $columns) { let width = 0; chain().not($column).each(function () { width += $(this).outerWidth(true); }); $columns.stop().animate({ scrollLeft: width }, settings.delay, function () { const last = $columns.find(`.${na...
[ "function", "animation", "(", "$column", ",", "$columns", ")", "{", "let", "width", "=", "0", ";", "chain", "(", ")", ".", "not", "(", "$column", ")", ".", "each", "(", "function", "(", ")", "{", "width", "+=", "$", "(", "this", ")", ".", "outerW...
Ensure the viewport shows the entire newly expanded item.
[ "Ensure", "the", "viewport", "shows", "the", "entire", "newly", "expanded", "item", "." ]
98f0711d6ccdc198265c47290159a481145517e8
https://github.com/brettz9/miller-columns/blob/98f0711d6ccdc198265c47290159a481145517e8/dist/index-es.js#L132-L147
train
brettz9/miller-columns
dist/index-es.js
unnest
function unnest($columns) { const queue = []; let $node; // Push the root unordered list item into the queue. queue.push($columns.children()); while (queue.length) { $node = queue.shift(); $node.children(itemSelector).each(function (item, el) { ...
javascript
function unnest($columns) { const queue = []; let $node; // Push the root unordered list item into the queue. queue.push($columns.children()); while (queue.length) { $node = queue.shift(); $node.children(itemSelector).each(function (item, el) { ...
[ "function", "unnest", "(", "$columns", ")", "{", "const", "queue", "=", "[", "]", ";", "let", "$node", ";", "// Push the root unordered list item into the queue.", "queue", ".", "push", "(", "$columns", ".", "children", "(", ")", ")", ";", "while", "(", "que...
Convert nested lists into columns using breadth-first traversal.
[ "Convert", "nested", "lists", "into", "columns", "using", "breadth", "-", "first", "traversal", "." ]
98f0711d6ccdc198265c47290159a481145517e8
https://github.com/brettz9/miller-columns/blob/98f0711d6ccdc198265c47290159a481145517e8/dist/index-es.js#L150-L180
train
stefanjudis/credits
lib/package.js
getAllStar
function getAllStar(person) { // Override properties from all-stars if available const allStar = allStars(person); return allStar ? objectAssign(person, allStar.subset()) : person; }
javascript
function getAllStar(person) { // Override properties from all-stars if available const allStar = allStars(person); return allStar ? objectAssign(person, allStar.subset()) : person; }
[ "function", "getAllStar", "(", "person", ")", "{", "// Override properties from all-stars if available", "const", "allStar", "=", "allStars", "(", "person", ")", ";", "return", "allStar", "?", "objectAssign", "(", "person", ",", "allStar", ".", "subset", "(", ")",...
Check all-stars db for given person and assign to person if found. @param {Object} person object representing author or maintainer @return {Object} same object given, possibly modified or augmented
[ "Check", "all", "-", "stars", "db", "for", "given", "person", "and", "assign", "to", "person", "if", "found", "." ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/package.js#L28-L32
train
stefanjudis/credits
lib/package.js
getPersonObject
function getPersonObject(personString) { const regex = personString.match(/^(.*?)\s?(<(.*)>)?\s?(\((.*)\))?\s?$/); return getAllStar({ name: regex[1], email: regex[3], url: regex[5] }); }
javascript
function getPersonObject(personString) { const regex = personString.match(/^(.*?)\s?(<(.*)>)?\s?(\((.*)\))?\s?$/); return getAllStar({ name: regex[1], email: regex[3], url: regex[5] }); }
[ "function", "getPersonObject", "(", "personString", ")", "{", "const", "regex", "=", "personString", ".", "match", "(", "/", "^(.*?)\\s?(<(.*)>)?\\s?(\\((.*)\\))?\\s?$", "/", ")", ";", "return", "getAllStar", "(", "{", "name", ":", "regex", "[", "1", "]", ",",...
Parse npm string shorthand into object representation @param {String} personString string shorthand for author or maintainer @return {Object} object representing author or maintainer
[ "Parse", "npm", "string", "shorthand", "into", "object", "representation" ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/package.js#L41-L49
train
stefanjudis/credits
lib/package.js
getAuthor
function getAuthor(packageJson) { if (Array.isArray(packageJson.authors)) { packageJson.authors = packageJson.authors.map(author => { if (typeof author === 'string') { return getPersonObject(author); } return getAllStar(author); }); return packageJson.authors ? packageJson.authors : false; } if...
javascript
function getAuthor(packageJson) { if (Array.isArray(packageJson.authors)) { packageJson.authors = packageJson.authors.map(author => { if (typeof author === 'string') { return getPersonObject(author); } return getAllStar(author); }); return packageJson.authors ? packageJson.authors : false; } if...
[ "function", "getAuthor", "(", "packageJson", ")", "{", "if", "(", "Array", ".", "isArray", "(", "packageJson", ".", "authors", ")", ")", "{", "packageJson", ".", "authors", "=", "packageJson", ".", "authors", ".", "map", "(", "author", "=>", "{", "if", ...
Extract author from package.json content @param {Object} packageJson content of package.json @return {Object|false} author if exists or false @tested
[ "Extract", "author", "from", "package", ".", "json", "content" ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/package.js#L60-L80
train
stefanjudis/credits
lib/package.js
getMaintainers
function getMaintainers(packageJson) { if (Array.isArray(packageJson.maintainers)) { packageJson.maintainers = packageJson.maintainers.map(maintainer => { if (typeof maintainer === 'string') { return getPersonObject(maintainer); } return getAllStar(maintainer); }); } // Safety fix for people doing...
javascript
function getMaintainers(packageJson) { if (Array.isArray(packageJson.maintainers)) { packageJson.maintainers = packageJson.maintainers.map(maintainer => { if (typeof maintainer === 'string') { return getPersonObject(maintainer); } return getAllStar(maintainer); }); } // Safety fix for people doing...
[ "function", "getMaintainers", "(", "packageJson", ")", "{", "if", "(", "Array", ".", "isArray", "(", "packageJson", ".", "maintainers", ")", ")", "{", "packageJson", ".", "maintainers", "=", "packageJson", ".", "maintainers", ".", "map", "(", "maintainer", "...
Extract maintainers from package.json content @param {Object} packageJson content of package.json @return {Array} maintainers if exists or false @tested
[ "Extract", "maintainers", "from", "package", ".", "json", "content" ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/package.js#L91-L111
train
stefanjudis/credits
lib/analyzers/npm/index.js
getNpmCredits
function getNpmCredits(packagePath, credits) { const directoryPath = path.dirname(packagePath); const name = path.basename(path.dirname(packagePath)); if ( name[0] !== '.' && ( fs.lstatSync(directoryPath).isDirectory() || fs.lstatSync(directoryPath).isSymbolicLink() ) ) { const packageJson = packageUti...
javascript
function getNpmCredits(packagePath, credits) { const directoryPath = path.dirname(packagePath); const name = path.basename(path.dirname(packagePath)); if ( name[0] !== '.' && ( fs.lstatSync(directoryPath).isDirectory() || fs.lstatSync(directoryPath).isSymbolicLink() ) ) { const packageJson = packageUti...
[ "function", "getNpmCredits", "(", "packagePath", ",", "credits", ")", "{", "const", "directoryPath", "=", "path", ".", "dirname", "(", "packagePath", ")", ";", "const", "name", "=", "path", ".", "basename", "(", "path", ".", "dirname", "(", "packagePath", ...
Read and evaluate dependency credits for npm module @param {String} packagePath absolute path to package.json file @param {Array} credits list of credits to append to @return {Array} list of credits
[ "Read", "and", "evaluate", "dependency", "credits", "for", "npm", "module" ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/analyzers/npm/index.js#L17-L44
train
stefanjudis/credits
lib/analyzers/npm/index.js
getCredits
function getCredits(projectPath, credits) { credits = credits || []; const depPath = path.join(projectPath, 'node_modules'); globby.sync(`${depPath}/**/package.json`) .forEach(packagePath => { getNpmCredits(packagePath, credits); }); return credits; }
javascript
function getCredits(projectPath, credits) { credits = credits || []; const depPath = path.join(projectPath, 'node_modules'); globby.sync(`${depPath}/**/package.json`) .forEach(packagePath => { getNpmCredits(packagePath, credits); }); return credits; }
[ "function", "getCredits", "(", "projectPath", ",", "credits", ")", "{", "credits", "=", "credits", "||", "[", "]", ";", "const", "depPath", "=", "path", ".", "join", "(", "projectPath", ",", "'node_modules'", ")", ";", "globby", ".", "sync", "(", "`", ...
Read project root and evaluate dependency credits for node modules @param {String} projectPath absolute path to project root @param {Array|undefined} credits list of credits @param {Array|undefined} seen list of already iterated packages @return {Array} list of credits
[ "Read", "project", "root", "and", "evaluate", "dependency", "credits", "for", "node", "modules" ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/analyzers/npm/index.js#L55-L66
train
knockout/tko.provider
src/provider.js
preProcessBindings
function preProcessBindings(bindingString) { var results = []; var bindingHandlers = this.bindingHandlers; var preprocessed; // Check for a Provider.preprocessNode property if (typeof this.preprocessNode === 'function') { preprocessed = this.preprocessNode(bindingString, this); if (preprocessed) { bi...
javascript
function preProcessBindings(bindingString) { var results = []; var bindingHandlers = this.bindingHandlers; var preprocessed; // Check for a Provider.preprocessNode property if (typeof this.preprocessNode === 'function') { preprocessed = this.preprocessNode(bindingString, this); if (preprocessed) { bi...
[ "function", "preProcessBindings", "(", "bindingString", ")", "{", "var", "results", "=", "[", "]", ";", "var", "bindingHandlers", "=", "this", ".", "bindingHandlers", ";", "var", "preprocessed", ";", "// Check for a Provider.preprocessNode property", "if", "(", "typ...
Call bindingHandler.preprocess on each respective binding string. The `preprocess` property of bindingHandler must be a static function (i.e. on the object or constructor).
[ "Call", "bindingHandler", ".", "preprocess", "on", "each", "respective", "binding", "string", "." ]
a157f31f5ab579b350eb6b64d92c92f9d6d4a385
https://github.com/knockout/tko.provider/blob/a157f31f5ab579b350eb6b64d92c92f9d6d4a385/src/provider.js#L131-L170
train
7digital/7digital-api
lib/parameters.js
template
function template(url, params) { var templated = url; var keys = _.keys(params); var loweredKeys = _.map(keys, function (key) { return key.toLowerCase(); }); var keyLookup = _.zipObject(loweredKeys, keys); _.each(templateParams(url), function replaceParam(param) { var normalisedParam = param.toLowerCase().su...
javascript
function template(url, params) { var templated = url; var keys = _.keys(params); var loweredKeys = _.map(keys, function (key) { return key.toLowerCase(); }); var keyLookup = _.zipObject(loweredKeys, keys); _.each(templateParams(url), function replaceParam(param) { var normalisedParam = param.toLowerCase().su...
[ "function", "template", "(", "url", ",", "params", ")", "{", "var", "templated", "=", "url", ";", "var", "keys", "=", "_", ".", "keys", "(", "params", ")", ";", "var", "loweredKeys", "=", "_", ".", "map", "(", "keys", ",", "function", "(", "key", ...
Given a url and some parameters replaces all named parameters with those supplied. - @param {String} url - the url to be modified - @param {Object} params - a hash of parameters to be put in the URL - @return {String} The url with the parameters replaced
[ "Given", "a", "url", "and", "some", "parameters", "replaces", "all", "named", "parameters", "with", "those", "supplied", ".", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/parameters.js#L21-L42
train
stefanjudis/credits
index.js
readDirectory
function readDirectory( projectPath, analyzers ) { var credits = {}; for ( var analyzer in analyzers ) { credits[ analyzer ] = analyzers[ analyzer ]( projectPath ); }; return credits; }
javascript
function readDirectory( projectPath, analyzers ) { var credits = {}; for ( var analyzer in analyzers ) { credits[ analyzer ] = analyzers[ analyzer ]( projectPath ); }; return credits; }
[ "function", "readDirectory", "(", "projectPath", ",", "analyzers", ")", "{", "var", "credits", "=", "{", "}", ";", "for", "(", "var", "analyzer", "in", "analyzers", ")", "{", "credits", "[", "analyzer", "]", "=", "analyzers", "[", "analyzer", "]", "(", ...
Read project root and evaluate dependency credits for all supported package managers @param {String} projectPath absolute path to project root @param {Array} analyzers list of availalbe analyzers @return {Array} list of credits @tested
[ "Read", "project", "root", "and", "evaluate", "dependency", "credits", "for", "all", "supported", "package", "managers" ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/index.js#L22-L30
train
stefanjudis/credits
lib/analyzers/bower/index.js
getBowerCredits
function getBowerCredits(bowerJsonPath, credits) { const name = path.basename(path.dirname(bowerJsonPath)); const bowerJson = packageUtil.readJSONSync(bowerJsonPath); const authors = packageUtil.getAuthor(bowerJson); if (authors) { authors.forEach(author => { credits = creditUtil.addCreditToCredits(credits, ...
javascript
function getBowerCredits(bowerJsonPath, credits) { const name = path.basename(path.dirname(bowerJsonPath)); const bowerJson = packageUtil.readJSONSync(bowerJsonPath); const authors = packageUtil.getAuthor(bowerJson); if (authors) { authors.forEach(author => { credits = creditUtil.addCreditToCredits(credits, ...
[ "function", "getBowerCredits", "(", "bowerJsonPath", ",", "credits", ")", "{", "const", "name", "=", "path", ".", "basename", "(", "path", ".", "dirname", "(", "bowerJsonPath", ")", ")", ";", "const", "bowerJson", "=", "packageUtil", ".", "readJSONSync", "("...
Read and evaluate dependency credits for bower module @param {String} bowerJsonPath absolute path to bower file @param {Array} credits list of credits to append to @return {Array} list of credits
[ "Read", "and", "evaluate", "dependency", "credits", "for", "bower", "module" ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/analyzers/bower/index.js#L16-L29
train
stefanjudis/credits
lib/analyzers/bower/index.js
getCredits
function getCredits(projectPath, credits) { credits = credits || []; const depPath = path.join(projectPath, 'bower_components'); globby.sync([`${depPath}/*/bower.json`]) .forEach(bowerJsonPath => { getBowerCredits(bowerJsonPath, credits); }); return credits; }
javascript
function getCredits(projectPath, credits) { credits = credits || []; const depPath = path.join(projectPath, 'bower_components'); globby.sync([`${depPath}/*/bower.json`]) .forEach(bowerJsonPath => { getBowerCredits(bowerJsonPath, credits); }); return credits; }
[ "function", "getCredits", "(", "projectPath", ",", "credits", ")", "{", "credits", "=", "credits", "||", "[", "]", ";", "const", "depPath", "=", "path", ".", "join", "(", "projectPath", ",", "'bower_components'", ")", ";", "globby", ".", "sync", "(", "["...
Read project root and evaluate dependency credits for bower modules @param {String} projectPath absolute path to project root @param {Array} credits list of credits to append to @return {Array} list of credits
[ "Read", "project", "root", "and", "evaluate", "dependency", "credits", "for", "bower", "modules" ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/analyzers/bower/index.js#L38-L49
train
Esri/geotrigger-js
spec/SpecHelpers.js
arrySignaturesMatch
function arrySignaturesMatch(array1, array2){ // setup variables var ref, test; // we want to use the shorter array if one is longer if (array1.length >= array2.length) { ref = array2; test = array1; } else { ref = array1; test = array2; } // loop over the shorter a...
javascript
function arrySignaturesMatch(array1, array2){ // setup variables var ref, test; // we want to use the shorter array if one is longer if (array1.length >= array2.length) { ref = array2; test = array1; } else { ref = array1; test = array2; } // loop over the shorter a...
[ "function", "arrySignaturesMatch", "(", "array1", ",", "array2", ")", "{", "// setup variables", "var", "ref", ",", "test", ";", "// we want to use the shorter array if one is longer", "if", "(", "array1", ".", "length", ">=", "array2", ".", "length", ")", "{", "r...
do the types of arguments in each array match?
[ "do", "the", "types", "of", "arguments", "in", "each", "array", "match?" ]
35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26
https://github.com/Esri/geotrigger-js/blob/35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26/spec/SpecHelpers.js#L4-L38
train
Esri/geotrigger-js
spec/SpecHelpers.js
objectSignaturesMatch
function objectSignaturesMatch(object1, object2){ // because typeof null is object we need to check for it here before Object.keys if(object1 === null && object2 === null){ return true; } // if the objects have different lengths of keys we should fail immediatly if (Object.keys(object1).leng...
javascript
function objectSignaturesMatch(object1, object2){ // because typeof null is object we need to check for it here before Object.keys if(object1 === null && object2 === null){ return true; } // if the objects have different lengths of keys we should fail immediatly if (Object.keys(object1).leng...
[ "function", "objectSignaturesMatch", "(", "object1", ",", "object2", ")", "{", "// because typeof null is object we need to check for it here before Object.keys", "if", "(", "object1", "===", "null", "&&", "object2", "===", "null", ")", "{", "return", "true", ";", "}", ...
do the keys in object 1 match object 2?
[ "do", "the", "keys", "in", "object", "1", "match", "object", "2?" ]
35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26
https://github.com/Esri/geotrigger-js/blob/35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26/spec/SpecHelpers.js#L41-L80
train
Esri/geotrigger-js
spec/SpecHelpers.js
function() { var refArgs = Array.prototype.slice.call(arguments); var calledArgs = this.actual.mostRecentCall.args; var arg; for(arg in refArgs){ var ref = refArgs[arg]; var test = calledArgs[arg]; // if the types of the objects dont match if(typeof ref !== type...
javascript
function() { var refArgs = Array.prototype.slice.call(arguments); var calledArgs = this.actual.mostRecentCall.args; var arg; for(arg in refArgs){ var ref = refArgs[arg]; var test = calledArgs[arg]; // if the types of the objects dont match if(typeof ref !== type...
[ "function", "(", ")", "{", "var", "refArgs", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ")", ";", "var", "calledArgs", "=", "this", ".", "actual", ".", "mostRecentCall", ".", "args", ";", "var", "arg", ";", "for", "(...
this is a lazy matcher for jasmine spies. it checks that the arguments for the last call made match all the arguments that are passed into the function, but does not care if the values match only that they are the same type. in short this only cares that all teh keys are the same and the types of values are the same, ...
[ "this", "is", "a", "lazy", "matcher", "for", "jasmine", "spies", ".", "it", "checks", "that", "the", "arguments", "for", "the", "last", "call", "made", "match", "all", "the", "arguments", "that", "are", "passed", "into", "the", "function", "but", "does", ...
35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26
https://github.com/Esri/geotrigger-js/blob/35f4724c0d6e6b8f1a6b054b99fbd2b270e70a26/spec/SpecHelpers.js#L91-L115
train
stefanjudis/credits
lib/analyzers.js
getAnalyzers
function getAnalyzers(config) { const methods = {}; const basePath = config.filePaths.analyzers; globby.sync(`${basePath}/*`) .forEach(analyzer => { const name = path.basename(analyzer); methods[name] = require(analyzer); }); return methods; }
javascript
function getAnalyzers(config) { const methods = {}; const basePath = config.filePaths.analyzers; globby.sync(`${basePath}/*`) .forEach(analyzer => { const name = path.basename(analyzer); methods[name] = require(analyzer); }); return methods; }
[ "function", "getAnalyzers", "(", "config", ")", "{", "const", "methods", "=", "{", "}", ";", "const", "basePath", "=", "config", ".", "filePaths", ".", "analyzers", ";", "globby", ".", "sync", "(", "`", "${", "basePath", "}", "`", ")", ".", "forEach", ...
Get all available analyzers @param {Object} config project configuration @return {Array} list of reporter methods
[ "Get", "all", "available", "analyzers" ]
b5e75518ca62d819e7f2145eeea30de2ea6043ce
https://github.com/stefanjudis/credits/blob/b5e75518ca62d819e7f2145eeea30de2ea6043ce/lib/analyzers.js#L13-L24
train
7digital/7digital-api
lib/request.js
prepare
function prepare(data, consumerkey) { var prop; data = data || {}; for (prop in data) { if (data.hasOwnProperty(prop)) { if (_.isDate(data[prop])) { data[prop] = helpers.toYYYYMMDD(data[prop]); } } } data.oauth_consumer_key = consumerkey; return data; }
javascript
function prepare(data, consumerkey) { var prop; data = data || {}; for (prop in data) { if (data.hasOwnProperty(prop)) { if (_.isDate(data[prop])) { data[prop] = helpers.toYYYYMMDD(data[prop]); } } } data.oauth_consumer_key = consumerkey; return data; }
[ "function", "prepare", "(", "data", ",", "consumerkey", ")", "{", "var", "prop", ";", "data", "=", "data", "||", "{", "}", ";", "for", "(", "prop", "in", "data", ")", "{", "if", "(", "data", ".", "hasOwnProperty", "(", "prop", ")", ")", "{", "if"...
Formats request parameters as expected by the API. - @param {Object} data - hash of pararameters - @param {String} consumerkey - consumer key - @return {String} - Encoded parameter string
[ "Formats", "request", "parameters", "as", "expected", "by", "the", "API", ".", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/request.js#L20-L35
train
7digital/7digital-api
lib/request.js
logHeaders
function logHeaders(logger, headers) { return _.each(_.keys(headers), function (key) { logger.info(key + ': ' + headers[key]); }); }
javascript
function logHeaders(logger, headers) { return _.each(_.keys(headers), function (key) { logger.info(key + ': ' + headers[key]); }); }
[ "function", "logHeaders", "(", "logger", ",", "headers", ")", "{", "return", "_", ".", "each", "(", "_", ".", "keys", "(", "headers", ")", ",", "function", "(", "key", ")", "{", "logger", ".", "info", "(", "key", "+", "': '", "+", "headers", "[", ...
Logs out a headers hash - @param {Object} logger - The logger to use - @param {Object} headers - The hash of headers to log
[ "Logs", "out", "a", "headers", "hash", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/request.js#L51-L55
train
7digital/7digital-api
lib/request.js
get
function get(endpointInfo, requestData, headers, credentials, logger, callback) { var normalisedData = prepare(requestData, credentials.consumerkey); var fullUrl = endpointInfo.url + '?' + qs.stringify(normalisedData); var hostInfo = { host: endpointInfo.host, port: endpointInfo.port }; // Decide whether to...
javascript
function get(endpointInfo, requestData, headers, credentials, logger, callback) { var normalisedData = prepare(requestData, credentials.consumerkey); var fullUrl = endpointInfo.url + '?' + qs.stringify(normalisedData); var hostInfo = { host: endpointInfo.host, port: endpointInfo.port }; // Decide whether to...
[ "function", "get", "(", "endpointInfo", ",", "requestData", ",", "headers", ",", "credentials", ",", "logger", ",", "callback", ")", "{", "var", "normalisedData", "=", "prepare", "(", "requestData", ",", "credentials", ".", "consumerkey", ")", ";", "var", "f...
Makes a GET request to the API. - @param {Object} endpointInfo - Generic metadata about the endpoint to hit. - @param {Object} requestData - Parameters for this specific request. - @param {Object} headers - Custom headers for this request. - @param {Object} credentials - OAuth consumerkey and consumersecret. - @param ...
[ "Makes", "a", "GET", "request", "to", "the", "API", ".", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/request.js#L65-L85
train
7digital/7digital-api
lib/request.js
dispatchSecure
function dispatchSecure(path, httpMethod, requestData, headers, authtype, hostInfo, credentials, logger, callback) { var url; var is2Legged = authtype === '2-legged'; var token = is2Legged ? null : requestData.accesstoken; var secret = is2Legged ? null : requestData.accesssecret; var mergedHeaders = createHeader...
javascript
function dispatchSecure(path, httpMethod, requestData, headers, authtype, hostInfo, credentials, logger, callback) { var url; var is2Legged = authtype === '2-legged'; var token = is2Legged ? null : requestData.accesstoken; var secret = is2Legged ? null : requestData.accesssecret; var mergedHeaders = createHeader...
[ "function", "dispatchSecure", "(", "path", ",", "httpMethod", ",", "requestData", ",", "headers", ",", "authtype", ",", "hostInfo", ",", "credentials", ",", "logger", ",", "callback", ")", "{", "var", "url", ";", "var", "is2Legged", "=", "authtype", "===", ...
Dispatches an oauth signed request to the API - @param {String} url - the path of the API url to request. - @param {String} httpMethod - @param {Object} requestData - hash of the parameters for the request. - @param {Object} headers - Headers for this request. - @param {String} authType - OAuth request type: '2-legged...
[ "Dispatches", "an", "oauth", "signed", "request", "to", "the", "API", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/request.js#L131-L199
train
7digital/7digital-api
lib/request.js
dispatch
function dispatch(url, httpMethod, data, headers, hostInfo, credentials, logger, callback) { hostInfo.port = hostInfo.port || 80; var apiRequest, prop, hasErrored; var mergedHeaders = createHeaders(hostInfo.host, headers); var apiPath = url; data = prepare(data, credentials.consumerkey); // Special case for...
javascript
function dispatch(url, httpMethod, data, headers, hostInfo, credentials, logger, callback) { hostInfo.port = hostInfo.port || 80; var apiRequest, prop, hasErrored; var mergedHeaders = createHeaders(hostInfo.host, headers); var apiPath = url; data = prepare(data, credentials.consumerkey); // Special case for...
[ "function", "dispatch", "(", "url", ",", "httpMethod", ",", "data", ",", "headers", ",", "hostInfo", ",", "credentials", ",", "logger", ",", "callback", ")", "{", "hostInfo", ".", "port", "=", "hostInfo", ".", "port", "||", "80", ";", "var", "apiRequest"...
Dispatches requests to the API. Serializes the data in keeping with the API specification and applies approriate HTTP headers. - @param {String} url - the URL on the API to make the request to. - @param {String} httpMethod - @param {Object} data - hash of the parameters for the request. - @param {Object} headers - He...
[ "Dispatches", "requests", "to", "the", "API", ".", "Serializes", "the", "data", "in", "keeping", "with", "the", "API", "specification", "and", "applies", "approriate", "HTTP", "headers", ".", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/request.js#L212-L289
train
7digital/7digital-api
lib/logger.js
makeLogger
function makeLogger(level, method) { // The logger function to return takes a variable number of arguments // and formats like console.log function logger() { var args = [].slice.call(arguments); var format = level.toUpperCase() + ': (api-client) ' + args.shift(); var logArgs = [format].concat(args); return...
javascript
function makeLogger(level, method) { // The logger function to return takes a variable number of arguments // and formats like console.log function logger() { var args = [].slice.call(arguments); var format = level.toUpperCase() + ': (api-client) ' + args.shift(); var logArgs = [format].concat(args); return...
[ "function", "makeLogger", "(", "level", ",", "method", ")", "{", "// The logger function to return takes a variable number of arguments", "// and formats like console.log", "function", "logger", "(", ")", "{", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "...
Makes a logger function that formats messages sensibly and logs to either stdout or stderr. - @param {String} level - the log level. - @param {String} method - the method on the console object to call. - @return {Function} - the logging function.
[ "Makes", "a", "logger", "function", "that", "formats", "messages", "sensibly", "and", "logs", "to", "either", "stdout", "or", "stderr", ".", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/logger.js#L9-L23
train
7digital/7digital-api
lib/response-cleaners/ensure-collections.js
ensureCollections
function ensureCollections(collectionPaths, response) { var basket; _.each(collectionPaths, function checkLength(item) { var parts = item.split('.'); var allPartsButLast = _.initial(parts); var lastPart = _.last(parts); var parents = _.reduce(allPartsButLast, function (chain, part) { return chain.pluck(par...
javascript
function ensureCollections(collectionPaths, response) { var basket; _.each(collectionPaths, function checkLength(item) { var parts = item.split('.'); var allPartsButLast = _.initial(parts); var lastPart = _.last(parts); var parents = _.reduce(allPartsButLast, function (chain, part) { return chain.pluck(par...
[ "function", "ensureCollections", "(", "collectionPaths", ",", "response", ")", "{", "var", "basket", ";", "_", ".", "each", "(", "collectionPaths", ",", "function", "checkLength", "(", "item", ")", "{", "var", "parts", "=", "item", ".", "split", "(", "'.'"...
The API returns resources as either a single object or an array. This makes responses fiddly to deal with for consumers as they manually check whether the resource has a length an access the property appropriately. This method checks the reponse for the existence of a property path and if it is an object wraps it in an...
[ "The", "API", "returns", "resources", "as", "either", "a", "single", "object", "or", "an", "array", ".", "This", "makes", "responses", "fiddly", "to", "deal", "with", "for", "consumers", "as", "they", "manually", "check", "whether", "the", "resource", "has",...
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/response-cleaners/ensure-collections.js#L18-L47
train
7digital/7digital-api
lib/api.js
Api
function Api(options, schema) { var prop, resourceOptions, resourceConstructor; var apiRoot = this; // Set default options for any unsupplied overrides _.defaults(options, config); this.options = options; this.schema = schema; configureSchemaFromEnv(this.schema); // Creates a constructor with the pre-built r...
javascript
function Api(options, schema) { var prop, resourceOptions, resourceConstructor; var apiRoot = this; // Set default options for any unsupplied overrides _.defaults(options, config); this.options = options; this.schema = schema; configureSchemaFromEnv(this.schema); // Creates a constructor with the pre-built r...
[ "function", "Api", "(", "options", ",", "schema", ")", "{", "var", "prop", ",", "resourceOptions", ",", "resourceConstructor", ";", "var", "apiRoot", "=", "this", ";", "// Set default options for any unsupplied overrides", "_", ".", "defaults", "(", "options", ","...
API Creates a new API wrapper from a schema definition - @param {Object} options - The API options, see below - @param {Object} schema - The definition of the api resources and actions see the assets/7digital-api-schema json file. - @constructor - @param {Object} options The options parameter should have the follow...
[ "API", "Creates", "a", "new", "API", "wrapper", "from", "a", "schema", "definition", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/api.js#L56-L107
train
7digital/7digital-api
lib/api.js
createResourceConstructor
function createResourceConstructor(resourcePrototype) { function APIResource(resourceOptions) { // Allow creating resources without `new` keyword if (!(this instanceof APIResource)) { return new APIResource(resourceOptions); } resourceOptions = resourceOptions || {}; // Override any default option...
javascript
function createResourceConstructor(resourcePrototype) { function APIResource(resourceOptions) { // Allow creating resources without `new` keyword if (!(this instanceof APIResource)) { return new APIResource(resourceOptions); } resourceOptions = resourceOptions || {}; // Override any default option...
[ "function", "createResourceConstructor", "(", "resourcePrototype", ")", "{", "function", "APIResource", "(", "resourceOptions", ")", "{", "// Allow creating resources without `new` keyword", "if", "(", "!", "(", "this", "instanceof", "APIResource", ")", ")", "{", "retur...
Creates a constructor with the pre-built resource as its prototype this is syntactic sugar to allow callers to new up the resources.
[ "Creates", "a", "constructor", "with", "the", "pre", "-", "built", "resource", "as", "its", "prototype", "this", "is", "syntactic", "sugar", "to", "allow", "callers", "to", "new", "up", "the", "resources", "." ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/api.js#L69-L92
train
danillouz/devrant
src/index.js
_getIdByUsername
function _getIdByUsername(username) { const url = `${API}/get-user-id`; const params = { app: 3, username }; return http .GET(url, params) .then(data => data.user_id); }
javascript
function _getIdByUsername(username) { const url = `${API}/get-user-id`; const params = { app: 3, username }; return http .GET(url, params) .then(data => data.user_id); }
[ "function", "_getIdByUsername", "(", "username", ")", "{", "const", "url", "=", "`", "${", "API", "}", "`", ";", "const", "params", "=", "{", "app", ":", "3", ",", "username", "}", ";", "return", "http", ".", "GET", "(", "url", ",", "params", ")", ...
Retrieve the user id associated with the devRant username. @private @param {String} username - the devRant username @return {Promise} Resolves with the user id
[ "Retrieve", "the", "user", "id", "associated", "with", "the", "devRant", "username", "." ]
d9938d2d0cd94823c69e291a2229f6cd799feddc
https://github.com/danillouz/devrant/blob/d9938d2d0cd94823c69e291a2229f6cd799feddc/src/index.js#L47-L57
train
danillouz/devrant
src/index.js
rant
function rant(id = _noRantIdError()) { const url = `${API}/devrant/rants/${id}`; const params = { app: 3 }; return http.GET(url, params); }
javascript
function rant(id = _noRantIdError()) { const url = `${API}/devrant/rants/${id}`; const params = { app: 3 }; return http.GET(url, params); }
[ "function", "rant", "(", "id", "=", "_noRantIdError", "(", ")", ")", "{", "const", "url", "=", "`", "${", "API", "}", "${", "id", "}", "`", ";", "const", "params", "=", "{", "app", ":", "3", "}", ";", "return", "http", ".", "GET", "(", "url", ...
Retrieve a single rant from devRant. Use this method to retrieve a rant with its full text and comments. @param {String} id - the rant id @return {Promise} Resolves with the fetched rant
[ "Retrieve", "a", "single", "rant", "from", "devRant", ".", "Use", "this", "method", "to", "retrieve", "a", "rant", "with", "its", "full", "text", "and", "comments", "." ]
d9938d2d0cd94823c69e291a2229f6cd799feddc
https://github.com/danillouz/devrant/blob/d9938d2d0cd94823c69e291a2229f6cd799feddc/src/index.js#L67-L72
train
danillouz/devrant
src/index.js
rants
function rants({ sort = 'algo', limit = 50, skip = 0 } = {}) { const url = `${API}/devrant/rants`; const params = { app: 3, sort, limit, skip }; return http .GET(url, params) .then(data => data.rants); }
javascript
function rants({ sort = 'algo', limit = 50, skip = 0 } = {}) { const url = `${API}/devrant/rants`; const params = { app: 3, sort, limit, skip }; return http .GET(url, params) .then(data => data.rants); }
[ "function", "rants", "(", "{", "sort", "=", "'algo'", ",", "limit", "=", "50", ",", "skip", "=", "0", "}", "=", "{", "}", ")", "{", "const", "url", "=", "`", "${", "API", "}", "`", ";", "const", "params", "=", "{", "app", ":", "3", ",", "so...
Retrieve rants from devRant. @param {Object} options - sort (by `algo`, `recent` or `top`), limit and skip @return {Promise} Resolves with the fetched rants
[ "Retrieve", "rants", "from", "devRant", "." ]
d9938d2d0cd94823c69e291a2229f6cd799feddc
https://github.com/danillouz/devrant/blob/d9938d2d0cd94823c69e291a2229f6cd799feddc/src/index.js#L81-L95
train
danillouz/devrant
src/index.js
search
function search(term = _noSearchTermError()) { const url = `${API}/devrant/search`; const params = { app: 3, term }; return http .GET(url, params) .then(data => data.results); }
javascript
function search(term = _noSearchTermError()) { const url = `${API}/devrant/search`; const params = { app: 3, term }; return http .GET(url, params) .then(data => data.results); }
[ "function", "search", "(", "term", "=", "_noSearchTermError", "(", ")", ")", "{", "const", "url", "=", "`", "${", "API", "}", "`", ";", "const", "params", "=", "{", "app", ":", "3", ",", "term", "}", ";", "return", "http", ".", "GET", "(", "url",...
Retrieve rants from devRant that match a specific search term. @param {String} term - the search term @return {Promise} Resolves with the fetched rants
[ "Retrieve", "rants", "from", "devRant", "that", "match", "a", "specific", "search", "term", "." ]
d9938d2d0cd94823c69e291a2229f6cd799feddc
https://github.com/danillouz/devrant/blob/d9938d2d0cd94823c69e291a2229f6cd799feddc/src/index.js#L105-L115
train
danillouz/devrant
src/index.js
profile
function profile(username = _noUsernameError()) { return co(function *resolveUsername() { const userId = yield _getIdByUsername(username); const url = `${API}/users/${userId}`; const params = { app: 3 }; return http .GET(url, params) .then(data => data.profile); }); }
javascript
function profile(username = _noUsernameError()) { return co(function *resolveUsername() { const userId = yield _getIdByUsername(username); const url = `${API}/users/${userId}`; const params = { app: 3 }; return http .GET(url, params) .then(data => data.profile); }); }
[ "function", "profile", "(", "username", "=", "_noUsernameError", "(", ")", ")", "{", "return", "co", "(", "function", "*", "resolveUsername", "(", ")", "{", "const", "userId", "=", "yield", "_getIdByUsername", "(", "username", ")", ";", "const", "url", "="...
Retrieve the profile of a devRant user by username. @param {String} username - the devRant username @return {Promise} Resolves with the fetched user profile
[ "Retrieve", "the", "profile", "of", "a", "devRant", "user", "by", "username", "." ]
d9938d2d0cd94823c69e291a2229f6cd799feddc
https://github.com/danillouz/devrant/blob/d9938d2d0cd94823c69e291a2229f6cd799feddc/src/index.js#L124-L134
train
moimikey/iso3166-1
src/index.js
to2
function to2 (alpha3) { if (alpha3 && alpha3.length > 1) state = alpha3 if (state.length !== 3) return state return ISOCodes.filter(function (row) { return row.alpha3 === state })[0].alpha2 }
javascript
function to2 (alpha3) { if (alpha3 && alpha3.length > 1) state = alpha3 if (state.length !== 3) return state return ISOCodes.filter(function (row) { return row.alpha3 === state })[0].alpha2 }
[ "function", "to2", "(", "alpha3", ")", "{", "if", "(", "alpha3", "&&", "alpha3", ".", "length", ">", "1", ")", "state", "=", "alpha3", "if", "(", "state", ".", "length", "!==", "3", ")", "return", "state", "return", "ISOCodes", ".", "filter", "(", ...
Convert an ISO 3166-1 alpha-3 code to alpha-2 @param {String} alpha3 USA @return {String}
[ "Convert", "an", "ISO", "3166", "-", "1", "alpha", "-", "3", "code", "to", "alpha", "-", "2" ]
f3596c1957e5c35d2a33f71567265f0a3bf571b7
https://github.com/moimikey/iso3166-1/blob/f3596c1957e5c35d2a33f71567265f0a3bf571b7/src/index.js#L14-L20
train
moimikey/iso3166-1
src/index.js
to3
function to3 (alpha2) { if (alpha2 && alpha2.length > 1) state = alpha2 if (state.length !== 2) return state return ISOCodes.filter(function (row) { return row.alpha2 === state })[0].alpha3 }
javascript
function to3 (alpha2) { if (alpha2 && alpha2.length > 1) state = alpha2 if (state.length !== 2) return state return ISOCodes.filter(function (row) { return row.alpha2 === state })[0].alpha3 }
[ "function", "to3", "(", "alpha2", ")", "{", "if", "(", "alpha2", "&&", "alpha2", ".", "length", ">", "1", ")", "state", "=", "alpha2", "if", "(", "state", ".", "length", "!==", "2", ")", "return", "state", "return", "ISOCodes", ".", "filter", "(", ...
Convert an ISO 3166-1 alpha-2 code to alpha-3 @param {String} alpha2 US @return {String}
[ "Convert", "an", "ISO", "3166", "-", "1", "alpha", "-", "2", "code", "to", "alpha", "-", "3" ]
f3596c1957e5c35d2a33f71567265f0a3bf571b7
https://github.com/moimikey/iso3166-1/blob/f3596c1957e5c35d2a33f71567265f0a3bf571b7/src/index.js#L28-L34
train
7digital/7digital-api
lib/resource.js
Resource
function Resource(options, schema) { this.logger = options.logger; this.resourceName = options.resourceDefinition.resource; this.host = options.resourceDefinition.host || schema.host; this.sslHost = options.resourceDefinition.sslHost || schema.sslHost; this.port = options.resourceDefinition.port || schema.port; t...
javascript
function Resource(options, schema) { this.logger = options.logger; this.resourceName = options.resourceDefinition.resource; this.host = options.resourceDefinition.host || schema.host; this.sslHost = options.resourceDefinition.sslHost || schema.sslHost; this.port = options.resourceDefinition.port || schema.port; t...
[ "function", "Resource", "(", "options", ",", "schema", ")", "{", "this", ".", "logger", "=", "options", ".", "logger", ";", "this", ".", "resourceName", "=", "options", ".", "resourceDefinition", ".", "resource", ";", "this", ".", "host", "=", "options", ...
A resource on the API, instances of this are used as the prototype of instances of each API resource. This constructor will build up a method for each action that can be performed on the resource. - @param {Object} options - @param {Object} schema The `options` argument should have the following properties: - `reso...
[ "A", "resource", "on", "the", "API", "instances", "of", "this", "are", "used", "as", "the", "prototype", "of", "instances", "of", "each", "API", "resource", ".", "This", "constructor", "will", "build", "up", "a", "method", "for", "each", "action", "that", ...
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/resource.js#L24-L42
train
MarkHerhold/palin
palin.js
truncFilename
function truncFilename(path, rootFolderName) { // bail if a string wasn't provided if (typeof path !== 'string') { return path; } var index = path.indexOf(rootFolderName); if (index > 0) { return path.substring(index + rootFolderName.length + 1); } else { return path; ...
javascript
function truncFilename(path, rootFolderName) { // bail if a string wasn't provided if (typeof path !== 'string') { return path; } var index = path.indexOf(rootFolderName); if (index > 0) { return path.substring(index + rootFolderName.length + 1); } else { return path; ...
[ "function", "truncFilename", "(", "path", ",", "rootFolderName", ")", "{", "// bail if a string wasn't provided", "if", "(", "typeof", "path", "!==", "'string'", ")", "{", "return", "path", ";", "}", "var", "index", "=", "path", ".", "indexOf", "(", "rootFolde...
shortens the file name to exclude any path before the project folder name @param path: file path string. e.g. /home/mark/myproj/run.js @param rootFolderName: root folder for the project. e.g. "myproj" @return the shortened file path string
[ "shortens", "the", "file", "name", "to", "exclude", "any", "path", "before", "the", "project", "folder", "name" ]
857ccd222bc649ab9be1411a049f76d779251fd8
https://github.com/MarkHerhold/palin/blob/857ccd222bc649ab9be1411a049f76d779251fd8/palin.js#L11-L23
train
MarkHerhold/palin
palin.js
getTimestampString
function getTimestampString(date) { // all this nasty code is faster (~30k ops/sec) than doing "moment(date).format('HH:mm:ss:SSS')" and means 0 dependencies var hour = '0' + date.getHours(); hour = hour.slice(hour.length - 2); var minute = '0' + date.getMinutes(); minute = minute.slice(minute.lengt...
javascript
function getTimestampString(date) { // all this nasty code is faster (~30k ops/sec) than doing "moment(date).format('HH:mm:ss:SSS')" and means 0 dependencies var hour = '0' + date.getHours(); hour = hour.slice(hour.length - 2); var minute = '0' + date.getMinutes(); minute = minute.slice(minute.lengt...
[ "function", "getTimestampString", "(", "date", ")", "{", "// all this nasty code is faster (~30k ops/sec) than doing \"moment(date).format('HH:mm:ss:SSS')\" and means 0 dependencies", "var", "hour", "=", "'0'", "+", "date", ".", "getHours", "(", ")", ";", "hour", "=", "hour",...
retruns the colorized timestamp string
[ "retruns", "the", "colorized", "timestamp", "string" ]
857ccd222bc649ab9be1411a049f76d779251fd8
https://github.com/MarkHerhold/palin/blob/857ccd222bc649ab9be1411a049f76d779251fd8/palin.js#L26-L45
train
MarkHerhold/palin
palin.js
getColorSeverity
function getColorSeverity(severity) { // get the color associated with the severity level const color = severityMap[severity] || 'white'; return chalk[color].bold(severity.toUpperCase()); }
javascript
function getColorSeverity(severity) { // get the color associated with the severity level const color = severityMap[severity] || 'white'; return chalk[color].bold(severity.toUpperCase()); }
[ "function", "getColorSeverity", "(", "severity", ")", "{", "// get the color associated with the severity level", "const", "color", "=", "severityMap", "[", "severity", "]", "||", "'white'", ";", "return", "chalk", "[", "color", "]", ".", "bold", "(", "severity", ...
returns the colorized text for the given severity level
[ "returns", "the", "colorized", "text", "for", "the", "given", "severity", "level" ]
857ccd222bc649ab9be1411a049f76d779251fd8
https://github.com/MarkHerhold/palin/blob/857ccd222bc649ab9be1411a049f76d779251fd8/palin.js#L56-L60
train
MarkHerhold/palin
palin.js
formatter
function formatter(options, severity, date, elems) { /* OPTIONS */ const indent = options.indent || defaultIndent; const objectDepth = options.objectDepth; const timestamp = (function () { if (check.function(options.timestamp)) { return options.timestamp; // user-provided ti...
javascript
function formatter(options, severity, date, elems) { /* OPTIONS */ const indent = options.indent || defaultIndent; const objectDepth = options.objectDepth; const timestamp = (function () { if (check.function(options.timestamp)) { return options.timestamp; // user-provided ti...
[ "function", "formatter", "(", "options", ",", "severity", ",", "date", ",", "elems", ")", "{", "/*\n OPTIONS\n */", "const", "indent", "=", "options", ".", "indent", "||", "defaultIndent", ";", "const", "objectDepth", "=", "options", ".", "objectDepth", ...
the formatter to export
[ "the", "formatter", "to", "export" ]
857ccd222bc649ab9be1411a049f76d779251fd8
https://github.com/MarkHerhold/palin/blob/857ccd222bc649ab9be1411a049f76d779251fd8/palin.js#L83-L189
train
7digital/7digital-api
lib/responseparser.js
parse
function parse(response, opts, callback) { var parser, jsonParseError, result; if (opts.format.toUpperCase() === 'XML') { callback(null, response); return; } if (opts.contentType && opts.contentType.indexOf('json') >= 0) { try { result = JSON.parse(response); } catch (e) { jsonParseError = e; } ...
javascript
function parse(response, opts, callback) { var parser, jsonParseError, result; if (opts.format.toUpperCase() === 'XML') { callback(null, response); return; } if (opts.contentType && opts.contentType.indexOf('json') >= 0) { try { result = JSON.parse(response); } catch (e) { jsonParseError = e; } ...
[ "function", "parse", "(", "response", ",", "opts", ",", "callback", ")", "{", "var", "parser", ",", "jsonParseError", ",", "result", ";", "if", "(", "opts", ".", "format", ".", "toUpperCase", "(", ")", "===", "'XML'", ")", "{", "callback", "(", "null",...
Callback for parsing the XML response return from the API and converting it to JSON and handing control back to the caller. - @param {Function} callback - the caller's callback - @param {String} response - the XML response from the API - @parma {Object} opts - an options hash with the desired format and logger
[ "Callback", "for", "parsing", "the", "XML", "response", "return", "from", "the", "API", "and", "converting", "it", "to", "JSON", "and", "handing", "control", "back", "to", "the", "caller", ".", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/responseparser.js#L17-L86
train
7digital/7digital-api
lib/errors.js
ApiHttpError
function ApiHttpError(statusCode, response, message) { this.name = "ApiHttpError"; this.statusCode = statusCode; this.response = response; this.message = message || response || util.format('Unexpected %s status code', statusCode); if (Error.captureStackTrace && typeof Error.captureStackTrace === 'function') {...
javascript
function ApiHttpError(statusCode, response, message) { this.name = "ApiHttpError"; this.statusCode = statusCode; this.response = response; this.message = message || response || util.format('Unexpected %s status code', statusCode); if (Error.captureStackTrace && typeof Error.captureStackTrace === 'function') {...
[ "function", "ApiHttpError", "(", "statusCode", ",", "response", ",", "message", ")", "{", "this", ".", "name", "=", "\"ApiHttpError\"", ";", "this", ".", "statusCode", "=", "statusCode", ";", "this", ".", "response", "=", "response", ";", "this", ".", "mes...
ApiHttpError Creates a new ApiHttpError supplied to callbacks when an error response is received at transport level. - @constructor - @param {Number} statusCode - The HTTP status code of the request. - @param {String} response - (Optional) The response body. - @param {String} message - (Optional) The message
[ "ApiHttpError", "Creates", "a", "new", "ApiHttpError", "supplied", "to", "callbacks", "when", "an", "error", "response", "is", "received", "at", "transport", "level", ".", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/errors.js#L25-L36
train
7digital/7digital-api
lib/errors.js
ApiParseError
function ApiParseError(parseErrorMessage, response) { this.name = "ApiParseError"; this.response = response; this.message = parseErrorMessage; if (Error.captureStackTrace && typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, ApiParseError); } }
javascript
function ApiParseError(parseErrorMessage, response) { this.name = "ApiParseError"; this.response = response; this.message = parseErrorMessage; if (Error.captureStackTrace && typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, ApiParseError); } }
[ "function", "ApiParseError", "(", "parseErrorMessage", ",", "response", ")", "{", "this", ".", "name", "=", "\"ApiParseError\"", ";", "this", ".", "response", "=", "response", ";", "this", ".", "message", "=", "parseErrorMessage", ";", "if", "(", "Error", "....
ApiParseError Creates a new ApiParseError supplied to callbacks when an invalid or unexpected response is received. - @constructor - @param {String} parseErrorMessage - Custom error message describing the nature of the parse error. - @param {String} response - The response body string.
[ "ApiParseError", "Creates", "a", "new", "ApiParseError", "supplied", "to", "callbacks", "when", "an", "invalid", "or", "unexpected", "response", "is", "received", ".", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/errors.js#L49-L58
train
7digital/7digital-api
lib/errors.js
RequestError
function RequestError(err, url) { VError.call(this, err, 'for url %s', url); this.name = RequestError.name; }
javascript
function RequestError(err, url) { VError.call(this, err, 'for url %s', url); this.name = RequestError.name; }
[ "function", "RequestError", "(", "err", ",", "url", ")", "{", "VError", ".", "call", "(", "this", ",", "err", ",", "'for url %s'", ",", "url", ")", ";", "this", ".", "name", "=", "RequestError", ".", "name", ";", "}" ]
RequestError Creates a new RequestError supplied to callbacks when the request to the api fails.
[ "RequestError", "Creates", "a", "new", "RequestError", "supplied", "to", "callbacks", "when", "the", "request", "to", "the", "api", "fails", "." ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/errors.js#L67-L70
train
7digital/7digital-api
lib/errors.js
OAuthError
function OAuthError(errorResponse, message) { this.name = "OAuthError"; this.message = message || errorResponse.errorMessage; this.code = errorResponse.code; this.response = errorResponse; if (Error.captureStackTrace && typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, OAuthError)...
javascript
function OAuthError(errorResponse, message) { this.name = "OAuthError"; this.message = message || errorResponse.errorMessage; this.code = errorResponse.code; this.response = errorResponse; if (Error.captureStackTrace && typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, OAuthError)...
[ "function", "OAuthError", "(", "errorResponse", ",", "message", ")", "{", "this", ".", "name", "=", "\"OAuthError\"", ";", "this", ".", "message", "=", "message", "||", "errorResponse", ".", "errorMessage", ";", "this", ".", "code", "=", "errorResponse", "."...
OAuthError Creates a new ApiError supplied to callbacks when a valid error response is received. - @constructor - @param {Object} errorResponse - The parsed API error response - @param {Object} message - The message
[ "OAuthError", "Creates", "a", "new", "ApiError", "supplied", "to", "callbacks", "when", "a", "valid", "error", "response", "is", "received", ".", "-" ]
3ca5db83d95a0361d997e2de72a215fb725b279d
https://github.com/7digital/7digital-api/blob/3ca5db83d95a0361d997e2de72a215fb725b279d/lib/errors.js#L82-L92
train
haroldiedema/joii
src/PrototypeBuilder.js
function(args, data, msg) { if (typeof (args) !== 'object') { args = [args]; } for (var i in args) { if (args.hasOwnProperty(i) === false) continue; if (JOII.Compat.indexOf(data, args[i]) !== -1) { throw msg; } } }
javascript
function(args, data, msg) { if (typeof (args) !== 'object') { args = [args]; } for (var i in args) { if (args.hasOwnProperty(i) === false) continue; if (JOII.Compat.indexOf(data, args[i]) !== -1) { throw msg; } } }
[ "function", "(", "args", ",", "data", ",", "msg", ")", "{", "if", "(", "typeof", "(", "args", ")", "!==", "'object'", ")", "{", "args", "=", "[", "args", "]", ";", "}", "for", "(", "var", "i", "in", "args", ")", "{", "if", "(", "args", ".", ...
Shorthand for validating other flags within the same declaration. If args exists in data, msg is thrown.
[ "Shorthand", "for", "validating", "other", "flags", "within", "the", "same", "declaration", ".", "If", "args", "exists", "in", "data", "msg", "is", "thrown", "." ]
08f9b795109f01c584b769959d573ef9a799f6ba
https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/PrototypeBuilder.js#L604-L615
train
SamyPesse/octocat.js
src/page.js
parseLinkHeader
function parseLinkHeader(header) { if (!header) { return {}; } // Split parts by comma const parts = header.split(','); const links = {}; // Parse each part into a named link parts.forEach((p) => { const section = p.split(';'); if (section.length != 2) { ...
javascript
function parseLinkHeader(header) { if (!header) { return {}; } // Split parts by comma const parts = header.split(','); const links = {}; // Parse each part into a named link parts.forEach((p) => { const section = p.split(';'); if (section.length != 2) { ...
[ "function", "parseLinkHeader", "(", "header", ")", "{", "if", "(", "!", "header", ")", "{", "return", "{", "}", ";", "}", "// Split parts by comma", "const", "parts", "=", "header", ".", "split", "(", "','", ")", ";", "const", "links", "=", "{", "}", ...
Extract next and prev from link header @param {String} header @return {Object}
[ "Extract", "next", "and", "prev", "from", "link", "header" ]
1cbc1c499d0f8595db34c4c0df498deba8e4099f
https://github.com/SamyPesse/octocat.js/blob/1cbc1c499d0f8595db34c4c0df498deba8e4099f/src/page.js#L113-L134
train
haroldiedema/joii
src/Config.js
function (name) { if (JOII.Config.constructors.indexOf(name) !== -1) { return; } JOII.Config.constructors.push(name); }
javascript
function (name) { if (JOII.Config.constructors.indexOf(name) !== -1) { return; } JOII.Config.constructors.push(name); }
[ "function", "(", "name", ")", "{", "if", "(", "JOII", ".", "Config", ".", "constructors", ".", "indexOf", "(", "name", ")", "!==", "-", "1", ")", "{", "return", ";", "}", "JOII", ".", "Config", ".", "constructors", ".", "push", "(", "name", ")", ...
Adds a constructor method name. The first occurance of a function named like one of these is executed. The rest is ignored to prevent ambiguous behavior. @param {string} name
[ "Adds", "a", "constructor", "method", "name", ".", "The", "first", "occurance", "of", "a", "function", "named", "like", "one", "of", "these", "is", "executed", ".", "The", "rest", "is", "ignored", "to", "prevent", "ambiguous", "behavior", "." ]
08f9b795109f01c584b769959d573ef9a799f6ba
https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Config.js#L25-L31
train
haroldiedema/joii
src/Config.js
function(name) { if (JOII.Config.constructors.indexOf(name) === -1) { return; } JOII.Config.constructors.splice(JOII.Config.constructors.indexOf(name), 1); }
javascript
function(name) { if (JOII.Config.constructors.indexOf(name) === -1) { return; } JOII.Config.constructors.splice(JOII.Config.constructors.indexOf(name), 1); }
[ "function", "(", "name", ")", "{", "if", "(", "JOII", ".", "Config", ".", "constructors", ".", "indexOf", "(", "name", ")", "===", "-", "1", ")", "{", "return", ";", "}", "JOII", ".", "Config", ".", "constructors", ".", "splice", "(", "JOII", ".", ...
Removes a constructor method name. The first occurance of a function named like one of these is executed. The rest is ignored to prevent ambiguous behavior. @param {string} name
[ "Removes", "a", "constructor", "method", "name", ".", "The", "first", "occurance", "of", "a", "function", "named", "like", "one", "of", "these", "is", "executed", ".", "The", "rest", "is", "ignored", "to", "prevent", "ambiguous", "behavior", "." ]
08f9b795109f01c584b769959d573ef9a799f6ba
https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Config.js#L40-L46
train
dannymidnight/node-weather
yahoo.js
function(msg) { if (yahoo.logging) { console.log('ERROR: ' + msg); } if (module.exports.error) { module.exports.error(msg); } }
javascript
function(msg) { if (yahoo.logging) { console.log('ERROR: ' + msg); } if (module.exports.error) { module.exports.error(msg); } }
[ "function", "(", "msg", ")", "{", "if", "(", "yahoo", ".", "logging", ")", "{", "console", ".", "log", "(", "'ERROR: '", "+", "msg", ")", ";", "}", "if", "(", "module", ".", "exports", ".", "error", ")", "{", "module", ".", "exports", ".", "error...
Report error.
[ "Report", "error", "." ]
6658662f8641ed272a93c280b327429f23c6d3d8
https://github.com/dannymidnight/node-weather/blob/6658662f8641ed272a93c280b327429f23c6d3d8/yahoo.js#L15-L23
train
telligro/opal-nodes
packages/opal-node-email/emailprocess.js
processNewMessage
function processNewMessage(msg, mailMessage) { // msg = JSON.parse(JSON.stringify(msg)); // Clone the message // Populate the msg fields from the content of the email message // that we have just parsed. msg.payload = mailMessage.text; msg....
javascript
function processNewMessage(msg, mailMessage) { // msg = JSON.parse(JSON.stringify(msg)); // Clone the message // Populate the msg fields from the content of the email message // that we have just parsed. msg.payload = mailMessage.text; msg....
[ "function", "processNewMessage", "(", "msg", ",", "mailMessage", ")", "{", "// msg = JSON.parse(JSON.stringify(msg)); // Clone the message", "// Populate the msg fields from the content of the email message", "// that we have just parsed.", "msg", ".", "payload", "=", "mailMessage", ...
Process a new email message by building a Node-RED message to be passed onwards in the message flow. The parameter called `msg` is the template message we start with while `mailMessage` is an object returned from `mailparser` that will be used to populate the email. Process a new email message by building a Node-RED ...
[ "Process", "a", "new", "email", "message", "by", "building", "a", "Node", "-", "RED", "message", "to", "be", "passed", "onwards", "in", "the", "message", "flow", ".", "The", "parameter", "called", "msg", "is", "the", "template", "message", "we", "start", ...
028e02b8ef9709ba548e153db446931c6d7a385d
https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-email/emailprocess.js#L352-L381
train
telligro/opal-nodes
packages/opal-node-email/emailprocess.js
checkPOP3
function checkPOP3(msg) { let currentMessage; let maxMessage; // Form a new connection to our email server using POP3. let pop3Client = new POP3Client( node.port, node.server, {enabletls: node.useSSL} // Should we u...
javascript
function checkPOP3(msg) { let currentMessage; let maxMessage; // Form a new connection to our email server using POP3. let pop3Client = new POP3Client( node.port, node.server, {enabletls: node.useSSL} // Should we u...
[ "function", "checkPOP3", "(", "msg", ")", "{", "let", "currentMessage", ";", "let", "maxMessage", ";", "// Form a new connection to our email server using POP3.", "let", "pop3Client", "=", "new", "POP3Client", "(", "node", ".", "port", ",", "node", ".", "server", ...
Check the POP3 email mailbox for any new messages. For any that are found, retrieve each message, call processNewMessage to process it and then delete Check the POP3 email mailbox for any new messages. For any that are found, retrieve each message, call processNewMessage to process it and then delete @param {any} m...
[ "Check", "the", "POP3", "email", "mailbox", "for", "any", "new", "messages", ".", "For", "any", "that", "are", "found", "retrieve", "each", "message", "call", "processNewMessage", "to", "process", "it", "and", "then", "delete", "Check", "the", "POP3", "email...
028e02b8ef9709ba548e153db446931c6d7a385d
https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-email/emailprocess.js#L391-L480
train
telligro/opal-nodes
packages/opal-node-email/emailprocess.js
processValuesFromContext
function processValuesFromContext(node, params, msg, varList) { let pMsg = {}; Object.assign(pMsg, params); varList.forEach((varItem) => { if (varItem.type === undefined || params[varItem.type] === undefined) { pMsg[varItem.name...
javascript
function processValuesFromContext(node, params, msg, varList) { let pMsg = {}; Object.assign(pMsg, params); varList.forEach((varItem) => { if (varItem.type === undefined || params[varItem.type] === undefined) { pMsg[varItem.name...
[ "function", "processValuesFromContext", "(", "node", ",", "params", ",", "msg", ",", "varList", ")", "{", "let", "pMsg", "=", "{", "}", ";", "Object", ".", "assign", "(", "pMsg", ",", "params", ")", ";", "varList", ".", "forEach", "(", "(", "varItem", ...
End of checkEmail proccess values from context @param {any} node __DOCSPLACEHOLDER__ @param {any} params __DOCSPLACEHOLDER__ @param {any} msg __DOCSPLACEHOLDER__ @param {any} varList __DOCSPLACEHOLDER__ @return {object} pMsg
[ "End", "of", "checkEmail", "proccess", "values", "from", "context" ]
028e02b8ef9709ba548e153db446931c6d7a385d
https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-email/emailprocess.js#L650-L667
train
nodebox/g.js
src/g.js
splitRow
function splitRow(s, delimiter) { var row = [], c, col = '', i, inString = false; s = s.trim(); for (i = 0; i < s.length; i += 1) { c = s[i]; if (c === '"') { if (s[i+1] === '"') { col += '"'; i += 1; } else { inString =...
javascript
function splitRow(s, delimiter) { var row = [], c, col = '', i, inString = false; s = s.trim(); for (i = 0; i < s.length; i += 1) { c = s[i]; if (c === '"') { if (s[i+1] === '"') { col += '"'; i += 1; } else { inString =...
[ "function", "splitRow", "(", "s", ",", "delimiter", ")", "{", "var", "row", "=", "[", "]", ",", "c", ",", "col", "=", "''", ",", "i", ",", "inString", "=", "false", ";", "s", "=", "s", ".", "trim", "(", ")", ";", "for", "(", "i", "=", "0", ...
Split the row, taking quotes into account.
[ "Split", "the", "row", "taking", "quotes", "into", "account", "." ]
4ef0c579a607a38337fbf9f36f176b35eb7092d2
https://github.com/nodebox/g.js/blob/4ef0c579a607a38337fbf9f36f176b35eb7092d2/src/g.js#L49-L74
train
haroldiedema/joii
src/Reflection.js
function(name) { var list = this.getProperties(); for (var i in list) { if (list[i].getName() === name) { return true; } } return false; }
javascript
function(name) { var list = this.getProperties(); for (var i in list) { if (list[i].getName() === name) { return true; } } return false; }
[ "function", "(", "name", ")", "{", "var", "list", "=", "this", ".", "getProperties", "(", ")", ";", "for", "(", "var", "i", "in", "list", ")", "{", "if", "(", "list", "[", "i", "]", ".", "getName", "(", ")", "===", "name", ")", "{", "return", ...
Returns true if a property by the given name exists. @return bool
[ "Returns", "true", "if", "a", "property", "by", "the", "given", "name", "exists", "." ]
08f9b795109f01c584b769959d573ef9a799f6ba
https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L106-L114
train
haroldiedema/joii
src/Reflection.js
function(filter) { var result = []; for (var i in this.proto) { if (typeof (this.proto[i]) === 'function' && JOII.Compat.indexOf(JOII.InternalPropertyNames, i) === -1) { result.push(new JOII.Reflection.Method(this, i)); } } return result; }
javascript
function(filter) { var result = []; for (var i in this.proto) { if (typeof (this.proto[i]) === 'function' && JOII.Compat.indexOf(JOII.InternalPropertyNames, i) === -1) { result.push(new JOII.Reflection.Method(this, i)); } } return result; }
[ "function", "(", "filter", ")", "{", "var", "result", "=", "[", "]", ";", "for", "(", "var", "i", "in", "this", ".", "proto", ")", "{", "if", "(", "typeof", "(", "this", ".", "proto", "[", "i", "]", ")", "===", "'function'", "&&", "JOII", ".", ...
Returns an array of JOII.Reflection.Method based on the methods defined in this class. @param string filter Optional filter for 'private' or 'public'. @return JOII.Reflection.Method[]
[ "Returns", "an", "array", "of", "JOII", ".", "Reflection", ".", "Method", "based", "on", "the", "methods", "defined", "in", "this", "class", "." ]
08f9b795109f01c584b769959d573ef9a799f6ba
https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L141-L149
train
haroldiedema/joii
src/Reflection.js
function(name) { var list = this.getMethods(); for (var i in list) { if (list[i].getName() === name) { return true; } } return false; }
javascript
function(name) { var list = this.getMethods(); for (var i in list) { if (list[i].getName() === name) { return true; } } return false; }
[ "function", "(", "name", ")", "{", "var", "list", "=", "this", ".", "getMethods", "(", ")", ";", "for", "(", "var", "i", "in", "list", ")", "{", "if", "(", "list", "[", "i", "]", ".", "getName", "(", ")", "===", "name", ")", "{", "return", "t...
Returns true if a method by the given name exists. @return bool
[ "Returns", "true", "if", "a", "method", "by", "the", "given", "name", "exists", "." ]
08f9b795109f01c584b769959d573ef9a799f6ba
https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L156-L164
train
haroldiedema/joii
src/Reflection.js
function(name) { var list = this.getMethods(); for (var i in list) { if (list[i].getName() === name) { return list[i]; } } throw 'Method "' + name + '" does not exist.'; }
javascript
function(name) { var list = this.getMethods(); for (var i in list) { if (list[i].getName() === name) { return list[i]; } } throw 'Method "' + name + '" does not exist.'; }
[ "function", "(", "name", ")", "{", "var", "list", "=", "this", ".", "getMethods", "(", ")", ";", "for", "(", "var", "i", "in", "list", ")", "{", "if", "(", "list", "[", "i", "]", ".", "getName", "(", ")", "===", "name", ")", "{", "return", "l...
Returns an instance of JOII.Reflection.Method of a method by the given name. @param string name @return JOII.Reflection.Method
[ "Returns", "an", "instance", "of", "JOII", ".", "Reflection", ".", "Method", "of", "a", "method", "by", "the", "given", "name", "." ]
08f9b795109f01c584b769959d573ef9a799f6ba
https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L173-L181
train
haroldiedema/joii
src/Reflection.js
function(name) { var list = this.getProperties(); for (var i in list) { if (list[i].getName() === name) { return list[i]; } } throw 'Property "' + name + '" does not exist.'; }
javascript
function(name) { var list = this.getProperties(); for (var i in list) { if (list[i].getName() === name) { return list[i]; } } throw 'Property "' + name + '" does not exist.'; }
[ "function", "(", "name", ")", "{", "var", "list", "=", "this", ".", "getProperties", "(", ")", ";", "for", "(", "var", "i", "in", "list", ")", "{", "if", "(", "list", "[", "i", "]", ".", "getName", "(", ")", "===", "name", ")", "{", "return", ...
Returns an instance of JOII.Reflection.Property of a property by the given name. @param string name @return JOII.Reflection.Property
[ "Returns", "an", "instance", "of", "JOII", ".", "Reflection", ".", "Property", "of", "a", "property", "by", "the", "given", "name", "." ]
08f9b795109f01c584b769959d573ef9a799f6ba
https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L207-L215
train
haroldiedema/joii
src/Reflection.js
function() { var name_parts = [], proto_ref = this.reflector.getProto()[this.name], name = '', body = ''; if (this.meta.is_abstract) { name_parts.push('abstract'); } if (this.meta.is_final) { name_parts.push('final'); } name_parts.push(t...
javascript
function() { var name_parts = [], proto_ref = this.reflector.getProto()[this.name], name = '', body = ''; if (this.meta.is_abstract) { name_parts.push('abstract'); } if (this.meta.is_final) { name_parts.push('final'); } name_parts.push(t...
[ "function", "(", ")", "{", "var", "name_parts", "=", "[", "]", ",", "proto_ref", "=", "this", ".", "reflector", ".", "getProto", "(", ")", "[", "this", ".", "name", "]", ",", "name", "=", "''", ",", "body", "=", "''", ";", "if", "(", "this", "....
Returns a string representation of this object. @return string
[ "Returns", "a", "string", "representation", "of", "this", "object", "." ]
08f9b795109f01c584b769959d573ef9a799f6ba
https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L392-L432
train
haroldiedema/joii
src/Reflection.js
function() { var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m, FN_ARG_SPLIT = /,/, FN_ARG = /^\s*(_?)(\S+?)\1\s*$/, STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg, getParams = function(fn) { var fnText, argDecl; ...
javascript
function() { var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m, FN_ARG_SPLIT = /,/, FN_ARG = /^\s*(_?)(\S+?)\1\s*$/, STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg, getParams = function(fn) { var fnText, argDecl; ...
[ "function", "(", ")", "{", "var", "FN_ARGS", "=", "/", "^function\\s*[^\\(]*\\(\\s*([^\\)]*)\\)", "/", "m", ",", "FN_ARG_SPLIT", "=", "/", ",", "/", ",", "FN_ARG", "=", "/", "^\\s*(_?)(\\S+?)\\1\\s*$", "/", ",", "STRIP_COMMENTS", "=", "/", "((\\/\\/.*$)|(\\/\\*[...
Returns an array of strings based on the parameters defined in the declared function. @return string[]
[ "Returns", "an", "array", "of", "strings", "based", "on", "the", "parameters", "defined", "in", "the", "declared", "function", "." ]
08f9b795109f01c584b769959d573ef9a799f6ba
https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L443-L493
train
haroldiedema/joii
src/Reflection.js
function(f) { var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg, fn_text = this.reflector.getProto()[this.name].toString().replace(STRIP_COMMENTS, ''); return fn_text.substr(fn_text.indexOf('{') + 1, fn_text.lastIndexOf('}') - 4).replace(/}([^}]*)$/, '$1'); }
javascript
function(f) { var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg, fn_text = this.reflector.getProto()[this.name].toString().replace(STRIP_COMMENTS, ''); return fn_text.substr(fn_text.indexOf('{') + 1, fn_text.lastIndexOf('}') - 4).replace(/}([^}]*)$/, '$1'); }
[ "function", "(", "f", ")", "{", "var", "STRIP_COMMENTS", "=", "/", "((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))", "/", "mg", ",", "fn_text", "=", "this", ".", "reflector", ".", "getProto", "(", ")", "[", "this", ".", "name", "]", ".", "toString", "(", ")", "....
Returns the body of this method as a string. @return string
[ "Returns", "the", "body", "of", "this", "method", "as", "a", "string", "." ]
08f9b795109f01c584b769959d573ef9a799f6ba
https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L500-L505
train
haroldiedema/joii
src/Reflection.js
function() { // Get the "declaration" part of the method. var prefix = this['super']('toString').split(':')[0], body = '[Function', args = this.getParameters(), is_var = this.usesVariadicArguments(); if (args.length > 0 && typeof (args[0]) === 'object') ...
javascript
function() { // Get the "declaration" part of the method. var prefix = this['super']('toString').split(':')[0], body = '[Function', args = this.getParameters(), is_var = this.usesVariadicArguments(); if (args.length > 0 && typeof (args[0]) === 'object') ...
[ "function", "(", ")", "{", "// Get the \"declaration\" part of the method.", "var", "prefix", "=", "this", "[", "'super'", "]", "(", "'toString'", ")", ".", "split", "(", "':'", ")", "[", "0", "]", ",", "body", "=", "'[Function'", ",", "args", "=", "this",...
Returns a string representation of the method. @return string
[ "Returns", "a", "string", "representation", "of", "the", "method", "." ]
08f9b795109f01c584b769959d573ef9a799f6ba
https://github.com/haroldiedema/joii/blob/08f9b795109f01c584b769959d573ef9a799f6ba/src/Reflection.js#L526-L576
train
telligro/opal-nodes
packages/opal-node-pdfreader/pdfreader.js
sendError
function sendError(node, msg, err, ...attrs) { if (check.string(err)) { msg.error = { node: node.name, message: util.format(err, ...attrs), }; } else if (check.instance(err, Error)) { msg.error = err; } node.error(node.n...
javascript
function sendError(node, msg, err, ...attrs) { if (check.string(err)) { msg.error = { node: node.name, message: util.format(err, ...attrs), }; } else if (check.instance(err, Error)) { msg.error = err; } node.error(node.n...
[ "function", "sendError", "(", "node", ",", "msg", ",", "err", ",", "...", "attrs", ")", "{", "if", "(", "check", ".", "string", "(", "err", ")", ")", "{", "msg", ".", "error", "=", "{", "node", ":", "node", ".", "name", ",", "message", ":", "ut...
sends Error back to node-red @function @param {object} node - the node object returned by createNode @param {object} msg - msg object passed as input to this node. @param {object} err - error object. @param {object} attrs - attrs to be used to construct error message.
[ "sends", "Error", "back", "to", "node", "-", "red" ]
028e02b8ef9709ba548e153db446931c6d7a385d
https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-pdfreader/pdfreader.js#L35-L45
train
node-modules/ndir
lib/ndir.js
Walk
function Walk(root, onDir, onEnd, onError) { if (!(this instanceof Walk)) { return new Walk(root, onDir, onEnd, onError); } this.dirs = [path.resolve(root)]; if (onDir) { this.on('dir', onDir); } if (onEnd) { this.on('end', onEnd); } onError && this.on('error', onError); var self = this; ...
javascript
function Walk(root, onDir, onEnd, onError) { if (!(this instanceof Walk)) { return new Walk(root, onDir, onEnd, onError); } this.dirs = [path.resolve(root)]; if (onDir) { this.on('dir', onDir); } if (onEnd) { this.on('end', onEnd); } onError && this.on('error', onError); var self = this; ...
[ "function", "Walk", "(", "root", ",", "onDir", ",", "onEnd", ",", "onError", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Walk", ")", ")", "{", "return", "new", "Walk", "(", "root", ",", "onDir", ",", "onEnd", ",", "onError", ")", ";", "...
dir Walker Class. @constructor @param {String} root Root path. @param {Function(dirpath, files)} [onDir] The `dir` event callback. @param {Function} [onEnd] The `end` event callback. @param {Function(err)} [onError] The `error` event callback. @public
[ "dir", "Walker", "Class", "." ]
d8fe9dca7c103f4180624bfa86ed6bbeaad67847
https://github.com/node-modules/ndir/blob/d8fe9dca7c103f4180624bfa86ed6bbeaad67847/lib/ndir.js#L27-L44
train
node-modules/ndir
lib/ndir.js
LineReader
function LineReader(file) { if (typeof file === 'string') { this.readstream = fs.createReadStream(file); } else { this.readstream = file; } this.remainBuffers = []; var self = this; this.readstream.on('data', function (data) { self.ondata(data); }); this.readstream.on('error', function (err)...
javascript
function LineReader(file) { if (typeof file === 'string') { this.readstream = fs.createReadStream(file); } else { this.readstream = file; } this.remainBuffers = []; var self = this; this.readstream.on('data', function (data) { self.ondata(data); }); this.readstream.on('error', function (err)...
[ "function", "LineReader", "(", "file", ")", "{", "if", "(", "typeof", "file", "===", "'string'", ")", "{", "this", ".", "readstream", "=", "fs", ".", "createReadStream", "(", "file", ")", ";", "}", "else", "{", "this", ".", "readstream", "=", "file", ...
Read stream data line by line. @constructor @param {String|ReadStream} file File path or data stream object.
[ "Read", "stream", "data", "line", "by", "line", "." ]
d8fe9dca7c103f4180624bfa86ed6bbeaad67847
https://github.com/node-modules/ndir/blob/d8fe9dca7c103f4180624bfa86ed6bbeaad67847/lib/ndir.js#L197-L214
train
wavesjs/waves-lfo
benchmarks/wasm/src/index.js
loadWebAssembly
function loadWebAssembly(filename, imports) { // Fetch the file and compile it return fetch(filename) .then(response => response.arrayBuffer()) .then(buffer => WebAssembly.compile(buffer)) .then(module => { // create the imports for the module, including the // standard dynamic library impor...
javascript
function loadWebAssembly(filename, imports) { // Fetch the file and compile it return fetch(filename) .then(response => response.arrayBuffer()) .then(buffer => WebAssembly.compile(buffer)) .then(module => { // create the imports for the module, including the // standard dynamic library impor...
[ "function", "loadWebAssembly", "(", "filename", ",", "imports", ")", "{", "// Fetch the file and compile it", "return", "fetch", "(", "filename", ")", ".", "then", "(", "response", "=>", "response", ".", "arrayBuffer", "(", ")", ")", ".", "then", "(", "buffer"...
loads a WebAssembly dynamic library, returns a promise. imports is an optional imports object
[ "loads", "a", "WebAssembly", "dynamic", "library", "returns", "a", "promise", ".", "imports", "is", "an", "optional", "imports", "object" ]
4353a8ef55b7921755fe182cb09b0df566696bc8
https://github.com/wavesjs/waves-lfo/blob/4353a8ef55b7921755fe182cb09b0df566696bc8/benchmarks/wasm/src/index.js#L21-L45
train
sipcapture/hep-js
index.js
function(message) { if (debug) console.log('Decoding HEP3 Packet...'); try { var HEP = hepHeader.parse(message); if(HEP.payload && HEP.payload.length>0){ var data = HEP.payload; var tot = 0; var decoded = {}; var PAYLOAD; while(true){ PAYLOAD = hepParse.parse( data.slice(tot) ); var t...
javascript
function(message) { if (debug) console.log('Decoding HEP3 Packet...'); try { var HEP = hepHeader.parse(message); if(HEP.payload && HEP.payload.length>0){ var data = HEP.payload; var tot = 0; var decoded = {}; var PAYLOAD; while(true){ PAYLOAD = hepParse.parse( data.slice(tot) ); var t...
[ "function", "(", "message", ")", "{", "if", "(", "debug", ")", "console", ".", "log", "(", "'Decoding HEP3 Packet...'", ")", ";", "try", "{", "var", "HEP", "=", "hepHeader", ".", "parse", "(", "message", ")", ";", "if", "(", "HEP", ".", "payload", "&...
Decode HEP3 Packet to JSON Object. @param {Buffer} hep message @return {Object}
[ "Decode", "HEP3", "Packet", "to", "JSON", "Object", "." ]
03922c439e4cce39ff2a0a87743476dfcdc2f298
https://github.com/sipcapture/hep-js/blob/03922c439e4cce39ff2a0a87743476dfcdc2f298/index.js#L39-L62
train
nodebox/g.js
src/libraries/img/img.js
toGradientData
function toGradientData(v1, v2, v3, v4, v5) { var startColor, endColor, type, rotation, spread, d; var data = {}; if (arguments.length === 1) { // The argument is a dictionary or undefined. d = v1 || {}; startColor = d.startColor; endColor = d.endColor; type = d.type; ...
javascript
function toGradientData(v1, v2, v3, v4, v5) { var startColor, endColor, type, rotation, spread, d; var data = {}; if (arguments.length === 1) { // The argument is a dictionary or undefined. d = v1 || {}; startColor = d.startColor; endColor = d.endColor; type = d.type; ...
[ "function", "toGradientData", "(", "v1", ",", "v2", ",", "v3", ",", "v4", ",", "v5", ")", "{", "var", "startColor", ",", "endColor", ",", "type", ",", "rotation", ",", "spread", ",", "d", ";", "var", "data", "=", "{", "}", ";", "if", "(", "argume...
Converts a number of arguments into a dictionary of gradient information that is understood by the renderer.
[ "Converts", "a", "number", "of", "arguments", "into", "a", "dictionary", "of", "gradient", "information", "that", "is", "understood", "by", "the", "renderer", "." ]
4ef0c579a607a38337fbf9f36f176b35eb7092d2
https://github.com/nodebox/g.js/blob/4ef0c579a607a38337fbf9f36f176b35eb7092d2/src/libraries/img/img.js#L124-L214
train
nodebox/g.js
src/libraries/img/img.js
function (canvas) { this.width = canvas.width; this.height = canvas.height; var ctx = canvas.getContext('2d'); this._data = ctx.getImageData(0, 0, this.width, this.height); this.array = this._data.data; }
javascript
function (canvas) { this.width = canvas.width; this.height = canvas.height; var ctx = canvas.getContext('2d'); this._data = ctx.getImageData(0, 0, this.width, this.height); this.array = this._data.data; }
[ "function", "(", "canvas", ")", "{", "this", ".", "width", "=", "canvas", ".", "width", ";", "this", ".", "height", "=", "canvas", ".", "height", ";", "var", "ctx", "=", "canvas", ".", "getContext", "(", "'2d'", ")", ";", "this", ".", "_data", "=",...
IMAGE PIXELS.
[ "IMAGE", "PIXELS", "." ]
4ef0c579a607a38337fbf9f36f176b35eb7092d2
https://github.com/nodebox/g.js/blob/4ef0c579a607a38337fbf9f36f176b35eb7092d2/src/libraries/img/img.js#L457-L463
train
arifsetiawan/flatten
lib/flatten.js
walkModules
function walkModules(dir, done) { var results = []; fs.readdir(dir, function(err, list) { if (err) return done(err); var pending = list.length; if (!pending) return done(null, results); list.forEach(function(file) { file = dir + path.sep + file; fs.stat(file, function(err...
javascript
function walkModules(dir, done) { var results = []; fs.readdir(dir, function(err, list) { if (err) return done(err); var pending = list.length; if (!pending) return done(null, results); list.forEach(function(file) { file = dir + path.sep + file; fs.stat(file, function(err...
[ "function", "walkModules", "(", "dir", ",", "done", ")", "{", "var", "results", "=", "[", "]", ";", "fs", ".", "readdir", "(", "dir", ",", "function", "(", "err", ",", "list", ")", "{", "if", "(", "err", ")", "return", "done", "(", "err", ")", ...
Walk module folder Find folder node_modules, scan its folders, find package.json and store it, recursively @param {String} dir Directory name @param {Function} done this will contains array of package.json file
[ "Walk", "module", "folder" ]
d5dbbf3753270df5fc0890a794bf0f7b24e1d00b
https://github.com/arifsetiawan/flatten/blob/d5dbbf3753270df5fc0890a794bf0f7b24e1d00b/lib/flatten.js#L188-L227
train
telligro/opal-nodes
packages/opal-node-msexcel/msexcel.js
readRows
function readRows(ws, rows, opts) { let contents = {}; if (typeof rows === 'string') { rows = rows.split(','); } opts = (opts === undefined) ? {} : opts; // console.log('Typeof Rows %s', typeof rows); // console.log('Typeof Rows %s', rows); // console....
javascript
function readRows(ws, rows, opts) { let contents = {}; if (typeof rows === 'string') { rows = rows.split(','); } opts = (opts === undefined) ? {} : opts; // console.log('Typeof Rows %s', typeof rows); // console.log('Typeof Rows %s', rows); // console....
[ "function", "readRows", "(", "ws", ",", "rows", ",", "opts", ")", "{", "let", "contents", "=", "{", "}", ";", "if", "(", "typeof", "rows", "===", "'string'", ")", "{", "rows", "=", "rows", ".", "split", "(", "','", ")", ";", "}", "opts", "=", "...
reads a specified rows from an opened workbook @function @param {object} ws - worksheet. @param {object} rows - rows to be fetched. @param {{asis: bool, useLabel: boolean, header: string, removeEmpty:boolean}} opts - options for processing the read request @return {object} contentsJson - returns the fetched content as ...
[ "reads", "a", "specified", "rows", "from", "an", "opened", "workbook" ]
028e02b8ef9709ba548e153db446931c6d7a385d
https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-msexcel/msexcel.js#L88-L131
train
telligro/opal-nodes
packages/opal-node-msexcel/msexcel.js
readCols
function readCols(ws, cols, opts) { // console.log('Reading cols ' + cols.length); // console.log(cols); let contents = {}; if (typeof cols === 'string') { cols = cols.split(','); } opts = (opts === undefined) ? {} : opts; let dRange = xlsx.utils.decod...
javascript
function readCols(ws, cols, opts) { // console.log('Reading cols ' + cols.length); // console.log(cols); let contents = {}; if (typeof cols === 'string') { cols = cols.split(','); } opts = (opts === undefined) ? {} : opts; let dRange = xlsx.utils.decod...
[ "function", "readCols", "(", "ws", ",", "cols", ",", "opts", ")", "{", "// console.log('Reading cols ' + cols.length);", "// console.log(cols);", "let", "contents", "=", "{", "}", ";", "if", "(", "typeof", "cols", "===", "'string'", ")", "{", "cols", "=", "col...
reads a specified cols from an opened workbook @function @param {object} ws - worksheet. @param {object} cols - cols to be fetched. @param {{asis: bool, useLabel: boolean, header: string, removeEmpty:boolean}} opts - options for processing the read request @return {object} contentsJson - returns the fetched content as ...
[ "reads", "a", "specified", "cols", "from", "an", "opened", "workbook" ]
028e02b8ef9709ba548e153db446931c6d7a385d
https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-msexcel/msexcel.js#L144-L188
train
telligro/opal-nodes
packages/opal-node-msexcel/msexcel.js
readRegion
function readRegion(ws, range, opts) { let contents = {}; opts = (opts === undefined) ? {} : opts; // console.log('Xref:%s', ws['!ref']); let dORange = xlsx.utils.decode_range(ws['!ref']); let dRange = xlsx.utils.decode_range(range); // Support for cols only ranges like ...
javascript
function readRegion(ws, range, opts) { let contents = {}; opts = (opts === undefined) ? {} : opts; // console.log('Xref:%s', ws['!ref']); let dORange = xlsx.utils.decode_range(ws['!ref']); let dRange = xlsx.utils.decode_range(range); // Support for cols only ranges like ...
[ "function", "readRegion", "(", "ws", ",", "range", ",", "opts", ")", "{", "let", "contents", "=", "{", "}", ";", "opts", "=", "(", "opts", "===", "undefined", ")", "?", "{", "}", ":", "opts", ";", "// console.log('Xref:%s', ws['!ref']);", "let", "dORange...
reads a specified region from an opened workbook @function @param {object} ws - worksheet. @param {object} range - rows to be fetched. @param {{asis: bool, useLabel: boolean, header: string, removeEmpty:boolean}} opts - options for processing the read request @return {object} contentsJson - returns the fetched content ...
[ "reads", "a", "specified", "region", "from", "an", "opened", "workbook" ]
028e02b8ef9709ba548e153db446931c6d7a385d
https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-msexcel/msexcel.js#L201-L247
train
telligro/opal-nodes
packages/opal-node-msexcel/msexcel.js
writeRegion
function writeRegion(ws, urange, contents) { let range = ws['!ref']; range = check.undefined(range) ? 'A1:A1' : range; let dRange = xlsx.utils.decode_range(range); let dUrange = xlsx.utils.decode_range(urange); let newRef = {s: {c: 0, r: 0}, e: {c: dRange.e.c, r: dRange.e.r}}; ...
javascript
function writeRegion(ws, urange, contents) { let range = ws['!ref']; range = check.undefined(range) ? 'A1:A1' : range; let dRange = xlsx.utils.decode_range(range); let dUrange = xlsx.utils.decode_range(urange); let newRef = {s: {c: 0, r: 0}, e: {c: dRange.e.c, r: dRange.e.r}}; ...
[ "function", "writeRegion", "(", "ws", ",", "urange", ",", "contents", ")", "{", "let", "range", "=", "ws", "[", "'!ref'", "]", ";", "range", "=", "check", ".", "undefined", "(", "range", ")", "?", "'A1:A1'", ":", "range", ";", "let", "dRange", "=", ...
writes a specified region to an opened workbook @function @param {object} ws - worksheet. @param {object} urange - range where contents are written @param {boolean} contents - contents that are to written to specified range @return {object} ws - returns the modified worksheet
[ "writes", "a", "specified", "region", "to", "an", "opened", "workbook" ]
028e02b8ef9709ba548e153db446931c6d7a385d
https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-msexcel/msexcel.js#L257-L282
train
telligro/opal-nodes
packages/opal-node-msexcel/msexcel.js
writeCols
function writeCols(ws, cols, contents) { let range = ws['!ref']; range = check.undefined(range) ? 'A1:A1' : range; let dRange = xlsx.utils.decode_range(range); let newRef = {s: {c: 0, r: 0}, e: {c: dRange.e.c, r: dRange.e.r}}; let encCell; if (typeof cols === 'string') { ...
javascript
function writeCols(ws, cols, contents) { let range = ws['!ref']; range = check.undefined(range) ? 'A1:A1' : range; let dRange = xlsx.utils.decode_range(range); let newRef = {s: {c: 0, r: 0}, e: {c: dRange.e.c, r: dRange.e.r}}; let encCell; if (typeof cols === 'string') { ...
[ "function", "writeCols", "(", "ws", ",", "cols", ",", "contents", ")", "{", "let", "range", "=", "ws", "[", "'!ref'", "]", ";", "range", "=", "check", ".", "undefined", "(", "range", ")", "?", "'A1:A1'", ":", "range", ";", "let", "dRange", "=", "xl...
writes specified cols to an opened workbook @function @param {object} ws - worksheet. @param {object} cols - cols where contents are written @param {boolean} contents - contents that are to written to specified cols @return {object} ws - returns the modified worksheet
[ "writes", "specified", "cols", "to", "an", "opened", "workbook" ]
028e02b8ef9709ba548e153db446931c6d7a385d
https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-msexcel/msexcel.js#L292-L320
train
telligro/opal-nodes
packages/opal-node-msexcel/msexcel.js
writeRows
function writeRows(ws, rows, contents) { // console.log('Typeof Rows %s', typeof rows); // console.log('Typeof Rows %s', rows); // console.log('Length Rows %d', rows.length); let range = ws['!ref']; range = check.undefined(range) ? 'A1:A1' : range; let dRange = xlsx.utils...
javascript
function writeRows(ws, rows, contents) { // console.log('Typeof Rows %s', typeof rows); // console.log('Typeof Rows %s', rows); // console.log('Length Rows %d', rows.length); let range = ws['!ref']; range = check.undefined(range) ? 'A1:A1' : range; let dRange = xlsx.utils...
[ "function", "writeRows", "(", "ws", ",", "rows", ",", "contents", ")", "{", "// console.log('Typeof Rows %s', typeof rows);", "// console.log('Typeof Rows %s', rows);", "// console.log('Length Rows %d', rows.length);", "let", "range", "=", "ws", "[", "'!ref'", "]", ";", "ra...
writes specified rows to an opened workbook @function @param {object} ws - worksheet. @param {object} rows - rows where contents are written @param {boolean} contents - contents that are to written to specified rows @return {object} ws - returns the modified worksheet
[ "writes", "specified", "rows", "to", "an", "opened", "workbook" ]
028e02b8ef9709ba548e153db446931c6d7a385d
https://github.com/telligro/opal-nodes/blob/028e02b8ef9709ba548e153db446931c6d7a385d/packages/opal-node-msexcel/msexcel.js#L330-L360
train
angular/gulp-clang-format
index.js
format
function format(opt_clangOptions, opt_clangFormat) { var actualClangFormat = opt_clangFormat || clangFormat; var optsStr = getOptsString(opt_clangOptions); function formatFilter(file, enc, done) { function onClangFormatFinished() { file.contents = Buffer.from(formatted, 'utf-8'); done(null, file)...
javascript
function format(opt_clangOptions, opt_clangFormat) { var actualClangFormat = opt_clangFormat || clangFormat; var optsStr = getOptsString(opt_clangOptions); function formatFilter(file, enc, done) { function onClangFormatFinished() { file.contents = Buffer.from(formatted, 'utf-8'); done(null, file)...
[ "function", "format", "(", "opt_clangOptions", ",", "opt_clangFormat", ")", "{", "var", "actualClangFormat", "=", "opt_clangFormat", "||", "clangFormat", ";", "var", "optsStr", "=", "getOptsString", "(", "opt_clangOptions", ")", ";", "function", "formatFilter", "(",...
Formats files using clang-format. @param {(string|Object)=} opt_clangOptions the string 'file' to search for a '.clang-format' file, or an object literal containing clang-format options http://clang.llvm.org/docs/ClangFormatStyleOptions.html#configurable-format-style-options @param {Object=} opt_clangFormat A clang-fo...
[ "Formats", "files", "using", "clang", "-", "format", "." ]
585c281cdd7788e6dee8082d6c9e5f53830baa4a
https://github.com/angular/gulp-clang-format/blob/585c281cdd7788e6dee8082d6c9e5f53830baa4a/index.js#L19-L34
train