id
int32
0
58k
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
20,400
greenlikeorange/knayi-myscript
library/converter.js
fontConvert
function fontConvert(content, to, from) { if (!content) { if (!globalOptions.isSilentMode()) console.warn('Content must be specified on knayi.fontConvert.'); return ''; } if (content === '' || !mmCharacterRange.test(content)) return content; if (!to) { if (!globalOptions.isSilentMode()) console.error('Convert target font must be specified on knayi.fontConvert.'); return content; } content = content.trim().replace(/\u200B/g, ''); to = fontTypes[to]; from = fontTypes[from]; if (!to) { if (!globalOptions.isSilentMode()) console.error('Convert library dosen\'t have this fontType.') return content; } else if (!from) { from = fontDetect(content); } if (to === from) { return content; } var debug_logs = { to: to, from: from, matched_patterns: [], steps: [] } content = spellingFix(content, from); var refLib = library.convert[from][to]; for (var i = 0; i < refLib.oneTime.length; i++) { var rule1 = refLib.oneTime[i]; // debugging if (this.debug && rule1[0].test(content)) { debug_logs.matched_patterns.push(rule1); debug_logs.steps.push(content); } content = content.replace(rule1[0], rule1[1]); } for (var j = 0; j < refLib.asLongAsMatch.length; j++) { var rule2 = refLib.asLongAsMatch[j]; // debugging if (this.debug && rule2[0].test(content)) { debug_logs.matched_patterns.push(rule2); debug_logs.steps.push(content); } while (rule2[0].test(content)) { content = content.replace(rule2[0], rule2[1]); } } if (this.debug) { // final debug_logs.steps.push(content); return debug_logs; } return content; }
javascript
function fontConvert(content, to, from) { if (!content) { if (!globalOptions.isSilentMode()) console.warn('Content must be specified on knayi.fontConvert.'); return ''; } if (content === '' || !mmCharacterRange.test(content)) return content; if (!to) { if (!globalOptions.isSilentMode()) console.error('Convert target font must be specified on knayi.fontConvert.'); return content; } content = content.trim().replace(/\u200B/g, ''); to = fontTypes[to]; from = fontTypes[from]; if (!to) { if (!globalOptions.isSilentMode()) console.error('Convert library dosen\'t have this fontType.') return content; } else if (!from) { from = fontDetect(content); } if (to === from) { return content; } var debug_logs = { to: to, from: from, matched_patterns: [], steps: [] } content = spellingFix(content, from); var refLib = library.convert[from][to]; for (var i = 0; i < refLib.oneTime.length; i++) { var rule1 = refLib.oneTime[i]; // debugging if (this.debug && rule1[0].test(content)) { debug_logs.matched_patterns.push(rule1); debug_logs.steps.push(content); } content = content.replace(rule1[0], rule1[1]); } for (var j = 0; j < refLib.asLongAsMatch.length; j++) { var rule2 = refLib.asLongAsMatch[j]; // debugging if (this.debug && rule2[0].test(content)) { debug_logs.matched_patterns.push(rule2); debug_logs.steps.push(content); } while (rule2[0].test(content)) { content = content.replace(rule2[0], rule2[1]); } } if (this.debug) { // final debug_logs.steps.push(content); return debug_logs; } return content; }
[ "function", "fontConvert", "(", "content", ",", "to", ",", "from", ")", "{", "if", "(", "!", "content", ")", "{", "if", "(", "!", "globalOptions", ".", "isSilentMode", "(", ")", ")", "console", ".", "warn", "(", "'Content must be specified on knayi.fontConvert.'", ")", ";", "return", "''", ";", "}", "if", "(", "content", "===", "''", "||", "!", "mmCharacterRange", ".", "test", "(", "content", ")", ")", "return", "content", ";", "if", "(", "!", "to", ")", "{", "if", "(", "!", "globalOptions", ".", "isSilentMode", "(", ")", ")", "console", ".", "error", "(", "'Convert target font must be specified on knayi.fontConvert.'", ")", ";", "return", "content", ";", "}", "content", "=", "content", ".", "trim", "(", ")", ".", "replace", "(", "/", "\\u200B", "/", "g", ",", "''", ")", ";", "to", "=", "fontTypes", "[", "to", "]", ";", "from", "=", "fontTypes", "[", "from", "]", ";", "if", "(", "!", "to", ")", "{", "if", "(", "!", "globalOptions", ".", "isSilentMode", "(", ")", ")", "console", ".", "error", "(", "'Convert library dosen\\'t have this fontType.'", ")", "return", "content", ";", "}", "else", "if", "(", "!", "from", ")", "{", "from", "=", "fontDetect", "(", "content", ")", ";", "}", "if", "(", "to", "===", "from", ")", "{", "return", "content", ";", "}", "var", "debug_logs", "=", "{", "to", ":", "to", ",", "from", ":", "from", ",", "matched_patterns", ":", "[", "]", ",", "steps", ":", "[", "]", "}", "content", "=", "spellingFix", "(", "content", ",", "from", ")", ";", "var", "refLib", "=", "library", ".", "convert", "[", "from", "]", "[", "to", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "refLib", ".", "oneTime", ".", "length", ";", "i", "++", ")", "{", "var", "rule1", "=", "refLib", ".", "oneTime", "[", "i", "]", ";", "// debugging", "if", "(", "this", ".", "debug", "&&", "rule1", "[", "0", "]", ".", "test", "(", "content", ")", ")", "{", "debug_logs", ".", "matched_patterns", ".", "push", "(", "rule1", ")", ";", "debug_logs", ".", "steps", ".", "push", "(", "content", ")", ";", "}", "content", "=", "content", ".", "replace", "(", "rule1", "[", "0", "]", ",", "rule1", "[", "1", "]", ")", ";", "}", "for", "(", "var", "j", "=", "0", ";", "j", "<", "refLib", ".", "asLongAsMatch", ".", "length", ";", "j", "++", ")", "{", "var", "rule2", "=", "refLib", ".", "asLongAsMatch", "[", "j", "]", ";", "// debugging", "if", "(", "this", ".", "debug", "&&", "rule2", "[", "0", "]", ".", "test", "(", "content", ")", ")", "{", "debug_logs", ".", "matched_patterns", ".", "push", "(", "rule2", ")", ";", "debug_logs", ".", "steps", ".", "push", "(", "content", ")", ";", "}", "while", "(", "rule2", "[", "0", "]", ".", "test", "(", "content", ")", ")", "{", "content", "=", "content", ".", "replace", "(", "rule2", "[", "0", "]", ",", "rule2", "[", "1", "]", ")", ";", "}", "}", "if", "(", "this", ".", "debug", ")", "{", "// final", "debug_logs", ".", "steps", ".", "push", "(", "content", ")", ";", "return", "debug_logs", ";", "}", "return", "content", ";", "}" ]
Font Converter agent @param content Text that you want to convert @param to Type of font to convert. Default: "unicode"; @param from Type of font of content text @return converted text
[ "Font", "Converter", "agent" ]
098dbc1cbeccfdda428e55aa37e04b413dc8619b
https://github.com/greenlikeorange/knayi-myscript/blob/098dbc1cbeccfdda428e55aa37e04b413dc8619b/library/converter.js#L211-L278
20,401
thlorenz/es6ify
index.js
compileFile
function compileFile(file, src) { var compiled; compiled = compile(file, src, exports.traceurOverrides); if (compiled.error) throw new Error(compiled.error); return compiled.source; }
javascript
function compileFile(file, src) { var compiled; compiled = compile(file, src, exports.traceurOverrides); if (compiled.error) throw new Error(compiled.error); return compiled.source; }
[ "function", "compileFile", "(", "file", ",", "src", ")", "{", "var", "compiled", ";", "compiled", "=", "compile", "(", "file", ",", "src", ",", "exports", ".", "traceurOverrides", ")", ";", "if", "(", "compiled", ".", "error", ")", "throw", "new", "Error", "(", "compiled", ".", "error", ")", ";", "return", "compiled", ".", "source", ";", "}" ]
Compile function, exposed to be used from other libraries, not needed when using es6ify as a transform. @name es6ify::compileFile @function @param {string} file name of the file that is being compiled to ES5 @param {string} src source of the file being compiled to ES5 @return {string} compiled source
[ "Compile", "function", "exposed", "to", "be", "used", "from", "other", "libraries", "not", "needed", "when", "using", "es6ify", "as", "a", "transform", "." ]
627e999ff6c2aaeb73f150687513ddb4dfb905e7
https://github.com/thlorenz/es6ify/blob/627e999ff6c2aaeb73f150687513ddb4dfb905e7/index.js#L26-L32
20,402
thlorenz/es6ify
example/src/features/generators.js
Tree
function Tree(left, label, right) { this.left = left; this.label = label; this.right = right; }
javascript
function Tree(left, label, right) { this.left = left; this.label = label; this.right = right; }
[ "function", "Tree", "(", "left", ",", "label", ",", "right", ")", "{", "this", ".", "left", "=", "left", ";", "this", ".", "label", "=", "label", ";", "this", ".", "right", "=", "right", ";", "}" ]
A binary tree class.
[ "A", "binary", "tree", "class", "." ]
627e999ff6c2aaeb73f150687513ddb4dfb905e7
https://github.com/thlorenz/es6ify/blob/627e999ff6c2aaeb73f150687513ddb4dfb905e7/example/src/features/generators.js#L2-L6
20,403
thlorenz/es6ify
example/src/features/generators.js
make
function make(array) { // Leaf node: if (array.length == 1) return new Tree(null, array[0], null); return new Tree(make(array[0]), array[1], make(array[2])); }
javascript
function make(array) { // Leaf node: if (array.length == 1) return new Tree(null, array[0], null); return new Tree(make(array[0]), array[1], make(array[2])); }
[ "function", "make", "(", "array", ")", "{", "// Leaf node:", "if", "(", "array", ".", "length", "==", "1", ")", "return", "new", "Tree", "(", "null", ",", "array", "[", "0", "]", ",", "null", ")", ";", "return", "new", "Tree", "(", "make", "(", "array", "[", "0", "]", ")", ",", "array", "[", "1", "]", ",", "make", "(", "array", "[", "2", "]", ")", ")", ";", "}" ]
Make a tree
[ "Make", "a", "tree" ]
627e999ff6c2aaeb73f150687513ddb4dfb905e7
https://github.com/thlorenz/es6ify/blob/627e999ff6c2aaeb73f150687513ddb4dfb905e7/example/src/features/generators.js#L18-L22
20,404
mongodb-js/mongodb-topology-manager
lib/utils.js
checkAvailable
function checkAvailable(host, port) { return new Promise(function(resolve, reject) { const socket = new net.Socket(); socket.on('connect', () => { cleanupSocket(socket); resolve(true); }); socket.on('error', err => { cleanupSocket(socket); if (err.code !== 'ECONNREFUSED') { return reject(err); } resolve(false); }); socket.connect({ port: port, host: host }); }); }
javascript
function checkAvailable(host, port) { return new Promise(function(resolve, reject) { const socket = new net.Socket(); socket.on('connect', () => { cleanupSocket(socket); resolve(true); }); socket.on('error', err => { cleanupSocket(socket); if (err.code !== 'ECONNREFUSED') { return reject(err); } resolve(false); }); socket.connect({ port: port, host: host }); }); }
[ "function", "checkAvailable", "(", "host", ",", "port", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "const", "socket", "=", "new", "net", ".", "Socket", "(", ")", ";", "socket", ".", "on", "(", "'connect'", ",", "(", ")", "=>", "{", "cleanupSocket", "(", "socket", ")", ";", "resolve", "(", "true", ")", ";", "}", ")", ";", "socket", ".", "on", "(", "'error'", ",", "err", "=>", "{", "cleanupSocket", "(", "socket", ")", ";", "if", "(", "err", ".", "code", "!==", "'ECONNREFUSED'", ")", "{", "return", "reject", "(", "err", ")", ";", "}", "resolve", "(", "false", ")", ";", "}", ")", ";", "socket", ".", "connect", "(", "{", "port", ":", "port", ",", "host", ":", "host", "}", ")", ";", "}", ")", ";", "}" ]
Checks if a provided address is actively listening for incoming connections @param {string} host the host to connect to @param {number} port the port to check for availability
[ "Checks", "if", "a", "provided", "address", "is", "actively", "listening", "for", "incoming", "connections" ]
7b30820c5d7f4fb4c3c748e42e456fb249469803
https://github.com/mongodb-js/mongodb-topology-manager/blob/7b30820c5d7f4fb4c3c748e42e456fb249469803/lib/utils.js#L29-L49
20,405
mongodb-js/mongodb-topology-manager
lib/utils.js
waitForAvailable
function waitForAvailable(host, port, options) { return co(function*() { options = Object.assign( {}, { initialMS: 300, retryMS: 100, retryCount: 25 }, options ); // Delay initial amount before attempting to connect yield delay(options.initialMS); // Try up to a certain number of times to connect for (var i = 0; i < options.retryCount; i++) { // Attempt to connect, returns true/false var available = yield checkAvailable(host, port); // If connected then return if (available) return; // Otherwise delay the retry amount and try again yield delay(options.retryMS); } // If this is reached then unable to connect throw new Error('Server is unavailable'); }); }
javascript
function waitForAvailable(host, port, options) { return co(function*() { options = Object.assign( {}, { initialMS: 300, retryMS: 100, retryCount: 25 }, options ); // Delay initial amount before attempting to connect yield delay(options.initialMS); // Try up to a certain number of times to connect for (var i = 0; i < options.retryCount; i++) { // Attempt to connect, returns true/false var available = yield checkAvailable(host, port); // If connected then return if (available) return; // Otherwise delay the retry amount and try again yield delay(options.retryMS); } // If this is reached then unable to connect throw new Error('Server is unavailable'); }); }
[ "function", "waitForAvailable", "(", "host", ",", "port", ",", "options", ")", "{", "return", "co", "(", "function", "*", "(", ")", "{", "options", "=", "Object", ".", "assign", "(", "{", "}", ",", "{", "initialMS", ":", "300", ",", "retryMS", ":", "100", ",", "retryCount", ":", "25", "}", ",", "options", ")", ";", "// Delay initial amount before attempting to connect", "yield", "delay", "(", "options", ".", "initialMS", ")", ";", "// Try up to a certain number of times to connect", "for", "(", "var", "i", "=", "0", ";", "i", "<", "options", ".", "retryCount", ";", "i", "++", ")", "{", "// Attempt to connect, returns true/false", "var", "available", "=", "yield", "checkAvailable", "(", "host", ",", "port", ")", ";", "// If connected then return", "if", "(", "available", ")", "return", ";", "// Otherwise delay the retry amount and try again", "yield", "delay", "(", "options", ".", "retryMS", ")", ";", "}", "// If this is reached then unable to connect", "throw", "new", "Error", "(", "'Server is unavailable'", ")", ";", "}", ")", ";", "}" ]
Waits for a provided address to actively listen for incoming connections on a given port. @param {string} host the host to connect to @param {number} port the port to check for availability @param {object} [options] optional settings @param {number} [options.retryMS] the amount of time to wait between retry attempts in ms @param {number} [options.initialMS] the amount of time to wait before first attempting in ms @param {number} [options.retryCount] the number of times to attempt retry
[ "Waits", "for", "a", "provided", "address", "to", "actively", "listen", "for", "incoming", "connections", "on", "a", "given", "port", "." ]
7b30820c5d7f4fb4c3c748e42e456fb249469803
https://github.com/mongodb-js/mongodb-topology-manager/blob/7b30820c5d7f4fb4c3c748e42e456fb249469803/lib/utils.js#L62-L92
20,406
mongodb-js/mongodb-topology-manager
lib/logger.js
function(className, options) { if (!(this instanceof Logger)) return new Logger(className, options); options = options || {}; // Current reference this.className = className; // Current logger if (currentLogger == null && options.logger) { currentLogger = options.logger; } else if (currentLogger == null) { currentLogger = console.log; } // Set level of logging, default is error if (level == null) { level = options.loggerLevel || 'error'; } // Add all class names if (filteredClasses[this.className] == null) classFilters[this.className] = true; }
javascript
function(className, options) { if (!(this instanceof Logger)) return new Logger(className, options); options = options || {}; // Current reference this.className = className; // Current logger if (currentLogger == null && options.logger) { currentLogger = options.logger; } else if (currentLogger == null) { currentLogger = console.log; } // Set level of logging, default is error if (level == null) { level = options.loggerLevel || 'error'; } // Add all class names if (filteredClasses[this.className] == null) classFilters[this.className] = true; }
[ "function", "(", "className", ",", "options", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Logger", ")", ")", "return", "new", "Logger", "(", "className", ",", "options", ")", ";", "options", "=", "options", "||", "{", "}", ";", "// Current reference", "this", ".", "className", "=", "className", ";", "// Current logger", "if", "(", "currentLogger", "==", "null", "&&", "options", ".", "logger", ")", "{", "currentLogger", "=", "options", ".", "logger", ";", "}", "else", "if", "(", "currentLogger", "==", "null", ")", "{", "currentLogger", "=", "console", ".", "log", ";", "}", "// Set level of logging, default is error", "if", "(", "level", "==", "null", ")", "{", "level", "=", "options", ".", "loggerLevel", "||", "'error'", ";", "}", "// Add all class names", "if", "(", "filteredClasses", "[", "this", ".", "className", "]", "==", "null", ")", "classFilters", "[", "this", ".", "className", "]", "=", "true", ";", "}" ]
Creates a new Logger instance @class @param {string} className The Class name associated with the logging instance @param {object} [options=null] Optional settings. @param {Function} [options.logger=null] Custom logger function; @param {string} [options.loggerLevel=error] Override default global log level. @return {Logger} a Logger instance.
[ "Creates", "a", "new", "Logger", "instance" ]
7b30820c5d7f4fb4c3c748e42e456fb249469803
https://github.com/mongodb-js/mongodb-topology-manager/blob/7b30820c5d7f4fb4c3c748e42e456fb249469803/lib/logger.js#L23-L44
20,407
segmentio/load-script
index.js
loadScript
function loadScript(options, cb) { if (!options) { throw new Error('Can\'t load nothing...'); } // Allow for the simplest case, just passing a `src` string. if (type(options) === 'string') { options = { src : options }; } var https = document.location.protocol === 'https:' || document.location.protocol === 'chrome-extension:'; // If you use protocol relative URLs, third-party scripts like Google // Analytics break when testing with `file:` so this fixes that. if (options.src && options.src.indexOf('//') === 0) { options.src = (https ? 'https:' : 'http:') + options.src; } // Allow them to pass in different URLs depending on the protocol. if (https && options.https) { options.src = options.https; } else if (!https && options.http) { options.src = options.http; } // Make the `<script>` element and insert it before the first script on the // page, which is guaranteed to exist since this Javascript is running. var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = options.src; // If we have a cb, attach event handlers. Does not work on < IE9 because // older browser versions don't register element.onerror if (type(cb) === 'function') { onload(script, cb); } tick(function() { // Append after event listeners are attached for IE. var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.insertBefore(script, firstScript); }); // Return the script element in case they want to do anything special, like // give it an ID or attributes. return script; }
javascript
function loadScript(options, cb) { if (!options) { throw new Error('Can\'t load nothing...'); } // Allow for the simplest case, just passing a `src` string. if (type(options) === 'string') { options = { src : options }; } var https = document.location.protocol === 'https:' || document.location.protocol === 'chrome-extension:'; // If you use protocol relative URLs, third-party scripts like Google // Analytics break when testing with `file:` so this fixes that. if (options.src && options.src.indexOf('//') === 0) { options.src = (https ? 'https:' : 'http:') + options.src; } // Allow them to pass in different URLs depending on the protocol. if (https && options.https) { options.src = options.https; } else if (!https && options.http) { options.src = options.http; } // Make the `<script>` element and insert it before the first script on the // page, which is guaranteed to exist since this Javascript is running. var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true; script.src = options.src; // If we have a cb, attach event handlers. Does not work on < IE9 because // older browser versions don't register element.onerror if (type(cb) === 'function') { onload(script, cb); } tick(function() { // Append after event listeners are attached for IE. var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.insertBefore(script, firstScript); }); // Return the script element in case they want to do anything special, like // give it an ID or attributes. return script; }
[ "function", "loadScript", "(", "options", ",", "cb", ")", "{", "if", "(", "!", "options", ")", "{", "throw", "new", "Error", "(", "'Can\\'t load nothing...'", ")", ";", "}", "// Allow for the simplest case, just passing a `src` string.", "if", "(", "type", "(", "options", ")", "===", "'string'", ")", "{", "options", "=", "{", "src", ":", "options", "}", ";", "}", "var", "https", "=", "document", ".", "location", ".", "protocol", "===", "'https:'", "||", "document", ".", "location", ".", "protocol", "===", "'chrome-extension:'", ";", "// If you use protocol relative URLs, third-party scripts like Google", "// Analytics break when testing with `file:` so this fixes that.", "if", "(", "options", ".", "src", "&&", "options", ".", "src", ".", "indexOf", "(", "'//'", ")", "===", "0", ")", "{", "options", ".", "src", "=", "(", "https", "?", "'https:'", ":", "'http:'", ")", "+", "options", ".", "src", ";", "}", "// Allow them to pass in different URLs depending on the protocol.", "if", "(", "https", "&&", "options", ".", "https", ")", "{", "options", ".", "src", "=", "options", ".", "https", ";", "}", "else", "if", "(", "!", "https", "&&", "options", ".", "http", ")", "{", "options", ".", "src", "=", "options", ".", "http", ";", "}", "// Make the `<script>` element and insert it before the first script on the", "// page, which is guaranteed to exist since this Javascript is running.", "var", "script", "=", "document", ".", "createElement", "(", "'script'", ")", ";", "script", ".", "type", "=", "'text/javascript'", ";", "script", ".", "async", "=", "true", ";", "script", ".", "src", "=", "options", ".", "src", ";", "// If we have a cb, attach event handlers. Does not work on < IE9 because", "// older browser versions don't register element.onerror", "if", "(", "type", "(", "cb", ")", "===", "'function'", ")", "{", "onload", "(", "script", ",", "cb", ")", ";", "}", "tick", "(", "function", "(", ")", "{", "// Append after event listeners are attached for IE.", "var", "firstScript", "=", "document", ".", "getElementsByTagName", "(", "'script'", ")", "[", "0", "]", ";", "firstScript", ".", "parentNode", ".", "insertBefore", "(", "script", ",", "firstScript", ")", ";", "}", ")", ";", "// Return the script element in case they want to do anything special, like", "// give it an ID or attributes.", "return", "script", ";", "}" ]
Loads a script asynchronously. @param {Object} options @param {Function} cb
[ "Loads", "a", "script", "asynchronously", "." ]
c167c85029e0a4c132c1f58d7ea96726989c82c0
https://github.com/segmentio/load-script/blob/c167c85029e0a4c132c1f58d7ea96726989c82c0/index.js#L17-L64
20,408
retextjs/retext-spell
index.js
transformer
function transformer(tree, file, next) { if (loadError) { next(loadError) } else if (config.checker) { all(tree, file, config) next() } else { queue.push([tree, file, config, next]) } }
javascript
function transformer(tree, file, next) { if (loadError) { next(loadError) } else if (config.checker) { all(tree, file, config) next() } else { queue.push([tree, file, config, next]) } }
[ "function", "transformer", "(", "tree", ",", "file", ",", "next", ")", "{", "if", "(", "loadError", ")", "{", "next", "(", "loadError", ")", "}", "else", "if", "(", "config", ".", "checker", ")", "{", "all", "(", "tree", ",", "file", ",", "config", ")", "next", "(", ")", "}", "else", "{", "queue", ".", "push", "(", "[", "tree", ",", "file", ",", "config", ",", "next", "]", ")", "}", "}" ]
Transformer which either immediately invokes `all` when everything has finished loading or queues the arguments.
[ "Transformer", "which", "either", "immediately", "invokes", "all", "when", "everything", "has", "finished", "loading", "or", "queues", "the", "arguments", "." ]
8f18babff9f12705c2113c34018ac576d044fd23
https://github.com/retextjs/retext-spell/blob/8f18babff9f12705c2113c34018ac576d044fd23/index.js#L51-L60
20,409
retextjs/retext-spell
index.js
all
function all(tree, file, config) { var ignore = config.ignore var ignoreLiteral = config.ignoreLiteral var ignoreDigits = config.ignoreDigits var apos = config.normalizeApostrophes var checker = config.checker var cache = config.cache visit(tree, 'WordNode', checkWord) // Check one word. function checkWord(node, position, parent) { var children = node.children var word = toString(node) var correct var length var index var child var reason var message var suggestions if (ignoreLiteral && isLiteral(parent, position)) { return } if (apos) { word = word.replace(smart, straight) } if (irrelevant(word)) { return } correct = checker.correct(word) if (!correct && children.length > 1) { correct = true length = children.length index = -1 while (++index < length) { child = children[index] if (child.type !== 'TextNode' || irrelevant(child.value)) { continue } if (!checker.correct(child.value)) { correct = false } } } if (!correct) { if (own.call(cache, word)) { reason = cache[word] } else { reason = quote(word, '`') + ' is misspelt' if (config.count === config.max) { message = file.message( 'Too many misspellings; no further spell suggestions are given', node, 'overflow' ) message.source = source } config.count++ if (config.count < config.max) { suggestions = checker.suggest(word) if (suggestions.length !== 0) { reason += '; did you mean ' + quote(suggestions, '`').join(', ') + '?' cache[word] = reason } } cache[word] = reason } message = file.message(reason, node, source) message.source = source message.actual = word message.expected = suggestions } } // Check if a word is irrelevant. function irrelevant(word) { return includes(ignore, word) || (ignoreDigits && digitsOnly.test(word)) } }
javascript
function all(tree, file, config) { var ignore = config.ignore var ignoreLiteral = config.ignoreLiteral var ignoreDigits = config.ignoreDigits var apos = config.normalizeApostrophes var checker = config.checker var cache = config.cache visit(tree, 'WordNode', checkWord) // Check one word. function checkWord(node, position, parent) { var children = node.children var word = toString(node) var correct var length var index var child var reason var message var suggestions if (ignoreLiteral && isLiteral(parent, position)) { return } if (apos) { word = word.replace(smart, straight) } if (irrelevant(word)) { return } correct = checker.correct(word) if (!correct && children.length > 1) { correct = true length = children.length index = -1 while (++index < length) { child = children[index] if (child.type !== 'TextNode' || irrelevant(child.value)) { continue } if (!checker.correct(child.value)) { correct = false } } } if (!correct) { if (own.call(cache, word)) { reason = cache[word] } else { reason = quote(word, '`') + ' is misspelt' if (config.count === config.max) { message = file.message( 'Too many misspellings; no further spell suggestions are given', node, 'overflow' ) message.source = source } config.count++ if (config.count < config.max) { suggestions = checker.suggest(word) if (suggestions.length !== 0) { reason += '; did you mean ' + quote(suggestions, '`').join(', ') + '?' cache[word] = reason } } cache[word] = reason } message = file.message(reason, node, source) message.source = source message.actual = word message.expected = suggestions } } // Check if a word is irrelevant. function irrelevant(word) { return includes(ignore, word) || (ignoreDigits && digitsOnly.test(word)) } }
[ "function", "all", "(", "tree", ",", "file", ",", "config", ")", "{", "var", "ignore", "=", "config", ".", "ignore", "var", "ignoreLiteral", "=", "config", ".", "ignoreLiteral", "var", "ignoreDigits", "=", "config", ".", "ignoreDigits", "var", "apos", "=", "config", ".", "normalizeApostrophes", "var", "checker", "=", "config", ".", "checker", "var", "cache", "=", "config", ".", "cache", "visit", "(", "tree", ",", "'WordNode'", ",", "checkWord", ")", "// Check one word.", "function", "checkWord", "(", "node", ",", "position", ",", "parent", ")", "{", "var", "children", "=", "node", ".", "children", "var", "word", "=", "toString", "(", "node", ")", "var", "correct", "var", "length", "var", "index", "var", "child", "var", "reason", "var", "message", "var", "suggestions", "if", "(", "ignoreLiteral", "&&", "isLiteral", "(", "parent", ",", "position", ")", ")", "{", "return", "}", "if", "(", "apos", ")", "{", "word", "=", "word", ".", "replace", "(", "smart", ",", "straight", ")", "}", "if", "(", "irrelevant", "(", "word", ")", ")", "{", "return", "}", "correct", "=", "checker", ".", "correct", "(", "word", ")", "if", "(", "!", "correct", "&&", "children", ".", "length", ">", "1", ")", "{", "correct", "=", "true", "length", "=", "children", ".", "length", "index", "=", "-", "1", "while", "(", "++", "index", "<", "length", ")", "{", "child", "=", "children", "[", "index", "]", "if", "(", "child", ".", "type", "!==", "'TextNode'", "||", "irrelevant", "(", "child", ".", "value", ")", ")", "{", "continue", "}", "if", "(", "!", "checker", ".", "correct", "(", "child", ".", "value", ")", ")", "{", "correct", "=", "false", "}", "}", "}", "if", "(", "!", "correct", ")", "{", "if", "(", "own", ".", "call", "(", "cache", ",", "word", ")", ")", "{", "reason", "=", "cache", "[", "word", "]", "}", "else", "{", "reason", "=", "quote", "(", "word", ",", "'`'", ")", "+", "' is misspelt'", "if", "(", "config", ".", "count", "===", "config", ".", "max", ")", "{", "message", "=", "file", ".", "message", "(", "'Too many misspellings; no further spell suggestions are given'", ",", "node", ",", "'overflow'", ")", "message", ".", "source", "=", "source", "}", "config", ".", "count", "++", "if", "(", "config", ".", "count", "<", "config", ".", "max", ")", "{", "suggestions", "=", "checker", ".", "suggest", "(", "word", ")", "if", "(", "suggestions", ".", "length", "!==", "0", ")", "{", "reason", "+=", "'; did you mean '", "+", "quote", "(", "suggestions", ",", "'`'", ")", ".", "join", "(", "', '", ")", "+", "'?'", "cache", "[", "word", "]", "=", "reason", "}", "}", "cache", "[", "word", "]", "=", "reason", "}", "message", "=", "file", ".", "message", "(", "reason", ",", "node", ",", "source", ")", "message", ".", "source", "=", "source", "message", ".", "actual", "=", "word", "message", ".", "expected", "=", "suggestions", "}", "}", "// Check if a word is irrelevant.", "function", "irrelevant", "(", "word", ")", "{", "return", "includes", "(", "ignore", ",", "word", ")", "||", "(", "ignoreDigits", "&&", "digitsOnly", ".", "test", "(", "word", ")", ")", "}", "}" ]
Check a file for spelling mistakes.
[ "Check", "a", "file", "for", "spelling", "mistakes", "." ]
8f18babff9f12705c2113c34018ac576d044fd23
https://github.com/retextjs/retext-spell/blob/8f18babff9f12705c2113c34018ac576d044fd23/index.js#L92-L188
20,410
stackgl/gl-vec3
clone.js
clone
function clone(a) { var out = new Float32Array(3) out[0] = a[0] out[1] = a[1] out[2] = a[2] return out }
javascript
function clone(a) { var out = new Float32Array(3) out[0] = a[0] out[1] = a[1] out[2] = a[2] return out }
[ "function", "clone", "(", "a", ")", "{", "var", "out", "=", "new", "Float32Array", "(", "3", ")", "out", "[", "0", "]", "=", "a", "[", "0", "]", "out", "[", "1", "]", "=", "a", "[", "1", "]", "out", "[", "2", "]", "=", "a", "[", "2", "]", "return", "out", "}" ]
Creates a new vec3 initialized with values from an existing vector @param {vec3} a vector to clone @returns {vec3} a new 3D vector
[ "Creates", "a", "new", "vec3", "initialized", "with", "values", "from", "an", "existing", "vector" ]
219dbe7bd23426fb921ee8f53edeb33e7a308155
https://github.com/stackgl/gl-vec3/blob/219dbe7bd23426fb921ee8f53edeb33e7a308155/clone.js#L9-L15
20,411
stackgl/gl-vec3
rotateX.js
rotateX
function rotateX(out, a, b, c){ var by = b[1] var bz = b[2] // Translate point to the origin var py = a[1] - by var pz = a[2] - bz var sc = Math.sin(c) var cc = Math.cos(c) // perform rotation and translate to correct position out[0] = a[0] out[1] = by + py * cc - pz * sc out[2] = bz + py * sc + pz * cc return out }
javascript
function rotateX(out, a, b, c){ var by = b[1] var bz = b[2] // Translate point to the origin var py = a[1] - by var pz = a[2] - bz var sc = Math.sin(c) var cc = Math.cos(c) // perform rotation and translate to correct position out[0] = a[0] out[1] = by + py * cc - pz * sc out[2] = bz + py * sc + pz * cc return out }
[ "function", "rotateX", "(", "out", ",", "a", ",", "b", ",", "c", ")", "{", "var", "by", "=", "b", "[", "1", "]", "var", "bz", "=", "b", "[", "2", "]", "// Translate point to the origin", "var", "py", "=", "a", "[", "1", "]", "-", "by", "var", "pz", "=", "a", "[", "2", "]", "-", "bz", "var", "sc", "=", "Math", ".", "sin", "(", "c", ")", "var", "cc", "=", "Math", ".", "cos", "(", "c", ")", "// perform rotation and translate to correct position", "out", "[", "0", "]", "=", "a", "[", "0", "]", "out", "[", "1", "]", "=", "by", "+", "py", "*", "cc", "-", "pz", "*", "sc", "out", "[", "2", "]", "=", "bz", "+", "py", "*", "sc", "+", "pz", "*", "cc", "return", "out", "}" ]
Rotate a 3D vector around the x-axis @param {vec3} out The receiving vec3 @param {vec3} a The vec3 point to rotate @param {vec3} b The origin of the rotation @param {Number} c The angle of rotation @returns {vec3} out
[ "Rotate", "a", "3D", "vector", "around", "the", "x", "-", "axis" ]
219dbe7bd23426fb921ee8f53edeb33e7a308155
https://github.com/stackgl/gl-vec3/blob/219dbe7bd23426fb921ee8f53edeb33e7a308155/rotateX.js#L11-L28
20,412
stackgl/gl-vec3
rotateZ.js
rotateZ
function rotateZ(out, a, b, c){ var bx = b[0] var by = b[1] //Translate point to the origin var px = a[0] - bx var py = a[1] - by var sc = Math.sin(c) var cc = Math.cos(c) // perform rotation and translate to correct position out[0] = bx + px * cc - py * sc out[1] = by + px * sc + py * cc out[2] = a[2] return out }
javascript
function rotateZ(out, a, b, c){ var bx = b[0] var by = b[1] //Translate point to the origin var px = a[0] - bx var py = a[1] - by var sc = Math.sin(c) var cc = Math.cos(c) // perform rotation and translate to correct position out[0] = bx + px * cc - py * sc out[1] = by + px * sc + py * cc out[2] = a[2] return out }
[ "function", "rotateZ", "(", "out", ",", "a", ",", "b", ",", "c", ")", "{", "var", "bx", "=", "b", "[", "0", "]", "var", "by", "=", "b", "[", "1", "]", "//Translate point to the origin", "var", "px", "=", "a", "[", "0", "]", "-", "bx", "var", "py", "=", "a", "[", "1", "]", "-", "by", "var", "sc", "=", "Math", ".", "sin", "(", "c", ")", "var", "cc", "=", "Math", ".", "cos", "(", "c", ")", "// perform rotation and translate to correct position", "out", "[", "0", "]", "=", "bx", "+", "px", "*", "cc", "-", "py", "*", "sc", "out", "[", "1", "]", "=", "by", "+", "px", "*", "sc", "+", "py", "*", "cc", "out", "[", "2", "]", "=", "a", "[", "2", "]", "return", "out", "}" ]
Rotate a 3D vector around the z-axis @param {vec3} out The receiving vec3 @param {vec3} a The vec3 point to rotate @param {vec3} b The origin of the rotation @param {Number} c The angle of rotation @returns {vec3} out
[ "Rotate", "a", "3D", "vector", "around", "the", "z", "-", "axis" ]
219dbe7bd23426fb921ee8f53edeb33e7a308155
https://github.com/stackgl/gl-vec3/blob/219dbe7bd23426fb921ee8f53edeb33e7a308155/rotateZ.js#L11-L28
20,413
stackgl/gl-vec3
negate.js
negate
function negate(out, a) { out[0] = -a[0] out[1] = -a[1] out[2] = -a[2] return out }
javascript
function negate(out, a) { out[0] = -a[0] out[1] = -a[1] out[2] = -a[2] return out }
[ "function", "negate", "(", "out", ",", "a", ")", "{", "out", "[", "0", "]", "=", "-", "a", "[", "0", "]", "out", "[", "1", "]", "=", "-", "a", "[", "1", "]", "out", "[", "2", "]", "=", "-", "a", "[", "2", "]", "return", "out", "}" ]
Negates the components of a vec3 @param {vec3} out the receiving vector @param {vec3} a vector to negate @returns {vec3} out
[ "Negates", "the", "components", "of", "a", "vec3" ]
219dbe7bd23426fb921ee8f53edeb33e7a308155
https://github.com/stackgl/gl-vec3/blob/219dbe7bd23426fb921ee8f53edeb33e7a308155/negate.js#L10-L15
20,414
stackgl/gl-vec3
rotateY.js
rotateY
function rotateY(out, a, b, c){ var bx = b[0] var bz = b[2] // translate point to the origin var px = a[0] - bx var pz = a[2] - bz var sc = Math.sin(c) var cc = Math.cos(c) // perform rotation and translate to correct position out[0] = bx + pz * sc + px * cc out[1] = a[1] out[2] = bz + pz * cc - px * sc return out }
javascript
function rotateY(out, a, b, c){ var bx = b[0] var bz = b[2] // translate point to the origin var px = a[0] - bx var pz = a[2] - bz var sc = Math.sin(c) var cc = Math.cos(c) // perform rotation and translate to correct position out[0] = bx + pz * sc + px * cc out[1] = a[1] out[2] = bz + pz * cc - px * sc return out }
[ "function", "rotateY", "(", "out", ",", "a", ",", "b", ",", "c", ")", "{", "var", "bx", "=", "b", "[", "0", "]", "var", "bz", "=", "b", "[", "2", "]", "// translate point to the origin", "var", "px", "=", "a", "[", "0", "]", "-", "bx", "var", "pz", "=", "a", "[", "2", "]", "-", "bz", "var", "sc", "=", "Math", ".", "sin", "(", "c", ")", "var", "cc", "=", "Math", ".", "cos", "(", "c", ")", "// perform rotation and translate to correct position", "out", "[", "0", "]", "=", "bx", "+", "pz", "*", "sc", "+", "px", "*", "cc", "out", "[", "1", "]", "=", "a", "[", "1", "]", "out", "[", "2", "]", "=", "bz", "+", "pz", "*", "cc", "-", "px", "*", "sc", "return", "out", "}" ]
Rotate a 3D vector around the y-axis @param {vec3} out The receiving vec3 @param {vec3} a The vec3 point to rotate @param {vec3} b The origin of the rotation @param {Number} c The angle of rotation @returns {vec3} out
[ "Rotate", "a", "3D", "vector", "around", "the", "y", "-", "axis" ]
219dbe7bd23426fb921ee8f53edeb33e7a308155
https://github.com/stackgl/gl-vec3/blob/219dbe7bd23426fb921ee8f53edeb33e7a308155/rotateY.js#L11-L28
20,415
stackgl/gl-vec3
inverse.js
inverse
function inverse(out, a) { out[0] = 1.0 / a[0] out[1] = 1.0 / a[1] out[2] = 1.0 / a[2] return out }
javascript
function inverse(out, a) { out[0] = 1.0 / a[0] out[1] = 1.0 / a[1] out[2] = 1.0 / a[2] return out }
[ "function", "inverse", "(", "out", ",", "a", ")", "{", "out", "[", "0", "]", "=", "1.0", "/", "a", "[", "0", "]", "out", "[", "1", "]", "=", "1.0", "/", "a", "[", "1", "]", "out", "[", "2", "]", "=", "1.0", "/", "a", "[", "2", "]", "return", "out", "}" ]
Returns the inverse of the components of a vec3 @param {vec3} out the receiving vector @param {vec3} a vector to invert @returns {vec3} out
[ "Returns", "the", "inverse", "of", "the", "components", "of", "a", "vec3" ]
219dbe7bd23426fb921ee8f53edeb33e7a308155
https://github.com/stackgl/gl-vec3/blob/219dbe7bd23426fb921ee8f53edeb33e7a308155/inverse.js#L10-L15
20,416
stackgl/gl-vec3
angle.js
angle
function angle(a, b) { var tempA = fromValues(a[0], a[1], a[2]) var tempB = fromValues(b[0], b[1], b[2]) normalize(tempA, tempA) normalize(tempB, tempB) var cosine = dot(tempA, tempB) if(cosine > 1.0){ return 0 } else { return Math.acos(cosine) } }
javascript
function angle(a, b) { var tempA = fromValues(a[0], a[1], a[2]) var tempB = fromValues(b[0], b[1], b[2]) normalize(tempA, tempA) normalize(tempB, tempB) var cosine = dot(tempA, tempB) if(cosine > 1.0){ return 0 } else { return Math.acos(cosine) } }
[ "function", "angle", "(", "a", ",", "b", ")", "{", "var", "tempA", "=", "fromValues", "(", "a", "[", "0", "]", ",", "a", "[", "1", "]", ",", "a", "[", "2", "]", ")", "var", "tempB", "=", "fromValues", "(", "b", "[", "0", "]", ",", "b", "[", "1", "]", ",", "b", "[", "2", "]", ")", "normalize", "(", "tempA", ",", "tempA", ")", "normalize", "(", "tempB", ",", "tempB", ")", "var", "cosine", "=", "dot", "(", "tempA", ",", "tempB", ")", "if", "(", "cosine", ">", "1.0", ")", "{", "return", "0", "}", "else", "{", "return", "Math", ".", "acos", "(", "cosine", ")", "}", "}" ]
Get the angle between two 3D vectors @param {vec3} a The first operand @param {vec3} b The second operand @returns {Number} The angle in radians
[ "Get", "the", "angle", "between", "two", "3D", "vectors" ]
219dbe7bd23426fb921ee8f53edeb33e7a308155
https://github.com/stackgl/gl-vec3/blob/219dbe7bd23426fb921ee8f53edeb33e7a308155/angle.js#L13-L27
20,417
ConsenSys/eth-signer
dist/eth-signer.min.js
se
function se(me){/* jshint maxstatements: 18 */if(!(this instanceof se))return new se(me);var ge={};if(fe.isBuffer(me))ge=se._fromBufferReader(le(me));else if(de.isObject(me)){var _e;_e=me.header instanceof ce?me.header:ce.fromObject(me.header),ge={/** * @name MerkleBlock#header * @type {BlockHeader} */header:_e,/** * @name MerkleBlock#numTransactions * @type {Number} */numTransactions:me.numTransactions,/** * @name MerkleBlock#hashes * @type {String[]} */hashes:me.hashes,/** * @name MerkleBlock#flags * @type {Number[]} */flags:me.flags}}else throw new TypeError("Unrecognized argument for MerkleBlock");return de.extend(this,ge),this._flagBitsUsed=0,this._hashesUsed=0,this}
javascript
function se(me){/* jshint maxstatements: 18 */if(!(this instanceof se))return new se(me);var ge={};if(fe.isBuffer(me))ge=se._fromBufferReader(le(me));else if(de.isObject(me)){var _e;_e=me.header instanceof ce?me.header:ce.fromObject(me.header),ge={/** * @name MerkleBlock#header * @type {BlockHeader} */header:_e,/** * @name MerkleBlock#numTransactions * @type {Number} */numTransactions:me.numTransactions,/** * @name MerkleBlock#hashes * @type {String[]} */hashes:me.hashes,/** * @name MerkleBlock#flags * @type {Number[]} */flags:me.flags}}else throw new TypeError("Unrecognized argument for MerkleBlock");return de.extend(this,ge),this._flagBitsUsed=0,this._hashesUsed=0,this}
[ "function", "se", "(", "me", ")", "{", "/* jshint maxstatements: 18 */", "if", "(", "!", "(", "this", "instanceof", "se", ")", ")", "return", "new", "se", "(", "me", ")", ";", "var", "ge", "=", "{", "}", ";", "if", "(", "fe", ".", "isBuffer", "(", "me", ")", ")", "ge", "=", "se", ".", "_fromBufferReader", "(", "le", "(", "me", ")", ")", ";", "else", "if", "(", "de", ".", "isObject", "(", "me", ")", ")", "{", "var", "_e", ";", "_e", "=", "me", ".", "header", "instanceof", "ce", "?", "me", ".", "header", ":", "ce", ".", "fromObject", "(", "me", ".", "header", ")", ",", "ge", "=", "{", "/**\n * @name MerkleBlock#header\n * @type {BlockHeader}\n */", "header", ":", "_e", ",", "/**\n * @name MerkleBlock#numTransactions\n * @type {Number}\n */", "numTransactions", ":", "me", ".", "numTransactions", ",", "/**\n * @name MerkleBlock#hashes\n * @type {String[]}\n */", "hashes", ":", "me", ".", "hashes", ",", "/**\n * @name MerkleBlock#flags\n * @type {Number[]}\n */", "flags", ":", "me", ".", "flags", "}", "}", "else", "throw", "new", "TypeError", "(", "\"Unrecognized argument for MerkleBlock\"", ")", ";", "return", "de", ".", "extend", "(", "this", ",", "ge", ")", ",", "this", ".", "_flagBitsUsed", "=", "0", ",", "this", ".", "_hashesUsed", "=", "0", ",", "this", "}" ]
Instantiate a MerkleBlock from a Buffer, JSON object, or Object with the properties of the Block @param {*} - A Buffer, JSON string, or Object representing a MerkleBlock @returns {MerkleBlock} @constructor
[ "Instantiate", "a", "MerkleBlock", "from", "a", "Buffer", "JSON", "object", "or", "Object", "with", "the", "properties", "of", "the", "Block" ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L558-L570
20,418
ConsenSys/eth-signer
dist/eth-signer.min.js
he
function he(vr,xr,Sr){for(var kr=-1,Ir=vr.criteria,Ar=xr.criteria,wr=Ir.length,Er=Sr.length,Pr;++kr<wr;)if(Pr=se(Ir[kr],Ar[kr]),Pr){if(kr>=Er)return Pr;var Br=Sr[kr];return Pr*("asc"===Br||!0===Br?1:-1)}// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications // that causes it, under certain circumstances, to provide the same value for // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 // for more details. // // This also ensures a stable sort in V8 and other engines. // See https://code.google.com/p/v8/issues/detail?id=90 for more details. return vr.index-xr.index}
javascript
function he(vr,xr,Sr){for(var kr=-1,Ir=vr.criteria,Ar=xr.criteria,wr=Ir.length,Er=Sr.length,Pr;++kr<wr;)if(Pr=se(Ir[kr],Ar[kr]),Pr){if(kr>=Er)return Pr;var Br=Sr[kr];return Pr*("asc"===Br||!0===Br?1:-1)}// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications // that causes it, under certain circumstances, to provide the same value for // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247 // for more details. // // This also ensures a stable sort in V8 and other engines. // See https://code.google.com/p/v8/issues/detail?id=90 for more details. return vr.index-xr.index}
[ "function", "he", "(", "vr", ",", "xr", ",", "Sr", ")", "{", "for", "(", "var", "kr", "=", "-", "1", ",", "Ir", "=", "vr", ".", "criteria", ",", "Ar", "=", "xr", ".", "criteria", ",", "wr", "=", "Ir", ".", "length", ",", "Er", "=", "Sr", ".", "length", ",", "Pr", ";", "++", "kr", "<", "wr", ";", ")", "if", "(", "Pr", "=", "se", "(", "Ir", "[", "kr", "]", ",", "Ar", "[", "kr", "]", ")", ",", "Pr", ")", "{", "if", "(", "kr", ">=", "Er", ")", "return", "Pr", ";", "var", "Br", "=", "Sr", "[", "kr", "]", ";", "return", "Pr", "*", "(", "\"asc\"", "===", "Br", "||", "!", "0", "===", "Br", "?", "1", ":", "-", "1", ")", "}", "// Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications", "// that causes it, under certain circumstances, to provide the same value for", "// `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247", "// for more details.", "//", "// This also ensures a stable sort in V8 and other engines.", "// See https://code.google.com/p/v8/issues/detail?id=90 for more details.", "return", "vr", ".", "index", "-", "xr", ".", "index", "}" ]
Used by `_.sortByOrder` to compare multiple properties of a value to another and stable sort them. If `orders` is unspecified, all valuess are sorted in ascending order. Otherwise, a value is sorted in ascending order if its corresponding order is "asc", and descending if "desc". @private @param {Object} object The object to compare. @param {Object} other The other object to compare. @param {boolean[]} orders The order to sort by for each property. @returns {number} Returns the sort order indicator for `object`.
[ "Used", "by", "_", ".", "sortByOrder", "to", "compare", "multiple", "properties", "of", "a", "value", "to", "another", "and", "stable", "sort", "them", "." ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L1640-L1647
20,419
ConsenSys/eth-signer
dist/eth-signer.min.js
uo
function uo(Kd,qd,Vd,Gd,Yd,Wd,Xd,Jd,Zd,Qd){function $d(){for(// Avoid `arguments` object use disqualifying optimizations by // converting it to an array before providing it to other functions. var dc=arguments.length,fc=dc,lc=Zn(dc);fc--;)lc[fc]=arguments[fc];if(Gd&&(lc=Da(lc,Gd,Yd)),Wd&&(lc=Ma(lc,Wd,Xd)),oc||ic){var pc=$d.placeholder,uc=Ae(lc,pc);if(dc-=uc.length,dc<Qd){var bc=Jd?Br(Jd):Te,hc=Gi(Qd-dc,0),mc=oc?uc:Te,gc=oc?Te:uc,_c=oc?lc:Te,vc=oc?Te:lc;qd|=oc?ze:De,qd&=~(oc?De:ze),nc||(qd&=~(Oe|Ce));var Sc=[Kd,qd,Vd,_c,mc,vc,gc,bc,Zd,hc],kc=uo.apply(Te,Sc);return Lo(Kd)&&gs(kc,Sc),kc.placeholder=pc,kc}}var Ic=rc?Vd:this,Ac=ac?Ic[Kd]:Kd;return Jd&&(lc=Ko(lc,Jd)),tc&&Zd<lc.length&&(lc.length=Zd),this&&this!==gr&&this instanceof $d&&(Ac=sc||Ya(Kd)),Ac.apply(Ic,lc)}var tc=qd&Me,rc=qd&Oe,ac=qd&Ce,oc=qd&je,nc=qd&Ne,ic=qd&Le,sc=ac?Te:Ya(Kd);return $d}
javascript
function uo(Kd,qd,Vd,Gd,Yd,Wd,Xd,Jd,Zd,Qd){function $d(){for(// Avoid `arguments` object use disqualifying optimizations by // converting it to an array before providing it to other functions. var dc=arguments.length,fc=dc,lc=Zn(dc);fc--;)lc[fc]=arguments[fc];if(Gd&&(lc=Da(lc,Gd,Yd)),Wd&&(lc=Ma(lc,Wd,Xd)),oc||ic){var pc=$d.placeholder,uc=Ae(lc,pc);if(dc-=uc.length,dc<Qd){var bc=Jd?Br(Jd):Te,hc=Gi(Qd-dc,0),mc=oc?uc:Te,gc=oc?Te:uc,_c=oc?lc:Te,vc=oc?Te:lc;qd|=oc?ze:De,qd&=~(oc?De:ze),nc||(qd&=~(Oe|Ce));var Sc=[Kd,qd,Vd,_c,mc,vc,gc,bc,Zd,hc],kc=uo.apply(Te,Sc);return Lo(Kd)&&gs(kc,Sc),kc.placeholder=pc,kc}}var Ic=rc?Vd:this,Ac=ac?Ic[Kd]:Kd;return Jd&&(lc=Ko(lc,Jd)),tc&&Zd<lc.length&&(lc.length=Zd),this&&this!==gr&&this instanceof $d&&(Ac=sc||Ya(Kd)),Ac.apply(Ic,lc)}var tc=qd&Me,rc=qd&Oe,ac=qd&Ce,oc=qd&je,nc=qd&Ne,ic=qd&Le,sc=ac?Te:Ya(Kd);return $d}
[ "function", "uo", "(", "Kd", ",", "qd", ",", "Vd", ",", "Gd", ",", "Yd", ",", "Wd", ",", "Xd", ",", "Jd", ",", "Zd", ",", "Qd", ")", "{", "function", "$d", "(", ")", "{", "for", "(", "// Avoid `arguments` object use disqualifying optimizations by", "// converting it to an array before providing it to other functions.", "var", "dc", "=", "arguments", ".", "length", ",", "fc", "=", "dc", ",", "lc", "=", "Zn", "(", "dc", ")", ";", "fc", "--", ";", ")", "lc", "[", "fc", "]", "=", "arguments", "[", "fc", "]", ";", "if", "(", "Gd", "&&", "(", "lc", "=", "Da", "(", "lc", ",", "Gd", ",", "Yd", ")", ")", ",", "Wd", "&&", "(", "lc", "=", "Ma", "(", "lc", ",", "Wd", ",", "Xd", ")", ")", ",", "oc", "||", "ic", ")", "{", "var", "pc", "=", "$d", ".", "placeholder", ",", "uc", "=", "Ae", "(", "lc", ",", "pc", ")", ";", "if", "(", "dc", "-=", "uc", ".", "length", ",", "dc", "<", "Qd", ")", "{", "var", "bc", "=", "Jd", "?", "Br", "(", "Jd", ")", ":", "Te", ",", "hc", "=", "Gi", "(", "Qd", "-", "dc", ",", "0", ")", ",", "mc", "=", "oc", "?", "uc", ":", "Te", ",", "gc", "=", "oc", "?", "Te", ":", "uc", ",", "_c", "=", "oc", "?", "lc", ":", "Te", ",", "vc", "=", "oc", "?", "Te", ":", "lc", ";", "qd", "|=", "oc", "?", "ze", ":", "De", ",", "qd", "&=", "~", "(", "oc", "?", "De", ":", "ze", ")", ",", "nc", "||", "(", "qd", "&=", "~", "(", "Oe", "|", "Ce", ")", ")", ";", "var", "Sc", "=", "[", "Kd", ",", "qd", ",", "Vd", ",", "_c", ",", "mc", ",", "vc", ",", "gc", ",", "bc", ",", "Zd", ",", "hc", "]", ",", "kc", "=", "uo", ".", "apply", "(", "Te", ",", "Sc", ")", ";", "return", "Lo", "(", "Kd", ")", "&&", "gs", "(", "kc", ",", "Sc", ")", ",", "kc", ".", "placeholder", "=", "pc", ",", "kc", "}", "}", "var", "Ic", "=", "rc", "?", "Vd", ":", "this", ",", "Ac", "=", "ac", "?", "Ic", "[", "Kd", "]", ":", "Kd", ";", "return", "Jd", "&&", "(", "lc", "=", "Ko", "(", "lc", ",", "Jd", ")", ")", ",", "tc", "&&", "Zd", "<", "lc", ".", "length", "&&", "(", "lc", ".", "length", "=", "Zd", ")", ",", "this", "&&", "this", "!==", "gr", "&&", "this", "instanceof", "$d", "&&", "(", "Ac", "=", "sc", "||", "Ya", "(", "Kd", ")", ")", ",", "Ac", ".", "apply", "(", "Ic", ",", "lc", ")", "}", "var", "tc", "=", "qd", "&", "Me", ",", "rc", "=", "qd", "&", "Oe", ",", "ac", "=", "qd", "&", "Ce", ",", "oc", "=", "qd", "&", "je", ",", "nc", "=", "qd", "&", "Ne", ",", "ic", "=", "qd", "&", "Le", ",", "sc", "=", "ac", "?", "Te", ":", "Ya", "(", "Kd", ")", ";", "return", "$d", "}" ]
Creates a function that wraps `func` and invokes it with optional `this` binding of, partial application, and currying. @private @param {Function|string} func The function or method name to reference. @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. @param {*} [thisArg] The `this` binding of `func`. @param {Array} [partials] The arguments to prepend to those provided to the new function. @param {Array} [holders] The `partials` placeholder indexes. @param {Array} [partialsRight] The arguments to append to those provided to the new function. @param {Array} [holdersRight] The `partialsRight` placeholder indexes. @param {Array} [argPos] The argument positions of the new function. @param {number} [ary] The arity cap of `func`. @param {number} [arity] The arity of `func`. @returns {Function} Returns the new wrapped function.
[ "Creates", "a", "function", "that", "wraps", "func", "and", "invokes", "it", "with", "optional", "this", "binding", "of", "partial", "application", "and", "currying", "." ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L2724-L2726
20,420
ConsenSys/eth-signer
dist/eth-signer.min.js
ho
function ho(Kd,qd,Vd,Gd){function Yd(){for(// Avoid `arguments` object use disqualifying optimizations by // converting it to an array before providing it `func`. var Xd=-1,Jd=arguments.length,Zd=-1,Qd=Gd.length,$d=Zn(Qd+Jd);++Zd<Qd;)$d[Zd]=Gd[Zd];for(;Jd--;)$d[Zd++]=arguments[++Xd];var tc=this&&this!==gr&&this instanceof Yd?Wd:Kd;return tc.apply(qd&Oe?Vd:this,$d)}var Wd=Ya(Kd);return Yd}
javascript
function ho(Kd,qd,Vd,Gd){function Yd(){for(// Avoid `arguments` object use disqualifying optimizations by // converting it to an array before providing it `func`. var Xd=-1,Jd=arguments.length,Zd=-1,Qd=Gd.length,$d=Zn(Qd+Jd);++Zd<Qd;)$d[Zd]=Gd[Zd];for(;Jd--;)$d[Zd++]=arguments[++Xd];var tc=this&&this!==gr&&this instanceof Yd?Wd:Kd;return tc.apply(qd&Oe?Vd:this,$d)}var Wd=Ya(Kd);return Yd}
[ "function", "ho", "(", "Kd", ",", "qd", ",", "Vd", ",", "Gd", ")", "{", "function", "Yd", "(", ")", "{", "for", "(", "// Avoid `arguments` object use disqualifying optimizations by", "// converting it to an array before providing it `func`.", "var", "Xd", "=", "-", "1", ",", "Jd", "=", "arguments", ".", "length", ",", "Zd", "=", "-", "1", ",", "Qd", "=", "Gd", ".", "length", ",", "$d", "=", "Zn", "(", "Qd", "+", "Jd", ")", ";", "++", "Zd", "<", "Qd", ";", ")", "$d", "[", "Zd", "]", "=", "Gd", "[", "Zd", "]", ";", "for", "(", ";", "Jd", "--", ";", ")", "$d", "[", "Zd", "++", "]", "=", "arguments", "[", "++", "Xd", "]", ";", "var", "tc", "=", "this", "&&", "this", "!==", "gr", "&&", "this", "instanceof", "Yd", "?", "Wd", ":", "Kd", ";", "return", "tc", ".", "apply", "(", "qd", "&", "Oe", "?", "Vd", ":", "this", ",", "$d", ")", "}", "var", "Wd", "=", "Ya", "(", "Kd", ")", ";", "return", "Yd", "}" ]
Creates a function that wraps `func` and invokes it with the optional `this` binding of `thisArg` and the `partials` prepended to those provided to the wrapper. @private @param {Function} func The function to partially apply arguments to. @param {number} bitmask The bitmask of flags. See `createWrapper` for more details. @param {*} thisArg The `this` binding of `func`. @param {Array} partials The arguments to prepend to those provided to the new function. @returns {Function} Returns the new bound function.
[ "Creates", "a", "function", "that", "wraps", "func", "and", "invokes", "it", "with", "the", "optional", "this", "binding", "of", "thisArg", "and", "the", "partials", "prepended", "to", "those", "provided", "to", "the", "wrapper", "." ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L2746-L2748
20,421
ConsenSys/eth-signer
dist/eth-signer.min.js
be
function be(Ce,Ne,je){je.negative=Ne.negative^Ce.negative;var Le=0|Ce.length+Ne.length;je.length=Le,Le=0|Le-1;// Peel one iteration (compiler can't do it, because of code complexity) var ze=0|Ce.words[0],De=0|Ne.words[0],Me=ze*De,Ue=67108863&Me,Fe=0|Me/67108864;je.words[0]=Ue;for(var He=1;He<Le;He++){for(var Ke=Fe>>>26,qe=67108863&Fe,Ve=Math.min(He,Ne.length-1),Ge=Math.max(0,He-Ce.length+1),Ye;Ge<=Ve;Ge++)Ye=0|He-Ge,ze=0|Ce.words[Ye],De=0|Ne.words[Ge],Me=ze*De+qe,Ke+=0|Me/67108864,qe=67108863&Me;// Sum all words with the same `i + j = k` and accumulate `ncarry`, // note that ncarry could be >= 0x3ffffff je.words[He]=0|qe,Fe=0|Ke}return 0==Fe?je.length--:je.words[He]=0|Fe,je.strip()}
javascript
function be(Ce,Ne,je){je.negative=Ne.negative^Ce.negative;var Le=0|Ce.length+Ne.length;je.length=Le,Le=0|Le-1;// Peel one iteration (compiler can't do it, because of code complexity) var ze=0|Ce.words[0],De=0|Ne.words[0],Me=ze*De,Ue=67108863&Me,Fe=0|Me/67108864;je.words[0]=Ue;for(var He=1;He<Le;He++){for(var Ke=Fe>>>26,qe=67108863&Fe,Ve=Math.min(He,Ne.length-1),Ge=Math.max(0,He-Ce.length+1),Ye;Ge<=Ve;Ge++)Ye=0|He-Ge,ze=0|Ce.words[Ye],De=0|Ne.words[Ge],Me=ze*De+qe,Ke+=0|Me/67108864,qe=67108863&Me;// Sum all words with the same `i + j = k` and accumulate `ncarry`, // note that ncarry could be >= 0x3ffffff je.words[He]=0|qe,Fe=0|Ke}return 0==Fe?je.length--:je.words[He]=0|Fe,je.strip()}
[ "function", "be", "(", "Ce", ",", "Ne", ",", "je", ")", "{", "je", ".", "negative", "=", "Ne", ".", "negative", "^", "Ce", ".", "negative", ";", "var", "Le", "=", "0", "|", "Ce", ".", "length", "+", "Ne", ".", "length", ";", "je", ".", "length", "=", "Le", ",", "Le", "=", "0", "|", "Le", "-", "1", ";", "// Peel one iteration (compiler can't do it, because of code complexity)", "var", "ze", "=", "0", "|", "Ce", ".", "words", "[", "0", "]", ",", "De", "=", "0", "|", "Ne", ".", "words", "[", "0", "]", ",", "Me", "=", "ze", "*", "De", ",", "Ue", "=", "67108863", "&", "Me", ",", "Fe", "=", "0", "|", "Me", "/", "67108864", ";", "je", ".", "words", "[", "0", "]", "=", "Ue", ";", "for", "(", "var", "He", "=", "1", ";", "He", "<", "Le", ";", "He", "++", ")", "{", "for", "(", "var", "Ke", "=", "Fe", ">>>", "26", ",", "qe", "=", "67108863", "&", "Fe", ",", "Ve", "=", "Math", ".", "min", "(", "He", ",", "Ne", ".", "length", "-", "1", ")", ",", "Ge", "=", "Math", ".", "max", "(", "0", ",", "He", "-", "Ce", ".", "length", "+", "1", ")", ",", "Ye", ";", "Ge", "<=", "Ve", ";", "Ge", "++", ")", "Ye", "=", "0", "|", "He", "-", "Ge", ",", "ze", "=", "0", "|", "Ce", ".", "words", "[", "Ye", "]", ",", "De", "=", "0", "|", "Ne", ".", "words", "[", "Ge", "]", ",", "Me", "=", "ze", "*", "De", "+", "qe", ",", "Ke", "+=", "0", "|", "Me", "/", "67108864", ",", "qe", "=", "67108863", "&", "Me", ";", "// Sum all words with the same `i + j = k` and accumulate `ncarry`,", "// note that ncarry could be >= 0x3ffffff", "je", ".", "words", "[", "He", "]", "=", "0", "|", "qe", ",", "Fe", "=", "0", "|", "Ke", "}", "return", "0", "==", "Fe", "?", "je", ".", "length", "--", ":", "je", ".", "words", "[", "He", "]", "=", "0", "|", "Fe", ",", "je", ".", "strip", "(", ")", "}" ]
Number of trailing zero bits
[ "Number", "of", "trailing", "zero", "bits" ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L8346-L8349
20,422
ConsenSys/eth-signer
dist/eth-signer.min.js
function(Se){// Spawn var ke=ce(this);// Augment return Se&&ke.mixIn(Se),ke.hasOwnProperty("init")&&this.init!==ke.init||(ke.init=function(){ke.$super.init.apply(this,arguments)}),ke.init.prototype=ke,ke.$super=this,ke}
javascript
function(Se){// Spawn var ke=ce(this);// Augment return Se&&ke.mixIn(Se),ke.hasOwnProperty("init")&&this.init!==ke.init||(ke.init=function(){ke.$super.init.apply(this,arguments)}),ke.init.prototype=ke,ke.$super=this,ke}
[ "function", "(", "Se", ")", "{", "// Spawn", "var", "ke", "=", "ce", "(", "this", ")", ";", "// Augment", "return", "Se", "&&", "ke", ".", "mixIn", "(", "Se", ")", ",", "ke", ".", "hasOwnProperty", "(", "\"init\"", ")", "&&", "this", ".", "init", "!==", "ke", ".", "init", "||", "(", "ke", ".", "init", "=", "function", "(", ")", "{", "ke", ".", "$super", ".", "init", ".", "apply", "(", "this", ",", "arguments", ")", "}", ")", ",", "ke", ".", "init", ".", "prototype", "=", "ke", ",", "ke", ".", "$super", "=", "this", ",", "ke", "}" ]
Creates a new object that inherits from this object. @param {Object} overrides Properties to copy into the new object. @return {Object} The new object. @static @example var MyType = CryptoJS.lib.Base.extend({ field: 'value', method: function () { } });
[ "Creates", "a", "new", "object", "that", "inherits", "from", "this", "object", "." ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L9067-L9069
20,423
ConsenSys/eth-signer
dist/eth-signer.min.js
function(Se){// Convert for(var ke=Se.length,Ie=[],Ae=0;Ae<ke;Ae++)Ie[Ae>>>2]|=(255&Se.charCodeAt(Ae))<<24-8*(Ae%4);// Shortcut return new ue.init(Ie,ke)}
javascript
function(Se){// Convert for(var ke=Se.length,Ie=[],Ae=0;Ae<ke;Ae++)Ie[Ae>>>2]|=(255&Se.charCodeAt(Ae))<<24-8*(Ae%4);// Shortcut return new ue.init(Ie,ke)}
[ "function", "(", "Se", ")", "{", "// Convert", "for", "(", "var", "ke", "=", "Se", ".", "length", ",", "Ie", "=", "[", "]", ",", "Ae", "=", "0", ";", "Ae", "<", "ke", ";", "Ae", "++", ")", "Ie", "[", "Ae", ">>>", "2", "]", "|=", "(", "255", "&", "Se", ".", "charCodeAt", "(", "Ae", ")", ")", "<<", "24", "-", "8", "*", "(", "Ae", "%", "4", ")", ";", "// Shortcut", "return", "new", "ue", ".", "init", "(", "Ie", ",", "ke", ")", "}" ]
Converts a Latin1 string to a word array. @param {string} latin1Str The Latin1 string. @return {WordArray} The word array. @static @example var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
[ "Converts", "a", "Latin1", "string", "to", "a", "word", "array", "." ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L9231-L9233
20,424
ConsenSys/eth-signer
dist/eth-signer.min.js
function(pe){// Shortcuts var ue=pe.words,be=pe.sigBytes,he=this._map;pe.clamp();for(var me=[],ge=0;ge<be;ge+=3)for(var _e=255&ue[ge>>>2]>>>24-8*(ge%4),ve=255&ue[ge+1>>>2]>>>24-8*((ge+1)%4),Se=255&ue[ge+2>>>2]>>>24-8*((ge+2)%4),ke=0;4>ke&&ge+0.75*ke<be;ke++)me.push(he.charAt(63&(_e<<16|ve<<8|Se)>>>6*(3-ke)));// Add padding var Ie=he.charAt(64);if(Ie)for(;me.length%4;)me.push(Ie);return me.join("")}
javascript
function(pe){// Shortcuts var ue=pe.words,be=pe.sigBytes,he=this._map;pe.clamp();for(var me=[],ge=0;ge<be;ge+=3)for(var _e=255&ue[ge>>>2]>>>24-8*(ge%4),ve=255&ue[ge+1>>>2]>>>24-8*((ge+1)%4),Se=255&ue[ge+2>>>2]>>>24-8*((ge+2)%4),ke=0;4>ke&&ge+0.75*ke<be;ke++)me.push(he.charAt(63&(_e<<16|ve<<8|Se)>>>6*(3-ke)));// Add padding var Ie=he.charAt(64);if(Ie)for(;me.length%4;)me.push(Ie);return me.join("")}
[ "function", "(", "pe", ")", "{", "// Shortcuts", "var", "ue", "=", "pe", ".", "words", ",", "be", "=", "pe", ".", "sigBytes", ",", "he", "=", "this", ".", "_map", ";", "pe", ".", "clamp", "(", ")", ";", "for", "(", "var", "me", "=", "[", "]", ",", "ge", "=", "0", ";", "ge", "<", "be", ";", "ge", "+=", "3", ")", "for", "(", "var", "_e", "=", "255", "&", "ue", "[", "ge", ">>>", "2", "]", ">>>", "24", "-", "8", "*", "(", "ge", "%", "4", ")", ",", "ve", "=", "255", "&", "ue", "[", "ge", "+", "1", ">>>", "2", "]", ">>>", "24", "-", "8", "*", "(", "(", "ge", "+", "1", ")", "%", "4", ")", ",", "Se", "=", "255", "&", "ue", "[", "ge", "+", "2", ">>>", "2", "]", ">>>", "24", "-", "8", "*", "(", "(", "ge", "+", "2", ")", "%", "4", ")", ",", "ke", "=", "0", ";", "4", ">", "ke", "&&", "ge", "+", "0.75", "*", "ke", "<", "be", ";", "ke", "++", ")", "me", ".", "push", "(", "he", ".", "charAt", "(", "63", "&", "(", "_e", "<<", "16", "|", "ve", "<<", "8", "|", "Se", ")", ">>>", "6", "*", "(", "3", "-", "ke", ")", ")", ")", ";", "// Add padding", "var", "Ie", "=", "he", ".", "charAt", "(", "64", ")", ";", "if", "(", "Ie", ")", "for", "(", ";", "me", ".", "length", "%", "4", ";", ")", "me", ".", "push", "(", "Ie", ")", ";", "return", "me", ".", "join", "(", "\"\"", ")", "}" ]
Converts a word array to a Base64 string. @param {WordArray} wordArray The word array. @return {string} The Base64 string. @static @example var base64String = CryptoJS.enc.Base64.stringify(wordArray);
[ "Converts", "a", "word", "array", "to", "a", "Base64", "string", "." ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L9411-L9413
20,425
ConsenSys/eth-signer
dist/eth-signer.min.js
function(pe){// Shortcuts var ue=pe.length,be=this._map,he=this._reverseMap;if(!he){he=this._reverseMap=[];for(var me=0;me<be.length;me++)he[be.charCodeAt(me)]=me}// Ignore padding var ge=be.charAt(64);if(ge){var _e=pe.indexOf(ge);-1!==_e&&(ue=_e)}// Convert return se(pe,ue,he)}
javascript
function(pe){// Shortcuts var ue=pe.length,be=this._map,he=this._reverseMap;if(!he){he=this._reverseMap=[];for(var me=0;me<be.length;me++)he[be.charCodeAt(me)]=me}// Ignore padding var ge=be.charAt(64);if(ge){var _e=pe.indexOf(ge);-1!==_e&&(ue=_e)}// Convert return se(pe,ue,he)}
[ "function", "(", "pe", ")", "{", "// Shortcuts", "var", "ue", "=", "pe", ".", "length", ",", "be", "=", "this", ".", "_map", ",", "he", "=", "this", ".", "_reverseMap", ";", "if", "(", "!", "he", ")", "{", "he", "=", "this", ".", "_reverseMap", "=", "[", "]", ";", "for", "(", "var", "me", "=", "0", ";", "me", "<", "be", ".", "length", ";", "me", "++", ")", "he", "[", "be", ".", "charCodeAt", "(", "me", ")", "]", "=", "me", "}", "// Ignore padding", "var", "ge", "=", "be", ".", "charAt", "(", "64", ")", ";", "if", "(", "ge", ")", "{", "var", "_e", "=", "pe", ".", "indexOf", "(", "ge", ")", ";", "-", "1", "!==", "_e", "&&", "(", "ue", "=", "_e", ")", "}", "// Convert", "return", "se", "(", "pe", ",", "ue", ",", "he", ")", "}" ]
Converts a Base64 string to a word array. @param {string} base64Str The Base64 string. @return {WordArray} The word array. @static @example var wordArray = CryptoJS.enc.Base64.parse(base64String);
[ "Converts", "a", "Base64", "string", "to", "a", "word", "array", "." ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L9425-L9428
20,426
ConsenSys/eth-signer
dist/eth-signer.min.js
function(pe){// Convert for(var ue=pe.length,be=[],he=0;he<ue;he++)be[he>>>1]|=pe.charCodeAt(he)<<16-16*(he%2);// Shortcut return fe.create(be,2*ue)}
javascript
function(pe){// Convert for(var ue=pe.length,be=[],he=0;he<ue;he++)be[he>>>1]|=pe.charCodeAt(he)<<16-16*(he%2);// Shortcut return fe.create(be,2*ue)}
[ "function", "(", "pe", ")", "{", "// Convert", "for", "(", "var", "ue", "=", "pe", ".", "length", ",", "be", "=", "[", "]", ",", "he", "=", "0", ";", "he", "<", "ue", ";", "he", "++", ")", "be", "[", "he", ">>>", "1", "]", "|=", "pe", ".", "charCodeAt", "(", "he", ")", "<<", "16", "-", "16", "*", "(", "he", "%", "2", ")", ";", "// Shortcut", "return", "fe", ".", "create", "(", "be", ",", "2", "*", "ue", ")", "}" ]
Converts a UTF-16 BE string to a word array. @param {string} utf16Str The UTF-16 BE string. @return {WordArray} The word array. @static @example var wordArray = CryptoJS.enc.Utf16.parse(utf16String);
[ "Converts", "a", "UTF", "-", "16", "BE", "string", "to", "a", "word", "array", "." ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L9455-L9457
20,427
ConsenSys/eth-signer
dist/eth-signer.min.js
function(ue){// Shortcut var be=this._hasher,he=be.finalize(ue);// Compute HMAC be.reset();var me=be.finalize(this._oKey.clone().concat(he));return me}
javascript
function(ue){// Shortcut var be=this._hasher,he=be.finalize(ue);// Compute HMAC be.reset();var me=be.finalize(this._oKey.clone().concat(he));return me}
[ "function", "(", "ue", ")", "{", "// Shortcut", "var", "be", "=", "this", ".", "_hasher", ",", "he", "=", "be", ".", "finalize", "(", "ue", ")", ";", "// Compute HMAC", "be", ".", "reset", "(", ")", ";", "var", "me", "=", "be", ".", "finalize", "(", "this", ".", "_oKey", ".", "clone", "(", ")", ".", "concat", "(", "he", ")", ")", ";", "return", "me", "}" ]
Finalizes the HMAC computation. Note that the finalize operation is effectively a destructive, read-once operation. @param {WordArray|string} messageUpdate (Optional) A final message update. @return {WordArray} The HMAC. @example var hmac = hmacHasher.finalize(); var hmac = hmacHasher.finalize('message'); var hmac = hmacHasher.finalize(wordArray);
[ "Finalizes", "the", "HMAC", "computation", ".", "Note", "that", "the", "finalize", "operation", "is", "effectively", "a", "destructive", "read", "-", "once", "operation", "." ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L9597-L9599
20,428
ConsenSys/eth-signer
dist/eth-signer.min.js
me
function me(Me){// Don't use UCS-2 var Ue=[],Fe=Me.length,Ke=0,qe=Be,Ve=Pe,He,Ge,Ye,We,Xe,Je,Ze,Qe,$e,/** Cached calculation results */et;// Handle the basic code points: let `basic` be the number of input code // points before the last delimiter, or `0` if there is none, then copy // the first basic code points to the output. for(Ge=Me.lastIndexOf(Re),0>Ge&&(Ge=0),Ye=0;Ye<Ge;++Ye)128<=Me.charCodeAt(Ye)&&de("not-basic"),Ue.push(Me.charCodeAt(Ye));// Main decoding loop: start just after the last delimiter if any basic code // points were copied; start at the beginning otherwise. for(We=0<Ge?Ge+1:0;We<Fe;)/* no final expression */{// `index` is the index of the next character to be consumed. // Decode a generalized variable-length integer into `delta`, // which gets added to `i`. The overflow checking is easier // if we increase `i` as we go, then subtract off its starting // value at the end to obtain `delta`. for(Xe=Ke,Je=1,Ze=Ae;;/* no condition */Ze+=Ae){if(We>=Fe&&de("invalid-input"),Qe=ue(Me.charCodeAt(We++)),(Qe>=Ae||Qe>Le((Ie-Ke)/Je))&&de("overflow"),Ke+=Qe*Je,$e=Ze<=Ve?we:Ze>=Ve+Ee?Ee:Ze-Ve,Qe<$e)break;et=Ae-$e,Je>Le(Ie/et)&&de("overflow"),Je*=et}He=Ue.length+1,Ve=he(Ke-Xe,He,0==Xe),Le(Ke/He)>Ie-qe&&de("overflow"),qe+=Le(Ke/He),Ke%=He,Ue.splice(Ke++,0,qe)}return pe(Ue)}
javascript
function me(Me){// Don't use UCS-2 var Ue=[],Fe=Me.length,Ke=0,qe=Be,Ve=Pe,He,Ge,Ye,We,Xe,Je,Ze,Qe,$e,/** Cached calculation results */et;// Handle the basic code points: let `basic` be the number of input code // points before the last delimiter, or `0` if there is none, then copy // the first basic code points to the output. for(Ge=Me.lastIndexOf(Re),0>Ge&&(Ge=0),Ye=0;Ye<Ge;++Ye)128<=Me.charCodeAt(Ye)&&de("not-basic"),Ue.push(Me.charCodeAt(Ye));// Main decoding loop: start just after the last delimiter if any basic code // points were copied; start at the beginning otherwise. for(We=0<Ge?Ge+1:0;We<Fe;)/* no final expression */{// `index` is the index of the next character to be consumed. // Decode a generalized variable-length integer into `delta`, // which gets added to `i`. The overflow checking is easier // if we increase `i` as we go, then subtract off its starting // value at the end to obtain `delta`. for(Xe=Ke,Je=1,Ze=Ae;;/* no condition */Ze+=Ae){if(We>=Fe&&de("invalid-input"),Qe=ue(Me.charCodeAt(We++)),(Qe>=Ae||Qe>Le((Ie-Ke)/Je))&&de("overflow"),Ke+=Qe*Je,$e=Ze<=Ve?we:Ze>=Ve+Ee?Ee:Ze-Ve,Qe<$e)break;et=Ae-$e,Je>Le(Ie/et)&&de("overflow"),Je*=et}He=Ue.length+1,Ve=he(Ke-Xe,He,0==Xe),Le(Ke/He)>Ie-qe&&de("overflow"),qe+=Le(Ke/He),Ke%=He,Ue.splice(Ke++,0,qe)}return pe(Ue)}
[ "function", "me", "(", "Me", ")", "{", "// Don't use UCS-2", "var", "Ue", "=", "[", "]", ",", "Fe", "=", "Me", ".", "length", ",", "Ke", "=", "0", ",", "qe", "=", "Be", ",", "Ve", "=", "Pe", ",", "He", ",", "Ge", ",", "Ye", ",", "We", ",", "Xe", ",", "Je", ",", "Ze", ",", "Qe", ",", "$e", ",", "/** Cached calculation results */", "et", ";", "// Handle the basic code points: let `basic` be the number of input code", "// points before the last delimiter, or `0` if there is none, then copy", "// the first basic code points to the output.", "for", "(", "Ge", "=", "Me", ".", "lastIndexOf", "(", "Re", ")", ",", "0", ">", "Ge", "&&", "(", "Ge", "=", "0", ")", ",", "Ye", "=", "0", ";", "Ye", "<", "Ge", ";", "++", "Ye", ")", "128", "<=", "Me", ".", "charCodeAt", "(", "Ye", ")", "&&", "de", "(", "\"not-basic\"", ")", ",", "Ue", ".", "push", "(", "Me", ".", "charCodeAt", "(", "Ye", ")", ")", ";", "// Main decoding loop: start just after the last delimiter if any basic code", "// points were copied; start at the beginning otherwise.", "for", "(", "We", "=", "0", "<", "Ge", "?", "Ge", "+", "1", ":", "0", ";", "We", "<", "Fe", ";", ")", "/* no final expression */", "{", "// `index` is the index of the next character to be consumed.", "// Decode a generalized variable-length integer into `delta`,", "// which gets added to `i`. The overflow checking is easier", "// if we increase `i` as we go, then subtract off its starting", "// value at the end to obtain `delta`.", "for", "(", "Xe", "=", "Ke", ",", "Je", "=", "1", ",", "Ze", "=", "Ae", ";", ";", "/* no condition */", "Ze", "+=", "Ae", ")", "{", "if", "(", "We", ">=", "Fe", "&&", "de", "(", "\"invalid-input\"", ")", ",", "Qe", "=", "ue", "(", "Me", ".", "charCodeAt", "(", "We", "++", ")", ")", ",", "(", "Qe", ">=", "Ae", "||", "Qe", ">", "Le", "(", "(", "Ie", "-", "Ke", ")", "/", "Je", ")", ")", "&&", "de", "(", "\"overflow\"", ")", ",", "Ke", "+=", "Qe", "*", "Je", ",", "$e", "=", "Ze", "<=", "Ve", "?", "we", ":", "Ze", ">=", "Ve", "+", "Ee", "?", "Ee", ":", "Ze", "-", "Ve", ",", "Qe", "<", "$e", ")", "break", ";", "et", "=", "Ae", "-", "$e", ",", "Je", ">", "Le", "(", "Ie", "/", "et", ")", "&&", "de", "(", "\"overflow\"", ")", ",", "Je", "*=", "et", "}", "He", "=", "Ue", ".", "length", "+", "1", ",", "Ve", "=", "he", "(", "Ke", "-", "Xe", ",", "He", ",", "0", "==", "Xe", ")", ",", "Le", "(", "Ke", "/", "He", ")", ">", "Ie", "-", "qe", "&&", "de", "(", "\"overflow\"", ")", ",", "qe", "+=", "Le", "(", "Ke", "/", "He", ")", ",", "Ke", "%=", "He", ",", "Ue", ".", "splice", "(", "Ke", "++", ",", "0", ",", "qe", ")", "}", "return", "pe", "(", "Ue", ")", "}" ]
Converts a Punycode string of ASCII-only symbols to a string of Unicode symbols. @memberOf punycode @param {String} input The Punycode string of ASCII-only symbols. @returns {String} The resulting string of Unicode symbols.
[ "Converts", "a", "Punycode", "string", "of", "ASCII", "-", "only", "symbols", "to", "a", "string", "of", "Unicode", "symbols", "." ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L10740-L10751
20,429
ConsenSys/eth-signer
dist/eth-signer.min.js
de
function de(Me,Ue){// default options var Fe={seen:[],stylize:fe};// legacy... return 3<=arguments.length&&(Fe.depth=arguments[2]),4<=arguments.length&&(Fe.colors=arguments[3]),ve(Ue)?Fe.showHidden=Ue:Ue&&te._extend(Fe,Ue),Ae(Fe.showHidden)&&(Fe.showHidden=!1),Ae(Fe.depth)&&(Fe.depth=2),Ae(Fe.colors)&&(Fe.colors=!1),Ae(Fe.customInspect)&&(Fe.customInspect=!0),Fe.colors&&(Fe.stylize=ce),pe(Fe,Me,Fe.depth)}
javascript
function de(Me,Ue){// default options var Fe={seen:[],stylize:fe};// legacy... return 3<=arguments.length&&(Fe.depth=arguments[2]),4<=arguments.length&&(Fe.colors=arguments[3]),ve(Ue)?Fe.showHidden=Ue:Ue&&te._extend(Fe,Ue),Ae(Fe.showHidden)&&(Fe.showHidden=!1),Ae(Fe.depth)&&(Fe.depth=2),Ae(Fe.colors)&&(Fe.colors=!1),Ae(Fe.customInspect)&&(Fe.customInspect=!0),Fe.colors&&(Fe.stylize=ce),pe(Fe,Me,Fe.depth)}
[ "function", "de", "(", "Me", ",", "Ue", ")", "{", "// default options", "var", "Fe", "=", "{", "seen", ":", "[", "]", ",", "stylize", ":", "fe", "}", ";", "// legacy...", "return", "3", "<=", "arguments", ".", "length", "&&", "(", "Fe", ".", "depth", "=", "arguments", "[", "2", "]", ")", ",", "4", "<=", "arguments", ".", "length", "&&", "(", "Fe", ".", "colors", "=", "arguments", "[", "3", "]", ")", ",", "ve", "(", "Ue", ")", "?", "Fe", ".", "showHidden", "=", "Ue", ":", "Ue", "&&", "te", ".", "_extend", "(", "Fe", ",", "Ue", ")", ",", "Ae", "(", "Fe", ".", "showHidden", ")", "&&", "(", "Fe", ".", "showHidden", "=", "!", "1", ")", ",", "Ae", "(", "Fe", ".", "depth", ")", "&&", "(", "Fe", ".", "depth", "=", "2", ")", ",", "Ae", "(", "Fe", ".", "colors", ")", "&&", "(", "Fe", ".", "colors", "=", "!", "1", ")", ",", "Ae", "(", "Fe", ".", "customInspect", ")", "&&", "(", "Fe", ".", "customInspect", "=", "!", "0", ")", ",", "Fe", ".", "colors", "&&", "(", "Fe", ".", "stylize", "=", "ce", ")", ",", "pe", "(", "Fe", ",", "Me", ",", "Fe", ".", "depth", ")", "}" ]
Echos the value of a value. Trys to print the value out in the best way possible given the different types. @param {Object} obj The object to print out. @param {Object} opts Optional options object that alters the output. /* legacy: obj, showHidden, depth, colors
[ "Echos", "the", "value", "of", "a", "value", ".", "Trys", "to", "print", "the", "value", "out", "in", "the", "best", "way", "possible", "given", "the", "different", "types", "." ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/dist/eth-signer.min.js#L12905-L12907
20,430
ConsenSys/eth-signer
lib/proxy_signer.js
function(proxy_address, signer, controller_address) { this.proxy_address = proxy_address; this.controller_address = controller_address || proxy_address; this.signer = signer; }
javascript
function(proxy_address, signer, controller_address) { this.proxy_address = proxy_address; this.controller_address = controller_address || proxy_address; this.signer = signer; }
[ "function", "(", "proxy_address", ",", "signer", ",", "controller_address", ")", "{", "this", ".", "proxy_address", "=", "proxy_address", ";", "this", ".", "controller_address", "=", "controller_address", "||", "proxy_address", ";", "this", ".", "signer", "=", "signer", ";", "}" ]
Simple unencrypted signer, not to be used in the browser
[ "Simple", "unencrypted", "signer", "not", "to", "be", "used", "in", "the", "browser" ]
3490546d865a0ec69e5cfd518b9fe1f1a76eba3a
https://github.com/ConsenSys/eth-signer/blob/3490546d865a0ec69e5cfd518b9fe1f1a76eba3a/lib/proxy_signer.js#L11-L15
20,431
terasum/js-mdict
lib/common.js
uint16BEtoNumber
function uint16BEtoNumber(bytes) { var n = 0; for (var i = 0; i < 1; i++) { n |= bytes[i]; n <<= 8; } n |= bytes[1]; return n; }
javascript
function uint16BEtoNumber(bytes) { var n = 0; for (var i = 0; i < 1; i++) { n |= bytes[i]; n <<= 8; } n |= bytes[1]; return n; }
[ "function", "uint16BEtoNumber", "(", "bytes", ")", "{", "var", "n", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "1", ";", "i", "++", ")", "{", "n", "|=", "bytes", "[", "i", "]", ";", "n", "<<=", "8", ";", "}", "n", "|=", "bytes", "[", "1", "]", ";", "return", "n", ";", "}" ]
read in uint16BE Bytes return uint16 number @param {Buffer} bytes Big-endian byte buffer
[ "read", "in", "uint16BE", "Bytes", "return", "uint16", "number" ]
d73f12510689a9e96792ed01763dc03723b64a51
https://github.com/terasum/js-mdict/blob/d73f12510689a9e96792ed01763dc03723b64a51/lib/common.js#L121-L129
20,432
terasum/js-mdict
lib/common.js
readNumber
function readNumber(bf, numfmt) { var value = new Uint8Array(bf); if (numfmt === NUMFMT_UINT32) { // uint32 return uint32BEtoNumber(value); } else if (numfmt === NUMFMT_UINT64) { // uint64 return uint64BEtoNumber(value); } else if (numfmt === NUMFMT_UINT16) { // uint16 return uint16BEtoNumber(value); } else if (numfmt === NUMFMT_UINT8) { // uint8 return uint8BEtoNumber(value); } return 0; // return struct.unpack(this._number_format, bf)[0]; }
javascript
function readNumber(bf, numfmt) { var value = new Uint8Array(bf); if (numfmt === NUMFMT_UINT32) { // uint32 return uint32BEtoNumber(value); } else if (numfmt === NUMFMT_UINT64) { // uint64 return uint64BEtoNumber(value); } else if (numfmt === NUMFMT_UINT16) { // uint16 return uint16BEtoNumber(value); } else if (numfmt === NUMFMT_UINT8) { // uint8 return uint8BEtoNumber(value); } return 0; // return struct.unpack(this._number_format, bf)[0]; }
[ "function", "readNumber", "(", "bf", ",", "numfmt", ")", "{", "var", "value", "=", "new", "Uint8Array", "(", "bf", ")", ";", "if", "(", "numfmt", "===", "NUMFMT_UINT32", ")", "{", "// uint32", "return", "uint32BEtoNumber", "(", "value", ")", ";", "}", "else", "if", "(", "numfmt", "===", "NUMFMT_UINT64", ")", "{", "// uint64", "return", "uint64BEtoNumber", "(", "value", ")", ";", "}", "else", "if", "(", "numfmt", "===", "NUMFMT_UINT16", ")", "{", "// uint16", "return", "uint16BEtoNumber", "(", "value", ")", ";", "}", "else", "if", "(", "numfmt", "===", "NUMFMT_UINT8", ")", "{", "// uint8", "return", "uint8BEtoNumber", "(", "value", ")", ";", "}", "return", "0", ";", "// return struct.unpack(this._number_format, bf)[0];", "}" ]
read number from buffer @param {BufferList} bf number buffer @param {string} numfmt number format
[ "read", "number", "from", "buffer" ]
d73f12510689a9e96792ed01763dc03723b64a51
https://github.com/terasum/js-mdict/blob/d73f12510689a9e96792ed01763dc03723b64a51/lib/common.js#L178-L196
20,433
terasum/js-mdict
lib/common.js
appendBuffer
function appendBuffer(buffer1, buffer2) { var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength); tmp.set(new Uint8Array(buffer1), 0); tmp.set(new Uint8Array(buffer2), buffer1.byteLength); return tmp.buffer; }
javascript
function appendBuffer(buffer1, buffer2) { var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength); tmp.set(new Uint8Array(buffer1), 0); tmp.set(new Uint8Array(buffer2), buffer1.byteLength); return tmp.buffer; }
[ "function", "appendBuffer", "(", "buffer1", ",", "buffer2", ")", "{", "var", "tmp", "=", "new", "Uint8Array", "(", "buffer1", ".", "byteLength", "+", "buffer2", ".", "byteLength", ")", ";", "tmp", ".", "set", "(", "new", "Uint8Array", "(", "buffer1", ")", ",", "0", ")", ";", "tmp", ".", "set", "(", "new", "Uint8Array", "(", "buffer2", ")", ",", "buffer1", ".", "byteLength", ")", ";", "return", "tmp", ".", "buffer", ";", "}" ]
Creates a new Uint8Array based on two different ArrayBuffers @param {ArrayBuffers} buffer1 The first buffer. @param {ArrayBuffers} buffer2 The second buffer. @return {ArrayBuffers} The new ArrayBuffer created out of the two.
[ "Creates", "a", "new", "Uint8Array", "based", "on", "two", "different", "ArrayBuffers" ]
d73f12510689a9e96792ed01763dc03723b64a51
https://github.com/terasum/js-mdict/blob/d73f12510689a9e96792ed01763dc03723b64a51/lib/common.js#L232-L237
20,434
terasum/js-mdict
src/ripemd128.js
concat
function concat(a, b) { if (!a && !b) throw new Error("Please specify valid arguments for parameters a and b."); if (!b || b.length === 0) return a; if (!a || a.length === 0) return b; const c = new a.constructor(a.length + b.length); c.set(a); c.set(b, a.length); return c; }
javascript
function concat(a, b) { if (!a && !b) throw new Error("Please specify valid arguments for parameters a and b."); if (!b || b.length === 0) return a; if (!a || a.length === 0) return b; const c = new a.constructor(a.length + b.length); c.set(a); c.set(b, a.length); return c; }
[ "function", "concat", "(", "a", ",", "b", ")", "{", "if", "(", "!", "a", "&&", "!", "b", ")", "throw", "new", "Error", "(", "\"Please specify valid arguments for parameters a and b.\"", ")", ";", "if", "(", "!", "b", "||", "b", ".", "length", "===", "0", ")", "return", "a", ";", "if", "(", "!", "a", "||", "a", ".", "length", "===", "0", ")", "return", "b", ";", "const", "c", "=", "new", "a", ".", "constructor", "(", "a", ".", "length", "+", "b", ".", "length", ")", ";", "c", ".", "set", "(", "a", ")", ";", "c", ".", "set", "(", "b", ",", "a", ".", "length", ")", ";", "return", "c", ";", "}" ]
concat 2 typed array
[ "concat", "2", "typed", "array" ]
d73f12510689a9e96792ed01763dc03723b64a51
https://github.com/terasum/js-mdict/blob/d73f12510689a9e96792ed01763dc03723b64a51/src/ripemd128.js#L23-L31
20,435
wix-incubator/wix-hive-node
lib/schemas/hotels/HotelPurchaseFailedSchema.js
Name
function Name() { /** * The prefix value * @member */ this.prefix = null; /** * The first value * @member */ this.first = null; /** * The middle value * @member */ this.middle = null; /** * The last value * @member */ this.last = null; /** * The suffix value * @member */ this.suffix = null; }
javascript
function Name() { /** * The prefix value * @member */ this.prefix = null; /** * The first value * @member */ this.first = null; /** * The middle value * @member */ this.middle = null; /** * The last value * @member */ this.last = null; /** * The suffix value * @member */ this.suffix = null; }
[ "function", "Name", "(", ")", "{", "/**\n * The prefix value\n * @member\n */", "this", ".", "prefix", "=", "null", ";", "/**\n * The first value\n * @member\n */", "this", ".", "first", "=", "null", ";", "/**\n * The middle value\n * @member\n */", "this", ".", "middle", "=", "null", ";", "/**\n * The last value\n * @member\n */", "this", ".", "last", "=", "null", ";", "/**\n * The suffix value\n * @member\n */", "this", ".", "suffix", "=", "null", ";", "}" ]
The Name class @constructor @alias Name
[ "The", "Name", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/hotels/HotelPurchaseFailedSchema.js#L324-L351
20,436
wix-incubator/wix-hive-node
lib/schemas/hotels/HotelPurchaseFailedSchema.js
Customer
function Customer() { /** * The contactId value * @member */ this.contactId = null; /** * The isGuest value * @member */ this.isGuest = null; /** * The name of value * @member * @type { Name } */ this.name = Object.create(Name.prototype); /** * The phone value * @member */ this.phone = null; /** * The email value * @member */ this.email = null; }
javascript
function Customer() { /** * The contactId value * @member */ this.contactId = null; /** * The isGuest value * @member */ this.isGuest = null; /** * The name of value * @member * @type { Name } */ this.name = Object.create(Name.prototype); /** * The phone value * @member */ this.phone = null; /** * The email value * @member */ this.email = null; }
[ "function", "Customer", "(", ")", "{", "/**\n * The contactId value\n * @member\n */", "this", ".", "contactId", "=", "null", ";", "/**\n * The isGuest value\n * @member\n */", "this", ".", "isGuest", "=", "null", ";", "/**\n * The name of value\n * @member\n * @type { Name }\n */", "this", ".", "name", "=", "Object", ".", "create", "(", "Name", ".", "prototype", ")", ";", "/**\n * The phone value\n * @member\n */", "this", ".", "phone", "=", "null", ";", "/**\n * The email value\n * @member\n */", "this", ".", "email", "=", "null", ";", "}" ]
The Customer class @constructor @alias Customer
[ "The", "Customer", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/hotels/HotelPurchaseFailedSchema.js#L398-L426
20,437
wix-incubator/wix-hive-node
lib/schemas/hotels/HotelPurchaseFailedSchema.js
HotelPurchaseFailedSchema
function HotelPurchaseFailedSchema() { /** * The reservationId value * @member */ this.reservationId = null; /** * The guests of value * @member * @type { Guests } */ this.guests = Object.create(Guests.prototype); /** * The stay of value * @member * @type { Stay } */ this.stay = Object.create(Stay.prototype); /** * The payment of value * @member * @type { Payment } */ this.payment = Object.create(Payment.prototype); /** * The customer of value * @member * @type { Customer } */ this.customer = Object.create(Customer.prototype); }
javascript
function HotelPurchaseFailedSchema() { /** * The reservationId value * @member */ this.reservationId = null; /** * The guests of value * @member * @type { Guests } */ this.guests = Object.create(Guests.prototype); /** * The stay of value * @member * @type { Stay } */ this.stay = Object.create(Stay.prototype); /** * The payment of value * @member * @type { Payment } */ this.payment = Object.create(Payment.prototype); /** * The customer of value * @member * @type { Customer } */ this.customer = Object.create(Customer.prototype); }
[ "function", "HotelPurchaseFailedSchema", "(", ")", "{", "/**\n * The reservationId value\n * @member\n */", "this", ".", "reservationId", "=", "null", ";", "/**\n * The guests of value\n * @member\n * @type { Guests }\n */", "this", ".", "guests", "=", "Object", ".", "create", "(", "Guests", ".", "prototype", ")", ";", "/**\n * The stay of value\n * @member\n * @type { Stay }\n */", "this", ".", "stay", "=", "Object", ".", "create", "(", "Stay", ".", "prototype", ")", ";", "/**\n * The payment of value\n * @member\n * @type { Payment }\n */", "this", ".", "payment", "=", "Object", ".", "create", "(", "Payment", ".", "prototype", ")", ";", "/**\n * The customer of value\n * @member\n * @type { Customer }\n */", "this", ".", "customer", "=", "Object", ".", "create", "(", "Customer", ".", "prototype", ")", ";", "}" ]
The HotelPurchaseFailedSchema class @constructor @alias HotelPurchaseFailedSchema
[ "The", "HotelPurchaseFailedSchema", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/hotels/HotelPurchaseFailedSchema.js#L569-L600
20,438
wix-incubator/wix-hive-node
lib/WixConnect.js
function(instance, secret, validator) { // spilt the instance into signature and data if (instance === null || typeof secret !== 'string' || instance.split('.').length !== 2) { throw { name: "WixSignatureException", message: "Missing instance or secret key" } } var pair = instance.split('.'); var signature = new Buffer(pair[0], 'base64'); // sign the data using hmac-sha1-256 var data = pair[1]; var newSignature = signData(secret, data); if (toBase64Safe(signature) !== newSignature.toString()) { throw { name: "WixSignatureException", message: "Signatures do not match, requester is most likely not Wix" }; } var jsonData = JSON.parse(new Buffer(fromBase64Safe(data), 'base64').toString('utf8')); if (typeof validator !== 'function') { validator = function (date) { return (Date.now() - date.getTime()) <= (1000 * 60 * 60 * 24 * 2); // 2 days }; } if (validator(new Date(jsonData.signDate))) { return jsonData; } throw { name: "WixSignatureException", message: "Signatures date has expired" }; }
javascript
function(instance, secret, validator) { // spilt the instance into signature and data if (instance === null || typeof secret !== 'string' || instance.split('.').length !== 2) { throw { name: "WixSignatureException", message: "Missing instance or secret key" } } var pair = instance.split('.'); var signature = new Buffer(pair[0], 'base64'); // sign the data using hmac-sha1-256 var data = pair[1]; var newSignature = signData(secret, data); if (toBase64Safe(signature) !== newSignature.toString()) { throw { name: "WixSignatureException", message: "Signatures do not match, requester is most likely not Wix" }; } var jsonData = JSON.parse(new Buffer(fromBase64Safe(data), 'base64').toString('utf8')); if (typeof validator !== 'function') { validator = function (date) { return (Date.now() - date.getTime()) <= (1000 * 60 * 60 * 24 * 2); // 2 days }; } if (validator(new Date(jsonData.signDate))) { return jsonData; } throw { name: "WixSignatureException", message: "Signatures date has expired" }; }
[ "function", "(", "instance", ",", "secret", ",", "validator", ")", "{", "// spilt the instance into signature and data", "if", "(", "instance", "===", "null", "||", "typeof", "secret", "!==", "'string'", "||", "instance", ".", "split", "(", "'.'", ")", ".", "length", "!==", "2", ")", "{", "throw", "{", "name", ":", "\"WixSignatureException\"", ",", "message", ":", "\"Missing instance or secret key\"", "}", "}", "var", "pair", "=", "instance", ".", "split", "(", "'.'", ")", ";", "var", "signature", "=", "new", "Buffer", "(", "pair", "[", "0", "]", ",", "'base64'", ")", ";", "// sign the data using hmac-sha1-256", "var", "data", "=", "pair", "[", "1", "]", ";", "var", "newSignature", "=", "signData", "(", "secret", ",", "data", ")", ";", "if", "(", "toBase64Safe", "(", "signature", ")", "!==", "newSignature", ".", "toString", "(", ")", ")", "{", "throw", "{", "name", ":", "\"WixSignatureException\"", ",", "message", ":", "\"Signatures do not match, requester is most likely not Wix\"", "}", ";", "}", "var", "jsonData", "=", "JSON", ".", "parse", "(", "new", "Buffer", "(", "fromBase64Safe", "(", "data", ")", ",", "'base64'", ")", ".", "toString", "(", "'utf8'", ")", ")", ";", "if", "(", "typeof", "validator", "!==", "'function'", ")", "{", "validator", "=", "function", "(", "date", ")", "{", "return", "(", "Date", ".", "now", "(", ")", "-", "date", ".", "getTime", "(", ")", ")", "<=", "(", "1000", "*", "60", "*", "60", "*", "24", "*", "2", ")", ";", "// 2 days", "}", ";", "}", "if", "(", "validator", "(", "new", "Date", "(", "jsonData", ".", "signDate", ")", ")", ")", "{", "return", "jsonData", ";", "}", "throw", "{", "name", ":", "\"WixSignatureException\"", ",", "message", ":", "\"Signatures date has expired\"", "}", ";", "}" ]
Parses a Wix instance and verifies the data. Either returns an object or throws an exception @static @param {string} instance - the instance parameter sent by Wix @param {string} secret - your application's secret key @param {?module:Wix/Connect~WixDateValidator} validator - an optional data validator @returns {module:Wix/Connect.WixInstanceData} - a JSON object containing information from Wix about the requester @throws an exception if signatures don't match
[ "Parses", "a", "Wix", "instance", "and", "verifies", "the", "data", ".", "Either", "returns", "an", "object", "or", "throws", "an", "exception" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixConnect.js#L225-L260
20,439
wix-incubator/wix-hive-node
lib/schemas/messaging/SendSchema.js
Recipient
function Recipient() { /** * The method value * @member */ this.method = null; /** * The destination of value * @member * @type { Destination } */ this.destination = Object.create(Destination.prototype); /** * The contactId value * @member */ this.contactId = null; }
javascript
function Recipient() { /** * The method value * @member */ this.method = null; /** * The destination of value * @member * @type { Destination } */ this.destination = Object.create(Destination.prototype); /** * The contactId value * @member */ this.contactId = null; }
[ "function", "Recipient", "(", ")", "{", "/**\n * The method value\n * @member\n */", "this", ".", "method", "=", "null", ";", "/**\n * The destination of value\n * @member\n * @type { Destination }\n */", "this", ".", "destination", "=", "Object", ".", "create", "(", "Destination", ".", "prototype", ")", ";", "/**\n * The contactId value\n * @member\n */", "this", ".", "contactId", "=", "null", ";", "}" ]
The Recipient class @constructor @alias Recipient
[ "The", "Recipient", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/messaging/SendSchema.js#L115-L133
20,440
wix-incubator/wix-hive-node
lib/schemas/messaging/SendSchema.js
SendSchema
function SendSchema() { /** * The recipient of value * @member * @type { Recipient } */ this.recipient = Object.create(Recipient.prototype); /** * The messageId value * @member */ this.messageId = null; /** * The conversionTarget of value * @member * @type { ConversionTarget } */ this.conversionTarget = Object.create(ConversionTarget.prototype); }
javascript
function SendSchema() { /** * The recipient of value * @member * @type { Recipient } */ this.recipient = Object.create(Recipient.prototype); /** * The messageId value * @member */ this.messageId = null; /** * The conversionTarget of value * @member * @type { ConversionTarget } */ this.conversionTarget = Object.create(ConversionTarget.prototype); }
[ "function", "SendSchema", "(", ")", "{", "/**\n * The recipient of value\n * @member\n * @type { Recipient }\n */", "this", ".", "recipient", "=", "Object", ".", "create", "(", "Recipient", ".", "prototype", ")", ";", "/**\n * The messageId value\n * @member\n */", "this", ".", "messageId", "=", "null", ";", "/**\n * The conversionTarget of value\n * @member\n * @type { ConversionTarget }\n */", "this", ".", "conversionTarget", "=", "Object", ".", "create", "(", "ConversionTarget", ".", "prototype", ")", ";", "}" ]
The SendSchema class @constructor @alias SendSchema
[ "The", "SendSchema", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/messaging/SendSchema.js#L238-L257
20,441
wix-incubator/wix-hive-node
lib/schemas/hotels/HotelConfirmationSchema.js
HotelConfirmationSchema
function HotelConfirmationSchema() { /** * The source value * @member */ this.source = null; /** * The reservationId value * @member */ this.reservationId = null; /** * The guests of value * @member * @type { Guests } */ this.guests = Object.create(Guests.prototype); /** * The stay of value * @member * @type { Stay } */ this.stay = Object.create(Stay.prototype); /** * The invoice of value * @member * @type { Invoice } */ this.invoice = Object.create(Invoice.prototype); /** * The customer of value * @member * @type { Customer } */ this.customer = Object.create(Customer.prototype); }
javascript
function HotelConfirmationSchema() { /** * The source value * @member */ this.source = null; /** * The reservationId value * @member */ this.reservationId = null; /** * The guests of value * @member * @type { Guests } */ this.guests = Object.create(Guests.prototype); /** * The stay of value * @member * @type { Stay } */ this.stay = Object.create(Stay.prototype); /** * The invoice of value * @member * @type { Invoice } */ this.invoice = Object.create(Invoice.prototype); /** * The customer of value * @member * @type { Customer } */ this.customer = Object.create(Customer.prototype); }
[ "function", "HotelConfirmationSchema", "(", ")", "{", "/**\n * The source value\n * @member\n */", "this", ".", "source", "=", "null", ";", "/**\n * The reservationId value\n * @member\n */", "this", ".", "reservationId", "=", "null", ";", "/**\n * The guests of value\n * @member\n * @type { Guests }\n */", "this", ".", "guests", "=", "Object", ".", "create", "(", "Guests", ".", "prototype", ")", ";", "/**\n * The stay of value\n * @member\n * @type { Stay }\n */", "this", ".", "stay", "=", "Object", ".", "create", "(", "Stay", ".", "prototype", ")", ";", "/**\n * The invoice of value\n * @member\n * @type { Invoice }\n */", "this", ".", "invoice", "=", "Object", ".", "create", "(", "Invoice", ".", "prototype", ")", ";", "/**\n * The customer of value\n * @member\n * @type { Customer }\n */", "this", ".", "customer", "=", "Object", ".", "create", "(", "Customer", ".", "prototype", ")", ";", "}" ]
The HotelConfirmationSchema class @constructor @alias HotelConfirmationSchema
[ "The", "HotelConfirmationSchema", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/hotels/HotelConfirmationSchema.js#L515-L551
20,442
wix-incubator/wix-hive-node
lib/schemas/music/TrackPlaySchema.js
TrackPlaySchema
function TrackPlaySchema() { /** * The track of value * @member * @type { Track } */ this.track = Object.create(Track.prototype); /** * The album of value * @member * @type { Album } */ this.album = Object.create(Album.prototype); }
javascript
function TrackPlaySchema() { /** * The track of value * @member * @type { Track } */ this.track = Object.create(Track.prototype); /** * The album of value * @member * @type { Album } */ this.album = Object.create(Album.prototype); }
[ "function", "TrackPlaySchema", "(", ")", "{", "/**\n * The track of value\n * @member\n * @type { Track }\n */", "this", ".", "track", "=", "Object", ".", "create", "(", "Track", ".", "prototype", ")", ";", "/**\n * The album of value\n * @member\n * @type { Album }\n */", "this", ".", "album", "=", "Object", ".", "create", "(", "Album", ".", "prototype", ")", ";", "}" ]
The TrackPlaySchema class @constructor @alias TrackPlaySchema
[ "The", "TrackPlaySchema", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/music/TrackPlaySchema.js#L83-L97
20,443
wix-incubator/wix-hive-node
lib/schemas/music/TrackShareSchema.js
TrackShareSchema
function TrackShareSchema() { /** * The track of value * @member * @type { Track } */ this.track = Object.create(Track.prototype); /** * The album of value * @member * @type { Album } */ this.album = Object.create(Album.prototype); /** * The sharedTo value * @member */ this.sharedTo = null; }
javascript
function TrackShareSchema() { /** * The track of value * @member * @type { Track } */ this.track = Object.create(Track.prototype); /** * The album of value * @member * @type { Album } */ this.album = Object.create(Album.prototype); /** * The sharedTo value * @member */ this.sharedTo = null; }
[ "function", "TrackShareSchema", "(", ")", "{", "/**\n * The track of value\n * @member\n * @type { Track }\n */", "this", ".", "track", "=", "Object", ".", "create", "(", "Track", ".", "prototype", ")", ";", "/**\n * The album of value\n * @member\n * @type { Album }\n */", "this", ".", "album", "=", "Object", ".", "create", "(", "Album", ".", "prototype", ")", ";", "/**\n * The sharedTo value\n * @member\n */", "this", ".", "sharedTo", "=", "null", ";", "}" ]
The TrackShareSchema class @constructor @alias TrackShareSchema
[ "The", "TrackShareSchema", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/music/TrackShareSchema.js#L83-L102
20,444
wix-incubator/wix-hive-node
lib/schemas/e_commerce/PurchaseSchema.js
ItemsItem
function ItemsItem() { /** * The id value * @member */ this.id = null; /** * The sku value * @member */ this.sku = null; /** * The title value * @member */ this.title = null; /** * The quantity value * @member */ this.quantity = null; /** * The price value * @member */ this.price = null; /** * The formattedPrice value * @member */ this.formattedPrice = null; /** * The currency value * @member */ this.currency = null; /** * The productLink value * @member */ this.productLink = null; /** * The weight value * @member */ this.weight = null; /** * The formattedWeight value * @member */ this.formattedWeight = null; /** * The media of value * @member * @type { Media } */ this.media = Object.create(Media.prototype); }
javascript
function ItemsItem() { /** * The id value * @member */ this.id = null; /** * The sku value * @member */ this.sku = null; /** * The title value * @member */ this.title = null; /** * The quantity value * @member */ this.quantity = null; /** * The price value * @member */ this.price = null; /** * The formattedPrice value * @member */ this.formattedPrice = null; /** * The currency value * @member */ this.currency = null; /** * The productLink value * @member */ this.productLink = null; /** * The weight value * @member */ this.weight = null; /** * The formattedWeight value * @member */ this.formattedWeight = null; /** * The media of value * @member * @type { Media } */ this.media = Object.create(Media.prototype); }
[ "function", "ItemsItem", "(", ")", "{", "/**\n * The id value\n * @member\n */", "this", ".", "id", "=", "null", ";", "/**\n * The sku value\n * @member\n */", "this", ".", "sku", "=", "null", ";", "/**\n * The title value\n * @member\n */", "this", ".", "title", "=", "null", ";", "/**\n * The quantity value\n * @member\n */", "this", ".", "quantity", "=", "null", ";", "/**\n * The price value\n * @member\n */", "this", ".", "price", "=", "null", ";", "/**\n * The formattedPrice value\n * @member\n */", "this", ".", "formattedPrice", "=", "null", ";", "/**\n * The currency value\n * @member\n */", "this", ".", "currency", "=", "null", ";", "/**\n * The productLink value\n * @member\n */", "this", ".", "productLink", "=", "null", ";", "/**\n * The weight value\n * @member\n */", "this", ".", "weight", "=", "null", ";", "/**\n * The formattedWeight value\n * @member\n */", "this", ".", "formattedWeight", "=", "null", ";", "/**\n * The media of value\n * @member\n * @type { Media }\n */", "this", ".", "media", "=", "Object", ".", "create", "(", "Media", ".", "prototype", ")", ";", "}" ]
The ItemsItem class @constructor @alias ItemsItem
[ "The", "ItemsItem", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/e_commerce/PurchaseSchema.js#L70-L128
20,445
wix-incubator/wix-hive-node
lib/schemas/e_commerce/PurchaseSchema.js
BillingAddress
function BillingAddress() { /** * The firstName value * @member */ this.firstName = null; /** * The lastName value * @member */ this.lastName = null; /** * The email value * @member */ this.email = null; /** * The phone value * @member */ this.phone = null; /** * The country value * @member */ this.country = null; /** * The countryCode value * @member */ this.countryCode = null; /** * The region value * @member */ this.region = null; /** * The regionCode value * @member */ this.regionCode = null; /** * The city value * @member */ this.city = null; /** * The address1 value * @member */ this.address1 = null; /** * The address2 value * @member */ this.address2 = null; /** * The zip value * @member */ this.zip = null; /** * The company value * @member */ this.company = null; }
javascript
function BillingAddress() { /** * The firstName value * @member */ this.firstName = null; /** * The lastName value * @member */ this.lastName = null; /** * The email value * @member */ this.email = null; /** * The phone value * @member */ this.phone = null; /** * The country value * @member */ this.country = null; /** * The countryCode value * @member */ this.countryCode = null; /** * The region value * @member */ this.region = null; /** * The regionCode value * @member */ this.regionCode = null; /** * The city value * @member */ this.city = null; /** * The address1 value * @member */ this.address1 = null; /** * The address2 value * @member */ this.address2 = null; /** * The zip value * @member */ this.zip = null; /** * The company value * @member */ this.company = null; }
[ "function", "BillingAddress", "(", ")", "{", "/**\n * The firstName value\n * @member\n */", "this", ".", "firstName", "=", "null", ";", "/**\n * The lastName value\n * @member\n */", "this", ".", "lastName", "=", "null", ";", "/**\n * The email value\n * @member\n */", "this", ".", "email", "=", "null", ";", "/**\n * The phone value\n * @member\n */", "this", ".", "phone", "=", "null", ";", "/**\n * The country value\n * @member\n */", "this", ".", "country", "=", "null", ";", "/**\n * The countryCode value\n * @member\n */", "this", ".", "countryCode", "=", "null", ";", "/**\n * The region value\n * @member\n */", "this", ".", "region", "=", "null", ";", "/**\n * The regionCode value\n * @member\n */", "this", ".", "regionCode", "=", "null", ";", "/**\n * The city value\n * @member\n */", "this", ".", "city", "=", "null", ";", "/**\n * The address1 value\n * @member\n */", "this", ".", "address1", "=", "null", ";", "/**\n * The address2 value\n * @member\n */", "this", ".", "address2", "=", "null", ";", "/**\n * The zip value\n * @member\n */", "this", ".", "zip", "=", "null", ";", "/**\n * The company value\n * @member\n */", "this", ".", "company", "=", "null", ";", "}" ]
The BillingAddress class @constructor @alias BillingAddress
[ "The", "BillingAddress", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/e_commerce/PurchaseSchema.js#L620-L687
20,446
wix-incubator/wix-hive-node
lib/schemas/e_commerce/PurchaseSchema.js
PurchaseSchema
function PurchaseSchema() { /** * The cartId value * @member */ this.cartId = null; /** * The storeId value * @member */ this.storeId = null; /** * The orderId value * @member */ this.orderId = null; /** * The payment of value * @member * @type { Payment } */ this.payment = Object.create(Payment.prototype); /** * The shippingAddress of value * @member * @type { ShippingAddress } */ this.shippingAddress = Object.create(ShippingAddress.prototype); /** * The billingAddress of value * @member * @type { BillingAddress } */ this.billingAddress = Object.create(BillingAddress.prototype); /** * The paymentGateway value * @member */ this.paymentGateway = null; /** * The note value * @member */ this.note = null; /** * The buyerAcceptsMarketing value * @member */ this.buyerAcceptsMarketing = null; }
javascript
function PurchaseSchema() { /** * The cartId value * @member */ this.cartId = null; /** * The storeId value * @member */ this.storeId = null; /** * The orderId value * @member */ this.orderId = null; /** * The payment of value * @member * @type { Payment } */ this.payment = Object.create(Payment.prototype); /** * The shippingAddress of value * @member * @type { ShippingAddress } */ this.shippingAddress = Object.create(ShippingAddress.prototype); /** * The billingAddress of value * @member * @type { BillingAddress } */ this.billingAddress = Object.create(BillingAddress.prototype); /** * The paymentGateway value * @member */ this.paymentGateway = null; /** * The note value * @member */ this.note = null; /** * The buyerAcceptsMarketing value * @member */ this.buyerAcceptsMarketing = null; }
[ "function", "PurchaseSchema", "(", ")", "{", "/**\n * The cartId value\n * @member\n */", "this", ".", "cartId", "=", "null", ";", "/**\n * The storeId value\n * @member\n */", "this", ".", "storeId", "=", "null", ";", "/**\n * The orderId value\n * @member\n */", "this", ".", "orderId", "=", "null", ";", "/**\n * The payment of value\n * @member\n * @type { Payment }\n */", "this", ".", "payment", "=", "Object", ".", "create", "(", "Payment", ".", "prototype", ")", ";", "/**\n * The shippingAddress of value\n * @member\n * @type { ShippingAddress }\n */", "this", ".", "shippingAddress", "=", "Object", ".", "create", "(", "ShippingAddress", ".", "prototype", ")", ";", "/**\n * The billingAddress of value\n * @member\n * @type { BillingAddress }\n */", "this", ".", "billingAddress", "=", "Object", ".", "create", "(", "BillingAddress", ".", "prototype", ")", ";", "/**\n * The paymentGateway value\n * @member\n */", "this", ".", "paymentGateway", "=", "null", ";", "/**\n * The note value\n * @member\n */", "this", ".", "note", "=", "null", ";", "/**\n * The buyerAcceptsMarketing value\n * @member\n */", "this", ".", "buyerAcceptsMarketing", "=", "null", ";", "}" ]
The PurchaseSchema class @constructor @alias PurchaseSchema
[ "The", "PurchaseSchema", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/e_commerce/PurchaseSchema.js#L798-L848
20,447
wix-incubator/wix-hive-node
lib/schemas/music/TrackSkippedSchema.js
TrackSkippedSchema
function TrackSkippedSchema() { /** * The track of value * @member * @type { Track } */ this.track = Object.create(Track.prototype); /** * The album of value * @member * @type { Album } */ this.album = Object.create(Album.prototype); }
javascript
function TrackSkippedSchema() { /** * The track of value * @member * @type { Track } */ this.track = Object.create(Track.prototype); /** * The album of value * @member * @type { Album } */ this.album = Object.create(Album.prototype); }
[ "function", "TrackSkippedSchema", "(", ")", "{", "/**\n * The track of value\n * @member\n * @type { Track }\n */", "this", ".", "track", "=", "Object", ".", "create", "(", "Track", ".", "prototype", ")", ";", "/**\n * The album of value\n * @member\n * @type { Album }\n */", "this", ".", "album", "=", "Object", ".", "create", "(", "Album", ".", "prototype", ")", ";", "}" ]
The TrackSkippedSchema class @constructor @alias TrackSkippedSchema
[ "The", "TrackSkippedSchema", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/music/TrackSkippedSchema.js#L83-L97
20,448
wix-incubator/wix-hive-node
lib/schemas/contacts/ContactCreateSchema.js
AddressesItem
function AddressesItem() { /** * The tag value * @member */ this.tag = null; /** * The address value * @member */ this.address = null; /** * The neighborhood value * @member */ this.neighborhood = null; /** * The city value * @member */ this.city = null; /** * The region value * @member */ this.region = null; /** * The postalCode value * @member */ this.postalCode = null; /** * The country value * @member */ this.country = null; }
javascript
function AddressesItem() { /** * The tag value * @member */ this.tag = null; /** * The address value * @member */ this.address = null; /** * The neighborhood value * @member */ this.neighborhood = null; /** * The city value * @member */ this.city = null; /** * The region value * @member */ this.region = null; /** * The postalCode value * @member */ this.postalCode = null; /** * The country value * @member */ this.country = null; }
[ "function", "AddressesItem", "(", ")", "{", "/**\n * The tag value\n * @member\n */", "this", ".", "tag", "=", "null", ";", "/**\n * The address value\n * @member\n */", "this", ".", "address", "=", "null", ";", "/**\n * The neighborhood value\n * @member\n */", "this", ".", "neighborhood", "=", "null", ";", "/**\n * The city value\n * @member\n */", "this", ".", "city", "=", "null", ";", "/**\n * The region value\n * @member\n */", "this", ".", "region", "=", "null", ";", "/**\n * The postalCode value\n * @member\n */", "this", ".", "postalCode", "=", "null", ";", "/**\n * The country value\n * @member\n */", "this", ".", "country", "=", "null", ";", "}" ]
The AddressesItem class @constructor @alias AddressesItem
[ "The", "AddressesItem", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/contacts/ContactCreateSchema.js#L192-L229
20,449
wix-incubator/wix-hive-node
lib/schemas/contacts/ContactCreateSchema.js
ContactCreateSchema
function ContactCreateSchema() { /** * The name of value * @member * @type { Name } */ this.name = Object.create(Name.prototype); /** * The picture value * @member */ this.picture = null; /** * The company of value * @member * @type { Company } */ this.company = Object.create(Company.prototype); }
javascript
function ContactCreateSchema() { /** * The name of value * @member * @type { Name } */ this.name = Object.create(Name.prototype); /** * The picture value * @member */ this.picture = null; /** * The company of value * @member * @type { Company } */ this.company = Object.create(Company.prototype); }
[ "function", "ContactCreateSchema", "(", ")", "{", "/**\n * The name of value\n * @member\n * @type { Name }\n */", "this", ".", "name", "=", "Object", ".", "create", "(", "Name", ".", "prototype", ")", ";", "/**\n * The picture value\n * @member\n */", "this", ".", "picture", "=", "null", ";", "/**\n * The company of value\n * @member\n * @type { Company }\n */", "this", ".", "company", "=", "Object", ".", "create", "(", "Company", ".", "prototype", ")", ";", "}" ]
The ContactCreateSchema class @constructor @alias ContactCreateSchema
[ "The", "ContactCreateSchema", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/contacts/ContactCreateSchema.js#L362-L381
20,450
wix-incubator/wix-hive-node
lib/WixClient.js
WixPagingData
function WixPagingData(initialResult, wixApiCallback, dataHandler) { this.currentData = initialResult; if(dataHandler !== undefined && dataHandler !== null) { this.resultData = _.map(initialResult.results, function(elem) { return dataHandler(elem); }); } else { this.resultData = initialResult.results; } this.wixApiCallback = wixApiCallback; function canYieldData(data, mode) { if(data !== null) { var field = data.nextCursor; if(mode === 'previous') { field = data.previousCursor; } return field !== null && field !== 0; } return false; } /** * Determines if this cursor can yield additional data * @returns {boolean} */ this.hasNext = function() { return canYieldData(this.currentData, 'next'); }; /** * Determines if this cursor can yield previous data * @returns {boolean} */ this.hasPrevious = function() { return canYieldData(this.currentData, 'previous'); }; /** * Returns the next page of data for this paging collection * @returns {Promise.<WixPagingData, error>} */ this.next = function() { return this.wixApiCallback(this.currentData.nextCursor); }; /** * Returns the previous page of data for this paging collection * @returns {Promise.<WixPagingData, error>} */ this.previous = function() { return this.wixApiCallback(this.currentData.previousCursor); }; /** * Returns an array of items represented in this page of data * @returns {array} */ this.results = function() { return this.resultData; }; }
javascript
function WixPagingData(initialResult, wixApiCallback, dataHandler) { this.currentData = initialResult; if(dataHandler !== undefined && dataHandler !== null) { this.resultData = _.map(initialResult.results, function(elem) { return dataHandler(elem); }); } else { this.resultData = initialResult.results; } this.wixApiCallback = wixApiCallback; function canYieldData(data, mode) { if(data !== null) { var field = data.nextCursor; if(mode === 'previous') { field = data.previousCursor; } return field !== null && field !== 0; } return false; } /** * Determines if this cursor can yield additional data * @returns {boolean} */ this.hasNext = function() { return canYieldData(this.currentData, 'next'); }; /** * Determines if this cursor can yield previous data * @returns {boolean} */ this.hasPrevious = function() { return canYieldData(this.currentData, 'previous'); }; /** * Returns the next page of data for this paging collection * @returns {Promise.<WixPagingData, error>} */ this.next = function() { return this.wixApiCallback(this.currentData.nextCursor); }; /** * Returns the previous page of data for this paging collection * @returns {Promise.<WixPagingData, error>} */ this.previous = function() { return this.wixApiCallback(this.currentData.previousCursor); }; /** * Returns an array of items represented in this page of data * @returns {array} */ this.results = function() { return this.resultData; }; }
[ "function", "WixPagingData", "(", "initialResult", ",", "wixApiCallback", ",", "dataHandler", ")", "{", "this", ".", "currentData", "=", "initialResult", ";", "if", "(", "dataHandler", "!==", "undefined", "&&", "dataHandler", "!==", "null", ")", "{", "this", ".", "resultData", "=", "_", ".", "map", "(", "initialResult", ".", "results", ",", "function", "(", "elem", ")", "{", "return", "dataHandler", "(", "elem", ")", ";", "}", ")", ";", "}", "else", "{", "this", ".", "resultData", "=", "initialResult", ".", "results", ";", "}", "this", ".", "wixApiCallback", "=", "wixApiCallback", ";", "function", "canYieldData", "(", "data", ",", "mode", ")", "{", "if", "(", "data", "!==", "null", ")", "{", "var", "field", "=", "data", ".", "nextCursor", ";", "if", "(", "mode", "===", "'previous'", ")", "{", "field", "=", "data", ".", "previousCursor", ";", "}", "return", "field", "!==", "null", "&&", "field", "!==", "0", ";", "}", "return", "false", ";", "}", "/**\n * Determines if this cursor can yield additional data\n * @returns {boolean}\n */", "this", ".", "hasNext", "=", "function", "(", ")", "{", "return", "canYieldData", "(", "this", ".", "currentData", ",", "'next'", ")", ";", "}", ";", "/**\n * Determines if this cursor can yield previous data\n * @returns {boolean}\n */", "this", ".", "hasPrevious", "=", "function", "(", ")", "{", "return", "canYieldData", "(", "this", ".", "currentData", ",", "'previous'", ")", ";", "}", ";", "/**\n * Returns the next page of data for this paging collection\n * @returns {Promise.<WixPagingData, error>}\n */", "this", ".", "next", "=", "function", "(", ")", "{", "return", "this", ".", "wixApiCallback", "(", "this", ".", "currentData", ".", "nextCursor", ")", ";", "}", ";", "/**\n * Returns the previous page of data for this paging collection\n * @returns {Promise.<WixPagingData, error>}\n */", "this", ".", "previous", "=", "function", "(", ")", "{", "return", "this", ".", "wixApiCallback", "(", "this", ".", "currentData", ".", "previousCursor", ")", ";", "}", ";", "/**\n * Returns an array of items represented in this page of data\n * @returns {array}\n */", "this", ".", "results", "=", "function", "(", ")", "{", "return", "this", ".", "resultData", ";", "}", ";", "}" ]
A WixPagingData object is used to navigate cursored data sets returned by Wix APIs @constructor @class @alias WixPagingData
[ "A", "WixPagingData", "object", "is", "used", "to", "navigate", "cursored", "data", "sets", "returned", "by", "Wix", "APIs" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L32-L90
20,451
wix-incubator/wix-hive-node
lib/WixClient.js
WixActivityData
function WixActivityData() { /** * Information about the Activity * @typedef {Object} WixActivityData.ActivityDetails * @property {?String} additionalInfoUrl Url linking to more specific contextual information about the activity for use in the Dashboard * @property {?string} summary A short description about the activity for use in the Dashboard */ /** * The id of the Activity * @member WixActivityData#id * @type {string} */ /** * A timestamp to indicate when this Activity took place * @member * @type {Date} */ this.createdAt = new Date().toISOString(); /** * The URL where the activity was performed * @member * @type {String} */ this.activityLocationUrl = null; /** * Information about the Activity * @member * @type {WixActivityData.ActivityDetails} */ this.activityDetails = {summary : null, additionalInfoUrl : null}; /** * The type of Activity * @member * @type {string} */ this.activityType = null; /** * Schema information about the Activity * @member * @type {Object} */ this.activityInfo = null; /** * @private */ this.init = function(obj) { this.activityType = { name: obj.activityType }; this.activityDetails = obj.activityDetails; this.activityInfo = obj.activityInfo; this.id = obj.id; this.activityLocationUrl = obj.activityLocationUrl; this.createdAt = obj.createdAt; return this; }; }
javascript
function WixActivityData() { /** * Information about the Activity * @typedef {Object} WixActivityData.ActivityDetails * @property {?String} additionalInfoUrl Url linking to more specific contextual information about the activity for use in the Dashboard * @property {?string} summary A short description about the activity for use in the Dashboard */ /** * The id of the Activity * @member WixActivityData#id * @type {string} */ /** * A timestamp to indicate when this Activity took place * @member * @type {Date} */ this.createdAt = new Date().toISOString(); /** * The URL where the activity was performed * @member * @type {String} */ this.activityLocationUrl = null; /** * Information about the Activity * @member * @type {WixActivityData.ActivityDetails} */ this.activityDetails = {summary : null, additionalInfoUrl : null}; /** * The type of Activity * @member * @type {string} */ this.activityType = null; /** * Schema information about the Activity * @member * @type {Object} */ this.activityInfo = null; /** * @private */ this.init = function(obj) { this.activityType = { name: obj.activityType }; this.activityDetails = obj.activityDetails; this.activityInfo = obj.activityInfo; this.id = obj.id; this.activityLocationUrl = obj.activityLocationUrl; this.createdAt = obj.createdAt; return this; }; }
[ "function", "WixActivityData", "(", ")", "{", "/**\n * Information about the Activity\n * @typedef {Object} WixActivityData.ActivityDetails\n * @property {?String} additionalInfoUrl Url linking to more specific contextual information about the activity for use in the Dashboard\n * @property {?string} summary A short description about the activity for use in the Dashboard\n */", "/**\n * The id of the Activity\n * @member WixActivityData#id\n * @type {string}\n */", "/**\n * A timestamp to indicate when this Activity took place\n * @member\n * @type {Date}\n */", "this", ".", "createdAt", "=", "new", "Date", "(", ")", ".", "toISOString", "(", ")", ";", "/**\n * The URL where the activity was performed\n * @member\n * @type {String}\n */", "this", ".", "activityLocationUrl", "=", "null", ";", "/**\n * Information about the Activity\n * @member\n * @type {WixActivityData.ActivityDetails}\n */", "this", ".", "activityDetails", "=", "{", "summary", ":", "null", ",", "additionalInfoUrl", ":", "null", "}", ";", "/**\n * The type of Activity\n * @member\n * @type {string}\n */", "this", ".", "activityType", "=", "null", ";", "/**\n * Schema information about the Activity\n * @member\n * @type {Object}\n */", "this", ".", "activityInfo", "=", "null", ";", "/**\n * @private\n */", "this", ".", "init", "=", "function", "(", "obj", ")", "{", "this", ".", "activityType", "=", "{", "name", ":", "obj", ".", "activityType", "}", ";", "this", ".", "activityDetails", "=", "obj", ".", "activityDetails", ";", "this", ".", "activityInfo", "=", "obj", ".", "activityInfo", ";", "this", ".", "id", "=", "obj", ".", "id", ";", "this", ".", "activityLocationUrl", "=", "obj", ".", "activityLocationUrl", ";", "this", ".", "createdAt", "=", "obj", ".", "createdAt", ";", "return", "this", ";", "}", ";", "}" ]
Represents an Activity in the Wix ecosystem @constructor @alias WixActivityData @class
[ "Represents", "an", "Activity", "in", "the", "Wix", "ecosystem" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L290-L350
20,452
wix-incubator/wix-hive-node
lib/WixClient.js
WixActivity
function WixActivity() { /** * Updates to the existing contact that performed this activity. The structure of this object should match the schema for Contact, with the relevant fields updated. * @member * @type {Object} */ this.contactUpdate = schemaFactory(this.TYPES.CONTACT_CREATE.name); /** * Configures this Activity with a given type * @param {ActivityType} type the type of the Activity to create * @returns {WixActivity} */ this.withActivityType = function(type) { this.activityType = type.name; this.activityInfo = schemaFactory(type.name); return this; }; /** * Configures the activityLocationUrl of this Activity * @param {string} url The URL of the Activities location * @returns {WixActivity} */ this.withLocationUrl = function(url) { this.activityLocationUrl = url; return this; }; /** * Configures the details of this Activity * @param {string} summary A summary of this Activity * @param {string} additionalInfoUrl a link to additional information about this Activity * @returns {WixActivity} */ this.withActivityDetails = function(summary, additionalInfoUrl) { if(summary !== null && summary !== undefined) { this.activityDetails.summary = summary; } if(additionalInfoUrl !== null && additionalInfoUrl !== undefined) { this.activityDetails.additionalInfoUrl = additionalInfoUrl; } return this; }; var readOnlyTypes = [ this.TYPES.CONTACT_CREATE.name ]; this.isWritable = function() { return (readOnlyTypes.indexOf(this.activityType) == -1); }; this.isValid = function() { //TODO provide slightly better validation return this.activityLocationUrl !== null && this.activityType !== null && this.activityDetails.summary !== null && this.createdAt !== null && this.activityDetails.additionalInfoUrl !== null; }; /** * Posts the Activity to Wix. Returns a Promise for an id * @param {string} sessionToken The current session token for the active Wix site visitor * @param {Wix} wix A Wix API object * @returns {Promise.<string, error>} A new id, or an error */ this.post = function(sessionToken, wix) { return wix.Activities.postActivity(this, sessionToken); }; function removeNulls(obj){ var isArray = obj instanceof Array; for (var k in obj){ if (obj[k]===null) isArray ? obj.splice(k,1) : delete obj[k]; else if (typeof obj[k]=="object") removeNulls(obj[k]); } } this.toJSON = function() { var _this = this; removeNulls(_this.contactUpdate); removeNulls(_this.activityInfo); return { createdAt : _this.createdAt, activityType : _this.activityType, contactUpdate : _this.contactUpdate, activityLocationUrl : _this.activityLocationUrl, activityDetails : _this.activityDetails, activityInfo: _this.activityInfo }; }; }
javascript
function WixActivity() { /** * Updates to the existing contact that performed this activity. The structure of this object should match the schema for Contact, with the relevant fields updated. * @member * @type {Object} */ this.contactUpdate = schemaFactory(this.TYPES.CONTACT_CREATE.name); /** * Configures this Activity with a given type * @param {ActivityType} type the type of the Activity to create * @returns {WixActivity} */ this.withActivityType = function(type) { this.activityType = type.name; this.activityInfo = schemaFactory(type.name); return this; }; /** * Configures the activityLocationUrl of this Activity * @param {string} url The URL of the Activities location * @returns {WixActivity} */ this.withLocationUrl = function(url) { this.activityLocationUrl = url; return this; }; /** * Configures the details of this Activity * @param {string} summary A summary of this Activity * @param {string} additionalInfoUrl a link to additional information about this Activity * @returns {WixActivity} */ this.withActivityDetails = function(summary, additionalInfoUrl) { if(summary !== null && summary !== undefined) { this.activityDetails.summary = summary; } if(additionalInfoUrl !== null && additionalInfoUrl !== undefined) { this.activityDetails.additionalInfoUrl = additionalInfoUrl; } return this; }; var readOnlyTypes = [ this.TYPES.CONTACT_CREATE.name ]; this.isWritable = function() { return (readOnlyTypes.indexOf(this.activityType) == -1); }; this.isValid = function() { //TODO provide slightly better validation return this.activityLocationUrl !== null && this.activityType !== null && this.activityDetails.summary !== null && this.createdAt !== null && this.activityDetails.additionalInfoUrl !== null; }; /** * Posts the Activity to Wix. Returns a Promise for an id * @param {string} sessionToken The current session token for the active Wix site visitor * @param {Wix} wix A Wix API object * @returns {Promise.<string, error>} A new id, or an error */ this.post = function(sessionToken, wix) { return wix.Activities.postActivity(this, sessionToken); }; function removeNulls(obj){ var isArray = obj instanceof Array; for (var k in obj){ if (obj[k]===null) isArray ? obj.splice(k,1) : delete obj[k]; else if (typeof obj[k]=="object") removeNulls(obj[k]); } } this.toJSON = function() { var _this = this; removeNulls(_this.contactUpdate); removeNulls(_this.activityInfo); return { createdAt : _this.createdAt, activityType : _this.activityType, contactUpdate : _this.contactUpdate, activityLocationUrl : _this.activityLocationUrl, activityDetails : _this.activityDetails, activityInfo: _this.activityInfo }; }; }
[ "function", "WixActivity", "(", ")", "{", "/**\n * Updates to the existing contact that performed this activity. The structure of this object should match the schema for Contact, with the relevant fields updated.\n * @member\n * @type {Object}\n */", "this", ".", "contactUpdate", "=", "schemaFactory", "(", "this", ".", "TYPES", ".", "CONTACT_CREATE", ".", "name", ")", ";", "/**\n * Configures this Activity with a given type\n * @param {ActivityType} type the type of the Activity to create\n * @returns {WixActivity}\n */", "this", ".", "withActivityType", "=", "function", "(", "type", ")", "{", "this", ".", "activityType", "=", "type", ".", "name", ";", "this", ".", "activityInfo", "=", "schemaFactory", "(", "type", ".", "name", ")", ";", "return", "this", ";", "}", ";", "/**\n * Configures the activityLocationUrl of this Activity\n * @param {string} url The URL of the Activities location\n * @returns {WixActivity}\n */", "this", ".", "withLocationUrl", "=", "function", "(", "url", ")", "{", "this", ".", "activityLocationUrl", "=", "url", ";", "return", "this", ";", "}", ";", "/**\n * Configures the details of this Activity\n * @param {string} summary A summary of this Activity\n * @param {string} additionalInfoUrl a link to additional information about this Activity\n * @returns {WixActivity}\n */", "this", ".", "withActivityDetails", "=", "function", "(", "summary", ",", "additionalInfoUrl", ")", "{", "if", "(", "summary", "!==", "null", "&&", "summary", "!==", "undefined", ")", "{", "this", ".", "activityDetails", ".", "summary", "=", "summary", ";", "}", "if", "(", "additionalInfoUrl", "!==", "null", "&&", "additionalInfoUrl", "!==", "undefined", ")", "{", "this", ".", "activityDetails", ".", "additionalInfoUrl", "=", "additionalInfoUrl", ";", "}", "return", "this", ";", "}", ";", "var", "readOnlyTypes", "=", "[", "this", ".", "TYPES", ".", "CONTACT_CREATE", ".", "name", "]", ";", "this", ".", "isWritable", "=", "function", "(", ")", "{", "return", "(", "readOnlyTypes", ".", "indexOf", "(", "this", ".", "activityType", ")", "==", "-", "1", ")", ";", "}", ";", "this", ".", "isValid", "=", "function", "(", ")", "{", "//TODO provide slightly better validation", "return", "this", ".", "activityLocationUrl", "!==", "null", "&&", "this", ".", "activityType", "!==", "null", "&&", "this", ".", "activityDetails", ".", "summary", "!==", "null", "&&", "this", ".", "createdAt", "!==", "null", "&&", "this", ".", "activityDetails", ".", "additionalInfoUrl", "!==", "null", ";", "}", ";", "/**\n * Posts the Activity to Wix. Returns a Promise for an id\n * @param {string} sessionToken The current session token for the active Wix site visitor\n * @param {Wix} wix A Wix API object\n * @returns {Promise.<string, error>} A new id, or an error\n */", "this", ".", "post", "=", "function", "(", "sessionToken", ",", "wix", ")", "{", "return", "wix", ".", "Activities", ".", "postActivity", "(", "this", ",", "sessionToken", ")", ";", "}", ";", "function", "removeNulls", "(", "obj", ")", "{", "var", "isArray", "=", "obj", "instanceof", "Array", ";", "for", "(", "var", "k", "in", "obj", ")", "{", "if", "(", "obj", "[", "k", "]", "===", "null", ")", "isArray", "?", "obj", ".", "splice", "(", "k", ",", "1", ")", ":", "delete", "obj", "[", "k", "]", ";", "else", "if", "(", "typeof", "obj", "[", "k", "]", "==", "\"object\"", ")", "removeNulls", "(", "obj", "[", "k", "]", ")", ";", "}", "}", "this", ".", "toJSON", "=", "function", "(", ")", "{", "var", "_this", "=", "this", ";", "removeNulls", "(", "_this", ".", "contactUpdate", ")", ";", "removeNulls", "(", "_this", ".", "activityInfo", ")", ";", "return", "{", "createdAt", ":", "_this", ".", "createdAt", ",", "activityType", ":", "_this", ".", "activityType", ",", "contactUpdate", ":", "_this", ".", "contactUpdate", ",", "activityLocationUrl", ":", "_this", ".", "activityLocationUrl", ",", "activityDetails", ":", "_this", ".", "activityDetails", ",", "activityInfo", ":", "_this", ".", "activityInfo", "}", ";", "}", ";", "}" ]
Represents a new Activity in the Wix ecosystem, allowing for easy construction and creation @mixes BaseWixAPIObject @mixes WixActivityData @constructor @alias WixActivity @class
[ "Represents", "a", "new", "Activity", "in", "the", "Wix", "ecosystem", "allowing", "for", "easy", "construction", "and", "creation" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L360-L452
20,453
wix-incubator/wix-hive-node
lib/WixClient.js
Name
function Name(obj){ this._prefix = obj && obj.prefix; this._first = obj && obj.first; this._last = obj && obj.last; this._middle = obj && obj.middle; this._suffix = obj && obj.suffix; }
javascript
function Name(obj){ this._prefix = obj && obj.prefix; this._first = obj && obj.first; this._last = obj && obj.last; this._middle = obj && obj.middle; this._suffix = obj && obj.suffix; }
[ "function", "Name", "(", "obj", ")", "{", "this", ".", "_prefix", "=", "obj", "&&", "obj", ".", "prefix", ";", "this", ".", "_first", "=", "obj", "&&", "obj", ".", "first", ";", "this", ".", "_last", "=", "obj", "&&", "obj", ".", "last", ";", "this", ".", "_middle", "=", "obj", "&&", "obj", ".", "middle", ";", "this", ".", "_suffix", "=", "obj", "&&", "obj", ".", "suffix", ";", "}" ]
Contact Name information @typedef {Object} Contact.Name @property {string} prefix - The prefix of the contact's name @property {string} first - The contact's first name @property {string} middle - The contact's middle name @property {string} last - The contact's last name @property {string} suffix - The suffix of the contact's name
[ "Contact", "Name", "information" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L933-L939
20,454
wix-incubator/wix-hive-node
lib/WixClient.js
Company
function Company(obj){ this._role = obj && obj.role; this._name = obj && obj.name; }
javascript
function Company(obj){ this._role = obj && obj.role; this._name = obj && obj.name; }
[ "function", "Company", "(", "obj", ")", "{", "this", ".", "_role", "=", "obj", "&&", "obj", ".", "role", ";", "this", ".", "_name", "=", "obj", "&&", "obj", ".", "name", ";", "}" ]
Contact Company information @typedef {Object} Contact.Company @property {string} role - The contact's role within their company, @property {string} name - The name of the contact's current company
[ "Contact", "Company", "information" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L978-L981
20,455
wix-incubator/wix-hive-node
lib/WixClient.js
Email
function Email(obj){ this._id = obj && obj.id; this._tag = obj && obj.tag; this._email = obj && obj.email; this._emailStatus = obj && obj.emailStatus; if (this._tag == undefined || this._tag == null){ throw 'Tag is a required field' } if (this._email == undefined || this._email == null){ throw 'Email is a required field' } }
javascript
function Email(obj){ this._id = obj && obj.id; this._tag = obj && obj.tag; this._email = obj && obj.email; this._emailStatus = obj && obj.emailStatus; if (this._tag == undefined || this._tag == null){ throw 'Tag is a required field' } if (this._email == undefined || this._email == null){ throw 'Email is a required field' } }
[ "function", "Email", "(", "obj", ")", "{", "this", ".", "_id", "=", "obj", "&&", "obj", ".", "id", ";", "this", ".", "_tag", "=", "obj", "&&", "obj", ".", "tag", ";", "this", ".", "_email", "=", "obj", "&&", "obj", ".", "email", ";", "this", ".", "_emailStatus", "=", "obj", "&&", "obj", ".", "emailStatus", ";", "if", "(", "this", ".", "_tag", "==", "undefined", "||", "this", ".", "_tag", "==", "null", ")", "{", "throw", "'Tag is a required field'", "}", "if", "(", "this", ".", "_email", "==", "undefined", "||", "this", ".", "_email", "==", "null", ")", "{", "throw", "'Email is a required field'", "}", "}" ]
Contact Email information @typedef {Object} Contact.Email @property {string} tag - a context tag @property {string} email - The email address to add @property {string} contactSubscriptionStatus - The subscription status of the current contact ['optIn' or 'optInOut' or 'notSet'] @property {string} siteOwnerSubscriptionStatus - The subscription status of the site owner in relation to this contact ['optIn' or 'optInOut' or 'notSet']
[ "Contact", "Email", "information" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L1010-L1022
20,456
wix-incubator/wix-hive-node
lib/WixClient.js
Phone
function Phone(obj){ this._id = obj && obj.id; this._tag = obj && obj.tag; this._phone = obj && obj.phone; this._normalizedPhone = obj && obj.normalizedPhone; }
javascript
function Phone(obj){ this._id = obj && obj.id; this._tag = obj && obj.tag; this._phone = obj && obj.phone; this._normalizedPhone = obj && obj.normalizedPhone; }
[ "function", "Phone", "(", "obj", ")", "{", "this", ".", "_id", "=", "obj", "&&", "obj", ".", "id", ";", "this", ".", "_tag", "=", "obj", "&&", "obj", ".", "tag", ";", "this", ".", "_phone", "=", "obj", "&&", "obj", ".", "phone", ";", "this", ".", "_normalizedPhone", "=", "obj", "&&", "obj", ".", "normalizedPhone", ";", "}" ]
Contact Phone information @typedef {Object} Contact.Phone @property {string} tag - a context tag @property {string} phone - The phone number to add @property {string} normalizedPhone - The contact's normalized phone number
[ "Contact", "Phone", "information" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L1061-L1066
20,457
wix-incubator/wix-hive-node
lib/WixClient.js
Address
function Address(obj){ this._id = obj && obj.id; this._tag = obj && obj.tag; this._address = obj && obj.address; this._city = obj && obj.city; this._neighborhood = obj && obj.neighborhood; this._region = obj && obj.region; this._country = obj && obj.country; this._postalCode = obj && obj.postalCode; }
javascript
function Address(obj){ this._id = obj && obj.id; this._tag = obj && obj.tag; this._address = obj && obj.address; this._city = obj && obj.city; this._neighborhood = obj && obj.neighborhood; this._region = obj && obj.region; this._country = obj && obj.country; this._postalCode = obj && obj.postalCode; }
[ "function", "Address", "(", "obj", ")", "{", "this", ".", "_id", "=", "obj", "&&", "obj", ".", "id", ";", "this", ".", "_tag", "=", "obj", "&&", "obj", ".", "tag", ";", "this", ".", "_address", "=", "obj", "&&", "obj", ".", "address", ";", "this", ".", "_city", "=", "obj", "&&", "obj", ".", "city", ";", "this", ".", "_neighborhood", "=", "obj", "&&", "obj", ".", "neighborhood", ";", "this", ".", "_region", "=", "obj", "&&", "obj", ".", "region", ";", "this", ".", "_country", "=", "obj", "&&", "obj", ".", "country", ";", "this", ".", "_postalCode", "=", "obj", "&&", "obj", ".", "postalCode", ";", "}" ]
Contact Address information @typedef {Object} Contact.Address @property {String} tag - The context tag associated with this address, @property {?String} address - The contact's street address, @property {?String} neighborhood - The contact's street neighborhood, @property {?String} city - The contact's city, @property {?String} region - The contact's region. An example of this would be a state in the US, or a province in Canada, @property {?String} country - The contact's country, @property {?Number} postalCode - The contact's postal code
[ "Contact", "Address", "information" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L1107-L1116
20,458
wix-incubator/wix-hive-node
lib/WixClient.js
Url
function Url(obj){ this._id = obj && obj.id; this._tag = obj && obj.tag; this._url = obj && obj.url; }
javascript
function Url(obj){ this._id = obj && obj.id; this._tag = obj && obj.tag; this._url = obj && obj.url; }
[ "function", "Url", "(", "obj", ")", "{", "this", ".", "_id", "=", "obj", "&&", "obj", ".", "id", ";", "this", ".", "_tag", "=", "obj", "&&", "obj", ".", "tag", ";", "this", ".", "_url", "=", "obj", "&&", "obj", ".", "url", ";", "}" ]
Contact Url information @typedef {Object} Contact.Url @property {string} tag - The context tag associated with this url @property {string} url - A url associated with this contact
[ "Contact", "Url", "information" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L1177-L1181
20,459
wix-incubator/wix-hive-node
lib/WixClient.js
StateLink
function StateLink(obj){ this._id = obj && obj.id; this._href = obj && obj.href; this._rel = obj && obj.rel; }
javascript
function StateLink(obj){ this._id = obj && obj.id; this._href = obj && obj.href; this._rel = obj && obj.rel; }
[ "function", "StateLink", "(", "obj", ")", "{", "this", ".", "_id", "=", "obj", "&&", "obj", ".", "id", ";", "this", ".", "_href", "=", "obj", "&&", "obj", ".", "href", ";", "this", ".", "_rel", "=", "obj", "&&", "obj", ".", "rel", ";", "}" ]
Contact Link information A HATEOAS link to operations applicable to this Contact resource @typedef {Object} Contact.StateLink @property {string} href - The href of the operation relevant to this resource @property {string} rel - The relationship of this operation to the returned resource
[ "Contact", "Link", "information", "A", "HATEOAS", "link", "to", "operations", "applicable", "to", "this", "Contact", "resource" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L1213-L1217
20,460
wix-incubator/wix-hive-node
lib/WixClient.js
ImportantDate
function ImportantDate(obj){ this._id = obj && obj.id; this._tag = obj && obj.tag; this._date = obj && obj.date; }
javascript
function ImportantDate(obj){ this._id = obj && obj.id; this._tag = obj && obj.tag; this._date = obj && obj.date; }
[ "function", "ImportantDate", "(", "obj", ")", "{", "this", ".", "_id", "=", "obj", "&&", "obj", ".", "id", ";", "this", ".", "_tag", "=", "obj", "&&", "obj", ".", "tag", ";", "this", ".", "_date", "=", "obj", "&&", "obj", ".", "date", ";", "}" ]
Contact Important Date information @typedef {Object} Contact.ImportantDate @property {string} tag - The context tag associated with this date @property {dateTime} date - An important date for this contact, as an ISO 8601 timestamp
[ "Contact", "Important", "Date", "information" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L1248-L1252
20,461
wix-incubator/wix-hive-node
lib/WixClient.js
Note
function Note(obj){ this._id = obj && obj.id; this._modifiedAt = obj && obj.modifiedAt; this._content = obj && obj.content; }
javascript
function Note(obj){ this._id = obj && obj.id; this._modifiedAt = obj && obj.modifiedAt; this._content = obj && obj.content; }
[ "function", "Note", "(", "obj", ")", "{", "this", ".", "_id", "=", "obj", "&&", "obj", ".", "id", ";", "this", ".", "_modifiedAt", "=", "obj", "&&", "obj", ".", "modifiedAt", ";", "this", ".", "_content", "=", "obj", "&&", "obj", ".", "content", ";", "}" ]
Contact Note information @typedef {Object} Contact.Note @property {string} tag - a context tag @property {string} note - The note to add
[ "Contact", "Note", "information" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L1318-L1322
20,462
wix-incubator/wix-hive-node
lib/WixClient.js
WixLabelData
function WixLabelData() { /** * The id of the Label * @member WixLabelData#id * @type {string} */ /** * A timestamp to indicate when this Label was created * @member * @type {Date} */ this.createdAt = new Date().toISOString(); /** * Label name * @member * @type {String} */ this.name = null; /** * Label description * @member * @type {String} */ this.description = null; /** * Label totalMembers * @member * @type {Number} */ this.totalMembers = null; /** * Label labelType * @member * @type {String} */ this.labelType = null; /** * @private */ this.init = function(obj) { this.id = obj.id; this.name = obj.name; this.description = obj.description; this.totalMembers = obj.totalMembers; this.labelType = obj.labelType; this.createdAt = obj.createdAt; return this; }; }
javascript
function WixLabelData() { /** * The id of the Label * @member WixLabelData#id * @type {string} */ /** * A timestamp to indicate when this Label was created * @member * @type {Date} */ this.createdAt = new Date().toISOString(); /** * Label name * @member * @type {String} */ this.name = null; /** * Label description * @member * @type {String} */ this.description = null; /** * Label totalMembers * @member * @type {Number} */ this.totalMembers = null; /** * Label labelType * @member * @type {String} */ this.labelType = null; /** * @private */ this.init = function(obj) { this.id = obj.id; this.name = obj.name; this.description = obj.description; this.totalMembers = obj.totalMembers; this.labelType = obj.labelType; this.createdAt = obj.createdAt; return this; }; }
[ "function", "WixLabelData", "(", ")", "{", "/**\n * The id of the Label\n * @member WixLabelData#id\n * @type {string}\n */", "/**\n * A timestamp to indicate when this Label was created\n * @member\n * @type {Date}\n */", "this", ".", "createdAt", "=", "new", "Date", "(", ")", ".", "toISOString", "(", ")", ";", "/**\n * Label name\n * @member\n * @type {String}\n */", "this", ".", "name", "=", "null", ";", "/**\n * Label description\n * @member\n * @type {String}\n */", "this", ".", "description", "=", "null", ";", "/**\n * Label totalMembers\n * @member\n * @type {Number}\n */", "this", ".", "totalMembers", "=", "null", ";", "/**\n * Label labelType\n * @member\n * @type {String}\n */", "this", ".", "labelType", "=", "null", ";", "/**\n * @private\n */", "this", ".", "init", "=", "function", "(", "obj", ")", "{", "this", ".", "id", "=", "obj", ".", "id", ";", "this", ".", "name", "=", "obj", ".", "name", ";", "this", ".", "description", "=", "obj", ".", "description", ";", "this", ".", "totalMembers", "=", "obj", ".", "totalMembers", ";", "this", ".", "labelType", "=", "obj", ".", "labelType", ";", "this", ".", "createdAt", "=", "obj", ".", "createdAt", ";", "return", "this", ";", "}", ";", "}" ]
Represents an Label in the Wix ecosystem @constructor @alias WixLabelData @class
[ "Represents", "an", "Label", "in", "the", "Wix", "ecosystem" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L1973-L2028
20,463
wix-incubator/wix-hive-node
lib/WixClient.js
WixLabel
function WixLabel() { this.isValid = function() { //TODO provide slightly better validation return this.name !== null && this.description !== null; }; this.toJSON = function() { var _this = this; return { name : _this.name, description : _this.description }; }; }
javascript
function WixLabel() { this.isValid = function() { //TODO provide slightly better validation return this.name !== null && this.description !== null; }; this.toJSON = function() { var _this = this; return { name : _this.name, description : _this.description }; }; }
[ "function", "WixLabel", "(", ")", "{", "this", ".", "isValid", "=", "function", "(", ")", "{", "//TODO provide slightly better validation", "return", "this", ".", "name", "!==", "null", "&&", "this", ".", "description", "!==", "null", ";", "}", ";", "this", ".", "toJSON", "=", "function", "(", ")", "{", "var", "_this", "=", "this", ";", "return", "{", "name", ":", "_this", ".", "name", ",", "description", ":", "_this", ".", "description", "}", ";", "}", ";", "}" ]
Represents a new Label in the Wix ecosystem, allowing for easy construction and creation @mixes BaseWixAPIObject @mixes WixLabelData @constructor @alias WixLabel @class
[ "Represents", "a", "new", "Label", "in", "the", "Wix", "ecosystem", "allowing", "for", "easy", "construction", "and", "creation" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L2038-L2053
20,464
wix-incubator/wix-hive-node
lib/WixClient.js
APIBuilder
function APIBuilder() { /** * Creates a {@link Wix} API object with the give credentials. * @method * @param {APIBuilder.APICredentials} data JSON data containing credentials for the API * @throws an exception if signatures don't match when using the API with the instance param * @throws an exception if API credentials are missing * @returns {Wix} a Wix API interface object */ this.withCredentials = function(data) { if(!data.hasOwnProperty('secretKey')) { throwMissingValue('secretKey'); } if(!data.hasOwnProperty('appId')) { throwMissingValue('appId') } if(!data.hasOwnProperty('instanceId') && !data.hasOwnProperty('instance')) { throwMissingValue('instanceId or instance') } var i = null; if(data.hasOwnProperty('instanceId')) { i = data.instanceId; } else { i = wixconnect.parseInstance(data.instance, data.secretKey).instanceId; } return new Wix(data.secretKey, data.appId, i); }; }
javascript
function APIBuilder() { /** * Creates a {@link Wix} API object with the give credentials. * @method * @param {APIBuilder.APICredentials} data JSON data containing credentials for the API * @throws an exception if signatures don't match when using the API with the instance param * @throws an exception if API credentials are missing * @returns {Wix} a Wix API interface object */ this.withCredentials = function(data) { if(!data.hasOwnProperty('secretKey')) { throwMissingValue('secretKey'); } if(!data.hasOwnProperty('appId')) { throwMissingValue('appId') } if(!data.hasOwnProperty('instanceId') && !data.hasOwnProperty('instance')) { throwMissingValue('instanceId or instance') } var i = null; if(data.hasOwnProperty('instanceId')) { i = data.instanceId; } else { i = wixconnect.parseInstance(data.instance, data.secretKey).instanceId; } return new Wix(data.secretKey, data.appId, i); }; }
[ "function", "APIBuilder", "(", ")", "{", "/**\n * Creates a {@link Wix} API object with the give credentials.\n * @method\n * @param {APIBuilder.APICredentials} data JSON data containing credentials for the API\n * @throws an exception if signatures don't match when using the API with the instance param\n * @throws an exception if API credentials are missing\n * @returns {Wix} a Wix API interface object\n */", "this", ".", "withCredentials", "=", "function", "(", "data", ")", "{", "if", "(", "!", "data", ".", "hasOwnProperty", "(", "'secretKey'", ")", ")", "{", "throwMissingValue", "(", "'secretKey'", ")", ";", "}", "if", "(", "!", "data", ".", "hasOwnProperty", "(", "'appId'", ")", ")", "{", "throwMissingValue", "(", "'appId'", ")", "}", "if", "(", "!", "data", ".", "hasOwnProperty", "(", "'instanceId'", ")", "&&", "!", "data", ".", "hasOwnProperty", "(", "'instance'", ")", ")", "{", "throwMissingValue", "(", "'instanceId or instance'", ")", "}", "var", "i", "=", "null", ";", "if", "(", "data", ".", "hasOwnProperty", "(", "'instanceId'", ")", ")", "{", "i", "=", "data", ".", "instanceId", ";", "}", "else", "{", "i", "=", "wixconnect", ".", "parseInstance", "(", "data", ".", "instance", ",", "data", ".", "secretKey", ")", ".", "instanceId", ";", "}", "return", "new", "Wix", "(", "data", ".", "secretKey", ",", "data", ".", "appId", ",", "i", ")", ";", "}", ";", "}" ]
Credentials to access the Wix API. Must specific either an instance or an instanceId property @typedef {Object} APIBuilder.APICredentials @alias APICredentials @property {!String} secretKey Your applications Secret Key @property {!string} appId Your applications App Id @property {?String} instanceId Your applications instanceId @property {?String} instance The instance passed to your server from Wix Builder used to create new instances of the {@link Wix} object @class @alias APIBuilder @constructor
[ "Credentials", "to", "access", "the", "Wix", "API", ".", "Must", "specific", "either", "an", "instance", "or", "an", "instanceId", "property" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/WixClient.js#L2293-L2321
20,465
wix-incubator/wix-hive-node
lib/schemas/music/TrackPlayedSchema.js
TrackPlayedSchema
function TrackPlayedSchema() { /** * The track of value * @member * @type { Track } */ this.track = Object.create(Track.prototype); /** * The album of value * @member * @type { Album } */ this.album = Object.create(Album.prototype); }
javascript
function TrackPlayedSchema() { /** * The track of value * @member * @type { Track } */ this.track = Object.create(Track.prototype); /** * The album of value * @member * @type { Album } */ this.album = Object.create(Album.prototype); }
[ "function", "TrackPlayedSchema", "(", ")", "{", "/**\n * The track of value\n * @member\n * @type { Track }\n */", "this", ".", "track", "=", "Object", ".", "create", "(", "Track", ".", "prototype", ")", ";", "/**\n * The album of value\n * @member\n * @type { Album }\n */", "this", ".", "album", "=", "Object", ".", "create", "(", "Album", ".", "prototype", ")", ";", "}" ]
The TrackPlayedSchema class @constructor @alias TrackPlayedSchema
[ "The", "TrackPlayedSchema", "class" ]
1e2ea858d30b057f300306d1eace6a6c388318e8
https://github.com/wix-incubator/wix-hive-node/blob/1e2ea858d30b057f300306d1eace6a6c388318e8/lib/schemas/music/TrackPlayedSchema.js#L83-L97
20,466
chriso/redback
lib/advanced_structures/Lock.js
function(client, key, ttl) { client.ttl(key, function(err, currentTtl) { if (currentTtl === -1) { // There is no expiry set on this key, set it client.expire(key, ttl); } }); }
javascript
function(client, key, ttl) { client.ttl(key, function(err, currentTtl) { if (currentTtl === -1) { // There is no expiry set on this key, set it client.expire(key, ttl); } }); }
[ "function", "(", "client", ",", "key", ",", "ttl", ")", "{", "client", ".", "ttl", "(", "key", ",", "function", "(", "err", ",", "currentTtl", ")", "{", "if", "(", "currentTtl", "===", "-", "1", ")", "{", "// There is no expiry set on this key, set it", "client", ".", "expire", "(", "key", ",", "ttl", ")", ";", "}", "}", ")", ";", "}" ]
Ensure the lock with the given key has a `ttl`. If it does not, the given expiry will be applied to it. @param {RedisClient} client The Redis to use to apply the ttl @param {string} key The key of the lock to check @param {number} ttl If the lock does not have an expiry set, set this duration (in seconds) @api private
[ "Ensure", "the", "lock", "with", "the", "given", "key", "has", "a", "ttl", ".", "If", "it", "does", "not", "the", "given", "expiry", "will", "be", "applied", "to", "it", "." ]
1529cbf2bfa31e2479bf7c1f81df0a48c730cc63
https://github.com/chriso/redback/blob/1529cbf2bfa31e2479bf7c1f81df0a48c730cc63/lib/advanced_structures/Lock.js#L109-L116
20,467
chriso/redback
lib/advanced_structures/Lock.js
function(callback) { crypto.randomBytes(16, function(err, buffer) { if (err) { return callback(err); } return callback(null, buffer.toString('base64')); }); }
javascript
function(callback) { crypto.randomBytes(16, function(err, buffer) { if (err) { return callback(err); } return callback(null, buffer.toString('base64')); }); }
[ "function", "(", "callback", ")", "{", "crypto", ".", "randomBytes", "(", "16", ",", "function", "(", "err", ",", "buffer", ")", "{", "if", "(", "err", ")", "{", "return", "callback", "(", "err", ")", ";", "}", "return", "callback", "(", "null", ",", "buffer", ".", "toString", "(", "'base64'", ")", ")", ";", "}", ")", ";", "}" ]
Generate a random lock token. @param {Function} callback Invoked with the token when complete @param {Error} callback.err An error that occurred, if any @param {string} callback.token The randomly generated token @api private
[ "Generate", "a", "random", "lock", "token", "." ]
1529cbf2bfa31e2479bf7c1f81df0a48c730cc63
https://github.com/chriso/redback/blob/1529cbf2bfa31e2479bf7c1f81df0a48c730cc63/lib/advanced_structures/Lock.js#L127-L135
20,468
themasch/node-bencode
lib/encode.js
encode
function encode (data, buffer, offset) { var buffers = [] var result = null encode._encode(buffers, data) result = Buffer.concat(buffers) encode.bytes = result.length if (Buffer.isBuffer(buffer)) { result.copy(buffer, offset) return buffer } return result }
javascript
function encode (data, buffer, offset) { var buffers = [] var result = null encode._encode(buffers, data) result = Buffer.concat(buffers) encode.bytes = result.length if (Buffer.isBuffer(buffer)) { result.copy(buffer, offset) return buffer } return result }
[ "function", "encode", "(", "data", ",", "buffer", ",", "offset", ")", "{", "var", "buffers", "=", "[", "]", "var", "result", "=", "null", "encode", ".", "_encode", "(", "buffers", ",", "data", ")", "result", "=", "Buffer", ".", "concat", "(", "buffers", ")", "encode", ".", "bytes", "=", "result", ".", "length", "if", "(", "Buffer", ".", "isBuffer", "(", "buffer", ")", ")", "{", "result", ".", "copy", "(", "buffer", ",", "offset", ")", "return", "buffer", "}", "return", "result", "}" ]
Encodes data in bencode. @param {Buffer|Array|String|Object|Number|Boolean} data @return {Buffer}
[ "Encodes", "data", "in", "bencode", "." ]
8a881dffcdedcc9e122b7f6e5dd2f96eb0fe0ab4
https://github.com/themasch/node-bencode/blob/8a881dffcdedcc9e122b7f6e5dd2f96eb0fe0ab4/lib/encode.js#L9-L23
20,469
themasch/node-bencode
lib/decode.js
decode
function decode (data, start, end, encoding) { if (data == null || data.length === 0) { return null } if (typeof start !== 'number' && encoding == null) { encoding = start start = undefined } if (typeof end !== 'number' && encoding == null) { encoding = end end = undefined } decode.position = 0 decode.encoding = encoding || null decode.data = !(Buffer.isBuffer(data)) ? Buffer.from(data) : data.slice(start, end) decode.bytes = decode.data.length return decode.next() }
javascript
function decode (data, start, end, encoding) { if (data == null || data.length === 0) { return null } if (typeof start !== 'number' && encoding == null) { encoding = start start = undefined } if (typeof end !== 'number' && encoding == null) { encoding = end end = undefined } decode.position = 0 decode.encoding = encoding || null decode.data = !(Buffer.isBuffer(data)) ? Buffer.from(data) : data.slice(start, end) decode.bytes = decode.data.length return decode.next() }
[ "function", "decode", "(", "data", ",", "start", ",", "end", ",", "encoding", ")", "{", "if", "(", "data", "==", "null", "||", "data", ".", "length", "===", "0", ")", "{", "return", "null", "}", "if", "(", "typeof", "start", "!==", "'number'", "&&", "encoding", "==", "null", ")", "{", "encoding", "=", "start", "start", "=", "undefined", "}", "if", "(", "typeof", "end", "!==", "'number'", "&&", "encoding", "==", "null", ")", "{", "encoding", "=", "end", "end", "=", "undefined", "}", "decode", ".", "position", "=", "0", "decode", ".", "encoding", "=", "encoding", "||", "null", "decode", ".", "data", "=", "!", "(", "Buffer", ".", "isBuffer", "(", "data", ")", ")", "?", "Buffer", ".", "from", "(", "data", ")", ":", "data", ".", "slice", "(", "start", ",", "end", ")", "decode", ".", "bytes", "=", "decode", ".", "data", ".", "length", "return", "decode", ".", "next", "(", ")", "}" ]
Decodes bencoded data. @param {Buffer} data @param {Number} start (optional) @param {Number} end (optional) @param {String} encoding (optional) @return {Object|Array|Buffer|String|Number}
[ "Decodes", "bencoded", "data", "." ]
8a881dffcdedcc9e122b7f6e5dd2f96eb0fe0ab4
https://github.com/themasch/node-bencode/blob/8a881dffcdedcc9e122b7f6e5dd2f96eb0fe0ab4/lib/decode.js#L59-L84
20,470
diegonetto/generator-ionic
templates/hooks/after_prepare/icons_and_splashscreens.js
copyFile
function copyFile (src, dest, ncpOpts, callback) { var orchestrator = new Orchestrator(); var parts = dest.split(path.sep); var fileName = parts.pop(); var destDir = parts.join(path.sep); var destFile = path.resolve(destDir, fileName); orchestrator.add('ensureDir', function (done) { mkdirp(destDir, function (err) { done(err); }); }); orchestrator.add('copyFile', ['ensureDir'], function (done) { ncp(src, destFile, ncpOpts, function (err) { done(err); }); }); orchestrator.start('copyFile', function (err) { callback(err); }); }
javascript
function copyFile (src, dest, ncpOpts, callback) { var orchestrator = new Orchestrator(); var parts = dest.split(path.sep); var fileName = parts.pop(); var destDir = parts.join(path.sep); var destFile = path.resolve(destDir, fileName); orchestrator.add('ensureDir', function (done) { mkdirp(destDir, function (err) { done(err); }); }); orchestrator.add('copyFile', ['ensureDir'], function (done) { ncp(src, destFile, ncpOpts, function (err) { done(err); }); }); orchestrator.start('copyFile', function (err) { callback(err); }); }
[ "function", "copyFile", "(", "src", ",", "dest", ",", "ncpOpts", ",", "callback", ")", "{", "var", "orchestrator", "=", "new", "Orchestrator", "(", ")", ";", "var", "parts", "=", "dest", ".", "split", "(", "path", ".", "sep", ")", ";", "var", "fileName", "=", "parts", ".", "pop", "(", ")", ";", "var", "destDir", "=", "parts", ".", "join", "(", "path", ".", "sep", ")", ";", "var", "destFile", "=", "path", ".", "resolve", "(", "destDir", ",", "fileName", ")", ";", "orchestrator", ".", "add", "(", "'ensureDir'", ",", "function", "(", "done", ")", "{", "mkdirp", "(", "destDir", ",", "function", "(", "err", ")", "{", "done", "(", "err", ")", ";", "}", ")", ";", "}", ")", ";", "orchestrator", ".", "add", "(", "'copyFile'", ",", "[", "'ensureDir'", "]", ",", "function", "(", "done", ")", "{", "ncp", "(", "src", ",", "destFile", ",", "ncpOpts", ",", "function", "(", "err", ")", "{", "done", "(", "err", ")", ";", "}", ")", ";", "}", ")", ";", "orchestrator", ".", "start", "(", "'copyFile'", ",", "function", "(", "err", ")", "{", "callback", "(", "err", ")", ";", "}", ")", ";", "}" ]
Helper function for file copying that ensures directory existence.
[ "Helper", "function", "for", "file", "copying", "that", "ensures", "directory", "existence", "." ]
c5eb2078a8fe08658aeccb4a51a17d19b169c3a1
https://github.com/diegonetto/generator-ionic/blob/c5eb2078a8fe08658aeccb4a51a17d19b169c3a1/templates/hooks/after_prepare/icons_and_splashscreens.js#L29-L48
20,471
diegonetto/generator-ionic
templates/hooks/after_prepare/update_platform_config.js
function (filename) { var contents = fs.readFileSync(filename, 'utf-8'); if(contents) { //Windows is the BOM. Skip the Byte Order Mark. contents = contents.substring(contents.indexOf('<')); } return new et.ElementTree(et.XML(contents)); }
javascript
function (filename) { var contents = fs.readFileSync(filename, 'utf-8'); if(contents) { //Windows is the BOM. Skip the Byte Order Mark. contents = contents.substring(contents.indexOf('<')); } return new et.ElementTree(et.XML(contents)); }
[ "function", "(", "filename", ")", "{", "var", "contents", "=", "fs", ".", "readFileSync", "(", "filename", ",", "'utf-8'", ")", ";", "if", "(", "contents", ")", "{", "//Windows is the BOM. Skip the Byte Order Mark.", "contents", "=", "contents", ".", "substring", "(", "contents", ".", "indexOf", "(", "'<'", ")", ")", ";", "}", "return", "new", "et", ".", "ElementTree", "(", "et", ".", "XML", "(", "contents", ")", ")", ";", "}" ]
Parses a given file into an elementtree object
[ "Parses", "a", "given", "file", "into", "an", "elementtree", "object" ]
c5eb2078a8fe08658aeccb4a51a17d19b169c3a1
https://github.com/diegonetto/generator-ionic/blob/c5eb2078a8fe08658aeccb4a51a17d19b169c3a1/templates/hooks/after_prepare/update_platform_config.js#L107-L114
20,472
rstiller/inspector-metrics
examples/express4-multi-process-js/src/metrics.js
carbonReporter
async function carbonReporter (registry, tags) { const { CarbonMetricReporter } = require('inspector-carbon') const reporter = new CarbonMetricReporter({ host: 'http://localhost/', log: null, minReportingTimeout: 30, reportInterval: 5000 }) reporter.setTags(tags) reporter.addMetricRegistry(registry) await reporter.start() return reporter }
javascript
async function carbonReporter (registry, tags) { const { CarbonMetricReporter } = require('inspector-carbon') const reporter = new CarbonMetricReporter({ host: 'http://localhost/', log: null, minReportingTimeout: 30, reportInterval: 5000 }) reporter.setTags(tags) reporter.addMetricRegistry(registry) await reporter.start() return reporter }
[ "async", "function", "carbonReporter", "(", "registry", ",", "tags", ")", "{", "const", "{", "CarbonMetricReporter", "}", "=", "require", "(", "'inspector-carbon'", ")", "const", "reporter", "=", "new", "CarbonMetricReporter", "(", "{", "host", ":", "'http://localhost/'", ",", "log", ":", "null", ",", "minReportingTimeout", ":", "30", ",", "reportInterval", ":", "5000", "}", ")", "reporter", ".", "setTags", "(", "tags", ")", "reporter", ".", "addMetricRegistry", "(", "registry", ")", "await", "reporter", ".", "start", "(", ")", "return", "reporter", "}" ]
return reporter }
[ "return", "reporter", "}" ]
6b1d23b8bf328614242cebecebfa2fac29ccb049
https://github.com/rstiller/inspector-metrics/blob/6b1d23b8bf328614242cebecebfa2fac29ccb049/examples/express4-multi-process-js/src/metrics.js#L22-L40
20,473
namics/generator-nitro
packages/nitro-webpack/lib/utils.js
getEnrichedConfig
function getEnrichedConfig(rule, config) { if (!config) { return rule; } if (config.include) { rule.include = config.include; } if (config.exclude) { rule.exclude = config.exclude; } return rule; }
javascript
function getEnrichedConfig(rule, config) { if (!config) { return rule; } if (config.include) { rule.include = config.include; } if (config.exclude) { rule.exclude = config.exclude; } return rule; }
[ "function", "getEnrichedConfig", "(", "rule", ",", "config", ")", "{", "if", "(", "!", "config", ")", "{", "return", "rule", ";", "}", "if", "(", "config", ".", "include", ")", "{", "rule", ".", "include", "=", "config", ".", "include", ";", "}", "if", "(", "config", ".", "exclude", ")", "{", "rule", ".", "exclude", "=", "config", ".", "exclude", ";", "}", "return", "rule", ";", "}" ]
add optional include or exclude configs to rule
[ "add", "optional", "include", "or", "exclude", "configs", "to", "rule" ]
c81f7c6ebd9aebe4a6dfbea0d6fa4eeedc68024d
https://github.com/namics/generator-nitro/blob/c81f7c6ebd9aebe4a6dfbea0d6fa4eeedc68024d/packages/nitro-webpack/lib/utils.js#L4-L14
20,474
namics/generator-nitro
packages/nitro-app/app/lib/view.js
getViewCombinations
function getViewCombinations(action) { const pathes = [action]; const positions = []; let i; let j; for (i = 0; i < action.length; i++) { if (action[i] === '-') { positions.push(i); } } const len = positions.length; const combinations = []; for (i = 1; i < (1 << len); i++) { const c = []; for (j = 0; j < len; j++) { if (i & (1 << j)) { c.push(positions[j]); } } combinations.push(c); } combinations.forEach((combination) => { let combinationPath = action; combination.forEach((pos) => { combinationPath = replaceAt(combinationPath, pos, '/'); }); pathes.push(combinationPath); }); return pathes; }
javascript
function getViewCombinations(action) { const pathes = [action]; const positions = []; let i; let j; for (i = 0; i < action.length; i++) { if (action[i] === '-') { positions.push(i); } } const len = positions.length; const combinations = []; for (i = 1; i < (1 << len); i++) { const c = []; for (j = 0; j < len; j++) { if (i & (1 << j)) { c.push(positions[j]); } } combinations.push(c); } combinations.forEach((combination) => { let combinationPath = action; combination.forEach((pos) => { combinationPath = replaceAt(combinationPath, pos, '/'); }); pathes.push(combinationPath); }); return pathes; }
[ "function", "getViewCombinations", "(", "action", ")", "{", "const", "pathes", "=", "[", "action", "]", ";", "const", "positions", "=", "[", "]", ";", "let", "i", ";", "let", "j", ";", "for", "(", "i", "=", "0", ";", "i", "<", "action", ".", "length", ";", "i", "++", ")", "{", "if", "(", "action", "[", "i", "]", "===", "'-'", ")", "{", "positions", ".", "push", "(", "i", ")", ";", "}", "}", "const", "len", "=", "positions", ".", "length", ";", "const", "combinations", "=", "[", "]", ";", "for", "(", "i", "=", "1", ";", "i", "<", "(", "1", "<<", "len", ")", ";", "i", "++", ")", "{", "const", "c", "=", "[", "]", ";", "for", "(", "j", "=", "0", ";", "j", "<", "len", ";", "j", "++", ")", "{", "if", "(", "i", "&", "(", "1", "<<", "j", ")", ")", "{", "c", ".", "push", "(", "positions", "[", "j", "]", ")", ";", "}", "}", "combinations", ".", "push", "(", "c", ")", ";", "}", "combinations", ".", "forEach", "(", "(", "combination", ")", "=>", "{", "let", "combinationPath", "=", "action", ";", "combination", ".", "forEach", "(", "(", "pos", ")", "=>", "{", "combinationPath", "=", "replaceAt", "(", "combinationPath", ",", "pos", ",", "'/'", ")", ";", "}", ")", ";", "pathes", ".", "push", "(", "combinationPath", ")", ";", "}", ")", ";", "return", "pathes", ";", "}" ]
get possible view paths @param action The requested route (e.g. content-example) @returns {Array} array of strings of possible paths to view files (e.g. content-example, content/example)
[ "get", "possible", "view", "paths" ]
c81f7c6ebd9aebe4a6dfbea0d6fa4eeedc68024d
https://github.com/namics/generator-nitro/blob/c81f7c6ebd9aebe4a6dfbea0d6fa4eeedc68024d/packages/nitro-app/app/lib/view.js#L70-L103
20,475
choojs/nanorouter
index.js
pathname
function pathname (routename, isElectron) { if (isElectron) routename = routename.replace(stripElectron, '') else routename = routename.replace(prefix, '') return decodeURI(routename.replace(suffix, '').replace(normalize, '/')) }
javascript
function pathname (routename, isElectron) { if (isElectron) routename = routename.replace(stripElectron, '') else routename = routename.replace(prefix, '') return decodeURI(routename.replace(suffix, '').replace(normalize, '/')) }
[ "function", "pathname", "(", "routename", ",", "isElectron", ")", "{", "if", "(", "isElectron", ")", "routename", "=", "routename", ".", "replace", "(", "stripElectron", ",", "''", ")", "else", "routename", "=", "routename", ".", "replace", "(", "prefix", ",", "''", ")", "return", "decodeURI", "(", "routename", ".", "replace", "(", "suffix", ",", "''", ")", ".", "replace", "(", "normalize", ",", "'/'", ")", ")", "}" ]
replace everything in a route but the pathname and hash
[ "replace", "everything", "in", "a", "route", "but", "the", "pathname", "and", "hash" ]
ed5016ef347cd466d603309a65bf83dfe61750ce
https://github.com/choojs/nanorouter/blob/ed5016ef347cd466d603309a65bf83dfe61750ce/index.js#L50-L54
20,476
dfinity/wasm-persist
index.js
prepare
function prepare (binary, include = {memory: true, table: true}, symbol = '_') { return inject(binary, include, symbol) }
javascript
function prepare (binary, include = {memory: true, table: true}, symbol = '_') { return inject(binary, include, symbol) }
[ "function", "prepare", "(", "binary", ",", "include", "=", "{", "memory", ":", "true", ",", "table", ":", "true", "}", ",", "symbol", "=", "'_'", ")", "{", "return", "inject", "(", "binary", ",", "include", ",", "symbol", ")", "}" ]
Prepares a binary by injecting getter and setter function for memory, globals and tables. @param {ArrayBuffer} binary - a wasm binary @param {Object} include @param {Boolean} [include.memory=true] - whether or not to include memory @param {Boolean} [include.table=true] - whether or not to include the function table @param {Array.<Boolean>} [include.globals=Array.<true>] - whether or not to include a given global. Each index in the array stands for a global index. Indexes that are set to false or left undefined will not be persisted. By default all globals are persisted. @param {String} [symbol = '_'] - a string used to prefix the injected setter and getter functions @return {ArrayBuffer} the resulting wasm binary
[ "Prepares", "a", "binary", "by", "injecting", "getter", "and", "setter", "function", "for", "memory", "globals", "and", "tables", "." ]
39daece03e7489406df32a0b433623980a20e393
https://github.com/dfinity/wasm-persist/blob/39daece03e7489406df32a0b433623980a20e393/index.js#L16-L18
20,477
dfinity/wasm-persist
index.js
hibernate
function hibernate (instance, symbol = '_') { const json = { globals: [], table: [], symbol } for (const key in instance.exports) { const val = instance.exports[key] if (key.startsWith(symbol)) { const keyElems = key.slice(symbol.length).split('_') // save the memory if (val instanceof WebAssembly.Memory) { json.memory = new Uint32Array(val.buffer) } else if (val instanceof WebAssembly.Table) { // mark the tables, (do something for external function?) // the external functions should have a callback for (let i = 0; i < val.length; i++) { const func = val.get(i) if (func === instance.exports[`${symbol}func_${func.name}`]) { json.table.push(func.name) } } } else if (keyElems[0] === 'global' && keyElems[1] === 'getter') { // save the globals const last = keyElems.pop() if (last === 'high') { json.globals.push([instance.exports[key]()]) } else if (last === 'low') { json.globals[json.globals.length - 1].push(instance.exports[key]()) } else { json.globals.push(instance.exports[key]()) } } } } instance.__hibernated = true return json }
javascript
function hibernate (instance, symbol = '_') { const json = { globals: [], table: [], symbol } for (const key in instance.exports) { const val = instance.exports[key] if (key.startsWith(symbol)) { const keyElems = key.slice(symbol.length).split('_') // save the memory if (val instanceof WebAssembly.Memory) { json.memory = new Uint32Array(val.buffer) } else if (val instanceof WebAssembly.Table) { // mark the tables, (do something for external function?) // the external functions should have a callback for (let i = 0; i < val.length; i++) { const func = val.get(i) if (func === instance.exports[`${symbol}func_${func.name}`]) { json.table.push(func.name) } } } else if (keyElems[0] === 'global' && keyElems[1] === 'getter') { // save the globals const last = keyElems.pop() if (last === 'high') { json.globals.push([instance.exports[key]()]) } else if (last === 'low') { json.globals[json.globals.length - 1].push(instance.exports[key]()) } else { json.globals.push(instance.exports[key]()) } } } } instance.__hibernated = true return json }
[ "function", "hibernate", "(", "instance", ",", "symbol", "=", "'_'", ")", "{", "const", "json", "=", "{", "globals", ":", "[", "]", ",", "table", ":", "[", "]", ",", "symbol", "}", "for", "(", "const", "key", "in", "instance", ".", "exports", ")", "{", "const", "val", "=", "instance", ".", "exports", "[", "key", "]", "if", "(", "key", ".", "startsWith", "(", "symbol", ")", ")", "{", "const", "keyElems", "=", "key", ".", "slice", "(", "symbol", ".", "length", ")", ".", "split", "(", "'_'", ")", "// save the memory", "if", "(", "val", "instanceof", "WebAssembly", ".", "Memory", ")", "{", "json", ".", "memory", "=", "new", "Uint32Array", "(", "val", ".", "buffer", ")", "}", "else", "if", "(", "val", "instanceof", "WebAssembly", ".", "Table", ")", "{", "// mark the tables, (do something for external function?)", "// the external functions should have a callback", "for", "(", "let", "i", "=", "0", ";", "i", "<", "val", ".", "length", ";", "i", "++", ")", "{", "const", "func", "=", "val", ".", "get", "(", "i", ")", "if", "(", "func", "===", "instance", ".", "exports", "[", "`", "${", "symbol", "}", "${", "func", ".", "name", "}", "`", "]", ")", "{", "json", ".", "table", ".", "push", "(", "func", ".", "name", ")", "}", "}", "}", "else", "if", "(", "keyElems", "[", "0", "]", "===", "'global'", "&&", "keyElems", "[", "1", "]", "===", "'getter'", ")", "{", "// save the globals", "const", "last", "=", "keyElems", ".", "pop", "(", ")", "if", "(", "last", "===", "'high'", ")", "{", "json", ".", "globals", ".", "push", "(", "[", "instance", ".", "exports", "[", "key", "]", "(", ")", "]", ")", "}", "else", "if", "(", "last", "===", "'low'", ")", "{", "json", ".", "globals", "[", "json", ".", "globals", ".", "length", "-", "1", "]", ".", "push", "(", "instance", ".", "exports", "[", "key", "]", "(", ")", ")", "}", "else", "{", "json", ".", "globals", ".", "push", "(", "instance", ".", "exports", "[", "key", "]", "(", ")", ")", "}", "}", "}", "}", "instance", ".", "__hibernated", "=", "true", "return", "json", "}" ]
Given a Webassembly Instance this will produce an Object containing the current state of the instance @param {WebAssembly.Instance} instance @param {String} symbol - the symbol that will be used to find the injected functions @return {Object} the state of the wasm instance
[ "Given", "a", "Webassembly", "Instance", "this", "will", "produce", "an", "Object", "containing", "the", "current", "state", "of", "the", "instance" ]
39daece03e7489406df32a0b433623980a20e393
https://github.com/dfinity/wasm-persist/blob/39daece03e7489406df32a0b433623980a20e393/index.js#L27-L64
20,478
dfinity/wasm-persist
index.js
resume
function resume (instance, state) { if (instance.__hibernated) { instance.__hibernated = false } else { // initialize memory const mem = instance.exports[`${state.symbol}memory`] if (mem) { (new Uint32Array(mem.buffer)).set(state.memory, 0) } // initialize table if (instance.exports._table) { for (const index in state.table) { const funcIndex = state.table[index] instance.exports._table.set(index, instance.exports[`${state.symbol}func_${funcIndex}`]) } } // initialize globals for (const index in state.globals) { const val = state.globals[index] if (val !== undefined) { if (Array.isArray(val)) { instance.exports[`${state.symbol}global_setter_i64_${index}`](val[1], val[0]) } else { instance.exports[`${state.symbol}global_setter_i32_${index}`](val) } } } } return instance }
javascript
function resume (instance, state) { if (instance.__hibernated) { instance.__hibernated = false } else { // initialize memory const mem = instance.exports[`${state.symbol}memory`] if (mem) { (new Uint32Array(mem.buffer)).set(state.memory, 0) } // initialize table if (instance.exports._table) { for (const index in state.table) { const funcIndex = state.table[index] instance.exports._table.set(index, instance.exports[`${state.symbol}func_${funcIndex}`]) } } // initialize globals for (const index in state.globals) { const val = state.globals[index] if (val !== undefined) { if (Array.isArray(val)) { instance.exports[`${state.symbol}global_setter_i64_${index}`](val[1], val[0]) } else { instance.exports[`${state.symbol}global_setter_i32_${index}`](val) } } } } return instance }
[ "function", "resume", "(", "instance", ",", "state", ")", "{", "if", "(", "instance", ".", "__hibernated", ")", "{", "instance", ".", "__hibernated", "=", "false", "}", "else", "{", "// initialize memory", "const", "mem", "=", "instance", ".", "exports", "[", "`", "${", "state", ".", "symbol", "}", "`", "]", "if", "(", "mem", ")", "{", "(", "new", "Uint32Array", "(", "mem", ".", "buffer", ")", ")", ".", "set", "(", "state", ".", "memory", ",", "0", ")", "}", "// initialize table", "if", "(", "instance", ".", "exports", ".", "_table", ")", "{", "for", "(", "const", "index", "in", "state", ".", "table", ")", "{", "const", "funcIndex", "=", "state", ".", "table", "[", "index", "]", "instance", ".", "exports", ".", "_table", ".", "set", "(", "index", ",", "instance", ".", "exports", "[", "`", "${", "state", ".", "symbol", "}", "${", "funcIndex", "}", "`", "]", ")", "}", "}", "// initialize globals", "for", "(", "const", "index", "in", "state", ".", "globals", ")", "{", "const", "val", "=", "state", ".", "globals", "[", "index", "]", "if", "(", "val", "!==", "undefined", ")", "{", "if", "(", "Array", ".", "isArray", "(", "val", ")", ")", "{", "instance", ".", "exports", "[", "`", "${", "state", ".", "symbol", "}", "${", "index", "}", "`", "]", "(", "val", "[", "1", "]", ",", "val", "[", "0", "]", ")", "}", "else", "{", "instance", ".", "exports", "[", "`", "${", "state", ".", "symbol", "}", "${", "index", "}", "`", "]", "(", "val", ")", "}", "}", "}", "}", "return", "instance", "}" ]
Resumes a previously hibernated Webassembly instance @param {WebAssembly.Instance} instance @param {Object} state - the previous state of the wasm instance @return {WebAssembly.Instance}
[ "Resumes", "a", "previously", "hibernated", "Webassembly", "instance" ]
39daece03e7489406df32a0b433623980a20e393
https://github.com/dfinity/wasm-persist/blob/39daece03e7489406df32a0b433623980a20e393/index.js#L72-L103
20,479
socketio/engine.io-parser
lib/index.js
encodeBuffer
function encodeBuffer(packet, supportsBinary, callback) { if (!supportsBinary) { return exports.encodeBase64Packet(packet, callback); } var data = packet.data; var typeBuffer = new Buffer(1); typeBuffer[0] = packets[packet.type]; return callback(Buffer.concat([typeBuffer, data])); }
javascript
function encodeBuffer(packet, supportsBinary, callback) { if (!supportsBinary) { return exports.encodeBase64Packet(packet, callback); } var data = packet.data; var typeBuffer = new Buffer(1); typeBuffer[0] = packets[packet.type]; return callback(Buffer.concat([typeBuffer, data])); }
[ "function", "encodeBuffer", "(", "packet", ",", "supportsBinary", ",", "callback", ")", "{", "if", "(", "!", "supportsBinary", ")", "{", "return", "exports", ".", "encodeBase64Packet", "(", "packet", ",", "callback", ")", ";", "}", "var", "data", "=", "packet", ".", "data", ";", "var", "typeBuffer", "=", "new", "Buffer", "(", "1", ")", ";", "typeBuffer", "[", "0", "]", "=", "packets", "[", "packet", ".", "type", "]", ";", "return", "callback", "(", "Buffer", ".", "concat", "(", "[", "typeBuffer", ",", "data", "]", ")", ")", ";", "}" ]
Encode Buffer data
[ "Encode", "Buffer", "data" ]
021a7dc75137585aced83f23fd056c3101504418
https://github.com/socketio/engine.io-parser/blob/021a7dc75137585aced83f23fd056c3101504418/lib/index.js#L85-L94
20,480
socketio/engine.io-parser
lib/index.js
map
function map(ary, each, done) { var result = new Array(ary.length); var next = after(ary.length, done); for (var i = 0; i < ary.length; i++) { each(ary[i], function(error, msg) { result[i] = msg; next(error, result); }); } }
javascript
function map(ary, each, done) { var result = new Array(ary.length); var next = after(ary.length, done); for (var i = 0; i < ary.length; i++) { each(ary[i], function(error, msg) { result[i] = msg; next(error, result); }); } }
[ "function", "map", "(", "ary", ",", "each", ",", "done", ")", "{", "var", "result", "=", "new", "Array", "(", "ary", ".", "length", ")", ";", "var", "next", "=", "after", "(", "ary", ".", "length", ",", "done", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "ary", ".", "length", ";", "i", "++", ")", "{", "each", "(", "ary", "[", "i", "]", ",", "function", "(", "error", ",", "msg", ")", "{", "result", "[", "i", "]", "=", "msg", ";", "next", "(", "error", ",", "result", ")", ";", "}", ")", ";", "}", "}" ]
Async array map using after
[ "Async", "array", "map", "using", "after" ]
021a7dc75137585aced83f23fd056c3101504418
https://github.com/socketio/engine.io-parser/blob/021a7dc75137585aced83f23fd056c3101504418/lib/index.js#L244-L254
20,481
shripalsoni04/nativescript-webview-interface
index-common.js
parseJSON
function parseJSON(data) { var oData; try { oData = JSON.parse(data); } catch (e) { return false; } return oData; }
javascript
function parseJSON(data) { var oData; try { oData = JSON.parse(data); } catch (e) { return false; } return oData; }
[ "function", "parseJSON", "(", "data", ")", "{", "var", "oData", ";", "try", "{", "oData", "=", "JSON", ".", "parse", "(", "data", ")", ";", "}", "catch", "(", "e", ")", "{", "return", "false", ";", "}", "return", "oData", ";", "}" ]
Parses json string to object if valid.
[ "Parses", "json", "string", "to", "object", "if", "valid", "." ]
351a418e6069eefc9c244700dfbaf6428b0bf3e0
https://github.com/shripalsoni04/nativescript-webview-interface/blob/351a418e6069eefc9c244700dfbaf6428b0bf3e0/index-common.js#L4-L12
20,482
shripalsoni04/nativescript-webview-interface
index-common.js
WebViewInterface
function WebViewInterface(webView) { /** * WebView to setup interface for */ this.webView = webView; /** * Mapping of webView event/command and its native handler */ this.eventListenerMap = {}; /** * Mapping of js call request id and its success handler. * Based on this mapping, the registered success handler will be called * on successful response from the js call */ this.jsCallReqIdSuccessCallbackMap = {}; /** * Mapping of js call request id and its error handler. * Based on this mapping, the error handler will be called * on error from the js call */ this.jsCallReqIdErrorCallbackMap = {}; /** * Web-view instance unique id to handle scenarios of multiple webview on single page. */ this.id = ++WebViewInterface.cntWebViewId; /** * Maintaining mapping of webview instance and its id, to handle scenarios of multiple webview on single page. */ WebViewInterface.webViewInterfaceIdMap[this.id] = this; }
javascript
function WebViewInterface(webView) { /** * WebView to setup interface for */ this.webView = webView; /** * Mapping of webView event/command and its native handler */ this.eventListenerMap = {}; /** * Mapping of js call request id and its success handler. * Based on this mapping, the registered success handler will be called * on successful response from the js call */ this.jsCallReqIdSuccessCallbackMap = {}; /** * Mapping of js call request id and its error handler. * Based on this mapping, the error handler will be called * on error from the js call */ this.jsCallReqIdErrorCallbackMap = {}; /** * Web-view instance unique id to handle scenarios of multiple webview on single page. */ this.id = ++WebViewInterface.cntWebViewId; /** * Maintaining mapping of webview instance and its id, to handle scenarios of multiple webview on single page. */ WebViewInterface.webViewInterfaceIdMap[this.id] = this; }
[ "function", "WebViewInterface", "(", "webView", ")", "{", "/**\n * WebView to setup interface for\n */", "this", ".", "webView", "=", "webView", ";", "/**\n * Mapping of webView event/command and its native handler \n */", "this", ".", "eventListenerMap", "=", "{", "}", ";", "/**\n * Mapping of js call request id and its success handler. \n * Based on this mapping, the registered success handler will be called \n * on successful response from the js call\n */", "this", ".", "jsCallReqIdSuccessCallbackMap", "=", "{", "}", ";", "/**\n * Mapping of js call request id and its error handler. \n * Based on this mapping, the error handler will be called \n * on error from the js call\n */", "this", ".", "jsCallReqIdErrorCallbackMap", "=", "{", "}", ";", "/**\n * Web-view instance unique id to handle scenarios of multiple webview on single page.\n */", "this", ".", "id", "=", "++", "WebViewInterface", ".", "cntWebViewId", ";", "/**\n * Maintaining mapping of webview instance and its id, to handle scenarios of multiple webview on single page.\n */", "WebViewInterface", ".", "webViewInterfaceIdMap", "[", "this", ".", "id", "]", "=", "this", ";", "}" ]
WebViewInterface Class containing common functionalities for Android and iOS
[ "WebViewInterface", "Class", "containing", "common", "functionalities", "for", "Android", "and", "iOS" ]
351a418e6069eefc9c244700dfbaf6428b0bf3e0
https://github.com/shripalsoni04/nativescript-webview-interface/blob/351a418e6069eefc9c244700dfbaf6428b0bf3e0/index-common.js#L17-L51
20,483
shripalsoni04/nativescript-webview-interface
index.android.js
getAndroidJSInterface
function getAndroidJSInterface(oWebViewInterface){ var AndroidWebViewInterface = com.shripalsoni.natiescriptwebviewinterface.WebViewInterface.extend({ /** * On call from webView to android, this function is called from handleEventFromWebView method of WebViewInerface class */ onWebViewEvent: function(webViewId, eventName, jsonData){ // getting webviewInterface object by webViewId from static map. var oWebViewInterface = getWebViewIntefaceObjByWebViewId(webViewId); if (oWebViewInterface) { oWebViewInterface._onWebViewEvent(eventName, jsonData); } } }); // creating androidWebViewInterface with unique web-view id. return new AndroidWebViewInterface(new java.lang.String(''+oWebViewInterface.id)); }
javascript
function getAndroidJSInterface(oWebViewInterface){ var AndroidWebViewInterface = com.shripalsoni.natiescriptwebviewinterface.WebViewInterface.extend({ /** * On call from webView to android, this function is called from handleEventFromWebView method of WebViewInerface class */ onWebViewEvent: function(webViewId, eventName, jsonData){ // getting webviewInterface object by webViewId from static map. var oWebViewInterface = getWebViewIntefaceObjByWebViewId(webViewId); if (oWebViewInterface) { oWebViewInterface._onWebViewEvent(eventName, jsonData); } } }); // creating androidWebViewInterface with unique web-view id. return new AndroidWebViewInterface(new java.lang.String(''+oWebViewInterface.id)); }
[ "function", "getAndroidJSInterface", "(", "oWebViewInterface", ")", "{", "var", "AndroidWebViewInterface", "=", "com", ".", "shripalsoni", ".", "natiescriptwebviewinterface", ".", "WebViewInterface", ".", "extend", "(", "{", "/**\n * On call from webView to android, this function is called from handleEventFromWebView method of WebViewInerface class\n */", "onWebViewEvent", ":", "function", "(", "webViewId", ",", "eventName", ",", "jsonData", ")", "{", "// getting webviewInterface object by webViewId from static map.", "var", "oWebViewInterface", "=", "getWebViewIntefaceObjByWebViewId", "(", "webViewId", ")", ";", "if", "(", "oWebViewInterface", ")", "{", "oWebViewInterface", ".", "_onWebViewEvent", "(", "eventName", ",", "jsonData", ")", ";", "}", "}", "}", ")", ";", "// creating androidWebViewInterface with unique web-view id.", "return", "new", "AndroidWebViewInterface", "(", "new", "java", ".", "lang", ".", "String", "(", "''", "+", "oWebViewInterface", ".", "id", ")", ")", ";", "}" ]
Factory function to provide instance of Android JavascriptInterface.
[ "Factory", "function", "to", "provide", "instance", "of", "Android", "JavascriptInterface", "." ]
351a418e6069eefc9c244700dfbaf6428b0bf3e0
https://github.com/shripalsoni04/nativescript-webview-interface/blob/351a418e6069eefc9c244700dfbaf6428b0bf3e0/index.android.js#L9-L25
20,484
shripalsoni04/nativescript-webview-interface
index.android.js
function(webViewId, eventName, jsonData){ // getting webviewInterface object by webViewId from static map. var oWebViewInterface = getWebViewIntefaceObjByWebViewId(webViewId); if (oWebViewInterface) { oWebViewInterface._onWebViewEvent(eventName, jsonData); } }
javascript
function(webViewId, eventName, jsonData){ // getting webviewInterface object by webViewId from static map. var oWebViewInterface = getWebViewIntefaceObjByWebViewId(webViewId); if (oWebViewInterface) { oWebViewInterface._onWebViewEvent(eventName, jsonData); } }
[ "function", "(", "webViewId", ",", "eventName", ",", "jsonData", ")", "{", "// getting webviewInterface object by webViewId from static map.", "var", "oWebViewInterface", "=", "getWebViewIntefaceObjByWebViewId", "(", "webViewId", ")", ";", "if", "(", "oWebViewInterface", ")", "{", "oWebViewInterface", ".", "_onWebViewEvent", "(", "eventName", ",", "jsonData", ")", ";", "}", "}" ]
On call from webView to android, this function is called from handleEventFromWebView method of WebViewInerface class
[ "On", "call", "from", "webView", "to", "android", "this", "function", "is", "called", "from", "handleEventFromWebView", "method", "of", "WebViewInerface", "class" ]
351a418e6069eefc9c244700dfbaf6428b0bf3e0
https://github.com/shripalsoni04/nativescript-webview-interface/blob/351a418e6069eefc9c244700dfbaf6428b0bf3e0/index.android.js#L14-L20
20,485
phillbaker/digitalocean-node
lib/digitalocean/util.js
function(object) { // if we're not an array or object, return the primative if (object !== Object(object)) { return object; } var decamelizeString = function(string) { var separator = '_'; var split = /(?=[A-Z])/; return string.split(split).join(separator).toLowerCase(); }; var output; if (object instanceof Array) { output = []; for(var i = 0, l = object.length; i < l; i++) { output.push(decamelizeKeys(object[i])); } } else { output = {}; for (var key in object) { if (object.hasOwnProperty(key)) { output[decamelizeString(key)] = decamelizeKeys(object[key]); } } } return output; }
javascript
function(object) { // if we're not an array or object, return the primative if (object !== Object(object)) { return object; } var decamelizeString = function(string) { var separator = '_'; var split = /(?=[A-Z])/; return string.split(split).join(separator).toLowerCase(); }; var output; if (object instanceof Array) { output = []; for(var i = 0, l = object.length; i < l; i++) { output.push(decamelizeKeys(object[i])); } } else { output = {}; for (var key in object) { if (object.hasOwnProperty(key)) { output[decamelizeString(key)] = decamelizeKeys(object[key]); } } } return output; }
[ "function", "(", "object", ")", "{", "// if we're not an array or object, return the primative", "if", "(", "object", "!==", "Object", "(", "object", ")", ")", "{", "return", "object", ";", "}", "var", "decamelizeString", "=", "function", "(", "string", ")", "{", "var", "separator", "=", "'_'", ";", "var", "split", "=", "/", "(?=[A-Z])", "/", ";", "return", "string", ".", "split", "(", "split", ")", ".", "join", "(", "separator", ")", ".", "toLowerCase", "(", ")", ";", "}", ";", "var", "output", ";", "if", "(", "object", "instanceof", "Array", ")", "{", "output", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ",", "l", "=", "object", ".", "length", ";", "i", "<", "l", ";", "i", "++", ")", "{", "output", ".", "push", "(", "decamelizeKeys", "(", "object", "[", "i", "]", ")", ")", ";", "}", "}", "else", "{", "output", "=", "{", "}", ";", "for", "(", "var", "key", "in", "object", ")", "{", "if", "(", "object", ".", "hasOwnProperty", "(", "key", ")", ")", "{", "output", "[", "decamelizeString", "(", "key", ")", "]", "=", "decamelizeKeys", "(", "object", "[", "key", "]", ")", ";", "}", "}", "}", "return", "output", ";", "}" ]
Based on Humps by Dom Christie
[ "Based", "on", "Humps", "by", "Dom", "Christie" ]
39fe7a0c5793ba1ee29434fa31627eee8bda3734
https://github.com/phillbaker/digitalocean-node/blob/39fe7a0c5793ba1ee29434fa31627eee8bda3734/lib/digitalocean/util.js#L12-L42
20,486
phillbaker/digitalocean-node
lib/digitalocean/util.js
function(client, initialData, totalLength, requestOptions, successStatuses, successRootKeys, promise) { this.currentPage = 1; // default to start at page 1 // this.perPage = queryParams && queryParams.per_page || 25; // default to 25 per page this.totalLength = totalLength; // bootstrap with initial data this.push.apply(this, initialData); this.client = client; this.requestOptions = requestOptions; this.successStatuses = successStatuses; this.successRootKeys = successRootKeys; this.promise = promise; }
javascript
function(client, initialData, totalLength, requestOptions, successStatuses, successRootKeys, promise) { this.currentPage = 1; // default to start at page 1 // this.perPage = queryParams && queryParams.per_page || 25; // default to 25 per page this.totalLength = totalLength; // bootstrap with initial data this.push.apply(this, initialData); this.client = client; this.requestOptions = requestOptions; this.successStatuses = successStatuses; this.successRootKeys = successRootKeys; this.promise = promise; }
[ "function", "(", "client", ",", "initialData", ",", "totalLength", ",", "requestOptions", ",", "successStatuses", ",", "successRootKeys", ",", "promise", ")", "{", "this", ".", "currentPage", "=", "1", ";", "// default to start at page 1", "// this.perPage = queryParams && queryParams.per_page || 25; // default to 25 per page", "this", ".", "totalLength", "=", "totalLength", ";", "// bootstrap with initial data", "this", ".", "push", ".", "apply", "(", "this", ",", "initialData", ")", ";", "this", ".", "client", "=", "client", ";", "this", ".", "requestOptions", "=", "requestOptions", ";", "this", ".", "successStatuses", "=", "successStatuses", ";", "this", ".", "successRootKeys", "=", "successRootKeys", ";", "this", ".", "promise", "=", "promise", ";", "}" ]
A class that runs the pagination until the end if necessary. @class ListResponse
[ "A", "class", "that", "runs", "the", "pagination", "until", "the", "end", "if", "necessary", "." ]
39fe7a0c5793ba1ee29434fa31627eee8bda3734
https://github.com/phillbaker/digitalocean-node/blob/39fe7a0c5793ba1ee29434fa31627eee8bda3734/lib/digitalocean/util.js#L82-L94
20,487
phillbaker/digitalocean-node
examples/make_droplet.js
pollUntilDone
function pollUntilDone(id, done) { client.droplets.get(id, function(err, droplet) { if (!err && droplet.locked === false) { // we're done! done.call(); } else if (!err && droplet.locked === true) { // back off 10s more setTimeout(function() { pollUntilDone(id, done); }, (10 * 1000)); } else { pollUntilDone(id, done); } }); }
javascript
function pollUntilDone(id, done) { client.droplets.get(id, function(err, droplet) { if (!err && droplet.locked === false) { // we're done! done.call(); } else if (!err && droplet.locked === true) { // back off 10s more setTimeout(function() { pollUntilDone(id, done); }, (10 * 1000)); } else { pollUntilDone(id, done); } }); }
[ "function", "pollUntilDone", "(", "id", ",", "done", ")", "{", "client", ".", "droplets", ".", "get", "(", "id", ",", "function", "(", "err", ",", "droplet", ")", "{", "if", "(", "!", "err", "&&", "droplet", ".", "locked", "===", "false", ")", "{", "// we're done!", "done", ".", "call", "(", ")", ";", "}", "else", "if", "(", "!", "err", "&&", "droplet", ".", "locked", "===", "true", ")", "{", "// back off 10s more", "setTimeout", "(", "function", "(", ")", "{", "pollUntilDone", "(", "id", ",", "done", ")", ";", "}", ",", "(", "10", "*", "1000", ")", ")", ";", "}", "else", "{", "pollUntilDone", "(", "id", ",", "done", ")", ";", "}", "}", ")", ";", "}" ]
Poll for non-locked state every 10s
[ "Poll", "for", "non", "-", "locked", "state", "every", "10s" ]
39fe7a0c5793ba1ee29434fa31627eee8bda3734
https://github.com/phillbaker/digitalocean-node/blob/39fe7a0c5793ba1ee29434fa31627eee8bda3734/examples/make_droplet.js#L22-L36
20,488
rquadling/grunt-html2js
tasks/html2js.js
generateModule
function generateModule (f) { // f.dest must be a string or write will fail var moduleNames = []; var filePaths = f.src.filter(existsFilter); if (options.watch) { watcher.add(filePaths); } var modules = filePaths.map(function (filepath) { var moduleName = normalizePath(path.relative(options.base, filepath)); if (grunt.util.kindOf(options.rename) === 'function') { moduleName = options.rename(moduleName); } moduleNames.push(options.quoteChar + moduleName + options.quoteChar); var compiled; if (options.watch && (compiled = fileCache[filepath])) { // return compiled file contents from cache return compiled; } if (options.target === 'js') { compiled = compileTemplate(moduleName, filepath, options); } else if (options.target === 'coffee') { compiled = compileCoffeeTemplate(moduleName, filepath, options); } else { grunt.fail.fatal('Unknown target "' + options.target + '" specified'); } if (options.watch) { // store compiled file contents in cache fileCache[filepath] = compiled; } return compiled; }); // don't generate empty modules if (!modules.length) { return; } counter += modules.length; modules = modules.join('\n'); var fileHeader = options.fileHeaderString !== '' ? options.fileHeaderString + '\n' : ''; var fileFooter = options.fileFooterString !== '' ? options.fileFooterString + '\n' : ''; var bundle = ''; var targetModule = f.module || options.module; var indentString = options.indentString; var quoteChar = options.quoteChar; var strict = (options.useStrict) ? indentString + quoteChar + 'use strict' + quoteChar + ';\n' : ''; var amdPrefix = ''; var amdSuffix = ''; // If options.module is a function, use that to get the targetModule if (grunt.util.kindOf(targetModule) === 'function') { targetModule = targetModule(f, target); } if (options.amd) { amdPrefix = options.amdPrefixString; amdSuffix = options.amdSuffixString; } if (!targetModule && options.singleModule) { throw new Error('When using singleModule: true be sure to specify a (target) module'); } if (options.existingModule && !options.singleModule) { throw new Error('When using existingModule: true be sure to set singleModule: true'); } if (options.singleModule) { var moduleSuffix = options.existingModule ? '' : ', []'; if (options.target === 'js') { bundle = 'angular.module(' + quoteChar + targetModule + quoteChar + moduleSuffix + ').run([' + quoteChar + '$templateCache' + quoteChar + ', function($templateCache) {\n' + strict; modules += '\n}]);\n'; } else if (options.target === 'coffee') { bundle = 'angular.module(' + quoteChar + targetModule + quoteChar + moduleSuffix + ').run([' + quoteChar + '$templateCache' + quoteChar + ', ($templateCache) ->\n'; modules += '\n])\n'; } } else if (targetModule) { //Allow a 'no targetModule if module is null' option bundle = 'angular.module(' + quoteChar + targetModule + quoteChar + ', [' + moduleNames.join(', ') + '])'; if (options.target === 'js') { bundle += ';'; } bundle += '\n\n'; } grunt.file.write(f.dest, grunt.util.normalizelf(fileHeader + amdPrefix + bundle + modules + amdSuffix + fileFooter)); }
javascript
function generateModule (f) { // f.dest must be a string or write will fail var moduleNames = []; var filePaths = f.src.filter(existsFilter); if (options.watch) { watcher.add(filePaths); } var modules = filePaths.map(function (filepath) { var moduleName = normalizePath(path.relative(options.base, filepath)); if (grunt.util.kindOf(options.rename) === 'function') { moduleName = options.rename(moduleName); } moduleNames.push(options.quoteChar + moduleName + options.quoteChar); var compiled; if (options.watch && (compiled = fileCache[filepath])) { // return compiled file contents from cache return compiled; } if (options.target === 'js') { compiled = compileTemplate(moduleName, filepath, options); } else if (options.target === 'coffee') { compiled = compileCoffeeTemplate(moduleName, filepath, options); } else { grunt.fail.fatal('Unknown target "' + options.target + '" specified'); } if (options.watch) { // store compiled file contents in cache fileCache[filepath] = compiled; } return compiled; }); // don't generate empty modules if (!modules.length) { return; } counter += modules.length; modules = modules.join('\n'); var fileHeader = options.fileHeaderString !== '' ? options.fileHeaderString + '\n' : ''; var fileFooter = options.fileFooterString !== '' ? options.fileFooterString + '\n' : ''; var bundle = ''; var targetModule = f.module || options.module; var indentString = options.indentString; var quoteChar = options.quoteChar; var strict = (options.useStrict) ? indentString + quoteChar + 'use strict' + quoteChar + ';\n' : ''; var amdPrefix = ''; var amdSuffix = ''; // If options.module is a function, use that to get the targetModule if (grunt.util.kindOf(targetModule) === 'function') { targetModule = targetModule(f, target); } if (options.amd) { amdPrefix = options.amdPrefixString; amdSuffix = options.amdSuffixString; } if (!targetModule && options.singleModule) { throw new Error('When using singleModule: true be sure to specify a (target) module'); } if (options.existingModule && !options.singleModule) { throw new Error('When using existingModule: true be sure to set singleModule: true'); } if (options.singleModule) { var moduleSuffix = options.existingModule ? '' : ', []'; if (options.target === 'js') { bundle = 'angular.module(' + quoteChar + targetModule + quoteChar + moduleSuffix + ').run([' + quoteChar + '$templateCache' + quoteChar + ', function($templateCache) {\n' + strict; modules += '\n}]);\n'; } else if (options.target === 'coffee') { bundle = 'angular.module(' + quoteChar + targetModule + quoteChar + moduleSuffix + ').run([' + quoteChar + '$templateCache' + quoteChar + ', ($templateCache) ->\n'; modules += '\n])\n'; } } else if (targetModule) { //Allow a 'no targetModule if module is null' option bundle = 'angular.module(' + quoteChar + targetModule + quoteChar + ', [' + moduleNames.join(', ') + '])'; if (options.target === 'js') { bundle += ';'; } bundle += '\n\n'; } grunt.file.write(f.dest, grunt.util.normalizelf(fileHeader + amdPrefix + bundle + modules + amdSuffix + fileFooter)); }
[ "function", "generateModule", "(", "f", ")", "{", "// f.dest must be a string or write will fail", "var", "moduleNames", "=", "[", "]", ";", "var", "filePaths", "=", "f", ".", "src", ".", "filter", "(", "existsFilter", ")", ";", "if", "(", "options", ".", "watch", ")", "{", "watcher", ".", "add", "(", "filePaths", ")", ";", "}", "var", "modules", "=", "filePaths", ".", "map", "(", "function", "(", "filepath", ")", "{", "var", "moduleName", "=", "normalizePath", "(", "path", ".", "relative", "(", "options", ".", "base", ",", "filepath", ")", ")", ";", "if", "(", "grunt", ".", "util", ".", "kindOf", "(", "options", ".", "rename", ")", "===", "'function'", ")", "{", "moduleName", "=", "options", ".", "rename", "(", "moduleName", ")", ";", "}", "moduleNames", ".", "push", "(", "options", ".", "quoteChar", "+", "moduleName", "+", "options", ".", "quoteChar", ")", ";", "var", "compiled", ";", "if", "(", "options", ".", "watch", "&&", "(", "compiled", "=", "fileCache", "[", "filepath", "]", ")", ")", "{", "// return compiled file contents from cache", "return", "compiled", ";", "}", "if", "(", "options", ".", "target", "===", "'js'", ")", "{", "compiled", "=", "compileTemplate", "(", "moduleName", ",", "filepath", ",", "options", ")", ";", "}", "else", "if", "(", "options", ".", "target", "===", "'coffee'", ")", "{", "compiled", "=", "compileCoffeeTemplate", "(", "moduleName", ",", "filepath", ",", "options", ")", ";", "}", "else", "{", "grunt", ".", "fail", ".", "fatal", "(", "'Unknown target \"'", "+", "options", ".", "target", "+", "'\" specified'", ")", ";", "}", "if", "(", "options", ".", "watch", ")", "{", "// store compiled file contents in cache", "fileCache", "[", "filepath", "]", "=", "compiled", ";", "}", "return", "compiled", ";", "}", ")", ";", "// don't generate empty modules", "if", "(", "!", "modules", ".", "length", ")", "{", "return", ";", "}", "counter", "+=", "modules", ".", "length", ";", "modules", "=", "modules", ".", "join", "(", "'\\n'", ")", ";", "var", "fileHeader", "=", "options", ".", "fileHeaderString", "!==", "''", "?", "options", ".", "fileHeaderString", "+", "'\\n'", ":", "''", ";", "var", "fileFooter", "=", "options", ".", "fileFooterString", "!==", "''", "?", "options", ".", "fileFooterString", "+", "'\\n'", ":", "''", ";", "var", "bundle", "=", "''", ";", "var", "targetModule", "=", "f", ".", "module", "||", "options", ".", "module", ";", "var", "indentString", "=", "options", ".", "indentString", ";", "var", "quoteChar", "=", "options", ".", "quoteChar", ";", "var", "strict", "=", "(", "options", ".", "useStrict", ")", "?", "indentString", "+", "quoteChar", "+", "'use strict'", "+", "quoteChar", "+", "';\\n'", ":", "''", ";", "var", "amdPrefix", "=", "''", ";", "var", "amdSuffix", "=", "''", ";", "// If options.module is a function, use that to get the targetModule", "if", "(", "grunt", ".", "util", ".", "kindOf", "(", "targetModule", ")", "===", "'function'", ")", "{", "targetModule", "=", "targetModule", "(", "f", ",", "target", ")", ";", "}", "if", "(", "options", ".", "amd", ")", "{", "amdPrefix", "=", "options", ".", "amdPrefixString", ";", "amdSuffix", "=", "options", ".", "amdSuffixString", ";", "}", "if", "(", "!", "targetModule", "&&", "options", ".", "singleModule", ")", "{", "throw", "new", "Error", "(", "'When using singleModule: true be sure to specify a (target) module'", ")", ";", "}", "if", "(", "options", ".", "existingModule", "&&", "!", "options", ".", "singleModule", ")", "{", "throw", "new", "Error", "(", "'When using existingModule: true be sure to set singleModule: true'", ")", ";", "}", "if", "(", "options", ".", "singleModule", ")", "{", "var", "moduleSuffix", "=", "options", ".", "existingModule", "?", "''", ":", "', []'", ";", "if", "(", "options", ".", "target", "===", "'js'", ")", "{", "bundle", "=", "'angular.module('", "+", "quoteChar", "+", "targetModule", "+", "quoteChar", "+", "moduleSuffix", "+", "').run(['", "+", "quoteChar", "+", "'$templateCache'", "+", "quoteChar", "+", "', function($templateCache) {\\n'", "+", "strict", ";", "modules", "+=", "'\\n}]);\\n'", ";", "}", "else", "if", "(", "options", ".", "target", "===", "'coffee'", ")", "{", "bundle", "=", "'angular.module('", "+", "quoteChar", "+", "targetModule", "+", "quoteChar", "+", "moduleSuffix", "+", "').run(['", "+", "quoteChar", "+", "'$templateCache'", "+", "quoteChar", "+", "', ($templateCache) ->\\n'", ";", "modules", "+=", "'\\n])\\n'", ";", "}", "}", "else", "if", "(", "targetModule", ")", "{", "//Allow a 'no targetModule if module is null' option", "bundle", "=", "'angular.module('", "+", "quoteChar", "+", "targetModule", "+", "quoteChar", "+", "', ['", "+", "moduleNames", ".", "join", "(", "', '", ")", "+", "'])'", ";", "if", "(", "options", ".", "target", "===", "'js'", ")", "{", "bundle", "+=", "';'", ";", "}", "bundle", "+=", "'\\n\\n'", ";", "}", "grunt", ".", "file", ".", "write", "(", "f", ".", "dest", ",", "grunt", ".", "util", ".", "normalizelf", "(", "fileHeader", "+", "amdPrefix", "+", "bundle", "+", "modules", "+", "amdSuffix", "+", "fileFooter", ")", ")", ";", "}" ]
generate a separate module
[ "generate", "a", "separate", "module" ]
9faf4a2e2a3491edf996f3ffc3b0f4eb153f48b3
https://github.com/rquadling/grunt-html2js/blob/9faf4a2e2a3491edf996f3ffc3b0f4eb153f48b3/tasks/html2js.js#L170-L265
20,489
ezraroi/ngJsTree
demo/bower_components/AngularJS-Toaster/toaster.js
function (scope, elm, attrs) { var id = 0, mergedConfig; mergedConfig = angular.extend({}, toasterConfig, scope.$eval(attrs.toasterOptions)); scope.config = { position: mergedConfig['position-class'], title: mergedConfig['title-class'], message: mergedConfig['message-class'], tap: mergedConfig['tap-to-dismiss'], closeButton: mergedConfig['close-button'] }; scope.configureTimer = function configureTimer(toast) { var timeout = typeof (toast.timeout) == "number" ? toast.timeout : mergedConfig['time-out']; if (timeout > 0) setTimeout(toast, timeout); }; function addToast(toast) { toast.type = mergedConfig['icon-classes'][toast.type]; if (!toast.type) toast.type = mergedConfig['icon-class']; id++; angular.extend(toast, { id: id }); // Set the toast.bodyOutputType to the default if it isn't set toast.bodyOutputType = toast.bodyOutputType || mergedConfig['body-output-type']; switch (toast.bodyOutputType) { case 'trustedHtml': toast.html = $sce.trustAsHtml(toast.body); break; case 'template': toast.bodyTemplate = toast.body || mergedConfig['body-template']; break; } scope.configureTimer(toast); if (mergedConfig['newest-on-top'] === true) { scope.toasters.unshift(toast); if (mergedConfig['limit'] > 0 && scope.toasters.length > mergedConfig['limit']) { scope.toasters.pop(); } } else { scope.toasters.push(toast); if (mergedConfig['limit'] > 0 && scope.toasters.length > mergedConfig['limit']) { scope.toasters.shift(); } } } function setTimeout(toast, time) { toast.timeout = $timeout(function () { scope.removeToast(toast.id); }, time); } scope.toasters = []; scope.$on('toaster-newToast', function () { addToast(toaster.toast); }); scope.$on('toaster-clearToasts', function () { scope.toasters.splice(0, scope.toasters.length); }); }
javascript
function (scope, elm, attrs) { var id = 0, mergedConfig; mergedConfig = angular.extend({}, toasterConfig, scope.$eval(attrs.toasterOptions)); scope.config = { position: mergedConfig['position-class'], title: mergedConfig['title-class'], message: mergedConfig['message-class'], tap: mergedConfig['tap-to-dismiss'], closeButton: mergedConfig['close-button'] }; scope.configureTimer = function configureTimer(toast) { var timeout = typeof (toast.timeout) == "number" ? toast.timeout : mergedConfig['time-out']; if (timeout > 0) setTimeout(toast, timeout); }; function addToast(toast) { toast.type = mergedConfig['icon-classes'][toast.type]; if (!toast.type) toast.type = mergedConfig['icon-class']; id++; angular.extend(toast, { id: id }); // Set the toast.bodyOutputType to the default if it isn't set toast.bodyOutputType = toast.bodyOutputType || mergedConfig['body-output-type']; switch (toast.bodyOutputType) { case 'trustedHtml': toast.html = $sce.trustAsHtml(toast.body); break; case 'template': toast.bodyTemplate = toast.body || mergedConfig['body-template']; break; } scope.configureTimer(toast); if (mergedConfig['newest-on-top'] === true) { scope.toasters.unshift(toast); if (mergedConfig['limit'] > 0 && scope.toasters.length > mergedConfig['limit']) { scope.toasters.pop(); } } else { scope.toasters.push(toast); if (mergedConfig['limit'] > 0 && scope.toasters.length > mergedConfig['limit']) { scope.toasters.shift(); } } } function setTimeout(toast, time) { toast.timeout = $timeout(function () { scope.removeToast(toast.id); }, time); } scope.toasters = []; scope.$on('toaster-newToast', function () { addToast(toaster.toast); }); scope.$on('toaster-clearToasts', function () { scope.toasters.splice(0, scope.toasters.length); }); }
[ "function", "(", "scope", ",", "elm", ",", "attrs", ")", "{", "var", "id", "=", "0", ",", "mergedConfig", ";", "mergedConfig", "=", "angular", ".", "extend", "(", "{", "}", ",", "toasterConfig", ",", "scope", ".", "$eval", "(", "attrs", ".", "toasterOptions", ")", ")", ";", "scope", ".", "config", "=", "{", "position", ":", "mergedConfig", "[", "'position-class'", "]", ",", "title", ":", "mergedConfig", "[", "'title-class'", "]", ",", "message", ":", "mergedConfig", "[", "'message-class'", "]", ",", "tap", ":", "mergedConfig", "[", "'tap-to-dismiss'", "]", ",", "closeButton", ":", "mergedConfig", "[", "'close-button'", "]", "}", ";", "scope", ".", "configureTimer", "=", "function", "configureTimer", "(", "toast", ")", "{", "var", "timeout", "=", "typeof", "(", "toast", ".", "timeout", ")", "==", "\"number\"", "?", "toast", ".", "timeout", ":", "mergedConfig", "[", "'time-out'", "]", ";", "if", "(", "timeout", ">", "0", ")", "setTimeout", "(", "toast", ",", "timeout", ")", ";", "}", ";", "function", "addToast", "(", "toast", ")", "{", "toast", ".", "type", "=", "mergedConfig", "[", "'icon-classes'", "]", "[", "toast", ".", "type", "]", ";", "if", "(", "!", "toast", ".", "type", ")", "toast", ".", "type", "=", "mergedConfig", "[", "'icon-class'", "]", ";", "id", "++", ";", "angular", ".", "extend", "(", "toast", ",", "{", "id", ":", "id", "}", ")", ";", "// Set the toast.bodyOutputType to the default if it isn't set", "toast", ".", "bodyOutputType", "=", "toast", ".", "bodyOutputType", "||", "mergedConfig", "[", "'body-output-type'", "]", ";", "switch", "(", "toast", ".", "bodyOutputType", ")", "{", "case", "'trustedHtml'", ":", "toast", ".", "html", "=", "$sce", ".", "trustAsHtml", "(", "toast", ".", "body", ")", ";", "break", ";", "case", "'template'", ":", "toast", ".", "bodyTemplate", "=", "toast", ".", "body", "||", "mergedConfig", "[", "'body-template'", "]", ";", "break", ";", "}", "scope", ".", "configureTimer", "(", "toast", ")", ";", "if", "(", "mergedConfig", "[", "'newest-on-top'", "]", "===", "true", ")", "{", "scope", ".", "toasters", ".", "unshift", "(", "toast", ")", ";", "if", "(", "mergedConfig", "[", "'limit'", "]", ">", "0", "&&", "scope", ".", "toasters", ".", "length", ">", "mergedConfig", "[", "'limit'", "]", ")", "{", "scope", ".", "toasters", ".", "pop", "(", ")", ";", "}", "}", "else", "{", "scope", ".", "toasters", ".", "push", "(", "toast", ")", ";", "if", "(", "mergedConfig", "[", "'limit'", "]", ">", "0", "&&", "scope", ".", "toasters", ".", "length", ">", "mergedConfig", "[", "'limit'", "]", ")", "{", "scope", ".", "toasters", ".", "shift", "(", ")", ";", "}", "}", "}", "function", "setTimeout", "(", "toast", ",", "time", ")", "{", "toast", ".", "timeout", "=", "$timeout", "(", "function", "(", ")", "{", "scope", ".", "removeToast", "(", "toast", ".", "id", ")", ";", "}", ",", "time", ")", ";", "}", "scope", ".", "toasters", "=", "[", "]", ";", "scope", ".", "$on", "(", "'toaster-newToast'", ",", "function", "(", ")", "{", "addToast", "(", "toaster", ".", "toast", ")", ";", "}", ")", ";", "scope", ".", "$on", "(", "'toaster-clearToasts'", ",", "function", "(", ")", "{", "scope", ".", "toasters", ".", "splice", "(", "0", ",", "scope", ".", "toasters", ".", "length", ")", ";", "}", ")", ";", "}" ]
creates an internal scope for this directive
[ "creates", "an", "internal", "scope", "for", "this", "directive" ]
bb323525a885f3a7cf9b231de8138492c0c96dbb
https://github.com/ezraroi/ngJsTree/blob/bb323525a885f3a7cf9b231de8138492c0c96dbb/demo/bower_components/AngularJS-Toaster/toaster.js#L65-L134
20,490
iamisti/mdDataTable
dist/md-data-table.js
_setDefaultTranslations
function _setDefaultTranslations(){ $scope.mdtTranslations = $scope.mdtTranslations || {}; $scope.mdtTranslations.rowsPerPage = $scope.mdtTranslations.rowsPerPage || 'Rows per page:'; $scope.mdtTranslations.largeEditDialog = $scope.mdtTranslations.largeEditDialog || {}; $scope.mdtTranslations.largeEditDialog.saveButtonLabel = $scope.mdtTranslations.largeEditDialog.saveButtonLabel || 'Save'; $scope.mdtTranslations.largeEditDialog.cancelButtonLabel = $scope.mdtTranslations.largeEditDialog.cancelButtonLabel || 'Cancel'; }
javascript
function _setDefaultTranslations(){ $scope.mdtTranslations = $scope.mdtTranslations || {}; $scope.mdtTranslations.rowsPerPage = $scope.mdtTranslations.rowsPerPage || 'Rows per page:'; $scope.mdtTranslations.largeEditDialog = $scope.mdtTranslations.largeEditDialog || {}; $scope.mdtTranslations.largeEditDialog.saveButtonLabel = $scope.mdtTranslations.largeEditDialog.saveButtonLabel || 'Save'; $scope.mdtTranslations.largeEditDialog.cancelButtonLabel = $scope.mdtTranslations.largeEditDialog.cancelButtonLabel || 'Cancel'; }
[ "function", "_setDefaultTranslations", "(", ")", "{", "$scope", ".", "mdtTranslations", "=", "$scope", ".", "mdtTranslations", "||", "{", "}", ";", "$scope", ".", "mdtTranslations", ".", "rowsPerPage", "=", "$scope", ".", "mdtTranslations", ".", "rowsPerPage", "||", "'Rows per page:'", ";", "$scope", ".", "mdtTranslations", ".", "largeEditDialog", "=", "$scope", ".", "mdtTranslations", ".", "largeEditDialog", "||", "{", "}", ";", "$scope", ".", "mdtTranslations", ".", "largeEditDialog", ".", "saveButtonLabel", "=", "$scope", ".", "mdtTranslations", ".", "largeEditDialog", ".", "saveButtonLabel", "||", "'Save'", ";", "$scope", ".", "mdtTranslations", ".", "largeEditDialog", ".", "cancelButtonLabel", "=", "$scope", ".", "mdtTranslations", ".", "largeEditDialog", ".", "cancelButtonLabel", "||", "'Cancel'", ";", "}" ]
set translations or fallback to a default value
[ "set", "translations", "or", "fallback", "to", "a", "default", "value" ]
85f0902f81912208514d5d9b334e90a7cec510fc
https://github.com/iamisti/mdDataTable/blob/85f0902f81912208514d5d9b334e90a7cec510fc/dist/md-data-table.js#L277-L285
20,491
iamisti/mdDataTable
dist/md-data-table.js
_processData
function _processData(){ if(_.isEmpty($scope.mdtRow)) { return; } //local search/filter if (angular.isUndefined($scope.mdtRowPaginator)) { $scope.$watch('mdtRow', function (mdtRow) { vm.dataStorage.storage = []; _addRawDataToStorage(mdtRow['data']); }, true); }else{ //if it's used for 'Ajax pagination' } }
javascript
function _processData(){ if(_.isEmpty($scope.mdtRow)) { return; } //local search/filter if (angular.isUndefined($scope.mdtRowPaginator)) { $scope.$watch('mdtRow', function (mdtRow) { vm.dataStorage.storage = []; _addRawDataToStorage(mdtRow['data']); }, true); }else{ //if it's used for 'Ajax pagination' } }
[ "function", "_processData", "(", ")", "{", "if", "(", "_", ".", "isEmpty", "(", "$scope", ".", "mdtRow", ")", ")", "{", "return", ";", "}", "//local search/filter", "if", "(", "angular", ".", "isUndefined", "(", "$scope", ".", "mdtRowPaginator", ")", ")", "{", "$scope", ".", "$watch", "(", "'mdtRow'", ",", "function", "(", "mdtRow", ")", "{", "vm", ".", "dataStorage", ".", "storage", "=", "[", "]", ";", "_addRawDataToStorage", "(", "mdtRow", "[", "'data'", "]", ")", ";", "}", ",", "true", ")", ";", "}", "else", "{", "//if it's used for 'Ajax pagination'", "}", "}" ]
fill storage with values if set
[ "fill", "storage", "with", "values", "if", "set" ]
85f0902f81912208514d5d9b334e90a7cec510fc
https://github.com/iamisti/mdDataTable/blob/85f0902f81912208514d5d9b334e90a7cec510fc/dist/md-data-table.js#L288-L303
20,492
iamisti/mdDataTable
demo/developmentArea.js
nutritionNameFilterCallback
function nutritionNameFilterCallback(names){ var arr = _.filter(nutritionList, function(item){ return item.fields.item_name.toLowerCase().indexOf(names.toLowerCase()) !== -1; }); return $q.resolve(arr); }
javascript
function nutritionNameFilterCallback(names){ var arr = _.filter(nutritionList, function(item){ return item.fields.item_name.toLowerCase().indexOf(names.toLowerCase()) !== -1; }); return $q.resolve(arr); }
[ "function", "nutritionNameFilterCallback", "(", "names", ")", "{", "var", "arr", "=", "_", ".", "filter", "(", "nutritionList", ",", "function", "(", "item", ")", "{", "return", "item", ".", "fields", ".", "item_name", ".", "toLowerCase", "(", ")", ".", "indexOf", "(", "names", ".", "toLowerCase", "(", ")", ")", "!==", "-", "1", ";", "}", ")", ";", "return", "$q", ".", "resolve", "(", "arr", ")", ";", "}" ]
name column filter functions
[ "name", "column", "filter", "functions" ]
85f0902f81912208514d5d9b334e90a7cec510fc
https://github.com/iamisti/mdDataTable/blob/85f0902f81912208514d5d9b334e90a7cec510fc/demo/developmentArea.js#L28-L34
20,493
iamisti/mdDataTable
demo/developmentArea.js
serviceUnitsFilterCallback
function serviceUnitsFilterCallback(){ var arr = _.filter(nutritionList, function(item){ return item.fields.nf_serving_size_unit && item.fields.nf_serving_size_unit.toLowerCase(); }); arr = _.uniq(arr, function(item){ return item.fields.nf_serving_size_unit;}); return $q.resolve(arr); }
javascript
function serviceUnitsFilterCallback(){ var arr = _.filter(nutritionList, function(item){ return item.fields.nf_serving_size_unit && item.fields.nf_serving_size_unit.toLowerCase(); }); arr = _.uniq(arr, function(item){ return item.fields.nf_serving_size_unit;}); return $q.resolve(arr); }
[ "function", "serviceUnitsFilterCallback", "(", ")", "{", "var", "arr", "=", "_", ".", "filter", "(", "nutritionList", ",", "function", "(", "item", ")", "{", "return", "item", ".", "fields", ".", "nf_serving_size_unit", "&&", "item", ".", "fields", ".", "nf_serving_size_unit", ".", "toLowerCase", "(", ")", ";", "}", ")", ";", "arr", "=", "_", ".", "uniq", "(", "arr", ",", "function", "(", "item", ")", "{", "return", "item", ".", "fields", ".", "nf_serving_size_unit", ";", "}", ")", ";", "return", "$q", ".", "resolve", "(", "arr", ")", ";", "}" ]
service units filter
[ "service", "units", "filter" ]
85f0902f81912208514d5d9b334e90a7cec510fc
https://github.com/iamisti/mdDataTable/blob/85f0902f81912208514d5d9b334e90a7cec510fc/demo/developmentArea.js#L41-L49
20,494
iamisti/mdDataTable
demo/developmentArea.js
fatValuesCallback
function fatValuesCallback(){ return $q.resolve([ { name: '> 50%', comparator: function(val){ return val > 50;} }, { name: '<= 50%', comparator: function(val){ return val <= 50;} }]); }
javascript
function fatValuesCallback(){ return $q.resolve([ { name: '> 50%', comparator: function(val){ return val > 50;} }, { name: '<= 50%', comparator: function(val){ return val <= 50;} }]); }
[ "function", "fatValuesCallback", "(", ")", "{", "return", "$q", ".", "resolve", "(", "[", "{", "name", ":", "'> 50%'", ",", "comparator", ":", "function", "(", "val", ")", "{", "return", "val", ">", "50", ";", "}", "}", ",", "{", "name", ":", "'<= 50%'", ",", "comparator", ":", "function", "(", "val", ")", "{", "return", "val", "<=", "50", ";", "}", "}", "]", ")", ";", "}" ]
fat values filter
[ "fat", "values", "filter" ]
85f0902f81912208514d5d9b334e90a7cec510fc
https://github.com/iamisti/mdDataTable/blob/85f0902f81912208514d5d9b334e90a7cec510fc/demo/developmentArea.js#L56-L65
20,495
iamisti/mdDataTable
demo/developmentArea.js
paginatorCallback
function paginatorCallback(page, pageSize, options){ console.log(options); var filtersApplied = options.columnFilter; var offset = (page-1) * pageSize; var result = nutritionList; if(filtersApplied[0].length) { result = _.filter(nutritionList, function (aNutrition) { var res = false; _.each(filtersApplied[0], function(filteredNutrition){ if(res){ return; } res = aNutrition.fields.item_name.indexOf(filteredNutrition.fields.item_name) !== -1; }); return res; }); } if(filtersApplied[1].length) { result = _.filter(result, function (aNutrition) { var res = false; _.each(filtersApplied[1], function(filteredNutrition){ if(res){ return; } res = aNutrition.fields.nf_serving_size_unit && aNutrition.fields.nf_serving_size_unit.toLowerCase() == filteredNutrition.fields.nf_serving_size_unit && filteredNutrition.fields.nf_serving_size_unit.toLowerCase(); }); return res; }); } if(filtersApplied[2].length) { result = _.filter(result, function (aNutrition) { var res = false; _.each(filtersApplied[2], function(fatObject){ if(res){ return; } res = fatObject.comparator(aNutrition.fields.nf_total_fat); }); return res; }); } return $q(function(resolve, reject){ setTimeout(function(){ resolve({ results: result.slice(offset, offset + pageSize), totalResultCount: result.length }); },1000); }); }
javascript
function paginatorCallback(page, pageSize, options){ console.log(options); var filtersApplied = options.columnFilter; var offset = (page-1) * pageSize; var result = nutritionList; if(filtersApplied[0].length) { result = _.filter(nutritionList, function (aNutrition) { var res = false; _.each(filtersApplied[0], function(filteredNutrition){ if(res){ return; } res = aNutrition.fields.item_name.indexOf(filteredNutrition.fields.item_name) !== -1; }); return res; }); } if(filtersApplied[1].length) { result = _.filter(result, function (aNutrition) { var res = false; _.each(filtersApplied[1], function(filteredNutrition){ if(res){ return; } res = aNutrition.fields.nf_serving_size_unit && aNutrition.fields.nf_serving_size_unit.toLowerCase() == filteredNutrition.fields.nf_serving_size_unit && filteredNutrition.fields.nf_serving_size_unit.toLowerCase(); }); return res; }); } if(filtersApplied[2].length) { result = _.filter(result, function (aNutrition) { var res = false; _.each(filtersApplied[2], function(fatObject){ if(res){ return; } res = fatObject.comparator(aNutrition.fields.nf_total_fat); }); return res; }); } return $q(function(resolve, reject){ setTimeout(function(){ resolve({ results: result.slice(offset, offset + pageSize), totalResultCount: result.length }); },1000); }); }
[ "function", "paginatorCallback", "(", "page", ",", "pageSize", ",", "options", ")", "{", "console", ".", "log", "(", "options", ")", ";", "var", "filtersApplied", "=", "options", ".", "columnFilter", ";", "var", "offset", "=", "(", "page", "-", "1", ")", "*", "pageSize", ";", "var", "result", "=", "nutritionList", ";", "if", "(", "filtersApplied", "[", "0", "]", ".", "length", ")", "{", "result", "=", "_", ".", "filter", "(", "nutritionList", ",", "function", "(", "aNutrition", ")", "{", "var", "res", "=", "false", ";", "_", ".", "each", "(", "filtersApplied", "[", "0", "]", ",", "function", "(", "filteredNutrition", ")", "{", "if", "(", "res", ")", "{", "return", ";", "}", "res", "=", "aNutrition", ".", "fields", ".", "item_name", ".", "indexOf", "(", "filteredNutrition", ".", "fields", ".", "item_name", ")", "!==", "-", "1", ";", "}", ")", ";", "return", "res", ";", "}", ")", ";", "}", "if", "(", "filtersApplied", "[", "1", "]", ".", "length", ")", "{", "result", "=", "_", ".", "filter", "(", "result", ",", "function", "(", "aNutrition", ")", "{", "var", "res", "=", "false", ";", "_", ".", "each", "(", "filtersApplied", "[", "1", "]", ",", "function", "(", "filteredNutrition", ")", "{", "if", "(", "res", ")", "{", "return", ";", "}", "res", "=", "aNutrition", ".", "fields", ".", "nf_serving_size_unit", "&&", "aNutrition", ".", "fields", ".", "nf_serving_size_unit", ".", "toLowerCase", "(", ")", "==", "filteredNutrition", ".", "fields", ".", "nf_serving_size_unit", "&&", "filteredNutrition", ".", "fields", ".", "nf_serving_size_unit", ".", "toLowerCase", "(", ")", ";", "}", ")", ";", "return", "res", ";", "}", ")", ";", "}", "if", "(", "filtersApplied", "[", "2", "]", ".", "length", ")", "{", "result", "=", "_", ".", "filter", "(", "result", ",", "function", "(", "aNutrition", ")", "{", "var", "res", "=", "false", ";", "_", ".", "each", "(", "filtersApplied", "[", "2", "]", ",", "function", "(", "fatObject", ")", "{", "if", "(", "res", ")", "{", "return", ";", "}", "res", "=", "fatObject", ".", "comparator", "(", "aNutrition", ".", "fields", ".", "nf_total_fat", ")", ";", "}", ")", ";", "return", "res", ";", "}", ")", ";", "}", "return", "$q", "(", "function", "(", "resolve", ",", "reject", ")", "{", "setTimeout", "(", "function", "(", ")", "{", "resolve", "(", "{", "results", ":", "result", ".", "slice", "(", "offset", ",", "offset", "+", "pageSize", ")", ",", "totalResultCount", ":", "result", ".", "length", "}", ")", ";", "}", ",", "1000", ")", ";", "}", ")", ";", "}" ]
table search endpoint Don't look carefully the implementation details of this method, since it's just emulates an API call which increases the complexity of it. What happens here is just simply playing with the values passed with `filtersApplied` parameter, and trying to filter the array of nutritions.
[ "table", "search", "endpoint", "Don", "t", "look", "carefully", "the", "implementation", "details", "of", "this", "method", "since", "it", "s", "just", "emulates", "an", "API", "call", "which", "increases", "the", "complexity", "of", "it", ".", "What", "happens", "here", "is", "just", "simply", "playing", "with", "the", "values", "passed", "with", "filtersApplied", "parameter", "and", "trying", "to", "filter", "the", "array", "of", "nutritions", "." ]
85f0902f81912208514d5d9b334e90a7cec510fc
https://github.com/iamisti/mdDataTable/blob/85f0902f81912208514d5d9b334e90a7cec510fc/demo/developmentArea.js#L74-L137
20,496
wso2/carbon-dashboards
components/dashboards-web-component/src/utils/WidgetClassRegistry.js
extendsFromDeprecatedWidgetClassVersion
function extendsFromDeprecatedWidgetClassVersion(widgetClass) { return Object.getPrototypeOf(widgetClass.prototype).constructor.version !== Widget.version; }
javascript
function extendsFromDeprecatedWidgetClassVersion(widgetClass) { return Object.getPrototypeOf(widgetClass.prototype).constructor.version !== Widget.version; }
[ "function", "extendsFromDeprecatedWidgetClassVersion", "(", "widgetClass", ")", "{", "return", "Object", ".", "getPrototypeOf", "(", "widgetClass", ".", "prototype", ")", ".", "constructor", ".", "version", "!==", "Widget", ".", "version", ";", "}" ]
Following is to maintain backward compatibility with SP-4.0.0, SP-4.1.0 Checks whether given widget class extends from a deprecated version of @wso2-dashboards/widget class. @param {class} widgetClass class to be checked @returns {boolean} true if extend from a deprecated version of the Widget class, otherwise false @private
[ "Following", "is", "to", "maintain", "backward", "compatibility", "with", "SP", "-", "4", ".", "0", ".", "0", "SP", "-", "4", ".", "1", ".", "0", "Checks", "whether", "given", "widget", "class", "extends", "from", "a", "deprecated", "version", "of" ]
9bbfd52d237f38dd3ade3455f78c9859ae506d20
https://github.com/wso2/carbon-dashboards/blob/9bbfd52d237f38dd3ade3455f78c9859ae506d20/components/dashboards-web-component/src/utils/WidgetClassRegistry.js#L78-L80
20,497
wso2/carbon-dashboards
components/dashboards-web-component/src/utils/WidgetClassRegistry.js
patchWidgetClass
function patchWidgetClass(widgetClass) { const superWidgetClassPrototype = Object.getPrototypeOf(widgetClass.prototype); // Patch subscribe method. superWidgetClassPrototype.subscribe = Widget.prototype.subscribe; // Patch publish method. superWidgetClassPrototype.publish = Widget.prototype.publish; }
javascript
function patchWidgetClass(widgetClass) { const superWidgetClassPrototype = Object.getPrototypeOf(widgetClass.prototype); // Patch subscribe method. superWidgetClassPrototype.subscribe = Widget.prototype.subscribe; // Patch publish method. superWidgetClassPrototype.publish = Widget.prototype.publish; }
[ "function", "patchWidgetClass", "(", "widgetClass", ")", "{", "const", "superWidgetClassPrototype", "=", "Object", ".", "getPrototypeOf", "(", "widgetClass", ".", "prototype", ")", ";", "// Patch subscribe method.", "superWidgetClassPrototype", ".", "subscribe", "=", "Widget", ".", "prototype", ".", "subscribe", ";", "// Patch publish method.", "superWidgetClassPrototype", ".", "publish", "=", "Widget", ".", "prototype", ".", "publish", ";", "}" ]
Patches given widget class which extends from a deprecated version of @wso2-dashboards/widget class, to be compatible with newer versions. @param {class} widgetClass widget class to be patched @private
[ "Patches", "given", "widget", "class", "which", "extends", "from", "a", "deprecated", "version", "of" ]
9bbfd52d237f38dd3ade3455f78c9859ae506d20
https://github.com/wso2/carbon-dashboards/blob/9bbfd52d237f38dd3ade3455f78c9859ae506d20/components/dashboards-web-component/src/utils/WidgetClassRegistry.js#L88-L94
20,498
mapbox/eslint-plugin-react-filenames
lib/rules/filename-matches-component.js
reportNonMatchingComponentName
function reportNonMatchingComponentName(node, rawName, name, filename) { context.report( node, 'Component name ' + rawName + ' (' + name + ') does not match filename ' + filename ); }
javascript
function reportNonMatchingComponentName(node, rawName, name, filename) { context.report( node, 'Component name ' + rawName + ' (' + name + ') does not match filename ' + filename ); }
[ "function", "reportNonMatchingComponentName", "(", "node", ",", "rawName", ",", "name", ",", "filename", ")", "{", "context", ".", "report", "(", "node", ",", "'Component name '", "+", "rawName", "+", "' ('", "+", "name", "+", "') does not match filename '", "+", "filename", ")", ";", "}" ]
Reports missing display name for a given component @param {Object} component The component to process
[ "Reports", "missing", "display", "name", "for", "a", "given", "component" ]
d25030b865124f2f0555ba17b8f73a99c2111af0
https://github.com/mapbox/eslint-plugin-react-filenames/blob/d25030b865124f2f0555ba17b8f73a99c2111af0/lib/rules/filename-matches-component.js#L69-L74
20,499
mapbox/watchbot-progress
lib/progress.js
client
function client(table) { table = table || process.env.ProgressTable; if (!table) throw new Error('ProgressTable environment variable is not set'); var dyno = module.exports.Dyno({ table: table.split(':')[5].split('/')[1], region: table.split(':')[3], endpoint: process.env.DynamoDbEndpoint }); /** * Watchbot's progress client * * @name client */ return { /** * Sets the total number of parts for a map-reduce job * * @memberof client * @param {string} jobId - the identifier for a map-reduce job * @param {number} total - the total number of parts * @param {function} [callback] - a function that will be called when the total * number of parts for this job has been recorded * @returns {promise} */ setTotal: setTotal.bind(null, dyno), /** * Mark one part of a map-reduce job as complete * * @memberof client * @param {string} jobId - the identifier for a map-reduce job * @param {number} part - the part that has completed (1-based, not 0-based) * @param {function} [callback] - a function that will be called indicating whether * or not the entire map-reduce job is complete * @returns {promise} */ completePart: completePart.bind(null, dyno), /** * Fetch the status of a pending job * * @memberof client * @param {string} jobId - the identifier for a map-reduce job * @param {number} [part] - the part number to check on * @param {function} [callback] - a function that will be called indicating the * current job status * @returns {promise} * @example * // a pending job that is 25% complete * { "progress": 0.25 } * @example * // a completed job * { "progress": 1 } * @example * // a job that failed after completing 60% of the work * { "progress": 0.60, "failed": "the reason for the failure" } * @example * // a job 75% complete which includes metadata * { "progress": 0.75, "metadata": { "name": "favorite-map-reduce" } } * @example * // a job 75% complete indicating that the requested part has already been completed * { "progress": 0.75, "partComplete": true } * @example * // a job 100% complete indicating that the reduce step has been taken * { "progress": 0.75, "reduceSent": true } */ status: status.bind(null, dyno), /** * Flag a job record to indicate that a reduce step has been taken. * * @param {string} jobId - the identifier for a map-reduce job * @param {function} [callback] - a function that will be called when the flag has been set * @returns {promise} */ reduceSent: reduceSent.bind(null, dyno), /** * Fail a job * * @memberof client * @param {string} jobId - the identifier for a map-reduce job * @param {string} reason - a description of why the job failed * @param {function} [callback] - a function that will be called when the reason * for the failure has been recorded * @returns {promise} */ failJob: failJob.bind(null, dyno), /** * Associate arbitrary metadata with the progress record which can be retrieved * with a status request. * * @param {string} jobId - the identifier for a map-reduce job * @param {object} metadata - arbitrary metadata to store with the progress record. * @param {function} [callback] - a function that will be called when the metadata * has been recorded * @returns {promise} */ setMetadata: setMetadata.bind(null, dyno) }; }
javascript
function client(table) { table = table || process.env.ProgressTable; if (!table) throw new Error('ProgressTable environment variable is not set'); var dyno = module.exports.Dyno({ table: table.split(':')[5].split('/')[1], region: table.split(':')[3], endpoint: process.env.DynamoDbEndpoint }); /** * Watchbot's progress client * * @name client */ return { /** * Sets the total number of parts for a map-reduce job * * @memberof client * @param {string} jobId - the identifier for a map-reduce job * @param {number} total - the total number of parts * @param {function} [callback] - a function that will be called when the total * number of parts for this job has been recorded * @returns {promise} */ setTotal: setTotal.bind(null, dyno), /** * Mark one part of a map-reduce job as complete * * @memberof client * @param {string} jobId - the identifier for a map-reduce job * @param {number} part - the part that has completed (1-based, not 0-based) * @param {function} [callback] - a function that will be called indicating whether * or not the entire map-reduce job is complete * @returns {promise} */ completePart: completePart.bind(null, dyno), /** * Fetch the status of a pending job * * @memberof client * @param {string} jobId - the identifier for a map-reduce job * @param {number} [part] - the part number to check on * @param {function} [callback] - a function that will be called indicating the * current job status * @returns {promise} * @example * // a pending job that is 25% complete * { "progress": 0.25 } * @example * // a completed job * { "progress": 1 } * @example * // a job that failed after completing 60% of the work * { "progress": 0.60, "failed": "the reason for the failure" } * @example * // a job 75% complete which includes metadata * { "progress": 0.75, "metadata": { "name": "favorite-map-reduce" } } * @example * // a job 75% complete indicating that the requested part has already been completed * { "progress": 0.75, "partComplete": true } * @example * // a job 100% complete indicating that the reduce step has been taken * { "progress": 0.75, "reduceSent": true } */ status: status.bind(null, dyno), /** * Flag a job record to indicate that a reduce step has been taken. * * @param {string} jobId - the identifier for a map-reduce job * @param {function} [callback] - a function that will be called when the flag has been set * @returns {promise} */ reduceSent: reduceSent.bind(null, dyno), /** * Fail a job * * @memberof client * @param {string} jobId - the identifier for a map-reduce job * @param {string} reason - a description of why the job failed * @param {function} [callback] - a function that will be called when the reason * for the failure has been recorded * @returns {promise} */ failJob: failJob.bind(null, dyno), /** * Associate arbitrary metadata with the progress record which can be retrieved * with a status request. * * @param {string} jobId - the identifier for a map-reduce job * @param {object} metadata - arbitrary metadata to store with the progress record. * @param {function} [callback] - a function that will be called when the metadata * has been recorded * @returns {promise} */ setMetadata: setMetadata.bind(null, dyno) }; }
[ "function", "client", "(", "table", ")", "{", "table", "=", "table", "||", "process", ".", "env", ".", "ProgressTable", ";", "if", "(", "!", "table", ")", "throw", "new", "Error", "(", "'ProgressTable environment variable is not set'", ")", ";", "var", "dyno", "=", "module", ".", "exports", ".", "Dyno", "(", "{", "table", ":", "table", ".", "split", "(", "':'", ")", "[", "5", "]", ".", "split", "(", "'/'", ")", "[", "1", "]", ",", "region", ":", "table", ".", "split", "(", "':'", ")", "[", "3", "]", ",", "endpoint", ":", "process", ".", "env", ".", "DynamoDbEndpoint", "}", ")", ";", "/**\n * Watchbot's progress client\n *\n * @name client\n */", "return", "{", "/**\n * Sets the total number of parts for a map-reduce job\n *\n * @memberof client\n * @param {string} jobId - the identifier for a map-reduce job\n * @param {number} total - the total number of parts\n * @param {function} [callback] - a function that will be called when the total\n * number of parts for this job has been recorded\n * @returns {promise}\n */", "setTotal", ":", "setTotal", ".", "bind", "(", "null", ",", "dyno", ")", ",", "/**\n * Mark one part of a map-reduce job as complete\n *\n * @memberof client\n * @param {string} jobId - the identifier for a map-reduce job\n * @param {number} part - the part that has completed (1-based, not 0-based)\n * @param {function} [callback] - a function that will be called indicating whether\n * or not the entire map-reduce job is complete\n * @returns {promise}\n */", "completePart", ":", "completePart", ".", "bind", "(", "null", ",", "dyno", ")", ",", "/**\n * Fetch the status of a pending job\n *\n * @memberof client\n * @param {string} jobId - the identifier for a map-reduce job\n * @param {number} [part] - the part number to check on\n * @param {function} [callback] - a function that will be called indicating the\n * current job status\n * @returns {promise}\n * @example\n * // a pending job that is 25% complete\n * { \"progress\": 0.25 }\n * @example\n * // a completed job\n * { \"progress\": 1 }\n * @example\n * // a job that failed after completing 60% of the work\n * { \"progress\": 0.60, \"failed\": \"the reason for the failure\" }\n * @example\n * // a job 75% complete which includes metadata\n * { \"progress\": 0.75, \"metadata\": { \"name\": \"favorite-map-reduce\" } }\n * @example\n * // a job 75% complete indicating that the requested part has already been completed\n * { \"progress\": 0.75, \"partComplete\": true }\n * @example\n * // a job 100% complete indicating that the reduce step has been taken\n * { \"progress\": 0.75, \"reduceSent\": true }\n */", "status", ":", "status", ".", "bind", "(", "null", ",", "dyno", ")", ",", "/**\n * Flag a job record to indicate that a reduce step has been taken.\n *\n * @param {string} jobId - the identifier for a map-reduce job\n * @param {function} [callback] - a function that will be called when the flag has been set\n * @returns {promise}\n */", "reduceSent", ":", "reduceSent", ".", "bind", "(", "null", ",", "dyno", ")", ",", "/**\n * Fail a job\n *\n * @memberof client\n * @param {string} jobId - the identifier for a map-reduce job\n * @param {string} reason - a description of why the job failed\n * @param {function} [callback] - a function that will be called when the reason\n * for the failure has been recorded\n * @returns {promise}\n */", "failJob", ":", "failJob", ".", "bind", "(", "null", ",", "dyno", ")", ",", "/**\n * Associate arbitrary metadata with the progress record which can be retrieved\n * with a status request.\n *\n * @param {string} jobId - the identifier for a map-reduce job\n * @param {object} metadata - arbitrary metadata to store with the progress record.\n * @param {function} [callback] - a function that will be called when the metadata\n * has been recorded\n * @returns {promise}\n */", "setMetadata", ":", "setMetadata", ".", "bind", "(", "null", ",", "dyno", ")", "}", ";", "}" ]
mockable Create a progress-tracking client @param {string} [table] - the ARN for the DynamoDB table used to track progress. If not provided, it will look for `$ProgessTable` environment variable, and fail if neither is provided. @returns {object} a progress client @example var progress = require('watchbot-progress').progress;
[ "mockable", "Create", "a", "progress", "-", "tracking", "client" ]
34306c917e839b2c32999a39152402524599c5ad
https://github.com/mapbox/watchbot-progress/blob/34306c917e839b2c32999a39152402524599c5ad/lib/progress.js#L14-L117