repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
HumanBrainProject/jsdoc-sphinx | template/util/rst-mixin.js | titlecase | function titlecase() {
return function(data, render) {
var text = render(data);
if (text.length === 0) {
return text;
}
return text[0].toUpperCase() + text.substring(1);
};
} | javascript | function titlecase() {
return function(data, render) {
var text = render(data);
if (text.length === 0) {
return text;
}
return text[0].toUpperCase() + text.substring(1);
};
} | [
"function",
"titlecase",
"(",
")",
"{",
"return",
"function",
"(",
"data",
",",
"render",
")",
"{",
"var",
"text",
"=",
"render",
"(",
"data",
")",
";",
"if",
"(",
"text",
".",
"length",
"===",
"0",
")",
"{",
"return",
"text",
";",
"}",
"return",
... | Mustache lambda that upercase the first letter
of each word in the given data.
@return {function} the titlecase helper function | [
"Mustache",
"lambda",
"that",
"upercase",
"the",
"first",
"letter",
"of",
"each",
"word",
"in",
"the",
"given",
"data",
"."
] | 9d7c1d318ce535640588e7308917729c3849bc83 | https://github.com/HumanBrainProject/jsdoc-sphinx/blob/9d7c1d318ce535640588e7308917729c3849bc83/template/util/rst-mixin.js#L19-L28 | train |
HumanBrainProject/jsdoc-sphinx | template/util/rst-mixin.js | generateHeading | function generateHeading() {
var mixin = {};
// If two char are provided, first one is used as upperline of the text.
_.each(['==', '=', '-', '~', '\''], function(char, idx) {
// Mustach lambda function takes no parameters and return a function
// whose signature is data, render.
// see https://mustac... | javascript | function generateHeading() {
var mixin = {};
// If two char are provided, first one is used as upperline of the text.
_.each(['==', '=', '-', '~', '\''], function(char, idx) {
// Mustach lambda function takes no parameters and return a function
// whose signature is data, render.
// see https://mustac... | [
"function",
"generateHeading",
"(",
")",
"{",
"var",
"mixin",
"=",
"{",
"}",
";",
"// If two char are provided, first one is used as upperline of the text.",
"_",
".",
"each",
"(",
"[",
"'=='",
",",
"'='",
",",
"'-'",
",",
"'~'",
",",
"'\\''",
"]",
",",
"funct... | Create a mixin object containing mustache lambda function for heading.
The function are named h1 to h[n].
@return {function} Mustache lambda | [
"Create",
"a",
"mixin",
"object",
"containing",
"mustache",
"lambda",
"function",
"for",
"heading",
"."
] | 9d7c1d318ce535640588e7308917729c3849bc83 | https://github.com/HumanBrainProject/jsdoc-sphinx/blob/9d7c1d318ce535640588e7308917729c3849bc83/template/util/rst-mixin.js#L37-L56 | train |
HumanBrainProject/jsdoc-sphinx | template/util/rst-mixin.js | pre | function pre() {
return function(data, render) {
// remove first line if empty ; it happens because of
// the {{pre}} tag on one line.
logger.debug('empty line:', Boolean(data.match(/^\s+\n/, '')));
data = data.replace(/^\s+\n/, '');
// Find the first non-empty lines tabulation
var m = data.ma... | javascript | function pre() {
return function(data, render) {
// remove first line if empty ; it happens because of
// the {{pre}} tag on one line.
logger.debug('empty line:', Boolean(data.match(/^\s+\n/, '')));
data = data.replace(/^\s+\n/, '');
// Find the first non-empty lines tabulation
var m = data.ma... | [
"function",
"pre",
"(",
")",
"{",
"return",
"function",
"(",
"data",
",",
"render",
")",
"{",
"// remove first line if empty ; it happens because of",
"// the {{pre}} tag on one line.",
"logger",
".",
"debug",
"(",
"'empty line:'",
",",
"Boolean",
"(",
"data",
".",
... | Mustache lambda to preserve whitespace of the given string.
@return {function} Mustache lambda | [
"Mustache",
"lambda",
"to",
"preserve",
"whitespace",
"of",
"the",
"given",
"string",
"."
] | 9d7c1d318ce535640588e7308917729c3849bc83 | https://github.com/HumanBrainProject/jsdoc-sphinx/blob/9d7c1d318ce535640588e7308917729c3849bc83/template/util/rst-mixin.js#L63-L87 | train |
syntax-tree/unist-builder-blueprint | index.js | propsNode | function propsNode (node) {
var props = flatmap(Object.keys(node), function (key) {
if (key == 'type' || key == 'value' || key == 'children') {
return;
}
var value = node[key];
if (key == 'data') {
value = JSON.parse(JSON.stringify(value));
}
return {
type: 'Property',
... | javascript | function propsNode (node) {
var props = flatmap(Object.keys(node), function (key) {
if (key == 'type' || key == 'value' || key == 'children') {
return;
}
var value = node[key];
if (key == 'data') {
value = JSON.parse(JSON.stringify(value));
}
return {
type: 'Property',
... | [
"function",
"propsNode",
"(",
"node",
")",
"{",
"var",
"props",
"=",
"flatmap",
"(",
"Object",
".",
"keys",
"(",
"node",
")",
",",
"function",
"(",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"'type'",
"||",
"key",
"==",
"'value'",
"||",
"key",
"==",
... | Create ESTree object literal node representing Unist node properties. | [
"Create",
"ESTree",
"object",
"literal",
"node",
"representing",
"Unist",
"node",
"properties",
"."
] | f63bf8f1474ea84cf1c127a3cc47814e7611783e | https://github.com/syntax-tree/unist-builder-blueprint/blob/f63bf8f1474ea84cf1c127a3cc47814e7611783e/index.js#L38-L64 | train |
syntax-tree/unist-builder-blueprint | index.js | literalNode | function literalNode (value) {
if (value === undefined) {
return {
type: 'Identifier',
name: 'undefined'
};
}
else if (typeof value == 'function') {
throw Error('Unist property contains a function');
}
else if (value === null || typeof value != 'object') {
return {
type: 'Lit... | javascript | function literalNode (value) {
if (value === undefined) {
return {
type: 'Identifier',
name: 'undefined'
};
}
else if (typeof value == 'function') {
throw Error('Unist property contains a function');
}
else if (value === null || typeof value != 'object') {
return {
type: 'Lit... | [
"function",
"literalNode",
"(",
"value",
")",
"{",
"if",
"(",
"value",
"===",
"undefined",
")",
"{",
"return",
"{",
"type",
":",
"'Identifier'",
",",
"name",
":",
"'undefined'",
"}",
";",
"}",
"else",
"if",
"(",
"typeof",
"value",
"==",
"'function'",
"... | Create ESTree node representing particular JavaScript literal. | [
"Create",
"ESTree",
"node",
"representing",
"particular",
"JavaScript",
"literal",
"."
] | f63bf8f1474ea84cf1c127a3cc47814e7611783e | https://github.com/syntax-tree/unist-builder-blueprint/blob/f63bf8f1474ea84cf1c127a3cc47814e7611783e/index.js#L68-L105 | train |
avoidwork/abaaso | src/promise.js | function ( parent, child ) {
parent.then( function ( arg ) {
child.resolve( arg );
}, function ( e ) {
child.reject( e );
});
} | javascript | function ( parent, child ) {
parent.then( function ( arg ) {
child.resolve( arg );
}, function ( e ) {
child.reject( e );
});
} | [
"function",
"(",
"parent",
",",
"child",
")",
"{",
"parent",
".",
"then",
"(",
"function",
"(",
"arg",
")",
"{",
"child",
".",
"resolve",
"(",
"arg",
")",
";",
"}",
",",
"function",
"(",
"e",
")",
"{",
"child",
".",
"reject",
"(",
"e",
")",
";"... | Pipes a reconciliation from `parent` to `child`
@method pipe
@param {Object} parent Promise
@param {Object} child Promise
@return {Undefined} undefined | [
"Pipes",
"a",
"reconciliation",
"from",
"parent",
"to",
"child"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/src/promise.js#L43-L49 | train | |
avoidwork/abaaso | src/promise.js | function ( obj, arg, state ) {
if ( obj.state > promise.state.PENDING ) {
return;
}
obj.value = arg;
obj.state = state;
if ( !obj.deferred ) {
promise.delay( function () {
obj.process();
});
obj.deferred = true;
}
return obj;
} | javascript | function ( obj, arg, state ) {
if ( obj.state > promise.state.PENDING ) {
return;
}
obj.value = arg;
obj.state = state;
if ( !obj.deferred ) {
promise.delay( function () {
obj.process();
});
obj.deferred = true;
}
return obj;
} | [
"function",
"(",
"obj",
",",
"arg",
",",
"state",
")",
"{",
"if",
"(",
"obj",
".",
"state",
">",
"promise",
".",
"state",
".",
"PENDING",
")",
"{",
"return",
";",
"}",
"obj",
".",
"value",
"=",
"arg",
";",
"obj",
".",
"state",
"=",
"state",
";"... | Initiates processing a Promise
@memberOf process
@param {Object} obj Promise instance
@param {Mixed} arg Promise value
@param {Number} state State, e.g. "1"
@return {Object} Promise instance | [
"Initiates",
"processing",
"a",
"Promise"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/src/promise.js#L60-L77 | train | |
HumanBrainProject/jsdoc-sphinx | template/util/index.js | view | function view(name, model, cb) {
var basePath = path.join(path.dirname(__filename), '../views');
var render = function(err, files) {
if (err) {
cb(err);
}
cb(null, mustache.render(files[0], model, {
toctreeChildren: files[1],
func: files[2],
member: files[3],
constant: file... | javascript | function view(name, model, cb) {
var basePath = path.join(path.dirname(__filename), '../views');
var render = function(err, files) {
if (err) {
cb(err);
}
cb(null, mustache.render(files[0], model, {
toctreeChildren: files[1],
func: files[2],
member: files[3],
constant: file... | [
"function",
"view",
"(",
"name",
",",
"model",
",",
"cb",
")",
"{",
"var",
"basePath",
"=",
"path",
".",
"join",
"(",
"path",
".",
"dirname",
"(",
"__filename",
")",
",",
"'../views'",
")",
";",
"var",
"render",
"=",
"function",
"(",
"err",
",",
"f... | Generate the output string given a template name and the model.
@param {string} name the template name without the extension.
@param {object} model the ViewModel to use with the template
@param {viewCallback} cb callback | [
"Generate",
"the",
"output",
"string",
"given",
"a",
"template",
"name",
"and",
"the",
"model",
"."
] | 9d7c1d318ce535640588e7308917729c3849bc83 | https://github.com/HumanBrainProject/jsdoc-sphinx/blob/9d7c1d318ce535640588e7308917729c3849bc83/template/util/index.js#L24-L50 | train |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg ) {
if ( !array.contains( obj, arg ) ) {
obj.push( arg );
}
return obj;
} | javascript | function ( obj, arg ) {
if ( !array.contains( obj, arg ) ) {
obj.push( arg );
}
return obj;
} | [
"function",
"(",
"obj",
",",
"arg",
")",
"{",
"if",
"(",
"!",
"array",
".",
"contains",
"(",
"obj",
",",
"arg",
")",
")",
"{",
"obj",
".",
"push",
"(",
"arg",
")",
";",
"}",
"return",
"obj",
";",
"}"
] | Adds 'arg' to 'obj' if it is not found
@method add
@param {Array} obj Array to receive 'arg'
@param {Mixed} arg Argument to set in 'obj'
@return {Array} Array that was queried | [
"Adds",
"arg",
"to",
"obj",
"if",
"it",
"is",
"not",
"found"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L167-L173 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg ) {
var min = 0,
max = obj.length - 1,
idx, val;
while ( min <= max ) {
idx = Math.floor( ( min + max ) / 2 );
val = obj[idx];
if ( val < arg ) {
min = idx + 1;
}
else if ( val > arg ) {
max = idx - 1;
}
else {
return idx;
}
}
return -1;
} | javascript | function ( obj, arg ) {
var min = 0,
max = obj.length - 1,
idx, val;
while ( min <= max ) {
idx = Math.floor( ( min + max ) / 2 );
val = obj[idx];
if ( val < arg ) {
min = idx + 1;
}
else if ( val > arg ) {
max = idx - 1;
}
else {
return idx;
}
}
return -1;
} | [
"function",
"(",
"obj",
",",
"arg",
")",
"{",
"var",
"min",
"=",
"0",
",",
"max",
"=",
"obj",
".",
"length",
"-",
"1",
",",
"idx",
",",
"val",
";",
"while",
"(",
"min",
"<=",
"max",
")",
"{",
"idx",
"=",
"Math",
".",
"floor",
"(",
"(",
"min... | Preforms a binary search on a sorted Array
@method binIndex
@param {Array} obj Array to search
@param {Mixed} arg Value to find index of
@return {Number} Index of `arg` within `obj` | [
"Preforms",
"a",
"binary",
"search",
"on",
"a",
"sorted",
"Array"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L183-L204 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, size ) {
var result = [],
nth = number.round( ( obj.length / size ), "up" ),
start = 0,
i = -1;
while ( ++i < nth ) {
start = i * size;
result.push( array.limit( obj, start, size ) );
}
return result;
} | javascript | function ( obj, size ) {
var result = [],
nth = number.round( ( obj.length / size ), "up" ),
start = 0,
i = -1;
while ( ++i < nth ) {
start = i * size;
result.push( array.limit( obj, start, size ) );
}
return result;
} | [
"function",
"(",
"obj",
",",
"size",
")",
"{",
"var",
"result",
"=",
"[",
"]",
",",
"nth",
"=",
"number",
".",
"round",
"(",
"(",
"obj",
".",
"length",
"/",
"size",
")",
",",
"\"up\"",
")",
",",
"start",
"=",
"0",
",",
"i",
"=",
"-",
"1",
"... | Transforms an Array to a 2D Array of chunks
@method chunk
@param {Array} obj Array to parse
@param {Number} size Chunk size ( integer )
@return {Array} Chunked Array | [
"Transforms",
"an",
"Array",
"to",
"a",
"2D",
"Array",
"of",
"chunks"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L274-L286 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, fn ) {
var result = [];
array.each( obj, function ( i ) {
result.push( fn( i ) );
});
return result;
} | javascript | function ( obj, fn ) {
var result = [];
array.each( obj, function ( i ) {
result.push( fn( i ) );
});
return result;
} | [
"function",
"(",
"obj",
",",
"fn",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"array",
".",
"each",
"(",
"obj",
",",
"function",
"(",
"i",
")",
"{",
"result",
".",
"push",
"(",
"fn",
"(",
"i",
")",
")",
";",
"}",
")",
";",
"return",
"re... | Creates a new Array of the result of `fn` executed against every index of `obj`
@method collect
@param {Array} obj Array to iterate
@param {Function} fn Function to execute against indices
@return {Array} New Array | [
"Creates",
"a",
"new",
"Array",
"of",
"the",
"result",
"of",
"fn",
"executed",
"against",
"every",
"index",
"of",
"obj"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L330-L338 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, diff ) {
var result = [];
result = obj.filter( function ( i ) {
return !regex.null_undefined.test( i );
});
return !diff ? result : ( result.length < obj.length ? result : null );
} | javascript | function ( obj, diff ) {
var result = [];
result = obj.filter( function ( i ) {
return !regex.null_undefined.test( i );
});
return !diff ? result : ( result.length < obj.length ? result : null );
} | [
"function",
"(",
"obj",
",",
"diff",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"result",
"=",
"obj",
".",
"filter",
"(",
"function",
"(",
"i",
")",
"{",
"return",
"!",
"regex",
".",
"null_undefined",
".",
"test",
"(",
"i",
")",
";",
"}",
"... | Compacts a Array by removing `null` or `undefined` indices
@method compact
@param {Array} obj Array to compact
@param {Boolean} diff Indicates to return resulting Array only if there's a difference
@return {Array} Compacted copy of `obj`, or null ( if `diff` is passed & no diff is found ) | [
"Compacts",
"a",
"Array",
"by",
"removing",
"null",
"or",
"undefined",
"indices"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L348-L356 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( array1, array2 ) {
var result = [];
array.each( array1, function ( i ) {
if ( !array.contains( array2, i ) ) {
array.add( result, i );
}
});
array.each( array2, function ( i ) {
if ( !array.contains( array1, i ) ) {
array.add( result, i );
}
});
return result;
} | javascript | function ( array1, array2 ) {
var result = [];
array.each( array1, function ( i ) {
if ( !array.contains( array2, i ) ) {
array.add( result, i );
}
});
array.each( array2, function ( i ) {
if ( !array.contains( array1, i ) ) {
array.add( result, i );
}
});
return result;
} | [
"function",
"(",
"array1",
",",
"array2",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"array",
".",
"each",
"(",
"array1",
",",
"function",
"(",
"i",
")",
"{",
"if",
"(",
"!",
"array",
".",
"contains",
"(",
"array2",
",",
"i",
")",
")",
"{",... | Finds the difference between array1 and array2
@method diff
@param {Array} array1 Source Array
@param {Array} array2 Comparison Array
@return {Array} Array of the differences | [
"Finds",
"the",
"difference",
"between",
"array1",
"and",
"array2"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L380-L396 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg, start, offset ) {
var fn = typeof arg === "function",
l = obj.length,
i = !isNaN( start ) ? start : 0,
nth = !isNaN( offset ) ? i + offset : l - 1;
if ( nth > ( l - 1) ) {
nth = l - 1;
}
while ( i <= nth ) {
obj[i] = fn ? arg( obj[i] ) : arg;
i++;
}
re... | javascript | function ( obj, arg, start, offset ) {
var fn = typeof arg === "function",
l = obj.length,
i = !isNaN( start ) ? start : 0,
nth = !isNaN( offset ) ? i + offset : l - 1;
if ( nth > ( l - 1) ) {
nth = l - 1;
}
while ( i <= nth ) {
obj[i] = fn ? arg( obj[i] ) : arg;
i++;
}
re... | [
"function",
"(",
"obj",
",",
"arg",
",",
"start",
",",
"offset",
")",
"{",
"var",
"fn",
"=",
"typeof",
"arg",
"===",
"\"function\"",
",",
"l",
"=",
"obj",
".",
"length",
",",
"i",
"=",
"!",
"isNaN",
"(",
"start",
")",
"?",
"start",
":",
"0",
",... | Fills `obj` with the evalution of `arg`, optionally from `start` to `offset`
@method fill
@param {Array} obj Array to fill
@param {Mixed} arg String, Number of Function to fill with
@param {Number} start [Optional] Index to begin filling at
@param {Number} end [Optional] Offset from start to stop filling a... | [
"Fills",
"obj",
"with",
"the",
"evalution",
"of",
"arg",
"optionally",
"from",
"start",
"to",
"offset"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L515-L531 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
var result = [];
result = obj.reduce( function ( a, b ) {
return a.concat( b );
}, result );
return result;
} | javascript | function ( obj ) {
var result = [];
result = obj.reduce( function ( a, b ) {
return a.concat( b );
}, result );
return result;
} | [
"function",
"(",
"obj",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"result",
"=",
"obj",
".",
"reduce",
"(",
"function",
"(",
"a",
",",
"b",
")",
"{",
"return",
"a",
".",
"concat",
"(",
"b",
")",
";",
"}",
",",
"result",
")",
";",
"return... | Flattens a 2D Array
@method flat
@param {Array} obj 2D Array to flatten
@return {Array} Flatten Array | [
"Flattens",
"a",
"2D",
"Array"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L551-L559 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
var indexed = [];
utility.iterate( obj, function ( v ) {
indexed.push( v );
});
return indexed;
} | javascript | function ( obj ) {
var indexed = [];
utility.iterate( obj, function ( v ) {
indexed.push( v );
});
return indexed;
} | [
"function",
"(",
"obj",
")",
"{",
"var",
"indexed",
"=",
"[",
"]",
";",
"utility",
".",
"iterate",
"(",
"obj",
",",
"function",
"(",
"v",
")",
"{",
"indexed",
".",
"push",
"(",
"v",
")",
";",
"}",
")",
";",
"return",
"indexed",
";",
"}"
] | Returns an Associative Array as an Indexed Array
@method indexed
@param {Array} obj Array to index
@return {Array} Indexed Array | [
"Returns",
"an",
"Associative",
"Array",
"as",
"an",
"Indexed",
"Array"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L591-L599 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( array1, array2 ) {
var a = array1.length > array2.length ? array1 : array2,
b = ( a === array1 ? array2 : array1 );
return a.filter( function ( key ) {
return array.contains( b, key );
});
} | javascript | function ( array1, array2 ) {
var a = array1.length > array2.length ? array1 : array2,
b = ( a === array1 ? array2 : array1 );
return a.filter( function ( key ) {
return array.contains( b, key );
});
} | [
"function",
"(",
"array1",
",",
"array2",
")",
"{",
"var",
"a",
"=",
"array1",
".",
"length",
">",
"array2",
".",
"length",
"?",
"array1",
":",
"array2",
",",
"b",
"=",
"(",
"a",
"===",
"array1",
"?",
"array2",
":",
"array1",
")",
";",
"return",
... | Finds the intersections between array1 and array2
@method intersect
@param {Array} array1 Source Array
@param {Array} array2 Comparison Array
@return {Array} Array of the intersections | [
"Finds",
"the",
"intersections",
"between",
"array1",
"and",
"array2"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L609-L616 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg ) {
var n = obj.length - 1;
if ( arg >= ( n + 1 ) ) {
return obj;
}
else if ( isNaN( arg ) || arg === 1 ) {
return obj[n];
}
else {
return array.limit( obj, ( n - ( --arg ) ), n );
}
} | javascript | function ( obj, arg ) {
var n = obj.length - 1;
if ( arg >= ( n + 1 ) ) {
return obj;
}
else if ( isNaN( arg ) || arg === 1 ) {
return obj[n];
}
else {
return array.limit( obj, ( n - ( --arg ) ), n );
}
} | [
"function",
"(",
"obj",
",",
"arg",
")",
"{",
"var",
"n",
"=",
"obj",
".",
"length",
"-",
"1",
";",
"if",
"(",
"arg",
">=",
"(",
"n",
"+",
"1",
")",
")",
"{",
"return",
"obj",
";",
"}",
"else",
"if",
"(",
"isNaN",
"(",
"arg",
")",
"||",
"... | Returns the last index of the Array
@method last
@param {Array} obj Array
@param {Number} arg [Optional] Negative offset from last index to return
@return {Mixed} Last index( s ) of Array | [
"Returns",
"the",
"last",
"index",
"of",
"the",
"Array"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L717-L729 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, start, offset ) {
var result = [],
i = start - 1,
nth = start + offset,
max = obj.length;
if ( max > 0 ) {
while ( ++i < nth && i < max ) {
result.push( obj[i] );
}
}
return result;
} | javascript | function ( obj, start, offset ) {
var result = [],
i = start - 1,
nth = start + offset,
max = obj.length;
if ( max > 0 ) {
while ( ++i < nth && i < max ) {
result.push( obj[i] );
}
}
return result;
} | [
"function",
"(",
"obj",
",",
"start",
",",
"offset",
")",
"{",
"var",
"result",
"=",
"[",
"]",
",",
"i",
"=",
"start",
"-",
"1",
",",
"nth",
"=",
"start",
"+",
"offset",
",",
"max",
"=",
"obj",
".",
"length",
";",
"if",
"(",
"max",
">",
"0",
... | Returns a limited range of indices from the Array
@method limit
@param {Array} obj Array to iterate
@param {Number} start Starting index
@param {Number} offset Number of indices to return
@return {Array} Array of indices | [
"Returns",
"a",
"limited",
"range",
"of",
"indices",
"from",
"the",
"Array"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L740-L753 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg ) {
array.each( arg, function ( i ) {
array.add( obj, i );
});
return obj;
} | javascript | function ( obj, arg ) {
array.each( arg, function ( i ) {
array.add( obj, i );
});
return obj;
} | [
"function",
"(",
"obj",
",",
"arg",
")",
"{",
"array",
".",
"each",
"(",
"arg",
",",
"function",
"(",
"i",
")",
"{",
"array",
".",
"add",
"(",
"obj",
",",
"i",
")",
";",
"}",
")",
";",
"return",
"obj",
";",
"}"
] | Merges `arg` into `obj`, excluding duplicate indices
@method merge
@param {Array} obj Array to receive indices
@param {Array} arg Array to merge
@return {Array} obj | [
"Merges",
"arg",
"into",
"obj",
"excluding",
"duplicate",
"indices"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L800-L806 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj1, obj2 ) {
var result;
result = obj1.map( function ( i, idx ) {
return [i, obj2[idx]];
});
return result;
} | javascript | function ( obj1, obj2 ) {
var result;
result = obj1.map( function ( i, idx ) {
return [i, obj2[idx]];
});
return result;
} | [
"function",
"(",
"obj1",
",",
"obj2",
")",
"{",
"var",
"result",
";",
"result",
"=",
"obj1",
".",
"map",
"(",
"function",
"(",
"i",
",",
"idx",
")",
"{",
"return",
"[",
"i",
",",
"obj2",
"[",
"idx",
"]",
"]",
";",
"}",
")",
";",
"return",
"re... | Mingles Arrays and returns a 2D Array
@method mingle
@param {Array} obj1 Array to mingle
@param {Array} obj2 Array to mingle
@return {Array} 2D Array | [
"Mingles",
"Arrays",
"and",
"returns",
"a",
"2D",
"Array"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L827-L835 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
var values = {},
count = 0,
nth = 0,
mode = [],
result;
// Counting values
array.each( obj, function ( i ) {
if ( !isNaN( values[i] ) ) {
values[i]++;
}
else {
values[i] = 1;
}
});
// Finding the highest occurring count
count = array.max... | javascript | function ( obj ) {
var values = {},
count = 0,
nth = 0,
mode = [],
result;
// Counting values
array.each( obj, function ( i ) {
if ( !isNaN( values[i] ) ) {
values[i]++;
}
else {
values[i] = 1;
}
});
// Finding the highest occurring count
count = array.max... | [
"function",
"(",
"obj",
")",
"{",
"var",
"values",
"=",
"{",
"}",
",",
"count",
"=",
"0",
",",
"nth",
"=",
"0",
",",
"mode",
"=",
"[",
"]",
",",
"result",
";",
"// Counting values",
"array",
".",
"each",
"(",
"obj",
",",
"function",
"(",
"i",
"... | Finds the mode value of an Array
@method mode
@param {Array} obj Array to parse
@return {Mixed} Mode value of the Array | [
"Finds",
"the",
"mode",
"value",
"of",
"an",
"Array"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L844-L879 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg ) {
array.remove( obj, 0, obj.length );
array.each( arg, function ( i ) {
obj.push( i );
});
return obj;
} | javascript | function ( obj, arg ) {
array.remove( obj, 0, obj.length );
array.each( arg, function ( i ) {
obj.push( i );
});
return obj;
} | [
"function",
"(",
"obj",
",",
"arg",
")",
"{",
"array",
".",
"remove",
"(",
"obj",
",",
"0",
",",
"obj",
".",
"length",
")",
";",
"array",
".",
"each",
"(",
"arg",
",",
"function",
"(",
"i",
")",
"{",
"obj",
".",
"push",
"(",
"i",
")",
";",
... | Replaces the contents of `obj` with `arg`
@method replace
@param {Array} obj Array to modify
@param {Array} arg Array to become `obj`
@return {Array} New version of `obj` | [
"Replaces",
"the",
"contents",
"of",
"obj",
"with",
"arg"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L980-L987 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, start, end ) {
if ( isNaN( start ) ) {
start = obj.index( start );
if ( start === -1 ) {
return obj;
}
}
else {
start = start || 0;
}
var length = obj.length,
remaining = obj.slice( ( end || start ) + 1 || length );
obj.length = start < 0 ? ( length + start ) : st... | javascript | function ( obj, start, end ) {
if ( isNaN( start ) ) {
start = obj.index( start );
if ( start === -1 ) {
return obj;
}
}
else {
start = start || 0;
}
var length = obj.length,
remaining = obj.slice( ( end || start ) + 1 || length );
obj.length = start < 0 ? ( length + start ) : st... | [
"function",
"(",
"obj",
",",
"start",
",",
"end",
")",
"{",
"if",
"(",
"isNaN",
"(",
"start",
")",
")",
"{",
"start",
"=",
"obj",
".",
"index",
"(",
"start",
")",
";",
"if",
"(",
"start",
"===",
"-",
"1",
")",
"{",
"return",
"obj",
";",
"}",
... | Removes indices from an Array without recreating it
@method remove
@param {Array} obj Array to remove from
@param {Mixed} start Starting index, or value to find within obj
@param {Number} end [Optional] Ending index
@return {Array} Modified Array | [
"Removes",
"indices",
"from",
"an",
"Array",
"without",
"recreating",
"it"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L998-L1017 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, fn ) {
var remove;
if ( typeof fn !== "function" ) {
throw new Error( label.error.invalidArguments );
}
remove = obj.filter( fn );
array.each( remove, function ( i ) {
array.remove( obj, array.index ( obj, i ) );
});
return obj;
} | javascript | function ( obj, fn ) {
var remove;
if ( typeof fn !== "function" ) {
throw new Error( label.error.invalidArguments );
}
remove = obj.filter( fn );
array.each( remove, function ( i ) {
array.remove( obj, array.index ( obj, i ) );
});
return obj;
} | [
"function",
"(",
"obj",
",",
"fn",
")",
"{",
"var",
"remove",
";",
"if",
"(",
"typeof",
"fn",
"!==",
"\"function\"",
")",
"{",
"throw",
"new",
"Error",
"(",
"label",
".",
"error",
".",
"invalidArguments",
")",
";",
"}",
"remove",
"=",
"obj",
".",
"... | Deletes every element of `obj` for which `fn` evaluates to true
@method removeIf
@param {Array} obj Array to iterate
@param {Function} fn Function to test indices against
@return {Array} Array | [
"Deletes",
"every",
"element",
"of",
"obj",
"for",
"which",
"fn",
"evaluates",
"to",
"true"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1027-L1041 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, fn ) {
if ( typeof fn !== "function" ) {
throw new Error( label.error.invalidArguments );
}
var remove = [];
array.each( obj, function ( i ) {
if ( fn( i ) !== false ) {
remove.push( i );
}
else {
return false;
}
});
array.each( remove, function ( i ) {
array.rem... | javascript | function ( obj, fn ) {
if ( typeof fn !== "function" ) {
throw new Error( label.error.invalidArguments );
}
var remove = [];
array.each( obj, function ( i ) {
if ( fn( i ) !== false ) {
remove.push( i );
}
else {
return false;
}
});
array.each( remove, function ( i ) {
array.rem... | [
"function",
"(",
"obj",
",",
"fn",
")",
"{",
"if",
"(",
"typeof",
"fn",
"!==",
"\"function\"",
")",
"{",
"throw",
"new",
"Error",
"(",
"label",
".",
"error",
".",
"invalidArguments",
")",
";",
"}",
"var",
"remove",
"=",
"[",
"]",
";",
"array",
".",... | Deletes elements of `obj` until `fn` evaluates to false
@method removeWhile
@param {Array} obj Array to iterate
@param {Function} fn Function to test indices against
@return {Array} Array | [
"Deletes",
"elements",
"of",
"obj",
"until",
"fn",
"evaluates",
"to",
"false"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1051-L1072 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg ) {
arg = arg || 1;
if ( arg < 1 ) {
arg = 1;
}
return array.limit( obj, arg, obj.length );
} | javascript | function ( obj, arg ) {
arg = arg || 1;
if ( arg < 1 ) {
arg = 1;
}
return array.limit( obj, arg, obj.length );
} | [
"function",
"(",
"obj",
",",
"arg",
")",
"{",
"arg",
"=",
"arg",
"||",
"1",
";",
"if",
"(",
"arg",
"<",
"1",
")",
"{",
"arg",
"=",
"1",
";",
"}",
"return",
"array",
".",
"limit",
"(",
"obj",
",",
"arg",
",",
"obj",
".",
"length",
")",
";",
... | Returns the "rest" of `obj` from `arg`
@method rest
@param {Array} obj Array to parse
@param {Number} arg [Optional] Start position of subset of `obj` ( positive number only )
@return {Array} Array of a subset of `obj` | [
"Returns",
"the",
"rest",
"of",
"obj",
"from",
"arg"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1082-L1090 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg ) {
var result = -1;
array.each( obj, function ( i, idx ) {
if ( i === arg ) {
result = idx;
}
});
return result;
} | javascript | function ( obj, arg ) {
var result = -1;
array.each( obj, function ( i, idx ) {
if ( i === arg ) {
result = idx;
}
});
return result;
} | [
"function",
"(",
"obj",
",",
"arg",
")",
"{",
"var",
"result",
"=",
"-",
"1",
";",
"array",
".",
"each",
"(",
"obj",
",",
"function",
"(",
"i",
",",
"idx",
")",
"{",
"if",
"(",
"i",
"===",
"arg",
")",
"{",
"result",
"=",
"idx",
";",
"}",
"}... | Finds the last index of `arg` in `obj`
@method rindex
@param {Array} obj Array to search
@param {Mixed} arg Primitive to find
@return {Mixed} Index or undefined | [
"Finds",
"the",
"last",
"index",
"of",
"arg",
"in",
"obj"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1100-L1110 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg ) {
var nth = obj.length,
result;
if ( arg === 0 ) {
result = obj;
}
else {
if ( arg < 0 ) {
arg += nth;
}
else {
arg--;
}
result = array.limit( obj, arg, nth );
result = result.concat( array.limit( obj, 0, arg ) );
}
return result;
} | javascript | function ( obj, arg ) {
var nth = obj.length,
result;
if ( arg === 0 ) {
result = obj;
}
else {
if ( arg < 0 ) {
arg += nth;
}
else {
arg--;
}
result = array.limit( obj, arg, nth );
result = result.concat( array.limit( obj, 0, arg ) );
}
return result;
} | [
"function",
"(",
"obj",
",",
"arg",
")",
"{",
"var",
"nth",
"=",
"obj",
".",
"length",
",",
"result",
";",
"if",
"(",
"arg",
"===",
"0",
")",
"{",
"result",
"=",
"obj",
";",
"}",
"else",
"{",
"if",
"(",
"arg",
"<",
"0",
")",
"{",
"arg",
"+=... | Returns new Array with `arg` moved to the first index
@method rotate
@param {Array} obj Array to rotate
@param {Number} arg Index to become the first index, if negative the rotation is in the opposite direction
@return {Array} Newly rotated Array | [
"Returns",
"new",
"Array",
"with",
"arg",
"moved",
"to",
"the",
"first",
"index"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1120-L1140 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( start, end, offset ) {
start = start || 0;
end = end || start;
offset = offset || 1;
var result = [],
n = -1,
nth = Math.max( 0, Math.ceil( ( end - start ) / offset ) );
while ( ++n < nth ) {
result[n] = start;
start += offset;
}
return resul... | javascript | function ( start, end, offset ) {
start = start || 0;
end = end || start;
offset = offset || 1;
var result = [],
n = -1,
nth = Math.max( 0, Math.ceil( ( end - start ) / offset ) );
while ( ++n < nth ) {
result[n] = start;
start += offset;
}
return resul... | [
"function",
"(",
"start",
",",
"end",
",",
"offset",
")",
"{",
"start",
"=",
"start",
"||",
"0",
";",
"end",
"=",
"end",
"||",
"start",
";",
"offset",
"=",
"offset",
"||",
"1",
";",
"var",
"result",
"=",
"[",
"]",
",",
"n",
"=",
"-",
"1",
","... | Generates a series Array
@method series
@param {Number} start Start value the series
@param {Number} end [Optional] The end of the series
@param {Number} offset [Optional] Offset for indices, default is 1
@return {Array} Array of new series | [
"Generates",
"a",
"series",
"Array"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1151-L1165 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, divisor ) {
var result = [],
total = obj.length,
nth = Math.ceil( total / divisor ),
low = Math.floor( total / divisor ),
lower = Math.ceil( total / nth ),
lowered = false,
start = 0,
i = -1;
// Finding the fold
if ( number.diff( tota... | javascript | function ( obj, divisor ) {
var result = [],
total = obj.length,
nth = Math.ceil( total / divisor ),
low = Math.floor( total / divisor ),
lower = Math.ceil( total / nth ),
lowered = false,
start = 0,
i = -1;
// Finding the fold
if ( number.diff( tota... | [
"function",
"(",
"obj",
",",
"divisor",
")",
"{",
"var",
"result",
"=",
"[",
"]",
",",
"total",
"=",
"obj",
".",
"length",
",",
"nth",
"=",
"Math",
".",
"ceil",
"(",
"total",
"/",
"divisor",
")",
",",
"low",
"=",
"Math",
".",
"floor",
"(",
"tot... | Splits an Array by divisor
@method split
@param {Array} obj Array to parse
@param {Number} divisor Integer to divide the Array by
@return {Array} Split Array | [
"Splits",
"an",
"Array",
"by",
"divisor"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1175-L1207 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( a, b ) {
var types = {a: typeof a, b: typeof b},
c, d, result;
if ( types.a === "number" && types.b === "number" ) {
result = a - b;
}
else {
c = a.toString();
d = b.toString();
if ( c < d ) {
result = -1;
}
else if ( c > d ) {
result = 1;
}
else if ( types.a =... | javascript | function ( a, b ) {
var types = {a: typeof a, b: typeof b},
c, d, result;
if ( types.a === "number" && types.b === "number" ) {
result = a - b;
}
else {
c = a.toString();
d = b.toString();
if ( c < d ) {
result = -1;
}
else if ( c > d ) {
result = 1;
}
else if ( types.a =... | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"var",
"types",
"=",
"{",
"a",
":",
"typeof",
"a",
",",
"b",
":",
"typeof",
"b",
"}",
",",
"c",
",",
"d",
",",
"result",
";",
"if",
"(",
"types",
".",
"a",
"===",
"\"number\"",
"&&",
"types",
".",
"... | Sorts the Array by parsing values
@method sort
@param {Mixed} a Argument to compare
@param {Mixed} b Argument to compare
@return {Number} Number indicating sort order | [
"Sorts",
"the",
"Array",
"by",
"parsing",
"values"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1217-L1246 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
var result = 0;
if ( obj.length > 0 ) {
result = obj.reduce( function ( prev, cur ) {
return prev + cur;
});
}
return result;
} | javascript | function ( obj ) {
var result = 0;
if ( obj.length > 0 ) {
result = obj.reduce( function ( prev, cur ) {
return prev + cur;
});
}
return result;
} | [
"function",
"(",
"obj",
")",
"{",
"var",
"result",
"=",
"0",
";",
"if",
"(",
"obj",
".",
"length",
">",
"0",
")",
"{",
"result",
"=",
"obj",
".",
"reduce",
"(",
"function",
"(",
"prev",
",",
"cur",
")",
"{",
"return",
"prev",
"+",
"cur",
";",
... | Gets the summation of an Array of numbers
@method sum
@param {Array} obj Array to sum
@return {Number} Summation of Array | [
"Gets",
"the",
"summation",
"of",
"an",
"Array",
"of",
"numbers"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1277-L1287 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( ar ) {
var obj = {},
i = ar.length;
while ( i-- ) {
obj[i.toString()] = ar[i];
}
return obj;
} | javascript | function ( ar ) {
var obj = {},
i = ar.length;
while ( i-- ) {
obj[i.toString()] = ar[i];
}
return obj;
} | [
"function",
"(",
"ar",
")",
"{",
"var",
"obj",
"=",
"{",
"}",
",",
"i",
"=",
"ar",
".",
"length",
";",
"while",
"(",
"i",
"--",
")",
"{",
"obj",
"[",
"i",
".",
"toString",
"(",
")",
"]",
"=",
"ar",
"[",
"i",
"]",
";",
"}",
"return",
"obj"... | Casts an Array to Object
@method toObject
@param {Array} ar Array to transform
@return {Object} New object | [
"Casts",
"an",
"Array",
"to",
"Object"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1319-L1328 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
var result = [];
array.each( obj, function ( i ) {
array.add( result, i );
});
return result;
} | javascript | function ( obj ) {
var result = [];
array.each( obj, function ( i ) {
array.add( result, i );
});
return result;
} | [
"function",
"(",
"obj",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"array",
".",
"each",
"(",
"obj",
",",
"function",
"(",
"i",
")",
"{",
"array",
".",
"add",
"(",
"result",
",",
"i",
")",
";",
"}",
")",
";",
"return",
"result",
";",
"}"
... | Returns an Array of unique indices of `obj`
@method unique
@param {Array} obj Array to parse
@return {Array} Array of unique indices | [
"Returns",
"an",
"Array",
"of",
"unique",
"indices",
"of",
"obj"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1337-L1345 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, args ) {
var result = [];
// Preparing args
if ( !(args instanceof Array) ) {
args = typeof args === "object" ? array.cast( args ) : [args];
}
array.each( args, function ( i, idx ) {
if ( !( i instanceof Array ) ) {
this[idx] = [i];
}
});
// Building result Array
array.ea... | javascript | function ( obj, args ) {
var result = [];
// Preparing args
if ( !(args instanceof Array) ) {
args = typeof args === "object" ? array.cast( args ) : [args];
}
array.each( args, function ( i, idx ) {
if ( !( i instanceof Array ) ) {
this[idx] = [i];
}
});
// Building result Array
array.ea... | [
"function",
"(",
"obj",
",",
"args",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"// Preparing args",
"if",
"(",
"!",
"(",
"args",
"instanceof",
"Array",
")",
")",
"{",
"args",
"=",
"typeof",
"args",
"===",
"\"object\"",
"?",
"array",
".",
"cast",... | Converts any arguments to Arrays, then merges elements of `obj` with corresponding elements from each argument
@method zip
@param {Array} obj Array to transform
@param {Mixed} args Argument instance or Array to merge
@return {Array} Array | [
"Converts",
"any",
"arguments",
"to",
"Arrays",
"then",
"merges",
"elements",
"of",
"obj",
"with",
"corresponding",
"elements",
"from",
"each",
"argument"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1381-L1404 | train | |
avoidwork/abaaso | lib/abaaso.js | function () {
return utility.iterate( cache.items, function ( v, k ) {
if ( cache.expired( k ) ) {
cache.expire( k, true );
}
});
} | javascript | function () {
return utility.iterate( cache.items, function ( v, k ) {
if ( cache.expired( k ) ) {
cache.expire( k, true );
}
});
} | [
"function",
"(",
")",
"{",
"return",
"utility",
".",
"iterate",
"(",
"cache",
".",
"items",
",",
"function",
"(",
"v",
",",
"k",
")",
"{",
"if",
"(",
"cache",
".",
"expired",
"(",
"k",
")",
")",
"{",
"cache",
".",
"expire",
"(",
"k",
",",
"true... | Garbage collector for the cached items
@method clean
@private
@return {Undefined} undefined | [
"Garbage",
"collector",
"for",
"the",
"cached",
"items"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1419-L1425 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( uri, silent ) {
silent = ( silent === true );
if ( cache.items[uri] !== undefined ) {
delete cache.items[uri];
if ( !silent ) {
observer.fire( uri, "beforeExpire, expire, afterExpire" );
}
return true;
}
else {
return false;
}
} | javascript | function ( uri, silent ) {
silent = ( silent === true );
if ( cache.items[uri] !== undefined ) {
delete cache.items[uri];
if ( !silent ) {
observer.fire( uri, "beforeExpire, expire, afterExpire" );
}
return true;
}
else {
return false;
}
} | [
"function",
"(",
"uri",
",",
"silent",
")",
"{",
"silent",
"=",
"(",
"silent",
"===",
"true",
")",
";",
"if",
"(",
"cache",
".",
"items",
"[",
"uri",
"]",
"!==",
"undefined",
")",
"{",
"delete",
"cache",
".",
"items",
"[",
"uri",
"]",
";",
"if",
... | Expires a URI from the local cache
Events: expire Fires when the URI expires
@method expire
@private
@param {String} uri URI of the local representation
@param {Boolean} silent [Optional] If 'true', the event will not fire
@return {Undefined} undefined | [
"Expires",
"a",
"URI",
"from",
"the",
"local",
"cache"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1438-L1452 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( uri ) {
var item = cache.items[uri];
return item !== undefined && item.expires !== undefined && item.expires < new Date();
} | javascript | function ( uri ) {
var item = cache.items[uri];
return item !== undefined && item.expires !== undefined && item.expires < new Date();
} | [
"function",
"(",
"uri",
")",
"{",
"var",
"item",
"=",
"cache",
".",
"items",
"[",
"uri",
"]",
";",
"return",
"item",
"!==",
"undefined",
"&&",
"item",
".",
"expires",
"!==",
"undefined",
"&&",
"item",
".",
"expires",
"<",
"new",
"Date",
"(",
")",
"... | Determines if a URI has expired
@method expired
@private
@param {Object} uri Cached URI object
@return {Boolean} True if the URI has expired | [
"Determines",
"if",
"a",
"URI",
"has",
"expired"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1462-L1466 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( uri, property, value ) {
uri = utility.parse( uri ).href;
if ( cache.items[uri] === undefined ) {
cache.items[uri] = {};
cache.items[uri].permission = 0;
}
if ( property === "permission" ) {
cache.items[uri].permission |= value;
}
else if ( property === "!permission" ) {
cache.items... | javascript | function ( uri, property, value ) {
uri = utility.parse( uri ).href;
if ( cache.items[uri] === undefined ) {
cache.items[uri] = {};
cache.items[uri].permission = 0;
}
if ( property === "permission" ) {
cache.items[uri].permission |= value;
}
else if ( property === "!permission" ) {
cache.items... | [
"function",
"(",
"uri",
",",
"property",
",",
"value",
")",
"{",
"uri",
"=",
"utility",
".",
"parse",
"(",
"uri",
")",
".",
"href",
";",
"if",
"(",
"cache",
".",
"items",
"[",
"uri",
"]",
"===",
"undefined",
")",
"{",
"cache",
".",
"items",
"[",
... | Sets, or updates an item in cache.items
@method set
@private
@param {String} uri URI to set or update
@param {String} property Property of the cached URI to set
@param {Mixed} value Value to set
@return {Mixed} URI Object {headers, response} or undefined | [
"Sets",
"or",
"updates",
"an",
"item",
"in",
"cache",
".",
"items"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1505-L1524 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( uri, verb ) {
if ( string.isEmpty( uri ) || string.isEmpty( verb ) ) {
throw new Error( label.error.invalidArguments );
}
uri = utility.parse( uri ).href;
verb = verb.toLowerCase();
var result = false,
bit = 0;
if ( !cache.get( uri, false ) ) {
result = undefined;
... | javascript | function ( uri, verb ) {
if ( string.isEmpty( uri ) || string.isEmpty( verb ) ) {
throw new Error( label.error.invalidArguments );
}
uri = utility.parse( uri ).href;
verb = verb.toLowerCase();
var result = false,
bit = 0;
if ( !cache.get( uri, false ) ) {
result = undefined;
... | [
"function",
"(",
"uri",
",",
"verb",
")",
"{",
"if",
"(",
"string",
".",
"isEmpty",
"(",
"uri",
")",
"||",
"string",
".",
"isEmpty",
"(",
"verb",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"label",
".",
"error",
".",
"invalidArguments",
")",
";",... | Quick way to see if a URI allows a specific verb
@method allows
@param {String} uri URI to query
@param {String} verb HTTP verb
@return {Boolean} `true` if the verb is allowed, undefined if unknown | [
"Quick",
"way",
"to",
"see",
"if",
"a",
"URI",
"allows",
"a",
"specific",
"verb"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1816-L1847 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( args ) {
var result = 0;
array.each( args, function ( verb ) {
verb = verb.toLowerCase();
if ( regex.get_headers.test( verb ) ) {
result |= 4;
}
else if ( regex.put_post.test( verb ) ) {
result |= 2;
}
else if ( regex.patch.test( verb ) ) {
result |= 8;
}
else if ( r... | javascript | function ( args ) {
var result = 0;
array.each( args, function ( verb ) {
verb = verb.toLowerCase();
if ( regex.get_headers.test( verb ) ) {
result |= 4;
}
else if ( regex.put_post.test( verb ) ) {
result |= 2;
}
else if ( regex.patch.test( verb ) ) {
result |= 8;
}
else if ( r... | [
"function",
"(",
"args",
")",
"{",
"var",
"result",
"=",
"0",
";",
"array",
".",
"each",
"(",
"args",
",",
"function",
"(",
"verb",
")",
"{",
"verb",
"=",
"verb",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"regex",
".",
"get_headers",
".",
"te... | Gets bit value based on args
@method bit
@param {Array} args Array of commands the URI accepts
@return {Number} To be set as a bit | [
"Gets",
"bit",
"value",
"based",
"on",
"args"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1856-L1877 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( xhr, uri, type ) {
var headers = string.trim( xhr.getAllResponseHeaders() ).split( "\n" ),
items = {},
o = {},
allow = null,
expires = new Date(),
cors = client.cors( uri );
array.each( headers, function ( i ) {
var header, value;
value = i.repla... | javascript | function ( xhr, uri, type ) {
var headers = string.trim( xhr.getAllResponseHeaders() ).split( "\n" ),
items = {},
o = {},
allow = null,
expires = new Date(),
cors = client.cors( uri );
array.each( headers, function ( i ) {
var header, value;
value = i.repla... | [
"function",
"(",
"xhr",
",",
"uri",
",",
"type",
")",
"{",
"var",
"headers",
"=",
"string",
".",
"trim",
"(",
"xhr",
".",
"getAllResponseHeaders",
"(",
")",
")",
".",
"split",
"(",
"\"\\n\"",
")",
",",
"items",
"=",
"{",
"}",
",",
"o",
"=",
"{",
... | Caches the headers from the XHR response
@method headers
@param {Object} xhr XMLHttpRequest Object
@param {String} uri URI to request
@param {String} type Type of request
@return {Object} Cached URI representation | [
"Caches",
"the",
"headers",
"from",
"the",
"XHR",
"response"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1899-L1946 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( xhr, type ) {
type = type || "";
var result, obj;
if ( ( regex.json_maybe.test( type ) || string.isEmpty( type ) ) && ( regex.json_wrap.test( xhr.responseText ) && Boolean( obj = json.decode( xhr.responseText, true ) ) ) ) {
result = obj;
}
else if ( regex.xml.test( type ) ) {
if ( type !== ... | javascript | function ( xhr, type ) {
type = type || "";
var result, obj;
if ( ( regex.json_maybe.test( type ) || string.isEmpty( type ) ) && ( regex.json_wrap.test( xhr.responseText ) && Boolean( obj = json.decode( xhr.responseText, true ) ) ) ) {
result = obj;
}
else if ( regex.xml.test( type ) ) {
if ( type !== ... | [
"function",
"(",
"xhr",
",",
"type",
")",
"{",
"type",
"=",
"type",
"||",
"\"\"",
";",
"var",
"result",
",",
"obj",
";",
"if",
"(",
"(",
"regex",
".",
"json_maybe",
".",
"test",
"(",
"type",
")",
"||",
"string",
".",
"isEmpty",
"(",
"type",
")",
... | Parses an XHR response
@method parse
@param {Object} xhr XHR Object
@param {String} type [Optional] Content-Type header value
@return {Mixed} Array, Boolean, Document, Number, Object or String | [
"Parses",
"an",
"XHR",
"response"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1956-L1978 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( uri ) {
var cached = cache.get( uri, false ),
bit = !cached ? 0 : cached.permission,
result = {allows: [], bit: bit, map: {partial: 8, read: 4, write: 2, "delete": 1, unknown: 0}};
if ( bit & 1) {
result.allows.push( "DELETE" );
}
if ( bit & 2) {
result.allows.push( "POST" );
... | javascript | function ( uri ) {
var cached = cache.get( uri, false ),
bit = !cached ? 0 : cached.permission,
result = {allows: [], bit: bit, map: {partial: 8, read: 4, write: 2, "delete": 1, unknown: 0}};
if ( bit & 1) {
result.allows.push( "DELETE" );
}
if ( bit & 2) {
result.allows.push( "POST" );
... | [
"function",
"(",
"uri",
")",
"{",
"var",
"cached",
"=",
"cache",
".",
"get",
"(",
"uri",
",",
"false",
")",
",",
"bit",
"=",
"!",
"cached",
"?",
"0",
":",
"cached",
".",
"permission",
",",
"result",
"=",
"{",
"allows",
":",
"[",
"]",
",",
"bit"... | Returns the permission of the cached URI
@method permissions
@param {String} uri URI to query
@return {Object} Contains an Array of available commands, the permission bit and a map | [
"Returns",
"the",
"permission",
"of",
"the",
"cached",
"URI"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L1987-L2010 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( uri, success, failure, args ) {
var defer = deferred(),
callback = "callback", cbid, s;
if ( external === undefined ) {
if ( global.abaaso === undefined ) {
utility.define( "abaaso.callback", {}, global );
}
external = "abaaso";
}
if ( args instanceof Object && args.callback ... | javascript | function ( uri, success, failure, args ) {
var defer = deferred(),
callback = "callback", cbid, s;
if ( external === undefined ) {
if ( global.abaaso === undefined ) {
utility.define( "abaaso.callback", {}, global );
}
external = "abaaso";
}
if ( args instanceof Object && args.callback ... | [
"function",
"(",
"uri",
",",
"success",
",",
"failure",
",",
"args",
")",
"{",
"var",
"defer",
"=",
"deferred",
"(",
")",
",",
"callback",
"=",
"\"callback\"",
",",
"cbid",
",",
"s",
";",
"if",
"(",
"external",
"===",
"undefined",
")",
"{",
"if",
"... | Creates a JSONP request
@method jsonp
@param {String} uri URI to request
@param {Function} success A handler function to execute when an appropriate response been received
@param {Function} failure [Optional] A handler function to execute on error
@param {Mixed} args Custom JSONP handler parameter name... | [
"Creates",
"a",
"JSONP",
"request"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L2022-L2072 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( arg, target, pos ) {
return element.create( "script", {type: "application/javascript", src: arg}, target || utility.$( "head" )[0], pos );
} | javascript | function ( arg, target, pos ) {
return element.create( "script", {type: "application/javascript", src: arg}, target || utility.$( "head" )[0], pos );
} | [
"function",
"(",
"arg",
",",
"target",
",",
"pos",
")",
"{",
"return",
"element",
".",
"create",
"(",
"\"script\"",
",",
"{",
"type",
":",
"\"application/javascript\"",
",",
"src",
":",
"arg",
"}",
",",
"target",
"||",
"utility",
".",
"$",
"(",
"\"head... | Creates a script Element to load an external script
@method script
@param {String} arg URL to script
@param {Object} target [Optional] Element to receive the script
@param {String} pos [Optional] Position to create the script at within the target
@return {Object} Script | [
"Creates",
"a",
"script",
"Element",
"to",
"load",
"an",
"external",
"script"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L2431-L2433 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( dest, ms ) {
var defer = deferred(),
start = client.scrollPos(),
t = 0;
ms = ( !isNaN( ms ) ? ms : 250 ) / 100;
utility.repeat( function () {
var pos = math.bezier( start[0], start[1], dest[0], dest[1], ++t / 100 );
window.scrollTo( pos[0], pos[1] );
if ( t === 100 ) {
... | javascript | function ( dest, ms ) {
var defer = deferred(),
start = client.scrollPos(),
t = 0;
ms = ( !isNaN( ms ) ? ms : 250 ) / 100;
utility.repeat( function () {
var pos = math.bezier( start[0], start[1], dest[0], dest[1], ++t / 100 );
window.scrollTo( pos[0], pos[1] );
if ( t === 100 ) {
... | [
"function",
"(",
"dest",
",",
"ms",
")",
"{",
"var",
"defer",
"=",
"deferred",
"(",
")",
",",
"start",
"=",
"client",
".",
"scrollPos",
"(",
")",
",",
"t",
"=",
"0",
";",
"ms",
"=",
"(",
"!",
"isNaN",
"(",
"ms",
")",
"?",
"ms",
":",
"250",
... | Scrolls to a position in the view using a two point bezier curve
@method scroll
@param {Array} dest Coordinates
@param {Number} ms [Optional] Milliseconds to scroll, default is 250, min is 100
@return {Object} Deferred | [
"Scrolls",
"to",
"a",
"position",
"in",
"the",
"view",
"using",
"a",
"two",
"point",
"bezier",
"curve"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L2443-L2462 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( arg, media ) {
return element.create( "link", {rel: "stylesheet", type: "text/css", href: arg, media: media || "print, screen"}, utility.$( "head" )[0] );
} | javascript | function ( arg, media ) {
return element.create( "link", {rel: "stylesheet", type: "text/css", href: arg, media: media || "print, screen"}, utility.$( "head" )[0] );
} | [
"function",
"(",
"arg",
",",
"media",
")",
"{",
"return",
"element",
".",
"create",
"(",
"\"link\"",
",",
"{",
"rel",
":",
"\"stylesheet\"",
",",
"type",
":",
"\"text/css\"",
",",
"href",
":",
"arg",
",",
"media",
":",
"media",
"||",
"\"print, screen\"",... | Creates a link Element to load an external stylesheet
@method stylesheet
@param {String} arg URL to stylesheet
@param {String} media [Optional] Medias the stylesheet applies to
@return {Objecct} Stylesheet | [
"Creates",
"a",
"link",
"Element",
"to",
"load",
"an",
"external",
"stylesheet"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L2498-L2500 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( name, domain, secure, path, jar ) {
cookie.set( name, "", "-1s", domain, secure, path, jar );
return name;
} | javascript | function ( name, domain, secure, path, jar ) {
cookie.set( name, "", "-1s", domain, secure, path, jar );
return name;
} | [
"function",
"(",
"name",
",",
"domain",
",",
"secure",
",",
"path",
",",
"jar",
")",
"{",
"cookie",
".",
"set",
"(",
"name",
",",
"\"\"",
",",
"\"-1s\"",
",",
"domain",
",",
"secure",
",",
"path",
",",
"jar",
")",
";",
"return",
"name",
";",
"}"
... | Expires a cookie if it exists
@method expire
@param {String} name Name of the cookie to expire
@param {String} domain [Optional] Domain to set the cookie for
@param {Boolean} secure [Optional] Make the cookie only accessible via SSL
@param {String} path [Optional] Path the cookie is for
@param {String} ja... | [
"Expires",
"a",
"cookie",
"if",
"it",
"exists"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L2516-L2520 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( jar ) {
var result = {};
if ( jar === undefined ) {
jar = server ? "" : document.cookie;
}
if ( !string.isEmpty( jar ) ) {
array.each( string.explode( jar, ";" ), function ( i ) {
var item = string.explode( i, "=" );
result[item[0]] = utility.coerce( item[1] );
} );
}
return ... | javascript | function ( jar ) {
var result = {};
if ( jar === undefined ) {
jar = server ? "" : document.cookie;
}
if ( !string.isEmpty( jar ) ) {
array.each( string.explode( jar, ";" ), function ( i ) {
var item = string.explode( i, "=" );
result[item[0]] = utility.coerce( item[1] );
} );
}
return ... | [
"function",
"(",
"jar",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"if",
"(",
"jar",
"===",
"undefined",
")",
"{",
"jar",
"=",
"server",
"?",
"\"\"",
":",
"document",
".",
"cookie",
";",
"}",
"if",
"(",
"!",
"string",
".",
"isEmpty",
"(",
"... | Gets the cookies for the domain
@method list
@param {String} jar [Optional] Cookie jar, defaults to document.cookie
@return {Object} Collection of cookies | [
"Gets",
"the",
"cookies",
"for",
"the",
"domain"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L2541-L2557 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( name, value, offset, domain, secure, path, jar ) {
value = ( value || "" ) + ";";
offset = offset || "";
domain = typeof domain === "string" ? ( " Domain=" + domain + ";" ) : "";
secure = ( secure === true ) ? " secure" : "";
path = typeof path === "string" ? ( " Path=" + pat... | javascript | function ( name, value, offset, domain, secure, path, jar ) {
value = ( value || "" ) + ";";
offset = offset || "";
domain = typeof domain === "string" ? ( " Domain=" + domain + ";" ) : "";
secure = ( secure === true ) ? " secure" : "";
path = typeof path === "string" ? ( " Path=" + pat... | [
"function",
"(",
"name",
",",
"value",
",",
"offset",
",",
"domain",
",",
"secure",
",",
"path",
",",
"jar",
")",
"{",
"value",
"=",
"(",
"value",
"||",
"\"\"",
")",
"+",
"\";\"",
";",
"offset",
"=",
"offset",
"||",
"\"\"",
";",
"domain",
"=",
"t... | Creates a cookie
The offset specifies a positive or negative span of time as day, hour, minute or second
@method set
@param {String} name Name of the cookie to create
@param {String} value Value to set
@param {String} offset A positive or negative integer followed by "d", "h", "m" or "s"
@param {String} do... | [
"Creates",
"a",
"cookie"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L2574-L2631 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, recs, args ) {
utility.genId( obj );
// Decorating observer if not present in prototype chain
if ( typeof obj.fire !== "function" ) {
observer.decorate( obj );
}
// Creating store
obj.data = new DataStore( obj );
if ( args instanceof Object ) {
utility.merge( obj.data, args );
}
if ( re... | javascript | function ( obj, recs, args ) {
utility.genId( obj );
// Decorating observer if not present in prototype chain
if ( typeof obj.fire !== "function" ) {
observer.decorate( obj );
}
// Creating store
obj.data = new DataStore( obj );
if ( args instanceof Object ) {
utility.merge( obj.data, args );
}
if ( re... | [
"function",
"(",
"obj",
",",
"recs",
",",
"args",
")",
"{",
"utility",
".",
"genId",
"(",
"obj",
")",
";",
"// Decorating observer if not present in prototype chain",
"if",
"(",
"typeof",
"obj",
".",
"fire",
"!==",
"\"function\"",
")",
"{",
"observer",
".",
... | Decorates a DataStore on an Object
@method decorator
@param {Object} obj Object
@param {Mixed} recs [Optional] Data to set with this.batch
@param {Object} args [Optional] Arguments to set on the store
@return {Object} Decorated Object | [
"Decorates",
"a",
"DataStore",
"on",
"an",
"Object"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L2643-L2663 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, key, value ) {
var target, result;
if ( regex.svg.test( obj.namespaceURI ) ) {
if ( value === undefined ) {
result = obj.getAttributeNS( obj.namespaceURI, key );
if ( result === null || string.isEmpty( result ) ) {
result = undefined;
}
else {
result = utility.coerce( ... | javascript | function ( obj, key, value ) {
var target, result;
if ( regex.svg.test( obj.namespaceURI ) ) {
if ( value === undefined ) {
result = obj.getAttributeNS( obj.namespaceURI, key );
if ( result === null || string.isEmpty( result ) ) {
result = undefined;
}
else {
result = utility.coerce( ... | [
"function",
"(",
"obj",
",",
"key",
",",
"value",
")",
"{",
"var",
"target",
",",
"result",
";",
"if",
"(",
"regex",
".",
"svg",
".",
"test",
"(",
"obj",
".",
"namespaceURI",
")",
")",
"{",
"if",
"(",
"value",
"===",
"undefined",
")",
"{",
"resul... | Gets or sets an Element attribute
@method attr
@param {Mixed} obj Element
@param {String} name Attribute name
@param {Mixed} value Attribute value
@return {Object} Element | [
"Gets",
"or",
"sets",
"an",
"Element",
"attribute"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L4926-L4988 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
if ( typeof obj.reset === "function" ) {
obj.reset();
}
else if ( obj.value !== undefined ) {
element.update( obj, {innerHTML: "", value: ""} );
}
else {
element.update( obj, {innerHTML: ""} );
}
return obj;
} | javascript | function ( obj ) {
if ( typeof obj.reset === "function" ) {
obj.reset();
}
else if ( obj.value !== undefined ) {
element.update( obj, {innerHTML: "", value: ""} );
}
else {
element.update( obj, {innerHTML: ""} );
}
return obj;
} | [
"function",
"(",
"obj",
")",
"{",
"if",
"(",
"typeof",
"obj",
".",
"reset",
"===",
"\"function\"",
")",
"{",
"obj",
".",
"reset",
"(",
")",
";",
"}",
"else",
"if",
"(",
"obj",
".",
"value",
"!==",
"undefined",
")",
"{",
"element",
".",
"update",
... | Clears an object's innerHTML, or resets it's state
@method clear
@param {Mixed} obj Element
@return {Object} Element | [
"Clears",
"an",
"object",
"s",
"innerHTML",
"or",
"resets",
"it",
"s",
"state"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L4997-L5009 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( type, args, target, pos ) {
var svg = false,
frag = false,
obj, uid, result;
// Removing potential HTML template formatting
type = type.replace( /\t|\n|\r/g, "" );
if ( target !== undefined ) {
svg = ( target.namespaceURI !== undefined && regex.svg.test( target.namespaceURI ) );
}... | javascript | function ( type, args, target, pos ) {
var svg = false,
frag = false,
obj, uid, result;
// Removing potential HTML template formatting
type = type.replace( /\t|\n|\r/g, "" );
if ( target !== undefined ) {
svg = ( target.namespaceURI !== undefined && regex.svg.test( target.namespaceURI ) );
}... | [
"function",
"(",
"type",
",",
"args",
",",
"target",
",",
"pos",
")",
"{",
"var",
"svg",
"=",
"false",
",",
"frag",
"=",
"false",
",",
"obj",
",",
"uid",
",",
"result",
";",
"// Removing potential HTML template formatting",
"type",
"=",
"type",
".",
"rep... | Creates an Element in document.body or a target Element
An id is generated if not specified with args
@method create
@param {String} type Type of Element to create
@param {Object} args [Optional] Collection of properties to apply to the new element
@param {Mixed} target [Optional] Target Element
@param {Mixe... | [
"Creates",
"an",
"Element",
"in",
"document",
".",
"body",
"or",
"a",
"target",
"Element"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5023-L5099 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, key, value ) {
key = string.toCamelCase( key );
if ( value !== undefined ) {
obj.style[key] = value;
return obj;
}
else {
return obj.style[key];
}
} | javascript | function ( obj, key, value ) {
key = string.toCamelCase( key );
if ( value !== undefined ) {
obj.style[key] = value;
return obj;
}
else {
return obj.style[key];
}
} | [
"function",
"(",
"obj",
",",
"key",
",",
"value",
")",
"{",
"key",
"=",
"string",
".",
"toCamelCase",
"(",
"key",
")",
";",
"if",
"(",
"value",
"!==",
"undefined",
")",
"{",
"obj",
".",
"style",
"[",
"key",
"]",
"=",
"value",
";",
"return",
"obj"... | Gets or sets a CSS style attribute on an Element
@method css
@param {Mixed} obj Element
@param {String} key CSS to put in a style tag
@param {String} value [Optional] Value to set
@return {Object} Element | [
"Gets",
"or",
"sets",
"a",
"CSS",
"style",
"attribute",
"on",
"an",
"Element"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5110-L5120 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
observer.remove( obj );
if ( obj.parentNode !== null ) {
obj.parentNode.removeChild( obj );
}
return undefined;
} | javascript | function ( obj ) {
observer.remove( obj );
if ( obj.parentNode !== null ) {
obj.parentNode.removeChild( obj );
}
return undefined;
} | [
"function",
"(",
"obj",
")",
"{",
"observer",
".",
"remove",
"(",
"obj",
")",
";",
"if",
"(",
"obj",
".",
"parentNode",
"!==",
"null",
")",
"{",
"obj",
".",
"parentNode",
".",
"removeChild",
"(",
"obj",
")",
";",
"}",
"return",
"undefined",
";",
"}... | Destroys an Element
@method destroy
@param {Mixed} obj Element
@return {Undefined} undefined | [
"Destroys",
"an",
"Element"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5148-L5156 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg ) {
var result = [];
utility.genId( obj, true );
array.each( string.explode( arg ), function ( i ) {
result = result.concat( utility.$( "#" + obj.id + " " + i ) );
});
return result;
} | javascript | function ( obj, arg ) {
var result = [];
utility.genId( obj, true );
array.each( string.explode( arg ), function ( i ) {
result = result.concat( utility.$( "#" + obj.id + " " + i ) );
});
return result;
} | [
"function",
"(",
"obj",
",",
"arg",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"utility",
".",
"genId",
"(",
"obj",
",",
"true",
")",
";",
"array",
".",
"each",
"(",
"string",
".",
"explode",
"(",
"arg",
")",
",",
"function",
"(",
"i",
")",... | Finds descendant childNodes of Element matched by arg
@method find
@param {Mixed} obj Element to search
@param {String} arg Comma delimited string of descendant selectors
@return {Mixed} Array of Elements or undefined | [
"Finds",
"descendant",
"childNodes",
"of",
"Element",
"matched",
"by",
"arg"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5257-L5267 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( arg ) {
var obj = document.createDocumentFragment();
if ( arg ) {
array.each( array.cast( element.create( "div", {innerHTML: arg}, obj ).childNodes ), function ( i ) {
obj.appendChild( i );
});
obj.removeChild( obj.childNodes[0] );
}
return obj;
} | javascript | function ( arg ) {
var obj = document.createDocumentFragment();
if ( arg ) {
array.each( array.cast( element.create( "div", {innerHTML: arg}, obj ).childNodes ), function ( i ) {
obj.appendChild( i );
});
obj.removeChild( obj.childNodes[0] );
}
return obj;
} | [
"function",
"(",
"arg",
")",
"{",
"var",
"obj",
"=",
"document",
".",
"createDocumentFragment",
"(",
")",
";",
"if",
"(",
"arg",
")",
"{",
"array",
".",
"each",
"(",
"array",
".",
"cast",
"(",
"element",
".",
"create",
"(",
"\"div\"",
",",
"{",
"in... | Creates a document fragment
@method frag
@param {String} arg [Optional] innerHTML
@return {Object} Document fragment | [
"Creates",
"a",
"document",
"fragment"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5276-L5288 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg ) {
var result = element.find( obj, arg );
return ( !isNaN( result.length ) && result.length > 0 );
} | javascript | function ( obj, arg ) {
var result = element.find( obj, arg );
return ( !isNaN( result.length ) && result.length > 0 );
} | [
"function",
"(",
"obj",
",",
"arg",
")",
"{",
"var",
"result",
"=",
"element",
".",
"find",
"(",
"obj",
",",
"arg",
")",
";",
"return",
"(",
"!",
"isNaN",
"(",
"result",
".",
"length",
")",
"&&",
"result",
".",
"length",
">",
"0",
")",
";",
"}"... | Determines if Element has descendants matching arg
@method has
@param {Mixed} obj Element or Array of Elements or $ queries
@param {String} arg Type of Element to find
@return {Boolean} True if 1 or more Elements are found | [
"Determines",
"if",
"Element",
"has",
"descendants",
"matching",
"arg"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5298-L5302 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg ) {
if ( arg === undefined ) {
return obj.innerHTML;
}
else {
obj.innerHTML = arg;
return obj;
}
} | javascript | function ( obj, arg ) {
if ( arg === undefined ) {
return obj.innerHTML;
}
else {
obj.innerHTML = arg;
return obj;
}
} | [
"function",
"(",
"obj",
",",
"arg",
")",
"{",
"if",
"(",
"arg",
"===",
"undefined",
")",
"{",
"return",
"obj",
".",
"innerHTML",
";",
"}",
"else",
"{",
"obj",
".",
"innerHTML",
"=",
"arg",
";",
"return",
"obj",
";",
"}",
"}"
] | Gets or sets an Elements innerHTML
@method html
@param {Object} obj Element
@param {String} arg [Optional] innerHTML value
@return {Object} Element | [
"Gets",
"or",
"sets",
"an",
"Elements",
"innerHTML"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5334-L5342 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg ) {
if ( regex.selector_is.test( arg ) ) {
utility.id( obj );
return ( element.find( obj.parentNode, obj.nodeName.toLowerCase() + arg ).filter( function ( i ) {
return ( i.id === obj.id );
}).length === 1 );
}
else {
return new RegExp( arg, "i" ).test( obj.nodeName );
}
} | javascript | function ( obj, arg ) {
if ( regex.selector_is.test( arg ) ) {
utility.id( obj );
return ( element.find( obj.parentNode, obj.nodeName.toLowerCase() + arg ).filter( function ( i ) {
return ( i.id === obj.id );
}).length === 1 );
}
else {
return new RegExp( arg, "i" ).test( obj.nodeName );
}
} | [
"function",
"(",
"obj",
",",
"arg",
")",
"{",
"if",
"(",
"regex",
".",
"selector_is",
".",
"test",
"(",
"arg",
")",
")",
"{",
"utility",
".",
"id",
"(",
"obj",
")",
";",
"return",
"(",
"element",
".",
"find",
"(",
"obj",
".",
"parentNode",
",",
... | Determines if Element is equal to arg, supports nodeNames & CSS2+ selectors
@method is
@param {Mixed} obj Element
@param {String} arg Property to query
@return {Boolean} True if a match | [
"Determines",
"if",
"Element",
"is",
"equal",
"to",
"arg",
"supports",
"nodeNames",
"&",
"CSS2",
"+",
"selectors"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5352-L5362 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
return obj.nodeName === "FORM" ? false : validate.test( {alphanum : obj.value || element.text( obj )} ).pass;
} | javascript | function ( obj ) {
return obj.nodeName === "FORM" ? false : validate.test( {alphanum : obj.value || element.text( obj )} ).pass;
} | [
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"nodeName",
"===",
"\"FORM\"",
"?",
"false",
":",
"validate",
".",
"test",
"(",
"{",
"alphanum",
":",
"obj",
".",
"value",
"||",
"element",
".",
"text",
"(",
"obj",
")",
"}",
")",
".",
"pass",... | Tests if Element value or text is alpha-numeric
@method isAlphaNum
@param {Object} obj Element to test
@return {Boolean} Result of test | [
"Tests",
"if",
"Element",
"value",
"or",
"text",
"is",
"alpha",
"-",
"numeric"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5371-L5373 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isDate( obj.value || element.text( obj ) );
} | javascript | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isDate( obj.value || element.text( obj ) );
} | [
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"nodeName",
"===",
"\"FORM\"",
"?",
"false",
":",
"string",
".",
"isDate",
"(",
"obj",
".",
"value",
"||",
"element",
".",
"text",
"(",
"obj",
")",
")",
";",
"}"
] | Tests if Element value or text is a date
@method isDate
@param {Object} obj Element to test
@return {Boolean} Result of test | [
"Tests",
"if",
"Element",
"value",
"or",
"text",
"is",
"a",
"date"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5404-L5406 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isDomain( obj.value || element.text( obj ) );
} | javascript | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isDomain( obj.value || element.text( obj ) );
} | [
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"nodeName",
"===",
"\"FORM\"",
"?",
"false",
":",
"string",
".",
"isDomain",
"(",
"obj",
".",
"value",
"||",
"element",
".",
"text",
"(",
"obj",
")",
")",
";",
"}"
] | Tests if Element value or text is a domain
@method isDomain
@param {Object} obj Element to test
@return {Boolean} Result of test | [
"Tests",
"if",
"Element",
"value",
"or",
"text",
"is",
"a",
"domain"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5426-L5428 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isEmail( obj.value || element.text( obj ) );
} | javascript | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isEmail( obj.value || element.text( obj ) );
} | [
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"nodeName",
"===",
"\"FORM\"",
"?",
"false",
":",
"string",
".",
"isEmail",
"(",
"obj",
".",
"value",
"||",
"element",
".",
"text",
"(",
"obj",
")",
")",
";",
"}"
] | Tests if Element value or text is an email address
@method isEmail
@param {Object} obj Element to test
@return {Boolean} Result of test | [
"Tests",
"if",
"Element",
"value",
"or",
"text",
"is",
"an",
"email",
"address"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5437-L5439 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isEmpty( obj.value || element.text( obj ) );
} | javascript | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isEmpty( obj.value || element.text( obj ) );
} | [
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"nodeName",
"===",
"\"FORM\"",
"?",
"false",
":",
"string",
".",
"isEmpty",
"(",
"obj",
".",
"value",
"||",
"element",
".",
"text",
"(",
"obj",
")",
")",
";",
"}"
] | Tests if Element value or text is empty
@method isEmpty
@param {Object} obj Element to test
@return {Boolean} Result of test | [
"Tests",
"if",
"Element",
"value",
"or",
"text",
"is",
"empty"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5448-L5450 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isIP( obj.value || element.text( obj ) );
} | javascript | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isIP( obj.value || element.text( obj ) );
} | [
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"nodeName",
"===",
"\"FORM\"",
"?",
"false",
":",
"string",
".",
"isIP",
"(",
"obj",
".",
"value",
"||",
"element",
".",
"text",
"(",
"obj",
")",
")",
";",
"}"
] | Tests if Element value or text is an IP address
@method isIP
@param {Object} obj Element to test
@return {Boolean} Result of test | [
"Tests",
"if",
"Element",
"value",
"or",
"text",
"is",
"an",
"IP",
"address"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5459-L5461 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isInt( obj.value || element.text( obj ) );
} | javascript | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isInt( obj.value || element.text( obj ) );
} | [
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"nodeName",
"===",
"\"FORM\"",
"?",
"false",
":",
"string",
".",
"isInt",
"(",
"obj",
".",
"value",
"||",
"element",
".",
"text",
"(",
"obj",
")",
")",
";",
"}"
] | Tests if Element value or text is an integer
@method isInt
@param {Object} obj Element to test
@return {Boolean} Result of test | [
"Tests",
"if",
"Element",
"value",
"or",
"text",
"is",
"an",
"integer"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5470-L5472 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isNumber( obj.value || element.text( obj ) );
} | javascript | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isNumber( obj.value || element.text( obj ) );
} | [
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"nodeName",
"===",
"\"FORM\"",
"?",
"false",
":",
"string",
".",
"isNumber",
"(",
"obj",
".",
"value",
"||",
"element",
".",
"text",
"(",
"obj",
")",
")",
";",
"}"
] | Tests if Element value or text is numeric
@method isNumber
@param {Object} obj Element to test
@return {Boolean} Result of test | [
"Tests",
"if",
"Element",
"value",
"or",
"text",
"is",
"numeric"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5481-L5483 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isPhone( obj.value || element.text( obj ) );
} | javascript | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isPhone( obj.value || element.text( obj ) );
} | [
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"nodeName",
"===",
"\"FORM\"",
"?",
"false",
":",
"string",
".",
"isPhone",
"(",
"obj",
".",
"value",
"||",
"element",
".",
"text",
"(",
"obj",
")",
")",
";",
"}"
] | Tests if Element value or text is a phone number
@method isPhone
@param {Object} obj Element to test
@return {Boolean} Result of test | [
"Tests",
"if",
"Element",
"value",
"or",
"text",
"is",
"a",
"phone",
"number"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5492-L5494 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isUrl( obj.value || element.text( obj ) );
} | javascript | function ( obj ) {
return obj.nodeName === "FORM" ? false : string.isUrl( obj.value || element.text( obj ) );
} | [
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"nodeName",
"===",
"\"FORM\"",
"?",
"false",
":",
"string",
".",
"isUrl",
"(",
"obj",
".",
"value",
"||",
"element",
".",
"text",
"(",
"obj",
")",
")",
";",
"}"
] | Tests if Element value or text is a URL
@method isUrl
@param {Object} obj Element to test
@return {Boolean} Result of test | [
"Tests",
"if",
"Element",
"value",
"or",
"text",
"is",
"a",
"URL"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5503-L5505 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, arg, add ) {
add = ( add !== false );
arg = string.explode( arg, " " );
if ( add ) {
array.each( arg, function ( i ) {
obj.classList.add( i );
});
}
else {
array.each( arg, function ( i ) {
if ( i !== "*" ) {
obj.classList.remove( i );
}
else {
array.each( o... | javascript | function ( obj, arg, add ) {
add = ( add !== false );
arg = string.explode( arg, " " );
if ( add ) {
array.each( arg, function ( i ) {
obj.classList.add( i );
});
}
else {
array.each( arg, function ( i ) {
if ( i !== "*" ) {
obj.classList.remove( i );
}
else {
array.each( o... | [
"function",
"(",
"obj",
",",
"arg",
",",
"add",
")",
"{",
"add",
"=",
"(",
"add",
"!==",
"false",
")",
";",
"arg",
"=",
"string",
".",
"explode",
"(",
"arg",
",",
"\" \"",
")",
";",
"if",
"(",
"add",
")",
"{",
"array",
".",
"each",
"(",
"arg"... | Adds or removes a CSS class
@method klass
@param {Mixed} obj Element
@param {String} arg Class to add or remove ( can be a wildcard )
@param {Boolean} add Boolean to add or remove, defaults to true
@return {Object} Element | [
"Adds",
"or",
"removes",
"a",
"CSS",
"class"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5516-L5541 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
obj = obj || document.body;
var left, top, right, bottom, height, width;
left = top = 0;
width = obj.offsetWidth;
height = obj.offsetHeight;
if ( obj.offsetParent ) {
top = obj.offsetTop;
left = obj.offsetLeft;
while ( obj = obj.offsetParent ) {
left += obj.offsetL... | javascript | function ( obj ) {
obj = obj || document.body;
var left, top, right, bottom, height, width;
left = top = 0;
width = obj.offsetWidth;
height = obj.offsetHeight;
if ( obj.offsetParent ) {
top = obj.offsetTop;
left = obj.offsetLeft;
while ( obj = obj.offsetParent ) {
left += obj.offsetL... | [
"function",
"(",
"obj",
")",
"{",
"obj",
"=",
"obj",
"||",
"document",
".",
"body",
";",
"var",
"left",
",",
"top",
",",
"right",
",",
"bottom",
",",
"height",
",",
"width",
";",
"left",
"=",
"top",
"=",
"0",
";",
"width",
"=",
"obj",
".",
"off... | Finds the position of an element
@method position
@param {Mixed} obj Element
@return {Array} Coordinates [left, top, right, bottom] | [
"Finds",
"the",
"position",
"of",
"an",
"element"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5550-L5576 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, child ) {
return obj.childNodes.length === 0 ? obj.appendChild( child ) : obj.insertBefore( child, obj.childNodes[0] );
} | javascript | function ( obj, child ) {
return obj.childNodes.length === 0 ? obj.appendChild( child ) : obj.insertBefore( child, obj.childNodes[0] );
} | [
"function",
"(",
"obj",
",",
"child",
")",
"{",
"return",
"obj",
".",
"childNodes",
".",
"length",
"===",
"0",
"?",
"obj",
".",
"appendChild",
"(",
"child",
")",
":",
"obj",
".",
"insertBefore",
"(",
"child",
",",
"obj",
".",
"childNodes",
"[",
"0",
... | Prepends an Element to an Element
@method prependChild
@param {Object} obj Element
@param {Object} child Child Element
@return {Object} Element | [
"Prepends",
"an",
"Element",
"to",
"an",
"Element"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5586-L5588 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, key ) {
var target;
if ( regex.svg.test( obj.namespaceURI ) ) {
obj.removeAttributeNS( obj.namespaceURI, key );
}
else {
if ( obj.nodeName === "SELECT" && key === "selected") {
target = utility.$( "#" + obj.id + " option[selected=\"selected\"]" )[0];
if ( target !== undefined ) {... | javascript | function ( obj, key ) {
var target;
if ( regex.svg.test( obj.namespaceURI ) ) {
obj.removeAttributeNS( obj.namespaceURI, key );
}
else {
if ( obj.nodeName === "SELECT" && key === "selected") {
target = utility.$( "#" + obj.id + " option[selected=\"selected\"]" )[0];
if ( target !== undefined ) {... | [
"function",
"(",
"obj",
",",
"key",
")",
"{",
"var",
"target",
";",
"if",
"(",
"regex",
".",
"svg",
".",
"test",
"(",
"obj",
".",
"namespaceURI",
")",
")",
"{",
"obj",
".",
"removeAttributeNS",
"(",
"obj",
".",
"namespaceURI",
",",
"key",
")",
";",... | Removes an Element attribute
@method removeAttr
@param {Mixed} obj Element
@param {String} key Attribute name
@return {Object} Element | [
"Removes",
"an",
"Element",
"attribute"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5598-L5619 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, ms ) {
return client.scroll( array.remove( element.position( obj ), 2, 3 ), ms );
} | javascript | function ( obj, ms ) {
return client.scroll( array.remove( element.position( obj ), 2, 3 ), ms );
} | [
"function",
"(",
"obj",
",",
"ms",
")",
"{",
"return",
"client",
".",
"scroll",
"(",
"array",
".",
"remove",
"(",
"element",
".",
"position",
"(",
"obj",
")",
",",
"2",
",",
"3",
")",
",",
"ms",
")",
";",
"}"
] | Scrolls to the position of an Element
@method scrollTo
@param {Object} obj Element to scroll to
@param {Number} ms [Optional] Milliseconds to scroll, default is 250, min is 100
@return {Object} Deferred | [
"Scrolls",
"to",
"the",
"position",
"of",
"an",
"Element"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5629-L5631 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, string, encode ) {
string = ( string === true );
encode = ( encode !== false );
var children = [],
registry = {},
result;
children = obj.nodeName === "FORM" ? ( obj.elements !== undefined ? array.cast( obj.elements ) : obj.find( "button, input, select, textarea" ) ) : [o... | javascript | function ( obj, string, encode ) {
string = ( string === true );
encode = ( encode !== false );
var children = [],
registry = {},
result;
children = obj.nodeName === "FORM" ? ( obj.elements !== undefined ? array.cast( obj.elements ) : obj.find( "button, input, select, textarea" ) ) : [o... | [
"function",
"(",
"obj",
",",
"string",
",",
"encode",
")",
"{",
"string",
"=",
"(",
"string",
"===",
"true",
")",
";",
"encode",
"=",
"(",
"encode",
"!==",
"false",
")",
";",
"var",
"children",
"=",
"[",
"]",
",",
"registry",
"=",
"{",
"}",
",",
... | Serializes the elements of an Element
@method serialize
@param {Object} obj Element
@param {Boolean} string [Optional] true if you want a query string, default is false ( JSON )
@param {Boolean} encode [Optional] true if you want to URI encode the value, default is true
@return {Mixed} String or Object | [
"Serializes",
"the",
"elements",
"of",
"an",
"Element"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5642-L5674 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
var parse = function ( arg ) {
return number.parse(arg, 10);
};
return {
height : obj.offsetHeight + parse( obj.style.paddingTop || 0 ) + parse( obj.style.paddingBottom || 0 ) + parse( obj.style.borderTop || 0 ) + parse( obj.style.borderBottom || 0 ),
width : obj.offsetWidth + par... | javascript | function ( obj ) {
var parse = function ( arg ) {
return number.parse(arg, 10);
};
return {
height : obj.offsetHeight + parse( obj.style.paddingTop || 0 ) + parse( obj.style.paddingBottom || 0 ) + parse( obj.style.borderTop || 0 ) + parse( obj.style.borderBottom || 0 ),
width : obj.offsetWidth + par... | [
"function",
"(",
"obj",
")",
"{",
"var",
"parse",
"=",
"function",
"(",
"arg",
")",
"{",
"return",
"number",
".",
"parse",
"(",
"arg",
",",
"10",
")",
";",
"}",
";",
"return",
"{",
"height",
":",
"obj",
".",
"offsetHeight",
"+",
"parse",
"(",
"ob... | Returns the size of the Object
@method size
@param {Mixed} obj Element
@return {Object} Size {height: n, width:n} | [
"Returns",
"the",
"size",
"of",
"the",
"Object"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5683-L5692 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, args ) {
args = args || {};
utility.iterate( args, function ( v, k ) {
if ( regex.element_update.test( k ) ) {
obj[k] = v;
}
else if ( k === "class" ) {
!string.isEmpty( v ) ? element.klass( obj, v ) : element.klass( obj, "*", false );
}
else if ( k.indexOf( "data-" ) === 0 )... | javascript | function ( obj, args ) {
args = args || {};
utility.iterate( args, function ( v, k ) {
if ( regex.element_update.test( k ) ) {
obj[k] = v;
}
else if ( k === "class" ) {
!string.isEmpty( v ) ? element.klass( obj, v ) : element.klass( obj, "*", false );
}
else if ( k.indexOf( "data-" ) === 0 )... | [
"function",
"(",
"obj",
",",
"args",
")",
"{",
"args",
"=",
"args",
"||",
"{",
"}",
";",
"utility",
".",
"iterate",
"(",
"args",
",",
"function",
"(",
"v",
",",
"k",
")",
"{",
"if",
"(",
"regex",
".",
"element_update",
".",
"test",
"(",
"k",
")... | Updates an Element
@method update
@param {Mixed} obj Element
@param {Object} args Collection of properties
@return {Object} Element | [
"Updates",
"an",
"Element"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5737-L5764 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, value ) {
var event = "input",
output;
if ( value === undefined ) {
if ( regex.radio_checkbox.test( obj.type ) ) {
if ( string.isEmpty( obj.name ) ) {
throw new Error( label.error.expectedProperty );
}
array.each( utility.$( "input[name='" + obj.name + "']" ), function ( ... | javascript | function ( obj, value ) {
var event = "input",
output;
if ( value === undefined ) {
if ( regex.radio_checkbox.test( obj.type ) ) {
if ( string.isEmpty( obj.name ) ) {
throw new Error( label.error.expectedProperty );
}
array.each( utility.$( "input[name='" + obj.name + "']" ), function ( ... | [
"function",
"(",
"obj",
",",
"value",
")",
"{",
"var",
"event",
"=",
"\"input\"",
",",
"output",
";",
"if",
"(",
"value",
"===",
"undefined",
")",
"{",
"if",
"(",
"regex",
".",
"radio_checkbox",
".",
"test",
"(",
"obj",
".",
"type",
")",
")",
"{",
... | Gets or sets the value of Element
@method val
@param {Mixed} obj Element
@param {Mixed} value [Optional] Value to set
@return {Object} Element | [
"Gets",
"or",
"sets",
"the",
"value",
"of",
"Element"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5774-L5844 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
return obj.nodeName === "FORM" ? validate.test( obj ) : !string.isEmpty( obj.value || element.text( obj ) );
} | javascript | function ( obj ) {
return obj.nodeName === "FORM" ? validate.test( obj ) : !string.isEmpty( obj.value || element.text( obj ) );
} | [
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"nodeName",
"===",
"\"FORM\"",
"?",
"validate",
".",
"test",
"(",
"obj",
")",
":",
"!",
"string",
".",
"isEmpty",
"(",
"obj",
".",
"value",
"||",
"element",
".",
"text",
"(",
"obj",
")",
")",
... | Validates the contents of Element
@method validate
@param {Object} obj Element to test
@return {Object} Result of test | [
"Validates",
"the",
"contents",
"of",
"Element"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L5853-L5855 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( arg, delimiter, header ) {
delimiter = delimiter || ",";
header = ( header !== false );
var obj = json.decode( arg, true ) || arg,
result = "",
prepare;
// Prepares input based on CSV rules
prepare = function ( input ) {
var output;
if ( input instanceof Array ) {
ou... | javascript | function ( arg, delimiter, header ) {
delimiter = delimiter || ",";
header = ( header !== false );
var obj = json.decode( arg, true ) || arg,
result = "",
prepare;
// Prepares input based on CSV rules
prepare = function ( input ) {
var output;
if ( input instanceof Array ) {
ou... | [
"function",
"(",
"arg",
",",
"delimiter",
",",
"header",
")",
"{",
"delimiter",
"=",
"delimiter",
"||",
"\",\"",
";",
"header",
"=",
"(",
"header",
"!==",
"false",
")",
";",
"var",
"obj",
"=",
"json",
".",
"decode",
"(",
"arg",
",",
"true",
")",
"|... | Transforms JSON to CSV
@method csv
@param {String} arg JSON string to transform
@param {String} delimiter [Optional] Character to separate fields
@param {Boolean} header [Optional] False to not include field names as first row
@return {String} CSV string | [
"Transforms",
"JSON",
"to",
"CSV"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L6200-L6255 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( arg, silent ) {
try {
return JSON.parse( arg );
}
catch ( e ) {
if ( silent !== true ) {
utility.error( e, arguments, this );
}
return undefined;
}
} | javascript | function ( arg, silent ) {
try {
return JSON.parse( arg );
}
catch ( e ) {
if ( silent !== true ) {
utility.error( e, arguments, this );
}
return undefined;
}
} | [
"function",
"(",
"arg",
",",
"silent",
")",
"{",
"try",
"{",
"return",
"JSON",
".",
"parse",
"(",
"arg",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"if",
"(",
"silent",
"!==",
"true",
")",
"{",
"utility",
".",
"error",
"(",
"e",
",",
"argument... | Decodes the argument
@method decode
@param {String} arg String to parse
@param {Boolean} silent [Optional] Silently fail
@return {Mixed} Entity resulting from parsing JSON, or undefined | [
"Decodes",
"the",
"argument"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L6265-L6276 | train | |
avoidwork/abaaso | lib/abaaso.js | LRU | function LRU ( max ) {
this.cache = {};
this.max = max || 1000;
this.first = null;
this.last = null;
this.length = 0;
} | javascript | function LRU ( max ) {
this.cache = {};
this.max = max || 1000;
this.first = null;
this.last = null;
this.length = 0;
} | [
"function",
"LRU",
"(",
"max",
")",
"{",
"this",
".",
"cache",
"=",
"{",
"}",
";",
"this",
".",
"max",
"=",
"max",
"||",
"1000",
";",
"this",
".",
"first",
"=",
"null",
";",
"this",
".",
"last",
"=",
"null",
";",
"this",
".",
"length",
"=",
"... | Least Recently Used cache
@constructor
@param {Number} max [Optional] Max size of cache, default is 1000 | [
"Least",
"Recently",
"Used",
"cache"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L6412-L6418 | train |
avoidwork/abaaso | lib/abaaso.js | function () {
var a = array.cast( arguments ),
t = a.pop(),
P = array.chunk( a, 2 ),
n = P.length,
c, S0, Q0, Q1, Q2, C0, C1, C2, C3;
if ( n < 2 || n > 4 ) {
throw new Error( label.error.invalidArguments );
}
// Setting variables
c = [];
S0 = 1 - t;
Q0 = math.sqr( S0 );
Q1 ... | javascript | function () {
var a = array.cast( arguments ),
t = a.pop(),
P = array.chunk( a, 2 ),
n = P.length,
c, S0, Q0, Q1, Q2, C0, C1, C2, C3;
if ( n < 2 || n > 4 ) {
throw new Error( label.error.invalidArguments );
}
// Setting variables
c = [];
S0 = 1 - t;
Q0 = math.sqr( S0 );
Q1 ... | [
"function",
"(",
")",
"{",
"var",
"a",
"=",
"array",
".",
"cast",
"(",
"arguments",
")",
",",
"t",
"=",
"a",
".",
"pop",
"(",
")",
",",
"P",
"=",
"array",
".",
"chunk",
"(",
"a",
",",
"2",
")",
",",
"n",
"=",
"P",
".",
"length",
",",
"c",... | Generates bezier curve coordinates for up to 4 points, last parameter is `t`
Two point example: (0, 10, 0, 0, 1) means move straight up
@method bezier
@return {Array} Coordinates | [
"Generates",
"bezier",
"curve",
"coordinates",
"for",
"up",
"to",
"4",
"points",
"last",
"parameter",
"is",
"t"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L6555-L6594 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( a, b ) {
return Math.sqrt( math.sqr( b[0] - a[0] ) + math.sqr( b[1] - a[1] ) );
} | javascript | function ( a, b ) {
return Math.sqrt( math.sqr( b[0] - a[0] ) + math.sqr( b[1] - a[1] ) );
} | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"return",
"Math",
".",
"sqrt",
"(",
"math",
".",
"sqr",
"(",
"b",
"[",
"0",
"]",
"-",
"a",
"[",
"0",
"]",
")",
"+",
"math",
".",
"sqr",
"(",
"b",
"[",
"1",
"]",
"-",
"a",
"[",
"1",
"]",
")",
"... | Finds the distance between 2 Arrays of coordinates
@method dist
@param {Array} a Coordinates [x, y]
@param {Array} b Coordinates [x, y]
@return {Number} Distance between `a` & `b` | [
"Finds",
"the",
"distance",
"between",
"2",
"Arrays",
"of",
"coordinates"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L6604-L6606 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( target, arg ) {
try {
target.postMessage( arg, "*" );
}
catch ( e ) {
utility.error( e, arguments, this );
}
return target;
} | javascript | function ( target, arg ) {
try {
target.postMessage( arg, "*" );
}
catch ( e ) {
utility.error( e, arguments, this );
}
return target;
} | [
"function",
"(",
"target",
",",
"arg",
")",
"{",
"try",
"{",
"target",
".",
"postMessage",
"(",
"arg",
",",
"\"*\"",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"utility",
".",
"error",
"(",
"e",
",",
"arguments",
",",
"this",
")",
";",
"}",
"r... | Posts a message to the target
@method send
@param {Object} target Object to receive message
@param {Mixed} arg Entity to send as message
@return {Object} target | [
"Posts",
"a",
"message",
"to",
"the",
"target"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L6642-L6651 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( fn, state ) {
state = state || "all";
return observer.add( global, "message", fn, "message", global, state );
} | javascript | function ( fn, state ) {
state = state || "all";
return observer.add( global, "message", fn, "message", global, state );
} | [
"function",
"(",
"fn",
",",
"state",
")",
"{",
"state",
"=",
"state",
"||",
"\"all\"",
";",
"return",
"observer",
".",
"add",
"(",
"global",
",",
"\"message\"",
",",
"fn",
",",
"\"message\"",
",",
"global",
",",
"state",
")",
";",
"}"
] | Sets a handler for recieving a message
@method recv
@param {Function} fn Callback function
@return {Object} abaaso | [
"Sets",
"a",
"handler",
"for",
"recieving",
"a",
"message"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L6660-L6664 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( arg ) {
var type = typeof arg;
if ( type === "object" ) {
var v = document[mouse.view],
x = arg.pageX ? arg.pageX : ( v.scrollLeft + arg.clientX ),
y = arg.pageY ? arg.pageY : ( v.scrollTop + arg.clientY ),
c = false;
if ( mouse.pos.x !== x ) {
c = true;
}
$.mouse... | javascript | function ( arg ) {
var type = typeof arg;
if ( type === "object" ) {
var v = document[mouse.view],
x = arg.pageX ? arg.pageX : ( v.scrollLeft + arg.clientX ),
y = arg.pageY ? arg.pageY : ( v.scrollTop + arg.clientY ),
c = false;
if ( mouse.pos.x !== x ) {
c = true;
}
$.mouse... | [
"function",
"(",
"arg",
")",
"{",
"var",
"type",
"=",
"typeof",
"arg",
";",
"if",
"(",
"type",
"===",
"\"object\"",
")",
"{",
"var",
"v",
"=",
"document",
"[",
"mouse",
".",
"view",
"]",
",",
"x",
"=",
"arg",
".",
"pageX",
"?",
"arg",
".",
"pag... | Enables or disables mouse co-ordinate tracking
@method track
@param {Mixed} arg Boolean to enable/disable tracking, or Mouse Event
@return {Object} $.mouse | [
"Enables",
"or",
"disables",
"mouse",
"co",
"-",
"ordinate",
"tracking"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L6692-L6727 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( num1, num2 ) {
if ( isNaN( num1 ) || isNaN( num2 ) ) {
throw new Error( label.error.expectedNumber );
}
return Math.abs( num1 - num2 );
} | javascript | function ( num1, num2 ) {
if ( isNaN( num1 ) || isNaN( num2 ) ) {
throw new Error( label.error.expectedNumber );
}
return Math.abs( num1 - num2 );
} | [
"function",
"(",
"num1",
",",
"num2",
")",
"{",
"if",
"(",
"isNaN",
"(",
"num1",
")",
"||",
"isNaN",
"(",
"num2",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"label",
".",
"error",
".",
"expectedNumber",
")",
";",
"}",
"return",
"Math",
".",
"ab... | Returns the difference of arg
@method odd
@param {Number} arg Number to compare
@return {Number} The absolute difference | [
"Returns",
"the",
"difference",
"of",
"arg"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L6739-L6745 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( arg, delimiter, every ) {
if ( isNaN( arg ) ) {
throw new Error( label.error.expectedNumber );
}
arg = arg.toString();
delimiter = delimiter || ",";
every = every || 3;
var d = arg.indexOf( "." ) > -1 ? "." + arg.replace( regex.number_format_1, "" ) : "",
a = arg.replace(... | javascript | function ( arg, delimiter, every ) {
if ( isNaN( arg ) ) {
throw new Error( label.error.expectedNumber );
}
arg = arg.toString();
delimiter = delimiter || ",";
every = every || 3;
var d = arg.indexOf( "." ) > -1 ? "." + arg.replace( regex.number_format_1, "" ) : "",
a = arg.replace(... | [
"function",
"(",
"arg",
",",
"delimiter",
",",
"every",
")",
"{",
"if",
"(",
"isNaN",
"(",
"arg",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"label",
".",
"error",
".",
"expectedNumber",
")",
";",
"}",
"arg",
"=",
"arg",
".",
"toString",
"(",
"... | Formats a Number to a delimited String
@method format
@param {Number} arg Number to format
@param {String} delimiter [Optional] String to delimit the Number with
@param {String} every [Optional] Position to insert the delimiter, default is 3
@return {String} Number represented as a comma delimit... | [
"Formats",
"a",
"Number",
"to",
"a",
"delimited",
"String"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L6767-L6794 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( arg, direction ) {
arg = number.parse( arg );
if ( direction === undefined || string.isEmpty( direction ) ) {
return number.parse( arg.toFixed( 0 ) );
}
else if ( regex.down.test( direction ) ) {
return ~~( arg );
}
else {
return Math.ceil( arg );
}
} | javascript | function ( arg, direction ) {
arg = number.parse( arg );
if ( direction === undefined || string.isEmpty( direction ) ) {
return number.parse( arg.toFixed( 0 ) );
}
else if ( regex.down.test( direction ) ) {
return ~~( arg );
}
else {
return Math.ceil( arg );
}
} | [
"function",
"(",
"arg",
",",
"direction",
")",
"{",
"arg",
"=",
"number",
".",
"parse",
"(",
"arg",
")",
";",
"if",
"(",
"direction",
"===",
"undefined",
"||",
"string",
".",
"isEmpty",
"(",
"direction",
")",
")",
"{",
"return",
"number",
".",
"parse... | Rounds a number up or down
@method round
@param {Number} arg Number to round
@param {String} direction [Optional] "up" or "down"
@return {Number} Rounded interger | [
"Rounds",
"a",
"number",
"up",
"or",
"down"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L6853-L6865 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj ) {
var methods = [
["fire", function () { return observer.fire.apply( observer, [this].concat( array.cast( arguments ) ) ); }],
["listeners", function ( event ) { return observer.list(this, event ); }],
["on", function ( event, listener, id, scope, standby ) { return observer.add(... | javascript | function ( obj ) {
var methods = [
["fire", function () { return observer.fire.apply( observer, [this].concat( array.cast( arguments ) ) ); }],
["listeners", function ( event ) { return observer.list(this, event ); }],
["on", function ( event, listener, id, scope, standby ) { return observer.add(... | [
"function",
"(",
"obj",
")",
"{",
"var",
"methods",
"=",
"[",
"[",
"\"fire\"",
",",
"function",
"(",
")",
"{",
"return",
"observer",
".",
"fire",
".",
"apply",
"(",
"observer",
",",
"[",
"this",
"]",
".",
"concat",
"(",
"array",
".",
"cast",
"(",
... | Decorates `obj` with `observer` methods
@method decorate
@param {Object} obj Object to decorate
@return {Object} Object to decorate | [
"Decorates",
"obj",
"with",
"observer",
"methods"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L7019-L7033 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, event ) {
var quit = false,
a = array.remove( array.cast( arguments ), 0, 1 ),
o, s, log, list;
if ( observer.ignore ) {
return obj;
}
o = observer.id( obj );
if ( o === undefined || event === undefined ) {
throw new Error( label.error.invalidArguments );
}
if ( ob... | javascript | function ( obj, event ) {
var quit = false,
a = array.remove( array.cast( arguments ), 0, 1 ),
o, s, log, list;
if ( observer.ignore ) {
return obj;
}
o = observer.id( obj );
if ( o === undefined || event === undefined ) {
throw new Error( label.error.invalidArguments );
}
if ( ob... | [
"function",
"(",
"obj",
",",
"event",
")",
"{",
"var",
"quit",
"=",
"false",
",",
"a",
"=",
"array",
".",
"remove",
"(",
"array",
".",
"cast",
"(",
"arguments",
")",
",",
"0",
",",
"1",
")",
",",
"o",
",",
"s",
",",
"log",
",",
"list",
";",
... | Fires an event
@method fire
@param {Mixed} obj Primitive
@param {String} event Event, or Events being fired ( comma delimited supported )
@return {Mixed} Primitive | [
"Fires",
"an",
"event"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L7054-L7104 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( arg ) {
var id;
if ( arg === global ) {
id = "window";
}
else if ( !server && arg === document ) {
id = "document";
}
else if ( !server && arg === document.body ) {
id = "body";
}
else {
utility.genId( arg );
id = arg.id || ( typeof arg.toString === "function" ? arg.toString()... | javascript | function ( arg ) {
var id;
if ( arg === global ) {
id = "window";
}
else if ( !server && arg === document ) {
id = "document";
}
else if ( !server && arg === document.body ) {
id = "body";
}
else {
utility.genId( arg );
id = arg.id || ( typeof arg.toString === "function" ? arg.toString()... | [
"function",
"(",
"arg",
")",
"{",
"var",
"id",
";",
"if",
"(",
"arg",
"===",
"global",
")",
"{",
"id",
"=",
"\"window\"",
";",
"}",
"else",
"if",
"(",
"!",
"server",
"&&",
"arg",
"===",
"document",
")",
"{",
"id",
"=",
"\"document\"",
";",
"}",
... | Gets the Observer id of arg
@method id
@param {Mixed} Object or String
@return {String} Observer id | [
"Gets",
"the",
"Observer",
"id",
"of",
"arg"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L7113-L7131 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, event, target ) {
var l = target || observer.listeners,
o = observer.id( obj ),
r;
if ( l[o] === undefined && event === undefined ) {
r = {};
}
else if ( l[o] !== undefined && ( event === undefined || string.isEmpty( event ) ) ) {
r = l[o];
}
else if ( l[o] !== undefined &... | javascript | function ( obj, event, target ) {
var l = target || observer.listeners,
o = observer.id( obj ),
r;
if ( l[o] === undefined && event === undefined ) {
r = {};
}
else if ( l[o] !== undefined && ( event === undefined || string.isEmpty( event ) ) ) {
r = l[o];
}
else if ( l[o] !== undefined &... | [
"function",
"(",
"obj",
",",
"event",
",",
"target",
")",
"{",
"var",
"l",
"=",
"target",
"||",
"observer",
".",
"listeners",
",",
"o",
"=",
"observer",
".",
"id",
"(",
"obj",
")",
",",
"r",
";",
"if",
"(",
"l",
"[",
"o",
"]",
"===",
"undefined... | Gets the listeners for an event
@method list
@param {Mixed} obj Primitive
@param {String} event Event being queried
@param {Object} target [Optional] Listeners collection to access, default is `observer.listeners`
@return {Mixed} Primitive | [
"Gets",
"the",
"listeners",
"for",
"an",
"event"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L7142-L7161 | train | |
avoidwork/abaaso | lib/abaaso.js | function ( obj, event, fn, id, scope, st ) {
var uuid = id || utility.genId();
scope = scope || obj;
st = st || state.getCurrent();
if ( obj === undefined || event === null || event === undefined || typeof fn !== "function" ) {
throw new Error( label.error.invalidArguments );
}
observer.add( obj... | javascript | function ( obj, event, fn, id, scope, st ) {
var uuid = id || utility.genId();
scope = scope || obj;
st = st || state.getCurrent();
if ( obj === undefined || event === null || event === undefined || typeof fn !== "function" ) {
throw new Error( label.error.invalidArguments );
}
observer.add( obj... | [
"function",
"(",
"obj",
",",
"event",
",",
"fn",
",",
"id",
",",
"scope",
",",
"st",
")",
"{",
"var",
"uuid",
"=",
"id",
"||",
"utility",
".",
"genId",
"(",
")",
";",
"scope",
"=",
"scope",
"||",
"obj",
";",
"st",
"=",
"st",
"||",
"state",
".... | Adds a listener for a single execution
@method once
@param {Mixed} obj Primitive
@param {String} event Event being fired
@param {Function} fn Event handler
@param {String} id [Optional / Recommended] The id for the listener
@param {String} scope [Optional / Recommended] The id of the object or el... | [
"Adds",
"a",
"listener",
"for",
"a",
"single",
"execution"
] | 07c147684bccd28868f377881eb80ffc285cd483 | https://github.com/avoidwork/abaaso/blob/07c147684bccd28868f377881eb80ffc285cd483/lib/abaaso.js#L7175-L7191 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.