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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
redisjs/jsr-script | lib/runner.js | sha1hex | function sha1hex(source) {
var hash = crypto.createHash(SHA1);
hash.update(new Buffer('' + source));
return hash.digest(ENCODING);
} | javascript | function sha1hex(source) {
var hash = crypto.createHash(SHA1);
hash.update(new Buffer('' + source));
return hash.digest(ENCODING);
} | [
"function",
"sha1hex",
"(",
"source",
")",
"{",
"var",
"hash",
"=",
"crypto",
".",
"createHash",
"(",
"SHA1",
")",
";",
"hash",
".",
"update",
"(",
"new",
"Buffer",
"(",
"''",
"+",
"source",
")",
")",
";",
"return",
"hash",
".",
"digest",
"(",
"ENC... | Utility to create an sha1 checksum from a source script. | [
"Utility",
"to",
"create",
"an",
"sha1",
"checksum",
"from",
"a",
"source",
"script",
"."
] | eab3df935372724a82a9ad9ba3bca7e6e165e9d1 | https://github.com/redisjs/jsr-script/blob/eab3df935372724a82a9ad9ba3bca7e6e165e9d1/lib/runner.js#L66-L70 | train |
redisjs/jsr-script | lib/runner.js | load | function load(source) {
var redis
, method
, script
, name
, digest;
digest = sha1hex(source);
if(this._cache[digest]) {
return {script: this._cache[digest], sha: digest};
}
name = 'f_' + digest;
method = util.format(
'var method = function %s(KEYS, ARGS, cb) {%s}', name, source);... | javascript | function load(source) {
var redis
, method
, script
, name
, digest;
digest = sha1hex(source);
if(this._cache[digest]) {
return {script: this._cache[digest], sha: digest};
}
name = 'f_' + digest;
method = util.format(
'var method = function %s(KEYS, ARGS, cb) {%s}', name, source);... | [
"function",
"load",
"(",
"source",
")",
"{",
"var",
"redis",
",",
"method",
",",
"script",
",",
"name",
",",
"digest",
";",
"digest",
"=",
"sha1hex",
"(",
"source",
")",
";",
"if",
"(",
"this",
".",
"_cache",
"[",
"digest",
"]",
")",
"{",
"return",... | Compile a script, generate a digest and add it to the cache. | [
"Compile",
"a",
"script",
"generate",
"a",
"digest",
"and",
"add",
"it",
"to",
"the",
"cache",
"."
] | eab3df935372724a82a9ad9ba3bca7e6e165e9d1 | https://github.com/redisjs/jsr-script/blob/eab3df935372724a82a9ad9ba3bca7e6e165e9d1/lib/runner.js#L75-L107 | train |
redisjs/jsr-script | lib/runner.js | exec | function exec(script, numkeys) {
var KEYS = slice.call(arguments, 2, 2 + numkeys);
var ARGS = slice.call(arguments, numkeys + 2);
function cb(err, reply) {
if(err) reply = err.message;
process.send(
{
err: (err instanceof Error),
data: reply,
str: (reply instanceof String)
... | javascript | function exec(script, numkeys) {
var KEYS = slice.call(arguments, 2, 2 + numkeys);
var ARGS = slice.call(arguments, numkeys + 2);
function cb(err, reply) {
if(err) reply = err.message;
process.send(
{
err: (err instanceof Error),
data: reply,
str: (reply instanceof String)
... | [
"function",
"exec",
"(",
"script",
",",
"numkeys",
")",
"{",
"var",
"KEYS",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"2",
",",
"2",
"+",
"numkeys",
")",
";",
"var",
"ARGS",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"numkeys",
"+",
... | Execute a pre-compiled script. | [
"Execute",
"a",
"pre",
"-",
"compiled",
"script",
"."
] | eab3df935372724a82a9ad9ba3bca7e6e165e9d1 | https://github.com/redisjs/jsr-script/blob/eab3df935372724a82a9ad9ba3bca7e6e165e9d1/lib/runner.js#L112-L207 | train |
redisjs/jsr-script | lib/runner.js | run | function run(script, args) {
var res, result, name;
try {
res = this.exec.apply(this, [script].concat(args));
result = res.result;
//console.dir(result);
//console.dir(result instanceof Error);
if(typeof result === 'function') return;
if(result === undefined) {
throw new Error('undefi... | javascript | function run(script, args) {
var res, result, name;
try {
res = this.exec.apply(this, [script].concat(args));
result = res.result;
//console.dir(result);
//console.dir(result instanceof Error);
if(typeof result === 'function') return;
if(result === undefined) {
throw new Error('undefi... | [
"function",
"run",
"(",
"script",
",",
"args",
")",
"{",
"var",
"res",
",",
"result",
",",
"name",
";",
"try",
"{",
"res",
"=",
"this",
".",
"exec",
".",
"apply",
"(",
"this",
",",
"[",
"script",
"]",
".",
"concat",
"(",
"args",
")",
")",
";",
... | Run a script.
@param script The compiled script function.
@param args The script arguments. | [
"Run",
"a",
"script",
"."
] | eab3df935372724a82a9ad9ba3bca7e6e165e9d1 | https://github.com/redisjs/jsr-script/blob/eab3df935372724a82a9ad9ba3bca7e6e165e9d1/lib/runner.js#L215-L250 | train |
redisjs/jsr-script | lib/runner.js | exists | function exists(args) {
var list = [];
for(var i = 0;i < args.length;i++) {
list.push(this._cache[args[i]] ? 1 : 0);
}
return list;
} | javascript | function exists(args) {
var list = [];
for(var i = 0;i < args.length;i++) {
list.push(this._cache[args[i]] ? 1 : 0);
}
return list;
} | [
"function",
"exists",
"(",
"args",
")",
"{",
"var",
"list",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"args",
".",
"length",
";",
"i",
"++",
")",
"{",
"list",
".",
"push",
"(",
"this",
".",
"_cache",
"[",
"args",
... | Get a script by sha digest. | [
"Get",
"a",
"script",
"by",
"sha",
"digest",
"."
] | eab3df935372724a82a9ad9ba3bca7e6e165e9d1 | https://github.com/redisjs/jsr-script/blob/eab3df935372724a82a9ad9ba3bca7e6e165e9d1/lib/runner.js#L255-L261 | train |
tolokoban/ToloFrameWork | tst/www/js/@index.js | fixContainer | function fixContainer ( container ) {
var children = container.childNodes,
doc = container.ownerDocument,
wrapper = null,
i, l, child, isBR,
config = getSquireInstance( doc )._config;
for ( i = 0, l = children.length; i < l; i += 1 ) {
child = children[i];
isBR =... | javascript | function fixContainer ( container ) {
var children = container.childNodes,
doc = container.ownerDocument,
wrapper = null,
i, l, child, isBR,
config = getSquireInstance( doc )._config;
for ( i = 0, l = children.length; i < l; i += 1 ) {
child = children[i];
isBR =... | [
"function",
"fixContainer",
"(",
"container",
")",
"{",
"var",
"children",
"=",
"container",
".",
"childNodes",
",",
"doc",
"=",
"container",
".",
"ownerDocument",
",",
"wrapper",
"=",
"null",
",",
"i",
",",
"l",
",",
"child",
",",
"isBR",
",",
"config",... | Recursively examine container nodes and wrap any inline children. | [
"Recursively",
"examine",
"container",
"nodes",
"and",
"wrap",
"any",
"inline",
"children",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/tst/www/js/@index.js#L501-L542 | train |
tolokoban/ToloFrameWork | tst/www/js/@index.js | function ( node, exemplar ) {
// If the node is completely contained by the range then
// we're going to remove all formatting so ignore it.
if ( isNodeContainedInRange( range, node, false ) ) {
return;
}
var isText = ( node.nodeType === TEXT_... | javascript | function ( node, exemplar ) {
// If the node is completely contained by the range then
// we're going to remove all formatting so ignore it.
if ( isNodeContainedInRange( range, node, false ) ) {
return;
}
var isText = ( node.nodeType === TEXT_... | [
"function",
"(",
"node",
",",
"exemplar",
")",
"{",
"// If the node is completely contained by the range then",
"// we're going to remove all formatting so ignore it.",
"if",
"(",
"isNodeContainedInRange",
"(",
"range",
",",
"node",
",",
"false",
")",
")",
"{",
"return",
... | Find text nodes inside formatTags that are not in selection and add an extra tag with the same formatting. | [
"Find",
"text",
"nodes",
"inside",
"formatTags",
"that",
"are",
"not",
"in",
"selection",
"and",
"add",
"an",
"extra",
"tag",
"with",
"the",
"same",
"formatting",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/tst/www/js/@index.js#L3231-L3271 | train | |
kyleburnett/error-engine | index.js | compose | function compose(auto_template, dictionary, key, params) {
var composer = dictionary[key];
// If auto_template is set to true, make dictionary value
if (auto_template) {
if (typeof composer === "string") {
composer = _.template(composer);
} else if (typeof composer !== "function... | javascript | function compose(auto_template, dictionary, key, params) {
var composer = dictionary[key];
// If auto_template is set to true, make dictionary value
if (auto_template) {
if (typeof composer === "string") {
composer = _.template(composer);
} else if (typeof composer !== "function... | [
"function",
"compose",
"(",
"auto_template",
",",
"dictionary",
",",
"key",
",",
"params",
")",
"{",
"var",
"composer",
"=",
"dictionary",
"[",
"key",
"]",
";",
"// If auto_template is set to true, make dictionary value",
"if",
"(",
"auto_template",
")",
"{",
"if"... | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Local Functions | [
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
"Local",
"Functions"
] | 16be944e2f6457e3dc6755e080077e441f07e207 | https://github.com/kyleburnett/error-engine/blob/16be944e2f6457e3dc6755e080077e441f07e207/index.js#L12-L36 | train |
fortyau/grunt-fg-codependent | tasks/componentize.js | resolveSerializer | function resolveSerializer(key) {
var serializer = SERIALIZERS[key] || key;
if (!_.isFunction(serializer)) {
grunt.fail.warn('Invalid serializer. Serializer needs to be a function.');
}
return serializer;
} | javascript | function resolveSerializer(key) {
var serializer = SERIALIZERS[key] || key;
if (!_.isFunction(serializer)) {
grunt.fail.warn('Invalid serializer. Serializer needs to be a function.');
}
return serializer;
} | [
"function",
"resolveSerializer",
"(",
"key",
")",
"{",
"var",
"serializer",
"=",
"SERIALIZERS",
"[",
"key",
"]",
"||",
"key",
";",
"if",
"(",
"!",
"_",
".",
"isFunction",
"(",
"serializer",
")",
")",
"{",
"grunt",
".",
"fail",
".",
"warn",
"(",
"'Inv... | Add delimiters that do not conflict with grunt | [
"Add",
"delimiters",
"that",
"do",
"not",
"conflict",
"with",
"grunt"
] | c7f57943eae6cdcade108e2a8ba8918297857394 | https://github.com/fortyau/grunt-fg-codependent/blob/c7f57943eae6cdcade108e2a8ba8918297857394/tasks/componentize.js#L95-L101 | train |
tolokoban/ToloFrameWork | lib/module-analyser.js | extractInfoFromAst | function extractInfoFromAst( ast ) {
const output = {
requires: [],
exports: findExports( ast )
};
recursivelyExtractInfoFromAst( ast.program.body, output );
return output;
} | javascript | function extractInfoFromAst( ast ) {
const output = {
requires: [],
exports: findExports( ast )
};
recursivelyExtractInfoFromAst( ast.program.body, output );
return output;
} | [
"function",
"extractInfoFromAst",
"(",
"ast",
")",
"{",
"const",
"output",
"=",
"{",
"requires",
":",
"[",
"]",
",",
"exports",
":",
"findExports",
"(",
"ast",
")",
"}",
";",
"recursivelyExtractInfoFromAst",
"(",
"ast",
".",
"program",
".",
"body",
",",
... | Try to figure oout which modules are needed from this javascript code.
@param {object} ast - Abstract Syntax Tree from Babel.
@returns {object} `{ requires: [] }`. | [
"Try",
"to",
"figure",
"oout",
"which",
"modules",
"are",
"needed",
"from",
"this",
"javascript",
"code",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/module-analyser.js#L21-L28 | train |
tolokoban/ToloFrameWork | lib/module-analyser.js | findExports | function findExports( ast ) {
try {
const
publics = {},
privates = {},
body = ast.program.body[ 0 ].expression.arguments[ 1 ].body.body;
body.forEach( function ( item ) {
if ( parseExports( item, publics ) ) return;
if ( parseModuleExports... | javascript | function findExports( ast ) {
try {
const
publics = {},
privates = {},
body = ast.program.body[ 0 ].expression.arguments[ 1 ].body.body;
body.forEach( function ( item ) {
if ( parseExports( item, publics ) ) return;
if ( parseModuleExports... | [
"function",
"findExports",
"(",
"ast",
")",
"{",
"try",
"{",
"const",
"publics",
"=",
"{",
"}",
",",
"privates",
"=",
"{",
"}",
",",
"body",
"=",
"ast",
".",
"program",
".",
"body",
"[",
"0",
"]",
".",
"expression",
".",
"arguments",
"[",
"1",
"]... | Look for the exports of the module with their comments.
This will be used for documentation.
@param {object} ast - AST of the module.
@returns {array} `{ id, type, comments }` | [
"Look",
"for",
"the",
"exports",
"of",
"the",
"module",
"with",
"their",
"comments",
".",
"This",
"will",
"be",
"used",
"for",
"documentation",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/module-analyser.js#L84-L119 | train |
Phalanstere/VisualData | lib/readVisualData.js | exif | function exif (file) {
"use strict";
var deferred = Q.defer(), o = {};
new ExifImage({ image : file }, function (error, data) {
if (error)
{
// callback.call("error " + file);
deferred.reject("ERROR");
}
if (data)
{
o.file = file... | javascript | function exif (file) {
"use strict";
var deferred = Q.defer(), o = {};
new ExifImage({ image : file }, function (error, data) {
if (error)
{
// callback.call("error " + file);
deferred.reject("ERROR");
}
if (data)
{
o.file = file... | [
"function",
"exif",
"(",
"file",
")",
"{",
"\"use strict\"",
";",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
",",
"o",
"=",
"{",
"}",
";",
"new",
"ExifImage",
"(",
"{",
"image",
":",
"file",
"}",
",",
"function",
"(",
"error",
",",
"dat... | liest die exif Daten des Bides ein | [
"liest",
"die",
"exif",
"Daten",
"des",
"Bides",
"ein"
] | 59bdc6cea190366d4bb466cf4e39e22f887e5104 | https://github.com/Phalanstere/VisualData/blob/59bdc6cea190366d4bb466cf4e39e22f887e5104/lib/readVisualData.js#L62-L81 | train |
jmjuanes/utily | lib/index.js | function(index)
{
//Check the index value
if(index >= keys.length)
{
//Do the callback and exit
return cb(null);
}
else
{
//Get the key
var key = (is_array) ? index : keys[index];
//Get the value
var value = list[key];
//Call the provided method with... | javascript | function(index)
{
//Check the index value
if(index >= keys.length)
{
//Do the callback and exit
return cb(null);
}
else
{
//Get the key
var key = (is_array) ? index : keys[index];
//Get the value
var value = list[key];
//Call the provided method with... | [
"function",
"(",
"index",
")",
"{",
"//Check the index value",
"if",
"(",
"index",
">=",
"keys",
".",
"length",
")",
"{",
"//Do the callback and exit",
"return",
"cb",
"(",
"null",
")",
";",
"}",
"else",
"{",
"//Get the key",
"var",
"key",
"=",
"(",
"is_ar... | Call each element of the array | [
"Call",
"each",
"element",
"of",
"the",
"array"
] | f620180aa21fc8ece0f7b2c268cda335e9e28831 | https://github.com/jmjuanes/utily/blob/f620180aa21fc8ece0f7b2c268cda335e9e28831/lib/index.js#L71-L103 | train | |
jeswin-unmaintained/isotropy-koa-context-in-browser | lib/response.js | function(field, val){
if (2 == arguments.length) {
if (Array.isArray(val)) val = val.map(String);
else val = String(val);
this.res.setHeader(field, val);
} else {
for (var key in field) {
this.set(key, field[key]... | javascript | function(field, val){
if (2 == arguments.length) {
if (Array.isArray(val)) val = val.map(String);
else val = String(val);
this.res.setHeader(field, val);
} else {
for (var key in field) {
this.set(key, field[key]... | [
"function",
"(",
"field",
",",
"val",
")",
"{",
"if",
"(",
"2",
"==",
"arguments",
".",
"length",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"val",
")",
")",
"val",
"=",
"val",
".",
"map",
"(",
"String",
")",
";",
"else",
"val",
"=",
... | Set header `field` to `val`, or pass
an object of header fields.
Examples:
this.set('Foo', ['bar', 'baz']);
this.set('Accept', 'application/json');
this.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' });
@param {String|Object|Array} field
@param {String} val
@api public | [
"Set",
"header",
"field",
"to",
"val",
"or",
"pass",
"an",
"object",
"of",
"header",
"fields",
"."
] | 033a3ac0fd65ba6ac2b4ce715b3da54f873eed6f | https://github.com/jeswin-unmaintained/isotropy-koa-context-in-browser/blob/033a3ac0fd65ba6ac2b4ce715b3da54f873eed6f/lib/response.js#L334-L344 | train | |
jeswin-unmaintained/isotropy-koa-context-in-browser | lib/response.js | function(field, val){
var prev = this.get(field);
if (prev) {
val = Array.isArray(prev) ? prev.concat(val) : [prev].concat(val);
}
return this.set(field, val);
} | javascript | function(field, val){
var prev = this.get(field);
if (prev) {
val = Array.isArray(prev) ? prev.concat(val) : [prev].concat(val);
}
return this.set(field, val);
} | [
"function",
"(",
"field",
",",
"val",
")",
"{",
"var",
"prev",
"=",
"this",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"prev",
")",
"{",
"val",
"=",
"Array",
".",
"isArray",
"(",
"prev",
")",
"?",
"prev",
".",
"concat",
"(",
"val",
")",
"... | Append additional header `field` with value `val`.
Examples:
this.append('Link', ['<http://localhost/>', '<http://localhost:3000/>']);
this.append('Set-Cookie', 'foo=bar; Path=/; HttpOnly');
this.append('Warning', '199 Miscellaneous warning');
@param {String} field
@param {String|Array} val
@api public | [
"Append",
"additional",
"header",
"field",
"with",
"value",
"val",
"."
] | 033a3ac0fd65ba6ac2b4ce715b3da54f873eed6f | https://github.com/jeswin-unmaintained/isotropy-koa-context-in-browser/blob/033a3ac0fd65ba6ac2b4ce715b3da54f873eed6f/lib/response.js#L360-L368 | train | |
nbrownus/ppunit | lib/writers/ConsoleWriter.js | function (options) {
options = options || {}
this.isTTY = process.stdout.isTTY || false
this.useColors = options.useColors || this.isTTY
} | javascript | function (options) {
options = options || {}
this.isTTY = process.stdout.isTTY || false
this.useColors = options.useColors || this.isTTY
} | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
"this",
".",
"isTTY",
"=",
"process",
".",
"stdout",
".",
"isTTY",
"||",
"false",
"this",
".",
"useColors",
"=",
"options",
".",
"useColors",
"||",
"this",
".",
"isTTY",
... | Handles writing output to stdout
@param {Object} options An object containing options pertaining to this writer
@param {Boolean} [options.useColors] Whether or not to use colors
default attempts to figure out if the tty supports colors
@constructor | [
"Handles",
"writing",
"output",
"to",
"stdout"
] | dcce602497d9548ce9085a8db115e65561dcc3de | https://github.com/nbrownus/ppunit/blob/dcce602497d9548ce9085a8db115e65561dcc3de/lib/writers/ConsoleWriter.js#L13-L17 | train | |
dreadcast/lowerdash | src/lowerdash.js | from | function from(arg){
if(!_.isArray(arg) && !_.isArguments(arg))
arg = [arg];
return _.toArray(arg);
} | javascript | function from(arg){
if(!_.isArray(arg) && !_.isArguments(arg))
arg = [arg];
return _.toArray(arg);
} | [
"function",
"from",
"(",
"arg",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isArray",
"(",
"arg",
")",
"&&",
"!",
"_",
".",
"isArguments",
"(",
"arg",
")",
")",
"arg",
"=",
"[",
"arg",
"]",
";",
"return",
"_",
".",
"toArray",
"(",
"arg",
")",
";",
... | Creates an array containing passed argument or return argument if it is already an array.
@method from
@return {Array} Created or existing array | [
"Creates",
"an",
"array",
"containing",
"passed",
"argument",
"or",
"return",
"argument",
"if",
"it",
"is",
"already",
"an",
"array",
"."
] | 38c66969cea9ba2dbde9c761689df2fa1cb870e0 | https://github.com/dreadcast/lowerdash/blob/38c66969cea9ba2dbde9c761689df2fa1cb870e0/src/lowerdash.js#L23-L28 | train |
dreadcast/lowerdash | src/lowerdash.js | joinLast | function joinLast(obj, glue, stick){
if(_.size(obj) == 1)
return obj[0];
var last = obj.pop();
return obj.join(glue) + stick + last;
} | javascript | function joinLast(obj, glue, stick){
if(_.size(obj) == 1)
return obj[0];
var last = obj.pop();
return obj.join(glue) + stick + last;
} | [
"function",
"joinLast",
"(",
"obj",
",",
"glue",
",",
"stick",
")",
"{",
"if",
"(",
"_",
".",
"size",
"(",
"obj",
")",
"==",
"1",
")",
"return",
"obj",
"[",
"0",
"]",
";",
"var",
"last",
"=",
"obj",
".",
"pop",
"(",
")",
";",
"return",
"obj",... | Joins items from an array with a different glue before last item
@method joinLast
@param {Array} obj Array to join
@param {String} glue Items delimiter
@param {String} stick Delimiter before last item
@return {String} Joined array | [
"Joins",
"items",
"from",
"an",
"array",
"with",
"a",
"different",
"glue",
"before",
"last",
"item"
] | 38c66969cea9ba2dbde9c761689df2fa1cb870e0 | https://github.com/dreadcast/lowerdash/blob/38c66969cea9ba2dbde9c761689df2fa1cb870e0/src/lowerdash.js#L48-L55 | train |
dreadcast/lowerdash | src/lowerdash.js | getFromPath | function getFromPath(obj, path){
path = path.split('.');
for(var i = 0, l = path.length; i < l; i++){
if (hasOwnProperty.call(obj, path[i]))
obj = obj[path[i]];
else
return undefined;
}
return obj;
} | javascript | function getFromPath(obj, path){
path = path.split('.');
for(var i = 0, l = path.length; i < l; i++){
if (hasOwnProperty.call(obj, path[i]))
obj = obj[path[i]];
else
return undefined;
}
return obj;
} | [
"function",
"getFromPath",
"(",
"obj",
",",
"path",
")",
"{",
"path",
"=",
"path",
".",
"split",
"(",
"'.'",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"path",
".",
"length",
";",
"i",
"<",
"l",
";",
"i",
"++",
")",
"{",
"if... | Get property from object following provided path
@method getFromPath
@param {Object} obj Object to get property from
@param {String} path Path to property (Dot-delimited)
@return {Mixed} Property | [
"Get",
"property",
"from",
"object",
"following",
"provided",
"path"
] | 38c66969cea9ba2dbde9c761689df2fa1cb870e0 | https://github.com/dreadcast/lowerdash/blob/38c66969cea9ba2dbde9c761689df2fa1cb870e0/src/lowerdash.js#L63-L75 | train |
dreadcast/lowerdash | src/lowerdash.js | setFromPath | function setFromPath(obj, path, value){
var parts = path.split('.');
for(var i = 0, l = parts.length; i < l; i++){
if(i < (l - 1) && !obj.hasOwnProperty(parts[i]))
obj[parts[i]] = {};
if(i == l - 1)
obj[parts[i]] = value;
else
obj = obj[parts[i]];
}
return obj;
} | javascript | function setFromPath(obj, path, value){
var parts = path.split('.');
for(var i = 0, l = parts.length; i < l; i++){
if(i < (l - 1) && !obj.hasOwnProperty(parts[i]))
obj[parts[i]] = {};
if(i == l - 1)
obj[parts[i]] = value;
else
obj = obj[parts[i]];
}
return obj;
} | [
"function",
"setFromPath",
"(",
"obj",
",",
"path",
",",
"value",
")",
"{",
"var",
"parts",
"=",
"path",
".",
"split",
"(",
"'.'",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"parts",
".",
"length",
";",
"i",
"<",
"l",
";",
"i"... | Set property of object following provided path
@method setFromPath
@param {Object} obj Destination object
@param {String} path Path to property
@param {Mixed} value Property value
@return {Object} Object | [
"Set",
"property",
"of",
"object",
"following",
"provided",
"path"
] | 38c66969cea9ba2dbde9c761689df2fa1cb870e0 | https://github.com/dreadcast/lowerdash/blob/38c66969cea9ba2dbde9c761689df2fa1cb870e0/src/lowerdash.js#L85-L100 | train |
dreadcast/lowerdash | src/lowerdash.js | eraseFromPath | function eraseFromPath(obj, path){
var parts = path.split('.'),
clone = obj;
for(var i = 0, l = parts.length; i < l; i++){
if (!obj.hasOwnProperty(parts[i])){
break;
} else if (i < l - 1){
obj = obj[parts[i]];
} else if(i == l - 1){
delete obj[parts[i]];
break;
}
}
... | javascript | function eraseFromPath(obj, path){
var parts = path.split('.'),
clone = obj;
for(var i = 0, l = parts.length; i < l; i++){
if (!obj.hasOwnProperty(parts[i])){
break;
} else if (i < l - 1){
obj = obj[parts[i]];
} else if(i == l - 1){
delete obj[parts[i]];
break;
}
}
... | [
"function",
"eraseFromPath",
"(",
"obj",
",",
"path",
")",
"{",
"var",
"parts",
"=",
"path",
".",
"split",
"(",
"'.'",
")",
",",
"clone",
"=",
"obj",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"parts",
".",
"length",
";",
"i",
"<",
... | Removes property of object following provided path
@method eraseFromPath
@param {Object} obj Object to remove property from
@param {String} path Path to property
@return {Object} Object | [
"Removes",
"property",
"of",
"object",
"following",
"provided",
"path"
] | 38c66969cea9ba2dbde9c761689df2fa1cb870e0 | https://github.com/dreadcast/lowerdash/blob/38c66969cea9ba2dbde9c761689df2fa1cb870e0/src/lowerdash.js#L109-L127 | train |
dreadcast/lowerdash | src/lowerdash.js | keyOf | function keyOf(obj, value){
for(var key in obj)
if(Object.prototype.hasOwnProperty.call(obj, key) && obj[key] === value)
return key;
return null;
} | javascript | function keyOf(obj, value){
for(var key in obj)
if(Object.prototype.hasOwnProperty.call(obj, key) && obj[key] === value)
return key;
return null;
} | [
"function",
"keyOf",
"(",
"obj",
",",
"value",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"obj",
")",
"if",
"(",
"Object",
".",
"prototype",
".",
"hasOwnProperty",
".",
"call",
"(",
"obj",
",",
"key",
")",
"&&",
"obj",
"[",
"key",
"]",
"===",
"val... | Retrieve object's key paired to given property
@method keyOf
@param {Object} obj Object to get key from
@param {Mixed} value Value corresponding to key
@return {String} Key or null if no key was found | [
"Retrieve",
"object",
"s",
"key",
"paired",
"to",
"given",
"property"
] | 38c66969cea9ba2dbde9c761689df2fa1cb870e0 | https://github.com/dreadcast/lowerdash/blob/38c66969cea9ba2dbde9c761689df2fa1cb870e0/src/lowerdash.js#L136-L142 | train |
dreadcast/lowerdash | src/lowerdash.js | isLaxEqual | function isLaxEqual(a, b){
if(_.isArray(a))
a = _.uniq(a.sort());
if(_.isArray(b))
b = _.uniq(b.sort());
return _.isEqual(a, b);
} | javascript | function isLaxEqual(a, b){
if(_.isArray(a))
a = _.uniq(a.sort());
if(_.isArray(b))
b = _.uniq(b.sort());
return _.isEqual(a, b);
} | [
"function",
"isLaxEqual",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"_",
".",
"isArray",
"(",
"a",
")",
")",
"a",
"=",
"_",
".",
"uniq",
"(",
"a",
".",
"sort",
"(",
")",
")",
";",
"if",
"(",
"_",
".",
"isArray",
"(",
"b",
")",
")",
"b",
... | Lax isEqual, arrays are sorted and unique'd
@method isLaxEqual
@param {Mixed} a Value to compare
@param {Mixed} b Value to be compared
@return {Boolean} Lax equality | [
"Lax",
"isEqual",
"arrays",
"are",
"sorted",
"and",
"unique",
"d"
] | 38c66969cea9ba2dbde9c761689df2fa1cb870e0 | https://github.com/dreadcast/lowerdash/blob/38c66969cea9ba2dbde9c761689df2fa1cb870e0/src/lowerdash.js#L151-L159 | train |
dreadcast/lowerdash | src/lowerdash.js | eachParallel | function eachParallel(obj, iterator, cb, max, bind){
if(!_.isFinite(max))
max = _.size(obj);
var stepsToGo = _.size(obj),
chunks = _.isIterable(obj) ? _.norris(obj, max) : _.chunk(obj, max);
_.eachAsync(chunks, function(chunk, chunkKey, chunkCursor){
var chunkIndex = 0;
_.each(chunk, fun... | javascript | function eachParallel(obj, iterator, cb, max, bind){
if(!_.isFinite(max))
max = _.size(obj);
var stepsToGo = _.size(obj),
chunks = _.isIterable(obj) ? _.norris(obj, max) : _.chunk(obj, max);
_.eachAsync(chunks, function(chunk, chunkKey, chunkCursor){
var chunkIndex = 0;
_.each(chunk, fun... | [
"function",
"eachParallel",
"(",
"obj",
",",
"iterator",
",",
"cb",
",",
"max",
",",
"bind",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isFinite",
"(",
"max",
")",
")",
"max",
"=",
"_",
".",
"size",
"(",
"obj",
")",
";",
"var",
"stepsToGo",
"=",
"_",... | Invoke passed iterator on each passed array entry
All iterations are concurrents
@method eachParallel
@param {Object} obj Object or array.
@param {Function} iterator Iterator, invoked on each obj entry.
Passed arguments are <code>item</code>, <code>index</code> or
<code>key</code> (if passed object is iterable),
<cod... | [
"Invoke",
"passed",
"iterator",
"on",
"each",
"passed",
"array",
"entry",
"All",
"iterations",
"are",
"concurrents"
] | 38c66969cea9ba2dbde9c761689df2fa1cb870e0 | https://github.com/dreadcast/lowerdash/blob/38c66969cea9ba2dbde9c761689df2fa1cb870e0/src/lowerdash.js#L290-L315 | train |
dreadcast/lowerdash | src/lowerdash.js | closest | function closest(obj, number){
if((current = obj.length) < 2)
return l - 1;
for(var current, previous = Math.abs(obj[--current] - number); current--;)
if(previous < (previous = Math.abs(obj[current] - number)))
break;
return obj[current + 1];
var closest = -1,
prev = Math.abs(obj[0] - ... | javascript | function closest(obj, number){
if((current = obj.length) < 2)
return l - 1;
for(var current, previous = Math.abs(obj[--current] - number); current--;)
if(previous < (previous = Math.abs(obj[current] - number)))
break;
return obj[current + 1];
var closest = -1,
prev = Math.abs(obj[0] - ... | [
"function",
"closest",
"(",
"obj",
",",
"number",
")",
"{",
"if",
"(",
"(",
"current",
"=",
"obj",
".",
"length",
")",
"<",
"2",
")",
"return",
"l",
"-",
"1",
";",
"for",
"(",
"var",
"current",
",",
"previous",
"=",
"Math",
".",
"abs",
"(",
"ob... | Find value closest to given number in an array of numbers
@method closest
@return {Number} Closest value | [
"Find",
"value",
"closest",
"to",
"given",
"number",
"in",
"an",
"array",
"of",
"numbers"
] | 38c66969cea9ba2dbde9c761689df2fa1cb870e0 | https://github.com/dreadcast/lowerdash/blob/38c66969cea9ba2dbde9c761689df2fa1cb870e0/src/lowerdash.js#L367-L390 | train |
dreadcast/lowerdash | src/lowerdash.js | attempt | function attempt(fn){
try {
var args = _.from(arguments);
args.shift();
return fn.apply(this, args);
} catch(e){
return false;
}
} | javascript | function attempt(fn){
try {
var args = _.from(arguments);
args.shift();
return fn.apply(this, args);
} catch(e){
return false;
}
} | [
"function",
"attempt",
"(",
"fn",
")",
"{",
"try",
"{",
"var",
"args",
"=",
"_",
".",
"from",
"(",
"arguments",
")",
";",
"args",
".",
"shift",
"(",
")",
";",
"return",
"fn",
".",
"apply",
"(",
"this",
",",
"args",
")",
";",
"}",
"catch",
"(",
... | Attempts to execute function, return false if fails
@method attempt
@param {Function} fn Function to execute
@param {Mixed} arguments* Arguments to pass to function
@return {Mixed} Function result or false | [
"Attempts",
"to",
"execute",
"function",
"return",
"false",
"if",
"fails"
] | 38c66969cea9ba2dbde9c761689df2fa1cb870e0 | https://github.com/dreadcast/lowerdash/blob/38c66969cea9ba2dbde9c761689df2fa1cb870e0/src/lowerdash.js#L421-L430 | train |
dreadcast/lowerdash | src/lowerdash.js | straitjacket | function straitjacket(fn, defaultValue){
return function(){
try {
var args = _.from(arguments);
return fn.apply(this, args);
} catch(e){
return defaultValue;
}
}
} | javascript | function straitjacket(fn, defaultValue){
return function(){
try {
var args = _.from(arguments);
return fn.apply(this, args);
} catch(e){
return defaultValue;
}
}
} | [
"function",
"straitjacket",
"(",
"fn",
",",
"defaultValue",
")",
"{",
"return",
"function",
"(",
")",
"{",
"try",
"{",
"var",
"args",
"=",
"_",
".",
"from",
"(",
"arguments",
")",
";",
"return",
"fn",
".",
"apply",
"(",
"this",
",",
"args",
")",
";... | Return a wrapped function that will catch errors and return provided defaultValue or undefined
@method straitjacket
@param {Function} fn Function to catch errors from
@param {Mixed} [defaultValue] Returned value if invoking wrapped function fails
@return {Mixed} Function result or false | [
"Return",
"a",
"wrapped",
"function",
"that",
"will",
"catch",
"errors",
"and",
"return",
"provided",
"defaultValue",
"or",
"undefined"
] | 38c66969cea9ba2dbde9c761689df2fa1cb870e0 | https://github.com/dreadcast/lowerdash/blob/38c66969cea9ba2dbde9c761689df2fa1cb870e0/src/lowerdash.js#L439-L449 | train |
linyngfly/omelo-protobuf | lib/client/protobuf.js | encodeArray | function encodeArray(array, proto, offset, buffer, protos){
let i = 0;
if(util.isSimpleType(proto.type)){
offset = writeBytes(buffer, offset, encodeTag(proto.type, proto.tag));
offset = writeBytes(buffer, offset, codec.encodeUInt32(array.length));
for(i = 0; i < array.length; i++){
of... | javascript | function encodeArray(array, proto, offset, buffer, protos){
let i = 0;
if(util.isSimpleType(proto.type)){
offset = writeBytes(buffer, offset, encodeTag(proto.type, proto.tag));
offset = writeBytes(buffer, offset, codec.encodeUInt32(array.length));
for(i = 0; i < array.length; i++){
of... | [
"function",
"encodeArray",
"(",
"array",
",",
"proto",
",",
"offset",
",",
"buffer",
",",
"protos",
")",
"{",
"let",
"i",
"=",
"0",
";",
"if",
"(",
"util",
".",
"isSimpleType",
"(",
"proto",
".",
"type",
")",
")",
"{",
"offset",
"=",
"writeBytes",
... | Encode reapeated properties, simple msg and object are decode differented | [
"Encode",
"reapeated",
"properties",
"simple",
"msg",
"and",
"object",
"are",
"decode",
"differented"
] | 712e172fdcc7e92aa7d0f41a71e79882b302f451 | https://github.com/linyngfly/omelo-protobuf/blob/712e172fdcc7e92aa7d0f41a71e79882b302f451/lib/client/protobuf.js#L424-L441 | train |
wordijp/flexi-require | lib/watch-additional.js | flush | function flush(done) {
if (checkWatchify(browserify)) {
var full_paths = mutils.toResolvePaths([].concat(options.files).concat(options.getFiles()));
// add require target files
mcached.collectRequirePaths(full_paths, function (collect_file_sources) {
var collect_full_paths = Object.keys(collec... | javascript | function flush(done) {
if (checkWatchify(browserify)) {
var full_paths = mutils.toResolvePaths([].concat(options.files).concat(options.getFiles()));
// add require target files
mcached.collectRequirePaths(full_paths, function (collect_file_sources) {
var collect_full_paths = Object.keys(collec... | [
"function",
"flush",
"(",
"done",
")",
"{",
"if",
"(",
"checkWatchify",
"(",
"browserify",
")",
")",
"{",
"var",
"full_paths",
"=",
"mutils",
".",
"toResolvePaths",
"(",
"[",
"]",
".",
"concat",
"(",
"options",
".",
"files",
")",
".",
"concat",
"(",
... | no-op | [
"no",
"-",
"op"
] | f62a7141fd97f4a5b47c9808a5c4a3349aeccb43 | https://github.com/wordijp/flexi-require/blob/f62a7141fd97f4a5b47c9808a5c4a3349aeccb43/lib/watch-additional.js#L52-L69 | train |
base/base-runner | index.js | RunnerContext | function RunnerContext(argv, config, env) {
argv.tasks = argv._.length ? argv._ : ['default'];
this.argv = argv;
this.config = config;
this.env = env;
this.json = loadConfig(this.argv.cwd, this.env);
this.pkg = loadPkg(this.argv.cwd, this.env);
this.pkgConfig = this.pkg[env.name] || {};
this.options = m... | javascript | function RunnerContext(argv, config, env) {
argv.tasks = argv._.length ? argv._ : ['default'];
this.argv = argv;
this.config = config;
this.env = env;
this.json = loadConfig(this.argv.cwd, this.env);
this.pkg = loadPkg(this.argv.cwd, this.env);
this.pkgConfig = this.pkg[env.name] || {};
this.options = m... | [
"function",
"RunnerContext",
"(",
"argv",
",",
"config",
",",
"env",
")",
"{",
"argv",
".",
"tasks",
"=",
"argv",
".",
"_",
".",
"length",
"?",
"argv",
".",
"_",
":",
"[",
"'default'",
"]",
";",
"this",
".",
"argv",
"=",
"argv",
";",
"this",
".",... | Create runner context | [
"Create",
"runner",
"context"
] | 07d5702771dfe5ced6d07b8a2c2927b9bc738a11 | https://github.com/base/base-runner/blob/07d5702771dfe5ced6d07b8a2c2927b9bc738a11/index.js#L177-L186 | train |
base/base-runner | index.js | validateRunnerArgs | function validateRunnerArgs(Ctor, config, argv, cb) {
if (typeof cb !== 'function') {
throw new Error('expected a callback function');
}
if (argv == null || typeof argv !== 'object') {
return new Error('expected the third argument to be an options object');
}
if (config == null || typeof config !== '... | javascript | function validateRunnerArgs(Ctor, config, argv, cb) {
if (typeof cb !== 'function') {
throw new Error('expected a callback function');
}
if (argv == null || typeof argv !== 'object') {
return new Error('expected the third argument to be an options object');
}
if (config == null || typeof config !== '... | [
"function",
"validateRunnerArgs",
"(",
"Ctor",
",",
"config",
",",
"argv",
",",
"cb",
")",
"{",
"if",
"(",
"typeof",
"cb",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'expected a callback function'",
")",
";",
"}",
"if",
"(",
"argv",
"=... | Handle invalid arguments | [
"Handle",
"invalid",
"arguments"
] | 07d5702771dfe5ced6d07b8a2c2927b9bc738a11 | https://github.com/base/base-runner/blob/07d5702771dfe5ced6d07b8a2c2927b9bc738a11/index.js#L213-L228 | train |
christkv/vitesse | lib/compiler.js | function(err, stdout, stderr) {
if(err) return callback(err);
// Get the transformed source
var source = stdout;
// Compile the function
eval(source)
// Return the validation function
callback(null, {
validate: func
});
} | javascript | function(err, stdout, stderr) {
if(err) return callback(err);
// Get the transformed source
var source = stdout;
// Compile the function
eval(source)
// Return the validation function
callback(null, {
validate: func
});
} | [
"function",
"(",
"err",
",",
"stdout",
",",
"stderr",
")",
"{",
"if",
"(",
"err",
")",
"return",
"callback",
"(",
"err",
")",
";",
"// Get the transformed source",
"var",
"source",
"=",
"stdout",
";",
"// Compile the function",
"eval",
"(",
"source",
")",
... | Handle closure compiler result | [
"Handle",
"closure",
"compiler",
"result"
] | 6f40f7eaafa7f22644c4c6df80c0bf0590c502ba | https://github.com/christkv/vitesse/blob/6f40f7eaafa7f22644c4c6df80c0bf0590c502ba/lib/compiler.js#L192-L202 | train | |
alexpods/ClazzJS | src/components/meta/Property/Methods.js | function(object, methods, property) {
for (var i = 0, ii = methods.length; i < ii; ++i) {
this.addMethodToObject(methods[i], object, property);
}
} | javascript | function(object, methods, property) {
for (var i = 0, ii = methods.length; i < ii; ++i) {
this.addMethodToObject(methods[i], object, property);
}
} | [
"function",
"(",
"object",
",",
"methods",
",",
"property",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"ii",
"=",
"methods",
".",
"length",
";",
"i",
"<",
"ii",
";",
"++",
"i",
")",
"{",
"this",
".",
"addMethodToObject",
"(",
"methods",
"["... | Add common methods for property
@param {object} object Some object
@param {array} methods List of property methods
@param {string} property Property name
@this {metaProcessor} | [
"Add",
"common",
"methods",
"for",
"property"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Property/Methods.js#L16-L21 | train | |
alexpods/ClazzJS | src/components/meta/Property/Methods.js | function(name, object, property) {
var method = this.createMethod(name, property);
object[method.name] = method.body;
} | javascript | function(name, object, property) {
var method = this.createMethod(name, property);
object[method.name] = method.body;
} | [
"function",
"(",
"name",
",",
"object",
",",
"property",
")",
"{",
"var",
"method",
"=",
"this",
".",
"createMethod",
"(",
"name",
",",
"property",
")",
";",
"object",
"[",
"method",
".",
"name",
"]",
"=",
"method",
".",
"body",
";",
"}"
] | Add specified method to object
@param {string} name Object name
@param {object} object Object to which method will be added
@param {string} property Property name
@this {metaProcessor} | [
"Add",
"specified",
"method",
"to",
"object"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Property/Methods.js#L32-L35 | train | |
alexpods/ClazzJS | src/components/meta/Property/Methods.js | function(name, property) {
if (!(name in this._methods)) {
throw new Error('Method "' + name + '" does not exist!');
}
var method = this._methods[name](property);
if (_.isFunction(method)) {
method = {
name: this.getMethodName(property, name),
... | javascript | function(name, property) {
if (!(name in this._methods)) {
throw new Error('Method "' + name + '" does not exist!');
}
var method = this._methods[name](property);
if (_.isFunction(method)) {
method = {
name: this.getMethodName(property, name),
... | [
"function",
"(",
"name",
",",
"property",
")",
"{",
"if",
"(",
"!",
"(",
"name",
"in",
"this",
".",
"_methods",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Method \"'",
"+",
"name",
"+",
"'\" does not exist!'",
")",
";",
"}",
"var",
"method",
"=",... | Creates method for specified property
@param {string} name Method name
@param {string} property Property name
@returns {function|object} Function or hash with 'name' and 'body' fields
@throws {Error} if method does not exist
@this {metaProcessor} | [
"Creates",
"method",
"for",
"specified",
"property"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Property/Methods.js#L49-L62 | train | |
alexpods/ClazzJS | src/components/meta/Property/Methods.js | function(property, method) {
var prefix = '';
property = property.replace(/^(_+)/g, function(str) {
prefix = str;
return '';
});
var methodName = 'is' === method && 0 === property.indexOf('is')
? property
: method + property[0].t... | javascript | function(property, method) {
var prefix = '';
property = property.replace(/^(_+)/g, function(str) {
prefix = str;
return '';
});
var methodName = 'is' === method && 0 === property.indexOf('is')
? property
: method + property[0].t... | [
"function",
"(",
"property",
",",
"method",
")",
"{",
"var",
"prefix",
"=",
"''",
";",
"property",
"=",
"property",
".",
"replace",
"(",
"/",
"^(_+)",
"/",
"g",
",",
"function",
"(",
"str",
")",
"{",
"prefix",
"=",
"str",
";",
"return",
"''",
";",
... | Gets method name for specified property
Prepend property name with method name and capitalize first character of property name
@param {string} property Property name
@param {string} method Method name
@returns {string} Method name for specified property
@this {metaProcessor} | [
"Gets",
"method",
"name",
"for",
"specified",
"property",
"Prepend",
"property",
"name",
"with",
"method",
"name",
"and",
"capitalize",
"first",
"character",
"of",
"property",
"name"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Property/Methods.js#L75-L91 | train | |
alexpods/ClazzJS | src/components/meta/Property/Methods.js | function(property) {
return function(fields) {
fields = _.isString(fields) ? fields.split('.') : fields || [];
return this.__hasPropertyValue([property].concat(fields));
}
} | javascript | function(property) {
return function(fields) {
fields = _.isString(fields) ? fields.split('.') : fields || [];
return this.__hasPropertyValue([property].concat(fields));
}
} | [
"function",
"(",
"property",
")",
"{",
"return",
"function",
"(",
"fields",
")",
"{",
"fields",
"=",
"_",
".",
"isString",
"(",
"fields",
")",
"?",
"fields",
".",
"split",
"(",
"'.'",
")",
":",
"fields",
"||",
"[",
"]",
";",
"return",
"this",
".",
... | Check whether specified property with specified fields exist
@param property
@returns {Function} | [
"Check",
"whether",
"specified",
"property",
"with",
"specified",
"fields",
"exist"
] | 2f94496019669813c8246d48fcceb12a3e68a870 | https://github.com/alexpods/ClazzJS/blob/2f94496019669813c8246d48fcceb12a3e68a870/src/components/meta/Property/Methods.js#L202-L207 | train | |
tolokoban/ToloFrameWork | ker/mod/tfw.web-service.js | request | function request( url, args ) {
return new Promise( function( resolve, reject ) {
const xhr = new XMLHttpRequest();
xhr.open( "POST", url, true ); // true is for async.
xhr.onload = () => {
const DONE = 4;
if ( xhr.readyState !== DONE ) return;
console.in... | javascript | function request( url, args ) {
return new Promise( function( resolve, reject ) {
const xhr = new XMLHttpRequest();
xhr.open( "POST", url, true ); // true is for async.
xhr.onload = () => {
const DONE = 4;
if ( xhr.readyState !== DONE ) return;
console.in... | [
"function",
"request",
"(",
"url",
",",
"args",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"const",
"xhr",
"=",
"new",
"XMLHttpRequest",
"(",
")",
";",
"xhr",
".",
"open",
"(",
"\"POST\"",
",",
"ur... | Request any web server with POST method and returns text.
@param {string} url - URL of the server to request. Can contain GET params.
@param {object} args - Arguments to send with the POST methos.
@returns {Promise} Resolves in the response as string. | [
"Request",
"any",
"web",
"server",
"with",
"POST",
"method",
"and",
"returns",
"text",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.web-service.js#L121-L153 | train |
tolokoban/ToloFrameWork | ker/mod/tfw.web-service.js | loadJSON | function loadJSON( path ) {
return new Promise( function( resolve, reject ) {
var xhr = new XMLHttpRequest( {
mozSystem: true
} );
xhr.onload = function() {
var text = xhr.responseText;
try {
resolve( JSON.parse( text ) );
} cat... | javascript | function loadJSON( path ) {
return new Promise( function( resolve, reject ) {
var xhr = new XMLHttpRequest( {
mozSystem: true
} );
xhr.onload = function() {
var text = xhr.responseText;
try {
resolve( JSON.parse( text ) );
} cat... | [
"function",
"loadJSON",
"(",
"path",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"var",
"xhr",
"=",
"new",
"XMLHttpRequest",
"(",
"{",
"mozSystem",
":",
"true",
"}",
")",
";",
"xhr",
".",
"onload",
... | Load a JSON file and return a Promise.
@param {string} path Local path relative to the current HTML page. | [
"Load",
"a",
"JSON",
"file",
"and",
"return",
"a",
"Promise",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.web-service.js#L230-L250 | train |
tolokoban/ToloFrameWork | ker/mod/tfw.web-service.js | logout | function logout() {
currentUser = null;
delete config.usr;
delete config.pwd;
Storage.local.set( "nigolotua", null );
exports.eventChange.fire();
return svc( "tfw.login.Logout" );
} | javascript | function logout() {
currentUser = null;
delete config.usr;
delete config.pwd;
Storage.local.set( "nigolotua", null );
exports.eventChange.fire();
return svc( "tfw.login.Logout" );
} | [
"function",
"logout",
"(",
")",
"{",
"currentUser",
"=",
"null",
";",
"delete",
"config",
".",
"usr",
";",
"delete",
"config",
".",
"pwd",
";",
"Storage",
".",
"local",
".",
"set",
"(",
"\"nigolotua\"",
",",
"null",
")",
";",
"exports",
".",
"eventChan... | Disconnect current user.
@return {Promise} A _thenable_ object resolved as soon as the server answered. | [
"Disconnect",
"current",
"user",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.web-service.js#L265-L272 | train |
tolokoban/ToloFrameWork | ker/mod/tfw.web-service.js | callWebService | function callWebService( name, args, url ) {
return new Promise(
function( resolve, reject ) {
svc( name, args, url ).then(
resolve,
function( err ) {
if ( typeof err === 'object' && err.id === exports.BAD_ROLE ) {
// Ec... | javascript | function callWebService( name, args, url ) {
return new Promise(
function( resolve, reject ) {
svc( name, args, url ).then(
resolve,
function( err ) {
if ( typeof err === 'object' && err.id === exports.BAD_ROLE ) {
// Ec... | [
"function",
"callWebService",
"(",
"name",
",",
"args",
",",
"url",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"svc",
"(",
"name",
",",
"args",
",",
"url",
")",
".",
"then",
"(",
"resolve",
",",
... | Call a webservice. | [
"Call",
"a",
"webservice",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.web-service.js#L361-L382 | train |
vkiding/jud-vue-render | src/render/vue/components/slider/indicator.js | _reLayout | function _reLayout (context, virtualRect, ltbr) {
const el = context.$el
const rect = _getIndicatorRect(el)
const rectWithPx = Object.keys(rect).reduce((pre, key) => {
pre[key] = rect[key] + 'px'
return pre
}, {})
extend(el.style, rectWithPx)
const axisMap = [
{ dir: ltbr.left ? 'left' : ltbr.ri... | javascript | function _reLayout (context, virtualRect, ltbr) {
const el = context.$el
const rect = _getIndicatorRect(el)
const rectWithPx = Object.keys(rect).reduce((pre, key) => {
pre[key] = rect[key] + 'px'
return pre
}, {})
extend(el.style, rectWithPx)
const axisMap = [
{ dir: ltbr.left ? 'left' : ltbr.ri... | [
"function",
"_reLayout",
"(",
"context",
",",
"virtualRect",
",",
"ltbr",
")",
"{",
"const",
"el",
"=",
"context",
".",
"$el",
"const",
"rect",
"=",
"_getIndicatorRect",
"(",
"el",
")",
"const",
"rectWithPx",
"=",
"Object",
".",
"keys",
"(",
"rect",
")",... | calculate and reset indicator's width, height, and ltbr.
@param {object} virtualRect. width and height of indicator's virtual rect box.
@param {object} ltbr. the user specified left, top, bottom, right pixels (without units). | [
"calculate",
"and",
"reset",
"indicator",
"s",
"width",
"height",
"and",
"ltbr",
"."
] | 07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47 | https://github.com/vkiding/jud-vue-render/blob/07d8ab08d0ef86cf2819e5f2bf1f4b06381f4d47/src/render/vue/components/slider/indicator.js#L120-L136 | train |
jmjuanes/objectsort | dist/objectsort.js | ObjectSort | function ObjectSort(array, columns, order)
{
//Check the columns
if(typeof columns === 'undefined')
{
//Create the columns array
var columns = [];
//Add the keys
for(var key in array[0]){ columns.push(key); }
}
//Check if columns is not an array
else if(Array.isArray(columns) === false)
{... | javascript | function ObjectSort(array, columns, order)
{
//Check the columns
if(typeof columns === 'undefined')
{
//Create the columns array
var columns = [];
//Add the keys
for(var key in array[0]){ columns.push(key); }
}
//Check if columns is not an array
else if(Array.isArray(columns) === false)
{... | [
"function",
"ObjectSort",
"(",
"array",
",",
"columns",
",",
"order",
")",
"{",
"//Check the columns\r",
"if",
"(",
"typeof",
"columns",
"===",
"'undefined'",
")",
"{",
"//Create the columns array\r",
"var",
"columns",
"=",
"[",
"]",
";",
"//Add the keys\r",
"fo... | Sort main function | [
"Sort",
"main",
"function"
] | a3d29a83423e56ff8aed5ebc06446fff0596ba46 | https://github.com/jmjuanes/objectsort/blob/a3d29a83423e56ff8aed5ebc06446fff0596ba46/dist/objectsort.js#L2-L57 | train |
jmjuanes/objectsort | dist/objectsort.js | Compare | function Compare(left, right, columns, order)
{
//Compare all
for(var i = 0; i < columns.length; i++)
{
//Check if que difference is numeric
var numeric = !isNaN(+left[columns[i]] - +right[columns[i]]);
//Get the values
var a = (numeric === true) ? +left[columns[i]] : left[columns[i]].toLowerCase()... | javascript | function Compare(left, right, columns, order)
{
//Compare all
for(var i = 0; i < columns.length; i++)
{
//Check if que difference is numeric
var numeric = !isNaN(+left[columns[i]] - +right[columns[i]]);
//Get the values
var a = (numeric === true) ? +left[columns[i]] : left[columns[i]].toLowerCase()... | [
"function",
"Compare",
"(",
"left",
",",
"right",
",",
"columns",
",",
"order",
")",
"{",
"//Compare all\r",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"columns",
".",
"length",
";",
"i",
"++",
")",
"{",
"//Check if que difference is numeric\r",
"v... | Function for compare two elements | [
"Function",
"for",
"compare",
"two",
"elements"
] | a3d29a83423e56ff8aed5ebc06446fff0596ba46 | https://github.com/jmjuanes/objectsort/blob/a3d29a83423e56ff8aed5ebc06446fff0596ba46/dist/objectsort.js#L60-L87 | train |
jeremyruppel/hoagie | lib/middleware/completion/index.js | commands | function commands(req, res /*, next */) {
req.app.commands.forEach(function(command) {
res.writeln(command);
});
res.end();
} | javascript | function commands(req, res /*, next */) {
req.app.commands.forEach(function(command) {
res.writeln(command);
});
res.end();
} | [
"function",
"commands",
"(",
"req",
",",
"res",
"/*, next */",
")",
"{",
"req",
".",
"app",
".",
"commands",
".",
"forEach",
"(",
"function",
"(",
"command",
")",
"{",
"res",
".",
"writeln",
"(",
"command",
")",
";",
"}",
")",
";",
"res",
".",
"end... | Prints all registered commands. | [
"Prints",
"all",
"registered",
"commands",
"."
] | 9e05b4c9f0537d681dcb240eab41822f15bef613 | https://github.com/jeremyruppel/hoagie/blob/9e05b4c9f0537d681dcb240eab41822f15bef613/lib/middleware/completion/index.js#L50-L55 | train |
jeremyruppel/hoagie | lib/middleware/completion/index.js | install | function install(req, res /*, next */) {
res.writeln('Add the following to your profile:');
res.writeln('eval "$(%s --completion)"', req.program);
res.end();
} | javascript | function install(req, res /*, next */) {
res.writeln('Add the following to your profile:');
res.writeln('eval "$(%s --completion)"', req.program);
res.end();
} | [
"function",
"install",
"(",
"req",
",",
"res",
"/*, next */",
")",
"{",
"res",
".",
"writeln",
"(",
"'Add the following to your profile:'",
")",
";",
"res",
".",
"writeln",
"(",
"'eval \"$(%s --completion)\"'",
",",
"req",
".",
"program",
")",
";",
"res",
".",... | Prints install instructions for the completion script. | [
"Prints",
"install",
"instructions",
"for",
"the",
"completion",
"script",
"."
] | 9e05b4c9f0537d681dcb240eab41822f15bef613 | https://github.com/jeremyruppel/hoagie/blob/9e05b4c9f0537d681dcb240eab41822f15bef613/lib/middleware/completion/index.js#L61-L65 | train |
jeremyruppel/hoagie | lib/middleware/completion/index.js | script | function script(req, res, next) {
switch (req.get('SHELL')) {
case '/bin/sh':
case '/bin/bash':
res.render(__dirname + '/init.bash');
break;
default:
next(new Error('Unsupported shell: ' + req.get('SHELL')));
}
} | javascript | function script(req, res, next) {
switch (req.get('SHELL')) {
case '/bin/sh':
case '/bin/bash':
res.render(__dirname + '/init.bash');
break;
default:
next(new Error('Unsupported shell: ' + req.get('SHELL')));
}
} | [
"function",
"script",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"switch",
"(",
"req",
".",
"get",
"(",
"'SHELL'",
")",
")",
"{",
"case",
"'/bin/sh'",
":",
"case",
"'/bin/bash'",
":",
"res",
".",
"render",
"(",
"__dirname",
"+",
"'/init.bash'",
"... | Prints the completion init script for the user's shell. | [
"Prints",
"the",
"completion",
"init",
"script",
"for",
"the",
"user",
"s",
"shell",
"."
] | 9e05b4c9f0537d681dcb240eab41822f15bef613 | https://github.com/jeremyruppel/hoagie/blob/9e05b4c9f0537d681dcb240eab41822f15bef613/lib/middleware/completion/index.js#L71-L80 | train |
leeola/tork | lib/middleware/history.js | function () {
var middlewares = Array.prototype.slice.apply(arguments)
, req = middlewares.splice(0, 1)
, next = middlewares.pop()
// Check other middlewares for client objects. If we find one, merge
// it and ours together.
for (var i = 0; i < middlewares.length; i++) {
v... | javascript | function () {
var middlewares = Array.prototype.slice.apply(arguments)
, req = middlewares.splice(0, 1)
, next = middlewares.pop()
// Check other middlewares for client objects. If we find one, merge
// it and ours together.
for (var i = 0; i < middlewares.length; i++) {
v... | [
"function",
"(",
")",
"{",
"var",
"middlewares",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"apply",
"(",
"arguments",
")",
",",
"req",
"=",
"middlewares",
".",
"splice",
"(",
"0",
",",
"1",
")",
",",
"next",
"=",
"middlewares",
".",
"pop",
... | Our middleware function | [
"Our",
"middleware",
"function"
] | d29edabb97ac49ac4cdbcce091647d4faa75989c | https://github.com/leeola/tork/blob/d29edabb97ac49ac4cdbcce091647d4faa75989c/lib/middleware/history.js#L41-L60 | train | |
dalekjs/dalek-driver-sauce | lib/commands/frame.js | function (selector, hash) {
if (selector !== null) {
this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector));
}
this.actionQueue.push(this.webdriverClient.frame.bind(this.webdriverClient));
this.actionQueue.push(this._frameCb.bind(this, selector, hash));
return... | javascript | function (selector, hash) {
if (selector !== null) {
this.actionQueue.push(this.webdriverClient.element.bind(this.webdriverClient, selector));
}
this.actionQueue.push(this.webdriverClient.frame.bind(this.webdriverClient));
this.actionQueue.push(this._frameCb.bind(this, selector, hash));
return... | [
"function",
"(",
"selector",
",",
"hash",
")",
"{",
"if",
"(",
"selector",
"!==",
"null",
")",
"{",
"this",
".",
"actionQueue",
".",
"push",
"(",
"this",
".",
"webdriverClient",
".",
"element",
".",
"bind",
"(",
"this",
".",
"webdriverClient",
",",
"se... | Switches to frame context
@method toFrame
@param {string} selector Selector expression to find the element
@param {string} hash Unique hash of that fn call
@chainable | [
"Switches",
"to",
"frame",
"context"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/commands/frame.js#L49-L56 | train | |
Nazariglez/perenquen | lib/pixi/src/filters/sepia/SepiaFilter.js | SepiaFilter | function SepiaFilter()
{
core.AbstractFilter.call(this,
// vertex shader
null,
// fragment shader
fs.readFileSync(__dirname + '/sepia.frag', 'utf8'),
// custom uniforms
{
sepia: { type: '1f', value: 1 }
}
);
} | javascript | function SepiaFilter()
{
core.AbstractFilter.call(this,
// vertex shader
null,
// fragment shader
fs.readFileSync(__dirname + '/sepia.frag', 'utf8'),
// custom uniforms
{
sepia: { type: '1f', value: 1 }
}
);
} | [
"function",
"SepiaFilter",
"(",
")",
"{",
"core",
".",
"AbstractFilter",
".",
"call",
"(",
"this",
",",
"// vertex shader",
"null",
",",
"// fragment shader",
"fs",
".",
"readFileSync",
"(",
"__dirname",
"+",
"'/sepia.frag'",
",",
"'utf8'",
")",
",",
"// custo... | This applies a sepia effect to your Display Objects.
@class
@extends AbstractFilter
@memberof PIXI.filters | [
"This",
"applies",
"a",
"sepia",
"effect",
"to",
"your",
"Display",
"Objects",
"."
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/filters/sepia/SepiaFilter.js#L12-L24 | train |
b-heilman/bmoor | src/array.js | remove | function remove( arr, searchElement, fromIndex ){
var pos = arr.indexOf( searchElement, fromIndex );
if ( pos > -1 ){
return arr.splice( pos, 1 )[0];
}
} | javascript | function remove( arr, searchElement, fromIndex ){
var pos = arr.indexOf( searchElement, fromIndex );
if ( pos > -1 ){
return arr.splice( pos, 1 )[0];
}
} | [
"function",
"remove",
"(",
"arr",
",",
"searchElement",
",",
"fromIndex",
")",
"{",
"var",
"pos",
"=",
"arr",
".",
"indexOf",
"(",
"searchElement",
",",
"fromIndex",
")",
";",
"if",
"(",
"pos",
">",
"-",
"1",
")",
"{",
"return",
"arr",
".",
"splice",... | Search an array for an element and remove it, starting at the begining or a specified location
@function remove
@param {array} arr An array to be searched
@param {*} searchElement Content for which to be searched
@param {integer} fromIndex The begining index from which to begin the search, defaults to 0
@return {array... | [
"Search",
"an",
"array",
"for",
"an",
"element",
"and",
"remove",
"it",
"starting",
"at",
"the",
"begining",
"or",
"a",
"specified",
"location"
] | b21a315b477093c14e5f32d857b4644a5a0a36fd | https://github.com/b-heilman/bmoor/blob/b21a315b477093c14e5f32d857b4644a5a0a36fd/src/array.js#L17-L23 | train |
b-heilman/bmoor | src/array.js | removeAll | function removeAll( arr, searchElement, fromIndex ){
var r,
pos = arr.indexOf( searchElement, fromIndex );
if ( pos > -1 ){
r = removeAll( arr, searchElement, pos+1 );
r.unshift( arr.splice(pos,1)[0] );
return r;
} else {
return [];
}
} | javascript | function removeAll( arr, searchElement, fromIndex ){
var r,
pos = arr.indexOf( searchElement, fromIndex );
if ( pos > -1 ){
r = removeAll( arr, searchElement, pos+1 );
r.unshift( arr.splice(pos,1)[0] );
return r;
} else {
return [];
}
} | [
"function",
"removeAll",
"(",
"arr",
",",
"searchElement",
",",
"fromIndex",
")",
"{",
"var",
"r",
",",
"pos",
"=",
"arr",
".",
"indexOf",
"(",
"searchElement",
",",
"fromIndex",
")",
";",
"if",
"(",
"pos",
">",
"-",
"1",
")",
"{",
"r",
"=",
"remov... | Search an array for an element and remove all instances of it, starting at the begining or a specified location
@function remove
@param {array} arr An array to be searched
@param {*} searchElement Content for which to be searched
@param {integer} fromIndex The begining index from which to begin the search, defaults to... | [
"Search",
"an",
"array",
"for",
"an",
"element",
"and",
"remove",
"all",
"instances",
"of",
"it",
"starting",
"at",
"the",
"begining",
"or",
"a",
"specified",
"location"
] | b21a315b477093c14e5f32d857b4644a5a0a36fd | https://github.com/b-heilman/bmoor/blob/b21a315b477093c14e5f32d857b4644a5a0a36fd/src/array.js#L34-L46 | train |
b-heilman/bmoor | src/array.js | compare | function compare( arr1, arr2, func ){
var cmp,
left = [],
right = [],
leftI = [],
rightI = [];
arr1 = arr1.slice(0);
arr2 = arr2.slice(0);
arr1.sort( func );
arr2.sort( func );
while( arr1.length > 0 && arr2.length > 0 ){
cmp = func( arr1[0], arr2[0] );
if ( cmp < 0 ){
left.push( arr1.shift() )... | javascript | function compare( arr1, arr2, func ){
var cmp,
left = [],
right = [],
leftI = [],
rightI = [];
arr1 = arr1.slice(0);
arr2 = arr2.slice(0);
arr1.sort( func );
arr2.sort( func );
while( arr1.length > 0 && arr2.length > 0 ){
cmp = func( arr1[0], arr2[0] );
if ( cmp < 0 ){
left.push( arr1.shift() )... | [
"function",
"compare",
"(",
"arr1",
",",
"arr2",
",",
"func",
")",
"{",
"var",
"cmp",
",",
"left",
"=",
"[",
"]",
",",
"right",
"=",
"[",
"]",
",",
"leftI",
"=",
"[",
"]",
",",
"rightI",
"=",
"[",
"]",
";",
"arr1",
"=",
"arr1",
".",
"slice",
... | Compare two arrays.
@function remove
@param {array} arr1 An array to be compared
@param {array} arr2 An array to be compared
@param {function} func The comparison function
@return {object} an object containing the elements unique to the left, matched, and unqiue to the right | [
"Compare",
"two",
"arrays",
"."
] | b21a315b477093c14e5f32d857b4644a5a0a36fd | https://github.com/b-heilman/bmoor/blob/b21a315b477093c14e5f32d857b4644a5a0a36fd/src/array.js#L118-L160 | train |
b-heilman/bmoor | src/array.js | unique | function unique( arr, sort, uniqueFn ){
var rtn = [];
if ( arr.length ){
if ( sort ){
// more efficient because I can presort
if ( bmoor.isFunction(sort) ){
arr = arr.slice(0).sort(sort);
}
let last;
for( let i = 0, c = arr.length; i < c; i++ ){
let d = arr[i],
v = uniqueFn ? uniqu... | javascript | function unique( arr, sort, uniqueFn ){
var rtn = [];
if ( arr.length ){
if ( sort ){
// more efficient because I can presort
if ( bmoor.isFunction(sort) ){
arr = arr.slice(0).sort(sort);
}
let last;
for( let i = 0, c = arr.length; i < c; i++ ){
let d = arr[i],
v = uniqueFn ? uniqu... | [
"function",
"unique",
"(",
"arr",
",",
"sort",
",",
"uniqueFn",
")",
"{",
"var",
"rtn",
"=",
"[",
"]",
";",
"if",
"(",
"arr",
".",
"length",
")",
"{",
"if",
"(",
"sort",
")",
"{",
"// more efficient because I can presort",
"if",
"(",
"bmoor",
".",
"i... | Create a new array that is completely unique
@function unique
@param {array} arr The array to be made unique
@param {function|boolean} sort If boolean === true, array is presorted. If function, use to sort | [
"Create",
"a",
"new",
"array",
"that",
"is",
"completely",
"unique"
] | b21a315b477093c14e5f32d857b4644a5a0a36fd | https://github.com/b-heilman/bmoor/blob/b21a315b477093c14e5f32d857b4644a5a0a36fd/src/array.js#L169-L215 | train |
b-heilman/bmoor | src/array.js | intersection | function intersection( arr1, arr2 ){
var rtn = [];
if ( arr1.length > arr2.length ){
let t = arr1;
arr1 = arr2;
arr2 = t;
}
for( let i = 0, c = arr1.length; i < c; i++ ){
let d = arr1[i];
if ( arr2.indexOf(d) !== -1 ){
rtn.push( d );
}
}
return rtn;
} | javascript | function intersection( arr1, arr2 ){
var rtn = [];
if ( arr1.length > arr2.length ){
let t = arr1;
arr1 = arr2;
arr2 = t;
}
for( let i = 0, c = arr1.length; i < c; i++ ){
let d = arr1[i];
if ( arr2.indexOf(d) !== -1 ){
rtn.push( d );
}
}
return rtn;
} | [
"function",
"intersection",
"(",
"arr1",
",",
"arr2",
")",
"{",
"var",
"rtn",
"=",
"[",
"]",
";",
"if",
"(",
"arr1",
".",
"length",
">",
"arr2",
".",
"length",
")",
"{",
"let",
"t",
"=",
"arr1",
";",
"arr1",
"=",
"arr2",
";",
"arr2",
"=",
"t",
... | I could probably make this sexier, like allow uniqueness algorithm, but I'm keeping it simple for now | [
"I",
"could",
"probably",
"make",
"this",
"sexier",
"like",
"allow",
"uniqueness",
"algorithm",
"but",
"I",
"m",
"keeping",
"it",
"simple",
"for",
"now"
] | b21a315b477093c14e5f32d857b4644a5a0a36fd | https://github.com/b-heilman/bmoor/blob/b21a315b477093c14e5f32d857b4644a5a0a36fd/src/array.js#L218-L237 | train |
vibe-project/vibe-protocol | lib/socket.js | open | function open() {
// If there is no remaining URI, fires `error` and `close` event as
// it means that all connection failed.
if (uris.length === 0) {
self.emit("error", new Error());
self.emit("close");
return;
}
... | javascript | function open() {
// If there is no remaining URI, fires `error` and `close` event as
// it means that all connection failed.
if (uris.length === 0) {
self.emit("error", new Error());
self.emit("close");
return;
}
... | [
"function",
"open",
"(",
")",
"{",
"// If there is no remaining URI, fires `error` and `close` event as",
"// it means that all connection failed.",
"if",
"(",
"uris",
".",
"length",
"===",
"0",
")",
"{",
"self",
".",
"emit",
"(",
"\"error\"",
",",
"new",
"Error",
"("... | Tries connection with next URI. | [
"Tries",
"connection",
"with",
"next",
"URI",
"."
] | 4a350acade3760ea13e75d7b9ce0815cf8b1d688 | https://github.com/vibe-project/vibe-protocol/blob/4a350acade3760ea13e75d7b9ce0815cf8b1d688/lib/socket.js#L65-L117 | train |
vibe-project/vibe-protocol | lib/socket.js | init | function init(trans) {
// Assign `trans` to `transport` which is associated with the
// socket.
transport = trans;
// When the transport has received a message from the server.
transport.on("text", function(text) {
// Converts JSON text to an e... | javascript | function init(trans) {
// Assign `trans` to `transport` which is associated with the
// socket.
transport = trans;
// When the transport has received a message from the server.
transport.on("text", function(text) {
// Converts JSON text to an e... | [
"function",
"init",
"(",
"trans",
")",
"{",
"// Assign `trans` to `transport` which is associated with the",
"// socket.",
"transport",
"=",
"trans",
";",
"// When the transport has received a message from the server.",
"transport",
".",
"on",
"(",
"\"text\"",
",",
"function",
... | Now that working transport is determined, associates it with the socket. | [
"Now",
"that",
"working",
"transport",
"is",
"determined",
"associates",
"it",
"with",
"the",
"socket",
"."
] | 4a350acade3760ea13e75d7b9ce0815cf8b1d688 | https://github.com/vibe-project/vibe-protocol/blob/4a350acade3760ea13e75d7b9ce0815cf8b1d688/lib/socket.js#L132-L176 | train |
antoniobrandao/mongoose3-bsonfix-bson | lib/bson/db_ref.js | DBRef | function DBRef(namespace, oid, db) {
if(!(this instanceof DBRef)) return new DBRef(namespace, oid, db);
this._bsontype = 'DBRef';
this.namespace = namespace;
this.oid = oid;
this.db = db;
} | javascript | function DBRef(namespace, oid, db) {
if(!(this instanceof DBRef)) return new DBRef(namespace, oid, db);
this._bsontype = 'DBRef';
this.namespace = namespace;
this.oid = oid;
this.db = db;
} | [
"function",
"DBRef",
"(",
"namespace",
",",
"oid",
",",
"db",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"DBRef",
")",
")",
"return",
"new",
"DBRef",
"(",
"namespace",
",",
"oid",
",",
"db",
")",
";",
"this",
".",
"_bsontype",
"=",
"'DBRe... | A class representation of the BSON DBRef type.
@class
@param {string} namespace the collection name.
@param {ObjectID} oid the reference ObjectID.
@param {string} [db] optional db name, if omitted the reference is local to the current db.
@return {DBRef} | [
"A",
"class",
"representation",
"of",
"the",
"BSON",
"DBRef",
"type",
"."
] | b0eae261710704de70f6f282669cf020dbd6a490 | https://github.com/antoniobrandao/mongoose3-bsonfix-bson/blob/b0eae261710704de70f6f282669cf020dbd6a490/lib/bson/db_ref.js#L10-L17 | train |
dalekjs/dalek-driver-sauce | lib/browser.js | function (configuration, events, config) {
var deferred = Q.defer();
// override desired capabilities, status & browser longname
this.desiredCapabilities = this._generateDesiredCaps(configuration.name, config);
this.driverDefaults.status = this._generateStatusInfo(this.desiredCapabilities);
this.lo... | javascript | function (configuration, events, config) {
var deferred = Q.defer();
// override desired capabilities, status & browser longname
this.desiredCapabilities = this._generateDesiredCaps(configuration.name, config);
this.driverDefaults.status = this._generateStatusInfo(this.desiredCapabilities);
this.lo... | [
"function",
"(",
"configuration",
",",
"events",
",",
"config",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"// override desired capabilities, status & browser longname",
"this",
".",
"desiredCapabilities",
"=",
"this",
".",
"_generateDesired... | Stores & validates the incoming browser config
@method launch
@param {object} configuration Browser configuration
@param {EventEmitter2} events EventEmitter (Reporter Emitter instance)
@param {Dalek.Internal.Config} config Dalek configuration class
@return {object} Browser promise | [
"Stores",
"&",
"validates",
"the",
"incoming",
"browser",
"config"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/browser.js#L182-L198 | train | |
dalekjs/dalek-driver-sauce | lib/browser.js | function (browserName, config) {
var browsers = config.get('browsers');
// check if we couldnt find a configured alias,
// set to defaults otherwise
if (!browsers) {
return {actAs: this.desiredCapabilities.browserName, version: this.desiredCapabilities['browser-version']};
}
var browser =... | javascript | function (browserName, config) {
var browsers = config.get('browsers');
// check if we couldnt find a configured alias,
// set to defaults otherwise
if (!browsers) {
return {actAs: this.desiredCapabilities.browserName, version: this.desiredCapabilities['browser-version']};
}
var browser =... | [
"function",
"(",
"browserName",
",",
"config",
")",
"{",
"var",
"browsers",
"=",
"config",
".",
"get",
"(",
"'browsers'",
")",
";",
"// check if we couldnt find a configured alias,",
"// set to defaults otherwise",
"if",
"(",
"!",
"browsers",
")",
"{",
"return",
"... | Verifies the browser config
@method _verfiyBrowserConfig
@param {string} browserName Name of the browser to verify
@param {object} config Daleks internal config helper
@return {object} Browser config
@private | [
"Verifies",
"the",
"browser",
"config"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/browser.js#L263-L285 | train | |
dalekjs/dalek-driver-sauce | lib/browser.js | function (browser) {
var isValid = this.platforms.reduce(function (previousValue, platform) {
if (previousValue === browser.platform || platform === browser.platform) {
return browser.platform;
}
});
return isValid || this.desiredCapabilities.platform;
} | javascript | function (browser) {
var isValid = this.platforms.reduce(function (previousValue, platform) {
if (previousValue === browser.platform || platform === browser.platform) {
return browser.platform;
}
});
return isValid || this.desiredCapabilities.platform;
} | [
"function",
"(",
"browser",
")",
"{",
"var",
"isValid",
"=",
"this",
".",
"platforms",
".",
"reduce",
"(",
"function",
"(",
"previousValue",
",",
"platform",
")",
"{",
"if",
"(",
"previousValue",
"===",
"browser",
".",
"platform",
"||",
"platform",
"===",
... | Verfies the OS platform config
@method _verfiyPlatformConfig
@param {object} browser Browser information
@return {string} Platform
@private | [
"Verfies",
"the",
"OS",
"platform",
"config"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/browser.js#L296-L304 | train | |
dalekjs/dalek-driver-sauce | lib/browser.js | function (browserName, config) {
var browser = this._verfiyBrowserConfig(browserName, config);
var platform = this._verfiyPlatformConfig(browser);
var driverConfig = config.get('driver.sauce');
var desiredCaps = {
browserName: browser.actAs,
platform: platform,
'screen-resolution': (br... | javascript | function (browserName, config) {
var browser = this._verfiyBrowserConfig(browserName, config);
var platform = this._verfiyPlatformConfig(browser);
var driverConfig = config.get('driver.sauce');
var desiredCaps = {
browserName: browser.actAs,
platform: platform,
'screen-resolution': (br... | [
"function",
"(",
"browserName",
",",
"config",
")",
"{",
"var",
"browser",
"=",
"this",
".",
"_verfiyBrowserConfig",
"(",
"browserName",
",",
"config",
")",
";",
"var",
"platform",
"=",
"this",
".",
"_verfiyPlatformConfig",
"(",
"browser",
")",
";",
"var",
... | Generates the desired capabilities for this session
@method _generateDesiredCaps
@param {string} browserName The browser name
@param {object} config Daleks internal config helper
@return {object} The sessions desired capabilities
@private | [
"Generates",
"the",
"desired",
"capabilities",
"for",
"this",
"session"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/browser.js#L316-L339 | train | |
dalekjs/dalek-driver-sauce | lib/browser.js | function (browserName, config) {
var longName = null;
if(this.browsers.hasOwnProperty(browserName)){
longName = this.browsers[browserName].longName;
}
if(config.get('browsers')[0].hasOwnProperty(browserName)){
longName = config.get('browsers')[0][browserName].longName;
}
return longN... | javascript | function (browserName, config) {
var longName = null;
if(this.browsers.hasOwnProperty(browserName)){
longName = this.browsers[browserName].longName;
}
if(config.get('browsers')[0].hasOwnProperty(browserName)){
longName = config.get('browsers')[0][browserName].longName;
}
return longN... | [
"function",
"(",
"browserName",
",",
"config",
")",
"{",
"var",
"longName",
"=",
"null",
";",
"if",
"(",
"this",
".",
"browsers",
".",
"hasOwnProperty",
"(",
"browserName",
")",
")",
"{",
"longName",
"=",
"this",
".",
"browsers",
"[",
"browserName",
"]",... | Generates the verbose name of the current remote browser in use
@method _generateLongName
@param {object} desiredCaps The sessions desired capabilities
@return {string} Verbose browser name
@private | [
"Generates",
"the",
"verbose",
"name",
"of",
"the",
"current",
"remote",
"browser",
"in",
"use"
] | 4b3ef87a0c35a91db8456d074b0d47a3e0df58f7 | https://github.com/dalekjs/dalek-driver-sauce/blob/4b3ef87a0c35a91db8456d074b0d47a3e0df58f7/lib/browser.js#L363-L372 | train | |
tolokoban/ToloFrameWork | ker/mod/wdg.wysiwyg.js | onMenu | function onMenu( item ) {
var squire = this.squire;
var id = item.id;
switch ( id ) {
case 'undo':
squire.undo();
break;
case 'redo':
squire.redo();
break;
case 'eraser':
squire.removeAllFormatting();
break;
case 'link':
makeLink.call(... | javascript | function onMenu( item ) {
var squire = this.squire;
var id = item.id;
switch ( id ) {
case 'undo':
squire.undo();
break;
case 'redo':
squire.redo();
break;
case 'eraser':
squire.removeAllFormatting();
break;
case 'link':
makeLink.call(... | [
"function",
"onMenu",
"(",
"item",
")",
"{",
"var",
"squire",
"=",
"this",
".",
"squire",
";",
"var",
"id",
"=",
"item",
".",
"id",
";",
"switch",
"(",
"id",
")",
"{",
"case",
"'undo'",
":",
"squire",
".",
"undo",
"(",
")",
";",
"break",
";",
"... | `this` is the squire object. | [
"this",
"is",
"the",
"squire",
"object",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/wdg.wysiwyg.js#L373-L448 | train |
weekeight/gulp-joycss | joycss/lib/csslib/cssReader.js | ruleEnd | function ruleEnd(e){
var selectors ;
if (e.old === 'ruleStart'){
selectors = this.get('selectors');
//delete the last selector
selectors.pop();
var lines = this.get('lines');
lines.pop();
this.attributes.nest.pop();
return;
} else if (e.old === 'valueStart') {
... | javascript | function ruleEnd(e){
var selectors ;
if (e.old === 'ruleStart'){
selectors = this.get('selectors');
//delete the last selector
selectors.pop();
var lines = this.get('lines');
lines.pop();
this.attributes.nest.pop();
return;
} else if (e.old === 'valueStart') {
... | [
"function",
"ruleEnd",
"(",
"e",
")",
"{",
"var",
"selectors",
";",
"if",
"(",
"e",
".",
"old",
"===",
"'ruleStart'",
")",
"{",
"selectors",
"=",
"this",
".",
"get",
"(",
"'selectors'",
")",
";",
"//delete the last selector",
"selectors",
".",
"pop",
"("... | 1. fix the problem when have some empty rule such as
@example .foo {}
remove the selector in the collections of selector
2. fix when the last value don't end with the semicolon
@example .foo { color: red } | [
"1",
".",
"fix",
"the",
"problem",
"when",
"have",
"some",
"empty",
"rule",
"such",
"as"
] | 5dc7a1276bcca878c2ac513efe6442fc47a36e29 | https://github.com/weekeight/gulp-joycss/blob/5dc7a1276bcca878c2ac513efe6442fc47a36e29/joycss/lib/csslib/cssReader.js#L170-L199 | train |
weekeight/gulp-joycss | joycss/lib/csslib/cssReader.js | addValue | function addValue(e){
var len;
if (e.old === 'valueStart') {
var history = this.get('history');
len = history.length;
var preStatus = history[len - 3];
isNew = preStatus == 'ruleStart';
value = this._getLast(isNew, 'values');
value && value.push(e.data);
} else {
... | javascript | function addValue(e){
var len;
if (e.old === 'valueStart') {
var history = this.get('history');
len = history.length;
var preStatus = history[len - 3];
isNew = preStatus == 'ruleStart';
value = this._getLast(isNew, 'values');
value && value.push(e.data);
} else {
... | [
"function",
"addValue",
"(",
"e",
")",
"{",
"var",
"len",
";",
"if",
"(",
"e",
".",
"old",
"===",
"'valueStart'",
")",
"{",
"var",
"history",
"=",
"this",
".",
"get",
"(",
"'history'",
")",
";",
"len",
"=",
"history",
".",
"length",
";",
"var",
"... | add value and when meet with single rule, such as '@charset "UTF-8";',
push the is to the object of metas | [
"add",
"value",
"and",
"when",
"meet",
"with",
"single",
"rule",
"such",
"as"
] | 5dc7a1276bcca878c2ac513efe6442fc47a36e29 | https://github.com/weekeight/gulp-joycss/blob/5dc7a1276bcca878c2ac513efe6442fc47a36e29/joycss/lib/csslib/cssReader.js#L234-L263 | train |
weekeight/gulp-joycss | joycss/lib/csslib/cssReader.js | getLast | function getLast(isNew, opt_key){
opt_key = opt_key || 'selectors';
var items = this.get(opt_key);
var len = items.length;
if (isNew){
len++;
items.push([]);
var nest = this.get('nest');
var nLen = nest.length;
if (nLen > 1){
//console.log([nest, nest[nLen - 2], l... | javascript | function getLast(isNew, opt_key){
opt_key = opt_key || 'selectors';
var items = this.get(opt_key);
var len = items.length;
if (isNew){
len++;
items.push([]);
var nest = this.get('nest');
var nLen = nest.length;
if (nLen > 1){
//console.log([nest, nest[nLen - 2], l... | [
"function",
"getLast",
"(",
"isNew",
",",
"opt_key",
")",
"{",
"opt_key",
"=",
"opt_key",
"||",
"'selectors'",
";",
"var",
"items",
"=",
"this",
".",
"get",
"(",
"opt_key",
")",
";",
"var",
"len",
"=",
"items",
".",
"length",
";",
"if",
"(",
"isNew",... | get last item of selectors or properties or values
@param isNew {bool} if isNew, push it an new empty array, if isNew
is null, isNew equal to false
@param opt_key {string} selectors | properties | values
by default opt_key is selectors | [
"get",
"last",
"item",
"of",
"selectors",
"or",
"properties",
"or",
"values"
] | 5dc7a1276bcca878c2ac513efe6442fc47a36e29 | https://github.com/weekeight/gulp-joycss/blob/5dc7a1276bcca878c2ac513efe6442fc47a36e29/joycss/lib/csslib/cssReader.js#L296-L315 | train |
weekeight/gulp-joycss | joycss/lib/csslib/cssReader.js | read | function read(data){
var dismember = this.get('DISMEMBER');
var i = 0, j = 0;
var comment = false;
var len = data.length;
var code = data[0];
var line = 1;
var val;
var slice = data.asciiSlice ? 'asciiSlice' : 'slice';
//console.log("one\n");
while(code){
if (typeof code... | javascript | function read(data){
var dismember = this.get('DISMEMBER');
var i = 0, j = 0;
var comment = false;
var len = data.length;
var code = data[0];
var line = 1;
var val;
var slice = data.asciiSlice ? 'asciiSlice' : 'slice';
//console.log("one\n");
while(code){
if (typeof code... | [
"function",
"read",
"(",
"data",
")",
"{",
"var",
"dismember",
"=",
"this",
".",
"get",
"(",
"'DISMEMBER'",
")",
";",
"var",
"i",
"=",
"0",
",",
"j",
"=",
"0",
";",
"var",
"comment",
"=",
"false",
";",
"var",
"len",
"=",
"data",
".",
"length",
... | read data steam, loop exam the assic code one by one. filter the comment
and when meet with code in dismember, fire some event, then change the
property of status, push event into the array of history, and deliver a
string of selector or property or value. | [
"read",
"data",
"steam",
"loop",
"exam",
"the",
"assic",
"code",
"one",
"by",
"one",
".",
"filter",
"the",
"comment",
"and",
"when",
"meet",
"with",
"code",
"in",
"dismember",
"fire",
"some",
"event",
"then",
"change",
"the",
"property",
"of",
"status",
... | 5dc7a1276bcca878c2ac513efe6442fc47a36e29 | https://github.com/weekeight/gulp-joycss/blob/5dc7a1276bcca878c2ac513efe6442fc47a36e29/joycss/lib/csslib/cssReader.js#L339-L395 | train |
arufian/better-say | app.js | function(sentences, options) {
var voice = options.voice, callback = options.callback,
iswrite = options.writetext;
for (var i=0; i<sentences.length; i++) {
speechList.push(sentences[i]);
};
try{
tts(voice, iswrite, callback);
return true;
} catch(e) {
throw new Error('... | javascript | function(sentences, options) {
var voice = options.voice, callback = options.callback,
iswrite = options.writetext;
for (var i=0; i<sentences.length; i++) {
speechList.push(sentences[i]);
};
try{
tts(voice, iswrite, callback);
return true;
} catch(e) {
throw new Error('... | [
"function",
"(",
"sentences",
",",
"options",
")",
"{",
"var",
"voice",
"=",
"options",
".",
"voice",
",",
"callback",
"=",
"options",
".",
"callback",
",",
"iswrite",
"=",
"options",
".",
"writetext",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",... | Make your computer speak better with multiple sentences
@param {Array} | {String} Array list of sentences or filepath
@param {Object<voice, writetext, callback>} options | [
"Make",
"your",
"computer",
"speak",
"better",
"with",
"multiple",
"sentences"
] | 52a53c0e96329109286bc64683ef65fdc06e1fda | https://github.com/arufian/better-say/blob/52a53c0e96329109286bc64683ef65fdc06e1fda/app.js#L69-L81 | train | |
assertjs/assert.js | dist/assert.esm.js | AssertionException | function AssertionException(type, message, id) {
var _this = _super.call(this, message) || this;
_this.type = type;
_this.id = id;
if (Error.captureStackTrace) {
Error.captureStackTrace(_this, _this.constructor);
}
return _this;
} | javascript | function AssertionException(type, message, id) {
var _this = _super.call(this, message) || this;
_this.type = type;
_this.id = id;
if (Error.captureStackTrace) {
Error.captureStackTrace(_this, _this.constructor);
}
return _this;
} | [
"function",
"AssertionException",
"(",
"type",
",",
"message",
",",
"id",
")",
"{",
"var",
"_this",
"=",
"_super",
".",
"call",
"(",
"this",
",",
"message",
")",
"||",
"this",
";",
"_this",
".",
"type",
"=",
"type",
";",
"_this",
".",
"id",
"=",
"i... | Create AssertionException based on type, message and id
@param {assertionTypes} type - Assertion type
@param {string} message - Custom error message
@param {string} id - Exception id | [
"Create",
"AssertionException",
"based",
"on",
"type",
"message",
"and",
"id"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L115-L123 | train |
assertjs/assert.js | dist/assert.esm.js | fail | function fail(message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled) {
throw new AssertionException(assertionTypes.FAIL, message, id);
}
} | javascript | function fail(message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled) {
throw new AssertionException(assertionTypes.FAIL, message, id);
}
} | [
"function",
"fail",
"(",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"(",
"this",
".",
"... | Always throw AssertError
@param message
@param id
@returns {void} | [
"Always",
"throw",
"AssertError"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L147-L153 | train |
assertjs/assert.js | dist/assert.esm.js | isTruthy | function isTruthy(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !value) {
throw LogicException.throw(assertionTypes.IS_TRUTHY, value, message, id);
}
} | javascript | function isTruthy(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !value) {
throw LogicException.throw(assertionTypes.IS_TRUTHY, value, message, id);
}
} | [
"function",
"isTruthy",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"("... | Assert if given value is truthy
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Assert",
"if",
"given",
"value",
"is",
"truthy"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L259-L265 | train |
assertjs/assert.js | dist/assert.esm.js | isFalsy | function isFalsy(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value) {
throw LogicException.throw(assertionTypes.IS_FALSY, value, message, id);
}
} | javascript | function isFalsy(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value) {
throw LogicException.throw(assertionTypes.IS_FALSY, value, message, id);
}
} | [
"function",
"isFalsy",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"(",... | Assert if given value is falsy
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Assert",
"if",
"given",
"value",
"is",
"falsy"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L274-L280 | train |
assertjs/assert.js | dist/assert.esm.js | isEmpty | function isEmpty(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled &&
((typeof value === 'string' && value.length === 0) ||
(typeof value === 'number' && value === 0))) {
throw LogicException.throw(assertionType... | javascript | function isEmpty(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled &&
((typeof value === 'string' && value.length === 0) ||
(typeof value === 'number' && value === 0))) {
throw LogicException.throw(assertionType... | [
"function",
"isEmpty",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"(",... | Assert if given value is empty
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Assert",
"if",
"given",
"value",
"is",
"empty"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L289-L297 | train |
assertjs/assert.js | dist/assert.esm.js | isNotEmpty | function isNotEmpty(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled &&
((typeof value === 'string' && value.length !== 0) ||
(typeof value === 'number' && value !== 0))) {
throw LogicException.throw(assertionT... | javascript | function isNotEmpty(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled &&
((typeof value === 'string' && value.length !== 0) ||
(typeof value === 'number' && value !== 0))) {
throw LogicException.throw(assertionT... | [
"function",
"isNotEmpty",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"... | Assert if given value is not empty
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Assert",
"if",
"given",
"value",
"is",
"not",
"empty"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L306-L314 | train |
assertjs/assert.js | dist/assert.esm.js | isUndefined | function isUndefined(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value !== undefined) {
throw TypeException.unexpectedType(assertionTypes.IS_UNDEFINED, value, '<undefined>', message, id);
}
} | javascript | function isUndefined(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value !== undefined) {
throw TypeException.unexpectedType(assertionTypes.IS_UNDEFINED, value, '<undefined>', message, id);
}
} | [
"function",
"isUndefined",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
... | Check if provided value is undefined
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Check",
"if",
"provided",
"value",
"is",
"undefined"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L384-L390 | train |
assertjs/assert.js | dist/assert.esm.js | isBool | function isBool(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && typeof value !== 'boolean') {
throw TypeException.unexpectedType(assertionTypes.IS_BOOL, value, '<boolean>', message, id);
}
} | javascript | function isBool(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && typeof value !== 'boolean') {
throw TypeException.unexpectedType(assertionTypes.IS_BOOL, value, '<boolean>', message, id);
}
} | [
"function",
"isBool",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"(",
... | Check if provided value is boolean
@param value
@param {string} message
@param {string} id
@returns void | [
"Check",
"if",
"provided",
"value",
"is",
"boolean"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L399-L405 | train |
assertjs/assert.js | dist/assert.esm.js | isNotBool | function isNotBool(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && typeof value === 'boolean') {
throw TypeException.expectedType(assertionTypes.IS_NOT_BOOL, value, '<boolean>', message, id);
}
} | javascript | function isNotBool(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && typeof value === 'boolean') {
throw TypeException.expectedType(assertionTypes.IS_NOT_BOOL, value, '<boolean>', message, id);
}
} | [
"function",
"isNotBool",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"(... | Check if provided value is not boolean
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Check",
"if",
"provided",
"value",
"is",
"not",
"boolean"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L414-L420 | train |
assertjs/assert.js | dist/assert.esm.js | isNumber | function isNumber(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !(typeof value === 'number' || value instanceof Number)) {
throw TypeException.unexpectedType(assertionTypes.IS_NUMBER, value, '<number>', message, id);
}
} | javascript | function isNumber(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !(typeof value === 'number' || value instanceof Number)) {
throw TypeException.unexpectedType(assertionTypes.IS_NUMBER, value, '<number>', message, id);
}
} | [
"function",
"isNumber",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"("... | Check if provided value is number
@param value
@param {string} message
@param {string} id
@returns void | [
"Check",
"if",
"provided",
"value",
"is",
"number"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L429-L435 | train |
assertjs/assert.js | dist/assert.esm.js | isNotNumber | function isNotNumber(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && (typeof value === 'number' || value instanceof Number)) {
throw TypeException.expectedType(assertionTypes.IS_NOT_NUMBER, value, '<number>', message, id);
... | javascript | function isNotNumber(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && (typeof value === 'number' || value instanceof Number)) {
throw TypeException.expectedType(assertionTypes.IS_NOT_NUMBER, value, '<number>', message, id);
... | [
"function",
"isNotNumber",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
... | Check if provided value is not number
@param value
@param {string} message
@param {string} id
@returns void | [
"Check",
"if",
"provided",
"value",
"is",
"not",
"number"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L444-L450 | train |
assertjs/assert.js | dist/assert.esm.js | isNaN | function isNaN(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !Number.isNaN(value)) {
throw TypeException.unexpectedType(assertionTypes.IS_NAN, value, '<NaN>', message, id);
}
} | javascript | function isNaN(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !Number.isNaN(value)) {
throw TypeException.unexpectedType(assertionTypes.IS_NAN, value, '<NaN>', message, id);
}
} | [
"function",
"isNaN",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"(",
... | Check if provided value is Not a Number
@param value
@param {string} message
@param {string} id
@returns void | [
"Check",
"if",
"provided",
"value",
"is",
"Not",
"a",
"Number"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L489-L495 | train |
assertjs/assert.js | dist/assert.esm.js | isNotNaN | function isNotNaN(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && Number.isNaN(value)) {
throw TypeException.expectedType(assertionTypes.IS_NOT_NAN, value, '<NaN>', message, id);
}
} | javascript | function isNotNaN(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && Number.isNaN(value)) {
throw TypeException.expectedType(assertionTypes.IS_NOT_NAN, value, '<NaN>', message, id);
}
} | [
"function",
"isNotNaN",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"("... | Check if provided value is other than Not a Number
@param value
@param {string} message
@param {string} id
@returns void | [
"Check",
"if",
"provided",
"value",
"is",
"other",
"than",
"Not",
"a",
"Number"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L504-L510 | train |
assertjs/assert.js | dist/assert.esm.js | isString | function isString(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !(typeof value === 'string' || value instanceof String)) {
throw TypeException.unexpectedType(assertionTypes.IS_STRING, value, '<string>', message, id);
}
} | javascript | function isString(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !(typeof value === 'string' || value instanceof String)) {
throw TypeException.unexpectedType(assertionTypes.IS_STRING, value, '<string>', message, id);
}
} | [
"function",
"isString",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"("... | Check if provided value is string
@param value
@param {string} message
@param {string} id
@returns void | [
"Check",
"if",
"provided",
"value",
"is",
"string"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L519-L525 | train |
assertjs/assert.js | dist/assert.esm.js | isNotString | function isNotString(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && (typeof value === 'string' || value instanceof String)) {
throw TypeException.expectedType(assertionTypes.IS_NOT_STRING, value, '<string>', message, id);
... | javascript | function isNotString(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && (typeof value === 'string' || value instanceof String)) {
throw TypeException.expectedType(assertionTypes.IS_NOT_STRING, value, '<string>', message, id);
... | [
"function",
"isNotString",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
... | Check if provided value is not string
@param value
@param {string} message
@param {string} id
@returns void | [
"Check",
"if",
"provided",
"value",
"is",
"not",
"string"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L534-L540 | train |
assertjs/assert.js | dist/assert.esm.js | isArray | function isArray(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !Array.isArray(value)) {
throw TypeException.unexpectedType(assertionTypes.IS_ARRAY, value, '<array>', message, id);
}
} | javascript | function isArray(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !Array.isArray(value)) {
throw TypeException.unexpectedType(assertionTypes.IS_ARRAY, value, '<array>', message, id);
}
} | [
"function",
"isArray",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"(",... | Check if provided value is an array
@param value
@param {string} message
@param {string} id
@returns void | [
"Check",
"if",
"provided",
"value",
"is",
"an",
"array"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L549-L555 | train |
assertjs/assert.js | dist/assert.esm.js | isNotArray | function isNotArray(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && Array.isArray(value)) {
throw TypeException.expectedType(assertionTypes.IS_NOT_ARRAY, value, '<array>', message, id);
}
} | javascript | function isNotArray(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && Array.isArray(value)) {
throw TypeException.expectedType(assertionTypes.IS_NOT_ARRAY, value, '<array>', message, id);
}
} | [
"function",
"isNotArray",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"... | Check if provided value is not an array
@param value
@param {string} message
@param {string} id
@returns void | [
"Check",
"if",
"provided",
"value",
"is",
"not",
"an",
"array"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L564-L570 | train |
assertjs/assert.js | dist/assert.esm.js | isFunction | function isFunction(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && typeof value !== 'function') {
throw TypeException.expectedType(assertionTypes.IS_FUNCTION, value, '<function>', message, id);
}
} | javascript | function isFunction(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && typeof value !== 'function') {
throw TypeException.expectedType(assertionTypes.IS_FUNCTION, value, '<function>', message, id);
}
} | [
"function",
"isFunction",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"... | Check if provided value is function
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Check",
"if",
"provided",
"value",
"is",
"function"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L579-L585 | train |
assertjs/assert.js | dist/assert.esm.js | isNotFunction | function isNotFunction(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && typeof value === 'function') {
throw TypeException.unexpectedType(assertionTypes.IS_NOT_FUNCTION, value, '<function>', message, id);
}
} | javascript | function isNotFunction(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && typeof value === 'function') {
throw TypeException.unexpectedType(assertionTypes.IS_NOT_FUNCTION, value, '<function>', message, id);
}
} | [
"function",
"isNotFunction",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
... | Check if provided value is not function
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Check",
"if",
"provided",
"value",
"is",
"not",
"function"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L594-L600 | train |
assertjs/assert.js | dist/assert.esm.js | isSymbol | function isSymbol(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && typeof value !== 'symbol') {
throw TypeException.unexpectedType(assertionTypes.IS_SYMBOL, value, '<symbol>', message, id);
}
} | javascript | function isSymbol(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && typeof value !== 'symbol') {
throw TypeException.unexpectedType(assertionTypes.IS_SYMBOL, value, '<symbol>', message, id);
}
} | [
"function",
"isSymbol",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"("... | Check if provided value is Symbol
@param value
@param {string} message
@param {string} id
@returns void | [
"Check",
"if",
"provided",
"value",
"is",
"Symbol"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L609-L615 | train |
assertjs/assert.js | dist/assert.esm.js | isNotSymbol | function isNotSymbol(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && typeof value === 'symbol') {
throw TypeException.expectedType(assertionTypes.IS_NOT_SYMBOL, value, '<symbol>', message, id);
}
} | javascript | function isNotSymbol(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && typeof value === 'symbol') {
throw TypeException.expectedType(assertionTypes.IS_NOT_SYMBOL, value, '<symbol>', message, id);
}
} | [
"function",
"isNotSymbol",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
... | Check if provided value is not an Symbol
@param value
@param {string} message
@param {string} id
@returns void | [
"Check",
"if",
"provided",
"value",
"is",
"not",
"an",
"Symbol"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L624-L630 | train |
assertjs/assert.js | dist/assert.esm.js | isInstanceOf | function isInstanceOf(value, expectedInstance, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !(value instanceof expectedInstance)) {
throw ValueException.unexpectedValue(assertionTypes.INSTANCE_OF, value, expectedInstance, message, i... | javascript | function isInstanceOf(value, expectedInstance, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !(value instanceof expectedInstance)) {
throw ValueException.unexpectedValue(assertionTypes.INSTANCE_OF, value, expectedInstance, message, i... | [
"function",
"isInstanceOf",
"(",
"value",
",",
"expectedInstance",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
... | Check if provided value is an expected instance
@param value
@param {Function} expectedInstance
@param {string} message
@param {string} id
@returns {void} | [
"Check",
"if",
"provided",
"value",
"is",
"an",
"expected",
"instance"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L686-L692 | train |
assertjs/assert.js | dist/assert.esm.js | isNotInstanceOf | function isNotInstanceOf(value, excludedInstance, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value instanceof excludedInstance) {
throw ValueException.expectedValue(assertionTypes.NOT_INSTANCE_OF, value, excludedInstance, message,... | javascript | function isNotInstanceOf(value, excludedInstance, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value instanceof excludedInstance) {
throw ValueException.expectedValue(assertionTypes.NOT_INSTANCE_OF, value, excludedInstance, message,... | [
"function",
"isNotInstanceOf",
"(",
"value",
",",
"excludedInstance",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",... | Check if provided value is not instance of excluded instance
@param value
@param {Function} excludedInstance
@param {string} message
@param {string} id | [
"Check",
"if",
"provided",
"value",
"is",
"not",
"instance",
"of",
"excluded",
"instance"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L701-L707 | train |
assertjs/assert.js | dist/assert.esm.js | isTrue | function isTrue(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value !== true) {
throw ValueException.unexpectedValue(assertionTypes.IS_TRUE, value, true, message, id);
}
} | javascript | function isTrue(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value !== true) {
throw ValueException.unexpectedValue(assertionTypes.IS_TRUE, value, true, message, id);
}
} | [
"function",
"isTrue",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"(",
... | Check if provided value is true
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Check",
"if",
"provided",
"value",
"is",
"true"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L716-L722 | train |
assertjs/assert.js | dist/assert.esm.js | isNotTrue | function isNotTrue(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value === true) {
throw ValueException.expectedValue(assertionTypes.IS_NOT_TRUE, value, true, message, id);
}
} | javascript | function isNotTrue(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value === true) {
throw ValueException.expectedValue(assertionTypes.IS_NOT_TRUE, value, true, message, id);
}
} | [
"function",
"isNotTrue",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"(... | Check if provided value is not true
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Check",
"if",
"provided",
"value",
"is",
"not",
"true"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L731-L737 | train |
assertjs/assert.js | dist/assert.esm.js | isFalse | function isFalse(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value !== false) {
throw ValueException.unexpectedValue(assertionTypes.IS_FALSE, value, false, message, id);
}
} | javascript | function isFalse(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value !== false) {
throw ValueException.unexpectedValue(assertionTypes.IS_FALSE, value, false, message, id);
}
} | [
"function",
"isFalse",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"(",... | Check if provided value is false
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Check",
"if",
"provided",
"value",
"is",
"false"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L746-L752 | train |
assertjs/assert.js | dist/assert.esm.js | isNotFalse | function isNotFalse(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value === false) {
throw ValueException.expectedValue(assertionTypes.IS_NOT_FALSE, value, false, message, id);
}
} | javascript | function isNotFalse(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value === false) {
throw ValueException.expectedValue(assertionTypes.IS_NOT_FALSE, value, false, message, id);
}
} | [
"function",
"isNotFalse",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"... | Check if provided value is not false
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Check",
"if",
"provided",
"value",
"is",
"not",
"false"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L761-L767 | train |
assertjs/assert.js | dist/assert.esm.js | isNull | function isNull(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value !== null) {
throw ValueException.unexpectedValue(assertionTypes.IS_NULL, value, null, message, id);
}
} | javascript | function isNull(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value !== null) {
throw ValueException.unexpectedValue(assertionTypes.IS_NULL, value, null, message, id);
}
} | [
"function",
"isNull",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"(",
... | Check if provided value is null
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Check",
"if",
"provided",
"value",
"is",
"null"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L776-L782 | train |
assertjs/assert.js | dist/assert.esm.js | isNotNull | function isNotNull(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value === null) {
throw ValueException.expectedValue(assertionTypes.IS_NOT_NULL, value, null, message, id);
}
} | javascript | function isNotNull(value, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && value === null) {
throw ValueException.expectedValue(assertionTypes.IS_NOT_NULL, value, null, message, id);
}
} | [
"function",
"isNotNull",
"(",
"value",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}",
"if",
"(... | Check if provided value is not null
@param value
@param {string} message
@param {string} id
@returns {void} | [
"Check",
"if",
"provided",
"value",
"is",
"not",
"null"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L791-L797 | train |
assertjs/assert.js | dist/assert.esm.js | match | function match(value, regExp, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !regExp.test(value)) {
throw LogicException.throw(assertionTypes.MATCH, value, message, id);
}
} | javascript | function match(value, regExp, message, id) {
if (message === void 0) { message = ''; }
if (id === void 0) { id = ''; }
if (this.enabled && !regExp.test(value)) {
throw LogicException.throw(assertionTypes.MATCH, value, message, id);
}
} | [
"function",
"match",
"(",
"value",
",",
"regExp",
",",
"message",
",",
"id",
")",
"{",
"if",
"(",
"message",
"===",
"void",
"0",
")",
"{",
"message",
"=",
"''",
";",
"}",
"if",
"(",
"id",
"===",
"void",
"0",
")",
"{",
"id",
"=",
"''",
";",
"}... | Check if provided value match provided RegExp
@param {string} value
@param {RegExp} regExp
@param {string} message
@param {string} id
@returns {void} | [
"Check",
"if",
"provided",
"value",
"match",
"provided",
"RegExp"
] | 709656c2dc87ffa47f86e0e3d6442f199252260c | https://github.com/assertjs/assert.js/blob/709656c2dc87ffa47f86e0e3d6442f199252260c/dist/assert.esm.js#L807-L813 | train |
joaquinfq/jf-json-parse | index.js | loadJsonFile | function loadJsonFile(filename, cache, cwd)
{
let _content = null;
if (filename.toLowerCase().endsWith('.json'))
{
const _filename = path.resolve(cwd, filename);
if (fs.existsSync(_filename))
{
if (_filename in cache)
{
_content = cache[_filena... | javascript | function loadJsonFile(filename, cache, cwd)
{
let _content = null;
if (filename.toLowerCase().endsWith('.json'))
{
const _filename = path.resolve(cwd, filename);
if (fs.existsSync(_filename))
{
if (_filename in cache)
{
_content = cache[_filena... | [
"function",
"loadJsonFile",
"(",
"filename",
",",
"cache",
",",
"cwd",
")",
"{",
"let",
"_content",
"=",
"null",
";",
"if",
"(",
"filename",
".",
"toLowerCase",
"(",
")",
".",
"endsWith",
"(",
"'.json'",
")",
")",
"{",
"const",
"_filename",
"=",
"path"... | Lee el archivo JSON o el texto en formato JSON y busca los archivos JSON incluidos.
Si un archivo no existe se deja el texto tal cual.
@param {string} filename Ruta al archivo a leer o texto en formato JSON.
@param {object} cache Archivos y textos procesados previamente.
@param {object} cwd Directorio actual a... | [
"Lee",
"el",
"archivo",
"JSON",
"o",
"el",
"texto",
"en",
"formato",
"JSON",
"y",
"busca",
"los",
"archivos",
"JSON",
"incluidos",
".",
"Si",
"un",
"archivo",
"no",
"existe",
"se",
"deja",
"el",
"texto",
"tal",
"cual",
"."
] | 73ad42e71de95426d51c98a9780419945fe2004e | https://github.com/joaquinfq/jf-json-parse/blob/73ad42e71de95426d51c98a9780419945fe2004e/index.js#L14-L55 | 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.