repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
athombv/node-linux-device
lib/Compat.js
utilCallbackAfterPromise
function utilCallbackAfterPromise(self, func, args, cb) { args = Array.prototype.slice.apply(args); let lastarg = args.pop(); if(!cb) cb = lastarg; func.apply(self, args).then(res => { try { cb(null, res); } catch(e) { process.nextTick(() => { throw e }); } }).catch((err) => { try { cb(err); } c...
javascript
function utilCallbackAfterPromise(self, func, args, cb) { args = Array.prototype.slice.apply(args); let lastarg = args.pop(); if(!cb) cb = lastarg; func.apply(self, args).then(res => { try { cb(null, res); } catch(e) { process.nextTick(() => { throw e }); } }).catch((err) => { try { cb(err); } c...
[ "function", "utilCallbackAfterPromise", "(", "self", ",", "func", ",", "args", ",", "cb", ")", "{", "args", "=", "Array", ".", "prototype", ".", "slice", ".", "apply", "(", "args", ")", ";", "let", "lastarg", "=", "args", ".", "pop", "(", ")", ";", ...
Strips the callback argument, and calls the function without, then invokes the callback when the promise returns
[ "Strips", "the", "callback", "argument", "and", "calls", "the", "function", "without", "then", "invokes", "the", "callback", "when", "the", "promise", "returns" ]
43ce13c5718d5ee0d0f0424f5541c28fd4882b3c
https://github.com/athombv/node-linux-device/blob/43ce13c5718d5ee0d0f0424f5541c28fd4882b3c/lib/Compat.js#L7-L24
train
ILLGrenoble/guacamole-common-js
src/OnScreenKeyboard.js
removeClass
function removeClass(element, classname) { // If classList supported, use that if (element.classList) element.classList.remove(classname); // Otherwise, manually filter out classes with given name else { element.className = element.className.replace(/([^ ]+)[ ]*...
javascript
function removeClass(element, classname) { // If classList supported, use that if (element.classList) element.classList.remove(classname); // Otherwise, manually filter out classes with given name else { element.className = element.className.replace(/([^ ]+)[ ]*...
[ "function", "removeClass", "(", "element", ",", "classname", ")", "{", "// If classList supported, use that", "if", "(", "element", ".", "classList", ")", "element", ".", "classList", ".", "remove", "(", "classname", ")", ";", "// Otherwise, manually filter out classe...
Removes a CSS class from an element. @private @function @param {Element} element The element to remove a class from. @param {String} classname The name of the class to remove.
[ "Removes", "a", "CSS", "class", "from", "an", "element", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L106-L128
train
ILLGrenoble/guacamole-common-js
src/OnScreenKeyboard.js
modifiersPressed
function modifiersPressed(names) { // If any required modifiers are not pressed, return false for (var i=0; i < names.length; i++) { // Test whether current modifier is pressed var name = names[i]; if (!(name in modifierKeysyms)) return false; ...
javascript
function modifiersPressed(names) { // If any required modifiers are not pressed, return false for (var i=0; i < names.length; i++) { // Test whether current modifier is pressed var name = names[i]; if (!(name in modifierKeysyms)) return false; ...
[ "function", "modifiersPressed", "(", "names", ")", "{", "// If any required modifiers are not pressed, return false", "for", "(", "var", "i", "=", "0", ";", "i", "<", "names", ".", "length", ";", "i", "++", ")", "{", "// Test whether current modifier is pressed", "v...
Returns whether all modifiers having the given names are currently active. @private @param {String[]} names The names of all modifiers to test. @returns {Boolean} true if all specified modifiers are pressed, false otherwise.
[ "Returns", "whether", "all", "modifiers", "having", "the", "given", "names", "are", "currently", "active", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L223-L238
train
ILLGrenoble/guacamole-common-js
src/OnScreenKeyboard.js
press
function press(keyName, keyElement) { // Press key if not yet pressed if (!pressed[keyName]) { addClass(keyElement, "guac-keyboard-pressed"); // Get current key based on modifier state var key = getActiveKey(keyName); // Update modifier state ...
javascript
function press(keyName, keyElement) { // Press key if not yet pressed if (!pressed[keyName]) { addClass(keyElement, "guac-keyboard-pressed"); // Get current key based on modifier state var key = getActiveKey(keyName); // Update modifier state ...
[ "function", "press", "(", "keyName", ",", "keyElement", ")", "{", "// Press key if not yet pressed", "if", "(", "!", "pressed", "[", "keyName", "]", ")", "{", "addClass", "(", "keyElement", ",", "\"guac-keyboard-pressed\"", ")", ";", "// Get current key based on mod...
Presses the key having the given name, updating the associated key element with the "guac-keyboard-pressed" CSS class. If the key is already pressed, this function has no effect. @private @param {String} keyName The name of the key to press. @param {String} keyElement The element associated with the given key.
[ "Presses", "the", "key", "having", "the", "given", "name", "updating", "the", "associated", "key", "element", "with", "the", "guac", "-", "keyboard", "-", "pressed", "CSS", "class", ".", "If", "the", "key", "is", "already", "pressed", "this", "function", "...
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L290-L344
train
ILLGrenoble/guacamole-common-js
src/OnScreenKeyboard.js
release
function release(keyName, keyElement) { // Release key if currently pressed if (pressed[keyName]) { removeClass(keyElement, "guac-keyboard-pressed"); // Get current key based on modifier state var key = getActiveKey(keyName); // Send key event if not a...
javascript
function release(keyName, keyElement) { // Release key if currently pressed if (pressed[keyName]) { removeClass(keyElement, "guac-keyboard-pressed"); // Get current key based on modifier state var key = getActiveKey(keyName); // Send key event if not a...
[ "function", "release", "(", "keyName", ",", "keyElement", ")", "{", "// Release key if currently pressed", "if", "(", "pressed", "[", "keyName", "]", ")", "{", "removeClass", "(", "keyElement", ",", "\"guac-keyboard-pressed\"", ")", ";", "// Get current key based on m...
Releases the key having the given name, removing the "guac-keyboard-pressed" CSS class from the associated element. If the key is already released, this function has no effect. @private @param {String} keyName The name of the key to release. @param {String} keyElement The element associated with the given key.
[ "Releases", "the", "key", "having", "the", "given", "name", "removing", "the", "guac", "-", "keyboard", "-", "pressed", "CSS", "class", "from", "the", "associated", "element", ".", "If", "the", "key", "is", "already", "released", "this", "function", "has", ...
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L358-L377
train
ILLGrenoble/guacamole-common-js
src/OnScreenKeyboard.js
getKeys
function getKeys(keys) { var keyArrays = {}; // Coerce all keys into individual key arrays for (var name in layout.keys) { keyArrays[name] = asKeyArray(name, keys[name]); } return keyArrays; }
javascript
function getKeys(keys) { var keyArrays = {}; // Coerce all keys into individual key arrays for (var name in layout.keys) { keyArrays[name] = asKeyArray(name, keys[name]); } return keyArrays; }
[ "function", "getKeys", "(", "keys", ")", "{", "var", "keyArrays", "=", "{", "}", ";", "// Coerce all keys into individual key arrays", "for", "(", "var", "name", "in", "layout", ".", "keys", ")", "{", "keyArrays", "[", "name", "]", "=", "asKeyArray", "(", ...
Converts the rather forgiving key mapping allowed by Guacamole.OnScreenKeyboard.Layout into a rigorous mapping of key name to key definition, where the key definition is always an array of Key objects. @private @param {Object.<String, Number|String|Guacamole.OnScreenKeyboard.Key|Guacamole.OnScreenKeyboard.Key[]>} keys...
[ "Converts", "the", "rather", "forgiving", "key", "mapping", "allowed", "by", "Guacamole", ".", "OnScreenKeyboard", ".", "Layout", "into", "a", "rigorous", "mapping", "of", "key", "name", "to", "key", "definition", "where", "the", "key", "definition", "is", "al...
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L535-L546
train
ILLGrenoble/guacamole-common-js
src/OnScreenKeyboard.js
getCSSName
function getCSSName(name) { // Convert name from possibly-CamelCase to hyphenated lowercase var cssName = name .replace(/([a-z])([A-Z])/g, '$1-$2') .replace(/[^A-Za-z0-9]+/g, '-') .toLowerCase(); return cssName; }
javascript
function getCSSName(name) { // Convert name from possibly-CamelCase to hyphenated lowercase var cssName = name .replace(/([a-z])([A-Z])/g, '$1-$2') .replace(/[^A-Za-z0-9]+/g, '-') .toLowerCase(); return cssName; }
[ "function", "getCSSName", "(", "name", ")", "{", "// Convert name from possibly-CamelCase to hyphenated lowercase", "var", "cssName", "=", "name", ".", "replace", "(", "/", "([a-z])([A-Z])", "/", "g", ",", "'$1-$2'", ")", ".", "replace", "(", "/", "[^A-Za-z0-9]+", ...
Given an arbitrary string representing the name of some component of the on-screen keyboard, returns a string formatted for use as a CSS class name. The result will be lowercase. Word boundaries previously denoted by CamelCase will be replaced by individual hyphens, as will all contiguous non-alphanumeric characters. ...
[ "Given", "an", "arbitrary", "string", "representing", "the", "name", "of", "some", "component", "of", "the", "on", "-", "screen", "keyboard", "returns", "a", "string", "formatted", "for", "use", "as", "a", "CSS", "class", "name", ".", "The", "result", "wil...
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L571-L581
train
ILLGrenoble/guacamole-common-js
src/OnScreenKeyboard.js
touchPress
function touchPress(e) { e.preventDefault(); ignoreMouse = osk.touchMouseThreshold; press(object, keyElement); }
javascript
function touchPress(e) { e.preventDefault(); ignoreMouse = osk.touchMouseThreshold; press(object, keyElement); }
[ "function", "touchPress", "(", "e", ")", "{", "e", ".", "preventDefault", "(", ")", ";", "ignoreMouse", "=", "osk", ".", "touchMouseThreshold", ";", "press", "(", "object", ",", "keyElement", ")", ";", "}" ]
Handles a touch event which results in the pressing of an OSK key. Touch events will result in mouse events being ignored for touchMouseThreshold events. @private @param {TouchEvent} e The touch event being handled.
[ "Handles", "a", "touch", "event", "which", "results", "in", "the", "pressing", "of", "an", "OSK", "key", ".", "Touch", "events", "will", "result", "in", "mouse", "events", "being", "ignored", "for", "touchMouseThreshold", "events", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L726-L730
train
ILLGrenoble/guacamole-common-js
src/OnScreenKeyboard.js
touchRelease
function touchRelease(e) { e.preventDefault(); ignoreMouse = osk.touchMouseThreshold; release(object, keyElement); }
javascript
function touchRelease(e) { e.preventDefault(); ignoreMouse = osk.touchMouseThreshold; release(object, keyElement); }
[ "function", "touchRelease", "(", "e", ")", "{", "e", ".", "preventDefault", "(", ")", ";", "ignoreMouse", "=", "osk", ".", "touchMouseThreshold", ";", "release", "(", "object", ",", "keyElement", ")", ";", "}" ]
Handles a touch event which results in the release of an OSK key. Touch events will result in mouse events being ignored for touchMouseThreshold events. @private @param {TouchEvent} e The touch event being handled.
[ "Handles", "a", "touch", "event", "which", "results", "in", "the", "release", "of", "an", "OSK", "key", ".", "Touch", "events", "will", "result", "in", "mouse", "events", "being", "ignored", "for", "touchMouseThreshold", "events", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/OnScreenKeyboard.js#L741-L745
train
Twipped/QueryizeJS
lib/mutators.js
_makeJoiner
function _makeJoiner (type) { return function (clause, options) { if (isQueryizeObject(clause)) { if (typeof options !== 'object') throw new Error('You must define join options when joining against a queryize subquery.'); options = Object.create(options); options.table = clause; clause = options; } el...
javascript
function _makeJoiner (type) { return function (clause, options) { if (isQueryizeObject(clause)) { if (typeof options !== 'object') throw new Error('You must define join options when joining against a queryize subquery.'); options = Object.create(options); options.table = clause; clause = options; } el...
[ "function", "_makeJoiner", "(", "type", ")", "{", "return", "function", "(", "clause", ",", "options", ")", "{", "if", "(", "isQueryizeObject", "(", "clause", ")", ")", "{", "if", "(", "typeof", "options", "!==", "'object'", ")", "throw", "new", "Error",...
Generates the closures for innerJoin, leftJoin and rightJoin @private @param {string} type Join type @return {function}
[ "Generates", "the", "closures", "for", "innerJoin", "leftJoin", "and", "rightJoin" ]
fdee3e8900f6a95419b88056916577f9b0067c93
https://github.com/Twipped/QueryizeJS/blob/fdee3e8900f6a95419b88056916577f9b0067c93/lib/mutators.js#L1189-L1216
train
Twipped/QueryizeJS
lib/mutators.js
flatten
function flatten (input, includingObjects) { var result = []; function descend (level) { if (isArray(level)) { level.forEach(descend); } else if (typeof level === 'object' && includingObjects) { Object.keys(level).forEach(function (key) { descend(level[key]); }); } else { result.push(level); ...
javascript
function flatten (input, includingObjects) { var result = []; function descend (level) { if (isArray(level)) { level.forEach(descend); } else if (typeof level === 'object' && includingObjects) { Object.keys(level).forEach(function (key) { descend(level[key]); }); } else { result.push(level); ...
[ "function", "flatten", "(", "input", ",", "includingObjects", ")", "{", "var", "result", "=", "[", "]", ";", "function", "descend", "(", "level", ")", "{", "if", "(", "isArray", "(", "level", ")", ")", "{", "level", ".", "forEach", "(", "descend", ")...
Flattens a nested array into a single level array @private @param {Array} input The top level array to flatten @param {boolean} [includingObjects=false] If an object is encountered and this argument is truthy, the object will also be flattened by its property values. @return {Array}
[ "Flattens", "a", "nested", "array", "into", "a", "single", "level", "array" ]
fdee3e8900f6a95419b88056916577f9b0067c93
https://github.com/Twipped/QueryizeJS/blob/fdee3e8900f6a95419b88056916577f9b0067c93/lib/mutators.js#L1922-L1940
train
Twipped/QueryizeJS
lib/mutators.js
mysqlDate
function mysqlDate (input) { var date = new Date(input.getTime()); date.setMinutes(date.getMinutes() + date.getTimezoneOffset()); var y = date.getFullYear(); var m = ('0' + (date.getMonth() + 1)).substr(-2); var d = ('0' + date.getDate()).substr(-2); var h = ('0' + date.getHours()).substr(-2); var i = ('0' + da...
javascript
function mysqlDate (input) { var date = new Date(input.getTime()); date.setMinutes(date.getMinutes() + date.getTimezoneOffset()); var y = date.getFullYear(); var m = ('0' + (date.getMonth() + 1)).substr(-2); var d = ('0' + date.getDate()).substr(-2); var h = ('0' + date.getHours()).substr(-2); var i = ('0' + da...
[ "function", "mysqlDate", "(", "input", ")", "{", "var", "date", "=", "new", "Date", "(", "input", ".", "getTime", "(", ")", ")", ";", "date", ".", "setMinutes", "(", "date", ".", "getMinutes", "(", ")", "+", "date", ".", "getTimezoneOffset", "(", ")"...
Formats a Date object into a MySQL DATETIME @param {Date} date [description] @private @return {string} [description]
[ "Formats", "a", "Date", "object", "into", "a", "MySQL", "DATETIME" ]
fdee3e8900f6a95419b88056916577f9b0067c93
https://github.com/Twipped/QueryizeJS/blob/fdee3e8900f6a95419b88056916577f9b0067c93/lib/mutators.js#L1948-L1960
train
Twipped/QueryizeJS
lib/mutators.js
arrayFromArguments
function arrayFromArguments () { var len = arguments.length; var args = new Array(len); for (var i = 0; i < len; ++i) { args[i] = arguments[i]; } return args; }
javascript
function arrayFromArguments () { var len = arguments.length; var args = new Array(len); for (var i = 0; i < len; ++i) { args[i] = arguments[i]; } return args; }
[ "function", "arrayFromArguments", "(", ")", "{", "var", "len", "=", "arguments", ".", "length", ";", "var", "args", "=", "new", "Array", "(", "len", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "len", ";", "++", "i", ")", "{", "ar...
Helper function to convert arguments to an array without triggering de-optimization in V8 MUST be called via .apply @private @return {Array<mixed>}
[ "Helper", "function", "to", "convert", "arguments", "to", "an", "array", "without", "triggering", "de", "-", "optimization", "in", "V8", "MUST", "be", "called", "via", ".", "apply" ]
fdee3e8900f6a95419b88056916577f9b0067c93
https://github.com/Twipped/QueryizeJS/blob/fdee3e8900f6a95419b88056916577f9b0067c93/lib/mutators.js#L1968-L1975
train
latentflip/base32-crockford-browser
dist/base32.js
function() { var table = {} // Invert 'alphabet' for (var i = 0; i < alphabet.length; i++) { table[alphabet[i]] = i } // Splice in 'alias' for (var key in alias) { if (!alias.hasOwnProperty(key)) continue table[key] = table['' + alias[key]] } lookup = function() {...
javascript
function() { var table = {} // Invert 'alphabet' for (var i = 0; i < alphabet.length; i++) { table[alphabet[i]] = i } // Splice in 'alias' for (var key in alias) { if (!alias.hasOwnProperty(key)) continue table[key] = table['' + alias[key]] } lookup = function() {...
[ "function", "(", ")", "{", "var", "table", "=", "{", "}", "// Invert 'alphabet'", "for", "(", "var", "i", "=", "0", ";", "i", "<", "alphabet", ".", "length", ";", "i", "++", ")", "{", "table", "[", "alphabet", "[", "i", "]", "]", "=", "i", "}",...
Build a lookup table and memoize it Return an object that maps a character to its byte value.
[ "Build", "a", "lookup", "table", "and", "memoize", "it" ]
6ae0826cc89838fc935160e8547edf77f6690858
https://github.com/latentflip/base32-crockford-browser/blob/6ae0826cc89838fc935160e8547edf77f6690858/dist/base32.js#L16-L29
train
latentflip/base32-crockford-browser
dist/base32.js
Encoder
function Encoder() { var skip = 0 // how many bits we will skip from the first byte var bits = 0 // 5 high bits, carry from one byte to the next this.output = '' // Read one byte of input // Should not really be used except by "update" this.readByte = function(byte) { // coerce the byt...
javascript
function Encoder() { var skip = 0 // how many bits we will skip from the first byte var bits = 0 // 5 high bits, carry from one byte to the next this.output = '' // Read one byte of input // Should not really be used except by "update" this.readByte = function(byte) { // coerce the byt...
[ "function", "Encoder", "(", ")", "{", "var", "skip", "=", "0", "// how many bits we will skip from the first byte", "var", "bits", "=", "0", "// 5 high bits, carry from one byte to the next", "this", ".", "output", "=", "''", "// Read one byte of input", "// Should not real...
A streaming encoder var encoder = new base32.Encoder() var output1 = encoder.update(input1) var output2 = encoder.update(input2) var lastoutput = encode.update(lastinput, true)
[ "A", "streaming", "encoder" ]
6ae0826cc89838fc935160e8547edf77f6690858
https://github.com/latentflip/base32-crockford-browser/blob/6ae0826cc89838fc935160e8547edf77f6690858/dist/base32.js#L40-L79
train
latentflip/base32-crockford-browser
dist/base32.js
Decoder
function Decoder() { var skip = 0 // how many bits we have from the previous character var byte = 0 // current byte we're producing this.output = '' // Consume a character from the stream, store // the output in this.output. As before, better // to use update(). this.readChar = function(ch...
javascript
function Decoder() { var skip = 0 // how many bits we have from the previous character var byte = 0 // current byte we're producing this.output = '' // Consume a character from the stream, store // the output in this.output. As before, better // to use update(). this.readChar = function(ch...
[ "function", "Decoder", "(", ")", "{", "var", "skip", "=", "0", "// how many bits we have from the previous character", "var", "byte", "=", "0", "// current byte we're producing", "this", ".", "output", "=", "''", "// Consume a character from the stream, store", "// the outp...
Functions analogously to Encoder
[ "Functions", "analogously", "to", "Encoder" ]
6ae0826cc89838fc935160e8547edf77f6690858
https://github.com/latentflip/base32-crockford-browser/blob/6ae0826cc89838fc935160e8547edf77f6690858/dist/base32.js#L105-L145
train
latentflip/base32-crockford-browser
dist/base32.js
decode
function decode(input) { var decoder = new Decoder() var output = decoder.update(input, true) return output }
javascript
function decode(input) { var decoder = new Decoder() var output = decoder.update(input, true) return output }
[ "function", "decode", "(", "input", ")", "{", "var", "decoder", "=", "new", "Decoder", "(", ")", "var", "output", "=", "decoder", ".", "update", "(", "input", ",", "true", ")", "return", "output", "}" ]
Base32-encoded string goes in, decoded data comes out.
[ "Base32", "-", "encoded", "string", "goes", "in", "decoded", "data", "comes", "out", "." ]
6ae0826cc89838fc935160e8547edf77f6690858
https://github.com/latentflip/base32-crockford-browser/blob/6ae0826cc89838fc935160e8547edf77f6690858/dist/base32.js#L173-L177
train
delian/node-amfutils
amfUtils.js
amf3decUI29
function amf3decUI29(buf) { var val = 0; var len = 1; var b; do { b = buf.readUInt8(len++); val = (val << 7) + (b & 0x7F); } while (len < 5 || b > 0x7F); if (len == 5) val = val | b; // Preserve the major bit of the last byte return { len: len, value: val } }
javascript
function amf3decUI29(buf) { var val = 0; var len = 1; var b; do { b = buf.readUInt8(len++); val = (val << 7) + (b & 0x7F); } while (len < 5 || b > 0x7F); if (len == 5) val = val | b; // Preserve the major bit of the last byte return { len: len, value: val } }
[ "function", "amf3decUI29", "(", "buf", ")", "{", "var", "val", "=", "0", ";", "var", "len", "=", "1", ";", "var", "b", ";", "do", "{", "b", "=", "buf", ".", "readUInt8", "(", "len", "++", ")", ";", "val", "=", "(", "val", "<<", "7", ")", "+...
Generic decode of AMF3 UInt29 values @param buf @returns {{len: number, value: number}}
[ "Generic", "decode", "of", "AMF3", "UInt29", "values" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L178-L191
train
delian/node-amfutils
amfUtils.js
amf3encUI29
function amf3encUI29(num) { var len = 0; if (num < 0x80) len = 1; if (num < 0x4000) len = 2; if (num < 0x200000) len = 3; if (num >= 0x200000) len = 4; var buf = new Buffer(len); switch (len) { case 1: buf.writeUInt8(num, 0); break; case 2: ...
javascript
function amf3encUI29(num) { var len = 0; if (num < 0x80) len = 1; if (num < 0x4000) len = 2; if (num < 0x200000) len = 3; if (num >= 0x200000) len = 4; var buf = new Buffer(len); switch (len) { case 1: buf.writeUInt8(num, 0); break; case 2: ...
[ "function", "amf3encUI29", "(", "num", ")", "{", "var", "len", "=", "0", ";", "if", "(", "num", "<", "0x80", ")", "len", "=", "1", ";", "if", "(", "num", "<", "0x4000", ")", "len", "=", "2", ";", "if", "(", "num", "<", "0x200000", ")", "len",...
Generic encode of AMF3 UInt29 value @param num @returns {Buffer}
[ "Generic", "encode", "of", "AMF3", "UInt29", "value" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L198-L226
train
delian/node-amfutils
amfUtils.js
amf3decInteger
function amf3decInteger(buf) { // Invert the integer var resp = amf3decUI29(buf); if (resp.value > 0x0FFFFFFF) resp.value = (resp.value & 0x0FFFFFFF) - 0x10000000; return resp; }
javascript
function amf3decInteger(buf) { // Invert the integer var resp = amf3decUI29(buf); if (resp.value > 0x0FFFFFFF) resp.value = (resp.value & 0x0FFFFFFF) - 0x10000000; return resp; }
[ "function", "amf3decInteger", "(", "buf", ")", "{", "// Invert the integer", "var", "resp", "=", "amf3decUI29", "(", "buf", ")", ";", "if", "(", "resp", ".", "value", ">", "0x0FFFFFFF", ")", "resp", ".", "value", "=", "(", "resp", ".", "value", "&", "0...
AMF3 Decode an integer @param buf @returns {{len: number, value: number}}
[ "AMF3", "Decode", "an", "integer" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L233-L237
train
delian/node-amfutils
amfUtils.js
amf3encInteger
function amf3encInteger(num) { var buf = new Buffer(1); buf.writeUInt8(0x4, 0); return Buffer.concat([buf, amf3encUI29(num & 0x3FFFFFFF)]); // This AND will auto convert the sign bit! }
javascript
function amf3encInteger(num) { var buf = new Buffer(1); buf.writeUInt8(0x4, 0); return Buffer.concat([buf, amf3encUI29(num & 0x3FFFFFFF)]); // This AND will auto convert the sign bit! }
[ "function", "amf3encInteger", "(", "num", ")", "{", "var", "buf", "=", "new", "Buffer", "(", "1", ")", ";", "buf", ".", "writeUInt8", "(", "0x4", ",", "0", ")", ";", "return", "Buffer", ".", "concat", "(", "[", "buf", ",", "amf3encUI29", "(", "num"...
AMF3 Encode an integer @param num @returns {Buffer}
[ "AMF3", "Encode", "an", "integer" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L244-L248
train
delian/node-amfutils
amfUtils.js
amf3decXmlDoc
function amf3decXmlDoc(buf) { var sLen = amf3decUI29(buf); var s = sLen & 1; sLen = sLen >> 1; // The real length without the lowest bit if (s) return { len: sLen.value + 5, value: buf.slice(5, sLen.value + 5).toString('utf8') }; throw new Error("Error, we have a need to decode a String that is a Re...
javascript
function amf3decXmlDoc(buf) { var sLen = amf3decUI29(buf); var s = sLen & 1; sLen = sLen >> 1; // The real length without the lowest bit if (s) return { len: sLen.value + 5, value: buf.slice(5, sLen.value + 5).toString('utf8') }; throw new Error("Error, we have a need to decode a String that is a Re...
[ "function", "amf3decXmlDoc", "(", "buf", ")", "{", "var", "sLen", "=", "amf3decUI29", "(", "buf", ")", ";", "var", "s", "=", "sLen", "&", "1", ";", "sLen", "=", "sLen", ">>", "1", ";", "// The real length without the lowest bit", "if", "(", "s", ")", "...
AMF3 Decode XMLDoc @param buf @returns {{len: *, value: (*|String)}}
[ "AMF3", "Decode", "XMLDoc" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L280-L286
train
delian/node-amfutils
amfUtils.js
amf3encXmlDoc
function amf3encXmlDoc(str) { var sLen = amf3encUI29(str.length << 1); var buf = new Buffer(1); buf.writeUInt8(0x7, 0); return Buffer.concat([buf, sLen, new Buffer(str, 'utf8')]); }
javascript
function amf3encXmlDoc(str) { var sLen = amf3encUI29(str.length << 1); var buf = new Buffer(1); buf.writeUInt8(0x7, 0); return Buffer.concat([buf, sLen, new Buffer(str, 'utf8')]); }
[ "function", "amf3encXmlDoc", "(", "str", ")", "{", "var", "sLen", "=", "amf3encUI29", "(", "str", ".", "length", "<<", "1", ")", ";", "var", "buf", "=", "new", "Buffer", "(", "1", ")", ";", "buf", ".", "writeUInt8", "(", "0x7", ",", "0", ")", ";"...
AMF3 Encode XMLDoc @param str @returns {Buffer}
[ "AMF3", "Encode", "XMLDoc" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L293-L298
train
delian/node-amfutils
amfUtils.js
amf3decByteArray
function amf3decByteArray(buf) { var sLen = amf3decUI29(buf); var s = sLen & 1; // TODO: Check if we follow the same rule! sLen = sLen >> 1; // The real length without the lowest bit if (s) return { len: sLen.value + 5, value: buf.slice(5, sLen.value + 5) }; throw new Error("Error, we have a need to...
javascript
function amf3decByteArray(buf) { var sLen = amf3decUI29(buf); var s = sLen & 1; // TODO: Check if we follow the same rule! sLen = sLen >> 1; // The real length without the lowest bit if (s) return { len: sLen.value + 5, value: buf.slice(5, sLen.value + 5) }; throw new Error("Error, we have a need to...
[ "function", "amf3decByteArray", "(", "buf", ")", "{", "var", "sLen", "=", "amf3decUI29", "(", "buf", ")", ";", "var", "s", "=", "sLen", "&", "1", ";", "// TODO: Check if we follow the same rule!", "sLen", "=", "sLen", ">>", "1", ";", "// The real length withou...
AMF3 Decide Byte Array @param buf @returns {{len: *, value: (Array|string|*|Buffer|Blob)}}
[ "AMF3", "Decide", "Byte", "Array" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L330-L336
train
delian/node-amfutils
amfUtils.js
amf3encDouble
function amf3encDouble(num) { var buf = new Buffer(9); buf.writeUInt8(0x05, 0); buf.writeDoubleBE(num, 1); return buf; }
javascript
function amf3encDouble(num) { var buf = new Buffer(9); buf.writeUInt8(0x05, 0); buf.writeDoubleBE(num, 1); return buf; }
[ "function", "amf3encDouble", "(", "num", ")", "{", "var", "buf", "=", "new", "Buffer", "(", "9", ")", ";", "buf", ".", "writeUInt8", "(", "0x05", ",", "0", ")", ";", "buf", ".", "writeDoubleBE", "(", "num", ",", "1", ")", ";", "return", "buf", ";...
AMF3 Encode Double @param num @returns {Buffer}
[ "AMF3", "Encode", "Double" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L364-L369
train
delian/node-amfutils
amfUtils.js
amf3decDate
function amf3decDate(buf) { // The UI29 should be 1 var uTz = amf3decUI29(buf); var ts = buf.readDoubleBE(uTz.len); return { len: uTz.len + 8, value: ts } }
javascript
function amf3decDate(buf) { // The UI29 should be 1 var uTz = amf3decUI29(buf); var ts = buf.readDoubleBE(uTz.len); return { len: uTz.len + 8, value: ts } }
[ "function", "amf3decDate", "(", "buf", ")", "{", "// The UI29 should be 1", "var", "uTz", "=", "amf3decUI29", "(", "buf", ")", ";", "var", "ts", "=", "buf", ".", "readDoubleBE", "(", "uTz", ".", "len", ")", ";", "return", "{", "len", ":", "uTz", ".", ...
AMF3 Decode Date @param buf @returns {{len: *, value: (*|Number)}}
[ "AMF3", "Decode", "Date" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L376-L380
train
delian/node-amfutils
amfUtils.js
amf3encDate
function amf3encDate(ts) { var buf = new Buffer(1); buf.writeUInt8(0x8, 0); var tsBuf = new Buffer(8); tsBuf.writeDoubleBE(ts, 0); return Buffer.concat([buf, amf3encUI29(1), tsBuf]); // We always do 1 }
javascript
function amf3encDate(ts) { var buf = new Buffer(1); buf.writeUInt8(0x8, 0); var tsBuf = new Buffer(8); tsBuf.writeDoubleBE(ts, 0); return Buffer.concat([buf, amf3encUI29(1), tsBuf]); // We always do 1 }
[ "function", "amf3encDate", "(", "ts", ")", "{", "var", "buf", "=", "new", "Buffer", "(", "1", ")", ";", "buf", ".", "writeUInt8", "(", "0x8", ",", "0", ")", ";", "var", "tsBuf", "=", "new", "Buffer", "(", "8", ")", ";", "tsBuf", ".", "writeDouble...
AMF3 Encode Date @param ts @returns {Buffer}
[ "AMF3", "Encode", "Date" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L387-L393
train
delian/node-amfutils
amfUtils.js
amf3decArray
function amf3decArray(buf) { var count = amf3decUI29(buf.slice(1)); var obj = amf3decObject(buf.slice(count.len)); if (count.value % 2 == 1) throw new Error("This is a reference to another array, which currently we don't support!"); return { len: count.len + obj.len, value: obj.value } }
javascript
function amf3decArray(buf) { var count = amf3decUI29(buf.slice(1)); var obj = amf3decObject(buf.slice(count.len)); if (count.value % 2 == 1) throw new Error("This is a reference to another array, which currently we don't support!"); return { len: count.len + obj.len, value: obj.value } }
[ "function", "amf3decArray", "(", "buf", ")", "{", "var", "count", "=", "amf3decUI29", "(", "buf", ".", "slice", "(", "1", ")", ")", ";", "var", "obj", "=", "amf3decObject", "(", "buf", ".", "slice", "(", "count", ".", "len", ")", ")", ";", "if", ...
AMF3 Decode Array @param buf @returns {{len: *, value: *}}
[ "AMF3", "Decode", "Array" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L400-L405
train
delian/node-amfutils
amfUtils.js
amf0encNumber
function amf0encNumber(num) { var buf = new Buffer(9); buf.writeUInt8(0x00, 0); buf.writeDoubleBE(num, 1); return buf; }
javascript
function amf0encNumber(num) { var buf = new Buffer(9); buf.writeUInt8(0x00, 0); buf.writeDoubleBE(num, 1); return buf; }
[ "function", "amf0encNumber", "(", "num", ")", "{", "var", "buf", "=", "new", "Buffer", "(", "9", ")", ";", "buf", ".", "writeUInt8", "(", "0x00", ",", "0", ")", ";", "buf", ".", "writeDoubleBE", "(", "num", ",", "1", ")", ";", "return", "buf", ";...
AMF0 Encode Number @param num @returns {Buffer}
[ "AMF0", "Encode", "Number" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L446-L451
train
delian/node-amfutils
amfUtils.js
amf0encBool
function amf0encBool(num) { var buf = new Buffer(2); buf.writeUInt8(0x01, 0); buf.writeUInt8((num ? 1 : 0), 1); return buf; }
javascript
function amf0encBool(num) { var buf = new Buffer(2); buf.writeUInt8(0x01, 0); buf.writeUInt8((num ? 1 : 0), 1); return buf; }
[ "function", "amf0encBool", "(", "num", ")", "{", "var", "buf", "=", "new", "Buffer", "(", "2", ")", ";", "buf", ".", "writeUInt8", "(", "0x01", ",", "0", ")", ";", "buf", ".", "writeUInt8", "(", "(", "num", "?", "1", ":", "0", ")", ",", "1", ...
AMF0 Encode Boolean @param num @returns {Buffer}
[ "AMF0", "Encode", "Boolean" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L467-L472
train
delian/node-amfutils
amfUtils.js
amf0encDate
function amf0encDate(ts) { var buf = new Buffer(11); buf.writeUInt8(0x0B, 0); buf.writeInt16BE(0, 1); buf.writeDoubleBE(ts, 3); return buf; }
javascript
function amf0encDate(ts) { var buf = new Buffer(11); buf.writeUInt8(0x0B, 0); buf.writeInt16BE(0, 1); buf.writeDoubleBE(ts, 3); return buf; }
[ "function", "amf0encDate", "(", "ts", ")", "{", "var", "buf", "=", "new", "Buffer", "(", "11", ")", ";", "buf", ".", "writeUInt8", "(", "0x0B", ",", "0", ")", ";", "buf", ".", "writeInt16BE", "(", "0", ",", "1", ")", ";", "buf", ".", "writeDouble...
AMF0 Encode Date @param ts @returns {Buffer}
[ "AMF0", "Encode", "Date" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L526-L532
train
delian/node-amfutils
amfUtils.js
amf0decObject
function amf0decObject(buf) { // TODO: Implement references! var obj = {}; var iBuf = buf.slice(1); var len = 1; // console.log('ODec',iBuf.readUInt8(0)); while (iBuf.readUInt8(0) != 0x09) { // console.log('Field', iBuf.readUInt8(0), iBuf); var prop = amf0decUString(iBuf); // ...
javascript
function amf0decObject(buf) { // TODO: Implement references! var obj = {}; var iBuf = buf.slice(1); var len = 1; // console.log('ODec',iBuf.readUInt8(0)); while (iBuf.readUInt8(0) != 0x09) { // console.log('Field', iBuf.readUInt8(0), iBuf); var prop = amf0decUString(iBuf); // ...
[ "function", "amf0decObject", "(", "buf", ")", "{", "// TODO: Implement references!", "var", "obj", "=", "{", "}", ";", "var", "iBuf", "=", "buf", ".", "slice", "(", "1", ")", ";", "var", "len", "=", "1", ";", "// console.log('ODec',iBuf.readUInt8(0));", "...
AMF0 Decode Object @param buf @returns {{len: number, value: {}}}
[ "AMF0", "Decode", "Object" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L539-L562
train
delian/node-amfutils
amfUtils.js
amf0encObject
function amf0encObject(o) { if (typeof o !== 'object') return; var data = new Buffer(1); data.writeUInt8(0x03,0); // Type object var k; for (k in o) { data = Buffer.concat([data,amf0encUString(k),amf0EncodeOne(o[k])]); } var termCode = new Buffer(1); termCode.writeUInt8(0x09,0);...
javascript
function amf0encObject(o) { if (typeof o !== 'object') return; var data = new Buffer(1); data.writeUInt8(0x03,0); // Type object var k; for (k in o) { data = Buffer.concat([data,amf0encUString(k),amf0EncodeOne(o[k])]); } var termCode = new Buffer(1); termCode.writeUInt8(0x09,0);...
[ "function", "amf0encObject", "(", "o", ")", "{", "if", "(", "typeof", "o", "!==", "'object'", ")", "return", ";", "var", "data", "=", "new", "Buffer", "(", "1", ")", ";", "data", ".", "writeUInt8", "(", "0x03", ",", "0", ")", ";", "// Type object", ...
AMF0 Encode Object
[ "AMF0", "Encode", "Object" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L567-L579
train
delian/node-amfutils
amfUtils.js
amf0encRef
function amf0encRef(index) { var buf = new Buffer(3); buf.writeUInt8(0x07, 0); buf.writeUInt16BE(index, 1); return buf; }
javascript
function amf0encRef(index) { var buf = new Buffer(3); buf.writeUInt8(0x07, 0); buf.writeUInt16BE(index, 1); return buf; }
[ "function", "amf0encRef", "(", "index", ")", "{", "var", "buf", "=", "new", "Buffer", "(", "3", ")", ";", "buf", ".", "writeUInt8", "(", "0x07", ",", "0", ")", ";", "buf", ".", "writeUInt16BE", "(", "index", ",", "1", ")", ";", "return", "buf", "...
AMF0 Encode Reference @param index @returns {Buffer}
[ "AMF0", "Encode", "Reference" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L596-L601
train
delian/node-amfutils
amfUtils.js
amf0decString
function amf0decString(buf) { var sLen = buf.readUInt16BE(1); return { len: 3 + sLen, value: buf.toString('utf8', 3, 3 + sLen) } }
javascript
function amf0decString(buf) { var sLen = buf.readUInt16BE(1); return { len: 3 + sLen, value: buf.toString('utf8', 3, 3 + sLen) } }
[ "function", "amf0decString", "(", "buf", ")", "{", "var", "sLen", "=", "buf", ".", "readUInt16BE", "(", "1", ")", ";", "return", "{", "len", ":", "3", "+", "sLen", ",", "value", ":", "buf", ".", "toString", "(", "'utf8'", ",", "3", ",", "3", "+",...
AMF0 Decode String @param buf @returns {{len: *, value: (*|string|String)}}
[ "AMF0", "Decode", "String" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L608-L611
train
delian/node-amfutils
amfUtils.js
amf0encUString
function amf0encUString(s) { var data = new Buffer(s,'utf8'); var sLen = new Buffer(2); sLen.writeUInt16BE(data.length,0); return Buffer.concat([sLen,data]); }
javascript
function amf0encUString(s) { var data = new Buffer(s,'utf8'); var sLen = new Buffer(2); sLen.writeUInt16BE(data.length,0); return Buffer.concat([sLen,data]); }
[ "function", "amf0encUString", "(", "s", ")", "{", "var", "data", "=", "new", "Buffer", "(", "s", ",", "'utf8'", ")", ";", "var", "sLen", "=", "new", "Buffer", "(", "2", ")", ";", "sLen", ".", "writeUInt16BE", "(", "data", ".", "length", ",", "0", ...
Do AMD0 Encode of Untyped String @param s @returns {Buffer}
[ "Do", "AMD0", "Encode", "of", "Untyped", "String" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L628-L633
train
delian/node-amfutils
amfUtils.js
amf0encString
function amf0encString(str) { var buf = new Buffer(3); buf.writeUInt8(0x02, 0); buf.writeUInt16BE(str.length, 1); return Buffer.concat([buf, new Buffer(str, 'utf8')]); }
javascript
function amf0encString(str) { var buf = new Buffer(3); buf.writeUInt8(0x02, 0); buf.writeUInt16BE(str.length, 1); return Buffer.concat([buf, new Buffer(str, 'utf8')]); }
[ "function", "amf0encString", "(", "str", ")", "{", "var", "buf", "=", "new", "Buffer", "(", "3", ")", ";", "buf", ".", "writeUInt8", "(", "0x02", ",", "0", ")", ";", "buf", ".", "writeUInt16BE", "(", "str", ".", "length", ",", "1", ")", ";", "ret...
AMF0 Encode String @param str @returns {Buffer}
[ "AMF0", "Encode", "String" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L640-L645
train
delian/node-amfutils
amfUtils.js
amf0decLongString
function amf0decLongString(buf) { var sLen = buf.readUInt32BE(1); return { len: 5 + sLen, value: buf.toString('utf8', 5, 5 + sLen) } }
javascript
function amf0decLongString(buf) { var sLen = buf.readUInt32BE(1); return { len: 5 + sLen, value: buf.toString('utf8', 5, 5 + sLen) } }
[ "function", "amf0decLongString", "(", "buf", ")", "{", "var", "sLen", "=", "buf", ".", "readUInt32BE", "(", "1", ")", ";", "return", "{", "len", ":", "5", "+", "sLen", ",", "value", ":", "buf", ".", "toString", "(", "'utf8'", ",", "5", ",", "5", ...
AMF0 Decode Long String @param buf @returns {{len: *, value: (*|string|String)}}
[ "AMF0", "Decode", "Long", "String" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L652-L655
train
delian/node-amfutils
amfUtils.js
amf0encLongString
function amf0encLongString(str) { var buf = new Buffer(5); buf.writeUInt8(0x0C, 0); buf.writeUInt32BE(str.length, 1); return Buffer.concat([buf, new Buffer(str, 'utf8')]); }
javascript
function amf0encLongString(str) { var buf = new Buffer(5); buf.writeUInt8(0x0C, 0); buf.writeUInt32BE(str.length, 1); return Buffer.concat([buf, new Buffer(str, 'utf8')]); }
[ "function", "amf0encLongString", "(", "str", ")", "{", "var", "buf", "=", "new", "Buffer", "(", "5", ")", ";", "buf", ".", "writeUInt8", "(", "0x0C", ",", "0", ")", ";", "buf", ".", "writeUInt32BE", "(", "str", ".", "length", ",", "1", ")", ";", ...
AMF0 Encode Long String @param str @returns {Buffer}
[ "AMF0", "Encode", "Long", "String" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L662-L667
train
delian/node-amfutils
amfUtils.js
amf0decArray
function amf0decArray(buf) { // var count = buf.readUInt32BE(1); var obj = amf0decObject(buf.slice(4)); return { len: 5 + obj.len, value: obj.value } }
javascript
function amf0decArray(buf) { // var count = buf.readUInt32BE(1); var obj = amf0decObject(buf.slice(4)); return { len: 5 + obj.len, value: obj.value } }
[ "function", "amf0decArray", "(", "buf", ")", "{", "// var count = buf.readUInt32BE(1);", "var", "obj", "=", "amf0decObject", "(", "buf", ".", "slice", "(", "4", ")", ")", ";", "return", "{", "len", ":", "5", "+", "obj", ".", "len", ",", "value", ":", ...
AMF0 Decode Array @param buf @returns {{len: *, value: ({}|*)}}
[ "AMF0", "Decode", "Array" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L674-L678
train
delian/node-amfutils
amfUtils.js
amf0encArray
function amf0encArray(a) { var l = 0; if (a instanceof Array) l = a.length; else l = Object.keys(a).length; console.log('Array encode', l, a); var buf = new Buffer(5); buf.writeUInt8(8,0); buf.writeUInt32BE(l,1); var data = amf0encObject(a); return Buffer.concat([buf,data.slice(1)]); }
javascript
function amf0encArray(a) { var l = 0; if (a instanceof Array) l = a.length; else l = Object.keys(a).length; console.log('Array encode', l, a); var buf = new Buffer(5); buf.writeUInt8(8,0); buf.writeUInt32BE(l,1); var data = amf0encObject(a); return Buffer.concat([buf,data.slice(1)]); }
[ "function", "amf0encArray", "(", "a", ")", "{", "var", "l", "=", "0", ";", "if", "(", "a", "instanceof", "Array", ")", "l", "=", "a", ".", "length", ";", "else", "l", "=", "Object", ".", "keys", "(", "a", ")", ".", "length", ";", "console", "."...
AMF0 Encode Array
[ "AMF0", "Encode", "Array" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L683-L692
train
delian/node-amfutils
amfUtils.js
amf0cnvArray2Object
function amf0cnvArray2Object(aData) { var buf = new Buffer(1); buf.writeUInt8(0x3,0); // Object id return Buffer.concat([buf,aData.slice(5)]); }
javascript
function amf0cnvArray2Object(aData) { var buf = new Buffer(1); buf.writeUInt8(0x3,0); // Object id return Buffer.concat([buf,aData.slice(5)]); }
[ "function", "amf0cnvArray2Object", "(", "aData", ")", "{", "var", "buf", "=", "new", "Buffer", "(", "1", ")", ";", "buf", ".", "writeUInt8", "(", "0x3", ",", "0", ")", ";", "// Object id", "return", "Buffer", ".", "concat", "(", "[", "buf", ",", "aDa...
AMF0 Encode Binary Array into binary Object @param aData @returns {Buffer}
[ "AMF0", "Encode", "Binary", "Array", "into", "binary", "Object" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L699-L703
train
delian/node-amfutils
amfUtils.js
amf0cnvObject2Array
function amf0cnvObject2Array(oData) { var buf = new Buffer(5); var o = amf0decObject(oData); var l = Object.keys(o).length; buf.writeUInt32BE(l,1); return Buffer.concat([buf,oData.slice(1)]); }
javascript
function amf0cnvObject2Array(oData) { var buf = new Buffer(5); var o = amf0decObject(oData); var l = Object.keys(o).length; buf.writeUInt32BE(l,1); return Buffer.concat([buf,oData.slice(1)]); }
[ "function", "amf0cnvObject2Array", "(", "oData", ")", "{", "var", "buf", "=", "new", "Buffer", "(", "5", ")", ";", "var", "o", "=", "amf0decObject", "(", "oData", ")", ";", "var", "l", "=", "Object", ".", "keys", "(", "o", ")", ".", "length", ";", ...
AMF0 Encode Binary Object into binary Array @param oData @returns {Buffer}
[ "AMF0", "Encode", "Binary", "Object", "into", "binary", "Array" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L710-L716
train
delian/node-amfutils
amfUtils.js
amf0decXmlDoc
function amf0decXmlDoc(buf) { var sLen = buf.readUInt16BE(1); return { len: 3 + sLen, value: buf.toString('utf8', 3, 3 + sLen) } }
javascript
function amf0decXmlDoc(buf) { var sLen = buf.readUInt16BE(1); return { len: 3 + sLen, value: buf.toString('utf8', 3, 3 + sLen) } }
[ "function", "amf0decXmlDoc", "(", "buf", ")", "{", "var", "sLen", "=", "buf", ".", "readUInt16BE", "(", "1", ")", ";", "return", "{", "len", ":", "3", "+", "sLen", ",", "value", ":", "buf", ".", "toString", "(", "'utf8'", ",", "3", ",", "3", "+",...
AMF0 Decode XMLDoc @param buf @returns {{len: *, value: (*|string|String)}}
[ "AMF0", "Decode", "XMLDoc" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L723-L726
train
delian/node-amfutils
amfUtils.js
amf0encXmlDoc
function amf0encXmlDoc(str) { // Essentially it is the same as string var buf = new Buffer(3); buf.writeUInt8(0x0F, 0); buf.writeUInt16BE(str.length, 1); return Buffer.concat([buf, new Buffer(str, 'utf8')]); }
javascript
function amf0encXmlDoc(str) { // Essentially it is the same as string var buf = new Buffer(3); buf.writeUInt8(0x0F, 0); buf.writeUInt16BE(str.length, 1); return Buffer.concat([buf, new Buffer(str, 'utf8')]); }
[ "function", "amf0encXmlDoc", "(", "str", ")", "{", "// Essentially it is the same as string", "var", "buf", "=", "new", "Buffer", "(", "3", ")", ";", "buf", ".", "writeUInt8", "(", "0x0F", ",", "0", ")", ";", "buf", ".", "writeUInt16BE", "(", "str", ".", ...
AMF0 Encode XMLDoc @param str @returns {Buffer}
[ "AMF0", "Encode", "XMLDoc" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L733-L738
train
delian/node-amfutils
amfUtils.js
amf0decSArray
function amf0decSArray(buf) { var a = []; var len = 5; var ret; for (var count = buf.readUInt32BE(1); count; count--) { ret = amf0DecodeOne(buf.slice(len)); a.push(ret.value); len += ret.len; } return { len: len, value: amf0markSArray(a) } }
javascript
function amf0decSArray(buf) { var a = []; var len = 5; var ret; for (var count = buf.readUInt32BE(1); count; count--) { ret = amf0DecodeOne(buf.slice(len)); a.push(ret.value); len += ret.len; } return { len: len, value: amf0markSArray(a) } }
[ "function", "amf0decSArray", "(", "buf", ")", "{", "var", "a", "=", "[", "]", ";", "var", "len", "=", "5", ";", "var", "ret", ";", "for", "(", "var", "count", "=", "buf", ".", "readUInt32BE", "(", "1", ")", ";", "count", ";", "count", "--", ")"...
AMF0 Decode Strict Array @param buf @returns {{len: number, value: Array}}
[ "AMF0", "Decode", "Strict", "Array" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L745-L755
train
delian/node-amfutils
amfUtils.js
amf0encSArray
function amf0encSArray(a) { console.log('Do strict array!'); var buf = new Buffer(5); buf.writeUInt8(0x0A,0); buf.writeUInt32BE(a.length,1); var i; for (i=0;i< a.length;i++) { buf = Buffer.concat([buf,amf0EncodeOne(a[i])]); } return buf; }
javascript
function amf0encSArray(a) { console.log('Do strict array!'); var buf = new Buffer(5); buf.writeUInt8(0x0A,0); buf.writeUInt32BE(a.length,1); var i; for (i=0;i< a.length;i++) { buf = Buffer.concat([buf,amf0EncodeOne(a[i])]); } return buf; }
[ "function", "amf0encSArray", "(", "a", ")", "{", "console", ".", "log", "(", "'Do strict array!'", ")", ";", "var", "buf", "=", "new", "Buffer", "(", "5", ")", ";", "buf", ".", "writeUInt8", "(", "0x0A", ",", "0", ")", ";", "buf", ".", "writeUInt32BE...
AMF0 Encode Strict Array @param a Array
[ "AMF0", "Encode", "Strict", "Array" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L761-L771
train
delian/node-amfutils
amfUtils.js
amf0decTypedObj
function amf0decTypedObj(buf) { var className = amf0decString(buf); var obj = amf0decObject(buf.slice(className.len - 1)); obj.value.__className__ = className.value; return { len: className.len + obj.len - 1, value: obj.value } }
javascript
function amf0decTypedObj(buf) { var className = amf0decString(buf); var obj = amf0decObject(buf.slice(className.len - 1)); obj.value.__className__ = className.value; return { len: className.len + obj.len - 1, value: obj.value } }
[ "function", "amf0decTypedObj", "(", "buf", ")", "{", "var", "className", "=", "amf0decString", "(", "buf", ")", ";", "var", "obj", "=", "amf0decObject", "(", "buf", ".", "slice", "(", "className", ".", "len", "-", "1", ")", ")", ";", "obj", ".", "val...
AMF0 Decode Typed Object @param buf @returns {{len: number, value: ({}|*)}}
[ "AMF0", "Decode", "Typed", "Object" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L783-L788
train
delian/node-amfutils
amfUtils.js
amfXDecodeOne
function amfXDecodeOne(rules, buffer) { if (!rules[buffer.readUInt8(0)]) { console.log('Unknown field', buffer.readUInt8(0)); throw new Error("Error: Unknown field"); } return rules[buffer.readUInt8(0)](buffer); }
javascript
function amfXDecodeOne(rules, buffer) { if (!rules[buffer.readUInt8(0)]) { console.log('Unknown field', buffer.readUInt8(0)); throw new Error("Error: Unknown field"); } return rules[buffer.readUInt8(0)](buffer); }
[ "function", "amfXDecodeOne", "(", "rules", ",", "buffer", ")", "{", "if", "(", "!", "rules", "[", "buffer", ".", "readUInt8", "(", "0", ")", "]", ")", "{", "console", ".", "log", "(", "'Unknown field'", ",", "buffer", ".", "readUInt8", "(", "0", ")",...
Decode one value from the Buffer according to the applied rules @param rules @param buffer @returns {*}
[ "Decode", "one", "value", "from", "the", "Buffer", "according", "to", "the", "applied", "rules" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L803-L809
train
delian/node-amfutils
amfUtils.js
amfXDecode
function amfXDecode(rules, buffer) { // We shall receive clean buffer and will respond with an array of values var resp = []; var res; for (var i = 0; i < buffer.length;) { res = amfXDecodeOne(rules, buffer.slice(i)); i += res.len; resp.push(res.value); // Add the response } ...
javascript
function amfXDecode(rules, buffer) { // We shall receive clean buffer and will respond with an array of values var resp = []; var res; for (var i = 0; i < buffer.length;) { res = amfXDecodeOne(rules, buffer.slice(i)); i += res.len; resp.push(res.value); // Add the response } ...
[ "function", "amfXDecode", "(", "rules", ",", "buffer", ")", "{", "// We shall receive clean buffer and will respond with an array of values", "var", "resp", "=", "[", "]", ";", "var", "res", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "buffer", ".", ...
Decode a whole buffer of AMF values according to rules and return in array @param rules @param buffer @returns {Array}
[ "Decode", "a", "whole", "buffer", "of", "AMF", "values", "according", "to", "rules", "and", "return", "in", "array" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L835-L845
train
delian/node-amfutils
amfUtils.js
amfXEncodeOne
function amfXEncodeOne(rules, o) { // console.log('amfXEncodeOne type',o,amfType(o),rules[amfType(o)]); var f = rules[amfType(o)]; if (f) return f(o); throw new Error('Unsupported type for encoding!'); }
javascript
function amfXEncodeOne(rules, o) { // console.log('amfXEncodeOne type',o,amfType(o),rules[amfType(o)]); var f = rules[amfType(o)]; if (f) return f(o); throw new Error('Unsupported type for encoding!'); }
[ "function", "amfXEncodeOne", "(", "rules", ",", "o", ")", "{", "// console.log('amfXEncodeOne type',o,amfType(o),rules[amfType(o)]);", "var", "f", "=", "rules", "[", "amfType", "(", "o", ")", "]", ";", "if", "(", "f", ")", "return", "f", "(", "o", ")", ";...
Encode one AMF value according to rules @param rules @param o @returns {*}
[ "Encode", "one", "AMF", "value", "according", "to", "rules" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L871-L876
train
delian/node-amfutils
amfUtils.js
decodeAMF0Cmd
function decodeAMF0Cmd(dbuf) { var buffer = dbuf; var resp = {}; var cmd = amf0DecodeOne(buffer); resp.cmd = cmd.value; buffer = buffer.slice(cmd.len); if (rtmpCmdDecode[cmd.value]) { rtmpCmdDecode[cmd.value].forEach(function (n) { if (buffer.length > 0) { v...
javascript
function decodeAMF0Cmd(dbuf) { var buffer = dbuf; var resp = {}; var cmd = amf0DecodeOne(buffer); resp.cmd = cmd.value; buffer = buffer.slice(cmd.len); if (rtmpCmdDecode[cmd.value]) { rtmpCmdDecode[cmd.value].forEach(function (n) { if (buffer.length > 0) { v...
[ "function", "decodeAMF0Cmd", "(", "dbuf", ")", "{", "var", "buffer", "=", "dbuf", ";", "var", "resp", "=", "{", "}", ";", "var", "cmd", "=", "amf0DecodeOne", "(", "buffer", ")", ";", "resp", ".", "cmd", "=", "cmd", ".", "value", ";", "buffer", "=",...
Decode a command! @param dbuf @returns {{cmd: (*|string|String|*), value: *}}
[ "Decode", "a", "command!" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L951-L971
train
delian/node-amfutils
amfUtils.js
encodeAMF3Cmd
function encodeAMF3Cmd(opt) { var data = amf0EncodeOne(opt.cmd); if (rtmpCmdDecode[opt.cmd]) { rtmpCmdDecode[opt.cmd].forEach(function (n) { if (opt.hasOwnProperty(n)) data = Buffer.concat([data, amf3EncodeOne(opt[n])]); }); } else { console.log('Unknown ...
javascript
function encodeAMF3Cmd(opt) { var data = amf0EncodeOne(opt.cmd); if (rtmpCmdDecode[opt.cmd]) { rtmpCmdDecode[opt.cmd].forEach(function (n) { if (opt.hasOwnProperty(n)) data = Buffer.concat([data, amf3EncodeOne(opt[n])]); }); } else { console.log('Unknown ...
[ "function", "encodeAMF3Cmd", "(", "opt", ")", "{", "var", "data", "=", "amf0EncodeOne", "(", "opt", ".", "cmd", ")", ";", "if", "(", "rtmpCmdDecode", "[", "opt", ".", "cmd", "]", ")", "{", "rtmpCmdDecode", "[", "opt", ".", "cmd", "]", ".", "forEach",...
Encode AMF3 Command @param opt @returns {*}
[ "Encode", "AMF3", "Command" ]
f9ef2d0df385f371c2f83a52200933f59eaebcce
https://github.com/delian/node-amfutils/blob/f9ef2d0df385f371c2f83a52200933f59eaebcce/amfUtils.js#L1025-L1037
train
ascartabelli/lamb
src/privates/_isArrayIndex.js
_isArrayIndex
function _isArrayIndex (target, key) { var n = +key; return Array.isArray(target) && n % 1 === 0 && !(n < 0 && _isEnumerable(target, key)); }
javascript
function _isArrayIndex (target, key) { var n = +key; return Array.isArray(target) && n % 1 === 0 && !(n < 0 && _isEnumerable(target, key)); }
[ "function", "_isArrayIndex", "(", "target", ",", "key", ")", "{", "var", "n", "=", "+", "key", ";", "return", "Array", ".", "isArray", "(", "target", ")", "&&", "n", "%", "1", "===", "0", "&&", "!", "(", "n", "<", "0", "&&", "_isEnumerable", "(",...
Accepts a target object and a key name and verifies that the target is an array and that the key is an existing index. @private @param {Object} target @param {String|Number} key @returns {Boolean}
[ "Accepts", "a", "target", "object", "and", "a", "key", "name", "and", "verifies", "that", "the", "target", "is", "an", "array", "and", "that", "the", "key", "is", "an", "existing", "index", "." ]
d36e45945c4789e4f1a2d8805936514b53f32362
https://github.com/ascartabelli/lamb/blob/d36e45945c4789e4f1a2d8805936514b53f32362/src/privates/_isArrayIndex.js#L11-L15
train
marionebl/eslint-plugin-flow-check
source/flow.js
flow
function flow(options) { const result = spawnSync(bin, [ 'check-contents', '--json', `--root=${options.root}`, options.fileName ], { input: options.source, encoding: 'utf-8' }); if (result.status !== 0) { return [{ message: result.stderr, loc: { start: { line: 1 }, end: { ...
javascript
function flow(options) { const result = spawnSync(bin, [ 'check-contents', '--json', `--root=${options.root}`, options.fileName ], { input: options.source, encoding: 'utf-8' }); if (result.status !== 0) { return [{ message: result.stderr, loc: { start: { line: 1 }, end: { ...
[ "function", "flow", "(", "options", ")", "{", "const", "result", "=", "spawnSync", "(", "bin", ",", "[", "'check-contents'", ",", "'--json'", ",", "`", "${", "options", ".", "root", "}", "`", ",", "options", ".", "fileName", "]", ",", "{", "input", "...
start a flow server
[ "start", "a", "flow", "server" ]
bd2332d114afe8a3fff03adbc4253cbd43bd926f
https://github.com/marionebl/eslint-plugin-flow-check/blob/bd2332d114afe8a3fff03adbc4253cbd43bd926f/source/flow.js#L9-L50
train
ascartabelli/lamb
src/privates/_getPathInfo.js
_getPathInfo
function _getPathInfo (obj, parts, walkNonEnumerables) { if (isNil(obj)) { throw _makeTypeErrorFor(obj, "object"); } var target = obj; var i = -1; var len = parts.length; var key; while (++i < len) { key = _getPathKey(target, parts[i], walkNonEnumerables); if (isUn...
javascript
function _getPathInfo (obj, parts, walkNonEnumerables) { if (isNil(obj)) { throw _makeTypeErrorFor(obj, "object"); } var target = obj; var i = -1; var len = parts.length; var key; while (++i < len) { key = _getPathKey(target, parts[i], walkNonEnumerables); if (isUn...
[ "function", "_getPathInfo", "(", "obj", ",", "parts", ",", "walkNonEnumerables", ")", "{", "if", "(", "isNil", "(", "obj", ")", ")", "{", "throw", "_makeTypeErrorFor", "(", "obj", ",", "\"object\"", ")", ";", "}", "var", "target", "=", "obj", ";", "var...
Checks if a path is valid in the given object and retrieves the path target. @private @param {Object} obj @param {String[]} parts @param {Boolean} walkNonEnumerables @returns {Object}
[ "Checks", "if", "a", "path", "is", "valid", "in", "the", "given", "object", "and", "retrieves", "the", "path", "target", "." ]
d36e45945c4789e4f1a2d8805936514b53f32362
https://github.com/ascartabelli/lamb/blob/d36e45945c4789e4f1a2d8805936514b53f32362/src/privates/_getPathInfo.js#L14-L35
train
ascartabelli/lamb
src/privates/_flatten.js
_flatten
function _flatten (array, isDeep, output, idx) { for (var i = 0, len = array.length, value, j, vLen; i < len; i++) { value = array[i]; if (!Array.isArray(value)) { output[idx++] = value; } else if (isDeep) { _flatten(value, true, output, idx); idx = outpu...
javascript
function _flatten (array, isDeep, output, idx) { for (var i = 0, len = array.length, value, j, vLen; i < len; i++) { value = array[i]; if (!Array.isArray(value)) { output[idx++] = value; } else if (isDeep) { _flatten(value, true, output, idx); idx = outpu...
[ "function", "_flatten", "(", "array", ",", "isDeep", ",", "output", ",", "idx", ")", "{", "for", "(", "var", "i", "=", "0", ",", "len", "=", "array", ".", "length", ",", "value", ",", "j", ",", "vLen", ";", "i", "<", "len", ";", "i", "++", ")...
Flattens an array. @private @param {Array} array - The source array @param {Boolean} isDeep - Whether to perform a deep flattening or not @param {Array} output - An array to collect the result @param {Number} idx - The next index to be filled in the output @returns {Array} The output array filled with the results
[ "Flattens", "an", "array", "." ]
d36e45945c4789e4f1a2d8805936514b53f32362
https://github.com/ascartabelli/lamb/blob/d36e45945c4789e4f1a2d8805936514b53f32362/src/privates/_flatten.js#L10-L30
train
fortunejs/fortune-mongodb
lib/helpers.js
mapValues
function mapValues (object, map) { return Object.keys(object).reduce((clone, key) => Object.assign(clone, { [key]: map(object[key], key) }), {}) }
javascript
function mapValues (object, map) { return Object.keys(object).reduce((clone, key) => Object.assign(clone, { [key]: map(object[key], key) }), {}) }
[ "function", "mapValues", "(", "object", ",", "map", ")", "{", "return", "Object", ".", "keys", "(", "object", ")", ".", "reduce", "(", "(", "clone", ",", "key", ")", "=>", "Object", ".", "assign", "(", "clone", ",", "{", "[", "key", "]", ":", "ma...
Create a new object with different key values. @param {Object} object @param {Function} map should return the first argument, which is the value @return {Object}
[ "Create", "a", "new", "object", "with", "different", "key", "values", "." ]
e1e5e4d830e37fdee92388ab194ba35a71dae27f
https://github.com/fortunejs/fortune-mongodb/blob/e1e5e4d830e37fdee92388ab194ba35a71dae27f/lib/helpers.js#L106-L109
train
fortunejs/fortune-mongodb
lib/helpers.js
toBuffer
function toBuffer (object) { if (Buffer.isBuffer(object)) return object if (object.buffer) return object.buffer throw new TypeError('Could not output buffer type.') }
javascript
function toBuffer (object) { if (Buffer.isBuffer(object)) return object if (object.buffer) return object.buffer throw new TypeError('Could not output buffer type.') }
[ "function", "toBuffer", "(", "object", ")", "{", "if", "(", "Buffer", ".", "isBuffer", "(", "object", ")", ")", "return", "object", "if", "(", "object", ".", "buffer", ")", "return", "object", ".", "buffer", "throw", "new", "TypeError", "(", "'Could not ...
There is an inconsistency when accessing a record depending on the method, it may be either a native `Buffer` or BSON object wrapper. We only want native buffers.
[ "There", "is", "an", "inconsistency", "when", "accessing", "a", "record", "depending", "on", "the", "method", "it", "may", "be", "either", "a", "native", "Buffer", "or", "BSON", "object", "wrapper", ".", "We", "only", "want", "native", "buffers", "." ]
e1e5e4d830e37fdee92388ab194ba35a71dae27f
https://github.com/fortunejs/fortune-mongodb/blob/e1e5e4d830e37fdee92388ab194ba35a71dae27f/lib/helpers.js#L115-L119
train
fortunejs/fortune-mongodb
lib/helpers.js
generateQuery
function generateQuery (fields, options, not) { let $and = [] const $or = [] const result = {} for (const key in options) switch (key) { case 'and': case 'or': const query = {} query[`$${key}`] = mapValues(options[key], value => { return generateQuery(fields, value) }) ...
javascript
function generateQuery (fields, options, not) { let $and = [] const $or = [] const result = {} for (const key in options) switch (key) { case 'and': case 'or': const query = {} query[`$${key}`] = mapValues(options[key], value => { return generateQuery(fields, value) }) ...
[ "function", "generateQuery", "(", "fields", ",", "options", ",", "not", ")", "{", "let", "$and", "=", "[", "]", "const", "$or", "=", "[", "]", "const", "result", "=", "{", "}", "for", "(", "const", "key", "in", "options", ")", "switch", "(", "key",...
Generate a mongoDB query from a fortune query object
[ "Generate", "a", "mongoDB", "query", "from", "a", "fortune", "query", "object" ]
e1e5e4d830e37fdee92388ab194ba35a71dae27f
https://github.com/fortunejs/fortune-mongodb/blob/e1e5e4d830e37fdee92388ab194ba35a71dae27f/lib/helpers.js#L152-L201
train
takashiki/cos-webpack
index.js
function(fileName) { let file = assets[fileName] || {}; fileName = basePath + "/" + fileName.replace(/\\/g, '/'); let key = path.posix.join(uploadPath, fileName); return new Promise((resolve, reject) => { let begin = Date.now(); ...
javascript
function(fileName) { let file = assets[fileName] || {}; fileName = basePath + "/" + fileName.replace(/\\/g, '/'); let key = path.posix.join(uploadPath, fileName); return new Promise((resolve, reject) => { let begin = Date.now(); ...
[ "function", "(", "fileName", ")", "{", "let", "file", "=", "assets", "[", "fileName", "]", "||", "{", "}", ";", "fileName", "=", "basePath", "+", "\"/\"", "+", "fileName", ".", "replace", "(", "/", "\\\\", "/", "g", ",", "'/'", ")", ";", "let", "...
Perform upload to cos
[ "Perform", "upload", "to", "cos" ]
2a8d09a14b977930c00c87a8c63e11897e929ed6
https://github.com/takashiki/cos-webpack/blob/2a8d09a14b977930c00c87a8c63e11897e929ed6/index.js#L104-L129
train
takashiki/cos-webpack
index.js
function(err) { if (err) { // eslint-disable-next-line no-console console.log("\n"); return Promise.reject(err); } // Get 20 files let _files = filesNames.splice(0, batch); if (_...
javascript
function(err) { if (err) { // eslint-disable-next-line no-console console.log("\n"); return Promise.reject(err); } // Get 20 files let _files = filesNames.splice(0, batch); if (_...
[ "function", "(", "err", ")", "{", "if", "(", "err", ")", "{", "// eslint-disable-next-line no-console", "console", ".", "log", "(", "\"\\n\"", ")", ";", "return", "Promise", ".", "reject", "(", "err", ")", ";", "}", "// Get 20 files", "let", "_files", "=",...
Execute stack according to `batch` option
[ "Execute", "stack", "according", "to", "batch", "option" ]
2a8d09a14b977930c00c87a8c63e11897e929ed6
https://github.com/takashiki/cos-webpack/blob/2a8d09a14b977930c00c87a8c63e11897e929ed6/index.js#L132-L147
train
aMarCruz/jspreproc
lib/compactor.js
indent
function indent(level) { var val = options.indent _indent = '' if (_lastch === null) _lastch = _to // as-is, this is the first file else if (_lastch !== _to) { _lastch = _to // istanbul ignore else if (output) output.emit('data', _to) // force eol afte...
javascript
function indent(level) { var val = options.indent _indent = '' if (_lastch === null) _lastch = _to // as-is, this is the first file else if (_lastch !== _to) { _lastch = _to // istanbul ignore else if (output) output.emit('data', _to) // force eol afte...
[ "function", "indent", "(", "level", ")", "{", "var", "val", "=", "options", ".", "indent", "_indent", "=", "''", "if", "(", "_lastch", "===", "null", ")", "_lastch", "=", "_to", "// as-is, this is the first file", "else", "if", "(", "_lastch", "!==", "_to"...
On file change, reset indentation
[ "On", "file", "change", "reset", "indentation" ]
5f31820d702a329e8aa25f0f3983f13097610250
https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/lib/compactor.js#L32-L51
train
aMarCruz/jspreproc
lib/compactor.js
write
function write(buffer) { // first, trim trailing whitespace for fast searching buffer = buffer.replace(/[ \t]+$/gm, '') // compact lines if emptyLines != -1 if (_elines >= 0) buffer = trimBuffer(buffer) if (!buffer) return // finished the surrounding lines, now the inners if (!_eli...
javascript
function write(buffer) { // first, trim trailing whitespace for fast searching buffer = buffer.replace(/[ \t]+$/gm, '') // compact lines if emptyLines != -1 if (_elines >= 0) buffer = trimBuffer(buffer) if (!buffer) return // finished the surrounding lines, now the inners if (!_eli...
[ "function", "write", "(", "buffer", ")", "{", "// first, trim trailing whitespace for fast searching", "buffer", "=", "buffer", ".", "replace", "(", "/", "[ \\t]+$", "/", "gm", ",", "''", ")", "// compact lines if emptyLines != -1", "if", "(", "_elines", ">=", "0", ...
On new data, trim trailing whitespace and normalize eols
[ "On", "new", "data", "trim", "trailing", "whitespace", "and", "normalize", "eols" ]
5f31820d702a329e8aa25f0f3983f13097610250
https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/lib/compactor.js#L55-L88
train
jgkim/mocha-gherkin
src/spec.js
GherkinSpec
function GherkinSpec(runner) { Base.call(this, runner); let indents = 0; let n = 0; if (!Base.useColors) { colors.enabled = false; } function indent() { return Array(indents).join(' '); } runner.on('start', () => { console.log(); }); runner.on('suite', (suite) => { indent...
javascript
function GherkinSpec(runner) { Base.call(this, runner); let indents = 0; let n = 0; if (!Base.useColors) { colors.enabled = false; } function indent() { return Array(indents).join(' '); } runner.on('start', () => { console.log(); }); runner.on('suite', (suite) => { indent...
[ "function", "GherkinSpec", "(", "runner", ")", "{", "Base", ".", "call", "(", "this", ",", "runner", ")", ";", "let", "indents", "=", "0", ";", "let", "n", "=", "0", ";", "if", "(", "!", "Base", ".", "useColors", ")", "{", "colors", ".", "enabled...
Initialize a new `GherkinSpec` test reporter. @api public @param {Runner} runner
[ "Initialize", "a", "new", "GherkinSpec", "test", "reporter", "." ]
9542725a3c5b557b153bc51ce6d61d1b11dfd3a5
https://github.com/jgkim/mocha-gherkin/blob/9542725a3c5b557b153bc51ce6d61d1b11dfd3a5/src/spec.js#L14-L82
train
LaxarJS/webpack-jasmine-html-runner-plugin
index.js
entry
function entry() { const patterns = Array.from( arguments ); const entry = {}; patterns.forEach( globPattern => { // backwards compatibility: const pattern = globPattern.replace( '[name]', '**' ); return glob.sync( pattern ).forEach( path => { const baseName = path.replace( /\.[^.]+$...
javascript
function entry() { const patterns = Array.from( arguments ); const entry = {}; patterns.forEach( globPattern => { // backwards compatibility: const pattern = globPattern.replace( '[name]', '**' ); return glob.sync( pattern ).forEach( path => { const baseName = path.replace( /\.[^.]+$...
[ "function", "entry", "(", ")", "{", "const", "patterns", "=", "Array", ".", "from", "(", "arguments", ")", ";", "const", "entry", "=", "{", "}", ";", "patterns", ".", "forEach", "(", "globPattern", "=>", "{", "// backwards compatibility:", "const", "patter...
Generates webpack entry points suitable for use with the WebpackJasmineHtmlRunnerPlugin plugin. Basically, each file matching one of the provided glob-patterns becomes an entry point which is named like that file, but without the extension. @param {...String} patterns File patterns in glob-syntax (may contain * and **...
[ "Generates", "webpack", "entry", "points", "suitable", "for", "use", "with", "the", "WebpackJasmineHtmlRunnerPlugin", "plugin", ".", "Basically", "each", "file", "matching", "one", "of", "the", "provided", "glob", "-", "patterns", "becomes", "an", "entry", "point"...
6a6671385dc54db67f44446fb52308d7513e66f7
https://github.com/LaxarJS/webpack-jasmine-html-runner-plugin/blob/6a6671385dc54db67f44446fb52308d7513e66f7/index.js#L34-L46
train
Inspired-by-Boredom/generator-vintage-frontend
generators/app/templates/gulp/tasks/templates.js
compileHtml
function compileHtml(src, dest) { return gulp.src([src]) .pipe(plumber(config.plumberOptions)) .pipe(pug(pugOptions)) .pipe(prettify()) .pipe(gulp.dest(dest)); }
javascript
function compileHtml(src, dest) { return gulp.src([src]) .pipe(plumber(config.plumberOptions)) .pipe(pug(pugOptions)) .pipe(prettify()) .pipe(gulp.dest(dest)); }
[ "function", "compileHtml", "(", "src", ",", "dest", ")", "{", "return", "gulp", ".", "src", "(", "[", "src", "]", ")", ".", "pipe", "(", "plumber", "(", "config", ".", "plumberOptions", ")", ")", ".", "pipe", "(", "pug", "(", "pugOptions", ")", ")"...
Default HTML compilation function. @param {String} src @param {String} dest
[ "Default", "HTML", "compilation", "function", "." ]
316ebc981961a39d3c47ba830f377350d529452b
https://github.com/Inspired-by-Boredom/generator-vintage-frontend/blob/316ebc981961a39d3c47ba830f377350d529452b/generators/app/templates/gulp/tasks/templates.js#L46-L52
train
ILLGrenoble/guacamole-common-js
src/Tunnel.js
addExtraHeaders
function addExtraHeaders(request, headers) { for (var name in headers) { request.setRequestHeader(name, headers[name]); } }
javascript
function addExtraHeaders(request, headers) { for (var name in headers) { request.setRequestHeader(name, headers[name]); } }
[ "function", "addExtraHeaders", "(", "request", ",", "headers", ")", "{", "for", "(", "var", "name", "in", "headers", ")", "{", "request", ".", "setRequestHeader", "(", "name", ",", "headers", "[", "name", "]", ")", ";", "}", "}" ]
Adds the configured additional headers to the given request. @param {XMLHttpRequest} request The request where the configured extra headers will be added. @param {Object} headers The headers to be added to the request. @private
[ "Adds", "the", "configured", "additional", "headers", "to", "the", "given", "request", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Tunnel.js#L242-L246
train
ILLGrenoble/guacamole-common-js
src/Tunnel.js
reset_timeout
function reset_timeout() { // Get rid of old timeout (if any) window.clearTimeout(receive_timeout); // Set new timeout receive_timeout = window.setTimeout(function () { close_tunnel(new Guacamole.Status(Guacamole.Status.Code.UPSTREAM_TIMEOUT, "Server timeout.")); },...
javascript
function reset_timeout() { // Get rid of old timeout (if any) window.clearTimeout(receive_timeout); // Set new timeout receive_timeout = window.setTimeout(function () { close_tunnel(new Guacamole.Status(Guacamole.Status.Code.UPSTREAM_TIMEOUT, "Server timeout.")); },...
[ "function", "reset_timeout", "(", ")", "{", "// Get rid of old timeout (if any)", "window", ".", "clearTimeout", "(", "receive_timeout", ")", ";", "// Set new timeout", "receive_timeout", "=", "window", ".", "setTimeout", "(", "function", "(", ")", "{", "close_tunnel"...
Initiates a timeout which, if data is not received, causes the tunnel to close with an error. @private
[ "Initiates", "a", "timeout", "which", "if", "data", "is", "not", "received", "causes", "the", "tunnel", "to", "close", "with", "an", "error", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Tunnel.js#L254-L264
train
ILLGrenoble/guacamole-common-js
src/Tunnel.js
attach
function attach(tunnel) { // Set own functions to tunnel's functions chained_tunnel.disconnect = tunnel.disconnect; chained_tunnel.sendMessage = tunnel.sendMessage; /** * Fails the currently-attached tunnel, attaching a new tunnel if * possible. * *...
javascript
function attach(tunnel) { // Set own functions to tunnel's functions chained_tunnel.disconnect = tunnel.disconnect; chained_tunnel.sendMessage = tunnel.sendMessage; /** * Fails the currently-attached tunnel, attaching a new tunnel if * possible. * *...
[ "function", "attach", "(", "tunnel", ")", "{", "// Set own functions to tunnel's functions", "chained_tunnel", ".", "disconnect", "=", "tunnel", ".", "disconnect", ";", "chained_tunnel", ".", "sendMessage", "=", "tunnel", ".", "sendMessage", ";", "/**\n * Fails ...
Sets the current tunnel. @private @param {Guacamole.Tunnel} tunnel The tunnel to set as the current tunnel.
[ "Sets", "the", "current", "tunnel", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Tunnel.js#L954-L1056
train
ILLGrenoble/guacamole-common-js
src/Tunnel.js
failTunnel
function failTunnel(status) { // Do not attempt to continue using next tunnel on server timeout if (status && status.code === Guacamole.Status.Code.UPSTREAM_TIMEOUT) { tunnels = []; return null; } // Get next tunnel var next_t...
javascript
function failTunnel(status) { // Do not attempt to continue using next tunnel on server timeout if (status && status.code === Guacamole.Status.Code.UPSTREAM_TIMEOUT) { tunnels = []; return null; } // Get next tunnel var next_t...
[ "function", "failTunnel", "(", "status", ")", "{", "// Do not attempt to continue using next tunnel on server timeout", "if", "(", "status", "&&", "status", ".", "code", "===", "Guacamole", ".", "Status", ".", "Code", ".", "UPSTREAM_TIMEOUT", ")", "{", "tunnels", "=...
Fails the currently-attached tunnel, attaching a new tunnel if possible. @private @param {Guacamole.Status} [status] An object representing the failure that occured in the currently-attached tunnel, if known. @return {Guacamole.Tunnel} The next tunnel, or null if there are no more tunnels to try or if no more tunnels...
[ "Fails", "the", "currently", "-", "attached", "tunnel", "attaching", "a", "new", "tunnel", "if", "possible", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Tunnel.js#L973-L994
train
ILLGrenoble/guacamole-common-js
src/Tunnel.js
commit_tunnel
function commit_tunnel() { tunnel.onstatechange = chained_tunnel.onstatechange; tunnel.oninstruction = chained_tunnel.oninstruction; tunnel.onerror = chained_tunnel.onerror; chained_tunnel.uuid = tunnel.uuid; committedTunnel = tunnel; }
javascript
function commit_tunnel() { tunnel.onstatechange = chained_tunnel.onstatechange; tunnel.oninstruction = chained_tunnel.oninstruction; tunnel.onerror = chained_tunnel.onerror; chained_tunnel.uuid = tunnel.uuid; committedTunnel = tunnel; }
[ "function", "commit_tunnel", "(", ")", "{", "tunnel", ".", "onstatechange", "=", "chained_tunnel", ".", "onstatechange", ";", "tunnel", ".", "oninstruction", "=", "chained_tunnel", ".", "oninstruction", ";", "tunnel", ".", "onerror", "=", "chained_tunnel", ".", ...
Use the current tunnel from this point forward. Do not try any more tunnels, even if the current tunnel fails. @private
[ "Use", "the", "current", "tunnel", "from", "this", "point", "forward", ".", "Do", "not", "try", "any", "more", "tunnels", "even", "if", "the", "current", "tunnel", "fails", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Tunnel.js#L1002-L1008
train
ILLGrenoble/guacamole-common-js
src/Tunnel.js
getGuacamoleStatusCode
function getGuacamoleStatusCode(httpStatus) { // Translate status codes with known equivalents switch (httpStatus) { // HTTP 400 - Bad request case 400: return Guacamole.Status.Code.CLIENT_BAD_REQUEST; // HTTP 403 - Forbidden case 403: ...
javascript
function getGuacamoleStatusCode(httpStatus) { // Translate status codes with known equivalents switch (httpStatus) { // HTTP 400 - Bad request case 400: return Guacamole.Status.Code.CLIENT_BAD_REQUEST; // HTTP 403 - Forbidden case 403: ...
[ "function", "getGuacamoleStatusCode", "(", "httpStatus", ")", "{", "// Translate status codes with known equivalents", "switch", "(", "httpStatus", ")", "{", "// HTTP 400 - Bad request", "case", "400", ":", "return", "Guacamole", ".", "Status", ".", "Code", ".", "CLIENT...
Returns the Guacamole protocol status code which most closely represents the given HTTP status code. @private @param {Number} httpStatus The HTTP status code to translate into a Guacamole protocol status code. @returns {Number} The Guacamole protocol status code which most closely represents the given HTTP status cod...
[ "Returns", "the", "Guacamole", "protocol", "status", "code", "which", "most", "closely", "represents", "the", "given", "HTTP", "status", "code", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Tunnel.js#L1157-L1187
train
smshuja/parse-server-accountkit-auth
index.js
validateAuthData
function validateAuthData(authData, config) { var appSecretProof = crypto.createHmac('sha256', config.appSecret).update(authData.access_token).digest('hex'); return graphRequest('me/?access_token=' + authData.access_token + '&appsecret_proof=' + appSecretProof) .then((data) => { if (data && data.id == aut...
javascript
function validateAuthData(authData, config) { var appSecretProof = crypto.createHmac('sha256', config.appSecret).update(authData.access_token).digest('hex'); return graphRequest('me/?access_token=' + authData.access_token + '&appsecret_proof=' + appSecretProof) .then((data) => { if (data && data.id == aut...
[ "function", "validateAuthData", "(", "authData", ",", "config", ")", "{", "var", "appSecretProof", "=", "crypto", ".", "createHmac", "(", "'sha256'", ",", "config", ".", "appSecret", ")", ".", "update", "(", "authData", ".", "access_token", ")", ".", "digest...
Returns a promise that fulfills iff this user id is valid.
[ "Returns", "a", "promise", "that", "fulfills", "iff", "this", "user", "id", "is", "valid", "." ]
6a47523ce08f0bc8f39c372e1a99d15d4d9e4aca
https://github.com/smshuja/parse-server-accountkit-auth/blob/6a47523ce08f0bc8f39c372e1a99d15d4d9e4aca/index.js#L7-L18
train
GiladShoham/seven-boom
lib/wrappedBoomFunction.js
getWrappedFunc
function getWrappedFunc(funcName, func, ...args) { const funcDefaultArgs = defaultArgs[funcName] || defaultArgs['default']; const allArgs = funcDefaultArgs.concat(args); return function(...allArgs) { const boomArgs = _.take(allArgs, funcDefaultArgs.length); let result = func.call(null, ...boomArgs); ...
javascript
function getWrappedFunc(funcName, func, ...args) { const funcDefaultArgs = defaultArgs[funcName] || defaultArgs['default']; const allArgs = funcDefaultArgs.concat(args); return function(...allArgs) { const boomArgs = _.take(allArgs, funcDefaultArgs.length); let result = func.call(null, ...boomArgs); ...
[ "function", "getWrappedFunc", "(", "funcName", ",", "func", ",", "...", "args", ")", "{", "const", "funcDefaultArgs", "=", "defaultArgs", "[", "funcName", "]", "||", "defaultArgs", "[", "'default'", "]", ";", "const", "allArgs", "=", "funcDefaultArgs", ".", ...
This function gets a boom function and arguments in new format and return a wrapped boom function
[ "This", "function", "gets", "a", "boom", "function", "and", "arguments", "in", "new", "format", "and", "return", "a", "wrapped", "boom", "function" ]
38b1469260743b5b083f8ca185786ef74a693844
https://github.com/GiladShoham/seven-boom/blob/38b1469260743b5b083f8ca185786ef74a693844/lib/wrappedBoomFunction.js#L15-L41
train
ILLGrenoble/guacamole-common-js
src/Display.js
__flush_frames
function __flush_frames() { var rendered_frames = 0; // Draw all pending frames, if ready while (rendered_frames < frames.length) { var frame = frames[rendered_frames]; if (!frame.isReady()) break; frame.flush(); rendered_frames...
javascript
function __flush_frames() { var rendered_frames = 0; // Draw all pending frames, if ready while (rendered_frames < frames.length) { var frame = frames[rendered_frames]; if (!frame.isReady()) break; frame.flush(); rendered_frames...
[ "function", "__flush_frames", "(", ")", "{", "var", "rendered_frames", "=", "0", ";", "// Draw all pending frames, if ready", "while", "(", "rendered_frames", "<", "frames", ".", "length", ")", "{", "var", "frame", "=", "frames", "[", "rendered_frames", "]", ";"...
Flushes all pending frames. @private
[ "Flushes", "all", "pending", "frames", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Display.js#L159-L178
train
ILLGrenoble/guacamole-common-js
src/Display.js
Task
function Task(taskHandler, blocked) { var task = this; /** * Whether this Task is blocked. * * @type {boolean} */ this.blocked = blocked; /** * Unblocks this Task, allowing it to run. */ this.unblock = functi...
javascript
function Task(taskHandler, blocked) { var task = this; /** * Whether this Task is blocked. * * @type {boolean} */ this.blocked = blocked; /** * Unblocks this Task, allowing it to run. */ this.unblock = functi...
[ "function", "Task", "(", "taskHandler", ",", "blocked", ")", "{", "var", "task", "=", "this", ";", "/**\n * Whether this Task is blocked.\n * \n * @type {boolean}\n */", "this", ".", "blocked", "=", "blocked", ";", "/**\n * Unblocks thi...
A container for an task handler. Each operation which must be ordered is associated with a Task that goes into a task queue. Tasks in this queue are executed in order once their handlers are set, while Tasks without handlers block themselves and any following Tasks from running. @constructor @private @param {function}...
[ "A", "container", "for", "an", "task", "handler", ".", "Each", "operation", "which", "must", "be", "ordered", "is", "associated", "with", "a", "Task", "that", "goes", "into", "a", "task", "queue", ".", "Tasks", "in", "this", "queue", "are", "executed", "...
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Display.js#L244-L274
train
ILLGrenoble/guacamole-common-js
src/Display.js
get_children
function get_children(layer) { // Build array of children var children = []; for (var index in layer.children) children.push(layer.children[index]); // Sort children.sort(function children_comparator(a, b) { // Compare based ...
javascript
function get_children(layer) { // Build array of children var children = []; for (var index in layer.children) children.push(layer.children[index]); // Sort children.sort(function children_comparator(a, b) { // Compare based ...
[ "function", "get_children", "(", "layer", ")", "{", "// Build array of children", "var", "children", "=", "[", "]", ";", "for", "(", "var", "index", "in", "layer", ".", "children", ")", "children", ".", "push", "(", "layer", ".", "children", "[", "index", ...
Returns sorted array of children
[ "Returns", "sorted", "array", "of", "children" ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Display.js#L1141-L1172
train
ILLGrenoble/guacamole-common-js
src/Display.js
draw_layer
function draw_layer(layer, x, y) { // Draw layer if (layer.width > 0 && layer.height > 0) { // Save and update alpha var initial_alpha = context.globalAlpha; context.globalAlpha *= layer.alpha / 255.0; // Copy data ...
javascript
function draw_layer(layer, x, y) { // Draw layer if (layer.width > 0 && layer.height > 0) { // Save and update alpha var initial_alpha = context.globalAlpha; context.globalAlpha *= layer.alpha / 255.0; // Copy data ...
[ "function", "draw_layer", "(", "layer", ",", "x", ",", "y", ")", "{", "// Draw layer", "if", "(", "layer", ".", "width", ">", "0", "&&", "layer", ".", "height", ">", "0", ")", "{", "// Save and update alpha", "var", "initial_alpha", "=", "context", ".", ...
Draws the contents of the given layer at the given coordinates
[ "Draws", "the", "contents", "of", "the", "given", "layer", "at", "the", "given", "coordinates" ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/Display.js#L1175-L1199
train
ILLGrenoble/guacamole-common-js
src/AudioPlayer.js
joinAudioPackets
function joinAudioPackets(packets) { // Do not bother joining if one or fewer packets are in the queue if (packets.length <= 1) return packets[0]; // Determine total sample length of the entire queue var totalLength = 0; packets.forEach(function addPacketLengths(pac...
javascript
function joinAudioPackets(packets) { // Do not bother joining if one or fewer packets are in the queue if (packets.length <= 1) return packets[0]; // Determine total sample length of the entire queue var totalLength = 0; packets.forEach(function addPacketLengths(pac...
[ "function", "joinAudioPackets", "(", "packets", ")", "{", "// Do not bother joining if one or fewer packets are in the queue", "if", "(", "packets", ".", "length", "<=", "1", ")", "return", "packets", "[", "0", "]", ";", "// Determine total sample length of the entire queue...
Given an array of audio packets, returns a single audio packet containing the concatenation of those packets. @private @param {SampleArray[]} packets The array of audio packets to concatenate. @returns {SampleArray} A single audio packet containing the concatenation of all given audio packets. If no packets are provi...
[ "Given", "an", "array", "of", "audio", "packets", "returns", "a", "single", "audio", "packet", "containing", "the", "concatenation", "of", "those", "packets", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/AudioPlayer.js#L228-L250
train
ILLGrenoble/guacamole-common-js
src/AudioPlayer.js
splitAudioPacket
function splitAudioPacket(data) { var minValue = Number.MAX_VALUE; var optimalSplitLength = data.length; // Calculate number of whole samples in the provided audio packet AND // in the minimum possible split packet var samples = Math.floor(data.length / format.channels); ...
javascript
function splitAudioPacket(data) { var minValue = Number.MAX_VALUE; var optimalSplitLength = data.length; // Calculate number of whole samples in the provided audio packet AND // in the minimum possible split packet var samples = Math.floor(data.length / format.channels); ...
[ "function", "splitAudioPacket", "(", "data", ")", "{", "var", "minValue", "=", "Number", ".", "MAX_VALUE", ";", "var", "optimalSplitLength", "=", "data", ".", "length", ";", "// Calculate number of whole samples in the provided audio packet AND", "// in the minimum possible...
Given a single packet of audio data, splits off an arbitrary length of audio data from the beginning of that packet, returning the split result as an array of two packets. The split location is determined through an algorithm intended to minimize the liklihood of audible clicking between packets. If no such split locat...
[ "Given", "a", "single", "packet", "of", "audio", "data", "splits", "off", "an", "arbitrary", "length", "of", "audio", "data", "from", "the", "beginning", "of", "that", "packet", "returning", "the", "split", "result", "as", "an", "array", "of", "two", "pack...
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/AudioPlayer.js#L270-L318
train
ILLGrenoble/guacamole-common-js
src/AudioPlayer.js
toAudioBuffer
function toAudioBuffer(data) { // Calculate total number of samples var samples = data.length / format.channels; // Determine exactly when packet CAN play var packetTime = context.currentTime; if (nextPacketTime < packetTime) nextPacketTime = packetTime; //...
javascript
function toAudioBuffer(data) { // Calculate total number of samples var samples = data.length / format.channels; // Determine exactly when packet CAN play var packetTime = context.currentTime; if (nextPacketTime < packetTime) nextPacketTime = packetTime; //...
[ "function", "toAudioBuffer", "(", "data", ")", "{", "// Calculate total number of samples", "var", "samples", "=", "data", ".", "length", "/", "format", ".", "channels", ";", "// Determine exactly when packet CAN play", "var", "packetTime", "=", "context", ".", "curre...
Converts the given audio packet into an AudioBuffer, ready for playback by the Web Audio API. Unlike the raw audio packets received by this audio player, AudioBuffers require floating point samples and are split into isolated planes of channel-specific data. @private @param {SampleArray} data The raw audio packet that...
[ "Converts", "the", "given", "audio", "packet", "into", "an", "AudioBuffer", "ready", "for", "playback", "by", "the", "Web", "Audio", "API", ".", "Unlike", "the", "raw", "audio", "packets", "received", "by", "this", "audio", "player", "AudioBuffers", "require",...
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/AudioPlayer.js#L378-L407
train
kibertoad/objection-swagger
lib/enrichers/schema.relationships.enricher.js
enrichSchemaWithRelationships
function enrichSchemaWithRelationships( schema, relationships, isIncludeParentRelationships, fromModelClass ) { const processedSchema = _.cloneDeep(schema); _.forOwn(relationships, (value, key) => { let relationshipValue; if (value.relation.name === constants.HasOneRelation) { //protect from ...
javascript
function enrichSchemaWithRelationships( schema, relationships, isIncludeParentRelationships, fromModelClass ) { const processedSchema = _.cloneDeep(schema); _.forOwn(relationships, (value, key) => { let relationshipValue; if (value.relation.name === constants.HasOneRelation) { //protect from ...
[ "function", "enrichSchemaWithRelationships", "(", "schema", ",", "relationships", ",", "isIncludeParentRelationships", ",", "fromModelClass", ")", "{", "const", "processedSchema", "=", "_", ".", "cloneDeep", "(", "schema", ")", ";", "_", ".", "forOwn", "(", "relat...
Creates copy of provided schema and enriches it with attributes that are derived from relationships @param {Object} schema - JSON Schema @param {Object} relationships - Objection.js relationMappings @param {boolean} isIncludeParentRelationships - whether ManyToManyRelation and BelongsToOneRelation relationships should ...
[ "Creates", "copy", "of", "provided", "schema", "and", "enriches", "it", "with", "attributes", "that", "are", "derived", "from", "relationships" ]
2109b58ce323e78252729a46bcc94e617035b541
https://github.com/kibertoad/objection-swagger/blob/2109b58ce323e78252729a46bcc94e617035b541/lib/enrichers/schema.relationships.enricher.js#L12-L93
train
aMarCruz/jspreproc
spec/uglify/core.js
mktag
function mktag(name, html, css, attrs, js, pcex) { var c = ', ', s = '}' + (pcex.length ? ', ' + q(pcex._bp[8]) : '') + ');' // give more consistency to the output if (js && js.slice(-1) !== '\n') s = '\n' + s return 'riot.tag2(\'' + name + "'" + c + q(html) + c + q(css) + c + q(attrs) + ', f...
javascript
function mktag(name, html, css, attrs, js, pcex) { var c = ', ', s = '}' + (pcex.length ? ', ' + q(pcex._bp[8]) : '') + ');' // give more consistency to the output if (js && js.slice(-1) !== '\n') s = '\n' + s return 'riot.tag2(\'' + name + "'" + c + q(html) + c + q(css) + c + q(attrs) + ', f...
[ "function", "mktag", "(", "name", ",", "html", ",", "css", ",", "attrs", ",", "js", ",", "pcex", ")", "{", "var", "c", "=", "', '", ",", "s", "=", "'}'", "+", "(", "pcex", ".", "length", "?", "', '", "+", "q", "(", "pcex", ".", "_bp", "[", ...
Generates the `riot.tag2` call with the processed parts.
[ "Generates", "the", "riot", ".", "tag2", "call", "with", "the", "processed", "parts", "." ]
5f31820d702a329e8aa25f0f3983f13097610250
https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/core.js#L57-L67
train
aMarCruz/jspreproc
spec/uglify/core.js
parseAttrs
function parseAttrs(str, pcex) { var list = [], match, k, v, t, e, DQ = '"' HTML_ATTR.lastIndex = 0 str = str.replace(/\s+/g, ' ') while (match = HTML_ATTR.exec(str)) { // all attribute names are converted to lower case k = match[1].toLowerCase() v = match[2] if (!v) { ...
javascript
function parseAttrs(str, pcex) { var list = [], match, k, v, t, e, DQ = '"' HTML_ATTR.lastIndex = 0 str = str.replace(/\s+/g, ' ') while (match = HTML_ATTR.exec(str)) { // all attribute names are converted to lower case k = match[1].toLowerCase() v = match[2] if (!v) { ...
[ "function", "parseAttrs", "(", "str", ",", "pcex", ")", "{", "var", "list", "=", "[", "]", ",", "match", ",", "k", ",", "v", ",", "t", ",", "e", ",", "DQ", "=", "'\"'", "HTML_ATTR", ".", "lastIndex", "=", "0", "str", "=", "str", ".", "replace",...
Parses and format attributes. @param {string} str - Attributes, with expressions replaced by their hash @param {Array} pcex - Has a _bp property with info about brackets @returns {string} Formated attributes
[ "Parses", "and", "format", "attributes", "." ]
5f31820d702a329e8aa25f0f3983f13097610250
https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/core.js#L96-L142
train
aMarCruz/jspreproc
spec/uglify/core.js
splitHtml
function splitHtml(html, opts, pcex) { var _bp = pcex._bp // `brackets.split` is a heavy function, so don't call it if not necessary if (html && _bp[4].test(html)) { var jsfn = opts.expr && (opts.parser || opts.type) ? _compileJS : 0, list = brackets.split(html, 0, _bp), expr for (var ...
javascript
function splitHtml(html, opts, pcex) { var _bp = pcex._bp // `brackets.split` is a heavy function, so don't call it if not necessary if (html && _bp[4].test(html)) { var jsfn = opts.expr && (opts.parser || opts.type) ? _compileJS : 0, list = brackets.split(html, 0, _bp), expr for (var ...
[ "function", "splitHtml", "(", "html", ",", "opts", ",", "pcex", ")", "{", "var", "_bp", "=", "pcex", ".", "_bp", "// `brackets.split` is a heavy function, so don't call it if not necessary", "if", "(", "html", "&&", "_bp", "[", "4", "]", ".", "test", "(", "htm...
Replaces expressions in the HTML with a marker, and runs expressions through the parser, except those beginning with `{^`.
[ "Replaces", "expressions", "in", "the", "HTML", "with", "a", "marker", "and", "runs", "expressions", "through", "the", "parser", "except", "those", "beginning", "with", "{", "^", "." ]
5f31820d702a329e8aa25f0f3983f13097610250
https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/core.js#L146-L171
train
aMarCruz/jspreproc
spec/uglify/core.js
restoreExpr
function restoreExpr(html, pcex) { if (pcex.length) { html = html .replace(/\u0001(\d+)/g, function (_, d) { var expr = pcex[d] if (expr[0] === '=') { expr = expr.replace(brackets.R_STRINGS, function (qs) { return qs //.replace(/&/g, '&amp;') // I don't know if this mak...
javascript
function restoreExpr(html, pcex) { if (pcex.length) { html = html .replace(/\u0001(\d+)/g, function (_, d) { var expr = pcex[d] if (expr[0] === '=') { expr = expr.replace(brackets.R_STRINGS, function (qs) { return qs //.replace(/&/g, '&amp;') // I don't know if this mak...
[ "function", "restoreExpr", "(", "html", ",", "pcex", ")", "{", "if", "(", "pcex", ".", "length", ")", "{", "html", "=", "html", ".", "replace", "(", "/", "\\u0001(\\d+)", "/", "g", ",", "function", "(", "_", ",", "d", ")", "{", "var", "expr", "="...
Restores expressions hidden by splitHtml and escape literal internal brackets
[ "Restores", "expressions", "hidden", "by", "splitHtml", "and", "escape", "literal", "internal", "brackets" ]
5f31820d702a329e8aa25f0f3983f13097610250
https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/core.js#L174-L190
train
aMarCruz/jspreproc
spec/uglify/core.js
compileHTML
function compileHTML(html, opts, pcex) { if (Array.isArray(opts)) { pcex = opts opts = {} } else { if (!pcex) pcex = [] if (!opts) opts = {} } html = html.replace(/\r\n?/g, '\n').replace(HTML_COMMENT, function (s) { return s[0] === '<' ? '' : s }).replace(TRIM_TRAIL, '') // `_bp` is un...
javascript
function compileHTML(html, opts, pcex) { if (Array.isArray(opts)) { pcex = opts opts = {} } else { if (!pcex) pcex = [] if (!opts) opts = {} } html = html.replace(/\r\n?/g, '\n').replace(HTML_COMMENT, function (s) { return s[0] === '<' ? '' : s }).replace(TRIM_TRAIL, '') // `_bp` is un...
[ "function", "compileHTML", "(", "html", ",", "opts", ",", "pcex", ")", "{", "if", "(", "Array", ".", "isArray", "(", "opts", ")", ")", "{", "pcex", "=", "opts", "opts", "=", "{", "}", "}", "else", "{", "if", "(", "!", "pcex", ")", "pcex", "=", ...
Parses and formats the HTML text. @param {string} html - Can contain embedded HTML comments and literal whitespace @param {Object} opts - Collected user options. Includes the brackets array in `_bp` @param {Array} [pcex] - Keeps precompiled expressions @returns {string} The parsed HTML text @see http://www....
[ "Parses", "and", "formats", "the", "HTML", "text", "." ]
5f31820d702a329e8aa25f0f3983f13097610250
https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/core.js#L248-L265
train
aMarCruz/jspreproc
spec/uglify/core.js
riotjs
function riotjs(js) { var match, toes5, parts = [], // parsed code pos // remove comments js = js.replace(JS_RMCOMMS, function (m, q) { return q ? m : ' ' }) // $1: indentation, // $2: method name, // $3: parameters while (match = js.match(JS_ES6SIGN)) { // save remaining part now...
javascript
function riotjs(js) { var match, toes5, parts = [], // parsed code pos // remove comments js = js.replace(JS_RMCOMMS, function (m, q) { return q ? m : ' ' }) // $1: indentation, // $2: method name, // $3: parameters while (match = js.match(JS_ES6SIGN)) { // save remaining part now...
[ "function", "riotjs", "(", "js", ")", "{", "var", "match", ",", "toes5", ",", "parts", "=", "[", "]", ",", "// parsed code", "pos", "// remove comments", "js", "=", "js", ".", "replace", "(", "JS_RMCOMMS", ",", "function", "(", "m", ",", "q", ")", "{...
Default parser for JavaScript code
[ "Default", "parser", "for", "JavaScript", "code" ]
5f31820d702a329e8aa25f0f3983f13097610250
https://github.com/aMarCruz/jspreproc/blob/5f31820d702a329e8aa25f0f3983f13097610250/spec/uglify/core.js#L278-L323
train
ascartabelli/lamb
src/privates/_groupWith.js
_groupWith
function _groupWith (makeValue) { return function (arrayLike, iteratee) { var result = {}; var len = arrayLike.length; for (var i = 0, element, key; i < len; i++) { element = arrayLike[i]; key = iteratee(element, i, arrayLike); result[key] = makeValue(res...
javascript
function _groupWith (makeValue) { return function (arrayLike, iteratee) { var result = {}; var len = arrayLike.length; for (var i = 0, element, key; i < len; i++) { element = arrayLike[i]; key = iteratee(element, i, arrayLike); result[key] = makeValue(res...
[ "function", "_groupWith", "(", "makeValue", ")", "{", "return", "function", "(", "arrayLike", ",", "iteratee", ")", "{", "var", "result", "=", "{", "}", ";", "var", "len", "=", "arrayLike", ".", "length", ";", "for", "(", "var", "i", "=", "0", ",", ...
Builds a "grouping function" for an array-like object. @private @param {Function} makeValue @returns {Function}
[ "Builds", "a", "grouping", "function", "for", "an", "array", "-", "like", "object", "." ]
d36e45945c4789e4f1a2d8805936514b53f32362
https://github.com/ascartabelli/lamb/blob/d36e45945c4789e4f1a2d8805936514b53f32362/src/privates/_groupWith.js#L7-L20
train
ascartabelli/lamb
src/privates/_curry3.js
_curry3
function _curry3 (fn, isRightCurry) { return function (a) { return function (b) { return function (c) { return isRightCurry ? fn.call(this, c, b, a) : fn.call(this, a, b, c); }; }; }; }
javascript
function _curry3 (fn, isRightCurry) { return function (a) { return function (b) { return function (c) { return isRightCurry ? fn.call(this, c, b, a) : fn.call(this, a, b, c); }; }; }; }
[ "function", "_curry3", "(", "fn", ",", "isRightCurry", ")", "{", "return", "function", "(", "a", ")", "{", "return", "function", "(", "b", ")", "{", "return", "function", "(", "c", ")", "{", "return", "isRightCurry", "?", "fn", ".", "call", "(", "thi...
Curries a function of arity 3. @private @param {Function} fn @param {Boolean} [isRightCurry=false] @returns {Function}
[ "Curries", "a", "function", "of", "arity", "3", "." ]
d36e45945c4789e4f1a2d8805936514b53f32362
https://github.com/ascartabelli/lamb/blob/d36e45945c4789e4f1a2d8805936514b53f32362/src/privates/_curry3.js#L8-L16
train
ILLGrenoble/guacamole-common-js
src/AudioContextFactory.js
getAudioContext
function getAudioContext() { // Fallback to Webkit-specific AudioContext implementation var AudioContext = window.AudioContext || window.webkitAudioContext; // Get new AudioContext instance if Web Audio API is supported if (AudioContext) { try { // Create n...
javascript
function getAudioContext() { // Fallback to Webkit-specific AudioContext implementation var AudioContext = window.AudioContext || window.webkitAudioContext; // Get new AudioContext instance if Web Audio API is supported if (AudioContext) { try { // Create n...
[ "function", "getAudioContext", "(", ")", "{", "// Fallback to Webkit-specific AudioContext implementation", "var", "AudioContext", "=", "window", ".", "AudioContext", "||", "window", ".", "webkitAudioContext", ";", "// Get new AudioContext instance if Web Audio API is supported", ...
Returns a singleton instance of a Web Audio API AudioContext object. @return {AudioContext} A singleton instance of a Web Audio API AudioContext object, or null if the Web Audio API is not supported.
[ "Returns", "a", "singleton", "instance", "of", "a", "Web", "Audio", "API", "AudioContext", "object", "." ]
71925794155ea3fc37d2a125adbca6f8be532887
https://github.com/ILLGrenoble/guacamole-common-js/blob/71925794155ea3fc37d2a125adbca6f8be532887/src/AudioContextFactory.js#L52-L77
train
jorisvervuurt/JVSDisplayOTron
lib/dot3k/dot3k.js
DOT3k
function DOT3k() { if (!(this instanceof DOT3k)) { return new DOT3k(); } this.displayOTron = new DisplayOTron('3k'); this.lcd = new LCD(this.displayOTron); this.backlight = new Backlight(this.displayOTron); this.barGraph = new BarGraph(this.displayOTron); this.joystick = new Joy...
javascript
function DOT3k() { if (!(this instanceof DOT3k)) { return new DOT3k(); } this.displayOTron = new DisplayOTron('3k'); this.lcd = new LCD(this.displayOTron); this.backlight = new Backlight(this.displayOTron); this.barGraph = new BarGraph(this.displayOTron); this.joystick = new Joy...
[ "function", "DOT3k", "(", ")", "{", "if", "(", "!", "(", "this", "instanceof", "DOT3k", ")", ")", "{", "return", "new", "DOT3k", "(", ")", ";", "}", "this", ".", "displayOTron", "=", "new", "DisplayOTron", "(", "'3k'", ")", ";", "this", ".", "lcd",...
Creates a new `DOT3k` object. @constructor
[ "Creates", "a", "new", "DOT3k", "object", "." ]
c8f9bfdbf4e2658bb12fc83bbf49853c938e7dcc
https://github.com/jorisvervuurt/JVSDisplayOTron/blob/c8f9bfdbf4e2658bb12fc83bbf49853c938e7dcc/lib/dot3k/dot3k.js#L44-L54
train
ascartabelli/lamb
src/privates/_isEnumerable.js
_isEnumerable
function _isEnumerable (obj, key) { return key in Object(obj) && (_isOwnEnumerable(obj, key) || ~_safeEnumerables(obj).indexOf(key)); }
javascript
function _isEnumerable (obj, key) { return key in Object(obj) && (_isOwnEnumerable(obj, key) || ~_safeEnumerables(obj).indexOf(key)); }
[ "function", "_isEnumerable", "(", "obj", ",", "key", ")", "{", "return", "key", "in", "Object", "(", "obj", ")", "&&", "(", "_isOwnEnumerable", "(", "obj", ",", "key", ")", "||", "~", "_safeEnumerables", "(", "obj", ")", ".", "indexOf", "(", "key", "...
Checks whether the specified key is an enumerable property of the given object or not. @private @param {Object} obj @param {String} key @returns {Boolean}
[ "Checks", "whether", "the", "specified", "key", "is", "an", "enumerable", "property", "of", "the", "given", "object", "or", "not", "." ]
d36e45945c4789e4f1a2d8805936514b53f32362
https://github.com/ascartabelli/lamb/blob/d36e45945c4789e4f1a2d8805936514b53f32362/src/privates/_isEnumerable.js#L11-L13
train
ascartabelli/lamb
src/privates/_compareWith.js
_compareWith
function _compareWith (criteria) { return function (a, b) { var len = criteria.length; var criterion = criteria[0]; var result = criterion.compare(a.value, b.value); for (var i = 1; result === 0 && i < len; i++) { criterion = criteria[i]; result = criterion.c...
javascript
function _compareWith (criteria) { return function (a, b) { var len = criteria.length; var criterion = criteria[0]; var result = criterion.compare(a.value, b.value); for (var i = 1; result === 0 && i < len; i++) { criterion = criteria[i]; result = criterion.c...
[ "function", "_compareWith", "(", "criteria", ")", "{", "return", "function", "(", "a", ",", "b", ")", "{", "var", "len", "=", "criteria", ".", "length", ";", "var", "criterion", "=", "criteria", "[", "0", "]", ";", "var", "result", "=", "criterion", ...
Accepts a list of sorting criteria with at least one element and builds a function that compares two values with such criteria. @private @param {Sorter[]} criteria @returns {Function}
[ "Accepts", "a", "list", "of", "sorting", "criteria", "with", "at", "least", "one", "element", "and", "builds", "a", "function", "that", "compares", "two", "values", "with", "such", "criteria", "." ]
d36e45945c4789e4f1a2d8805936514b53f32362
https://github.com/ascartabelli/lamb/blob/d36e45945c4789e4f1a2d8805936514b53f32362/src/privates/_compareWith.js#L8-L25
train
ascartabelli/lamb
src/privates/_currier.js
_currier
function _currier (fn, arity, isRightCurry, isAutoCurry, argsHolder) { return function () { var holderLen = argsHolder.length; var argsLen = arguments.length; var newArgsLen = holderLen + (argsLen > 1 && isAutoCurry ? argsLen : 1); var newArgs = Array(newArgsLen); for (var i...
javascript
function _currier (fn, arity, isRightCurry, isAutoCurry, argsHolder) { return function () { var holderLen = argsHolder.length; var argsLen = arguments.length; var newArgsLen = holderLen + (argsLen > 1 && isAutoCurry ? argsLen : 1); var newArgs = Array(newArgsLen); for (var i...
[ "function", "_currier", "(", "fn", ",", "arity", ",", "isRightCurry", ",", "isAutoCurry", ",", "argsHolder", ")", "{", "return", "function", "(", ")", "{", "var", "holderLen", "=", "argsHolder", ".", "length", ";", "var", "argsLen", "=", "arguments", ".", ...
Used by curry functions to collect arguments until the arity is consumed, then applies the original function. @private @param {Function} fn @param {Number} arity @param {Boolean} isRightCurry @param {Boolean} isAutoCurry @param {Array} argsHolder @returns {Function}
[ "Used", "by", "curry", "functions", "to", "collect", "arguments", "until", "the", "arity", "is", "consumed", "then", "applies", "the", "original", "function", "." ]
d36e45945c4789e4f1a2d8805936514b53f32362
https://github.com/ascartabelli/lamb/blob/d36e45945c4789e4f1a2d8805936514b53f32362/src/privates/_currier.js#L12-L33
train
mrsteele/ng-alerts
dist/ng-alerts.js
reset
function reset() { $scope.count = ngAlertsMngr.get().length; $scope.badge = ($attrs.badge); if ($scope.count === 0 && $attrs.hideEmpty) { $scope.count = ''; } }
javascript
function reset() { $scope.count = ngAlertsMngr.get().length; $scope.badge = ($attrs.badge); if ($scope.count === 0 && $attrs.hideEmpty) { $scope.count = ''; } }
[ "function", "reset", "(", ")", "{", "$scope", ".", "count", "=", "ngAlertsMngr", ".", "get", "(", ")", ".", "length", ";", "$scope", ".", "badge", "=", "(", "$attrs", ".", "badge", ")", ";", "if", "(", "$scope", ".", "count", "===", "0", "&&", "$...
Resets the alert count view.
[ "Resets", "the", "alert", "count", "view", "." ]
8f4a811a62d331d6286ce01aaf88479f3cdf181c
https://github.com/mrsteele/ng-alerts/blob/8f4a811a62d331d6286ce01aaf88479f3cdf181c/dist/ng-alerts.js#L55-L62
train
mrsteele/ng-alerts
dist/ng-alerts.js
remove
function remove(id) { var i; for (i = 0; i < $scope.alerts.length; i += 1) { if ($scope.alerts[i].id === id) { $scope.alerts.splice(i, 1); return; } } ...
javascript
function remove(id) { var i; for (i = 0; i < $scope.alerts.length; i += 1) { if ($scope.alerts[i].id === id) { $scope.alerts.splice(i, 1); return; } } ...
[ "function", "remove", "(", "id", ")", "{", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "$scope", ".", "alerts", ".", "length", ";", "i", "+=", "1", ")", "{", "if", "(", "$scope", ".", "alerts", "[", "i", "]", ".", "id", "==="...
Removes a specific alert by id.
[ "Removes", "a", "specific", "alert", "by", "id", "." ]
8f4a811a62d331d6286ce01aaf88479f3cdf181c
https://github.com/mrsteele/ng-alerts/blob/8f4a811a62d331d6286ce01aaf88479f3cdf181c/dist/ng-alerts.js#L225-L233
train
mrsteele/ng-alerts
dist/ng-alerts.js
function (args) { var params = angular.extend({ id: ngAlertsId.create(), msg: '', type: 'default', time: Date.now() }, args); this.id = params.id; this.msg = params.msg; this.type = params.type; ...
javascript
function (args) { var params = angular.extend({ id: ngAlertsId.create(), msg: '', type: 'default', time: Date.now() }, args); this.id = params.id; this.msg = params.msg; this.type = params.type; ...
[ "function", "(", "args", ")", "{", "var", "params", "=", "angular", ".", "extend", "(", "{", "id", ":", "ngAlertsId", ".", "create", "(", ")", ",", "msg", ":", "''", ",", "type", ":", "'default'", ",", "time", ":", "Date", ".", "now", "(", ")", ...
The alert object. @param {Object} args - The argument object. @param {Number} args.id - The unique id. @param {String} args.msg - The message. @param {String} [args.type=default] - The type of alert. @param {Number} [args.time=Date.now()] - The time of the notification (Miliseconds since Jan 1 1970).
[ "The", "alert", "object", "." ]
8f4a811a62d331d6286ce01aaf88479f3cdf181c
https://github.com/mrsteele/ng-alerts/blob/8f4a811a62d331d6286ce01aaf88479f3cdf181c/dist/ng-alerts.js#L281-L293
train
mrsteele/ng-alerts
dist/ng-alerts.js
fire
function fire(name, args) { ngAlertsEvent.fire(name, args); ngAlertsEvent.fire('change', args); }
javascript
function fire(name, args) { ngAlertsEvent.fire(name, args); ngAlertsEvent.fire('change', args); }
[ "function", "fire", "(", "name", ",", "args", ")", "{", "ngAlertsEvent", ".", "fire", "(", "name", ",", "args", ")", ";", "ngAlertsEvent", ".", "fire", "(", "'change'", ",", "args", ")", ";", "}" ]
Fires an alert event. @param {String} name - The name of the event. @param {Object=} args - Any optional arguments.
[ "Fires", "an", "alert", "event", "." ]
8f4a811a62d331d6286ce01aaf88479f3cdf181c
https://github.com/mrsteele/ng-alerts/blob/8f4a811a62d331d6286ce01aaf88479f3cdf181c/dist/ng-alerts.js#L355-L358
train