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
SassDoc/sassdoc
src/sassdoc.js
theme
function theme (env) { let promise = env.theme(env.dest, env) if (!is.promise(promise)) { let type = Object.prototype.toString.call(promise) throw new errors.Error(`Theme didn't return a promise, got ${type}.`) } return promise .then(() => { let displayTheme = env.displayThem...
javascript
function theme (env) { let promise = env.theme(env.dest, env) if (!is.promise(promise)) { let type = Object.prototype.toString.call(promise) throw new errors.Error(`Theme didn't return a promise, got ${type}.`) } return promise .then(() => { let displayTheme = env.displayThem...
[ "function", "theme", "(", "env", ")", "{", "let", "promise", "=", "env", ".", "theme", "(", "env", ".", "dest", ",", "env", ")", "if", "(", "!", "is", ".", "promise", "(", "promise", ")", ")", "{", "let", "type", "=", "Object", ".", "prototype", ...
Render theme with parsed data context. @return {Promise}
[ "Render", "theme", "with", "parsed", "data", "context", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L110-L123
train
SassDoc/sassdoc
src/sassdoc.js
documentize
async function documentize (env) { init(env) let data = await baseDocumentize(env) try { await refresh(env) await theme(env) okay(env) } catch (err) { env.emit('error', err) throw err } return data }
javascript
async function documentize (env) { init(env) let data = await baseDocumentize(env) try { await refresh(env) await theme(env) okay(env) } catch (err) { env.emit('error', err) throw err } return data }
[ "async", "function", "documentize", "(", "env", ")", "{", "init", "(", "env", ")", "let", "data", "=", "await", "baseDocumentize", "(", "env", ")", "try", "{", "await", "refresh", "(", "env", ")", "await", "theme", "(", "env", ")", "okay", "(", "env"...
Execute full SassDoc sequence from a source directory. @return {Promise}
[ "Execute", "full", "SassDoc", "sequence", "from", "a", "source", "directory", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L129-L143
train
SassDoc/sassdoc
src/sassdoc.js
stream
function stream (env) { let filter = parseFilter(env) filter.promise .then(data => { env.logger.log('Sass sources successfully parsed.') env.data = data onEmpty(data, env) }) /** * Returned Promise await the full sequence, * instead of just the parsing step. ...
javascript
function stream (env) { let filter = parseFilter(env) filter.promise .then(data => { env.logger.log('Sass sources successfully parsed.') env.data = data onEmpty(data, env) }) /** * Returned Promise await the full sequence, * instead of just the parsing step. ...
[ "function", "stream", "(", "env", ")", "{", "let", "filter", "=", "parseFilter", "(", "env", ")", "filter", ".", "promise", ".", "then", "(", "data", "=>", "{", "env", ".", "logger", ".", "log", "(", "'Sass sources successfully parsed.'", ")", "env", "."...
Execute full SassDoc sequence from a Vinyl files stream. @return {Stream} @return {Promise} - as a property of Stream.
[ "Execute", "full", "SassDoc", "sequence", "from", "a", "Vinyl", "files", "stream", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L150-L188
train
SassDoc/sassdoc
src/sassdoc.js
stream
function stream (env) { let parseStream = parseFilter(env) let filter = through.obj((file, enc, cb) => cb(), function (cb) { parseStream.promise.then(data => { this.push(data) cb() }, cb) }) return pipe(parseStream, filter) }
javascript
function stream (env) { let parseStream = parseFilter(env) let filter = through.obj((file, enc, cb) => cb(), function (cb) { parseStream.promise.then(data => { this.push(data) cb() }, cb) }) return pipe(parseStream, filter) }
[ "function", "stream", "(", "env", ")", "{", "let", "parseStream", "=", "parseFilter", "(", "env", ")", "let", "filter", "=", "through", ".", "obj", "(", "(", "file", ",", "enc", ",", "cb", ")", "=>", "cb", "(", ")", ",", "function", "(", "cb", ")...
Don't pass files through, but pass final data at the end. @return {Stream}
[ "Don", "t", "pass", "files", "through", "but", "pass", "final", "data", "at", "the", "end", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L215-L226
train
SassDoc/sassdoc
src/sassdoc.js
baseDocumentize
async function baseDocumentize (env) { let filter = parseFilter(env) filter.promise .then(data => { env.logger.log(`Folder \`${env.src}\` successfully parsed.`) env.data = data onEmpty(data, env) env.logger.debug(() => { fs.writeFile( 'sassdoc-data.json', JS...
javascript
async function baseDocumentize (env) { let filter = parseFilter(env) filter.promise .then(data => { env.logger.log(`Folder \`${env.src}\` successfully parsed.`) env.data = data onEmpty(data, env) env.logger.debug(() => { fs.writeFile( 'sassdoc-data.json', JS...
[ "async", "function", "baseDocumentize", "(", "env", ")", "{", "let", "filter", "=", "parseFilter", "(", "env", ")", "filter", ".", "promise", ".", "then", "(", "data", "=>", "{", "env", ".", "logger", ".", "log", "(", "`", "\\`", "${", "env", ".", ...
Source directory fetching and parsing.
[ "Source", "directory", "fetching", "and", "parsing", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L232-L279
train
SassDoc/sassdoc
src/sassdoc.js
onEmpty
function onEmpty (data, env) { let message = `SassDoc could not find anything to document.\n * Are you still using \`/**\` comments ? They're no more supported since 2.0. See <http://sassdoc.com/upgrading/#c-style-comments>.\n` if (!data.length && env.verbose) { env.emit('warning', new errors.Warning(mes...
javascript
function onEmpty (data, env) { let message = `SassDoc could not find anything to document.\n * Are you still using \`/**\` comments ? They're no more supported since 2.0. See <http://sassdoc.com/upgrading/#c-style-comments>.\n` if (!data.length && env.verbose) { env.emit('warning', new errors.Warning(mes...
[ "function", "onEmpty", "(", "data", ",", "env", ")", "{", "let", "message", "=", "`", "\\n", "\\`", "\\`", "\\n", "`", "if", "(", "!", "data", ".", "length", "&&", "env", ".", "verbose", ")", "{", "env", ".", "emit", "(", "'warning'", ",", "new",...
Warn user on empty documentation. @param {Array} data @param {Object} env
[ "Warn", "user", "on", "empty", "documentation", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/sassdoc.js#L341-L349
train
SassDoc/sassdoc
src/cli.js
ensure
function ensure (env, options, names) { for (let k of Object.keys(names)) { let v = names[k] if (options[v]) { env[k] = options[v] env[k + 'Cwd'] = true } } }
javascript
function ensure (env, options, names) { for (let k of Object.keys(names)) { let v = names[k] if (options[v]) { env[k] = options[v] env[k + 'Cwd'] = true } } }
[ "function", "ensure", "(", "env", ",", "options", ",", "names", ")", "{", "for", "(", "let", "k", "of", "Object", ".", "keys", "(", "names", ")", ")", "{", "let", "v", "=", "names", "[", "k", "]", "if", "(", "options", "[", "v", "]", ")", "{"...
Ensure that CLI options take precedence over configuration values. For each name/option tuple, if the option is set, override configuration value.
[ "Ensure", "that", "CLI", "options", "take", "precedence", "over", "configuration", "values", "." ]
d34339d785e3a78cc1f61a98e268db49d61aa505
https://github.com/SassDoc/sassdoc/blob/d34339d785e3a78cc1f61a98e268db49d61aa505/src/cli.js#L94-L103
train
ruddell/ignite-jhipster
boilerplate/app/navigation/layouts.js
handleOpenURL
function handleOpenURL (event) { console.tron.log(event.url) let splitUrl = event.url.split('/') // ['https:', '', 'domain', 'route', 'params'] let importantParameters = splitUrl.splice(3) // ['route', 'params'] if (importantParameters.length === 0) { console.tron.log('Sending to home page') return null...
javascript
function handleOpenURL (event) { console.tron.log(event.url) let splitUrl = event.url.split('/') // ['https:', '', 'domain', 'route', 'params'] let importantParameters = splitUrl.splice(3) // ['route', 'params'] if (importantParameters.length === 0) { console.tron.log('Sending to home page') return null...
[ "function", "handleOpenURL", "(", "event", ")", "{", "console", ".", "tron", ".", "log", "(", "event", ".", "url", ")", "let", "splitUrl", "=", "event", ".", "url", ".", "split", "(", "'/'", ")", "// ['https:', '', 'domain', 'route', 'params']", "let", "impo...
for deep linking
[ "for", "deep", "linking" ]
301c3aa9e4286715b0f5ad6f32f516672ea8d09d
https://github.com/ruddell/ignite-jhipster/blob/301c3aa9e4286715b0f5ad6f32f516672ea8d09d/boilerplate/app/navigation/layouts.js#L83-L102
train
ruddell/ignite-jhipster
src/boilerplate/index.js
mergePackageJsons
async function mergePackageJsons () { // transform our package.json incase we need to replace variables const rawJson = await template.generate({ directory: `${ignite.ignitePluginPath()}/boilerplate`, template: 'package.json.ejs', props: props }) const newPackageJson = JSON.parse(rawJs...
javascript
async function mergePackageJsons () { // transform our package.json incase we need to replace variables const rawJson = await template.generate({ directory: `${ignite.ignitePluginPath()}/boilerplate`, template: 'package.json.ejs', props: props }) const newPackageJson = JSON.parse(rawJs...
[ "async", "function", "mergePackageJsons", "(", ")", "{", "// transform our package.json incase we need to replace variables", "const", "rawJson", "=", "await", "template", ".", "generate", "(", "{", "directory", ":", "`", "${", "ignite", ".", "ignitePluginPath", "(", ...
Merge the package.json from our template into the one provided from react-native init.
[ "Merge", "the", "package", ".", "json", "from", "our", "template", "into", "the", "one", "provided", "from", "react", "-", "native", "init", "." ]
301c3aa9e4286715b0f5ad6f32f516672ea8d09d
https://github.com/ruddell/ignite-jhipster/blob/301c3aa9e4286715b0f5ad6f32f516672ea8d09d/src/boilerplate/index.js#L144-L175
train
ruddell/ignite-jhipster
boilerplate/app/shared/websockets/websocket.service.js
subscribeToChat
function subscribeToChat () { console.tron.log('Subscribing to Chat') if (!subscriptions.hasOwnProperty('chat')) { subscriptions.chat = { subscribed: true } connection.then(() => { chatSubscriber = stompClient.subscribe('/topic/chat', onMessage.bind(this, 'chat')) }) } }
javascript
function subscribeToChat () { console.tron.log('Subscribing to Chat') if (!subscriptions.hasOwnProperty('chat')) { subscriptions.chat = { subscribed: true } connection.then(() => { chatSubscriber = stompClient.subscribe('/topic/chat', onMessage.bind(this, 'chat')) }) } }
[ "function", "subscribeToChat", "(", ")", "{", "console", ".", "tron", ".", "log", "(", "'Subscribing to Chat'", ")", "if", "(", "!", "subscriptions", ".", "hasOwnProperty", "(", "'chat'", ")", ")", "{", "subscriptions", ".", "chat", "=", "{", "subscribed", ...
methods for subscribing
[ "methods", "for", "subscribing" ]
301c3aa9e4286715b0f5ad6f32f516672ea8d09d
https://github.com/ruddell/ignite-jhipster/blob/301c3aa9e4286715b0f5ad6f32f516672ea8d09d/boilerplate/app/shared/websockets/websocket.service.js#L93-L101
train
ruddell/ignite-jhipster
boilerplate/app/shared/websockets/websocket.service.js
sendChat
function sendChat (ev) { if (stompClient !== null && stompClient.connected) { var p = '/topic/chat' stompClient.send(p, {}, JSON.stringify(ev)) } }
javascript
function sendChat (ev) { if (stompClient !== null && stompClient.connected) { var p = '/topic/chat' stompClient.send(p, {}, JSON.stringify(ev)) } }
[ "function", "sendChat", "(", "ev", ")", "{", "if", "(", "stompClient", "!==", "null", "&&", "stompClient", ".", "connected", ")", "{", "var", "p", "=", "'/topic/chat'", "stompClient", ".", "send", "(", "p", ",", "{", "}", ",", "JSON", ".", "stringify",...
methods for sending
[ "methods", "for", "sending" ]
301c3aa9e4286715b0f5ad6f32f516672ea8d09d
https://github.com/ruddell/ignite-jhipster/blob/301c3aa9e4286715b0f5ad6f32f516672ea8d09d/boilerplate/app/shared/websockets/websocket.service.js#L112-L117
train
ruddell/ignite-jhipster
boilerplate/app/shared/websockets/websocket.service.js
onMessage
function onMessage (subscription, fullMessage) { let msg = null try { msg = JSON.parse(fullMessage.body) } catch (fullMessage) { console.tron.error(`Error parsing : ${fullMessage}`) } if (msg) { return em({ subscription, msg }) } }
javascript
function onMessage (subscription, fullMessage) { let msg = null try { msg = JSON.parse(fullMessage.body) } catch (fullMessage) { console.tron.error(`Error parsing : ${fullMessage}`) } if (msg) { return em({ subscription, msg }) } }
[ "function", "onMessage", "(", "subscription", ",", "fullMessage", ")", "{", "let", "msg", "=", "null", "try", "{", "msg", "=", "JSON", ".", "parse", "(", "fullMessage", ".", "body", ")", "}", "catch", "(", "fullMessage", ")", "{", "console", ".", "tron...
when the message is received, send it to the WebsocketSaga
[ "when", "the", "message", "is", "received", "send", "it", "to", "the", "WebsocketSaga" ]
301c3aa9e4286715b0f5ad6f32f516672ea8d09d
https://github.com/ruddell/ignite-jhipster/blob/301c3aa9e4286715b0f5ad6f32f516672ea8d09d/boilerplate/app/shared/websockets/websocket.service.js#L120-L130
train
ruddell/ignite-jhipster
boilerplate/app/shared/websockets/websocket.service.js
generateInterval
function generateInterval (k) { let maxInterval = (Math.pow(2, k) - 1) * 1000 if (maxInterval > 30 * 1000) { // If the generated interval is more than 30 seconds, truncate it down to 30 seconds. maxInterval = 30 * 1000 } // generate the interval to a random number between 0 and the maxInterval determin...
javascript
function generateInterval (k) { let maxInterval = (Math.pow(2, k) - 1) * 1000 if (maxInterval > 30 * 1000) { // If the generated interval is more than 30 seconds, truncate it down to 30 seconds. maxInterval = 30 * 1000 } // generate the interval to a random number between 0 and the maxInterval determin...
[ "function", "generateInterval", "(", "k", ")", "{", "let", "maxInterval", "=", "(", "Math", ".", "pow", "(", "2", ",", "k", ")", "-", "1", ")", "*", "1000", "if", "(", "maxInterval", ">", "30", "*", "1000", ")", "{", "// If the generated interval is mo...
exponential backoff for reconnections
[ "exponential", "backoff", "for", "reconnections" ]
301c3aa9e4286715b0f5ad6f32f516672ea8d09d
https://github.com/ruddell/ignite-jhipster/blob/301c3aa9e4286715b0f5ad6f32f516672ea8d09d/boilerplate/app/shared/websockets/websocket.service.js#L164-L173
train
ztoben/assets-webpack-plugin
lib/pathTemplate.js
function (data) { return this.fields.reduce(function (output, field) { var replacement = '' var placeholder = field.placeholder var width = field.width if (field.prefix) { output += field.prefix } if (placeholder) { replacement = data[placeholder] || '' i...
javascript
function (data) { return this.fields.reduce(function (output, field) { var replacement = '' var placeholder = field.placeholder var width = field.width if (field.prefix) { output += field.prefix } if (placeholder) { replacement = data[placeholder] || '' i...
[ "function", "(", "data", ")", "{", "return", "this", ".", "fields", ".", "reduce", "(", "function", "(", "output", ",", "field", ")", "{", "var", "replacement", "=", "''", "var", "placeholder", "=", "field", ".", "placeholder", "var", "width", "=", "fi...
Applies data to this template and outputs a filename. @param Object data
[ "Applies", "data", "to", "this", "template", "and", "outputs", "a", "filename", "." ]
1a3239f3f7f01301154e51ba0a7ce6fd362a629a
https://github.com/ztoben/assets-webpack-plugin/blob/1a3239f3f7f01301154e51ba0a7ce6fd362a629a/lib/pathTemplate.js#L40-L59
train
IonicaBizau/medium-editor-markdown
dist/me-markdown.standalone.js
Rules
function Rules (options) { this.options = options; this._keep = []; this._remove = []; this.blankRule = { replacement: options.blankReplacement }; this.keepReplacement = options.keepReplacement; this.defaultRule = { replacement: options.defaultReplacement }; this.array = []; for (var key...
javascript
function Rules (options) { this.options = options; this._keep = []; this._remove = []; this.blankRule = { replacement: options.blankReplacement }; this.keepReplacement = options.keepReplacement; this.defaultRule = { replacement: options.defaultReplacement }; this.array = []; for (var key...
[ "function", "Rules", "(", "options", ")", "{", "this", ".", "options", "=", "options", ";", "this", ".", "_keep", "=", "[", "]", ";", "this", ".", "_remove", "=", "[", "]", ";", "this", ".", "blankRule", "=", "{", "replacement", ":", "options", "."...
Manages a collection of rules used to convert HTML to Markdown
[ "Manages", "a", "collection", "of", "rules", "used", "to", "convert", "HTML", "to", "Markdown" ]
e35601361d4708c8077199e58b8b09700c6bd059
https://github.com/IonicaBizau/medium-editor-markdown/blob/e35601361d4708c8077199e58b8b09700c6bd059/dist/me-markdown.standalone.js#L299-L316
train
IonicaBizau/medium-editor-markdown
dist/me-markdown.standalone.js
function (input) { if (!canConvert(input)) { throw new TypeError( input + ' is not a string, or an element/document/fragment node.' ) } if (input === '') return '' var output = process.call(this, new RootNode(input)); return postProcess.call(this, output) }
javascript
function (input) { if (!canConvert(input)) { throw new TypeError( input + ' is not a string, or an element/document/fragment node.' ) } if (input === '') return '' var output = process.call(this, new RootNode(input)); return postProcess.call(this, output) }
[ "function", "(", "input", ")", "{", "if", "(", "!", "canConvert", "(", "input", ")", ")", "{", "throw", "new", "TypeError", "(", "input", "+", "' is not a string, or an element/document/fragment node.'", ")", "}", "if", "(", "input", "===", "''", ")", "retur...
The entry point for converting a string or DOM node to Markdown @public @param {String|HTMLElement} input The string or DOM node to convert @returns A Markdown representation of the input @type String
[ "The", "entry", "point", "for", "converting", "a", "string", "or", "DOM", "node", "to", "Markdown" ]
e35601361d4708c8077199e58b8b09700c6bd059
https://github.com/IonicaBizau/medium-editor-markdown/blob/e35601361d4708c8077199e58b8b09700c6bd059/dist/me-markdown.standalone.js#L699-L710
train
IonicaBizau/medium-editor-markdown
dist/me-markdown.standalone.js
function (plugin) { if (Array.isArray(plugin)) { for (var i = 0; i < plugin.length; i++) this.use(plugin[i]); } else if (typeof plugin === 'function') { plugin(this); } else { throw new TypeError('plugin must be a Function or an Array of Functions') } return this }
javascript
function (plugin) { if (Array.isArray(plugin)) { for (var i = 0; i < plugin.length; i++) this.use(plugin[i]); } else if (typeof plugin === 'function') { plugin(this); } else { throw new TypeError('plugin must be a Function or an Array of Functions') } return this }
[ "function", "(", "plugin", ")", "{", "if", "(", "Array", ".", "isArray", "(", "plugin", ")", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "plugin", ".", "length", ";", "i", "++", ")", "this", ".", "use", "(", "plugin", "[", "i",...
Add one or more plugins @public @param {Function|Array} plugin The plugin or array of plugins to add @returns The Turndown instance for chaining @type Object
[ "Add", "one", "or", "more", "plugins" ]
e35601361d4708c8077199e58b8b09700c6bd059
https://github.com/IonicaBizau/medium-editor-markdown/blob/e35601361d4708c8077199e58b8b09700c6bd059/dist/me-markdown.standalone.js#L720-L729
train
IonicaBizau/medium-editor-markdown
dist/me-markdown.standalone.js
function (string) { return ( string // Escape backslash escapes! .replace(/\\(\S)/g, '\\\\$1') // Escape headings .replace(/^(#{1,6} )/gm, '\\$1') // Escape hr .replace(/^([-*_] *){3,}$/gm, function (match, character) { return match.split(character)....
javascript
function (string) { return ( string // Escape backslash escapes! .replace(/\\(\S)/g, '\\\\$1') // Escape headings .replace(/^(#{1,6} )/gm, '\\$1') // Escape hr .replace(/^([-*_] *){3,}$/gm, function (match, character) { return match.split(character)....
[ "function", "(", "string", ")", "{", "return", "(", "string", "// Escape backslash escapes!", ".", "replace", "(", "/", "\\\\(\\S)", "/", "g", ",", "'\\\\\\\\$1'", ")", "// Escape headings", ".", "replace", "(", "/", "^(#{1,6} )", "/", "gm", ",", "'\\\\$1'", ...
Escapes Markdown syntax @public @param {String} string The string to escape @returns A string with Markdown syntax escaped @type String
[ "Escapes", "Markdown", "syntax" ]
e35601361d4708c8077199e58b8b09700c6bd059
https://github.com/IonicaBizau/medium-editor-markdown/blob/e35601361d4708c8077199e58b8b09700c6bd059/dist/me-markdown.standalone.js#L779-L822
train
IonicaBizau/medium-editor-markdown
dist/me-markdown.standalone.js
process
function process (parentNode) { var self = this; return reduce.call(parentNode.childNodes, function (output, node) { node = new Node(node); var replacement = ''; if (node.nodeType === 3) { replacement = node.isCode ? node.nodeValue : self.escape(node.nodeValue); } else if (node.nodeType === 1...
javascript
function process (parentNode) { var self = this; return reduce.call(parentNode.childNodes, function (output, node) { node = new Node(node); var replacement = ''; if (node.nodeType === 3) { replacement = node.isCode ? node.nodeValue : self.escape(node.nodeValue); } else if (node.nodeType === 1...
[ "function", "process", "(", "parentNode", ")", "{", "var", "self", "=", "this", ";", "return", "reduce", ".", "call", "(", "parentNode", ".", "childNodes", ",", "function", "(", "output", ",", "node", ")", "{", "node", "=", "new", "Node", "(", "node", ...
Reduces a DOM node down to its Markdown string equivalent @private @param {HTMLElement} parentNode The node to convert @returns A Markdown representation of the node @type String
[ "Reduces", "a", "DOM", "node", "down", "to", "its", "Markdown", "string", "equivalent" ]
e35601361d4708c8077199e58b8b09700c6bd059
https://github.com/IonicaBizau/medium-editor-markdown/blob/e35601361d4708c8077199e58b8b09700c6bd059/dist/me-markdown.standalone.js#L833-L847
train
IonicaBizau/medium-editor-markdown
dist/me-markdown.standalone.js
postProcess
function postProcess (output) { var self = this; this.rules.forEach(function (rule) { if (typeof rule.append === 'function') { output = join(output, rule.append(self.options)); } }); return output.replace(/^[\t\r\n]+/, '').replace(/[\t\r\n\s]+$/, '') }
javascript
function postProcess (output) { var self = this; this.rules.forEach(function (rule) { if (typeof rule.append === 'function') { output = join(output, rule.append(self.options)); } }); return output.replace(/^[\t\r\n]+/, '').replace(/[\t\r\n\s]+$/, '') }
[ "function", "postProcess", "(", "output", ")", "{", "var", "self", "=", "this", ";", "this", ".", "rules", ".", "forEach", "(", "function", "(", "rule", ")", "{", "if", "(", "typeof", "rule", ".", "append", "===", "'function'", ")", "{", "output", "=...
Appends strings as each rule requires and trims the output @private @param {String} output The conversion output @returns A trimmed version of the ouput @type String
[ "Appends", "strings", "as", "each", "rule", "requires", "and", "trims", "the", "output" ]
e35601361d4708c8077199e58b8b09700c6bd059
https://github.com/IonicaBizau/medium-editor-markdown/blob/e35601361d4708c8077199e58b8b09700c6bd059/dist/me-markdown.standalone.js#L857-L866
train
wix/protractor-helpers
dist/protractor-helpers.js
function (matchedValue, expectedValue, currencySymbol, isFraction) { // get value with fraction expectedValue = getNumberWithCommas(expectedValue); if (isFraction === true && expectedValue.indexOf('.') === -1) { expectedValue += '.00'; } // add minus and symbol if needed var expression = '^'; if (matc...
javascript
function (matchedValue, expectedValue, currencySymbol, isFraction) { // get value with fraction expectedValue = getNumberWithCommas(expectedValue); if (isFraction === true && expectedValue.indexOf('.') === -1) { expectedValue += '.00'; } // add minus and symbol if needed var expression = '^'; if (matc...
[ "function", "(", "matchedValue", ",", "expectedValue", ",", "currencySymbol", ",", "isFraction", ")", "{", "// get value with fraction", "expectedValue", "=", "getNumberWithCommas", "(", "expectedValue", ")", ";", "if", "(", "isFraction", "===", "true", "&&", "expec...
Creates a regular expression to match money representation with or without spaces in between @param matchedValue - the number that is tested @param expectedValue - the number to match against @param currencySymbol[optional] {string} - the symbol to match against. if not specify - validate that there is no symbol. @para...
[ "Creates", "a", "regular", "expression", "to", "match", "money", "representation", "with", "or", "without", "spaces", "in", "between" ]
f496e47c38e4de2e847c300bfead6c9f17a52bcc
https://github.com/wix/protractor-helpers/blob/f496e47c38e4de2e847c300bfead6c9f17a52bcc/dist/protractor-helpers.js#L297-L314
train
hsluv/hsluv
website/generate-images.js
round
function round(num, places) { const n = Math.pow(10, places); return Math.round(num * n) / n; }
javascript
function round(num, places) { const n = Math.pow(10, places); return Math.round(num * n) / n; }
[ "function", "round", "(", "num", ",", "places", ")", "{", "const", "n", "=", "Math", ".", "pow", "(", "10", ",", "places", ")", ";", "return", "Math", ".", "round", "(", "num", "*", "n", ")", "/", "n", ";", "}" ]
Rounds number to a given number of decimal places
[ "Rounds", "number", "to", "a", "given", "number", "of", "decimal", "places" ]
ba6a9ee7d80eb669ba90de975902b0bf574fd045
https://github.com/hsluv/hsluv/blob/ba6a9ee7d80eb669ba90de975902b0bf574fd045/website/generate-images.js#L64-L67
train
bbecquet/Leaflet.PolylineDecorator
src/L.PolylineDecorator.js
function(patternDef, latLngs) { return { symbolFactory: patternDef.symbol, // Parse offset and repeat values, managing the two cases: // absolute (in pixels) or relative (in percentage of the polyline length) offset: parseRelativeOrAbsoluteValue(patternDef.offset)...
javascript
function(patternDef, latLngs) { return { symbolFactory: patternDef.symbol, // Parse offset and repeat values, managing the two cases: // absolute (in pixels) or relative (in percentage of the polyline length) offset: parseRelativeOrAbsoluteValue(patternDef.offset)...
[ "function", "(", "patternDef", ",", "latLngs", ")", "{", "return", "{", "symbolFactory", ":", "patternDef", ".", "symbol", ",", "// Parse offset and repeat values, managing the two cases:", "// absolute (in pixels) or relative (in percentage of the polyline length)", "offset", ":...
Parse the pattern definition
[ "Parse", "the", "pattern", "definition" ]
96858e837a07c08e08dbba1c6751abdec9a85433
https://github.com/bbecquet/Leaflet.PolylineDecorator/blob/96858e837a07c08e08dbba1c6751abdec9a85433/src/L.PolylineDecorator.js#L80-L89
train
bbecquet/Leaflet.PolylineDecorator
src/L.PolylineDecorator.js
function() { const allPathCoords = this._paths.reduce((acc, path) => acc.concat(path), []); return L.latLngBounds(allPathCoords); }
javascript
function() { const allPathCoords = this._paths.reduce((acc, path) => acc.concat(path), []); return L.latLngBounds(allPathCoords); }
[ "function", "(", ")", "{", "const", "allPathCoords", "=", "this", ".", "_paths", ".", "reduce", "(", "(", "acc", ",", "path", ")", "=>", "acc", ".", "concat", "(", "path", ")", ",", "[", "]", ")", ";", "return", "L", ".", "latLngBounds", "(", "al...
As real pattern bounds depends on map zoom and bounds, we just compute the total bounds of all paths decorated by this instance.
[ "As", "real", "pattern", "bounds", "depends", "on", "map", "zoom", "and", "bounds", "we", "just", "compute", "the", "total", "bounds", "of", "all", "paths", "decorated", "by", "this", "instance", "." ]
96858e837a07c08e08dbba1c6751abdec9a85433
https://github.com/bbecquet/Leaflet.PolylineDecorator/blob/96858e837a07c08e08dbba1c6751abdec9a85433/src/L.PolylineDecorator.js#L107-L110
train
bbecquet/Leaflet.PolylineDecorator
src/L.PolylineDecorator.js
function(latLngs, symbolFactory, directionPoints) { return directionPoints.map((directionPoint, i) => symbolFactory.buildSymbol(directionPoint, latLngs, this._map, i, directionPoints.length) ); }
javascript
function(latLngs, symbolFactory, directionPoints) { return directionPoints.map((directionPoint, i) => symbolFactory.buildSymbol(directionPoint, latLngs, this._map, i, directionPoints.length) ); }
[ "function", "(", "latLngs", ",", "symbolFactory", ",", "directionPoints", ")", "{", "return", "directionPoints", ".", "map", "(", "(", "directionPoint", ",", "i", ")", "=>", "symbolFactory", ".", "buildSymbol", "(", "directionPoint", ",", "latLngs", ",", "this...
Returns an array of ILayers object
[ "Returns", "an", "array", "of", "ILayers", "object" ]
96858e837a07c08e08dbba1c6751abdec9a85433
https://github.com/bbecquet/Leaflet.PolylineDecorator/blob/96858e837a07c08e08dbba1c6751abdec9a85433/src/L.PolylineDecorator.js#L119-L123
train
bbecquet/Leaflet.PolylineDecorator
src/L.PolylineDecorator.js
function(latLngs, pattern) { if (latLngs.length < 2) { return []; } const pathAsPoints = latLngs.map(latLng => this._map.project(latLng)); return projectPatternOnPointPath(pathAsPoints, pattern) .map(point => ({ latLng: this._map.unproject(L.point(...
javascript
function(latLngs, pattern) { if (latLngs.length < 2) { return []; } const pathAsPoints = latLngs.map(latLng => this._map.project(latLng)); return projectPatternOnPointPath(pathAsPoints, pattern) .map(point => ({ latLng: this._map.unproject(L.point(...
[ "function", "(", "latLngs", ",", "pattern", ")", "{", "if", "(", "latLngs", ".", "length", "<", "2", ")", "{", "return", "[", "]", ";", "}", "const", "pathAsPoints", "=", "latLngs", ".", "map", "(", "latLng", "=>", "this", ".", "_map", ".", "projec...
Compute pairs of LatLng and heading angle, that define positions and directions of the symbols on the path
[ "Compute", "pairs", "of", "LatLng", "and", "heading", "angle", "that", "define", "positions", "and", "directions", "of", "the", "symbols", "on", "the", "path" ]
96858e837a07c08e08dbba1c6751abdec9a85433
https://github.com/bbecquet/Leaflet.PolylineDecorator/blob/96858e837a07c08e08dbba1c6751abdec9a85433/src/L.PolylineDecorator.js#L129-L139
train
bbecquet/Leaflet.PolylineDecorator
src/L.PolylineDecorator.js
function(pattern) { const mapBounds = this._map.getBounds().pad(0.1); return this._paths.map(path => { const directionPoints = this._getDirectionPoints(path, pattern) // filter out invisible points .filter(point => mapBounds.contains(point.latLng)); ...
javascript
function(pattern) { const mapBounds = this._map.getBounds().pad(0.1); return this._paths.map(path => { const directionPoints = this._getDirectionPoints(path, pattern) // filter out invisible points .filter(point => mapBounds.contains(point.latLng)); ...
[ "function", "(", "pattern", ")", "{", "const", "mapBounds", "=", "this", ".", "_map", ".", "getBounds", "(", ")", ".", "pad", "(", "0.1", ")", ";", "return", "this", ".", "_paths", ".", "map", "(", "path", "=>", "{", "const", "directionPoints", "=", ...
Returns all symbols for a given pattern as an array of FeatureGroup
[ "Returns", "all", "symbols", "for", "a", "given", "pattern", "as", "an", "array", "of", "FeatureGroup" ]
96858e837a07c08e08dbba1c6751abdec9a85433
https://github.com/bbecquet/Leaflet.PolylineDecorator/blob/96858e837a07c08e08dbba1c6751abdec9a85433/src/L.PolylineDecorator.js#L152-L160
train
bbecquet/Leaflet.PolylineDecorator
src/L.PolylineDecorator.js
function () { this._patterns .map(pattern => this._getPatternLayers(pattern)) .forEach(layers => { this.addLayer(L.featureGroup(layers)); }); }
javascript
function () { this._patterns .map(pattern => this._getPatternLayers(pattern)) .forEach(layers => { this.addLayer(L.featureGroup(layers)); }); }
[ "function", "(", ")", "{", "this", ".", "_patterns", ".", "map", "(", "pattern", "=>", "this", ".", "_getPatternLayers", "(", "pattern", ")", ")", ".", "forEach", "(", "layers", "=>", "{", "this", ".", "addLayer", "(", "L", ".", "featureGroup", "(", ...
Draw all patterns
[ "Draw", "all", "patterns" ]
96858e837a07c08e08dbba1c6751abdec9a85433
https://github.com/bbecquet/Leaflet.PolylineDecorator/blob/96858e837a07c08e08dbba1c6751abdec9a85433/src/L.PolylineDecorator.js#L165-L169
train
AndiDittrich/NodeMCU-Tool
lib/cli/nodemcu-tool.js
getConnection
async function getConnection(){ // already connected ? if (_nodeMcuConnector.isConnected()){ return; } // create new connector try{ const msg = await _nodeMcuConnector.connect(_options.device, _options.baudrate, true, _options.connectionDelay); // status message _lo...
javascript
async function getConnection(){ // already connected ? if (_nodeMcuConnector.isConnected()){ return; } // create new connector try{ const msg = await _nodeMcuConnector.connect(_options.device, _options.baudrate, true, _options.connectionDelay); // status message _lo...
[ "async", "function", "getConnection", "(", ")", "{", "// already connected ?", "if", "(", "_nodeMcuConnector", ".", "isConnected", "(", ")", ")", "{", "return", ";", "}", "// create new connector", "try", "{", "const", "msg", "=", "await", "_nodeMcuConnector", "...
helper function to create a NodeMCU Tool Connection
[ "helper", "function", "to", "create", "a", "NodeMCU", "Tool", "Connection" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/cli/nodemcu-tool.js#L38-L56
train
AndiDittrich/NodeMCU-Tool
lib/cli/nodemcu-tool.js
fsinfo
async function fsinfo(format){ // try to establish a connection to the module await getConnection(); const {metadata, files} = await _nodeMcuConnector.fsinfo(); // json output - third party applications if (format == 'json') { writeOutput(JSON.stringify({ files: files, ...
javascript
async function fsinfo(format){ // try to establish a connection to the module await getConnection(); const {metadata, files} = await _nodeMcuConnector.fsinfo(); // json output - third party applications if (format == 'json') { writeOutput(JSON.stringify({ files: files, ...
[ "async", "function", "fsinfo", "(", "format", ")", "{", "// try to establish a connection to the module", "await", "getConnection", "(", ")", ";", "const", "{", "metadata", ",", "files", "}", "=", "await", "_nodeMcuConnector", ".", "fsinfo", "(", ")", ";", "// j...
show file-system info
[ "show", "file", "-", "system", "info" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/cli/nodemcu-tool.js#L63-L99
train
AndiDittrich/NodeMCU-Tool
lib/cli/nodemcu-tool.js
upload
async function upload(localFiles, options, onProgess){ // the index of the current uploaded file let fileUploadIndex = 0; async function uploadFile(localFile, remoteFilename){ // increment upload index fileUploadIndex++; // get file stats try{ const stats = aw...
javascript
async function upload(localFiles, options, onProgess){ // the index of the current uploaded file let fileUploadIndex = 0; async function uploadFile(localFile, remoteFilename){ // increment upload index fileUploadIndex++; // get file stats try{ const stats = aw...
[ "async", "function", "upload", "(", "localFiles", ",", "options", ",", "onProgess", ")", "{", "// the index of the current uploaded file", "let", "fileUploadIndex", "=", "0", ";", "async", "function", "uploadFile", "(", "localFile", ",", "remoteFilename", ")", "{", ...
upload a local file to nodemcu
[ "upload", "a", "local", "file", "to", "nodemcu" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/cli/nodemcu-tool.js#L117-L213
train
AndiDittrich/NodeMCU-Tool
lib/cli/nodemcu-tool.js
download
async function download(remoteFile){ // strip path let localFilename = _path.basename(remoteFile); // local file with same name already available ? if (await _fs.exists(remoteFile)){ // change filename localFilename += '.' + (new Date().getTime()); _logger.log('Local file "' + ...
javascript
async function download(remoteFile){ // strip path let localFilename = _path.basename(remoteFile); // local file with same name already available ? if (await _fs.exists(remoteFile)){ // change filename localFilename += '.' + (new Date().getTime()); _logger.log('Local file "' + ...
[ "async", "function", "download", "(", "remoteFile", ")", "{", "// strip path", "let", "localFilename", "=", "_path", ".", "basename", "(", "remoteFile", ")", ";", "// local file with same name already available ?", "if", "(", "await", "_fs", ".", "exists", "(", "r...
download a remote file from nodemcu
[ "download", "a", "remote", "file", "from", "nodemcu" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/cli/nodemcu-tool.js#L216-L253
train
AndiDittrich/NodeMCU-Tool
lib/cli/nodemcu-tool.js
remove
async function remove(filename){ // try to establish a connection to the module await getConnection(); // remove the file await _nodeMcuConnector.remove(filename); // just show complete message (no feedback from nodemcu) _mculogger.log('File "' + filename + '" removed!'); }
javascript
async function remove(filename){ // try to establish a connection to the module await getConnection(); // remove the file await _nodeMcuConnector.remove(filename); // just show complete message (no feedback from nodemcu) _mculogger.log('File "' + filename + '" removed!'); }
[ "async", "function", "remove", "(", "filename", ")", "{", "// try to establish a connection to the module", "await", "getConnection", "(", ")", ";", "// remove the file", "await", "_nodeMcuConnector", ".", "remove", "(", "filename", ")", ";", "// just show complete messag...
removes a file from NodeMCU
[ "removes", "a", "file", "from", "NodeMCU" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/cli/nodemcu-tool.js#L256-L266
train
AndiDittrich/NodeMCU-Tool
lib/cli/nodemcu-tool.js
mkfs
async function mkfs(){ // try to establish a connection to the module await getConnection(); _mculogger.log('Formatting the file system...this will take around ~30s'); try{ const response = await _nodeMcuConnector.format(); // just show complete message _mculogger.log('File S...
javascript
async function mkfs(){ // try to establish a connection to the module await getConnection(); _mculogger.log('Formatting the file system...this will take around ~30s'); try{ const response = await _nodeMcuConnector.format(); // just show complete message _mculogger.log('File S...
[ "async", "function", "mkfs", "(", ")", "{", "// try to establish a connection to the module", "await", "getConnection", "(", ")", ";", "_mculogger", ".", "log", "(", "'Formatting the file system...this will take around ~30s'", ")", ";", "try", "{", "const", "response", ...
format the file system
[ "format", "the", "file", "system" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/cli/nodemcu-tool.js#L269-L285
train
AndiDittrich/NodeMCU-Tool
lib/cli/nodemcu-tool.js
devices
async function devices(showAll, jsonOutput){ try{ const serialDevices = await _nodeMcuConnector.listDevices(showAll); if (jsonOutput){ writeOutput(JSON.stringify(serialDevices)); }else{ // just show complete message if (serialDevices.length == 0){ ...
javascript
async function devices(showAll, jsonOutput){ try{ const serialDevices = await _nodeMcuConnector.listDevices(showAll); if (jsonOutput){ writeOutput(JSON.stringify(serialDevices)); }else{ // just show complete message if (serialDevices.length == 0){ ...
[ "async", "function", "devices", "(", "showAll", ",", "jsonOutput", ")", "{", "try", "{", "const", "serialDevices", "=", "await", "_nodeMcuConnector", ".", "listDevices", "(", "showAll", ")", ";", "if", "(", "jsonOutput", ")", "{", "writeOutput", "(", "JSON",...
show serial devices connected to the system
[ "show", "serial", "devices", "connected", "to", "the", "system" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/cli/nodemcu-tool.js#L321-L346
train
AndiDittrich/NodeMCU-Tool
lib/cli/nodemcu-tool.js
function(opt){ // merge with default options Object.keys(_options).forEach(function(key){ _options[key] = opt[key] || _options[key]; }); }
javascript
function(opt){ // merge with default options Object.keys(_options).forEach(function(key){ _options[key] = opt[key] || _options[key]; }); }
[ "function", "(", "opt", ")", "{", "// merge with default options", "Object", ".", "keys", "(", "_options", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "_options", "[", "key", "]", "=", "opt", "[", "key", "]", "||", "_options", "[", "key...
set connector options
[ "set", "connector", "options" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/cli/nodemcu-tool.js#L359-L364
train
AndiDittrich/NodeMCU-Tool
lib/lua/command-builder.js
luaPrepare
function luaPrepare(commandName, args){ // get command by name let command = _esp8266_commands[commandName] || null; // valid command name provided ? if (command == null){ return null; } // replace all placeholders with given args args.forEach(function(arg){ // simple escap...
javascript
function luaPrepare(commandName, args){ // get command by name let command = _esp8266_commands[commandName] || null; // valid command name provided ? if (command == null){ return null; } // replace all placeholders with given args args.forEach(function(arg){ // simple escap...
[ "function", "luaPrepare", "(", "commandName", ",", "args", ")", "{", "// get command by name", "let", "command", "=", "_esp8266_commands", "[", "commandName", "]", "||", "null", ";", "// valid command name provided ?", "if", "(", "command", "==", "null", ")", "{",...
prepare command be escaping args
[ "prepare", "command", "be", "escaping", "args" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/lua/command-builder.js#L4-L23
train
AndiDittrich/NodeMCU-Tool
lib/cli/prompt.js
prompt
function prompt(menu){ return new Promise(function(resolve, reject){ // user confirmation required! _prompt.start(); _prompt.message = ''; _prompt.delimiter = ''; _prompt.colors = false; _prompt.get(menu, function (err, result){ if (err){ ...
javascript
function prompt(menu){ return new Promise(function(resolve, reject){ // user confirmation required! _prompt.start(); _prompt.message = ''; _prompt.delimiter = ''; _prompt.colors = false; _prompt.get(menu, function (err, result){ if (err){ ...
[ "function", "prompt", "(", "menu", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "// user confirmation required!", "_prompt", ".", "start", "(", ")", ";", "_prompt", ".", "message", "=", "''", ";", "_prompt...
async prompt wrapper
[ "async", "prompt", "wrapper" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/cli/prompt.js#L4-L22
train
AndiDittrich/NodeMCU-Tool
lib/connector/device-info.js
fetchDeviceInfo
async function fetchDeviceInfo(){ // run the node.info() command let {response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command.nodeInfo); // replace whitespaces with single delimiter const p = response.replace(/\s+/gi, '-').split('-'); // 8 elements found ? nodemcu on esp8266 ...
javascript
async function fetchDeviceInfo(){ // run the node.info() command let {response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command.nodeInfo); // replace whitespaces with single delimiter const p = response.replace(/\s+/gi, '-').split('-'); // 8 elements found ? nodemcu on esp8266 ...
[ "async", "function", "fetchDeviceInfo", "(", ")", "{", "// run the node.info() command", "let", "{", "response", "}", "=", "await", "_virtualTerminal", ".", "executeCommand", "(", "_luaCommandBuilder", ".", "command", ".", "nodeInfo", ")", ";", "// replace whitespaces...
fetch nodemcu device info
[ "fetch", "nodemcu", "device", "info" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/connector/device-info.js#L6-L52
train
AndiDittrich/NodeMCU-Tool
lib/connector/fsinfo.js
fsinfo
async function fsinfo(){ // get file system info (size) let {response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command.fsInfo); // extract size (remaining, used, total) response = response.replace(/\s+/gi, '-').split('-'); const meta = { remaining: toKB(response[0]), ...
javascript
async function fsinfo(){ // get file system info (size) let {response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command.fsInfo); // extract size (remaining, used, total) response = response.replace(/\s+/gi, '-').split('-'); const meta = { remaining: toKB(response[0]), ...
[ "async", "function", "fsinfo", "(", ")", "{", "// get file system info (size)", "let", "{", "response", "}", "=", "await", "_virtualTerminal", ".", "executeCommand", "(", "_luaCommandBuilder", ".", "command", ".", "fsInfo", ")", ";", "// extract size (remaining, used,...
show filesystem information
[ "show", "filesystem", "information" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/connector/fsinfo.js#L9-L51
train
AndiDittrich/NodeMCU-Tool
lib/connector/format.js
format
async function format(){ // create new filesystem const {response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command.fsFormat); return response; }
javascript
async function format(){ // create new filesystem const {response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command.fsFormat); return response; }
[ "async", "function", "format", "(", ")", "{", "// create new filesystem", "const", "{", "response", "}", "=", "await", "_virtualTerminal", ".", "executeCommand", "(", "_luaCommandBuilder", ".", "command", ".", "fsFormat", ")", ";", "return", "response", ";", "}"...
format the filesystem
[ "format", "the", "filesystem" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/connector/format.js#L5-L10
train
AndiDittrich/NodeMCU-Tool
lib/connector/compile.js
compile
async function compile(remoteName){ // run the lua compiler/interpreter to cache the file as bytecode const {response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.prepare('compile', [remoteName])); return response; }
javascript
async function compile(remoteName){ // run the lua compiler/interpreter to cache the file as bytecode const {response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.prepare('compile', [remoteName])); return response; }
[ "async", "function", "compile", "(", "remoteName", ")", "{", "// run the lua compiler/interpreter to cache the file as bytecode", "const", "{", "response", "}", "=", "await", "_virtualTerminal", ".", "executeCommand", "(", "_luaCommandBuilder", ".", "prepare", "(", "'comp...
compile a remote file
[ "compile", "a", "remote", "file" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/connector/compile.js#L5-L10
train
AndiDittrich/NodeMCU-Tool
lib/transport/scriptable-serial-terminal.js
onData
function onData(rawData){ // strip delimiter sequence from array const input = rawData.toString(_encoding); // response data object - default no response data const data = { echo: input, response: null }; // response found ? split echo and respo...
javascript
function onData(rawData){ // strip delimiter sequence from array const input = rawData.toString(_encoding); // response data object - default no response data const data = { echo: input, response: null }; // response found ? split echo and respo...
[ "function", "onData", "(", "rawData", ")", "{", "// strip delimiter sequence from array", "const", "input", "=", "rawData", ".", "toString", "(", "_encoding", ")", ";", "// response data object - default no response data", "const", "data", "=", "{", "echo", ":", "inpu...
listen on incoming data
[ "listen", "on", "incoming", "data" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/transport/scriptable-serial-terminal.js#L33-L59
train
AndiDittrich/NodeMCU-Tool
lib/transport/scriptable-serial-terminal.js
getNextResponse
function getNextResponse(){ if (_waitingForInput !== null){ throw new Error('concurreny error - receive listener already in-queue'); } return new Promise(function(resolve){ // data received ? if (_inputbuffer.length > 0){ resolve(_inputbuffer.shift()); }else{ ...
javascript
function getNextResponse(){ if (_waitingForInput !== null){ throw new Error('concurreny error - receive listener already in-queue'); } return new Promise(function(resolve){ // data received ? if (_inputbuffer.length > 0){ resolve(_inputbuffer.shift()); }else{ ...
[ "function", "getNextResponse", "(", ")", "{", "if", "(", "_waitingForInput", "!==", "null", ")", "{", "throw", "new", "Error", "(", "'concurreny error - receive listener already in-queue'", ")", ";", "}", "return", "new", "Promise", "(", "function", "(", "resolve"...
wait for next echo + response line
[ "wait", "for", "next", "echo", "+", "response", "line" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/transport/scriptable-serial-terminal.js#L71-L85
train
AndiDittrich/NodeMCU-Tool
lib/transport/scriptable-serial-terminal.js
write
async function write(data){ await _serialport.write(data); await _serialport.drain(); }
javascript
async function write(data){ await _serialport.write(data); await _serialport.drain(); }
[ "async", "function", "write", "(", "data", ")", "{", "await", "_serialport", ".", "write", "(", "data", ")", ";", "await", "_serialport", ".", "drain", "(", ")", ";", "}" ]
write data to serial port and wait for transmission complete
[ "write", "data", "to", "serial", "port", "and", "wait", "for", "transmission", "complete" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/transport/scriptable-serial-terminal.js#L88-L91
train
AndiDittrich/NodeMCU-Tool
lib/connector/upload.js
startTransfer
async function startTransfer(rawContent, localName, remoteName, progressCb){ // convert buffer to hex or base64 const content = rawContent.toString(_transferEncoding); // get absolute filesize const absoluteFilesize = content.length; // split file content into chunks const chunks = content.mat...
javascript
async function startTransfer(rawContent, localName, remoteName, progressCb){ // convert buffer to hex or base64 const content = rawContent.toString(_transferEncoding); // get absolute filesize const absoluteFilesize = content.length; // split file content into chunks const chunks = content.mat...
[ "async", "function", "startTransfer", "(", "rawContent", ",", "localName", ",", "remoteName", ",", "progressCb", ")", "{", "// convert buffer to hex or base64", "const", "content", "=", "rawContent", ".", "toString", "(", "_transferEncoding", ")", ";", "// get absolut...
utility function to handle the file transfer
[ "utility", "function", "to", "handle", "the", "file", "transfer" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/connector/upload.js#L13-L84
train
AndiDittrich/NodeMCU-Tool
lib/connector/upload.js
writeChunk
async function writeChunk(){ if (chunks.length > 0){ // get first element const l = chunks.shift(); // increment size counter currentUploadSize += l.length; // write first element to file try{ await _virtualTerminal.execut...
javascript
async function writeChunk(){ if (chunks.length > 0){ // get first element const l = chunks.shift(); // increment size counter currentUploadSize += l.length; // write first element to file try{ await _virtualTerminal.execut...
[ "async", "function", "writeChunk", "(", ")", "{", "if", "(", "chunks", ".", "length", ">", "0", ")", "{", "// get first element", "const", "l", "=", "chunks", ".", "shift", "(", ")", ";", "// increment size counter", "currentUploadSize", "+=", "l", ".", "l...
internal helper to write chunks
[ "internal", "helper", "to", "write", "chunks" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/connector/upload.js#L46-L80
train
AndiDittrich/NodeMCU-Tool
lib/connector/upload.js
requireTransferHelper
async function requireTransferHelper(){ // hex write helper already uploaded within current session ? // otherwise upload helper if (_isTransferWriteHelperUploaded !== true){ let response = null; try{ ({response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command...
javascript
async function requireTransferHelper(){ // hex write helper already uploaded within current session ? // otherwise upload helper if (_isTransferWriteHelperUploaded !== true){ let response = null; try{ ({response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command...
[ "async", "function", "requireTransferHelper", "(", ")", "{", "// hex write helper already uploaded within current session ?", "// otherwise upload helper", "if", "(", "_isTransferWriteHelperUploaded", "!==", "true", ")", "{", "let", "response", "=", "null", ";", "try", "{",...
utility function to upload file transfer helper
[ "utility", "function", "to", "upload", "file", "transfer", "helper" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/connector/upload.js#L87-L116
train
AndiDittrich/NodeMCU-Tool
lib/transport/serial-terminal.js
passthrough
function passthrough(devicename, baudrate, initialCommand=null){ return new Promise(function(resolve, reject){ // try to open the serial port const _device = new _serialport(devicename, { baudRate: parseInt(baudrate), autoOpen: false }); // new length parse...
javascript
function passthrough(devicename, baudrate, initialCommand=null){ return new Promise(function(resolve, reject){ // try to open the serial port const _device = new _serialport(devicename, { baudRate: parseInt(baudrate), autoOpen: false }); // new length parse...
[ "function", "passthrough", "(", "devicename", ",", "baudrate", ",", "initialCommand", "=", "null", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "// try to open the serial port", "const", "_device", "=", "new", ...
serial connection to stdout;stdin
[ "serial", "connection", "to", "stdout", ";", "stdin" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/transport/serial-terminal.js#L5-L62
train
AndiDittrich/NodeMCU-Tool
bin/nodemcu-tool.js
asyncWrapper
function asyncWrapper(promise){ return function(...args){ // extract options (last argument) _optionsManager.parse(args.pop()) // trigger command .then(options => { // re-merge return promise(...args, options) }) // tr...
javascript
function asyncWrapper(promise){ return function(...args){ // extract options (last argument) _optionsManager.parse(args.pop()) // trigger command .then(options => { // re-merge return promise(...args, options) }) // tr...
[ "function", "asyncWrapper", "(", "promise", ")", "{", "return", "function", "(", "...", "args", ")", "{", "// extract options (last argument)", "_optionsManager", ".", "parse", "(", "args", ".", "pop", "(", ")", ")", "// trigger command", ".", "then", "(", "op...
wrap async tasks
[ "wrap", "async", "tasks" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/bin/nodemcu-tool.js#L25-L57
train
AndiDittrich/NodeMCU-Tool
lib/connector/check-connection.js
checkConnection
function checkConnection(){ return new Promise(function(resolve, reject){ // 1.5s connection timeout const watchdog = setTimeout(function(){ // throw error reject(new Error('Timeout, no response detected - is NodeMCU online and the Lua interpreter ready ?')); }, 150...
javascript
function checkConnection(){ return new Promise(function(resolve, reject){ // 1.5s connection timeout const watchdog = setTimeout(function(){ // throw error reject(new Error('Timeout, no response detected - is NodeMCU online and the Lua interpreter ready ?')); }, 150...
[ "function", "checkConnection", "(", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "// 1.5s connection timeout", "const", "watchdog", "=", "setTimeout", "(", "function", "(", ")", "{", "// throw error", "reject", ...
checks the node-mcu connection
[ "checks", "the", "node", "-", "mcu", "connection" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/connector/check-connection.js#L6-L34
train
AndiDittrich/NodeMCU-Tool
lib/connector/download.js
download
async function download(remoteName){ let response = null; let data = null; // transfer helper function to encode hex data try{ ({response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command.transferReadHelper)); }catch(e){ _logger.debug(e); throw new Error('...
javascript
async function download(remoteName){ let response = null; let data = null; // transfer helper function to encode hex data try{ ({response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.command.transferReadHelper)); }catch(e){ _logger.debug(e); throw new Error('...
[ "async", "function", "download", "(", "remoteName", ")", "{", "let", "response", "=", "null", ";", "let", "data", "=", "null", ";", "// transfer helper function to encode hex data", "try", "{", "(", "{", "response", "}", "=", "await", "_virtualTerminal", ".", ...
download a file from NodeMCU
[ "download", "a", "file", "from", "NodeMCU" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/connector/download.js#L6-L51
train
AndiDittrich/NodeMCU-Tool
lib/connector/list-devices.js
listDevices
async function listDevices(showAll){ // get all available serial ports const ports = (await _serialport.list()) || []; // just pass-through if (showAll){ return ports; // filter by vendorIDs }else{ return ports.filter(function(item){ // return knownVendo...
javascript
async function listDevices(showAll){ // get all available serial ports const ports = (await _serialport.list()) || []; // just pass-through if (showAll){ return ports; // filter by vendorIDs }else{ return ports.filter(function(item){ // return knownVendo...
[ "async", "function", "listDevices", "(", "showAll", ")", "{", "// get all available serial ports", "const", "ports", "=", "(", "await", "_serialport", ".", "list", "(", ")", ")", "||", "[", "]", ";", "// just pass-through", "if", "(", "showAll", ")", "{", "r...
show connected serial devices
[ "show", "connected", "serial", "devices" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/connector/list-devices.js#L16-L30
train
AndiDittrich/NodeMCU-Tool
lib/cli/options-manager.js
mergeOptions
function mergeOptions(...opt){ // extract default (last argument) const result = opt.pop(); // try to find first match while (opt.length > 0){ // extract first argument (priority) const o = opt.shift(); // value set ? if (typeof o !== 'un...
javascript
function mergeOptions(...opt){ // extract default (last argument) const result = opt.pop(); // try to find first match while (opt.length > 0){ // extract first argument (priority) const o = opt.shift(); // value set ? if (typeof o !== 'un...
[ "function", "mergeOptions", "(", "...", "opt", ")", "{", "// extract default (last argument)", "const", "result", "=", "opt", ".", "pop", "(", ")", ";", "// try to find first match", "while", "(", "opt", ".", "length", ">", "0", ")", "{", "// extract first argum...
utility function to merge different options cli args take presendence over config
[ "utility", "function", "to", "merge", "different", "options", "cli", "args", "take", "presendence", "over", "config" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/cli/options-manager.js#L54-L70
train
AndiDittrich/NodeMCU-Tool
lib/cli/options-manager.js
storeOptions
async function storeOptions(options){ await _fs.writeFile(_configFilename, JSON.stringify(options, null, 4)); }
javascript
async function storeOptions(options){ await _fs.writeFile(_configFilename, JSON.stringify(options, null, 4)); }
[ "async", "function", "storeOptions", "(", "options", ")", "{", "await", "_fs", ".", "writeFile", "(", "_configFilename", ",", "JSON", ".", "stringify", "(", "options", ",", "null", ",", "4", ")", ")", ";", "}" ]
write options to file
[ "write", "options", "to", "file" ]
93670a062d38dd65e868295b0b071be503714b7c
https://github.com/AndiDittrich/NodeMCU-Tool/blob/93670a062d38dd65e868295b0b071be503714b7c/lib/cli/options-manager.js#L107-L109
train
Diokuz/baron
src/autoUpdate.js
startWatch
function startWatch() { if (watcher) return watcher = setInterval(function() { if (self.root[self.origin.offset]) { stopWatch() self.update() } }, 300) // is it good enought for you?) }
javascript
function startWatch() { if (watcher) return watcher = setInterval(function() { if (self.root[self.origin.offset]) { stopWatch() self.update() } }, 300) // is it good enought for you?) }
[ "function", "startWatch", "(", ")", "{", "if", "(", "watcher", ")", "return", "watcher", "=", "setInterval", "(", "function", "(", ")", "{", "if", "(", "self", ".", "root", "[", "self", ".", "origin", ".", "offset", "]", ")", "{", "stopWatch", "(", ...
Set interval timeout for watching when root node will be visible
[ "Set", "interval", "timeout", "for", "watching", "when", "root", "node", "will", "be", "visible" ]
2403ec98582c624da7671fff6c44b864a64caf5f
https://github.com/Diokuz/baron/blob/2403ec98582c624da7671fff6c44b864a64caf5f/src/autoUpdate.js#L22-L31
train
Diokuz/baron
src/core.js
baron
function baron(user) { var withParams = !!user var tryNode = (user && user[0]) || user var isNode = typeof user == 'string' || tryNode instanceof HTMLElement var params = isNode ? { root: user } : clone(user) var jQueryMode var rootNode var defaultParams = { direction: 'v', b...
javascript
function baron(user) { var withParams = !!user var tryNode = (user && user[0]) || user var isNode = typeof user == 'string' || tryNode instanceof HTMLElement var params = isNode ? { root: user } : clone(user) var jQueryMode var rootNode var defaultParams = { direction: 'v', b...
[ "function", "baron", "(", "user", ")", "{", "var", "withParams", "=", "!", "!", "user", "var", "tryNode", "=", "(", "user", "&&", "user", "[", "0", "]", ")", "||", "user", "var", "isNode", "=", "typeof", "user", "==", "'string'", "||", "tryNode", "...
window.baron and jQuery.fn.baron points to this function
[ "window", ".", "baron", "and", "jQuery", ".", "fn", ".", "baron", "points", "to", "this", "function" ]
2403ec98582c624da7671fff6c44b864a64caf5f
https://github.com/Diokuz/baron/blob/2403ec98582c624da7671fff6c44b864a64caf5f/src/core.js#L61-L160
train
Diokuz/baron
src/core.js
manageAttr
function manageAttr(node, direction, mode, id) { var attrName = 'data-baron-' + direction + '-id' if (mode == 'on') { node.setAttribute(attrName, id) } else if (mode == 'off') { node.removeAttribute(attrName) } return node.getAttribute(attrName) }
javascript
function manageAttr(node, direction, mode, id) { var attrName = 'data-baron-' + direction + '-id' if (mode == 'on') { node.setAttribute(attrName, id) } else if (mode == 'off') { node.removeAttribute(attrName) } return node.getAttribute(attrName) }
[ "function", "manageAttr", "(", "node", ",", "direction", ",", "mode", ",", "id", ")", "{", "var", "attrName", "=", "'data-baron-'", "+", "direction", "+", "'-id'", "if", "(", "mode", "==", "'on'", ")", "{", "node", ".", "setAttribute", "(", "attrName", ...
set, remove or read baron-specific id-attribute @returns {String|null} - id node value, or null, if there is no attr
[ "set", "remove", "or", "read", "baron", "-", "specific", "id", "-", "attribute" ]
2403ec98582c624da7671fff6c44b864a64caf5f
https://github.com/Diokuz/baron/blob/2403ec98582c624da7671fff6c44b864a64caf5f/src/core.js#L326-L336
train
Diokuz/baron
src/core.js
function(func, wait) { var self = this, timeout, // args, // right now there is no need for arguments // context, // and for context timestamp // result // and for result var later = function() { if (self._disposed) { ...
javascript
function(func, wait) { var self = this, timeout, // args, // right now there is no need for arguments // context, // and for context timestamp // result // and for result var later = function() { if (self._disposed) { ...
[ "function", "(", "func", ",", "wait", ")", "{", "var", "self", "=", "this", ",", "timeout", ",", "// args, // right now there is no need for arguments", "// context, // and for context", "timestamp", "// result // and for result", "var", "later", "=", "function", "(", "...
underscore.js realization used in autoUpdate plugin
[ "underscore", ".", "js", "realization", "used", "in", "autoUpdate", "plugin" ]
2403ec98582c624da7671fff6c44b864a64caf5f
https://github.com/Diokuz/baron/blob/2403ec98582c624da7671fff6c44b864a64caf5f/src/core.js#L385-L423
train
Diokuz/baron
src/core.js
setBarSize
function setBarSize(_size) { var barMinSize = this.barMinSize || 20 var size = _size if (size > 0 && size < barMinSize) { size = barMinSize } if (this.bar) { css(this.bar, this.origin.size, parseInt(size, 10) + 'px') ...
javascript
function setBarSize(_size) { var barMinSize = this.barMinSize || 20 var size = _size if (size > 0 && size < barMinSize) { size = barMinSize } if (this.bar) { css(this.bar, this.origin.size, parseInt(size, 10) + 'px') ...
[ "function", "setBarSize", "(", "_size", ")", "{", "var", "barMinSize", "=", "this", ".", "barMinSize", "||", "20", "var", "size", "=", "_size", "if", "(", "size", ">", "0", "&&", "size", "<", "barMinSize", ")", "{", "size", "=", "barMinSize", "}", "i...
Updating height or width of bar
[ "Updating", "height", "or", "width", "of", "bar" ]
2403ec98582c624da7671fff6c44b864a64caf5f
https://github.com/Diokuz/baron/blob/2403ec98582c624da7671fff6c44b864a64caf5f/src/core.js#L472-L483
train
Diokuz/baron
src/core.js
posBar
function posBar(_pos) { if (this.bar) { var was = css(this.bar, this.origin.pos), will = +_pos + 'px' if (will && will != was) { css(this.bar, this.origin.pos, will) } } }
javascript
function posBar(_pos) { if (this.bar) { var was = css(this.bar, this.origin.pos), will = +_pos + 'px' if (will && will != was) { css(this.bar, this.origin.pos, will) } } }
[ "function", "posBar", "(", "_pos", ")", "{", "if", "(", "this", ".", "bar", ")", "{", "var", "was", "=", "css", "(", "this", ".", "bar", ",", "this", ".", "origin", ".", "pos", ")", ",", "will", "=", "+", "_pos", "+", "'px'", "if", "(", "will...
Updating top or left bar position
[ "Updating", "top", "or", "left", "bar", "position" ]
2403ec98582c624da7671fff6c44b864a64caf5f
https://github.com/Diokuz/baron/blob/2403ec98582c624da7671fff6c44b864a64caf5f/src/core.js#L486-L495
train
Diokuz/baron
src/core.js
function(params) { if (process.env.NODE_ENV !== 'production') { if (this._disposed) { log('error', [ 'Update on disposed baron instance detected.', 'You should clear your stored baron value for this instance:', this ...
javascript
function(params) { if (process.env.NODE_ENV !== 'production') { if (this._disposed) { log('error', [ 'Update on disposed baron instance detected.', 'You should clear your stored baron value for this instance:', this ...
[ "function", "(", "params", ")", "{", "if", "(", "process", ".", "env", ".", "NODE_ENV", "!==", "'production'", ")", "{", "if", "(", "this", ".", "_disposed", ")", "{", "log", "(", "'error'", ",", "[", "'Update on disposed baron instance detected.'", ",", "...
fires on any update and on init
[ "fires", "on", "any", "update", "and", "on", "init" ]
2403ec98582c624da7671fff6c44b864a64caf5f
https://github.com/Diokuz/baron/blob/2403ec98582c624da7671fff6c44b864a64caf5f/src/core.js#L790-L807
train
HelloFax/hellosign-nodejs-sdk
lib/HelloSignResource.js
HelloSignResource
function HelloSignResource(hellosign, urlData) { this._hellosign = hellosign; this._urlData = urlData || {}; this.basePath = utils.makeURLInterpolator(hellosign.getApiField('basePath')); this.path = utils.makeURLInterpolator(this.path); if (this.includeBasic) { this.includeBasic.forEach(f...
javascript
function HelloSignResource(hellosign, urlData) { this._hellosign = hellosign; this._urlData = urlData || {}; this.basePath = utils.makeURLInterpolator(hellosign.getApiField('basePath')); this.path = utils.makeURLInterpolator(this.path); if (this.includeBasic) { this.includeBasic.forEach(f...
[ "function", "HelloSignResource", "(", "hellosign", ",", "urlData", ")", "{", "this", ".", "_hellosign", "=", "hellosign", ";", "this", ".", "_urlData", "=", "urlData", "||", "{", "}", ";", "this", ".", "basePath", "=", "utils", ".", "makeURLInterpolator", ...
Encapsulates request logic for a HelloSign Resource
[ "Encapsulates", "request", "logic", "for", "a", "HelloSign", "Resource" ]
5ab3e27896986602fa9613ccb3e7d2997f02539a
https://github.com/HelloFax/hellosign-nodejs-sdk/blob/5ab3e27896986602fa9613ccb3e7d2997f02539a/lib/HelloSignResource.js#L49-L65
train
silas/node-consul
lib/agent.js
Agent
function Agent(consul) { this.consul = consul; this.check = new Agent.Check(consul); this.service = new Agent.Service(consul); }
javascript
function Agent(consul) { this.consul = consul; this.check = new Agent.Check(consul); this.service = new Agent.Service(consul); }
[ "function", "Agent", "(", "consul", ")", "{", "this", ".", "consul", "=", "consul", ";", "this", ".", "check", "=", "new", "Agent", ".", "Check", "(", "consul", ")", ";", "this", ".", "service", "=", "new", "Agent", ".", "Service", "(", "consul", "...
Initialize a new `Agent` client.
[ "Initialize", "a", "new", "Agent", "client", "." ]
d009af5b05a1543fa7bd7aa58a6325d1aae93308
https://github.com/silas/node-consul/blob/d009af5b05a1543fa7bd7aa58a6325d1aae93308/lib/agent.js#L20-L24
train
silas/node-consul
lib/lock.js
Lock
function Lock(consul, opts) { events.EventEmitter.call(this); opts = utils.normalizeKeys(opts); this.consul = consul; this._opts = opts; this._defaults = utils.defaultCommonOptions(opts); if (opts.session) { switch (typeof opts.session) { case 'string': opts.session = { id: opts.session...
javascript
function Lock(consul, opts) { events.EventEmitter.call(this); opts = utils.normalizeKeys(opts); this.consul = consul; this._opts = opts; this._defaults = utils.defaultCommonOptions(opts); if (opts.session) { switch (typeof opts.session) { case 'string': opts.session = { id: opts.session...
[ "function", "Lock", "(", "consul", ",", "opts", ")", "{", "events", ".", "EventEmitter", ".", "call", "(", "this", ")", ";", "opts", "=", "utils", ".", "normalizeKeys", "(", "opts", ")", ";", "this", ".", "consul", "=", "consul", ";", "this", ".", ...
Initialize a new `Lock` instance.
[ "Initialize", "a", "new", "Lock", "instance", "." ]
d009af5b05a1543fa7bd7aa58a6325d1aae93308
https://github.com/silas/node-consul/blob/d009af5b05a1543fa7bd7aa58a6325d1aae93308/lib/lock.js#L34-L63
train
silas/node-consul
lib/utils.js
bodyItem
function bodyItem(request, next) { if (request.err) return next(false, request.err, undefined, request.res); if (request.res.body && request.res.body.length) { return next(false, undefined, request.res.body[0], request.res); } next(false, undefined, undefined, request.res); }
javascript
function bodyItem(request, next) { if (request.err) return next(false, request.err, undefined, request.res); if (request.res.body && request.res.body.length) { return next(false, undefined, request.res.body[0], request.res); } next(false, undefined, undefined, request.res); }
[ "function", "bodyItem", "(", "request", ",", "next", ")", "{", "if", "(", "request", ".", "err", ")", "return", "next", "(", "false", ",", "request", ".", "err", ",", "undefined", ",", "request", ".", "res", ")", ";", "if", "(", "request", ".", "re...
First item in body
[ "First", "item", "in", "body" ]
d009af5b05a1543fa7bd7aa58a6325d1aae93308
https://github.com/silas/node-consul/blob/d009af5b05a1543fa7bd7aa58a6325d1aae93308/lib/utils.js#L27-L35
train
silas/node-consul
lib/utils.js
defaultCommonOptions
function defaultCommonOptions(opts) { opts = normalizeKeys(opts); var defaults; constants.DEFAULT_OPTIONS.forEach(function(key) { if (!opts.hasOwnProperty(key)) return; if (!defaults) defaults = {}; defaults[key] = opts[key]; }); return defaults; }
javascript
function defaultCommonOptions(opts) { opts = normalizeKeys(opts); var defaults; constants.DEFAULT_OPTIONS.forEach(function(key) { if (!opts.hasOwnProperty(key)) return; if (!defaults) defaults = {}; defaults[key] = opts[key]; }); return defaults; }
[ "function", "defaultCommonOptions", "(", "opts", ")", "{", "opts", "=", "normalizeKeys", "(", "opts", ")", ";", "var", "defaults", ";", "constants", ".", "DEFAULT_OPTIONS", ".", "forEach", "(", "function", "(", "key", ")", "{", "if", "(", "!", "opts", "....
Default common options
[ "Default", "common", "options" ]
d009af5b05a1543fa7bd7aa58a6325d1aae93308
https://github.com/silas/node-consul/blob/d009af5b05a1543fa7bd7aa58a6325d1aae93308/lib/utils.js#L160-L171
train
silas/node-consul
lib/utils.js
setTimeoutContext
function setTimeoutContext(fn, ctx, timeout) { var id; var cancel = function() { clearTimeout(id); }; id = setTimeout(function() { ctx.removeListener('cancel', cancel); fn(); }, timeout); ctx.once('cancel', cancel); }
javascript
function setTimeoutContext(fn, ctx, timeout) { var id; var cancel = function() { clearTimeout(id); }; id = setTimeout(function() { ctx.removeListener('cancel', cancel); fn(); }, timeout); ctx.once('cancel', cancel); }
[ "function", "setTimeoutContext", "(", "fn", ",", "ctx", ",", "timeout", ")", "{", "var", "id", ";", "var", "cancel", "=", "function", "(", ")", "{", "clearTimeout", "(", "id", ")", ";", "}", ";", "id", "=", "setTimeout", "(", "function", "(", ")", ...
Set timeout with cancel support
[ "Set", "timeout", "with", "cancel", "support" ]
d009af5b05a1543fa7bd7aa58a6325d1aae93308
https://github.com/silas/node-consul/blob/d009af5b05a1543fa7bd7aa58a6325d1aae93308/lib/utils.js#L204-L218
train
silas/node-consul
lib/utils.js
setIntervalContext
function setIntervalContext(fn, ctx, timeout) { var id; var cancel = function() { clearInterval(id); }; id = setInterval(function() { fn(); }, timeout); ctx.once('cancel', cancel); }
javascript
function setIntervalContext(fn, ctx, timeout) { var id; var cancel = function() { clearInterval(id); }; id = setInterval(function() { fn(); }, timeout); ctx.once('cancel', cancel); }
[ "function", "setIntervalContext", "(", "fn", ",", "ctx", ",", "timeout", ")", "{", "var", "id", ";", "var", "cancel", "=", "function", "(", ")", "{", "clearInterval", "(", "id", ")", ";", "}", ";", "id", "=", "setInterval", "(", "function", "(", ")",...
Set interval with cancel support
[ "Set", "interval", "with", "cancel", "support" ]
d009af5b05a1543fa7bd7aa58a6325d1aae93308
https://github.com/silas/node-consul/blob/d009af5b05a1543fa7bd7aa58a6325d1aae93308/lib/utils.js#L224-L234
train
silas/node-consul
lib/utils.js
hasIndexChanged
function hasIndexChanged(index, prevIndex) { if (typeof index !== 'string' || !index) return false; if (typeof prevIndex !== 'string' || !prevIndex) return true; return index !== prevIndex; }
javascript
function hasIndexChanged(index, prevIndex) { if (typeof index !== 'string' || !index) return false; if (typeof prevIndex !== 'string' || !prevIndex) return true; return index !== prevIndex; }
[ "function", "hasIndexChanged", "(", "index", ",", "prevIndex", ")", "{", "if", "(", "typeof", "index", "!==", "'string'", "||", "!", "index", ")", "return", "false", ";", "if", "(", "typeof", "prevIndex", "!==", "'string'", "||", "!", "prevIndex", ")", "...
Has the Consul index changed.
[ "Has", "the", "Consul", "index", "changed", "." ]
d009af5b05a1543fa7bd7aa58a6325d1aae93308
https://github.com/silas/node-consul/blob/d009af5b05a1543fa7bd7aa58a6325d1aae93308/lib/utils.js#L316-L320
train
silas/node-consul
lib/utils.js
parseQueryMeta
function parseQueryMeta(res) { var meta = {}; if (res && res.headers) { if (res.headers['x-consul-index']) { meta.LastIndex = res.headers['x-consul-index']; } if (res.headers['x-consul-lastcontact']) { meta.LastContact = parseInt(res.headers['x-consul-lastcontact'], 10); } if (res.h...
javascript
function parseQueryMeta(res) { var meta = {}; if (res && res.headers) { if (res.headers['x-consul-index']) { meta.LastIndex = res.headers['x-consul-index']; } if (res.headers['x-consul-lastcontact']) { meta.LastContact = parseInt(res.headers['x-consul-lastcontact'], 10); } if (res.h...
[ "function", "parseQueryMeta", "(", "res", ")", "{", "var", "meta", "=", "{", "}", ";", "if", "(", "res", "&&", "res", ".", "headers", ")", "{", "if", "(", "res", ".", "headers", "[", "'x-consul-index'", "]", ")", "{", "meta", ".", "LastIndex", "=",...
Parse query meta
[ "Parse", "query", "meta" ]
d009af5b05a1543fa7bd7aa58a6325d1aae93308
https://github.com/silas/node-consul/blob/d009af5b05a1543fa7bd7aa58a6325d1aae93308/lib/utils.js#L326-L345
train
silas/node-consul
lib/catalog.js
Catalog
function Catalog(consul) { this.consul = consul; this.connect = new Catalog.Connect(consul); this.node = new Catalog.Node(consul); this.service = new Catalog.Service(consul); }
javascript
function Catalog(consul) { this.consul = consul; this.connect = new Catalog.Connect(consul); this.node = new Catalog.Node(consul); this.service = new Catalog.Service(consul); }
[ "function", "Catalog", "(", "consul", ")", "{", "this", ".", "consul", "=", "consul", ";", "this", ".", "connect", "=", "new", "Catalog", ".", "Connect", "(", "consul", ")", ";", "this", ".", "node", "=", "new", "Catalog", ".", "Node", "(", "consul",...
Initialize a new `Catalog` client.
[ "Initialize", "a", "new", "Catalog", "client", "." ]
d009af5b05a1543fa7bd7aa58a6325d1aae93308
https://github.com/silas/node-consul/blob/d009af5b05a1543fa7bd7aa58a6325d1aae93308/lib/catalog.js#L20-L25
train
silas/node-consul
lib/consul.js
Consul
function Consul(opts) { if (!(this instanceof Consul)) { return new Consul(opts); } opts = utils.defaults({}, opts); if (!opts.baseUrl) { opts.baseUrl = (opts.secure ? 'https:' : 'http:') + '//' + (opts.host || '127.0.0.1') + ':' + (opts.port || 8500) + '/v1'; } opts.name = 'consul'; ...
javascript
function Consul(opts) { if (!(this instanceof Consul)) { return new Consul(opts); } opts = utils.defaults({}, opts); if (!opts.baseUrl) { opts.baseUrl = (opts.secure ? 'https:' : 'http:') + '//' + (opts.host || '127.0.0.1') + ':' + (opts.port || 8500) + '/v1'; } opts.name = 'consul'; ...
[ "function", "Consul", "(", "opts", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Consul", ")", ")", "{", "return", "new", "Consul", "(", "opts", ")", ";", "}", "opts", "=", "utils", ".", "defaults", "(", "{", "}", ",", "opts", ")", ";", ...
Initialize a new `Consul` client.
[ "Initialize", "a", "new", "Consul", "client", "." ]
d009af5b05a1543fa7bd7aa58a6325d1aae93308
https://github.com/silas/node-consul/blob/d009af5b05a1543fa7bd7aa58a6325d1aae93308/lib/consul.js#L31-L76
train
silas/node-consul
lib/watch.js
Watch
function Watch(consul, opts) { var self = this; events.EventEmitter.call(self); opts = utils.normalizeKeys(opts); var options = utils.normalizeKeys(opts.options || {}); options = utils.defaults(options, consul._defaults); options.wait = options.wait || '30s'; options.index = options.index || '0'; if...
javascript
function Watch(consul, opts) { var self = this; events.EventEmitter.call(self); opts = utils.normalizeKeys(opts); var options = utils.normalizeKeys(opts.options || {}); options = utils.defaults(options, consul._defaults); options.wait = options.wait || '30s'; options.index = options.index || '0'; if...
[ "function", "Watch", "(", "consul", ",", "opts", ")", "{", "var", "self", "=", "this", ";", "events", ".", "EventEmitter", ".", "call", "(", "self", ")", ";", "opts", "=", "utils", ".", "normalizeKeys", "(", "opts", ")", ";", "var", "options", "=", ...
Initialize a new `Watch` instance.
[ "Initialize", "a", "new", "Watch", "instance", "." ]
d009af5b05a1543fa7bd7aa58a6325d1aae93308
https://github.com/silas/node-consul/blob/d009af5b05a1543fa7bd7aa58a6325d1aae93308/lib/watch.js#L21-L67
train
pbojinov/request-ip
src/index.js
getClientIpFromXForwardedFor
function getClientIpFromXForwardedFor(value) { if (!is.existy(value)) { return null; } if (is.not.string(value)) { throw new TypeError(`Expected a string, got "${typeof value}"`); } // x-forwarded-for may return multiple IP addresses in the format: // "client IP, proxy 1 IP, pr...
javascript
function getClientIpFromXForwardedFor(value) { if (!is.existy(value)) { return null; } if (is.not.string(value)) { throw new TypeError(`Expected a string, got "${typeof value}"`); } // x-forwarded-for may return multiple IP addresses in the format: // "client IP, proxy 1 IP, pr...
[ "function", "getClientIpFromXForwardedFor", "(", "value", ")", "{", "if", "(", "!", "is", ".", "existy", "(", "value", ")", ")", "{", "return", "null", ";", "}", "if", "(", "is", ".", "not", ".", "string", "(", "value", ")", ")", "{", "throw", "new...
Parse x-forwarded-for headers. @param {string} value - The value to be parsed. @return {string|null} First known IP address, if any.
[ "Parse", "x", "-", "forwarded", "-", "for", "headers", "." ]
915d984b46d262e4418a889abc7601c38d47f049
https://github.com/pbojinov/request-ip/blob/915d984b46d262e4418a889abc7601c38d47f049/src/index.js#L9-L40
train
pbojinov/request-ip
src/index.js
getClientIp
function getClientIp(req) { // Server is probably behind a proxy. if (req.headers) { // Standard headers used by Amazon EC2, Heroku, and others. if (is.ip(req.headers['x-client-ip'])) { return req.headers['x-client-ip']; } // Load-balancers (AWS ELB) or pro...
javascript
function getClientIp(req) { // Server is probably behind a proxy. if (req.headers) { // Standard headers used by Amazon EC2, Heroku, and others. if (is.ip(req.headers['x-client-ip'])) { return req.headers['x-client-ip']; } // Load-balancers (AWS ELB) or pro...
[ "function", "getClientIp", "(", "req", ")", "{", "// Server is probably behind a proxy.", "if", "(", "req", ".", "headers", ")", "{", "// Standard headers used by Amazon EC2, Heroku, and others.", "if", "(", "is", ".", "ip", "(", "req", ".", "headers", "[", "'x-clie...
Determine client IP address. @param req @returns {string} ip - The IP address if known, defaulting to empty string if unknown.
[ "Determine", "client", "IP", "address", "." ]
915d984b46d262e4418a889abc7601c38d47f049
https://github.com/pbojinov/request-ip/blob/915d984b46d262e4418a889abc7601c38d47f049/src/index.js#L48-L130
train
pbojinov/request-ip
src/index.js
mw
function mw(options) { // Defaults. const configuration = is.not.existy(options) ? {} : options; // Validation. if (is.not.object(configuration)) { throw new TypeError('Options must be an object!'); } const attributeName = configuration.attributeName || 'clientIp'; return (req, res...
javascript
function mw(options) { // Defaults. const configuration = is.not.existy(options) ? {} : options; // Validation. if (is.not.object(configuration)) { throw new TypeError('Options must be an object!'); } const attributeName = configuration.attributeName || 'clientIp'; return (req, res...
[ "function", "mw", "(", "options", ")", "{", "// Defaults.", "const", "configuration", "=", "is", ".", "not", ".", "existy", "(", "options", ")", "?", "{", "}", ":", "options", ";", "// Validation.", "if", "(", "is", ".", "not", ".", "object", "(", "c...
Expose request IP as a middleware. @param {object} [options] - Configuration. @param {string} [options.attributeName] - Name of attribute to augment request object with. @return {*}
[ "Expose", "request", "IP", "as", "a", "middleware", "." ]
915d984b46d262e4418a889abc7601c38d47f049
https://github.com/pbojinov/request-ip/blob/915d984b46d262e4418a889abc7601c38d47f049/src/index.js#L139-L157
train
anandthakker/doiuse
src/missing-support.js
missingSupport
function missingSupport (browserRequest, from) { const browsers = new BrowserSelection(browserRequest, from) let result = {} Object.keys(features).forEach(function (feature) { const featureData = caniuse.feature(caniuse.features[feature]) const lackData = filterStats(browsers, featureData.stats) cons...
javascript
function missingSupport (browserRequest, from) { const browsers = new BrowserSelection(browserRequest, from) let result = {} Object.keys(features).forEach(function (feature) { const featureData = caniuse.feature(caniuse.features[feature]) const lackData = filterStats(browsers, featureData.stats) cons...
[ "function", "missingSupport", "(", "browserRequest", ",", "from", ")", "{", "const", "browsers", "=", "new", "BrowserSelection", "(", "browserRequest", ",", "from", ")", "let", "result", "=", "{", "}", "Object", ".", "keys", "(", "features", ")", ".", "for...
Get data on CSS features not supported by the given autoprefixer-like browser selection. @returns `{browsers, features}`, where `features` is an array of: ``` { 'feature-name': { title: 'Title of feature' missing: "IE (8), Chrome (31)" missingData: { // map of browser -> version -> (lack of)support code ie: { '8': 'n'...
[ "Get", "data", "on", "CSS", "features", "not", "supported", "by", "the", "given", "autoprefixer", "-", "like", "browser", "selection", "." ]
7525e72dbc86914600e96710c1a5c34b8cb3f8ac
https://github.com/anandthakker/doiuse/blob/7525e72dbc86914600e96710c1a5c34b8cb3f8ac/src/missing-support.js#L76-L109
train
joewalnes/filtrex
filtrex.js
removeErrorRecovery
function removeErrorRecovery (fn) { var parseFn = String(fn); try { var JSONSelect = require("JSONSelect"); var Reflect = require("reflect"); var ast = Reflect.parse(parseFn); var labeled = JSONSelect.match(':has(:root > .label > .name:val("_handle_error"))', ast); label...
javascript
function removeErrorRecovery (fn) { var parseFn = String(fn); try { var JSONSelect = require("JSONSelect"); var Reflect = require("reflect"); var ast = Reflect.parse(parseFn); var labeled = JSONSelect.match(':has(:root > .label > .name:val("_handle_error"))', ast); label...
[ "function", "removeErrorRecovery", "(", "fn", ")", "{", "var", "parseFn", "=", "String", "(", "fn", ")", ";", "try", "{", "var", "JSONSelect", "=", "require", "(", "\"JSONSelect\"", ")", ";", "var", "Reflect", "=", "require", "(", "\"reflect\"", ")", ";"...
returns parse function without error recovery code
[ "returns", "parse", "function", "without", "error", "recovery", "code" ]
685f5796211353623269de02b43bb6bc68e556a0
https://github.com/joewalnes/filtrex/blob/685f5796211353623269de02b43bb6bc68e556a0/filtrex.js#L1178-L1192
train
joewalnes/filtrex
filtrex.js
layerMethod
function layerMethod(k, fun) { var pos = k.match(position)[0], key = k.replace(position, ''), prop = this[key]; if (pos === 'after') { this[key] = function () { var ret = prop.apply(this, arguments); var args = [].slice.call(arguments); args.splice(0,...
javascript
function layerMethod(k, fun) { var pos = k.match(position)[0], key = k.replace(position, ''), prop = this[key]; if (pos === 'after') { this[key] = function () { var ret = prop.apply(this, arguments); var args = [].slice.call(arguments); args.splice(0,...
[ "function", "layerMethod", "(", "k", ",", "fun", ")", "{", "var", "pos", "=", "k", ".", "match", "(", "position", ")", "[", "0", "]", ",", "key", "=", "k", ".", "replace", "(", "position", ",", "''", ")", ",", "prop", "=", "this", "[", "key", ...
basic method layering always returns original method's return value
[ "basic", "method", "layering", "always", "returns", "original", "method", "s", "return", "value" ]
685f5796211353623269de02b43bb6bc68e556a0
https://github.com/joewalnes/filtrex/blob/685f5796211353623269de02b43bb6bc68e556a0/filtrex.js#L2392-L2412
train
joewalnes/filtrex
filtrex.js
typal_construct
function typal_construct() { var o = typal_mix.apply(create(this), arguments); var constructor = o.constructor; var Klass = o.constructor = function () { return constructor.apply(this, arguments); }; Klass.prototype = o; Klass.mix = typal_mix; // allow for easy singleton property...
javascript
function typal_construct() { var o = typal_mix.apply(create(this), arguments); var constructor = o.constructor; var Klass = o.constructor = function () { return constructor.apply(this, arguments); }; Klass.prototype = o; Klass.mix = typal_mix; // allow for easy singleton property...
[ "function", "typal_construct", "(", ")", "{", "var", "o", "=", "typal_mix", ".", "apply", "(", "create", "(", "this", ")", ",", "arguments", ")", ";", "var", "constructor", "=", "o", ".", "constructor", ";", "var", "Klass", "=", "o", ".", "constructor"...
Creates a new Class function based on an object with a constructor method
[ "Creates", "a", "new", "Class", "function", "based", "on", "an", "object", "with", "a", "constructor", "method" ]
685f5796211353623269de02b43bb6bc68e556a0
https://github.com/joewalnes/filtrex/blob/685f5796211353623269de02b43bb6bc68e556a0/filtrex.js#L2450-L2457
train
joewalnes/filtrex
example/highlight.js
buildTable
function buildTable(tbody, data) { tbody.empty(); data.forEach(function(item) { var row = $('<tr>').appendTo(tbody); $('<td>').appendTo(row).text(item.price); $('<td>').appendTo(row).text(item.weight); $('<td>').appendTo(row).text(item.taste); // Associate underlying data with row node so we ca...
javascript
function buildTable(tbody, data) { tbody.empty(); data.forEach(function(item) { var row = $('<tr>').appendTo(tbody); $('<td>').appendTo(row).text(item.price); $('<td>').appendTo(row).text(item.weight); $('<td>').appendTo(row).text(item.taste); // Associate underlying data with row node so we ca...
[ "function", "buildTable", "(", "tbody", ",", "data", ")", "{", "tbody", ".", "empty", "(", ")", ";", "data", ".", "forEach", "(", "function", "(", "item", ")", "{", "var", "row", "=", "$", "(", "'<tr>'", ")", ".", "appendTo", "(", "tbody", ")", "...
Build table on page with items.
[ "Build", "table", "on", "page", "with", "items", "." ]
685f5796211353623269de02b43bb6bc68e556a0
https://github.com/joewalnes/filtrex/blob/685f5796211353623269de02b43bb6bc68e556a0/example/highlight.js#L27-L39
train
joewalnes/filtrex
example/highlight.js
updateExpression
function updateExpression() { // Default highlighter will not highlight anything var nullHighlighter = function(item) { return false; } var input = $('.expression'); var expression = input.val(); var highlighter; if (!expression) { // No expression specified. Don't highlight anything. highlighter...
javascript
function updateExpression() { // Default highlighter will not highlight anything var nullHighlighter = function(item) { return false; } var input = $('.expression'); var expression = input.val(); var highlighter; if (!expression) { // No expression specified. Don't highlight anything. highlighter...
[ "function", "updateExpression", "(", ")", "{", "// Default highlighter will not highlight anything", "var", "nullHighlighter", "=", "function", "(", "item", ")", "{", "return", "false", ";", "}", "var", "input", "=", "$", "(", "'.expression'", ")", ";", "var", "...
When user entered expression changes, attempt to parse it and apply highlights to rows that match filter.
[ "When", "user", "entered", "expression", "changes", "attempt", "to", "parse", "it", "and", "apply", "highlights", "to", "rows", "that", "match", "filter", "." ]
685f5796211353623269de02b43bb6bc68e556a0
https://github.com/joewalnes/filtrex/blob/685f5796211353623269de02b43bb6bc68e556a0/example/highlight.js#L45-L71
train
kristerkari/stylelint-scss
src/utils/sassValueParser/index.js
isInsideFunctionCall
function isInsideFunctionCall(string, index) { const result = { is: false, fn: null }; const before = string.substring(0, index).trim(); const after = string.substring(index + 1).trim(); const beforeMatch = before.match(/([a-zA-Z_-][a-zA-Z0-9_-]*)\([^(){},]+$/); if (beforeMatch && beforeMatch[0] && after.sea...
javascript
function isInsideFunctionCall(string, index) { const result = { is: false, fn: null }; const before = string.substring(0, index).trim(); const after = string.substring(index + 1).trim(); const beforeMatch = before.match(/([a-zA-Z_-][a-zA-Z0-9_-]*)\([^(){},]+$/); if (beforeMatch && beforeMatch[0] && after.sea...
[ "function", "isInsideFunctionCall", "(", "string", ",", "index", ")", "{", "const", "result", "=", "{", "is", ":", "false", ",", "fn", ":", "null", "}", ";", "const", "before", "=", "string", ".", "substring", "(", "0", ",", "index", ")", ".", "trim"...
Checks if the character is inside a function agruments @param {String} string - the input string @param {Number} index - current character index @return {Object} return {Boolean} return.is - if inside a function arguments {String} return.fn - function name
[ "Checks", "if", "the", "character", "is", "inside", "a", "function", "agruments" ]
c8a0f2ff85a588424b02a154be3811b16029ecc0
https://github.com/kristerkari/stylelint-scss/blob/c8a0f2ff85a588424b02a154be3811b16029ecc0/src/utils/sassValueParser/index.js#L690-L702
train
kristerkari/stylelint-scss
src/utils/sassValueParser/index.js
isStringBefore
function isStringBefore(before) { const result = { is: false, opsBetween: false }; const stringOpsClipped = before.replace(/(\s*[+/*%]|\s+-)+$/, ""); if (stringOpsClipped !== before) { result.opsBetween = true; } // If it is quoted if ( stringOpsClipped[stringOpsClipped.length - 1] === '"' || ...
javascript
function isStringBefore(before) { const result = { is: false, opsBetween: false }; const stringOpsClipped = before.replace(/(\s*[+/*%]|\s+-)+$/, ""); if (stringOpsClipped !== before) { result.opsBetween = true; } // If it is quoted if ( stringOpsClipped[stringOpsClipped.length - 1] === '"' || ...
[ "function", "isStringBefore", "(", "before", ")", "{", "const", "result", "=", "{", "is", ":", "false", ",", "opsBetween", ":", "false", "}", ";", "const", "stringOpsClipped", "=", "before", ".", "replace", "(", "/", "(\\s*[+/*%]|\\s+-)+$", "/", ",", "\"\"...
Checks if there is a string before the character. Also checks if there is a math operator in between @param {String} before - the input string that preceses the character @return {Object} return {Boolean} return.is - if there is a string {String} return.opsBetween - if there are operators in between
[ "Checks", "if", "there", "is", "a", "string", "before", "the", "character", ".", "Also", "checks", "if", "there", "is", "a", "math", "operator", "in", "between" ]
c8a0f2ff85a588424b02a154be3811b16029ecc0
https://github.com/kristerkari/stylelint-scss/blob/c8a0f2ff85a588424b02a154be3811b16029ecc0/src/utils/sassValueParser/index.js#L713-L737
train
kristerkari/stylelint-scss
src/utils/sassValueParser/index.js
isInterpolationBefore
function isInterpolationBefore(before) { const result = { is: false, opsBetween: false }; // Removing preceding operators if any const beforeOpsClipped = before.replace(/(\s*[+/*%-])+$/, ""); if (beforeOpsClipped !== before) { result.opsBetween = true; } if (beforeOpsClipped[beforeOpsClipped.length - ...
javascript
function isInterpolationBefore(before) { const result = { is: false, opsBetween: false }; // Removing preceding operators if any const beforeOpsClipped = before.replace(/(\s*[+/*%-])+$/, ""); if (beforeOpsClipped !== before) { result.opsBetween = true; } if (beforeOpsClipped[beforeOpsClipped.length - ...
[ "function", "isInterpolationBefore", "(", "before", ")", "{", "const", "result", "=", "{", "is", ":", "false", ",", "opsBetween", ":", "false", "}", ";", "// Removing preceding operators if any", "const", "beforeOpsClipped", "=", "before", ".", "replace", "(", "...
Checks if there is an interpolation before the character. Also checks if there is a math operator in between @param {String} before - the input string that preceses the character @return {Object} return {Boolean} return.is - if there is an interpolation {String} return.opsBetween - if there are operators in between
[ "Checks", "if", "there", "is", "an", "interpolation", "before", "the", "character", ".", "Also", "checks", "if", "there", "is", "a", "math", "operator", "in", "between" ]
c8a0f2ff85a588424b02a154be3811b16029ecc0
https://github.com/kristerkari/stylelint-scss/blob/c8a0f2ff85a588424b02a154be3811b16029ecc0/src/utils/sassValueParser/index.js#L803-L817
train
elpheria/rpc-websockets
dist/lib/utils.js
createError
function createError(code, details) { var error = { code: code, message: errors.get(code) || "Internal Server Error" }; if (details) error["data"] = details; return error; }
javascript
function createError(code, details) { var error = { code: code, message: errors.get(code) || "Internal Server Error" }; if (details) error["data"] = details; return error; }
[ "function", "createError", "(", "code", ",", "details", ")", "{", "var", "error", "=", "{", "code", ":", "code", ",", "message", ":", "errors", ".", "get", "(", "code", ")", "||", "\"Internal Server Error\"", "}", ";", "if", "(", "details", ")", "error...
Creates a JSON-RPC 2.0-compliant error. @param {Number} code - error code @param {String} details - error details @return {Object}
[ "Creates", "a", "JSON", "-", "RPC", "2", ".", "0", "-", "compliant", "error", "." ]
b9430f04593d42161dd19b8ca7e01f877587497f
https://github.com/elpheria/rpc-websockets/blob/b9430f04593d42161dd19b8ca7e01f877587497f/dist/lib/utils.js#L22-L31
train
filerjs/filer
src/filesystem/implementation.js
create_node_in_parent
function create_node_in_parent(error, parentDirectoryNode) { if(error) { callback(error); } else if(parentDirectoryNode.type !== NODE_TYPE_DIRECTORY) { callback(new Errors.ENOTDIR('a component of the path prefix is not a directory', path)); } else { parentNode = parentDirectoryNode; ...
javascript
function create_node_in_parent(error, parentDirectoryNode) { if(error) { callback(error); } else if(parentDirectoryNode.type !== NODE_TYPE_DIRECTORY) { callback(new Errors.ENOTDIR('a component of the path prefix is not a directory', path)); } else { parentNode = parentDirectoryNode; ...
[ "function", "create_node_in_parent", "(", "error", ",", "parentDirectoryNode", ")", "{", "if", "(", "error", ")", "{", "callback", "(", "error", ")", ";", "}", "else", "if", "(", "parentDirectoryNode", ".", "type", "!==", "NODE_TYPE_DIRECTORY", ")", "{", "ca...
Check if the parent node exists
[ "Check", "if", "the", "parent", "node", "exists" ]
4aae53839a8da2ca5da9f4e92c33eaab50094352
https://github.com/filerjs/filer/blob/4aae53839a8da2ca5da9f4e92c33eaab50094352/src/filesystem/implementation.js#L106-L115
train
filerjs/filer
src/filesystem/implementation.js
check_if_node_exists
function check_if_node_exists(error, result) { if(!error && result) { callback(new Errors.EEXIST('path name already exists', path)); } else if(error && !(error instanceof Errors.ENOENT)) { callback(error); } else { context.getObject(parentNode.data, create_node); } }
javascript
function check_if_node_exists(error, result) { if(!error && result) { callback(new Errors.EEXIST('path name already exists', path)); } else if(error && !(error instanceof Errors.ENOENT)) { callback(error); } else { context.getObject(parentNode.data, create_node); } }
[ "function", "check_if_node_exists", "(", "error", ",", "result", ")", "{", "if", "(", "!", "error", "&&", "result", ")", "{", "callback", "(", "new", "Errors", ".", "EEXIST", "(", "'path name already exists'", ",", "path", ")", ")", ";", "}", "else", "if...
Check if the node to be created already exists
[ "Check", "if", "the", "node", "to", "be", "created", "already", "exists" ]
4aae53839a8da2ca5da9f4e92c33eaab50094352
https://github.com/filerjs/filer/blob/4aae53839a8da2ca5da9f4e92c33eaab50094352/src/filesystem/implementation.js#L118-L126
train
filerjs/filer
src/filesystem/implementation.js
create_node
function create_node(error, result) { if(error) { callback(error); } else { parentNodeData = result; Node.create({ guid: context.guid, type: type }, function(error, result) { if(error) { callback(error); return; } node = result;...
javascript
function create_node(error, result) { if(error) { callback(error); } else { parentNodeData = result; Node.create({ guid: context.guid, type: type }, function(error, result) { if(error) { callback(error); return; } node = result;...
[ "function", "create_node", "(", "error", ",", "result", ")", "{", "if", "(", "error", ")", "{", "callback", "(", "error", ")", ";", "}", "else", "{", "parentNodeData", "=", "result", ";", "Node", ".", "create", "(", "{", "guid", ":", "context", ".", ...
Create the new node
[ "Create", "the", "new", "node" ]
4aae53839a8da2ca5da9f4e92c33eaab50094352
https://github.com/filerjs/filer/blob/4aae53839a8da2ca5da9f4e92c33eaab50094352/src/filesystem/implementation.js#L129-L147
train
filerjs/filer
src/filesystem/implementation.js
update_parent_node_data
function update_parent_node_data(error) { if(error) { callback(error); } else { parentNodeData[name] = new DirectoryEntry(node.id, type); context.putObject(parentNode.data, parentNodeData, update_time); } }
javascript
function update_parent_node_data(error) { if(error) { callback(error); } else { parentNodeData[name] = new DirectoryEntry(node.id, type); context.putObject(parentNode.data, parentNodeData, update_time); } }
[ "function", "update_parent_node_data", "(", "error", ")", "{", "if", "(", "error", ")", "{", "callback", "(", "error", ")", ";", "}", "else", "{", "parentNodeData", "[", "name", "]", "=", "new", "DirectoryEntry", "(", "node", ".", "id", ",", "type", ")...
Update the parent nodes data
[ "Update", "the", "parent", "nodes", "data" ]
4aae53839a8da2ca5da9f4e92c33eaab50094352
https://github.com/filerjs/filer/blob/4aae53839a8da2ca5da9f4e92c33eaab50094352/src/filesystem/implementation.js#L160-L167
train
filerjs/filer
src/filesystem/implementation.js
ensure_root_directory
function ensure_root_directory(context, callback) { var superNode; var directoryNode; var directoryData; function ensure_super_node(error, existingNode) { if(!error && existingNode) { // Another instance has beat us and already created the super node. callback(); } else if(error && !(error ...
javascript
function ensure_root_directory(context, callback) { var superNode; var directoryNode; var directoryData; function ensure_super_node(error, existingNode) { if(!error && existingNode) { // Another instance has beat us and already created the super node. callback(); } else if(error && !(error ...
[ "function", "ensure_root_directory", "(", "context", ",", "callback", ")", "{", "var", "superNode", ";", "var", "directoryNode", ";", "var", "directoryData", ";", "function", "ensure_super_node", "(", "error", ",", "existingNode", ")", "{", "if", "(", "!", "er...
ensure_root_directory. Creates a root node if necessary. Note: this should only be invoked when formatting a new file system. Multiple invocations of this by separate instances will still result in only a single super node.
[ "ensure_root_directory", ".", "Creates", "a", "root", "node", "if", "necessary", "." ]
4aae53839a8da2ca5da9f4e92c33eaab50094352
https://github.com/filerjs/filer/blob/4aae53839a8da2ca5da9f4e92c33eaab50094352/src/filesystem/implementation.js#L315-L368
train
filerjs/filer
src/node.js
ensureID
function ensureID(options, prop, callback) { if(options[prop]) { return callback(); } options.guid(function(err, id) { if(err) { return callback(err); } options[prop] = id; callback(); }); }
javascript
function ensureID(options, prop, callback) { if(options[prop]) { return callback(); } options.guid(function(err, id) { if(err) { return callback(err); } options[prop] = id; callback(); }); }
[ "function", "ensureID", "(", "options", ",", "prop", ",", "callback", ")", "{", "if", "(", "options", "[", "prop", "]", ")", "{", "return", "callback", "(", ")", ";", "}", "options", ".", "guid", "(", "function", "(", "err", ",", "id", ")", "{", ...
Make sure the options object has an id on property, either from caller or one we generate using supplied guid fn.
[ "Make", "sure", "the", "options", "object", "has", "an", "id", "on", "property", "either", "from", "caller", "or", "one", "we", "generate", "using", "supplied", "guid", "fn", "." ]
4aae53839a8da2ca5da9f4e92c33eaab50094352
https://github.com/filerjs/filer/blob/4aae53839a8da2ca5da9f4e92c33eaab50094352/src/node.js#L18-L30
train
filerjs/filer
src/filesystem/interface.js
wrappedGuidFn
function wrappedGuidFn(context) { return function (callback) { // Skip the duplicate ID check if asked to if (flags.includes(FS_NODUPEIDCHECK)) { callback(null, guid()); return; } // Otherwise (default) make sure this id is unused first function guidWithCheck(callback)...
javascript
function wrappedGuidFn(context) { return function (callback) { // Skip the duplicate ID check if asked to if (flags.includes(FS_NODUPEIDCHECK)) { callback(null, guid()); return; } // Otherwise (default) make sure this id is unused first function guidWithCheck(callback)...
[ "function", "wrappedGuidFn", "(", "context", ")", "{", "return", "function", "(", "callback", ")", "{", "// Skip the duplicate ID check if asked to", "if", "(", "flags", ".", "includes", "(", "FS_NODUPEIDCHECK", ")", ")", "{", "callback", "(", "null", ",", "guid...
Deal with various approaches to node ID creation
[ "Deal", "with", "various", "approaches", "to", "node", "ID", "creation" ]
4aae53839a8da2ca5da9f4e92c33eaab50094352
https://github.com/filerjs/filer/blob/4aae53839a8da2ca5da9f4e92c33eaab50094352/src/filesystem/interface.js#L210-L237
train
country-regions/country-region-selector
source/source-jquery.crs.js
function (countries, preferred, preferredDelim) { var preferredShortCodes = preferred.split(',').reverse(); var preferredMap = {}; var foundPreferred = false; var updatedCountries = countries.filter(function (c) { if (preferredShortCodes.indexOf(c[1]) !== -1) { ...
javascript
function (countries, preferred, preferredDelim) { var preferredShortCodes = preferred.split(',').reverse(); var preferredMap = {}; var foundPreferred = false; var updatedCountries = countries.filter(function (c) { if (preferredShortCodes.indexOf(c[1]) !== -1) { ...
[ "function", "(", "countries", ",", "preferred", ",", "preferredDelim", ")", "{", "var", "preferredShortCodes", "=", "preferred", ".", "split", "(", "','", ")", ".", "reverse", "(", ")", ";", "var", "preferredMap", "=", "{", "}", ";", "var", "foundPreferred...
in 0.5.0 we added the option for "preferred" countries that get listed first. This just causes the preferred countries to get listed at the top of the list with an optional delimiter row following them
[ "in", "0", ".", "5", ".", "0", "we", "added", "the", "option", "for", "preferred", "countries", "that", "get", "listed", "first", ".", "This", "just", "causes", "the", "preferred", "countries", "to", "get", "listed", "at", "the", "top", "of", "the", "l...
619110c162b6b68e427798b8c049135802ebf0c5
https://github.com/country-regions/country-region-selector/blob/619110c162b6b68e427798b8c049135802ebf0c5/source/source-jquery.crs.js#L229-L254
train
country-regions/country-region-selector
gruntfile.js
getCountryList
function getCountryList() { var countries = grunt.option("countries"); if (!countries) { grunt.fail.fatal("Country list not passed. Example usage: `grunt customBuild --countries=Canada,United States`"); } // countries may contain commas in their names. Bit ugly, but simple. ...
javascript
function getCountryList() { var countries = grunt.option("countries"); if (!countries) { grunt.fail.fatal("Country list not passed. Example usage: `grunt customBuild --countries=Canada,United States`"); } // countries may contain commas in their names. Bit ugly, but simple. ...
[ "function", "getCountryList", "(", ")", "{", "var", "countries", "=", "grunt", ".", "option", "(", "\"countries\"", ")", ";", "if", "(", "!", "countries", ")", "{", "grunt", ".", "fail", ".", "fatal", "(", "\"Country list not passed. Example usage: `grunt custom...
used for the customBuild target. This generates a custom build of CRS with the list of countries specified by the user
[ "used", "for", "the", "customBuild", "target", ".", "This", "generates", "a", "custom", "build", "of", "CRS", "with", "the", "list", "of", "countries", "specified", "by", "the", "user" ]
619110c162b6b68e427798b8c049135802ebf0c5
https://github.com/country-regions/country-region-selector/blob/619110c162b6b68e427798b8c049135802ebf0c5/gruntfile.js#L15-L58
train
country-regions/country-region-selector
gruntfile.js
minifyJSON
function minifyJSON(json) { var js = []; json.forEach(function (countryData) { var pairs = []; countryData.regions.forEach(function (info) { if (_.has(info, 'shortCode')) { pairs.push(info.name + '~' + info.shortCode); } else {...
javascript
function minifyJSON(json) { var js = []; json.forEach(function (countryData) { var pairs = []; countryData.regions.forEach(function (info) { if (_.has(info, 'shortCode')) { pairs.push(info.name + '~' + info.shortCode); } else {...
[ "function", "minifyJSON", "(", "json", ")", "{", "var", "js", "=", "[", "]", ";", "json", ".", "forEach", "(", "function", "(", "countryData", ")", "{", "var", "pairs", "=", "[", "]", ";", "countryData", ".", "regions", ".", "forEach", "(", "function...
converts the data.json content from the country-region-data
[ "converts", "the", "data", ".", "json", "content", "from", "the", "country", "-", "region", "-", "data" ]
619110c162b6b68e427798b8c049135802ebf0c5
https://github.com/country-regions/country-region-selector/blob/619110c162b6b68e427798b8c049135802ebf0c5/gruntfile.js#L62-L84
train
Mikhus/domurl
url.js
urlConfig
function urlConfig (url) { var config = { path: true, query: true, hash: true }; if (!url) { return config; } if (RX_PROTOCOL.test(url)) { config.protocol = true; config.host = true; if (RX_POR...
javascript
function urlConfig (url) { var config = { path: true, query: true, hash: true }; if (!url) { return config; } if (RX_PROTOCOL.test(url)) { config.protocol = true; config.host = true; if (RX_POR...
[ "function", "urlConfig", "(", "url", ")", "{", "var", "config", "=", "{", "path", ":", "true", ",", "query", ":", "true", ",", "hash", ":", "true", "}", ";", "if", "(", "!", "url", ")", "{", "return", "config", ";", "}", "if", "(", "RX_PROTOCOL",...
configure given url options
[ "configure", "given", "url", "options" ]
6da9d172cfed40b126a7f53f87645e85124814a8
https://github.com/Mikhus/domurl/blob/6da9d172cfed40b126a7f53f87645e85124814a8/url.js#L32-L58
train
medialab/artoo
src/artoo.writers.js
keysIndex
function keysIndex(a) { var keys = [], l, k, i; for (i = 0, l = a.length; i < l; i++) for (k in a[i]) if (!~keys.indexOf(k)) keys.push(k); return keys; }
javascript
function keysIndex(a) { var keys = [], l, k, i; for (i = 0, l = a.length; i < l; i++) for (k in a[i]) if (!~keys.indexOf(k)) keys.push(k); return keys; }
[ "function", "keysIndex", "(", "a", ")", "{", "var", "keys", "=", "[", "]", ",", "l", ",", "k", ",", "i", ";", "for", "(", "i", "=", "0", ",", "l", "=", "a", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "for", "(", "k", "in", ...
Retrieve an index of keys present in an array of objects
[ "Retrieve", "an", "index", "of", "keys", "present", "in", "an", "array", "of", "objects" ]
89fe334cb2c2ec38b16012edfab2977822e1ecda
https://github.com/medialab/artoo/blob/89fe334cb2c2ec38b16012edfab2977822e1ecda/src/artoo.writers.js#L40-L52
train
medialab/artoo
src/artoo.writers.js
toCSVString
function toCSVString(data, params) { if (data.length === 0) { return ''; } params = params || {}; var header = params.headers || [], plainObject = isPlainObject(data[0]), keys = plainObject && (params.order || keysIndex(data)), oData, i; // Defaults var es...
javascript
function toCSVString(data, params) { if (data.length === 0) { return ''; } params = params || {}; var header = params.headers || [], plainObject = isPlainObject(data[0]), keys = plainObject && (params.order || keysIndex(data)), oData, i; // Defaults var es...
[ "function", "toCSVString", "(", "data", ",", "params", ")", "{", "if", "(", "data", ".", "length", "===", "0", ")", "{", "return", "''", ";", "}", "params", "=", "params", "||", "{", "}", ";", "var", "header", "=", "params", ".", "headers", "||", ...
Converting an array of arrays into a CSV string
[ "Converting", "an", "array", "of", "arrays", "into", "a", "CSV", "string" ]
89fe334cb2c2ec38b16012edfab2977822e1ecda
https://github.com/medialab/artoo/blob/89fe334cb2c2ec38b16012edfab2977822e1ecda/src/artoo.writers.js#L60-L104
train