id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
30,300
Rekord/rekord
build/rekord.js
function(delaySort) { var removed = AP.pop.apply( this ); var i = this.length; this.trigger( Collection.Events.Remove, [this, removed, i] ); if ( !delaySort ) { this.sort( undefined, undefined, true ); } return removed; }
javascript
function(delaySort) { var removed = AP.pop.apply( this ); var i = this.length; this.trigger( Collection.Events.Remove, [this, removed, i] ); if ( !delaySort ) { this.sort( undefined, undefined, true ); } return removed; }
[ "function", "(", "delaySort", ")", "{", "var", "removed", "=", "AP", ".", "pop", ".", "apply", "(", "this", ")", ";", "var", "i", "=", "this", ".", "length", ";", "this", ".", "trigger", "(", "Collection", ".", "Events", ".", "Remove", ",", "[", ...
Removes the last element in this collection and returns it - sorting the collection if a comparator is set on this collection and `delaySort` is no specified or a true value. ```javascript var c = Rekord.collect(1, 2, 3, 4); c.pop(); // 4 ``` @method @memberof Rekord.Collection# @param {Boolean} [delaySort=false] - W...
[ "Removes", "the", "last", "element", "in", "this", "collection", "and", "returns", "it", "-", "sorting", "the", "collection", "if", "a", "comparator", "is", "set", "on", "this", "collection", "and", "delaySort", "is", "no", "specified", "or", "a", "true", ...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8149-L8162
30,301
Rekord/rekord
build/rekord.js
function(delaySort) { var removed = AP.shift.apply( this ); this.trigger( Collection.Events.Remove, [this, removed, 0] ); if ( !delaySort ) { this.sort( undefined, undefined, true ); } return removed; }
javascript
function(delaySort) { var removed = AP.shift.apply( this ); this.trigger( Collection.Events.Remove, [this, removed, 0] ); if ( !delaySort ) { this.sort( undefined, undefined, true ); } return removed; }
[ "function", "(", "delaySort", ")", "{", "var", "removed", "=", "AP", ".", "shift", ".", "apply", "(", "this", ")", ";", "this", ".", "trigger", "(", "Collection", ".", "Events", ".", "Remove", ",", "[", "this", ",", "removed", ",", "0", "]", ")", ...
Removes the first element in this collection and returns it - sorting the collection if a comparator is set on this collection and `delaySort` is no specified or a true value. ```javascript var c = Rekord.collect(1, 2, 3, 4); c.shift(); // 1 ``` @method @memberof Rekord.Collection# @param {Boolean} [delaySort=false] ...
[ "Removes", "the", "first", "element", "in", "this", "collection", "and", "returns", "it", "-", "sorting", "the", "collection", "if", "a", "comparator", "is", "set", "on", "this", "collection", "and", "delaySort", "is", "no", "specified", "or", "a", "true", ...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8184-L8196
30,302
Rekord/rekord
build/rekord.js
function(i, delaySort) { var removing; if (i >= 0 && i < this.length) { removing = this[ i ]; AP.splice.call( this, i, 1 ); this.trigger( Collection.Events.Remove, [this, removing, i] ); if ( !delaySort ) { this.sort( undefined, undefined, true ); } } ...
javascript
function(i, delaySort) { var removing; if (i >= 0 && i < this.length) { removing = this[ i ]; AP.splice.call( this, i, 1 ); this.trigger( Collection.Events.Remove, [this, removing, i] ); if ( !delaySort ) { this.sort( undefined, undefined, true ); } } ...
[ "function", "(", "i", ",", "delaySort", ")", "{", "var", "removing", ";", "if", "(", "i", ">=", "0", "&&", "i", "<", "this", ".", "length", ")", "{", "removing", "=", "this", "[", "i", "]", ";", "AP", ".", "splice", ".", "call", "(", "this", ...
Removes the element in this collection at the given index `i` - sorting the collection if a comparator is set on this collection and `delaySort` is not specified or a true value. ```javascript var c = Rekord.collect(1, 2, 3, 4); c.removeAt( 1 ); // 2 c.removeAt( 5 ); // undefined c // [1, 3, 4] ``` @method @memberof ...
[ "Removes", "the", "element", "in", "this", "collection", "at", "the", "given", "index", "i", "-", "sorting", "the", "collection", "if", "a", "comparator", "is", "set", "on", "this", "collection", "and", "delaySort", "is", "not", "specified", "or", "a", "tr...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8222-L8240
30,303
Rekord/rekord
build/rekord.js
function(value, delaySort, equals) { var i = this.indexOf( value, equals ); var element = this[ i ]; if ( i !== -1 ) { this.removeAt( i, delaySort ); } return element; }
javascript
function(value, delaySort, equals) { var i = this.indexOf( value, equals ); var element = this[ i ]; if ( i !== -1 ) { this.removeAt( i, delaySort ); } return element; }
[ "function", "(", "value", ",", "delaySort", ",", "equals", ")", "{", "var", "i", "=", "this", ".", "indexOf", "(", "value", ",", "equals", ")", ";", "var", "element", "=", "this", "[", "i", "]", ";", "if", "(", "i", "!==", "-", "1", ")", "{", ...
Removes the given value from this collection if it exists - sorting the collection if a comparator is set on this collection and `delaySort` is not specified or a true value. ```javascript var c = Rekord.collect(1, 2, 3, 4); c.remove( 1 ); // 1 c.remove( 5 ); // undefined c // [2, 3, 4] ``` @method @memberof Rekord.C...
[ "Removes", "the", "given", "value", "from", "this", "collection", "if", "it", "exists", "-", "sorting", "the", "collection", "if", "a", "comparator", "is", "set", "on", "this", "collection", "and", "delaySort", "is", "not", "specified", "or", "a", "true", ...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8269-L8280
30,304
Rekord/rekord
build/rekord.js
function(values, delaySort, equals) { var removed = []; var removedIndices = []; if ( isArray( values ) && values.length ) { for (var i = 0; i < values.length; i++) { var value = values[ i ]; var k = this.indexOf( value, equals ); if ( k !== -1 ) { ...
javascript
function(values, delaySort, equals) { var removed = []; var removedIndices = []; if ( isArray( values ) && values.length ) { for (var i = 0; i < values.length; i++) { var value = values[ i ]; var k = this.indexOf( value, equals ); if ( k !== -1 ) { ...
[ "function", "(", "values", ",", "delaySort", ",", "equals", ")", "{", "var", "removed", "=", "[", "]", ";", "var", "removedIndices", "=", "[", "]", ";", "if", "(", "isArray", "(", "values", ")", "&&", "values", ".", "length", ")", "{", "for", "(", ...
Removes the given values from this collection - sorting the collection if a comparator is set on this collection and `delaySort` is not specified or a true value. ```javascript var c = Rekord.collect(1, 2, 3, 4); c.removeAll( [1, 5] ); // [1] c // [2, 3, 4] ``` @method @memberof Rekord.Collection# @param {Any[]} valu...
[ "Removes", "the", "given", "values", "from", "this", "collection", "-", "sorting", "the", "collection", "if", "a", "comparator", "is", "set", "on", "this", "collection", "and", "delaySort", "is", "not", "specified", "or", "a", "true", "value", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8308-L8343
30,305
Rekord/rekord
build/rekord.js
function() { if ( AP.reverse ) { AP.reverse.apply( this ); } else { reverse( this ); } this.trigger( Collection.Events.Updates, [this] ); return this; }
javascript
function() { if ( AP.reverse ) { AP.reverse.apply( this ); } else { reverse( this ); } this.trigger( Collection.Events.Updates, [this] ); return this; }
[ "function", "(", ")", "{", "if", "(", "AP", ".", "reverse", ")", "{", "AP", ".", "reverse", ".", "apply", "(", "this", ")", ";", "}", "else", "{", "reverse", "(", "this", ")", ";", "}", "this", ".", "trigger", "(", "Collection", ".", "Events", ...
Reverses the order of elements in this collection. ```javascript var c = Rekord.collect(1, 2, 3, 4); c.reverse(); // [4, 3, 2, 1] ``` @method @memberof Rekord.Collection# @return {Rekord.Collection} - The reference to this collection. @emits Rekord.Collection#updates
[ "Reverses", "the", "order", "of", "elements", "in", "this", "collection", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8468-L8482
30,306
Rekord/rekord
build/rekord.js
function(value, equals) { var equality = equals || equalsStrict; for (var i = 0; i < this.length; i++) { if ( equality( value, this[ i ] ) ) { return i; } } return -1; }
javascript
function(value, equals) { var equality = equals || equalsStrict; for (var i = 0; i < this.length; i++) { if ( equality( value, this[ i ] ) ) { return i; } } return -1; }
[ "function", "(", "value", ",", "equals", ")", "{", "var", "equality", "=", "equals", "||", "equalsStrict", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "length", ";", "i", "++", ")", "{", "if", "(", "equality", "(", "value",...
Returns the index of the given element in this collection or returns -1 if the element doesn't exist in this collection. ```javascript var c = Rekord.collect(1, 2, 3, 4); c.indexOf( 1 ); // 0 c.indexOf( 2 ); // 1 c.indexOf( 5 ); // -1 ``` @method @memberof Rekord.Collection# @param {Any} value - The value to search f...
[ "Returns", "the", "index", "of", "the", "given", "element", "in", "this", "collection", "or", "returns", "-", "1", "if", "the", "element", "doesn", "t", "exist", "in", "this", "collection", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8507-L8520
30,307
Rekord/rekord
build/rekord.js
function(comparator, startingValue) { var cmp = createComparator( comparator || this.comparator, false ); var min = startingValue; for (var i = 0; i < this.length; i++) { if ( cmp( min, this[i] ) > 0 ) { min = this[i]; } } return min; }
javascript
function(comparator, startingValue) { var cmp = createComparator( comparator || this.comparator, false ); var min = startingValue; for (var i = 0; i < this.length; i++) { if ( cmp( min, this[i] ) > 0 ) { min = this[i]; } } return min; }
[ "function", "(", "comparator", ",", "startingValue", ")", "{", "var", "cmp", "=", "createComparator", "(", "comparator", "||", "this", ".", "comparator", ",", "false", ")", ";", "var", "min", "=", "startingValue", ";", "for", "(", "var", "i", "=", "0", ...
Returns the element with the minimum value given a comparator. ```javascript var c = Rekord.collect({age: 4}, {age: 5}, {age: 6}, {age: 3}); c.minModel('age'); // {age: 3} c.minModel('-age'); // {age: 6} ``` @method @memberof Rekord.Collection# @param {comparatorInput} comparator - The comparator which calculates the...
[ "Returns", "the", "element", "with", "the", "minimum", "value", "given", "a", "comparator", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8543-L8557
30,308
Rekord/rekord
build/rekord.js
function(comparator, startingValue) { var cmp = createComparator( comparator || this.comparator, true ); var max = startingValue; for (var i = 0; i < this.length; i++) { if ( cmp( max, this[i] ) < 0 ) { max = this[i]; } } return max; }
javascript
function(comparator, startingValue) { var cmp = createComparator( comparator || this.comparator, true ); var max = startingValue; for (var i = 0; i < this.length; i++) { if ( cmp( max, this[i] ) < 0 ) { max = this[i]; } } return max; }
[ "function", "(", "comparator", ",", "startingValue", ")", "{", "var", "cmp", "=", "createComparator", "(", "comparator", "||", "this", ".", "comparator", ",", "true", ")", ";", "var", "max", "=", "startingValue", ";", "for", "(", "var", "i", "=", "0", ...
Returns the element with the maximum value given a comparator. ```javascript var c = Rekord.collect({age: 4}, {age: 5}, {age: 6}, {age: 3}); c.maxModel('age'); // {age: 6} c.maxModel('-age'); // {age: 3} ``` @method @memberof Rekord.Collection# @param {comparatorInput} comparator - The comparator which calculates the...
[ "Returns", "the", "element", "with", "the", "maximum", "value", "given", "a", "comparator", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8580-L8594
30,309
Rekord/rekord
build/rekord.js
function(properties, startingValue, compareFunction) { var comparator = compareFunction || compare; var resolver = createPropertyResolver( properties ); var min = startingValue; for (var i = 0; i < this.length; i++) { var resolved = resolver( this[ i ] ); if ( comparator( min, resolv...
javascript
function(properties, startingValue, compareFunction) { var comparator = compareFunction || compare; var resolver = createPropertyResolver( properties ); var min = startingValue; for (var i = 0; i < this.length; i++) { var resolved = resolver( this[ i ] ); if ( comparator( min, resolv...
[ "function", "(", "properties", ",", "startingValue", ",", "compareFunction", ")", "{", "var", "comparator", "=", "compareFunction", "||", "compare", ";", "var", "resolver", "=", "createPropertyResolver", "(", "properties", ")", ";", "var", "min", "=", "startingV...
Returns the minimum value for the given property expression out of all the elements this collection. ```javascript var c = Rekord.collect({age: 6}, {age: 5}, {notage: 5}); c.min('age'); // 5 ``` @method @memberof Rekord.Collection# @param {propertyResolverInput} [properties] - The expression which takes an element i...
[ "Returns", "the", "minimum", "value", "for", "the", "given", "property", "expression", "out", "of", "all", "the", "elements", "this", "collection", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8621-L8638
30,310
Rekord/rekord
build/rekord.js
function(properties, startingValue, compareFunction) { var comparator = compareFunction || compare; var resolver = createPropertyResolver( properties ); var max = startingValue; for (var i = 0; i < this.length; i++) { var resolved = resolver( this[ i ] ); if ( comparator( max, resolv...
javascript
function(properties, startingValue, compareFunction) { var comparator = compareFunction || compare; var resolver = createPropertyResolver( properties ); var max = startingValue; for (var i = 0; i < this.length; i++) { var resolved = resolver( this[ i ] ); if ( comparator( max, resolv...
[ "function", "(", "properties", ",", "startingValue", ",", "compareFunction", ")", "{", "var", "comparator", "=", "compareFunction", "||", "compare", ";", "var", "resolver", "=", "createPropertyResolver", "(", "properties", ")", ";", "var", "max", "=", "startingV...
Returns the maximum value for the given property expression out of all the elements this collection. ```javascript var c = Rekord.collect({age: 6}, {age: 5}, {notage: 5}); c.max('age'); // 6 ``` @method @memberof Rekord.Collection# @param {propertyResolverInput} [properties] - The expression which takes an element i...
[ "Returns", "the", "maximum", "value", "for", "the", "given", "property", "expression", "out", "of", "all", "the", "elements", "this", "collection", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8665-L8682
30,311
Rekord/rekord
build/rekord.js
function(whereProperties, whereValue, whereEquals) { var where = createWhere( whereProperties, whereValue, whereEquals ); for (var i = 0; i < this.length; i++) { var model = this[ i ]; if ( where( model ) ) { return model; } } return null; }
javascript
function(whereProperties, whereValue, whereEquals) { var where = createWhere( whereProperties, whereValue, whereEquals ); for (var i = 0; i < this.length; i++) { var model = this[ i ]; if ( where( model ) ) { return model; } } return null; }
[ "function", "(", "whereProperties", ",", "whereValue", ",", "whereEquals", ")", "{", "var", "where", "=", "createWhere", "(", "whereProperties", ",", "whereValue", ",", "whereEquals", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", "."...
Returns the first element where the given expression is true. ```javascript var c = Rekord.collect([{x: 5}, {y: 6}, {y: 6, age: 8}, {z: 7}]); c.firstWhere('y', 6); // {x: 6} c.firstWhere(); // {x: 5} ``` @method @memberof Rekord.Collection# @param {whereInput} [whereProperties] - The expression used to create a funct...
[ "Returns", "the", "first", "element", "where", "the", "given", "expression", "is", "true", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8708-L8723
30,312
Rekord/rekord
build/rekord.js
function(properties) { var resolver = createPropertyResolver( properties ); for (var i = 0; i < this.length; i++) { var resolved = resolver( this[ i ] ); if ( isValue( resolved ) ) { return resolved; } } }
javascript
function(properties) { var resolver = createPropertyResolver( properties ); for (var i = 0; i < this.length; i++) { var resolved = resolver( this[ i ] ); if ( isValue( resolved ) ) { return resolved; } } }
[ "function", "(", "properties", ")", "{", "var", "resolver", "=", "createPropertyResolver", "(", "properties", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "length", ";", "i", "++", ")", "{", "var", "resolved", "=", "resolve...
Returns the first non-null value in this collection given a property expression. If no non-null values exist for the given property expression, then undefined will be returned. ```javascript var c = Rekord.collect([{x: 5}, {y: 6}, {y: 4}, {z: 7}]); c.first('y'); // 6 c.first(); // {x: 5} ``` @method @memberof Rekord....
[ "Returns", "the", "first", "non", "-", "null", "value", "in", "this", "collection", "given", "a", "property", "expression", ".", "If", "no", "non", "-", "null", "values", "exist", "for", "the", "given", "property", "expression", "then", "undefined", "will", ...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8744-L8757
30,313
Rekord/rekord
build/rekord.js
function(properties, value, equals) { var where = createWhere( properties, value, equals ); for (var i = this.length - 1; i >= 0; i--) { var model = this[ i ]; if ( where( model ) ) { return model; } } return null; }
javascript
function(properties, value, equals) { var where = createWhere( properties, value, equals ); for (var i = this.length - 1; i >= 0; i--) { var model = this[ i ]; if ( where( model ) ) { return model; } } return null; }
[ "function", "(", "properties", ",", "value", ",", "equals", ")", "{", "var", "where", "=", "createWhere", "(", "properties", ",", "value", ",", "equals", ")", ";", "for", "(", "var", "i", "=", "this", ".", "length", "-", "1", ";", "i", ">=", "0", ...
Returns the last element where the given expression is true. ```javascript var c = Rekord.collect([{x: 5}, {y: 6}, {y: 6, age: 8}, {z: 7}]); c.lastWhere('y', 6); // {x: 6, age: 8} c.lastWhere(); // {z: 7} ``` @method @memberof Rekord.Collection# @param {whereInput} [properties] - The expression used to create a funct...
[ "Returns", "the", "last", "element", "where", "the", "given", "expression", "is", "true", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8783-L8798
30,314
Rekord/rekord
build/rekord.js
function(resolver, validator, process, getResult) { for (var i = 0; i < this.length; i++) { var resolved = resolver( this[ i ] ); if ( validator( resolved ) ) { process( resolved ); } } return getResult(); }
javascript
function(resolver, validator, process, getResult) { for (var i = 0; i < this.length; i++) { var resolved = resolver( this[ i ] ); if ( validator( resolved ) ) { process( resolved ); } } return getResult(); }
[ "function", "(", "resolver", ",", "validator", ",", "process", ",", "getResult", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "length", ";", "i", "++", ")", "{", "var", "resolved", "=", "resolver", "(", "this", "[", "i"...
Iterates over all elements in this collection and passes them through the `resolver` function. The returned value is passed through the `validator` function and if that returns true the resolved value is passed through the `process` function. After iteration, the `getResult` function is executed and the returned value ...
[ "Iterates", "over", "all", "elements", "in", "this", "collection", "and", "passes", "them", "through", "the", "resolver", "function", ".", "The", "returned", "value", "is", "passed", "through", "the", "validator", "function", "and", "if", "that", "returns", "t...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8857-L8870
30,315
Rekord/rekord
build/rekord.js
function(numbers) { var resolver = createNumberResolver( numbers ); var result = 0; var total = 0; function process(x) { result += x; total++; } function getResult() { return total === 0 ? 0 : result / total; } return this.aggregate( resolver, isNumber, pro...
javascript
function(numbers) { var resolver = createNumberResolver( numbers ); var result = 0; var total = 0; function process(x) { result += x; total++; } function getResult() { return total === 0 ? 0 : result / total; } return this.aggregate( resolver, isNumber, pro...
[ "function", "(", "numbers", ")", "{", "var", "resolver", "=", "createNumberResolver", "(", "numbers", ")", ";", "var", "result", "=", "0", ";", "var", "total", "=", "0", ";", "function", "process", "(", "x", ")", "{", "result", "+=", "x", ";", "total...
Averages all numbers resolved from the given property expression and returns the result. ```javascript var c = Rekord.collect([2, 3, 4]); c.avg(); // 3 var d = Rekord.collect([{age: 5}, {age: 4}, {age: 2}]); d.avg('age'); // 3.66666 ``` @method @memberof Rekord.Collection# @param {propertyResolverInput} [numbers] The...
[ "Averages", "all", "numbers", "resolved", "from", "the", "given", "property", "expression", "and", "returns", "the", "result", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L8928-L8946
30,316
Rekord/rekord
build/rekord.js
function(properties) { if ( !isValue( properties ) ) { return this.length; } var resolver = createPropertyResolver( properties ); var result = 0; for (var i = 0; i < this.length; i++) { var resolved = resolver( this[ i ] ); if ( isValue( resolved ) ) { re...
javascript
function(properties) { if ( !isValue( properties ) ) { return this.length; } var resolver = createPropertyResolver( properties ); var result = 0; for (var i = 0; i < this.length; i++) { var resolved = resolver( this[ i ] ); if ( isValue( resolved ) ) { re...
[ "function", "(", "properties", ")", "{", "if", "(", "!", "isValue", "(", "properties", ")", ")", "{", "return", "this", ".", "length", ";", "}", "var", "resolver", "=", "createPropertyResolver", "(", "properties", ")", ";", "var", "result", "=", "0", "...
Counts the number of elements in this collection that has a value for the given property expression. ```javascript var c = Rekord.collect([{age: 2}, {age: 3}, {taco: 4}]); c.count('age'); // 2 c.count('taco'); // 1 c.count(); // 3 ``` @method @memberof Rekord.Collection# @param {propertyResolverInput} [properties] - ...
[ "Counts", "the", "number", "of", "elements", "in", "this", "collection", "that", "has", "a", "value", "for", "the", "given", "property", "expression", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L9012-L9033
30,317
Rekord/rekord
build/rekord.js
function(values, keys) { var valuesResolver = createPropertyResolver( values ); if ( keys ) { var keysResolver = createPropertyResolver( keys ); var result = {}; for (var i = 0; i < this.length; i++) { var model = this[ i ]; var value = valuesResolver( model ); ...
javascript
function(values, keys) { var valuesResolver = createPropertyResolver( values ); if ( keys ) { var keysResolver = createPropertyResolver( keys ); var result = {}; for (var i = 0; i < this.length; i++) { var model = this[ i ]; var value = valuesResolver( model ); ...
[ "function", "(", "values", ",", "keys", ")", "{", "var", "valuesResolver", "=", "createPropertyResolver", "(", "values", ")", ";", "if", "(", "keys", ")", "{", "var", "keysResolver", "=", "createPropertyResolver", "(", "keys", ")", ";", "var", "result", "=...
Plucks values from elements in the collection. If only a `values` property expression is given the result will be an array of resolved values. If the `keys` property expression is given, the result will be an object where the property of the object is determined by the key expression. ```javascript var c = Rekord.coll...
[ "Plucks", "values", "from", "elements", "in", "the", "collection", ".", "If", "only", "a", "values", "property", "expression", "is", "given", "the", "result", "will", "be", "an", "array", "of", "resolved", "values", ".", "If", "the", "keys", "property", "e...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L9060-L9094
30,318
Rekord/rekord
build/rekord.js
function(callback, context) { var callbackContext = context || this; for (var i = 0; i < this.length; i++) { var item = this[ i ]; callback.call( callbackContext, item, i ); if ( this[ i ] !== item ) { i--; } } return this; }
javascript
function(callback, context) { var callbackContext = context || this; for (var i = 0; i < this.length; i++) { var item = this[ i ]; callback.call( callbackContext, item, i ); if ( this[ i ] !== item ) { i--; } } return this; }
[ "function", "(", "callback", ",", "context", ")", "{", "var", "callbackContext", "=", "context", "||", "this", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "length", ";", "i", "++", ")", "{", "var", "item", "=", "this", "[",...
Iterates over each element in this collection and passes the element and it's index to the given function. An optional function context can be given. @method @memberof Rekord.Collection# @param {Function} callback - The function to invoke for each element of this collection passing the element and the index where it e...
[ "Iterates", "over", "each", "element", "in", "this", "collection", "and", "passes", "the", "element", "and", "it", "s", "index", "to", "the", "given", "function", ".", "An", "optional", "function", "context", "can", "be", "given", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L9110-L9127
30,319
Rekord/rekord
build/rekord.js
function(callback, properties, values, equals) { var where = createWhere( properties, values, equals ); for (var i = 0; i < this.length; i++) { var item = this[ i ]; if ( where( item ) ) { callback.call( this, item, i ); if ( this[ i ] !== item ) { i-...
javascript
function(callback, properties, values, equals) { var where = createWhere( properties, values, equals ); for (var i = 0; i < this.length; i++) { var item = this[ i ]; if ( where( item ) ) { callback.call( this, item, i ); if ( this[ i ] !== item ) { i-...
[ "function", "(", "callback", ",", "properties", ",", "values", ",", "equals", ")", "{", "var", "where", "=", "createWhere", "(", "properties", ",", "values", ",", "equals", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "le...
Iterates over each element in this collection that matches the where expression and passes the element and it's index to the given function. @method @memberof Rekord.Collection# @param {Function} callback - The function to invoke for each element of this collection passing the element and the index where it exists. @p...
[ "Iterates", "over", "each", "element", "in", "this", "collection", "that", "matches", "the", "where", "expression", "and", "passes", "the", "element", "and", "it", "s", "index", "to", "the", "given", "function", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L9148-L9168
30,320
Rekord/rekord
build/rekord.js
function(reducer, initialValue) { for (var i = 0; i < this.length; i++) { initialValue = reducer( initialValue, this[ i ] ); } return initialValue; }
javascript
function(reducer, initialValue) { for (var i = 0; i < this.length; i++) { initialValue = reducer( initialValue, this[ i ] ); } return initialValue; }
[ "function", "(", "reducer", ",", "initialValue", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "length", ";", "i", "++", ")", "{", "initialValue", "=", "reducer", "(", "initialValue", ",", "this", "[", "i", "]", ")", ";"...
Reduces all the elements of this collection to a single value. All elements are passed to a function which accepts the currently reduced value and the current element and returns the new reduced value. ```javascript var reduceIt = function(curr, elem) { return curr + ( elem[0] * elem[1] ); }; var c = Rekord.collect([[...
[ "Reduces", "all", "the", "elements", "of", "this", "collection", "to", "a", "single", "value", ".", "All", "elements", "are", "passed", "to", "a", "function", "which", "accepts", "the", "currently", "reduced", "value", "and", "the", "current", "element", "an...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L9193-L9201
30,321
Rekord/rekord
build/rekord.js
function(properties, value, equals) { var where = createWhere( properties, value, equals ); for (var i = 0; i < this.length; i++) { var model = this[ i ]; if ( where( model ) ) { return true; } } return false; }
javascript
function(properties, value, equals) { var where = createWhere( properties, value, equals ); for (var i = 0; i < this.length; i++) { var model = this[ i ]; if ( where( model ) ) { return true; } } return false; }
[ "function", "(", "properties", ",", "value", ",", "equals", ")", "{", "var", "where", "=", "createWhere", "(", "properties", ",", "value", ",", "equals", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "length", ";", "i", ...
Determines whether at least one element in this collection matches the given criteria. ```javascript var c = Rekord.collect([{age: 2}, {age: 6}]); c.contains('age', 2); // true c.contains('age', 3); // false c.contains('age'); // true c.contains('name'); // false ``` @method @memberof Rekord.Collection# @param {where...
[ "Determines", "whether", "at", "least", "one", "element", "in", "this", "collection", "matches", "the", "given", "criteria", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L9294-L9309
30,322
Rekord/rekord
build/rekord.js
function(grouping) { var by = createPropertyResolver( grouping.by ); var having = createWhere( grouping.having, grouping.havingValue, grouping.havingEquals ); var select = grouping.select || {}; var map = {}; if ( isString( grouping.by ) ) { if ( !(grouping.by in select) ) { ...
javascript
function(grouping) { var by = createPropertyResolver( grouping.by ); var having = createWhere( grouping.having, grouping.havingValue, grouping.havingEquals ); var select = grouping.select || {}; var map = {}; if ( isString( grouping.by ) ) { if ( !(grouping.by in select) ) { ...
[ "function", "(", "grouping", ")", "{", "var", "by", "=", "createPropertyResolver", "(", "grouping", ".", "by", ")", ";", "var", "having", "=", "createWhere", "(", "grouping", ".", "having", ",", "grouping", ".", "havingValue", ",", "grouping", ".", "having...
Groups the elements into sub collections given some property expression to use as the value to group by. ```javascript var c = Rekord.collect([ { name: 'Tom', age: 6, group: 'X' }, { name: 'Jon', age: 7, group: 'X' }, { name: 'Rob', age: 8, group: 'X' }, { name: 'Bon', age: 9, group: 'Y' }, { name: 'Ran', age: 10, gro...
[ "Groups", "the", "elements", "into", "sub", "collections", "given", "some", "property", "expression", "to", "use", "as", "the", "value", "to", "group", "by", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L9363-L9444
30,323
Rekord/rekord
build/rekord.js
function(database, models, remoteData) { Class.props(this, { database: database, map: new Map() }); this.map.values = this; this.reset( models, remoteData ); return this; }
javascript
function(database, models, remoteData) { Class.props(this, { database: database, map: new Map() }); this.map.values = this; this.reset( models, remoteData ); return this; }
[ "function", "(", "database", ",", "models", ",", "remoteData", ")", "{", "Class", ".", "props", "(", "this", ",", "{", "database", ":", "database", ",", "map", ":", "new", "Map", "(", ")", "}", ")", ";", "this", ".", "map", ".", "values", "=", "t...
Initializes the model collection by setting the database, the initial set of models, and whether the initial set of models is from a remote source. @method @memberof Rekord.ModelCollection# @param {Rekord.Database} database - The database for the models in this collection. @param {modelInput[]} [models] - The initial ...
[ "Initializes", "the", "model", "collection", "by", "setting", "the", "database", "the", "initial", "set", "of", "models", "and", "whether", "the", "initial", "set", "of", "models", "is", "from", "a", "remote", "source", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L10088-L10099
30,324
Rekord/rekord
build/rekord.js
function(models, remoteData) { var map = this.map; map.reset(); if ( isArray( models ) ) { for (var i = 0; i < models.length; i++) { var model = models[ i ]; var parsed = this.parseModel( model, remoteData ); if ( parsed ) { map.put( parsed.$key...
javascript
function(models, remoteData) { var map = this.map; map.reset(); if ( isArray( models ) ) { for (var i = 0; i < models.length; i++) { var model = models[ i ]; var parsed = this.parseModel( model, remoteData ); if ( parsed ) { map.put( parsed.$key...
[ "function", "(", "models", ",", "remoteData", ")", "{", "var", "map", "=", "this", ".", "map", ";", "map", ".", "reset", "(", ")", ";", "if", "(", "isArray", "(", "models", ")", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "mode...
Resets the models in this collection with a new collection of models. @method @memberof Rekord.ModelCollection# @param {modelInput[]} [models] - The initial array of models in this collection. @param {Boolean} [remoteData=false] - If the models array is from a remote source. Remote sources place the model directly int...
[ "Resets", "the", "models", "in", "this", "collection", "with", "a", "new", "collection", "of", "models", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L10290-L10323
30,325
Rekord/rekord
build/rekord.js
function(key, model, delaySort) { this.map.put( key, model ); this.trigger( Collection.Events.Add, [this, model, this.map.indices[ key ]] ); if ( !delaySort ) { this.sort(); } }
javascript
function(key, model, delaySort) { this.map.put( key, model ); this.trigger( Collection.Events.Add, [this, model, this.map.indices[ key ]] ); if ( !delaySort ) { this.sort(); } }
[ "function", "(", "key", ",", "model", ",", "delaySort", ")", "{", "this", ".", "map", ".", "put", "(", "key", ",", "model", ")", ";", "this", ".", "trigger", "(", "Collection", ".", "Events", ".", "Add", ",", "[", "this", ",", "model", ",", "this...
Places a model in this collection providing a key to use. @method @memberof Rekord.ModelCollection# @param {modelKey} key - The key of the model. @param {Rekord.Model} model - The model instance to place in the collection. @param {Boolean} [delaySort=false] - Whether automatic sorting should be delayed until the user ...
[ "Places", "a", "model", "in", "this", "collection", "providing", "a", "key", "to", "use", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L10374-L10383
30,326
Rekord/rekord
build/rekord.js
function(input, delaySort, remoteData) { var model = this.parseModel( input, remoteData ); var key = model.$key(); this.map.put( key, model ); this.trigger( Collection.Events.Add, [this, model, this.map.indices[ key ]] ); if ( !delaySort ) { this.sort(); } return this; }
javascript
function(input, delaySort, remoteData) { var model = this.parseModel( input, remoteData ); var key = model.$key(); this.map.put( key, model ); this.trigger( Collection.Events.Add, [this, model, this.map.indices[ key ]] ); if ( !delaySort ) { this.sort(); } return this; }
[ "function", "(", "input", ",", "delaySort", ",", "remoteData", ")", "{", "var", "model", "=", "this", ".", "parseModel", "(", "input", ",", "remoteData", ")", ";", "var", "key", "=", "model", ".", "$key", "(", ")", ";", "this", ".", "map", ".", "pu...
Adds a model to this collection - sorting the collection if a comparator is set on this collection and `delaySort` is not a specified or a true value. @method @memberof Rekord.ModelCollection# @param {modelInput} input - The model to add to this collection. @param {Boolean} [delaySort=false] - Whether automatic sortin...
[ "Adds", "a", "model", "to", "this", "collection", "-", "sorting", "the", "collection", "if", "a", "comparator", "is", "set", "on", "this", "collection", "and", "delaySort", "is", "not", "a", "specified", "or", "a", "true", "value", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L10406-L10420
30,327
Rekord/rekord
build/rekord.js
function() { var values = AP.slice.apply( arguments ); var indices = []; for (var i = 0; i < values.length; i++) { var model = this.parseModel( values[ i ] ); var key = model.$key(); this.map.put( key, model ); indices.push( this.map.indices[ key ] ); } this.trigger(...
javascript
function() { var values = AP.slice.apply( arguments ); var indices = []; for (var i = 0; i < values.length; i++) { var model = this.parseModel( values[ i ] ); var key = model.$key(); this.map.put( key, model ); indices.push( this.map.indices[ key ] ); } this.trigger(...
[ "function", "(", ")", "{", "var", "values", "=", "AP", ".", "slice", ".", "apply", "(", "arguments", ")", ";", "var", "indices", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")"...
Adds one or more models to the end of this collection - sorting the collection if a comparator is set on this collection. @method @memberof Rekord.ModelCollection# @param {...modelInput} value - The models to add to this collection. @return {Number} - The new length of this collection. @emits Rekord.ModelCollection#ad...
[ "Adds", "one", "or", "more", "models", "to", "the", "end", "of", "this", "collection", "-", "sorting", "the", "collection", "if", "a", "comparator", "is", "set", "on", "this", "collection", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L10435-L10453
30,328
Rekord/rekord
build/rekord.js
function(models, delaySort, remoteData) { if ( isArray( models ) ) { var indices = []; for (var i = 0; i < models.length; i++) { var model = this.parseModel( models[ i ], remoteData ); var key = model.$key(); this.map.put( key, model ); indices.push( this.ma...
javascript
function(models, delaySort, remoteData) { if ( isArray( models ) ) { var indices = []; for (var i = 0; i < models.length; i++) { var model = this.parseModel( models[ i ], remoteData ); var key = model.$key(); this.map.put( key, model ); indices.push( this.ma...
[ "function", "(", "models", ",", "delaySort", ",", "remoteData", ")", "{", "if", "(", "isArray", "(", "models", ")", ")", "{", "var", "indices", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "models", ".", "length", ";", "...
Adds all models in the given array to this collection - sorting the collection if a comparator is set on this collection and `delaySort` is not specified or a true value. @method @memberof Rekord.ModelCollection# @param {modelInput[]} models - The models to add to this collection. @param {Boolean} [delaySort=false] - ...
[ "Adds", "all", "models", "in", "the", "given", "array", "to", "this", "collection", "-", "sorting", "the", "collection", "if", "a", "comparator", "is", "set", "on", "this", "collection", "and", "delaySort", "is", "not", "specified", "or", "a", "true", "val...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L10492-L10514
30,329
Rekord/rekord
build/rekord.js
function(delaySort) { var removed = this[ 0 ]; this.map.removeAt( 0 ); this.trigger( Collection.Events.Remove, [this, removed, 0] ); if ( !delaySort ) { this.sort(); } return removed; }
javascript
function(delaySort) { var removed = this[ 0 ]; this.map.removeAt( 0 ); this.trigger( Collection.Events.Remove, [this, removed, 0] ); if ( !delaySort ) { this.sort(); } return removed; }
[ "function", "(", "delaySort", ")", "{", "var", "removed", "=", "this", "[", "0", "]", ";", "this", ".", "map", ".", "removeAt", "(", "0", ")", ";", "this", ".", "trigger", "(", "Collection", ".", "Events", ".", "Remove", ",", "[", "this", ",", "r...
Removes the first model in this collection and returns it - sorting the collection if a comparator is set on this collection and `delaySort` is no specified or a true value. ```javascript var c = Rekord.collect(1, 2, 3, 4); c.shift(); // 1 ``` @method @memberof Rekord.ModelCollection# @param {Boolean} [delaySort=fals...
[ "Removes", "the", "first", "model", "in", "this", "collection", "and", "returns", "it", "-", "sorting", "the", "collection", "if", "a", "comparator", "is", "set", "on", "this", "collection", "and", "delaySort", "is", "no", "specified", "or", "a", "true", "...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L10581-L10594
30,330
Rekord/rekord
build/rekord.js
function(i, delaySort) { var removing; if (i >= 0 && i < this.length) { removing = this[ i ]; this.map.removeAt( i ); this.trigger( Collection.Events.Remove, [this, removing, i] ); if ( !delaySort ) { this.sort(); } } return removing; }
javascript
function(i, delaySort) { var removing; if (i >= 0 && i < this.length) { removing = this[ i ]; this.map.removeAt( i ); this.trigger( Collection.Events.Remove, [this, removing, i] ); if ( !delaySort ) { this.sort(); } } return removing; }
[ "function", "(", "i", ",", "delaySort", ")", "{", "var", "removing", ";", "if", "(", "i", ">=", "0", "&&", "i", "<", "this", ".", "length", ")", "{", "removing", "=", "this", "[", "i", "]", ";", "this", ".", "map", ".", "removeAt", "(", "i", ...
Removes the model in this collection at the given index `i` - sorting the collection if a comparator is set on this collection and `delaySort` is not specified or a true value. @method @memberof Rekord.ModelCollection# @param {Number} i - The index of the model to remove. @param {Boolean} [delaySort=false] - Whether a...
[ "Removes", "the", "model", "in", "this", "collection", "at", "the", "given", "index", "i", "-", "sorting", "the", "collection", "if", "a", "comparator", "is", "set", "on", "this", "collection", "and", "delaySort", "is", "not", "specified", "or", "a", "true...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L10613-L10631
30,331
Rekord/rekord
build/rekord.js
function(input, delaySort) { var key = this.buildKeyFromInput( input ); var removing = this.map.get( key ); if ( removing ) { var i = this.map.indices[ key ]; this.map.remove( key ); this.trigger( Collection.Events.Remove, [this, removing, i] ); if ( !delaySort ) { ...
javascript
function(input, delaySort) { var key = this.buildKeyFromInput( input ); var removing = this.map.get( key ); if ( removing ) { var i = this.map.indices[ key ]; this.map.remove( key ); this.trigger( Collection.Events.Remove, [this, removing, i] ); if ( !delaySort ) { ...
[ "function", "(", "input", ",", "delaySort", ")", "{", "var", "key", "=", "this", ".", "buildKeyFromInput", "(", "input", ")", ";", "var", "removing", "=", "this", ".", "map", ".", "get", "(", "key", ")", ";", "if", "(", "removing", ")", "{", "var",...
Removes the given model from this collection if it exists - sorting the collection if a comparator is set on this collection and `delaySort` is not specified or a true value. @method @memberof Rekord.ModelCollection# @param {modelInput} input - The model to remove from this collection if it exists. @param {Boolean} [d...
[ "Removes", "the", "given", "model", "from", "this", "collection", "if", "it", "exists", "-", "sorting", "the", "collection", "if", "a", "comparator", "is", "set", "on", "this", "collection", "and", "delaySort", "is", "not", "specified", "or", "a", "true", ...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L10653-L10672
30,332
Rekord/rekord
build/rekord.js
function(inputs, delaySort) { var map = this.map; var removed = []; var removedIndices = []; for (var i = 0; i < inputs.length; i++) { var key = this.buildKeyFromInput( inputs[ i ] ); var removing = map.get( key ); if ( removing ) { removedIndices.push( map.indice...
javascript
function(inputs, delaySort) { var map = this.map; var removed = []; var removedIndices = []; for (var i = 0; i < inputs.length; i++) { var key = this.buildKeyFromInput( inputs[ i ] ); var removing = map.get( key ); if ( removing ) { removedIndices.push( map.indice...
[ "function", "(", "inputs", ",", "delaySort", ")", "{", "var", "map", "=", "this", ".", "map", ";", "var", "removed", "=", "[", "]", ";", "var", "removedIndices", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "inputs", "."...
Removes the given models from this collection - sorting the collection if a comparator is set on this collection and `delaySort` is not specified or a true value. @method @memberof Rekord.ModelCollection# @param {modelInput[]} inputs - The models to remove from this collection if they exist. @param {Boolean} [delaySor...
[ "Removes", "the", "given", "models", "from", "this", "collection", "-", "sorting", "the", "collection", "if", "a", "comparator", "is", "set", "on", "this", "collection", "and", "delaySort", "is", "not", "specified", "or", "a", "true", "value", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L10691-L10724
30,333
Rekord/rekord
build/rekord.js
function(input) { var key = this.buildKeyFromInput( input ); var index = this.map.indices[ key ]; return index === undefined ? -1 : index; }
javascript
function(input) { var key = this.buildKeyFromInput( input ); var index = this.map.indices[ key ]; return index === undefined ? -1 : index; }
[ "function", "(", "input", ")", "{", "var", "key", "=", "this", ".", "buildKeyFromInput", "(", "input", ")", ";", "var", "index", "=", "this", ".", "map", ".", "indices", "[", "key", "]", ";", "return", "index", "===", "undefined", "?", "-", "1", ":...
Returns the index of the given model in this collection or returns -1 if the model doesn't exist in this collection. @method @memberof Rekord.ModelCollection# @param {modelInput} input - The model to search for. @return {Number} - The index of the model in this collection or -1 if it was not found.
[ "Returns", "the", "index", "of", "the", "given", "model", "in", "this", "collection", "or", "returns", "-", "1", "if", "the", "model", "doesn", "t", "exist", "in", "this", "collection", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L10737-L10743
30,334
Rekord/rekord
build/rekord.js
function(properties, value, equals) { var where = createWhere( properties, value, equals ); var hasChanges = function( model ) { return where( model ) && model.$hasChanges(); }; return this.contains( hasChanges ); }
javascript
function(properties, value, equals) { var where = createWhere( properties, value, equals ); var hasChanges = function( model ) { return where( model ) && model.$hasChanges(); }; return this.contains( hasChanges ); }
[ "function", "(", "properties", ",", "value", ",", "equals", ")", "{", "var", "where", "=", "createWhere", "(", "properties", ",", "value", ",", "equals", ")", ";", "var", "hasChanges", "=", "function", "(", "model", ")", "{", "return", "where", "(", "m...
Returns whether this collection has at least one model with changes. An additional where expression can be given to only check certain models. @method @memberof Rekord.ModelCollection# @param {whereInput} [properties] - See {@link Rekord.createWhere} @param {Any} [value] - See {@link Rekord.createWhere} @param {equali...
[ "Returns", "whether", "this", "collection", "has", "at", "least", "one", "model", "with", "changes", ".", "An", "additional", "where", "expression", "can", "be", "given", "to", "only", "check", "certain", "models", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L11241-L11251
30,335
Rekord/rekord
build/rekord.js
function(properties, value, equals, out) { var where = createWhere( properties, value, equals ); var changes = out && out instanceof ModelCollection ? out : this.cloneEmpty(); this.each(function(model) { if ( where( model ) && model.$hasChanges() ) { changes.put( model.$key(), mod...
javascript
function(properties, value, equals, out) { var where = createWhere( properties, value, equals ); var changes = out && out instanceof ModelCollection ? out : this.cloneEmpty(); this.each(function(model) { if ( where( model ) && model.$hasChanges() ) { changes.put( model.$key(), mod...
[ "function", "(", "properties", ",", "value", ",", "equals", ",", "out", ")", "{", "var", "where", "=", "createWhere", "(", "properties", ",", "value", ",", "equals", ")", ";", "var", "changes", "=", "out", "&&", "out", "instanceof", "ModelCollection", "?...
Returns a collection of all changes for each model. The changes are keyed into the collection by the models key. An additional where expression can be given to only check certain models. @method @memberof Rekord.ModelCollection# @param {whereInput} [properties] - See {@link Rekord.createWhere} @param {Any} [value] - S...
[ "Returns", "a", "collection", "of", "all", "changes", "for", "each", "model", ".", "The", "changes", "are", "keyed", "into", "the", "collection", "by", "the", "models", "key", ".", "An", "additional", "where", "expression", "can", "be", "given", "to", "onl...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L11274-L11288
30,336
Rekord/rekord
build/rekord.js
function(cloneModels, cloneProperties) { var source = this; if ( cloneModels ) { source = []; for (var i = 0; i < this.length; i++) { source[ i ] = this[ i ].$clone( cloneProperties ); } } return ModelCollection.create( this.database, source, true ); }
javascript
function(cloneModels, cloneProperties) { var source = this; if ( cloneModels ) { source = []; for (var i = 0; i < this.length; i++) { source[ i ] = this[ i ].$clone( cloneProperties ); } } return ModelCollection.create( this.database, source, true ); }
[ "function", "(", "cloneModels", ",", "cloneProperties", ")", "{", "var", "source", "=", "this", ";", "if", "(", "cloneModels", ")", "{", "source", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "length", ";", "i...
Returns a clone of this collection. Optionally the models in this collection can also be cloned. @method @memberof Rekord.ModelCollection# @param {Boolean} [cloneModels=false] - Whether or not the models should be cloned as well. @param {Boolean} [cloneProperties] - The properties object which defines what fields shou...
[ "Returns", "a", "clone", "of", "this", "collection", ".", "Optionally", "the", "models", "in", "this", "collection", "can", "also", "be", "cloned", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L11335-L11350
30,337
Rekord/rekord
build/rekord.js
function(base, filter) { if ( this.base ) { this.base.database.off( Database.Events.ModelUpdated, this.onModelUpdated ); } ModelCollection.prototype.init.call( this, base.database ); Filtering.init.call( this, base, filter ); base.database.on( Database.Events.ModelUpdated, this.onMode...
javascript
function(base, filter) { if ( this.base ) { this.base.database.off( Database.Events.ModelUpdated, this.onModelUpdated ); } ModelCollection.prototype.init.call( this, base.database ); Filtering.init.call( this, base, filter ); base.database.on( Database.Events.ModelUpdated, this.onMode...
[ "function", "(", "base", ",", "filter", ")", "{", "if", "(", "this", ".", "base", ")", "{", "this", ".", "base", ".", "database", ".", "off", "(", "Database", ".", "Events", ".", "ModelUpdated", ",", "this", ".", "onModelUpdated", ")", ";", "}", "M...
Initializes the filtered collection by setting the base collection and the filtering function. @method @memberof Rekord.FilteredModelCollection# @param {Rekord.ModelCollection} base - The model collection to listen to for changes to update this collection. @param {whereCallback} filter - The function which determines ...
[ "Initializes", "the", "filtered", "collection", "by", "setting", "the", "base", "collection", "and", "the", "filtering", "function", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L11448-L11462
30,338
Rekord/rekord
build/rekord.js
function(model) { var exists = this.has( model.$key() ); var matches = this.filter( model ); if ( exists && !matches ) { this.remove( model ); } if ( !exists && matches ) { this.add( model ); } }
javascript
function(model) { var exists = this.has( model.$key() ); var matches = this.filter( model ); if ( exists && !matches ) { this.remove( model ); } if ( !exists && matches ) { this.add( model ); } }
[ "function", "(", "model", ")", "{", "var", "exists", "=", "this", ".", "has", "(", "model", ".", "$key", "(", ")", ")", ";", "var", "matches", "=", "this", ".", "filter", "(", "model", ")", ";", "if", "(", "exists", "&&", "!", "matches", ")", "...
Handles the ModelUpdated event from the database.
[ "Handles", "the", "ModelUpdated", "event", "from", "the", "database", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L11520-L11533
30,339
Rekord/rekord
build/rekord.js
DiscriminateCollection
function DiscriminateCollection(collection, discriminator, discriminatorsToModel) { Class.props( collection, { discriminator: discriminator, discriminatorsToModel: discriminatorsToModel }); // Original Functions var buildKeyFromInput = collection.buildKeyFromInput; var parseModel = collection.parse...
javascript
function DiscriminateCollection(collection, discriminator, discriminatorsToModel) { Class.props( collection, { discriminator: discriminator, discriminatorsToModel: discriminatorsToModel }); // Original Functions var buildKeyFromInput = collection.buildKeyFromInput; var parseModel = collection.parse...
[ "function", "DiscriminateCollection", "(", "collection", ",", "discriminator", ",", "discriminatorsToModel", ")", "{", "Class", ".", "props", "(", "collection", ",", "{", "discriminator", ":", "discriminator", ",", "discriminatorsToModel", ":", "discriminatorsToModel", ...
Overrides functions in the given model collection to turn it into a collection which contains models with a discriminator field. @param {Rekord.ModelCollection} collection - The collection instance with discriminated models. @param {String} discriminator - The name of the field which contains the discriminator. @param...
[ "Overrides", "functions", "in", "the", "given", "model", "collection", "to", "turn", "it", "into", "a", "collection", "which", "contains", "models", "with", "a", "discriminator", "field", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L11770-L11867
30,340
Rekord/rekord
build/rekord.js
function(input) { if ( isObject( input ) ) { var discriminatedValue = input[ this.discriminator ]; var model = this.discriminatorsToModel[ discriminatedValue ]; if ( model ) { return model.Database.keyHandler.buildKeyFromInput( input ); } } ...
javascript
function(input) { if ( isObject( input ) ) { var discriminatedValue = input[ this.discriminator ]; var model = this.discriminatorsToModel[ discriminatedValue ]; if ( model ) { return model.Database.keyHandler.buildKeyFromInput( input ); } } ...
[ "function", "(", "input", ")", "{", "if", "(", "isObject", "(", "input", ")", ")", "{", "var", "discriminatedValue", "=", "input", "[", "this", ".", "discriminator", "]", ";", "var", "model", "=", "this", ".", "discriminatorsToModel", "[", "discriminatedVa...
Builds a key from input. Discriminated collections only accept objects as input - otherwise there's no way to determine the discriminator. If the discriminator on the input doesn't map to a Rekord instance OR the input is not an object the input will be returned instead of a model instance. @param {modelInput} input -...
[ "Builds", "a", "key", "from", "input", ".", "Discriminated", "collections", "only", "accept", "objects", "as", "input", "-", "otherwise", "there", "s", "no", "way", "to", "determine", "the", "discriminator", ".", "If", "the", "discriminator", "on", "the", "i...
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L11798-L11812
30,341
Rekord/rekord
build/rekord.js
function(input, remoteData) { if ( input instanceof Model ) { return input; } var discriminatedValue = isValue( input ) ? input[ this.discriminator ] : null; var model = this.discriminatorsToModel[ discriminatedValue ]; return model ? model.Database.parseModel( input, r...
javascript
function(input, remoteData) { if ( input instanceof Model ) { return input; } var discriminatedValue = isValue( input ) ? input[ this.discriminator ] : null; var model = this.discriminatorsToModel[ discriminatedValue ]; return model ? model.Database.parseModel( input, r...
[ "function", "(", "input", ",", "remoteData", ")", "{", "if", "(", "input", "instanceof", "Model", ")", "{", "return", "input", ";", "}", "var", "discriminatedValue", "=", "isValue", "(", "input", ")", "?", "input", "[", "this", ".", "discriminator", "]",...
Takes input and returns a model instance. The input is expected to be an object, any other type will return null. @param {modelInput} input - The input to parse to a model instance. @param {Boolean} [remoteData=false] - Whether or not the input is coming from a remote source. @return {Rekord.Model} - The model instanc...
[ "Takes", "input", "and", "returns", "a", "model", "instance", ".", "The", "input", "is", "expected", "to", "be", "an", "object", "any", "other", "type", "will", "return", "null", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L11825-L11836
30,342
Rekord/rekord
build/rekord.js
function(database, field, options) { applyOptions( this, options, this.getDefaults( database, field, options ) ); this.database = database; this.name = field; this.options = options; this.initialized = false; this.property = this.property || (indexOf( database.fields, this.name ) !== false); ...
javascript
function(database, field, options) { applyOptions( this, options, this.getDefaults( database, field, options ) ); this.database = database; this.name = field; this.options = options; this.initialized = false; this.property = this.property || (indexOf( database.fields, this.name ) !== false); ...
[ "function", "(", "database", ",", "field", ",", "options", ")", "{", "applyOptions", "(", "this", ",", "options", ",", "this", ".", "getDefaults", "(", "database", ",", "field", ",", "options", ")", ")", ";", "this", ".", "database", "=", "database", "...
Initializes this relation with the given database, field, and options. @param {Rekord.Database} database [description] @param {String} field [description] @param {Object} options [description]
[ "Initializes", "this", "relation", "with", "the", "given", "database", "field", "and", "options", "." ]
6663dbedad865549a6b9bccaa9a993b2074483e6
https://github.com/Rekord/rekord/blob/6663dbedad865549a6b9bccaa9a993b2074483e6/build/rekord.js#L13758-L13780
30,343
rossj/rackit
lib/rackit.js
function (cb) { o1._client.auth(function (err) { if (err && !(err instanceof Error)) { err = new Error(err.message || err); } if (!err) { o1.config = { storage : o1._client._serviceUrl }; } cb(err); }); }
javascript
function (cb) { o1._client.auth(function (err) { if (err && !(err instanceof Error)) { err = new Error(err.message || err); } if (!err) { o1.config = { storage : o1._client._serviceUrl }; } cb(err); }); }
[ "function", "(", "cb", ")", "{", "o1", ".", "_client", ".", "auth", "(", "function", "(", "err", ")", "{", "if", "(", "err", "&&", "!", "(", "err", "instanceof", "Error", ")", ")", "{", "err", "=", "new", "Error", "(", "err", ".", "message", "|...
First authenticate with Cloud Files
[ "First", "authenticate", "with", "Cloud", "Files" ]
d5e5184980b00b993ef3eb448c2a5a763b9daf56
https://github.com/rossj/rackit/blob/d5e5184980b00b993ef3eb448c2a5a763b9daf56/lib/rackit.js#L75-L88
30,344
rossj/rackit
lib/rackit.js
function (cb) { if (o1.options.tempURLKey) { o1._log('Setting temporary URL key for account...'); o1._client.setTemporaryUrlKey(o1.options.tempURLKey, cb); } else { cb(); } }
javascript
function (cb) { if (o1.options.tempURLKey) { o1._log('Setting temporary URL key for account...'); o1._client.setTemporaryUrlKey(o1.options.tempURLKey, cb); } else { cb(); } }
[ "function", "(", "cb", ")", "{", "if", "(", "o1", ".", "options", ".", "tempURLKey", ")", "{", "o1", ".", "_log", "(", "'Setting temporary URL key for account...'", ")", ";", "o1", ".", "_client", ".", "setTemporaryUrlKey", "(", "o1", ".", "options", ".", ...
Set Account Metadata Key for public access
[ "Set", "Account", "Metadata", "Key", "for", "public", "access" ]
d5e5184980b00b993ef3eb448c2a5a763b9daf56
https://github.com/rossj/rackit/blob/d5e5184980b00b993ef3eb448c2a5a763b9daf56/lib/rackit.js#L96-L103
30,345
rossj/rackit
lib/rackit.js
function (cb) { o1._client.createContainer(sName, function (err, _container) { if (err) return cb(err); // check that a parallel operation didn't just add the same container container = _.find(o1.aContainers, { name : sName }); if (!container) { o1.aContainers.push(_container); conta...
javascript
function (cb) { o1._client.createContainer(sName, function (err, _container) { if (err) return cb(err); // check that a parallel operation didn't just add the same container container = _.find(o1.aContainers, { name : sName }); if (!container) { o1.aContainers.push(_container); conta...
[ "function", "(", "cb", ")", "{", "o1", ".", "_client", ".", "createContainer", "(", "sName", ",", "function", "(", "err", ",", "_container", ")", "{", "if", "(", "err", ")", "return", "cb", "(", "err", ")", ";", "// check that a parallel operation didn't j...
Create the container
[ "Create", "the", "container" ]
d5e5184980b00b993ef3eb448c2a5a763b9daf56
https://github.com/rossj/rackit/blob/d5e5184980b00b993ef3eb448c2a5a763b9daf56/lib/rackit.js#L179-L194
30,346
rossj/rackit
lib/rackit.js
function (cb) { if (!o1.options.useCDN) return cb(); o1._log('CDN enabling the container'); container.enableCdn(function (err, _container) { if (err) return cb(err); // check that a parallel operation didn't just CDN enable the same container var index = _.findIndex(o1.aContainers, { na...
javascript
function (cb) { if (!o1.options.useCDN) return cb(); o1._log('CDN enabling the container'); container.enableCdn(function (err, _container) { if (err) return cb(err); // check that a parallel operation didn't just CDN enable the same container var index = _.findIndex(o1.aContainers, { na...
[ "function", "(", "cb", ")", "{", "if", "(", "!", "o1", ".", "options", ".", "useCDN", ")", "return", "cb", "(", ")", ";", "o1", ".", "_log", "(", "'CDN enabling the container'", ")", ";", "container", ".", "enableCdn", "(", "function", "(", "err", ",...
CDN enable the container, if necessary
[ "CDN", "enable", "the", "container", "if", "necessary" ]
d5e5184980b00b993ef3eb448c2a5a763b9daf56
https://github.com/rossj/rackit/blob/d5e5184980b00b993ef3eb448c2a5a763b9daf56/lib/rackit.js#L196-L213
30,347
rossj/rackit
lib/rackit.js
function (err, results) { if (err) { return cb(err); } // Generate file id var id = options.filename || utils.uid(24); // // Generate the headers to be send to Rackspace // var headers = {}; // set the content-length of transfer-encoding as appropriate if (fromFile) { headers['c...
javascript
function (err, results) { if (err) { return cb(err); } // Generate file id var id = options.filename || utils.uid(24); // // Generate the headers to be send to Rackspace // var headers = {}; // set the content-length of transfer-encoding as appropriate if (fromFile) { headers['c...
[ "function", "(", "err", ",", "results", ")", "{", "if", "(", "err", ")", "{", "return", "cb", "(", "err", ")", ";", "}", "// Generate file id", "var", "id", "=", "options", ".", "filename", "||", "utils", ".", "uid", "(", "24", ")", ";", "//", "/...
Final function of parallel.. create the request to add the file
[ "Final", "function", "of", "parallel", "..", "create", "the", "request", "to", "add", "the", "file" ]
d5e5184980b00b993ef3eb448c2a5a763b9daf56
https://github.com/rossj/rackit/blob/d5e5184980b00b993ef3eb448c2a5a763b9daf56/lib/rackit.js#L328-L391
30,348
rossj/rackit
lib/rackit.js
function (err) { var i; // If the extended option is off, just return cloudpaths if (!options.extended) { i = aObjects.length; while (i--) { aObjects[i] = aObjects[i].cloudpath; } } cb(err, err ? undefined : aObjects); }
javascript
function (err) { var i; // If the extended option is off, just return cloudpaths if (!options.extended) { i = aObjects.length; while (i--) { aObjects[i] = aObjects[i].cloudpath; } } cb(err, err ? undefined : aObjects); }
[ "function", "(", "err", ")", "{", "var", "i", ";", "// If the extended option is off, just return cloudpaths", "if", "(", "!", "options", ".", "extended", ")", "{", "i", "=", "aObjects", ".", "length", ";", "while", "(", "i", "--", ")", "{", "aObjects", "[...
Final function of forEach
[ "Final", "function", "of", "forEach" ]
d5e5184980b00b993ef3eb448c2a5a763b9daf56
https://github.com/rossj/rackit/blob/d5e5184980b00b993ef3eb448c2a5a763b9daf56/lib/rackit.js#L429-L441
30,349
gerardobort/node-corenlp
examples/browser/tree/tree.js
collapse
function collapse(d) { if (d.children) { d._children = d.children; d._children.forEach(collapse); d.children = null; } }
javascript
function collapse(d) { if (d.children) { d._children = d.children; d._children.forEach(collapse); d.children = null; } }
[ "function", "collapse", "(", "d", ")", "{", "if", "(", "d", ".", "children", ")", "{", "d", ".", "_children", "=", "d", ".", "children", ";", "d", ".", "_children", ".", "forEach", "(", "collapse", ")", ";", "d", ".", "children", "=", "null", ";"...
Collapse the node and all it's children
[ "Collapse", "the", "node", "and", "all", "it", "s", "children" ]
c4461168a58950130c904785e6e7386bcebdad09
https://github.com/gerardobort/node-corenlp/blob/c4461168a58950130c904785e6e7386bcebdad09/examples/browser/tree/tree.js#L89-L95
30,350
gerardobort/node-corenlp
examples/browser/tree/tree.js
click
function click(d) { if (d.children) { d._children = d.children; d.children = null; } else { d.children = d._children; d._children = null; } update(d); }
javascript
function click(d) { if (d.children) { d._children = d.children; d.children = null; } else { d.children = d._children; d._children = null; } update(d); }
[ "function", "click", "(", "d", ")", "{", "if", "(", "d", ".", "children", ")", "{", "d", ".", "_children", "=", "d", ".", "children", ";", "d", ".", "children", "=", "null", ";", "}", "else", "{", "d", ".", "children", "=", "d", ".", "_children...
Toggle children on click.
[ "Toggle", "children", "on", "click", "." ]
c4461168a58950130c904785e6e7386bcebdad09
https://github.com/gerardobort/node-corenlp/blob/c4461168a58950130c904785e6e7386bcebdad09/examples/browser/tree/tree.js#L225-L234
30,351
relution-io/relution-sdk
lib/core/cipher.js
encryptJson
function encryptJson(password, json) { return Q.all([ randomBytes(pbkdf2SaltLen), randomBytes(cipherIvLen) ]).spread(function (salt, iv) { return pbkdf2(password, salt, pbkdf2Iterations, pbkdf2KeyLen, pbkdf2Digest).then(function (key) { var cipher = crypto.createCipheriv(ciph...
javascript
function encryptJson(password, json) { return Q.all([ randomBytes(pbkdf2SaltLen), randomBytes(cipherIvLen) ]).spread(function (salt, iv) { return pbkdf2(password, salt, pbkdf2Iterations, pbkdf2KeyLen, pbkdf2Digest).then(function (key) { var cipher = crypto.createCipheriv(ciph...
[ "function", "encryptJson", "(", "password", ",", "json", ")", "{", "return", "Q", ".", "all", "(", "[", "randomBytes", "(", "pbkdf2SaltLen", ")", ",", "randomBytes", "(", "cipherIvLen", ")", "]", ")", ".", "spread", "(", "function", "(", "salt", ",", "...
encrypts a JSON object using a user-provided password. This method is suitable for human-entered passwords and not appropriate for machine generated passwords. Make sure to read regarding pbkdf2. @param password of a human. @param json to encode. @return encoded json data. @internal Not part of public API, exported ...
[ "encrypts", "a", "JSON", "object", "using", "a", "user", "-", "provided", "password", "." ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/lib/core/cipher.js#L52-L73
30,352
relution-io/relution-sdk
lib/core/cipher.js
decryptJson
function decryptJson(password, data) { var salt = new Buffer(data.salt, 'base64'); return pbkdf2(password, salt, pbkdf2Iterations, pbkdf2KeyLen, pbkdf2Digest).then(function (key) { var iv = new Buffer(data.iv, 'base64'); var decipher = crypto.createDecipheriv(cipherAlgorithm, key, iv); v...
javascript
function decryptJson(password, data) { var salt = new Buffer(data.salt, 'base64'); return pbkdf2(password, salt, pbkdf2Iterations, pbkdf2KeyLen, pbkdf2Digest).then(function (key) { var iv = new Buffer(data.iv, 'base64'); var decipher = crypto.createDecipheriv(cipherAlgorithm, key, iv); v...
[ "function", "decryptJson", "(", "password", ",", "data", ")", "{", "var", "salt", "=", "new", "Buffer", "(", "data", ".", "salt", ",", "'base64'", ")", ";", "return", "pbkdf2", "(", "password", ",", "salt", ",", "pbkdf2Iterations", ",", "pbkdf2KeyLen", "...
decrypts some encoded json data. @param password of a human. @param data encoded json data. @return json to decoded. @internal Not part of public API, exported for library use only.
[ "decrypts", "some", "encoded", "json", "data", "." ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/lib/core/cipher.js#L84-L97
30,353
banphlet/HubtelMobilePayment
lib/onlinecheckout.js
OnlineCheckout
function OnlineCheckout(body) { if (!body) throw new Error('No data provided') const config = this.config const hubtelurl = 'https://api.hubtel.com/v1/merchantaccount/onlinecheckout/invoice/create' const auth = 'Basic ' + Buffer.from(config.clientid + ':' + config.secretid).toString('base64') r...
javascript
function OnlineCheckout(body) { if (!body) throw new Error('No data provided') const config = this.config const hubtelurl = 'https://api.hubtel.com/v1/merchantaccount/onlinecheckout/invoice/create' const auth = 'Basic ' + Buffer.from(config.clientid + ':' + config.secretid).toString('base64') r...
[ "function", "OnlineCheckout", "(", "body", ")", "{", "if", "(", "!", "body", ")", "throw", "new", "Error", "(", "'No data provided'", ")", "const", "config", "=", "this", ".", "config", "const", "hubtelurl", "=", "'https://api.hubtel.com/v1/merchantaccount/onlinec...
Use Hubtel Online Checkout Service @param {object} body
[ "Use", "Hubtel", "Online", "Checkout", "Service" ]
6308e35e0d0c3a1567f94bfee3039f74eee8e480
https://github.com/banphlet/HubtelMobilePayment/blob/6308e35e0d0c3a1567f94bfee3039f74eee8e480/lib/onlinecheckout.js#L7-L25
30,354
canjs/can-query-logic
compat/compat.js
function(raw){ var clone = canReflect.serialize(raw); if(clone.page) { clone[offset] = clone.page.start; clone[limit] = (clone.page.end - clone.page.start) + 1; delete clone.page; } ...
javascript
function(raw){ var clone = canReflect.serialize(raw); if(clone.page) { clone[offset] = clone.page.start; clone[limit] = (clone.page.end - clone.page.start) + 1; delete clone.page; } ...
[ "function", "(", "raw", ")", "{", "var", "clone", "=", "canReflect", ".", "serialize", "(", "raw", ")", ";", "if", "(", "clone", ".", "page", ")", "{", "clone", "[", "offset", "]", "=", "clone", ".", "page", ".", "start", ";", "clone", "[", "limi...
taking the normal format and putting it back page.start -> start page.end -> end
[ "taking", "the", "normal", "format", "and", "putting", "it", "back", "page", ".", "start", "-", ">", "start", "page", ".", "end", "-", ">", "end" ]
fe32908e7aa36853362fbc1a4df276193247f38d
https://github.com/canjs/can-query-logic/blob/fe32908e7aa36853362fbc1a4df276193247f38d/compat/compat.js#L228-L236
30,355
saneki-discontinued/node-toxcore
lib/toxerror.js
ToxError
function ToxError(type, code, message) { this.name = "ToxError"; this.type = ( type || "ToxError" ); this.code = ( code || 0 ); // 0 = unsuccessful this.message = ( message || (this.type + ": " + this.code) ); Error.captureStackTrace(this, ToxError); }
javascript
function ToxError(type, code, message) { this.name = "ToxError"; this.type = ( type || "ToxError" ); this.code = ( code || 0 ); // 0 = unsuccessful this.message = ( message || (this.type + ": " + this.code) ); Error.captureStackTrace(this, ToxError); }
[ "function", "ToxError", "(", "type", ",", "code", ",", "message", ")", "{", "this", ".", "name", "=", "\"ToxError\"", ";", "this", ".", "type", "=", "(", "type", "||", "\"ToxError\"", ")", ";", "this", ".", "code", "=", "(", "code", "||", "0", ")",...
Creates a ToxError instance @class @param {String} type of error @param {Number} code of type @param {String} message of error
[ "Creates", "a", "ToxError", "instance" ]
45dfb339f4e8a58888fca175528dee13f075824a
https://github.com/saneki-discontinued/node-toxcore/blob/45dfb339f4e8a58888fca175528dee13f075824a/lib/toxerror.js#L30-L36
30,356
banphlet/HubtelMobilePayment
lib/checkstatus.js
CheckStatus
function CheckStatus(token) { if (!token) throw 'Invoice Token must be provided' const config = this.config const hubtelurl = `https://api.hubtel.com/v1/merchantaccount/onlinecheckout/invoice/status/${token}` const auth = 'Basic ' + Buffer.from(config.clientid + ':' + config.secretid).toString('base64'...
javascript
function CheckStatus(token) { if (!token) throw 'Invoice Token must be provided' const config = this.config const hubtelurl = `https://api.hubtel.com/v1/merchantaccount/onlinecheckout/invoice/status/${token}` const auth = 'Basic ' + Buffer.from(config.clientid + ':' + config.secretid).toString('base64'...
[ "function", "CheckStatus", "(", "token", ")", "{", "if", "(", "!", "token", ")", "throw", "'Invoice Token must be provided'", "const", "config", "=", "this", ".", "config", "const", "hubtelurl", "=", "`", "${", "token", "}", "`", "const", "auth", "=", "'Ba...
Check the Status of Hubtel online-checkout Transaction @param {String} token
[ "Check", "the", "Status", "of", "Hubtel", "online", "-", "checkout", "Transaction" ]
6308e35e0d0c3a1567f94bfee3039f74eee8e480
https://github.com/banphlet/HubtelMobilePayment/blob/6308e35e0d0c3a1567f94bfee3039f74eee8e480/lib/checkstatus.js#L7-L22
30,357
canjs/can-query-logic
src/serializers/basic-query.js
hydrateAndValue
function hydrateAndValue(value, prop, SchemaType, hydrateChild) { // The `SchemaType` is the type of value on `instances` of // the schema. `Instances` values are different from `Set` values. if (SchemaType) { // If there's a `SetType`, we will use that var SetType = SchemaType[setTypeSymbol]; if (SetType) { ...
javascript
function hydrateAndValue(value, prop, SchemaType, hydrateChild) { // The `SchemaType` is the type of value on `instances` of // the schema. `Instances` values are different from `Set` values. if (SchemaType) { // If there's a `SetType`, we will use that var SetType = SchemaType[setTypeSymbol]; if (SetType) { ...
[ "function", "hydrateAndValue", "(", "value", ",", "prop", ",", "SchemaType", ",", "hydrateChild", ")", "{", "// The `SchemaType` is the type of value on `instances` of", "// the schema. `Instances` values are different from `Set` values.", "if", "(", "SchemaType", ")", "{", "//...
This is used to hydrate a value directly within a `filter`'s And.
[ "This", "is", "used", "to", "hydrate", "a", "value", "directly", "within", "a", "filter", "s", "And", "." ]
fe32908e7aa36853362fbc1a4df276193247f38d
https://github.com/canjs/can-query-logic/blob/fe32908e7aa36853362fbc1a4df276193247f38d/src/serializers/basic-query.js#L40-L98
30,358
relution-io/relution-sdk
lib/livedata/SyncContext.spec.js
loadCollection
function loadCollection(collection, data) { return Q(collection.fetch()).then(function () { // delete all before running tests return Q.all(collection.models.slice().map(function (model) { return model.destroy(); })).then(function () { chai_1.a...
javascript
function loadCollection(collection, data) { return Q(collection.fetch()).then(function () { // delete all before running tests return Q.all(collection.models.slice().map(function (model) { return model.destroy(); })).then(function () { chai_1.a...
[ "function", "loadCollection", "(", "collection", ",", "data", ")", "{", "return", "Q", "(", "collection", ".", "fetch", "(", ")", ")", ".", "then", "(", "function", "(", ")", "{", "// delete all before running tests", "return", "Q", ".", "all", "(", "colle...
loads data using collection, returns promise on collection, collection is empty afterwards
[ "loads", "data", "using", "collection", "returns", "promise", "on", "collection", "collection", "is", "empty", "afterwards" ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/lib/livedata/SyncContext.spec.js#L71-L92
30,359
hhff/ember-chimp
addon/components/ember-chimp.js
endsWith
function endsWith(string, suffix) { return string.indexOf(suffix, string.length - suffix.length) !== -1; }
javascript
function endsWith(string, suffix) { return string.indexOf(suffix, string.length - suffix.length) !== -1; }
[ "function", "endsWith", "(", "string", ",", "suffix", ")", "{", "return", "string", ".", "indexOf", "(", "suffix", ",", "string", ".", "length", "-", "suffix", ".", "length", ")", "!==", "-", "1", ";", "}" ]
A utility method for checking the end of a string for a certain value. @method endsWith @param {String} string The string to check. @param {String} suffix The suffix to check the string for. @private @return {Boolean} A boolean that indicates whether the suffix is present.
[ "A", "utility", "method", "for", "checking", "the", "end", "of", "a", "string", "for", "a", "certain", "value", "." ]
796a737f58965f16ad574df19c44f77eca528df1
https://github.com/hhff/ember-chimp/blob/796a737f58965f16ad574df19c44f77eca528df1/addon/components/ember-chimp.js#L22-L24
30,360
peerigon/erroz
lib/defaultRenderer.js
defaultRenderer
function defaultRenderer(template, data) { return template.replace(/%\w+/g, function (match) { return data[match.slice(1)]; }); }
javascript
function defaultRenderer(template, data) { return template.replace(/%\w+/g, function (match) { return data[match.slice(1)]; }); }
[ "function", "defaultRenderer", "(", "template", ",", "data", ")", "{", "return", "template", ".", "replace", "(", "/", "%\\w+", "/", "g", ",", "function", "(", "match", ")", "{", "return", "data", "[", "match", ".", "slice", "(", "1", ")", "]", ";", ...
replaces all %placeHolder with data.placeHolder @param {String} template @param {Object} data @returns {String}
[ "replaces", "all", "%placeHolder", "with", "data", ".", "placeHolder" ]
57adf5fa7a86680da2c6460b81aaaceaa57db6bd
https://github.com/peerigon/erroz/blob/57adf5fa7a86680da2c6460b81aaaceaa57db6bd/lib/defaultRenderer.js#L10-L14
30,361
relution-io/relution-sdk
lib/core/objectid.js
makeObjectID
function makeObjectID() { return hexString(8, Date.now() / 1000) + hexString(6, machineId) + hexString(4, processId) + hexString(6, counter++); // a 3-byte counter, starting with a random value. }
javascript
function makeObjectID() { return hexString(8, Date.now() / 1000) + hexString(6, machineId) + hexString(4, processId) + hexString(6, counter++); // a 3-byte counter, starting with a random value. }
[ "function", "makeObjectID", "(", ")", "{", "return", "hexString", "(", "8", ",", "Date", ".", "now", "(", ")", "/", "1000", ")", "+", "hexString", "(", "6", ",", "machineId", ")", "+", "hexString", "(", "4", ",", "processId", ")", "+", "hexString", ...
random-based impl of Mongo ObjectID
[ "random", "-", "based", "impl", "of", "Mongo", "ObjectID" ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/lib/core/objectid.js#L36-L41
30,362
fergiemcdowall/search-index-adder
lib/delete.js
function (key) { if (key === undefined) { that.push({ key: 'DOCUMENT' + sep + docId + sep, lastPass: true }) return end() } that.options.indexes.get(key, function (err, val) { if (!err) { that.push({ key: key, value:...
javascript
function (key) { if (key === undefined) { that.push({ key: 'DOCUMENT' + sep + docId + sep, lastPass: true }) return end() } that.options.indexes.get(key, function (err, val) { if (!err) { that.push({ key: key, value:...
[ "function", "(", "key", ")", "{", "if", "(", "key", "===", "undefined", ")", "{", "that", ".", "push", "(", "{", "key", ":", "'DOCUMENT'", "+", "sep", "+", "docId", "+", "sep", ",", "lastPass", ":", "true", "}", ")", "return", "end", "(", ")", ...
get value from db and push it to the stream
[ "get", "value", "from", "db", "and", "push", "it", "to", "the", "stream" ]
5c0fc40fbff4bb4912a5e8ba542cb88a650efd11
https://github.com/fergiemcdowall/search-index-adder/blob/5c0fc40fbff4bb4912a5e8ba542cb88a650efd11/lib/delete.js#L43-L60
30,363
relution-io/relution-sdk
server/mongodb_rest.js
function(req, res, fromMessage) { var name = req.params.name; var doc = req.body; var id = this.toId(req.params.id || doc._id); if (typeof id === 'undefined' || id === '') { return res.send(400, "invalid id."); } doc._id = id; ...
javascript
function(req, res, fromMessage) { var name = req.params.name; var doc = req.body; var id = this.toId(req.params.id || doc._id); if (typeof id === 'undefined' || id === '') { return res.send(400, "invalid id."); } doc._id = id; ...
[ "function", "(", "req", ",", "res", ",", "fromMessage", ")", "{", "var", "name", "=", "req", ".", "params", ".", "name", ";", "var", "doc", "=", "req", ".", "body", ";", "var", "id", "=", "this", ".", "toId", "(", "req", ".", "params", ".", "id...
Update a document
[ "Update", "a", "document" ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/server/mongodb_rest.js#L185-L218
30,364
relution-io/relution-sdk
server/mongodb_rest.js
function(req, res, fromMessage) { var name = req.params.name; var id = this.toId(req.params.id); if (typeof id === 'undefined' || id === '') { return res.send(400, "invalid id."); } var doc = {}; doc._id = id; doc....
javascript
function(req, res, fromMessage) { var name = req.params.name; var id = this.toId(req.params.id); if (typeof id === 'undefined' || id === '') { return res.send(400, "invalid id."); } var doc = {}; doc._id = id; doc....
[ "function", "(", "req", ",", "res", ",", "fromMessage", ")", "{", "var", "name", "=", "req", ".", "params", ".", "name", ";", "var", "id", "=", "this", ".", "toId", "(", "req", ".", "params", ".", "id", ")", ";", "if", "(", "typeof", "id", "===...
Delete a contact
[ "Delete", "a", "contact" ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/server/mongodb_rest.js#L221-L267
30,365
relution-io/relution-sdk
server/mongodb_rest.js
function(entity, msg) { if (!msg._id) { msg._id = new ObjectID(); } var collection = new mongodb.Collection(this.db, "__msg__" + entity); if (msg.method === 'delete' && (msg.id === 'all' || msg.id === 'clean')) { collection.remove(function ...
javascript
function(entity, msg) { if (!msg._id) { msg._id = new ObjectID(); } var collection = new mongodb.Collection(this.db, "__msg__" + entity); if (msg.method === 'delete' && (msg.id === 'all' || msg.id === 'clean')) { collection.remove(function ...
[ "function", "(", "entity", ",", "msg", ")", "{", "if", "(", "!", "msg", ".", "_id", ")", "{", "msg", ".", "_id", "=", "new", "ObjectID", "(", ")", ";", "}", "var", "collection", "=", "new", "mongodb", ".", "Collection", "(", "this", ".", "db", ...
save a new change message
[ "save", "a", "new", "change", "message" ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/server/mongodb_rest.js#L270-L284
30,366
relution-io/relution-sdk
server/mongodb_rest.js
function(entity, time, callback) { var collection = new mongodb.Collection(this.db, "__msg__" + entity); time = parseInt(time); if (time || time === 0) { collection.ensureIndex( { time: 1, id: 1 }, { unique:true, background:true...
javascript
function(entity, time, callback) { var collection = new mongodb.Collection(this.db, "__msg__" + entity); time = parseInt(time); if (time || time === 0) { collection.ensureIndex( { time: 1, id: 1 }, { unique:true, background:true...
[ "function", "(", "entity", ",", "time", ",", "callback", ")", "{", "var", "collection", "=", "new", "mongodb", ".", "Collection", "(", "this", ".", "db", ",", "\"__msg__\"", "+", "entity", ")", ";", "time", "=", "parseInt", "(", "time", ")", ";", "if...
read the change message, since time
[ "read", "the", "change", "message", "since", "time" ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/server/mongodb_rest.js#L287-L322
30,367
relution-io/relution-sdk
lib/livedata/SyncEndpoint.js
hashCode
function hashCode() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i - 0] = arguments[_i]; } var hash = 0; for (var i = 0; i < args.length; ++i) { var str = args[i] || ''; for (var j = 0, l = str.length; j < l; ++j) { var char = str.charCod...
javascript
function hashCode() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i - 0] = arguments[_i]; } var hash = 0; for (var i = 0; i < args.length; ++i) { var str = args[i] || ''; for (var j = 0, l = str.length; j < l; ++j) { var char = str.charCod...
[ "function", "hashCode", "(", ")", "{", "var", "args", "=", "[", "]", ";", "for", "(", "var", "_i", "=", "0", ";", "_i", "<", "arguments", ".", "length", ";", "_i", "++", ")", "{", "args", "[", "_i", "-", "0", "]", "=", "arguments", "[", "_i",...
very simple hash coding implementation. @internal For library use only.
[ "very", "simple", "hash", "coding", "implementation", "." ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/lib/livedata/SyncEndpoint.js#L31-L46
30,368
flumedb/aligned-block-file
blocks.js
readInteger
function readInteger(width, reader) { return function (start, cb) { var i = Math.floor(start/block_size) var _i = start%block_size //if the UInt32BE aligns with in a block //read directly and it's 3x faster. if(_i < block_size - width) get(i, function (err, block) { ...
javascript
function readInteger(width, reader) { return function (start, cb) { var i = Math.floor(start/block_size) var _i = start%block_size //if the UInt32BE aligns with in a block //read directly and it's 3x faster. if(_i < block_size - width) get(i, function (err, block) { ...
[ "function", "readInteger", "(", "width", ",", "reader", ")", "{", "return", "function", "(", "start", ",", "cb", ")", "{", "var", "i", "=", "Math", ".", "floor", "(", "start", "/", "block_size", ")", "var", "_i", "=", "start", "%", "block_size", "//i...
start by reading the end of the last block. this must always be kept in memory.
[ "start", "by", "reading", "the", "end", "of", "the", "last", "block", ".", "this", "must", "always", "be", "kept", "in", "memory", "." ]
5361e46459f0836e2c8ec597d795c42a1a783d91
https://github.com/flumedb/aligned-block-file/blob/5361e46459f0836e2c8ec597d795c42a1a783d91/blocks.js#L85-L107
30,369
relution-io/relution-sdk
server/backend/routes/push.js
init
function init(app) { app.post('/api/v1/push/registration', /** * register the device on the push Service * * @param req containing body JSON to pass as input. * @param res result of call is provided as JSON body data. * @param next function to invoke error handling. */ function serv...
javascript
function init(app) { app.post('/api/v1/push/registration', /** * register the device on the push Service * * @param req containing body JSON to pass as input. * @param res result of call is provided as JSON body data. * @param next function to invoke error handling. */ function serv...
[ "function", "init", "(", "app", ")", "{", "app", ".", "post", "(", "'/api/v1/push/registration'", ",", "/**\n * register the device on the push Service\n *\n * @param req containing body JSON to pass as input.\n * @param res result of call is provided as JSON body data.\n * @p...
module providing direct access to push. registers a push target device. <p> The method attempts fetching an existing device using the metadata information given. This either works by providing a UUID or using heuristics based on information typically extracted using Cordova device plugin. The latter approach solves t...
[ "module", "providing", "direct", "access", "to", "push", "." ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/server/backend/routes/push.js#L24-L58
30,370
relution-io/relution-sdk
server/backend/routes/push.js
serviceCall
function serviceCall(req, res, next) { Q(pushService.registerPushDevice(req.body)).then(res.json.bind(res), next).done(); }
javascript
function serviceCall(req, res, next) { Q(pushService.registerPushDevice(req.body)).then(res.json.bind(res), next).done(); }
[ "function", "serviceCall", "(", "req", ",", "res", ",", "next", ")", "{", "Q", "(", "pushService", ".", "registerPushDevice", "(", "req", ".", "body", ")", ")", ".", "then", "(", "res", ".", "json", ".", "bind", "(", "res", ")", ",", "next", ")", ...
register the device on the push Service @param req containing body JSON to pass as input. @param res result of call is provided as JSON body data. @param next function to invoke error handling.
[ "register", "the", "device", "on", "the", "push", "Service" ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/server/backend/routes/push.js#L33-L35
30,371
syntax-tree/hast-util-to-parse5
index.js
patch
function patch(node, p5, parentSchema) { var schema = parentSchema var position = node.position var children = node.children var childNodes = [] var length = children ? children.length : 0 var index = -1 var child if (node.type === 'element') { if (schema.space === 'html' && node.tagName === 'svg')...
javascript
function patch(node, p5, parentSchema) { var schema = parentSchema var position = node.position var children = node.children var childNodes = [] var length = children ? children.length : 0 var index = -1 var child if (node.type === 'element') { if (schema.space === 'html' && node.tagName === 'svg')...
[ "function", "patch", "(", "node", ",", "p5", ",", "parentSchema", ")", "{", "var", "schema", "=", "parentSchema", "var", "position", "=", "node", ".", "position", "var", "children", "=", "node", ".", "children", "var", "childNodes", "=", "[", "]", "var",...
Patch specific properties.
[ "Patch", "specific", "properties", "." ]
d1a90057eca4a38986e94c2220b692531d678335
https://github.com/syntax-tree/hast-util-to-parse5/blob/d1a90057eca4a38986e94c2220b692531d678335/index.js#L112-L151
30,372
relution-io/relution-sdk
lib/web/urls.js
resolveServer
function resolveServer(path, options) { if (options === void 0) { options = {}; } var serverUrl = options.serverUrl || init.initOptions.serverUrl; if (path) { if (serverUrl) { path = url.resolve(serverUrl, path); } } else { path = serverUrl; } return url.r...
javascript
function resolveServer(path, options) { if (options === void 0) { options = {}; } var serverUrl = options.serverUrl || init.initOptions.serverUrl; if (path) { if (serverUrl) { path = url.resolve(serverUrl, path); } } else { path = serverUrl; } return url.r...
[ "function", "resolveServer", "(", "path", ",", "options", ")", "{", "if", "(", "options", "===", "void", "0", ")", "{", "options", "=", "{", "}", ";", "}", "var", "serverUrl", "=", "options", ".", "serverUrl", "||", "init", ".", "initOptions", ".", "...
computes a server url from a given path. @param path path to resolve, relative or absolute. @param options of server in effect. @return {string} absolute URL of server.
[ "computes", "a", "server", "url", "from", "a", "given", "path", "." ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/lib/web/urls.js#L36-L48
30,373
relution-io/relution-sdk
lib/web/urls.js
resolveUrl
function resolveUrl(path, options) { if (options === void 0) { options = {}; } var serverUrl = resolveServer(path, options); if (!serverUrl) { return path; } if (path.charAt(0) !== '/') { // construct full application url var tenantOrga = options.tenantOrga; if (!tena...
javascript
function resolveUrl(path, options) { if (options === void 0) { options = {}; } var serverUrl = resolveServer(path, options); if (!serverUrl) { return path; } if (path.charAt(0) !== '/') { // construct full application url var tenantOrga = options.tenantOrga; if (!tena...
[ "function", "resolveUrl", "(", "path", ",", "options", ")", "{", "if", "(", "options", "===", "void", "0", ")", "{", "options", "=", "{", "}", ";", "}", "var", "serverUrl", "=", "resolveServer", "(", "path", ",", "options", ")", ";", "if", "(", "!"...
computes a url from a given path. - absolute URLs are used as is, e.g. ``http://192.168.0.10:8080/mway/myapp/api/v1/some_endpoint`` stays as is, - machine-relative URLs beginning with ``/`` are resolved against the Relution server logged into, so that ``/gofer/.../rest/...``-style URLs work as expected, for example ``...
[ "computes", "a", "url", "from", "a", "given", "path", "." ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/lib/web/urls.js#L69-L98
30,374
relution-io/relution-sdk
lib/web/urls.js
resolveApp
function resolveApp(baseAliasOrNameOrApp, options) { if (options === void 0) { options = {}; } // defaults on arguments given var url; if (!baseAliasOrNameOrApp) { url = options.application || init.initOptions.application; } else if (_.isString(baseAliasOrNameOrApp)) { url = base...
javascript
function resolveApp(baseAliasOrNameOrApp, options) { if (options === void 0) { options = {}; } // defaults on arguments given var url; if (!baseAliasOrNameOrApp) { url = options.application || init.initOptions.application; } else if (_.isString(baseAliasOrNameOrApp)) { url = base...
[ "function", "resolveApp", "(", "baseAliasOrNameOrApp", ",", "options", ")", "{", "if", "(", "options", "===", "void", "0", ")", "{", "options", "=", "{", "}", ";", "}", "// defaults on arguments given", "var", "url", ";", "if", "(", "!", "baseAliasOrNameOrAp...
computes the basepath of a BaaS application. @param baseAliasOrNameOrApp baseAlias of application, may be name when baseAlias is not changed by developer or application metadata object of Relution server. @param options of server in effect. @return {string} absolute URL of application alias on current server.
[ "computes", "the", "basepath", "of", "a", "BaaS", "application", "." ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/lib/web/urls.js#L108-L127
30,375
relution-io/relution-sdk
lib/livedata/Store.js
isStore
function isStore(object) { if (!object || typeof object !== 'object') { return false; } else if ('isStore' in object) { diag.debug.assert(function () { return object.isStore === Store.prototype.isPrototypeOf(object); }); return object.isStore; } else { return Store.pr...
javascript
function isStore(object) { if (!object || typeof object !== 'object') { return false; } else if ('isStore' in object) { diag.debug.assert(function () { return object.isStore === Store.prototype.isPrototypeOf(object); }); return object.isStore; } else { return Store.pr...
[ "function", "isStore", "(", "object", ")", "{", "if", "(", "!", "object", "||", "typeof", "object", "!==", "'object'", ")", "{", "return", "false", ";", "}", "else", "if", "(", "'isStore'", "in", "object", ")", "{", "diag", ".", "debug", ".", "assert...
tests whether a given object is a Store. @param {object} object to check. @return {boolean} whether object is a Store.
[ "tests", "whether", "a", "given", "object", "is", "a", "Store", "." ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/lib/livedata/Store.js#L37-L48
30,376
swagen/swagen
lib/utils.js
loadConfig
function loadConfig(justJson) { if (!justJson) { const configScript = path.resolve(currentDir, configScriptFileName); if (fs.existsSync(configScript)) { return require(configScript); } } const configJson = path.resolve(currentDir, configJsonFileName); if (fs.existsSy...
javascript
function loadConfig(justJson) { if (!justJson) { const configScript = path.resolve(currentDir, configScriptFileName); if (fs.existsSync(configScript)) { return require(configScript); } } const configJson = path.resolve(currentDir, configJsonFileName); if (fs.existsSy...
[ "function", "loadConfig", "(", "justJson", ")", "{", "if", "(", "!", "justJson", ")", "{", "const", "configScript", "=", "path", ".", "resolve", "(", "currentDir", ",", "configScriptFileName", ")", ";", "if", "(", "fs", ".", "existsSync", "(", "configScrip...
Loads the correct configuration from the current directory. @returns {Object} Configuration object
[ "Loads", "the", "correct", "configuration", "from", "the", "current", "directory", "." ]
cd8b032942d9fa9184243012ceecfeb179948340
https://github.com/swagen/swagen/blob/cd8b032942d9fa9184243012ceecfeb179948340/lib/utils.js#L39-L62
30,377
relution-io/relution-sdk
server/backend/routes/connectors.js
init
function init(app) { app.post('/api/v1/connectors/:connection', /** * installs session data such as credentials. * * @param req containing body JSON to pass as input. * @param res result of call is provided as JSON body data. * @param next function to invoke error handling. */ ...
javascript
function init(app) { app.post('/api/v1/connectors/:connection', /** * installs session data such as credentials. * * @param req containing body JSON to pass as input. * @param res result of call is provided as JSON body data. * @param next function to invoke error handling. */ ...
[ "function", "init", "(", "app", ")", "{", "app", ".", "post", "(", "'/api/v1/connectors/:connection'", ",", "/**\n * installs session data such as credentials.\n *\n * @param req containing body JSON to pass as input.\n * @param res result of call is provided as JSON body dat...
module providing direct access to connectors. Used by Relution SDK connectors module for direct access to backend servers. If you do not want or need this functionality, the routes defined herein can be removed. @param app express.js application to hook into.
[ "module", "providing", "direct", "access", "to", "connectors", "." ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/server/backend/routes/connectors.js#L16-L40
30,378
relution-io/relution-sdk
server/backend/routes/connectors.js
serviceCall
function serviceCall(req, res, next) { connector.configureSession(req.params.connection, req.body); res.send(204); // success --> 204 no content }
javascript
function serviceCall(req, res, next) { connector.configureSession(req.params.connection, req.body); res.send(204); // success --> 204 no content }
[ "function", "serviceCall", "(", "req", ",", "res", ",", "next", ")", "{", "connector", ".", "configureSession", "(", "req", ".", "params", ".", "connection", ",", "req", ".", "body", ")", ";", "res", ".", "send", "(", "204", ")", ";", "// success --> 2...
installs session data such as credentials. @param req containing body JSON to pass as input. @param res result of call is provided as JSON body data. @param next function to invoke error handling.
[ "installs", "session", "data", "such", "as", "credentials", "." ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/server/backend/routes/connectors.js#L25-L28
30,379
relution-io/relution-sdk
server/backend/routes/connectors.js
serviceCall
function serviceCall(req, res, next) { connector.runCall(req.params.connection, req.params.call, req.body).then(res.json.bind(res), next).done(); }
javascript
function serviceCall(req, res, next) { connector.runCall(req.params.connection, req.params.call, req.body).then(res.json.bind(res), next).done(); }
[ "function", "serviceCall", "(", "req", ",", "res", ",", "next", ")", "{", "connector", ".", "runCall", "(", "req", ".", "params", ".", "connection", ",", "req", ".", "params", ".", "call", ",", "req", ".", "body", ")", ".", "then", "(", "res", ".",...
calls directly into a service connection. @param req containing body JSON to pass as input. @param res result of call is provided as JSON body data. @param next function to invoke error handling.
[ "calls", "directly", "into", "a", "service", "connection", "." ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/server/backend/routes/connectors.js#L37-L39
30,380
saneki-discontinued/node-toxcore
examples/bin/old/promises-example.js
function(callback) { // Asynchronously set our name and status message using promises Promise.join( tox.setNameAsync('Bluebird'), tox.setStatusMessageAsync('Some status message') ).then(function() { console.log('Successfully set name and status message!'); callback(); }).catch(function(err) { ...
javascript
function(callback) { // Asynchronously set our name and status message using promises Promise.join( tox.setNameAsync('Bluebird'), tox.setStatusMessageAsync('Some status message') ).then(function() { console.log('Successfully set name and status message!'); callback(); }).catch(function(err) { ...
[ "function", "(", "callback", ")", "{", "// Asynchronously set our name and status message using promises", "Promise", ".", "join", "(", "tox", ".", "setNameAsync", "(", "'Bluebird'", ")", ",", "tox", ".", "setStatusMessageAsync", "(", "'Some status message'", ")", ")", ...
Initialize ourself. Sets name and status message. @private
[ "Initialize", "ourself", ".", "Sets", "name", "and", "status", "message", "." ]
45dfb339f4e8a58888fca175528dee13f075824a
https://github.com/saneki-discontinued/node-toxcore/blob/45dfb339f4e8a58888fca175528dee13f075824a/examples/bin/old/promises-example.js#L72-L84
30,381
saneki-discontinued/node-toxcore
examples/bin/old/promises-example.js
function(callback) { tox.on('friendRequest', function(evt) { console.log('Accepting friend request from ' + evt.publicKeyHex()); // Automatically accept the request tox.addFriendNoRequestAsync(evt.publicKey()).then(function() { console.log('Successfully accepted the friend request!'); }).catch(f...
javascript
function(callback) { tox.on('friendRequest', function(evt) { console.log('Accepting friend request from ' + evt.publicKeyHex()); // Automatically accept the request tox.addFriendNoRequestAsync(evt.publicKey()).then(function() { console.log('Successfully accepted the friend request!'); }).catch(f...
[ "function", "(", "callback", ")", "{", "tox", ".", "on", "(", "'friendRequest'", ",", "function", "(", "evt", ")", "{", "console", ".", "log", "(", "'Accepting friend request from '", "+", "evt", ".", "publicKeyHex", "(", ")", ")", ";", "// Automatically acc...
Initialize our callbacks, listening for friend requests and messages.
[ "Initialize", "our", "callbacks", "listening", "for", "friend", "requests", "and", "messages", "." ]
45dfb339f4e8a58888fca175528dee13f075824a
https://github.com/saneki-discontinued/node-toxcore/blob/45dfb339f4e8a58888fca175528dee13f075824a/examples/bin/old/promises-example.js#L89-L124
30,382
saneki-discontinued/node-toxcore
examples/bin/old/promises-example.js
function(callback) { async.parallelAsync([ tox.addGroupchat.bind(tox), tox.getAV().addGroupchat.bind(tox.getAV()) ]).then(function(results) { groupchats['text'] = results[0]; groupchats['av'] = results[1]; }).finally(callback); }
javascript
function(callback) { async.parallelAsync([ tox.addGroupchat.bind(tox), tox.getAV().addGroupchat.bind(tox.getAV()) ]).then(function(results) { groupchats['text'] = results[0]; groupchats['av'] = results[1]; }).finally(callback); }
[ "function", "(", "callback", ")", "{", "async", ".", "parallelAsync", "(", "[", "tox", ".", "addGroupchat", ".", "bind", "(", "tox", ")", ",", "tox", ".", "getAV", "(", ")", ".", "addGroupchat", ".", "bind", "(", "tox", ".", "getAV", "(", ")", ")",...
Initialize the groupchats, and call the callback when finished.
[ "Initialize", "the", "groupchats", "and", "call", "the", "callback", "when", "finished", "." ]
45dfb339f4e8a58888fca175528dee13f075824a
https://github.com/saneki-discontinued/node-toxcore/blob/45dfb339f4e8a58888fca175528dee13f075824a/examples/bin/old/promises-example.js#L129-L137
30,383
swagen/swagen
cli.js
handleCommandError
function handleCommandError(ex) { // If the command throws an exception, display the error message and command help. if (ex instanceof Error) { console.log(chalk.red(ex.message)); } else { console.log(chalk.red(ex)); } console.log(); const helpArgs = { _: [command] };...
javascript
function handleCommandError(ex) { // If the command throws an exception, display the error message and command help. if (ex instanceof Error) { console.log(chalk.red(ex.message)); } else { console.log(chalk.red(ex)); } console.log(); const helpArgs = { _: [command] };...
[ "function", "handleCommandError", "(", "ex", ")", "{", "// If the command throws an exception, display the error message and command help.", "if", "(", "ex", "instanceof", "Error", ")", "{", "console", ".", "log", "(", "chalk", ".", "red", "(", "ex", ".", "message", ...
If the command throws an exception, display the error message and command help @param {*} ex The thrown exception
[ "If", "the", "command", "throws", "an", "exception", "display", "the", "error", "message", "and", "command", "help" ]
cd8b032942d9fa9184243012ceecfeb179948340
https://github.com/swagen/swagen/blob/cd8b032942d9fa9184243012ceecfeb179948340/cli.js#L57-L69
30,384
saneki-discontinued/node-toxcore
lib/old/toxencryptsave.js
function(tox, opts) { // If one argument and not tox, assume opts if(arguments.length === 1 && !(tox instanceof Tox)) { opts = tox; tox = undefined; } if(!(tox instanceof Tox)) { tox = undefined; //var err = new Error('Tox instance required for ToxEncryptSave'); //throw err; } if(!opts...
javascript
function(tox, opts) { // If one argument and not tox, assume opts if(arguments.length === 1 && !(tox instanceof Tox)) { opts = tox; tox = undefined; } if(!(tox instanceof Tox)) { tox = undefined; //var err = new Error('Tox instance required for ToxEncryptSave'); //throw err; } if(!opts...
[ "function", "(", "tox", ",", "opts", ")", "{", "// If one argument and not tox, assume opts", "if", "(", "arguments", ".", "length", "===", "1", "&&", "!", "(", "tox", "instanceof", "Tox", ")", ")", "{", "opts", "=", "tox", ";", "tox", "=", "undefined", ...
Construct a new ToxEncryptSave. @class @param {Tox} [tox] Tox instance @param {Object} [opts] Options @param {String} [opts.path] toxencryptsave library path, will use the default if not specified @param {Boolean} [opts.sync=true] If true, will have async methods behave like sync methods if no callback given
[ "Construct", "a", "new", "ToxEncryptSave", "." ]
45dfb339f4e8a58888fca175528dee13f075824a
https://github.com/saneki-discontinued/node-toxcore/blob/45dfb339f4e8a58888fca175528dee13f075824a/lib/old/toxencryptsave.js#L47-L74
30,385
banphlet/HubtelMobilePayment
index.js
HubtelMobilePayment
function HubtelMobilePayment({ secretid = required('secretid'), clientid = required('clientid'), merchantaccnumber = required('merchantaccnumber'), }) { this.config = {} this.config['clientid'] = clientid this.config['secretid'] = secretid this.config['merchantaccnumber'] = merchantaccnumber this.hubtel...
javascript
function HubtelMobilePayment({ secretid = required('secretid'), clientid = required('clientid'), merchantaccnumber = required('merchantaccnumber'), }) { this.config = {} this.config['clientid'] = clientid this.config['secretid'] = secretid this.config['merchantaccnumber'] = merchantaccnumber this.hubtel...
[ "function", "HubtelMobilePayment", "(", "{", "secretid", "=", "required", "(", "'secretid'", ")", ",", "clientid", "=", "required", "(", "'clientid'", ")", ",", "merchantaccnumber", "=", "required", "(", "'merchantaccnumber'", ")", ",", "}", ")", "{", "this", ...
Set up Hubtel authentication @param {object} data
[ "Set", "up", "Hubtel", "authentication" ]
6308e35e0d0c3a1567f94bfee3039f74eee8e480
https://github.com/banphlet/HubtelMobilePayment/blob/6308e35e0d0c3a1567f94bfee3039f74eee8e480/index.js#L13-L23
30,386
silvermine/eslint-plugin-silvermine
lib/rules/brace-style.js
validateCurlyPair
function validateCurlyPair(openingCurly, closingCurly) { const tokenBeforeOpeningCurly = sourceCode.getTokenBefore(openingCurly), tokenAfterOpeningCurly = sourceCode.getTokenAfter(openingCurly), tokenBeforeClosingCurly = sourceCode.getTokenBefore(closingCurly), sing...
javascript
function validateCurlyPair(openingCurly, closingCurly) { const tokenBeforeOpeningCurly = sourceCode.getTokenBefore(openingCurly), tokenAfterOpeningCurly = sourceCode.getTokenAfter(openingCurly), tokenBeforeClosingCurly = sourceCode.getTokenBefore(closingCurly), sing...
[ "function", "validateCurlyPair", "(", "openingCurly", ",", "closingCurly", ")", "{", "const", "tokenBeforeOpeningCurly", "=", "sourceCode", ".", "getTokenBefore", "(", "openingCurly", ")", ",", "tokenAfterOpeningCurly", "=", "sourceCode", ".", "getTokenAfter", "(", "o...
Validates a pair of curly brackets based on the user's config @param {Token} openingCurly The opening curly bracket @param {Token} closingCurly The closing curly bracket @returns {void}
[ "Validates", "a", "pair", "of", "curly", "brackets", "based", "on", "the", "user", "s", "config" ]
2eac37fcaa4cfa86ad7a36793e4a8908e90bfbb6
https://github.com/silvermine/eslint-plugin-silvermine/blob/2eac37fcaa4cfa86ad7a36793e4a8908e90bfbb6/lib/rules/brace-style.js#L97-L137
30,387
relution-io/relution-sdk
lib/livedata/Model.js
isModel
function isModel(object) { if (!object || typeof object !== 'object') { return false; } else if ('isModel' in object) { diag.debug.assert(function () { return object.isModel === Model.prototype.isPrototypeOf(object); }); return object.isModel; } else { return Model.pr...
javascript
function isModel(object) { if (!object || typeof object !== 'object') { return false; } else if ('isModel' in object) { diag.debug.assert(function () { return object.isModel === Model.prototype.isPrototypeOf(object); }); return object.isModel; } else { return Model.pr...
[ "function", "isModel", "(", "object", ")", "{", "if", "(", "!", "object", "||", "typeof", "object", "!==", "'object'", ")", "{", "return", "false", ";", "}", "else", "if", "(", "'isModel'", "in", "object", ")", "{", "diag", ".", "debug", ".", "assert...
tests whether a given object is a Model. @param {object} object to check. @return {boolean} whether object is a Model.
[ "tests", "whether", "a", "given", "object", "is", "a", "Model", "." ]
776b8bd0c249428add03f97ba2d19092e709bc7b
https://github.com/relution-io/relution-sdk/blob/776b8bd0c249428add03f97ba2d19092e709bc7b/lib/livedata/Model.js#L40-L51
30,388
saneki-discontinued/node-toxcore
examples/bin/dns-example.js
function(dnsaddr) { var domain = getAddressDomain(dnsaddr); if(domain !== undefined && clients[domain] !== undefined) return clients[domain]; }
javascript
function(dnsaddr) { var domain = getAddressDomain(dnsaddr); if(domain !== undefined && clients[domain] !== undefined) return clients[domain]; }
[ "function", "(", "dnsaddr", ")", "{", "var", "domain", "=", "getAddressDomain", "(", "dnsaddr", ")", ";", "if", "(", "domain", "!==", "undefined", "&&", "clients", "[", "domain", "]", "!==", "undefined", ")", "return", "clients", "[", "domain", "]", ";",...
Get the ToxDns client for a specific address. @param {String} dnsaddr - Address (ex. 'user@toxme.io') @return {ToxDns} client to use for the given address, or undefined if none for the address domain
[ "Get", "the", "ToxDns", "client", "for", "a", "specific", "address", "." ]
45dfb339f4e8a58888fca175528dee13f075824a
https://github.com/saneki-discontinued/node-toxcore/blob/45dfb339f4e8a58888fca175528dee13f075824a/examples/bin/dns-example.js#L47-L51
30,389
saneki-discontinued/node-toxcore
lib/toxdns.js
function(opts) { if(!opts) opts = {}; var libpath = opts['path']; var key = opts['key']; this._library = this._createLibrary(libpath); this._initKey(key); this._initHandle(this._key); }
javascript
function(opts) { if(!opts) opts = {}; var libpath = opts['path']; var key = opts['key']; this._library = this._createLibrary(libpath); this._initKey(key); this._initHandle(this._key); }
[ "function", "(", "opts", ")", "{", "if", "(", "!", "opts", ")", "opts", "=", "{", "}", ";", "var", "libpath", "=", "opts", "[", "'path'", "]", ";", "var", "key", "=", "opts", "[", "'key'", "]", ";", "this", ".", "_library", "=", "this", ".", ...
Creates a ToxDns instance. @class @param {Object} [opts] Options @param {String} [opts.path] Path to libtoxdns.so @param {(Buffer|String)} [opts.key] Public key of ToxDns3 service
[ "Creates", "a", "ToxDns", "instance", "." ]
45dfb339f4e8a58888fca175528dee13f075824a
https://github.com/saneki-discontinued/node-toxcore/blob/45dfb339f4e8a58888fca175528dee13f075824a/lib/toxdns.js#L50-L58
30,390
canjs/can-query-logic
src/types/values-not.js
function(not, primitive){ // NOT(5) U 5 if( set.isEqual( not.value, primitive) ) { return set.UNIVERSAL; } // NOT(4) U 6 else { throw new Error("Not,Identity Union is not filled out"); } }
javascript
function(not, primitive){ // NOT(5) U 5 if( set.isEqual( not.value, primitive) ) { return set.UNIVERSAL; } // NOT(4) U 6 else { throw new Error("Not,Identity Union is not filled out"); } }
[ "function", "(", "not", ",", "primitive", ")", "{", "// NOT(5) U 5", "if", "(", "set", ".", "isEqual", "(", "not", ".", "value", ",", "primitive", ")", ")", "{", "return", "set", ".", "UNIVERSAL", ";", "}", "// NOT(4) U 6", "else", "{", "throw", "new",...
not 5 and not 6
[ "not", "5", "and", "not", "6" ]
fe32908e7aa36853362fbc1a4df276193247f38d
https://github.com/canjs/can-query-logic/blob/fe32908e7aa36853362fbc1a4df276193247f38d/src/types/values-not.js#L49-L58
30,391
dalekjs/dalek-internal-webdriver
lib/driver.js
function (url, options) { return Object.keys(options).reduce(this._replacePlaceholderInUrl.bind(this, options), url); }
javascript
function (url, options) { return Object.keys(options).reduce(this._replacePlaceholderInUrl.bind(this, options), url); }
[ "function", "(", "url", ",", "options", ")", "{", "return", "Object", ".", "keys", "(", "options", ")", ".", "reduce", "(", "this", ".", "_replacePlaceholderInUrl", ".", "bind", "(", "this", ",", "options", ")", ",", "url", ")", ";", "}" ]
Parses an JSON Wire protocol dummy url @method parseUrl @param {string} url URL with placeholders @param {object} options List of url options @return {string} url Parsed URL
[ "Parses", "an", "JSON", "Wire", "protocol", "dummy", "url" ]
1b857e99f0ef5d045f355eabcf991378ed98279c
https://github.com/dalekjs/dalek-internal-webdriver/blob/1b857e99f0ef5d045f355eabcf991378ed98279c/lib/driver.js#L53-L55
30,392
dalekjs/dalek-internal-webdriver
lib/driver.js
function (options, cb, wd, params) { // if no cb is given, generate a body with the `desiredCapabilities` object if (!cb) { // check if we have parameters set up if (Object.keys(params).length > 0) { return JSON.stringify(params); } return ''; } // invo...
javascript
function (options, cb, wd, params) { // if no cb is given, generate a body with the `desiredCapabilities` object if (!cb) { // check if we have parameters set up if (Object.keys(params).length > 0) { return JSON.stringify(params); } return ''; } // invo...
[ "function", "(", "options", ",", "cb", ",", "wd", ",", "params", ")", "{", "// if no cb is given, generate a body with the `desiredCapabilities` object", "if", "(", "!", "cb", ")", "{", "// check if we have parameters set up", "if", "(", "Object", ".", "keys", "(", ...
Generates the message body for webdriver client requests of type POST @method generateBody @param {object} options Browser options (name, bin path, etc.) @param {function|undefined} cb Callback function that should be invoked to generate the message body @param {Dalek.Internal.Webdriver} wd Webdriver base object @para...
[ "Generates", "the", "message", "body", "for", "webdriver", "client", "requests", "of", "type", "POST" ]
1b857e99f0ef5d045f355eabcf991378ed98279c
https://github.com/dalekjs/dalek-internal-webdriver/blob/1b857e99f0ef5d045f355eabcf991378ed98279c/lib/driver.js#L113-L126
30,393
dalekjs/dalek-internal-webdriver
lib/driver.js
function (hostname, port, prefix, url, method, body, auth) { var options = { hostname: hostname, port: port, path: prefix + url, method: method, headers: { 'Content-Type': 'application/json;charset=utf-8', 'Content-Length': Buffer.byteLength(body, 'utf8'...
javascript
function (hostname, port, prefix, url, method, body, auth) { var options = { hostname: hostname, port: port, path: prefix + url, method: method, headers: { 'Content-Type': 'application/json;charset=utf-8', 'Content-Length': Buffer.byteLength(body, 'utf8'...
[ "function", "(", "hostname", ",", "port", ",", "prefix", ",", "url", ",", "method", ",", "body", ",", "auth", ")", "{", "var", "options", "=", "{", "hostname", ":", "hostname", ",", "port", ":", "port", ",", "path", ":", "prefix", "+", "url", ",", ...
Generates the request options for a webdriver client request @method generateRequestOptions @param {string} hostname Hostname of the webdriver server @param {integer} port Port of the webdriver server @param {string} prefix Url address prefix of the webdriver endpoint @param {string} url Url of the webdriver method @p...
[ "Generates", "the", "request", "options", "for", "a", "webdriver", "client", "request" ]
1b857e99f0ef5d045f355eabcf991378ed98279c
https://github.com/dalekjs/dalek-internal-webdriver/blob/1b857e99f0ef5d045f355eabcf991378ed98279c/lib/driver.js#L141-L159
30,394
dalekjs/dalek-internal-webdriver
lib/driver.js
function (remote, driver) { return function webdriverCommand() { var deferred = Q.defer(); // the request meta data var params = Driver.generateParamset(remote.params, arguments); var body = Driver.generateBody({}, remote.onRequest, this, params); var options = Driver.gener...
javascript
function (remote, driver) { return function webdriverCommand() { var deferred = Q.defer(); // the request meta data var params = Driver.generateParamset(remote.params, arguments); var body = Driver.generateBody({}, remote.onRequest, this, params); var options = Driver.gener...
[ "function", "(", "remote", ",", "driver", ")", "{", "return", "function", "webdriverCommand", "(", ")", "{", "var", "deferred", "=", "Q", ".", "defer", "(", ")", ";", "// the request meta data", "var", "params", "=", "Driver", ".", "generateParamset", "(", ...
Generates the webdriver callback function @method _generateWebdriverCommand @param {object} remote Dummy request body (function name, url, method) @param {DalekJs.Internal.Driver} driver Driver instance @return {function} webdriverCommand Generated webdriver command function @private
[ "Generates", "the", "webdriver", "callback", "function" ]
1b857e99f0ef5d045f355eabcf991378ed98279c
https://github.com/dalekjs/dalek-internal-webdriver/blob/1b857e99f0ef5d045f355eabcf991378ed98279c/lib/driver.js#L188-L203
30,395
dalekjs/dalek-internal-webdriver
lib/driver.js
function (driver, remote, options, deferred, response) { this.data = ''; response.on('data', driver._concatDataChunks.bind(this)); response.on('end', driver._onResponseEnd.bind(this, driver, response, remote, options, deferred)); return this; }
javascript
function (driver, remote, options, deferred, response) { this.data = ''; response.on('data', driver._concatDataChunks.bind(this)); response.on('end', driver._onResponseEnd.bind(this, driver, response, remote, options, deferred)); return this; }
[ "function", "(", "driver", ",", "remote", ",", "options", ",", "deferred", ",", "response", ")", "{", "this", ".", "data", "=", "''", ";", "response", ".", "on", "(", "'data'", ",", "driver", ".", "_concatDataChunks", ".", "bind", "(", "this", ")", "...
Response callback function @method _onResponse @param {DalekJs.Internal.Driver} driver Driver instance @param {object} remote Dummy request body (function name, url, method) @param {object} options Request options (method, port, path, headers, etc.) @param {object} deferred Webdriver command deferred @param {object} r...
[ "Response", "callback", "function" ]
1b857e99f0ef5d045f355eabcf991378ed98279c
https://github.com/dalekjs/dalek-internal-webdriver/blob/1b857e99f0ef5d045f355eabcf991378ed98279c/lib/driver.js#L218-L223
30,396
dalekjs/dalek-internal-webdriver
lib/driver.js
function (driver, response, remote, options, deferred) { return driver[(response.statusCode === 500 ? '_onError' : '_onSuccess')].bind(this)(driver, response, remote, options, deferred); }
javascript
function (driver, response, remote, options, deferred) { return driver[(response.statusCode === 500 ? '_onError' : '_onSuccess')].bind(this)(driver, response, remote, options, deferred); }
[ "function", "(", "driver", ",", "response", ",", "remote", ",", "options", ",", "deferred", ")", "{", "return", "driver", "[", "(", "response", ".", "statusCode", "===", "500", "?", "'_onError'", ":", "'_onSuccess'", ")", "]", ".", "bind", "(", "this", ...
Response end callback function @method _onResponseEnd @param {DalekJs.Internal.Driver} driver Driver instance @param {object} response Response from the webdriver server @param {object} remote Dummy request body (function name, url, method) @param {object} options Request options (method, port, path, headers, etc.) @p...
[ "Response", "end", "callback", "function" ]
1b857e99f0ef5d045f355eabcf991378ed98279c
https://github.com/dalekjs/dalek-internal-webdriver/blob/1b857e99f0ef5d045f355eabcf991378ed98279c/lib/driver.js#L251-L253
30,397
dalekjs/dalek-internal-webdriver
lib/driver.js
function (driver, response, remote, options, deferred) { // Provide a default error handler to prevent hangs. if (!remote.onError) { remote.onError = function (request, remote, options, deferred, data) { data = JSON.parse(data); var value = -1; if (typeof data.value.mes...
javascript
function (driver, response, remote, options, deferred) { // Provide a default error handler to prevent hangs. if (!remote.onError) { remote.onError = function (request, remote, options, deferred, data) { data = JSON.parse(data); var value = -1; if (typeof data.value.mes...
[ "function", "(", "driver", ",", "response", ",", "remote", ",", "options", ",", "deferred", ")", "{", "// Provide a default error handler to prevent hangs.", "if", "(", "!", "remote", ".", "onError", ")", "{", "remote", ".", "onError", "=", "function", "(", "r...
On error callback function @method _onError @param {DalekJs.Internal.Driver} driver Driver instance @param {object} response Response from the webdriver server @param {object} remote Dummy request body (function name, url, method) @param {object} options Request options (method, port, path, headers, etc.) @param {obje...
[ "On", "error", "callback", "function" ]
1b857e99f0ef5d045f355eabcf991378ed98279c
https://github.com/dalekjs/dalek-internal-webdriver/blob/1b857e99f0ef5d045f355eabcf991378ed98279c/lib/driver.js#L268-L283
30,398
dalekjs/dalek-internal-webdriver
lib/driver.js
function (driver, response, remote, options, deferred) { // log response data this.events.emit('driver:webdriver:response', { statusCode: response.statusCode, method: response.req.method, path: response.req.path, data: this.data }); if (remote.onResponse) {...
javascript
function (driver, response, remote, options, deferred) { // log response data this.events.emit('driver:webdriver:response', { statusCode: response.statusCode, method: response.req.method, path: response.req.path, data: this.data }); if (remote.onResponse) {...
[ "function", "(", "driver", ",", "response", ",", "remote", ",", "options", ",", "deferred", ")", "{", "// log response data", "this", ".", "events", ".", "emit", "(", "'driver:webdriver:response'", ",", "{", "statusCode", ":", "response", ".", "statusCode", ",...
On success callback function @method _onSuccess @param {DalekJs.Internal.Driver} driver Driver instance @param {object} response Response from the webdriver server @param {object} remote Dummy request body (function name, url, method) @param {object} options Request options (method, port, path, headers, etc.) @param {...
[ "On", "success", "callback", "function" ]
1b857e99f0ef5d045f355eabcf991378ed98279c
https://github.com/dalekjs/dalek-internal-webdriver/blob/1b857e99f0ef5d045f355eabcf991378ed98279c/lib/driver.js#L298-L313
30,399
swagen/swagen
lib/generate/index.js
handleFileSwagger
function handleFileSwagger(profile, profileKey) { const inputFilePath = path.resolve(currentDir, profile.file); console.log(chalk`{green [${profileKey}]} Input swagger file : {cyan ${inputFilePath}}`); fs.readFile(inputFilePath, 'utf8', (error, swagger) => { if (error) { console.log(chal...
javascript
function handleFileSwagger(profile, profileKey) { const inputFilePath = path.resolve(currentDir, profile.file); console.log(chalk`{green [${profileKey}]} Input swagger file : {cyan ${inputFilePath}}`); fs.readFile(inputFilePath, 'utf8', (error, swagger) => { if (error) { console.log(chal...
[ "function", "handleFileSwagger", "(", "profile", ",", "profileKey", ")", "{", "const", "inputFilePath", "=", "path", ".", "resolve", "(", "currentDir", ",", "profile", ".", "file", ")", ";", "console", ".", "log", "(", "chalk", "`", "${", "profileKey", "}"...
Reads the swagger json from a file specified in the profile. @param {Profile} profile - The profile being handled. @param {String} profileKey - The name of the profile.
[ "Reads", "the", "swagger", "json", "from", "a", "file", "specified", "in", "the", "profile", "." ]
cd8b032942d9fa9184243012ceecfeb179948340
https://github.com/swagen/swagen/blob/cd8b032942d9fa9184243012ceecfeb179948340/lib/generate/index.js#L73-L84