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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
documentcloud/underscore-contrib | dist/underscore-contrib.js | function(fun) {
var funLength = fun.length;
if (funLength < 1) {
return fun;
}
else if (funLength === 1) {
return function () {
return fun.call(this, __slice.call(arguments, 0));
};
}
else {
return function () {
var numberOfArgs =... | javascript | function(fun) {
var funLength = fun.length;
if (funLength < 1) {
return fun;
}
else if (funLength === 1) {
return function () {
return fun.call(this, __slice.call(arguments, 0));
};
}
else {
return function () {
var numberOfArgs =... | [
"function",
"(",
"fun",
")",
"{",
"var",
"funLength",
"=",
"fun",
".",
"length",
";",
"if",
"(",
"funLength",
"<",
"1",
")",
"{",
"return",
"fun",
";",
"}",
"else",
"if",
"(",
"funLength",
"===",
"1",
")",
"{",
"return",
"function",
"(",
")",
"{"... | Takes a function expecting an array and returns a function that takes varargs and wraps all in an array that is passed to the original function. | [
"Takes",
"a",
"function",
"expecting",
"an",
"array",
"and",
"returns",
"a",
"function",
"that",
"takes",
"varargs",
"and",
"wraps",
"all",
"in",
"an",
"array",
"that",
"is",
"passed",
"to",
"the",
"original",
"function",
"."
] | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/dist/underscore-contrib.js#L845-L867 | train | |
documentcloud/underscore-contrib | dist/underscore-contrib.js | function(/* funs */) {
var funs = arguments;
return function(/* args */) {
var args = arguments;
return _.map(funs, function(f) {
return f.apply(this, args);
}, this);
};
} | javascript | function(/* funs */) {
var funs = arguments;
return function(/* args */) {
var args = arguments;
return _.map(funs, function(f) {
return f.apply(this, args);
}, this);
};
} | [
"function",
"(",
"/* funs */",
")",
"{",
"var",
"funs",
"=",
"arguments",
";",
"return",
"function",
"(",
"/* args */",
")",
"{",
"var",
"args",
"=",
"arguments",
";",
"return",
"_",
".",
"map",
"(",
"funs",
",",
"function",
"(",
"f",
")",
"{",
"retu... | Returns a function that returns an array of the calls to each given function for some arguments. | [
"Returns",
"a",
"function",
"that",
"returns",
"an",
"array",
"of",
"the",
"calls",
"to",
"each",
"given",
"function",
"for",
"some",
"arguments",
"."
] | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/dist/underscore-contrib.js#L898-L907 | train | |
documentcloud/underscore-contrib | dist/underscore-contrib.js | function(fun /*, defaults */) {
var defaults = _.rest(arguments);
return function(/*args*/) {
var args = _.toArray(arguments);
var sz = _.size(defaults);
for(var i = 0; i < sz; i++) {
if (!existy(args[i]))
args[i] = defaults[i];
}
return fun.a... | javascript | function(fun /*, defaults */) {
var defaults = _.rest(arguments);
return function(/*args*/) {
var args = _.toArray(arguments);
var sz = _.size(defaults);
for(var i = 0; i < sz; i++) {
if (!existy(args[i]))
args[i] = defaults[i];
}
return fun.a... | [
"function",
"(",
"fun",
"/*, defaults */",
")",
"{",
"var",
"defaults",
"=",
"_",
".",
"rest",
"(",
"arguments",
")",
";",
"return",
"function",
"(",
"/*args*/",
")",
"{",
"var",
"args",
"=",
"_",
".",
"toArray",
"(",
"arguments",
")",
";",
"var",
"s... | Returns a function that protects a given function from receiving non-existy values. Each subsequent value provided to `fnull` acts as the default to the original function should a call receive non-existy values in the defaulted arg slots. | [
"Returns",
"a",
"function",
"that",
"protects",
"a",
"given",
"function",
"from",
"receiving",
"non",
"-",
"existy",
"values",
".",
"Each",
"subsequent",
"value",
"provided",
"to",
"fnull",
"acts",
"as",
"the",
"default",
"to",
"the",
"original",
"function",
... | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/dist/underscore-contrib.js#L913-L927 | train | |
documentcloud/underscore-contrib | dist/underscore-contrib.js | function(fun) {
return function(/* args */) {
var flipped = __slice.call(arguments);
flipped[0] = arguments[1];
flipped[1] = arguments[0];
return fun.apply(this, flipped);
};
} | javascript | function(fun) {
return function(/* args */) {
var flipped = __slice.call(arguments);
flipped[0] = arguments[1];
flipped[1] = arguments[0];
return fun.apply(this, flipped);
};
} | [
"function",
"(",
"fun",
")",
"{",
"return",
"function",
"(",
"/* args */",
")",
"{",
"var",
"flipped",
"=",
"__slice",
".",
"call",
"(",
"arguments",
")",
";",
"flipped",
"[",
"0",
"]",
"=",
"arguments",
"[",
"1",
"]",
";",
"flipped",
"[",
"1",
"]"... | Flips the first two args of a function | [
"Flips",
"the",
"first",
"two",
"args",
"of",
"a",
"function"
] | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/dist/underscore-contrib.js#L930-L938 | train | |
documentcloud/underscore-contrib | dist/underscore-contrib.js | function(object, method) {
if (object == null) return void 0;
var func = object[method];
var args = slice.call(arguments, 2);
return _.isFunction(func) ? func.apply(object, args) : void 0;
} | javascript | function(object, method) {
if (object == null) return void 0;
var func = object[method];
var args = slice.call(arguments, 2);
return _.isFunction(func) ? func.apply(object, args) : void 0;
} | [
"function",
"(",
"object",
",",
"method",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"return",
"void",
"0",
";",
"var",
"func",
"=",
"object",
"[",
"method",
"]",
";",
"var",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"2",
"... | If object is not undefined or null then invoke the named `method` function with `object` as context and arguments; otherwise, return undefined. | [
"If",
"object",
"is",
"not",
"undefined",
"or",
"null",
"then",
"invoke",
"the",
"named",
"method",
"function",
"with",
"object",
"as",
"context",
"and",
"arguments",
";",
"otherwise",
"return",
"undefined",
"."
] | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/dist/underscore-contrib.js#L1013-L1018 | train | |
documentcloud/underscore-contrib | dist/underscore-contrib.js | unfoldWithReturn | function unfoldWithReturn (seed, unaryFn) {
var state = seed,
pair,
value;
return function () {
if (state != null) {
pair = unaryFn.call(state, state);
value = pair[1];
state = value != null ? pair[0] : void 0;
return value;
}
else return void 0;... | javascript | function unfoldWithReturn (seed, unaryFn) {
var state = seed,
pair,
value;
return function () {
if (state != null) {
pair = unaryFn.call(state, state);
value = pair[1];
state = value != null ? pair[0] : void 0;
return value;
}
else return void 0;... | [
"function",
"unfoldWithReturn",
"(",
"seed",
",",
"unaryFn",
")",
"{",
"var",
"state",
"=",
"seed",
",",
"pair",
",",
"value",
";",
"return",
"function",
"(",
")",
"{",
"if",
"(",
"state",
"!=",
"null",
")",
"{",
"pair",
"=",
"unaryFn",
".",
"call",
... | note that the unfoldWithReturn behaves differently than unfold with respect to the first value returned | [
"note",
"that",
"the",
"unfoldWithReturn",
"behaves",
"differently",
"than",
"unfold",
"with",
"respect",
"to",
"the",
"first",
"value",
"returned"
] | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/dist/underscore-contrib.js#L1086-L1099 | train |
documentcloud/underscore-contrib | dist/underscore-contrib.js | function() {
var count = _.size(arguments);
if (count === 1) return true;
if (count === 2) return arguments[0] < arguments[1];
for (var i = 1; i < count; i++) {
if (arguments[i-1] >= arguments[i]) {
return false;
}
}
return true;
} | javascript | function() {
var count = _.size(arguments);
if (count === 1) return true;
if (count === 2) return arguments[0] < arguments[1];
for (var i = 1; i < count; i++) {
if (arguments[i-1] >= arguments[i]) {
return false;
}
}
return true;
} | [
"function",
"(",
")",
"{",
"var",
"count",
"=",
"_",
".",
"size",
"(",
"arguments",
")",
";",
"if",
"(",
"count",
"===",
"1",
")",
"return",
"true",
";",
"if",
"(",
"count",
"===",
"2",
")",
"return",
"arguments",
"[",
"0",
"]",
"<",
"arguments",... | Returns true if its arguments are monotonically increaing values; false otherwise. | [
"Returns",
"true",
"if",
"its",
"arguments",
"are",
"monotonically",
"increaing",
"values",
";",
"false",
"otherwise",
"."
] | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/dist/underscore-contrib.js#L1438-L1450 | train | |
documentcloud/underscore-contrib | dist/underscore-contrib.js | function(obj, kobj) {
return _.reduce(kobj, function(o, nu, old) {
if (existy(obj[old])) {
o[nu] = obj[old];
return o;
}
else
return o;
},
_.omit.apply(null, concat.call([obj], _.keys(kobj))));
} | javascript | function(obj, kobj) {
return _.reduce(kobj, function(o, nu, old) {
if (existy(obj[old])) {
o[nu] = obj[old];
return o;
}
else
return o;
},
_.omit.apply(null, concat.call([obj], _.keys(kobj))));
} | [
"function",
"(",
"obj",
",",
"kobj",
")",
"{",
"return",
"_",
".",
"reduce",
"(",
"kobj",
",",
"function",
"(",
"o",
",",
"nu",
",",
"old",
")",
"{",
"if",
"(",
"existy",
"(",
"obj",
"[",
"old",
"]",
")",
")",
"{",
"o",
"[",
"nu",
"]",
"=",... | Takes an object and another object of strings to strings where the second object describes the key renaming to occur in the first object. | [
"Takes",
"an",
"object",
"and",
"another",
"object",
"of",
"strings",
"to",
"strings",
"where",
"the",
"second",
"object",
"describes",
"the",
"key",
"renaming",
"to",
"occur",
"in",
"the",
"first",
"object",
"."
] | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/dist/underscore-contrib.js#L1520-L1530 | train | |
documentcloud/underscore-contrib | dist/underscore-contrib.js | function(obj, fun, ks, defaultValue) {
if (!isAssociative(obj)) throw new TypeError("Attempted to update a non-associative object.");
if (!existy(ks)) return fun(obj);
var deepness = _.isArray(ks);
var keys = deepness ? ks : [ks];
var ret = deepness ? _.snapshot(obj) : _.clone(ob... | javascript | function(obj, fun, ks, defaultValue) {
if (!isAssociative(obj)) throw new TypeError("Attempted to update a non-associative object.");
if (!existy(ks)) return fun(obj);
var deepness = _.isArray(ks);
var keys = deepness ? ks : [ks];
var ret = deepness ? _.snapshot(obj) : _.clone(ob... | [
"function",
"(",
"obj",
",",
"fun",
",",
"ks",
",",
"defaultValue",
")",
"{",
"if",
"(",
"!",
"isAssociative",
"(",
"obj",
")",
")",
"throw",
"new",
"TypeError",
"(",
"\"Attempted to update a non-associative object.\"",
")",
";",
"if",
"(",
"!",
"existy",
... | Updates the value at any depth in a nested object based on the path described by the keys given. The function provided is supplied the current value and is expected to return a value for use as the new value. If no keys are provided, then the object itself is presented to the given function. | [
"Updates",
"the",
"value",
"at",
"any",
"depth",
"in",
"a",
"nested",
"object",
"based",
"on",
"the",
"path",
"described",
"by",
"the",
"keys",
"given",
".",
"The",
"function",
"provided",
"is",
"supplied",
"the",
"current",
"value",
"and",
"is",
"expected... | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/dist/underscore-contrib.js#L1556-L1575 | train | |
documentcloud/underscore-contrib | dist/underscore-contrib.js | function(obj, value, ks, defaultValue) {
if (!existy(ks)) throw new TypeError("Attempted to set a property at a null path.");
return _.updatePath(obj, function() { return value; }, ks, defaultValue);
} | javascript | function(obj, value, ks, defaultValue) {
if (!existy(ks)) throw new TypeError("Attempted to set a property at a null path.");
return _.updatePath(obj, function() { return value; }, ks, defaultValue);
} | [
"function",
"(",
"obj",
",",
"value",
",",
"ks",
",",
"defaultValue",
")",
"{",
"if",
"(",
"!",
"existy",
"(",
"ks",
")",
")",
"throw",
"new",
"TypeError",
"(",
"\"Attempted to set a property at a null path.\"",
")",
";",
"return",
"_",
".",
"updatePath",
... | Sets the value at any depth in a nested object based on the path described by the keys given. | [
"Sets",
"the",
"value",
"at",
"any",
"depth",
"in",
"a",
"nested",
"object",
"based",
"on",
"the",
"path",
"described",
"by",
"the",
"keys",
"given",
"."
] | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/dist/underscore-contrib.js#L1579-L1583 | train | |
documentcloud/underscore-contrib | dist/underscore-contrib.js | function (obj, ks) {
return _.pick.apply(null, concat.call([obj], ks));
} | javascript | function (obj, ks) {
return _.pick.apply(null, concat.call([obj], ks));
} | [
"function",
"(",
"obj",
",",
"ks",
")",
"{",
"return",
"_",
".",
"pick",
".",
"apply",
"(",
"null",
",",
"concat",
".",
"call",
"(",
"[",
"obj",
"]",
",",
"ks",
")",
")",
";",
"}"
] | Like `_.pick` except that it takes an array of keys to pick. | [
"Like",
"_",
".",
"pick",
"except",
"that",
"it",
"takes",
"an",
"array",
"of",
"keys",
"to",
"pick",
"."
] | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/dist/underscore-contrib.js#L1633-L1635 | train | |
documentcloud/underscore-contrib | dist/underscore-contrib.js | function(str) {
var parameters = str.split('&'),
obj = {},
parameter,
key,
match,
lastKey,
subKey,
depth;
// Iterate over key/value pairs
_.each(parameters, function(parameter) {
parameter = parameter.split('=');
ke... | javascript | function(str) {
var parameters = str.split('&'),
obj = {},
parameter,
key,
match,
lastKey,
subKey,
depth;
// Iterate over key/value pairs
_.each(parameters, function(parameter) {
parameter = parameter.split('=');
ke... | [
"function",
"(",
"str",
")",
"{",
"var",
"parameters",
"=",
"str",
".",
"split",
"(",
"'&'",
")",
",",
"obj",
"=",
"{",
"}",
",",
"parameter",
",",
"key",
",",
"match",
",",
"lastKey",
",",
"subKey",
",",
"depth",
";",
"// Iterate over key/value pairs"... | Parses a query string into a hash | [
"Parses",
"a",
"query",
"string",
"into",
"a",
"hash"
] | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/dist/underscore-contrib.js#L1951-L1996 | train | |
documentcloud/underscore-contrib | underscore.util.operators.js | variaderize | function variaderize(func) {
return function (args) {
var allArgs = isArrayLike(args) ? args : arguments;
return func(allArgs);
};
} | javascript | function variaderize(func) {
return function (args) {
var allArgs = isArrayLike(args) ? args : arguments;
return func(allArgs);
};
} | [
"function",
"variaderize",
"(",
"func",
")",
"{",
"return",
"function",
"(",
"args",
")",
"{",
"var",
"allArgs",
"=",
"isArrayLike",
"(",
"args",
")",
"?",
"args",
":",
"arguments",
";",
"return",
"func",
"(",
"allArgs",
")",
";",
"}",
";",
"}"
] | Converts a unary function that operates on an array into one that also works with a variable number of arguments | [
"Converts",
"a",
"unary",
"function",
"that",
"operates",
"on",
"an",
"array",
"into",
"one",
"that",
"also",
"works",
"with",
"a",
"variable",
"number",
"of",
"arguments"
] | 1492ffbe04a62a838da89df6ebdf77d0ed0b9844 | https://github.com/documentcloud/underscore-contrib/blob/1492ffbe04a62a838da89df6ebdf77d0ed0b9844/underscore.util.operators.js#L40-L45 | train |
voodootikigod/node-rolling-spider | lib/swarm.js | function(options) {
this.ble = noble;
var membership = (typeof options === 'string' ? options : undefined);
options = options || {};
this.targets = membership || options.membership;
this.peripherals = [];
this.members = [];
this.timeout = (options.timeout || 30) * 1000; // in seconds
//define member... | javascript | function(options) {
this.ble = noble;
var membership = (typeof options === 'string' ? options : undefined);
options = options || {};
this.targets = membership || options.membership;
this.peripherals = [];
this.members = [];
this.timeout = (options.timeout || 30) * 1000; // in seconds
//define member... | [
"function",
"(",
"options",
")",
"{",
"this",
".",
"ble",
"=",
"noble",
";",
"var",
"membership",
"=",
"(",
"typeof",
"options",
"===",
"'string'",
"?",
"options",
":",
"undefined",
")",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".... | Constructs a new RollingSpider Swarm
@param {Object} options to construct the drone with:
- {String} A comma seperated list (as a string) of UUIDs or names to connect to. This could also be an array of the same items. If this is omitted then it will add any device with the manufacturer data value for Parrot..
- logge... | [
"Constructs",
"a",
"new",
"RollingSpider",
"Swarm"
] | b9ed55d5016aec55671d328b62c980ca0f9e5ef4 | https://github.com/voodootikigod/node-rolling-spider/blob/b9ed55d5016aec55671d328b62c980ca0f9e5ef4/lib/swarm.js#L18-L48 | train | |
voodootikigod/node-rolling-spider | lib/drone.js | function(options) {
EventEmitter.call(this);
var uuid = (typeof options === 'string' ? options : undefined);
options = options || {};
this.uuid = null;
this.targets = uuid || options.uuid;
if (this.targets && !util.isArray(this.targets)) {
this.targets = this.targets.split(',');
}
this.logger = ... | javascript | function(options) {
EventEmitter.call(this);
var uuid = (typeof options === 'string' ? options : undefined);
options = options || {};
this.uuid = null;
this.targets = uuid || options.uuid;
if (this.targets && !util.isArray(this.targets)) {
this.targets = this.targets.split(',');
}
this.logger = ... | [
"function",
"(",
"options",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"var",
"uuid",
"=",
"(",
"typeof",
"options",
"===",
"'string'",
"?",
"options",
":",
"undefined",
")",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"th... | Constructs a new RollingSpider
@param {Object} options to construct the drone with:
- {String} uuid to connect to. If this is omitted then it will connect to the first device starting with 'RS_' as the local name.
- logger function to call if/when errors occur. If omitted then uses console#log
@constructor | [
"Constructs",
"a",
"new",
"RollingSpider"
] | b9ed55d5016aec55671d328b62c980ca0f9e5ef4 | https://github.com/voodootikigod/node-rolling-spider/blob/b9ed55d5016aec55671d328b62c980ca0f9e5ef4/lib/drone.js#L22-L71 | train | |
voodootikigod/node-rolling-spider | lib/drone.js | takeOff | function takeOff(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#takeOff');
if (this.status.battery < 10) {
this.logger('!!! BATTERY LEVEL TOO LOW !!!');
}
if (!this.status.flying) {
this.writeTo(
'fa0b',
n... | javascript | function takeOff(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#takeOff');
if (this.status.battery < 10) {
this.logger('!!! BATTERY LEVEL TOO LOW !!!');
}
if (!this.status.flying) {
this.writeTo(
'fa0b',
n... | [
"function",
"takeOff",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"this",
".",
"logger",
"(",
"'RollingSpider#takeOff'",
"... | Operational Functions Multiple use cases provided to support initial build API as well as NodeCopter API and parity with the ar-drone library.
Instructs the drone to take off if it isn't already in the air | [
"Operational",
"Functions",
"Multiple",
"use",
"cases",
"provided",
"to",
"support",
"initial",
"build",
"API",
"as",
"well",
"as",
"NodeCopter",
"API",
"and",
"parity",
"with",
"the",
"ar",
"-",
"drone",
"library",
".",
"Instructs",
"the",
"drone",
"to",
"t... | b9ed55d5016aec55671d328b62c980ca0f9e5ef4 | https://github.com/voodootikigod/node-rolling-spider/blob/b9ed55d5016aec55671d328b62c980ca0f9e5ef4/lib/drone.js#L507-L533 | train |
voodootikigod/node-rolling-spider | lib/drone.js | wheelOn | function wheelOn(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#wheelOn');
this.writeTo(
'fa0b',
new Buffer([0x02, ++this.steps.fa0b & 0xFF, 0x02, 0x01, 0x02, 0x00, 0x01])
);
if (callback) {
callback();
}
} | javascript | function wheelOn(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#wheelOn');
this.writeTo(
'fa0b',
new Buffer([0x02, ++this.steps.fa0b & 0xFF, 0x02, 0x01, 0x02, 0x00, 0x01])
);
if (callback) {
callback();
}
} | [
"function",
"wheelOn",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"this",
".",
"logger",
"(",
"'RollingSpider#wheelOn'",
"... | Configures the drone to fly in 'wheel on' or protected mode. | [
"Configures",
"the",
"drone",
"to",
"fly",
"in",
"wheel",
"on",
"or",
"protected",
"mode",
"."
] | b9ed55d5016aec55671d328b62c980ca0f9e5ef4 | https://github.com/voodootikigod/node-rolling-spider/blob/b9ed55d5016aec55671d328b62c980ca0f9e5ef4/lib/drone.js#L542-L556 | train |
voodootikigod/node-rolling-spider | lib/drone.js | wheelOff | function wheelOff(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#wheelOff');
this.writeTo(
'fa0b',
new Buffer([0x02, ++this.steps.fa0b & 0xFF, 0x02, 0x01, 0x02, 0x00, 0x00])
);
if (callback) {
callback();
}
} | javascript | function wheelOff(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#wheelOff');
this.writeTo(
'fa0b',
new Buffer([0x02, ++this.steps.fa0b & 0xFF, 0x02, 0x01, 0x02, 0x00, 0x00])
);
if (callback) {
callback();
}
} | [
"function",
"wheelOff",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"this",
".",
"logger",
"(",
"'RollingSpider#wheelOff'",
... | Configures the drone to fly in 'wheel off' or unprotected mode. | [
"Configures",
"the",
"drone",
"to",
"fly",
"in",
"wheel",
"off",
"or",
"unprotected",
"mode",
"."
] | b9ed55d5016aec55671d328b62c980ca0f9e5ef4 | https://github.com/voodootikigod/node-rolling-spider/blob/b9ed55d5016aec55671d328b62c980ca0f9e5ef4/lib/drone.js#L562-L575 | train |
voodootikigod/node-rolling-spider | lib/drone.js | land | function land(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#land');
if (this.status.flying) {
this.writeTo(
'fa0b',
new Buffer([0x02, ++this.steps.fa0b & 0xFF, 0x02, 0x00, 0x03, 0x00])
);
this.on('flyingS... | javascript | function land(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#land');
if (this.status.flying) {
this.writeTo(
'fa0b',
new Buffer([0x02, ++this.steps.fa0b & 0xFF, 0x02, 0x00, 0x03, 0x00])
);
this.on('flyingS... | [
"function",
"land",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"this",
".",
"logger",
"(",
"'RollingSpider#land'",
")",
... | Instructs the drone to land if it's in the air. | [
"Instructs",
"the",
"drone",
"to",
"land",
"if",
"it",
"s",
"in",
"the",
"air",
"."
] | b9ed55d5016aec55671d328b62c980ca0f9e5ef4 | https://github.com/voodootikigod/node-rolling-spider/blob/b9ed55d5016aec55671d328b62c980ca0f9e5ef4/lib/drone.js#L581-L608 | train |
voodootikigod/node-rolling-spider | lib/drone.js | cutOff | function cutOff(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#cutOff');
this.status.flying = false;
this.writeTo(
'fa0c',
new Buffer([0x02, ++this.steps.fa0c & 0xFF, 0x02, 0x00, 0x04, 0x00])
, callback);
} | javascript | function cutOff(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#cutOff');
this.status.flying = false;
this.writeTo(
'fa0c',
new Buffer([0x02, ++this.steps.fa0c & 0xFF, 0x02, 0x00, 0x04, 0x00])
, callback);
} | [
"function",
"cutOff",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"this",
".",
"logger",
"(",
"'RollingSpider#cutOff'",
")"... | Instructs the drone to do an emergency landing. | [
"Instructs",
"the",
"drone",
"to",
"do",
"an",
"emergency",
"landing",
"."
] | b9ed55d5016aec55671d328b62c980ca0f9e5ef4 | https://github.com/voodootikigod/node-rolling-spider/blob/b9ed55d5016aec55671d328b62c980ca0f9e5ef4/lib/drone.js#L627-L638 | train |
voodootikigod/node-rolling-spider | lib/drone.js | flatTrim | function flatTrim(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#flatTrim');
this.writeTo(
'fa0b',
new Buffer([0x02, ++this.steps.fa0b & 0xFF, 0x02, 0x00, 0x00, 0x00]),
callback
);
} | javascript | function flatTrim(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#flatTrim');
this.writeTo(
'fa0b',
new Buffer([0x02, ++this.steps.fa0b & 0xFF, 0x02, 0x00, 0x00, 0x00]),
callback
);
} | [
"function",
"flatTrim",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"this",
".",
"logger",
"(",
"'RollingSpider#flatTrim'",
... | Instructs the drone to trim. Make sure to call this before taking off. | [
"Instructs",
"the",
"drone",
"to",
"trim",
".",
"Make",
"sure",
"to",
"call",
"this",
"before",
"taking",
"off",
"."
] | b9ed55d5016aec55671d328b62c980ca0f9e5ef4 | https://github.com/voodootikigod/node-rolling-spider/blob/b9ed55d5016aec55671d328b62c980ca0f9e5ef4/lib/drone.js#L643-L654 | train |
voodootikigod/node-rolling-spider | lib/drone.js | frontFlip | function frontFlip(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#frontFlip');
if (this.status.flying) {
this.writeTo(
'fa0b',
new Buffer([0x02, ++this.steps.fa0b & 0xFF, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0... | javascript | function frontFlip(options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
this.logger('RollingSpider#frontFlip');
if (this.status.flying) {
this.writeTo(
'fa0b',
new Buffer([0x02, ++this.steps.fa0b & 0xFF, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0... | [
"function",
"frontFlip",
"(",
"options",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"callback",
"=",
"options",
";",
"options",
"=",
"{",
"}",
";",
"}",
"this",
".",
"logger",
"(",
"'RollingSpider#frontFlip'",... | Instructs the drone to do a front flip.
It will only do this if it's in the air | [
"Instructs",
"the",
"drone",
"to",
"do",
"a",
"front",
"flip",
"."
] | b9ed55d5016aec55671d328b62c980ca0f9e5ef4 | https://github.com/voodootikigod/node-rolling-spider/blob/b9ed55d5016aec55671d328b62c980ca0f9e5ef4/lib/drone.js#L665-L686 | train |
SAP/cf-nodejs-logging-support | sample/cf-nodejs-shoutboard/web-express.js | mergeMessages | function mergeMessages(data) {
lastSync = (new Date()).getTime();
if (messages.length == 0) {
messages = data;
} else {
var i = data.length - 1;
var j = messages.length - 1;
while (i >= 0 && j >= 0) {
if (data[i].timestamp < messages[j].timestamp) {
... | javascript | function mergeMessages(data) {
lastSync = (new Date()).getTime();
if (messages.length == 0) {
messages = data;
} else {
var i = data.length - 1;
var j = messages.length - 1;
while (i >= 0 && j >= 0) {
if (data[i].timestamp < messages[j].timestamp) {
... | [
"function",
"mergeMessages",
"(",
"data",
")",
"{",
"lastSync",
"=",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
";",
"if",
"(",
"messages",
".",
"length",
"==",
"0",
")",
"{",
"messages",
"=",
"data",
";",
"}",
"else",
"{",
"var... | merge messages from different servers after redis restart | [
"merge",
"messages",
"from",
"different",
"servers",
"after",
"redis",
"restart"
] | 129459d40e3f1c70bdb929118ce7ffd6ab7578c4 | https://github.com/SAP/cf-nodejs-logging-support/blob/129459d40e3f1c70bdb929118ce7ffd6ab7578c4/sample/cf-nodejs-shoutboard/web-express.js#L83-L98 | train |
SAP/cf-nodejs-logging-support | sample/cf-nodejs-shoutboard/web-express.js | sendCumulativeMessages | function sendCumulativeMessages(timestamp, clientSync, res) {
if (timestamp == null) timestamp = 0;
if (clientSync == null) clientSync = 0;
var data = getCumulativeMessages(timestamp, clientSync);
res.send(data);
} | javascript | function sendCumulativeMessages(timestamp, clientSync, res) {
if (timestamp == null) timestamp = 0;
if (clientSync == null) clientSync = 0;
var data = getCumulativeMessages(timestamp, clientSync);
res.send(data);
} | [
"function",
"sendCumulativeMessages",
"(",
"timestamp",
",",
"clientSync",
",",
"res",
")",
"{",
"if",
"(",
"timestamp",
"==",
"null",
")",
"timestamp",
"=",
"0",
";",
"if",
"(",
"clientSync",
"==",
"null",
")",
"clientSync",
"=",
"0",
";",
"var",
"data"... | send all messages to client it is missing, or resends some messages after redis restart | [
"send",
"all",
"messages",
"to",
"client",
"it",
"is",
"missing",
"or",
"resends",
"some",
"messages",
"after",
"redis",
"restart"
] | 129459d40e3f1c70bdb929118ce7ffd6ab7578c4 | https://github.com/SAP/cf-nodejs-logging-support/blob/129459d40e3f1c70bdb929118ce7ffd6ab7578c4/sample/cf-nodejs-shoutboard/web-express.js#L109-L115 | train |
SAP/cf-nodejs-logging-support | sample/cf-nodejs-shoutboard/web-express.js | getCumulativeMessages | function getCumulativeMessages(timestamp, clientSync) {
var msgs = [];
if (lastSync > clientSync) {
msgs = messages;
} else {
var newMsgs = messages.length;
while (newMsgs > 0 && messages[newMsgs - 1].timestamp > timestamp) {
newMsgs--;
}
for (var i = newM... | javascript | function getCumulativeMessages(timestamp, clientSync) {
var msgs = [];
if (lastSync > clientSync) {
msgs = messages;
} else {
var newMsgs = messages.length;
while (newMsgs > 0 && messages[newMsgs - 1].timestamp > timestamp) {
newMsgs--;
}
for (var i = newM... | [
"function",
"getCumulativeMessages",
"(",
"timestamp",
",",
"clientSync",
")",
"{",
"var",
"msgs",
"=",
"[",
"]",
";",
"if",
"(",
"lastSync",
">",
"clientSync",
")",
"{",
"msgs",
"=",
"messages",
";",
"}",
"else",
"{",
"var",
"newMsgs",
"=",
"messages",
... | get the requested messages from message storage system | [
"get",
"the",
"requested",
"messages",
"from",
"message",
"storage",
"system"
] | 129459d40e3f1c70bdb929118ce7ffd6ab7578c4 | https://github.com/SAP/cf-nodejs-logging-support/blob/129459d40e3f1c70bdb929118ce7ffd6ab7578c4/sample/cf-nodejs-shoutboard/web-express.js#L118-L137 | train |
SAP/cf-nodejs-logging-support | sample/cf-nodejs-shoutboard/web-express.js | synchronize | function synchronize() {
if (syncPointer != -1) {
log.logMessage("verbose", "redis synchronization!");
var syncMessage = {};
syncMessage.data = messages.splice(syncPointer, messages.length - syncPointer);
setTimeout(function () {
pub.publish("message", JSON.stringify(sync... | javascript | function synchronize() {
if (syncPointer != -1) {
log.logMessage("verbose", "redis synchronization!");
var syncMessage = {};
syncMessage.data = messages.splice(syncPointer, messages.length - syncPointer);
setTimeout(function () {
pub.publish("message", JSON.stringify(sync... | [
"function",
"synchronize",
"(",
")",
"{",
"if",
"(",
"syncPointer",
"!=",
"-",
"1",
")",
"{",
"log",
".",
"logMessage",
"(",
"\"verbose\"",
",",
"\"redis synchronization!\"",
")",
";",
"var",
"syncMessage",
"=",
"{",
"}",
";",
"syncMessage",
".",
"data",
... | synchronizes messages after redis reconnect between server Instances | [
"synchronizes",
"messages",
"after",
"redis",
"reconnect",
"between",
"server",
"Instances"
] | 129459d40e3f1c70bdb929118ce7ffd6ab7578c4 | https://github.com/SAP/cf-nodejs-logging-support/blob/129459d40e3f1c70bdb929118ce7ffd6ab7578c4/sample/cf-nodejs-shoutboard/web-express.js#L166-L176 | train |
stacktracejs/stacktrace-gps | stacktrace-gps.js | _xdr | function _xdr(url) {
return new Promise(function(resolve, reject) {
var req = new XMLHttpRequest();
req.open('get', url);
req.onerror = reject;
req.onreadystatechange = function onreadystatechange() {
if (req.readyState === 4) {
... | javascript | function _xdr(url) {
return new Promise(function(resolve, reject) {
var req = new XMLHttpRequest();
req.open('get', url);
req.onerror = reject;
req.onreadystatechange = function onreadystatechange() {
if (req.readyState === 4) {
... | [
"function",
"_xdr",
"(",
"url",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"var",
"req",
"=",
"new",
"XMLHttpRequest",
"(",
")",
";",
"req",
".",
"open",
"(",
"'get'",
",",
"url",
")",
";",
"req"... | Make a X-Domain request to url and callback.
@param {String} url
@returns {Promise} with response text if fulfilled | [
"Make",
"a",
"X",
"-",
"Domain",
"request",
"to",
"url",
"and",
"callback",
"."
] | 1b80f11a6716dbd189dd08c89049b1efe6f45b65 | https://github.com/stacktracejs/stacktrace-gps/blob/1b80f11a6716dbd189dd08c89049b1efe6f45b65/stacktrace-gps.js#L22-L40 | train |
nunofgs/clean-deep | dist/index.js | cleanDeep | function cleanDeep(object) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$emptyArrays = _ref.emptyArrays,
emptyArrays = _ref$emptyArrays === undefined ? true : _ref$emptyArrays,
_ref$emptyObjects = _ref.emptyObjects,
emptyObjects = _ref$emptyObjects =... | javascript | function cleanDeep(object) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$emptyArrays = _ref.emptyArrays,
emptyArrays = _ref$emptyArrays === undefined ? true : _ref$emptyArrays,
_ref$emptyObjects = _ref.emptyObjects,
emptyObjects = _ref$emptyObjects =... | [
"function",
"cleanDeep",
"(",
"object",
")",
"{",
"var",
"_ref",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"{",
"}",
",",
"_ref$emptyArrays",
"=",
"_ref",
".... | Export `cleanDeep` function. | [
"Export",
"cleanDeep",
"function",
"."
] | 8cb741ff30613440ea24533308cbb29164272545 | https://github.com/nunofgs/clean-deep/blob/8cb741ff30613440ea24533308cbb29164272545/dist/index.js#L26-L77 | train |
ricmoo/scrypt-js | scrypt.js | incrementCounter | function incrementCounter() {
for (var i = innerLen-1; i >= innerLen-4; i--) {
inner[i]++;
if (inner[i] <= 0xff) return;
inner[i] = 0;
}
} | javascript | function incrementCounter() {
for (var i = innerLen-1; i >= innerLen-4; i--) {
inner[i]++;
if (inner[i] <= 0xff) return;
inner[i] = 0;
}
} | [
"function",
"incrementCounter",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"innerLen",
"-",
"1",
";",
"i",
">=",
"innerLen",
"-",
"4",
";",
"i",
"--",
")",
"{",
"inner",
"[",
"i",
"]",
"++",
";",
"if",
"(",
"inner",
"[",
"i",
"]",
"<=",
"0xf... | increments counter inside inner | [
"increments",
"counter",
"inside",
"inner"
] | 0eb70873ddf3d24e34b53e0d9a99a0cef06a79c0 | https://github.com/ricmoo/scrypt-js/blob/0eb70873ddf3d24e34b53e0d9a99a0cef06a79c0/scrypt.js#L136-L142 | train |
ricmoo/scrypt-js | scrypt.js | blockxor | function blockxor(S, Si, D, len) {
for (var i = 0; i < len; i++) {
D[i] ^= S[Si + i]
}
} | javascript | function blockxor(S, Si, D, len) {
for (var i = 0; i < len; i++) {
D[i] ^= S[Si + i]
}
} | [
"function",
"blockxor",
"(",
"S",
",",
"Si",
",",
"D",
",",
"len",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"D",
"[",
"i",
"]",
"^=",
"S",
"[",
"Si",
"+",
"i",
"]",
"}",
"}"
] | naive approach... going back to loop unrolling may yield additional performance | [
"naive",
"approach",
"...",
"going",
"back",
"to",
"loop",
"unrolling",
"may",
"yield",
"additional",
"performance"
] | 0eb70873ddf3d24e34b53e0d9a99a0cef06a79c0 | https://github.com/ricmoo/scrypt-js/blob/0eb70873ddf3d24e34b53e0d9a99a0cef06a79c0/scrypt.js#L227-L231 | train |
ricmoo/scrypt-js | scrypt.js | function() {
if (stop) {
return callback(new Error('cancelled'), currentOp / totalOps);
}
switch (state) {
case 0:
// for (var i = 0; i < p; i++)...
Bi = i0 * 32 * r;
arraycopy(B, Bi, XY, 0,... | javascript | function() {
if (stop) {
return callback(new Error('cancelled'), currentOp / totalOps);
}
switch (state) {
case 0:
// for (var i = 0; i < p; i++)...
Bi = i0 * 32 * r;
arraycopy(B, Bi, XY, 0,... | [
"function",
"(",
")",
"{",
"if",
"(",
"stop",
")",
"{",
"return",
"callback",
"(",
"new",
"Error",
"(",
"'cancelled'",
")",
",",
"currentOp",
"/",
"totalOps",
")",
";",
"}",
"switch",
"(",
"state",
")",
"{",
"case",
"0",
":",
"// for (var i = 0; i < p;... | This is really all I changed; making scryptsy a state machine so we occasionally stop and give other evnts on the evnt loop a chance to run. ~RicMoo | [
"This",
"is",
"really",
"all",
"I",
"changed",
";",
"making",
"scryptsy",
"a",
"state",
"machine",
"so",
"we",
"occasionally",
"stop",
"and",
"give",
"other",
"evnts",
"on",
"the",
"evnt",
"loop",
"a",
"chance",
"to",
"run",
".",
"~RicMoo"
] | 0eb70873ddf3d24e34b53e0d9a99a0cef06a79c0 | https://github.com/ricmoo/scrypt-js/blob/0eb70873ddf3d24e34b53e0d9a99a0cef06a79c0/scrypt.js#L326-L427 | train | |
jshttp/compressible | index.js | compressible | function compressible (type) {
if (!type || typeof type !== 'string') {
return false
}
// strip parameters
var match = EXTRACT_TYPE_REGEXP.exec(type)
var mime = match && match[1].toLowerCase()
var data = db[mime]
// return database information
if (data && data.compressible !== undefined) {
ret... | javascript | function compressible (type) {
if (!type || typeof type !== 'string') {
return false
}
// strip parameters
var match = EXTRACT_TYPE_REGEXP.exec(type)
var mime = match && match[1].toLowerCase()
var data = db[mime]
// return database information
if (data && data.compressible !== undefined) {
ret... | [
"function",
"compressible",
"(",
"type",
")",
"{",
"if",
"(",
"!",
"type",
"||",
"typeof",
"type",
"!==",
"'string'",
")",
"{",
"return",
"false",
"}",
"// strip parameters",
"var",
"match",
"=",
"EXTRACT_TYPE_REGEXP",
".",
"exec",
"(",
"type",
")",
"var",... | Checks if a type is compressible.
@param {string} type
@return {Boolean} compressible
@public | [
"Checks",
"if",
"a",
"type",
"is",
"compressible",
"."
] | 57985690741c2670fb5c171bdefb07114ce1a63f | https://github.com/jshttp/compressible/blob/57985690741c2670fb5c171bdefb07114ce1a63f/index.js#L41-L58 | train |
livechat/sample-apps | lc3-bot-example/public/client.js | function(dream) {
const newListItem = document.createElement('li');
newListItem.innerHTML = dream;
dreamsList.appendChild(newListItem);
} | javascript | function(dream) {
const newListItem = document.createElement('li');
newListItem.innerHTML = dream;
dreamsList.appendChild(newListItem);
} | [
"function",
"(",
"dream",
")",
"{",
"const",
"newListItem",
"=",
"document",
".",
"createElement",
"(",
"'li'",
")",
";",
"newListItem",
".",
"innerHTML",
"=",
"dream",
";",
"dreamsList",
".",
"appendChild",
"(",
"newListItem",
")",
";",
"}"
] | a helper function that creates a list item for a given dream | [
"a",
"helper",
"function",
"that",
"creates",
"a",
"list",
"item",
"for",
"a",
"given",
"dream"
] | 69c8fbeecb7df6b287ec300da2b950b486c2baf5 | https://github.com/livechat/sample-apps/blob/69c8fbeecb7df6b287ec300da2b950b486c2baf5/lc3-bot-example/public/client.js#L19-L23 | train | |
muaz-khan/FileBufferReader | demo/PeerUI.js | onDragOver | function onDragOver() {
mainContainer.style.border = '7px solid #98a90f';
mainContainer.style.background = '#ffff13';
mainContainer.style.borderRadisu = '16px';
} | javascript | function onDragOver() {
mainContainer.style.border = '7px solid #98a90f';
mainContainer.style.background = '#ffff13';
mainContainer.style.borderRadisu = '16px';
} | [
"function",
"onDragOver",
"(",
")",
"{",
"mainContainer",
".",
"style",
".",
"border",
"=",
"'7px solid #98a90f'",
";",
"mainContainer",
".",
"style",
".",
"background",
"=",
"'#ffff13'",
";",
"mainContainer",
".",
"style",
".",
"borderRadisu",
"=",
"'16px'",
... | drag-drop support | [
"drag",
"-",
"drop",
"support"
] | 866987df9a6c5c6924314a01d1aa53f0efc4e9c4 | https://github.com/muaz-khan/FileBufferReader/blob/866987df9a6c5c6924314a01d1aa53f0efc4e9c4/demo/PeerUI.js#L584-L588 | train |
jonathanong/ee-first | index.js | first | function first (stuff, done) {
if (!Array.isArray(stuff)) {
throw new TypeError('arg must be an array of [ee, events...] arrays')
}
var cleanups = []
for (var i = 0; i < stuff.length; i++) {
var arr = stuff[i]
if (!Array.isArray(arr) || arr.length < 2) {
throw new TypeError('each array memb... | javascript | function first (stuff, done) {
if (!Array.isArray(stuff)) {
throw new TypeError('arg must be an array of [ee, events...] arrays')
}
var cleanups = []
for (var i = 0; i < stuff.length; i++) {
var arr = stuff[i]
if (!Array.isArray(arr) || arr.length < 2) {
throw new TypeError('each array memb... | [
"function",
"first",
"(",
"stuff",
",",
"done",
")",
"{",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
"stuff",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'arg must be an array of [ee, events...] arrays'",
")",
"}",
"var",
"cleanups",
"=",
"[",
"]"... | Get the first event in a set of event emitters and event pairs.
@param {array} stuff
@param {function} done
@public | [
"Get",
"the",
"first",
"event",
"in",
"a",
"set",
"of",
"event",
"emitters",
"and",
"event",
"pairs",
"."
] | 661cfe51c4ad65b968ca909b70772a007a098764 | https://github.com/jonathanong/ee-first/blob/661cfe51c4ad65b968ca909b70772a007a098764/index.js#L24-L75 | train |
jonathanong/ee-first | index.js | listener | function listener (event, done) {
return function onevent (arg1) {
var args = new Array(arguments.length)
var ee = this
var err = event === 'error'
? arg1
: null
// copy args to prevent arguments escaping scope
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i]
}... | javascript | function listener (event, done) {
return function onevent (arg1) {
var args = new Array(arguments.length)
var ee = this
var err = event === 'error'
? arg1
: null
// copy args to prevent arguments escaping scope
for (var i = 0; i < args.length; i++) {
args[i] = arguments[i]
}... | [
"function",
"listener",
"(",
"event",
",",
"done",
")",
"{",
"return",
"function",
"onevent",
"(",
"arg1",
")",
"{",
"var",
"args",
"=",
"new",
"Array",
"(",
"arguments",
".",
"length",
")",
"var",
"ee",
"=",
"this",
"var",
"err",
"=",
"event",
"==="... | Create the event listener.
@private | [
"Create",
"the",
"event",
"listener",
"."
] | 661cfe51c4ad65b968ca909b70772a007a098764 | https://github.com/jonathanong/ee-first/blob/661cfe51c4ad65b968ca909b70772a007a098764/index.js#L82-L97 | train |
emailjs/emailjs-mime-builder | dist/utils.js | encodeAddressName | function encodeAddressName(name) {
if (!/^[\w ']*$/.test(name)) {
if (/^[\x20-\x7e]*$/.test(name)) {
return '"' + name.replace(/([\\"])/g, '\\$1') + '"';
} else {
return (0, _emailjsMimeCodec.mimeWordEncode)(name, 'Q');
}
}
return name;
} | javascript | function encodeAddressName(name) {
if (!/^[\w ']*$/.test(name)) {
if (/^[\x20-\x7e]*$/.test(name)) {
return '"' + name.replace(/([\\"])/g, '\\$1') + '"';
} else {
return (0, _emailjsMimeCodec.mimeWordEncode)(name, 'Q');
}
}
return name;
} | [
"function",
"encodeAddressName",
"(",
"name",
")",
"{",
"if",
"(",
"!",
"/",
"^[\\w ']*$",
"/",
".",
"test",
"(",
"name",
")",
")",
"{",
"if",
"(",
"/",
"^[\\x20-\\x7e]*$",
"/",
".",
"test",
"(",
"name",
")",
")",
"{",
"return",
"'\"'",
"+",
"name"... | If needed, mime encodes the name part
@param {String} name Name part of an address
@returns {String} Mime word encoded string if needed
/* eslint-disable node/no-deprecated-api /* eslint-disable no-control-regex | [
"If",
"needed",
"mime",
"encodes",
"the",
"name",
"part"
] | 7090355f1c82c32570640a322d02bacce2a94a2c | https://github.com/emailjs/emailjs-mime-builder/blob/7090355f1c82c32570640a322d02bacce2a94a2c/dist/utils.js#L36-L45 | train |
emailjs/emailjs-mime-builder | dist/utils.js | convertAddresses | function convertAddresses() {
var addresses = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var uniqueList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var values = [];[].concat(addresses).forEach(function (address) {
if (address.address) {
address... | javascript | function convertAddresses() {
var addresses = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var uniqueList = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
var values = [];[].concat(addresses).forEach(function (address) {
if (address.address) {
address... | [
"function",
"convertAddresses",
"(",
")",
"{",
"var",
"addresses",
"=",
"arguments",
".",
"length",
">",
"0",
"&&",
"arguments",
"[",
"0",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"0",
"]",
":",
"[",
"]",
";",
"var",
"uniqueList",
"=",
"argument... | Rebuilds address object using punycode and other adjustments
@param {Array} addresses An array of address objects
@param {Array} [uniqueList] An array to be populated with addresses
@return {String} address string | [
"Rebuilds",
"address",
"object",
"using",
"punycode",
"and",
"other",
"adjustments"
] | 7090355f1c82c32570640a322d02bacce2a94a2c | https://github.com/emailjs/emailjs-mime-builder/blob/7090355f1c82c32570640a322d02bacce2a94a2c/dist/utils.js#L64-L91 | train |
emailjs/emailjs-mime-builder | dist/utils.js | encodeHeaderValue | function encodeHeaderValue(key) {
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
key = normalizeHeaderKey(key);
switch (key) {
case 'From':
case 'Sender':
case 'To':
case 'Cc':
case 'Bcc':
case 'Reply-To':
return convertAddresses(parseAddresses(... | javascript | function encodeHeaderValue(key) {
var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
key = normalizeHeaderKey(key);
switch (key) {
case 'From':
case 'Sender':
case 'To':
case 'Cc':
case 'Bcc':
case 'Reply-To':
return convertAddresses(parseAddresses(... | [
"function",
"encodeHeaderValue",
"(",
"key",
")",
"{",
"var",
"value",
"=",
"arguments",
".",
"length",
">",
"1",
"&&",
"arguments",
"[",
"1",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"1",
"]",
":",
"''",
";",
"key",
"=",
"normalizeHeaderKey",
"... | Encodes a header value for use in the generated rfc2822 email.
@param {String} key Header key
@param {String} value Header value | [
"Encodes",
"a",
"header",
"value",
"for",
"use",
"in",
"the",
"generated",
"rfc2822",
"email",
"."
] | 7090355f1c82c32570640a322d02bacce2a94a2c | https://github.com/emailjs/emailjs-mime-builder/blob/7090355f1c82c32570640a322d02bacce2a94a2c/dist/utils.js#L117-L166 | train |
emailjs/emailjs-mime-builder | dist/utils.js | normalizeHeaderKey | function normalizeHeaderKey() {
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return key.replace(/\r?\n|\r/g, ' ') // no newlines in keys
.trim().toLowerCase().replace(/^MIME\b|^[a-z]|-[a-z]/ig, function (c) {
return c.toUpperCase();
}); // use uppercase words, except MI... | javascript | function normalizeHeaderKey() {
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return key.replace(/\r?\n|\r/g, ' ') // no newlines in keys
.trim().toLowerCase().replace(/^MIME\b|^[a-z]|-[a-z]/ig, function (c) {
return c.toUpperCase();
}); // use uppercase words, except MI... | [
"function",
"normalizeHeaderKey",
"(",
")",
"{",
"var",
"key",
"=",
"arguments",
".",
"length",
">",
"0",
"&&",
"arguments",
"[",
"0",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"0",
"]",
":",
"''",
";",
"return",
"key",
".",
"replace",
"(",
"/"... | Normalizes a header key, uses Camel-Case form, except for uppercase MIME-
@param {String} key Key to be normalized
@return {String} key in Camel-Case form | [
"Normalizes",
"a",
"header",
"key",
"uses",
"Camel",
"-",
"Case",
"form",
"except",
"for",
"uppercase",
"MIME",
"-"
] | 7090355f1c82c32570640a322d02bacce2a94a2c | https://github.com/emailjs/emailjs-mime-builder/blob/7090355f1c82c32570640a322d02bacce2a94a2c/dist/utils.js#L174-L181 | train |
emailjs/emailjs-mime-builder | dist/utils.js | buildHeaderValue | function buildHeaderValue(structured) {
var paramsArray = [];
Object.keys(structured.params || {}).forEach(function (param) {
// filename might include unicode characters so it is a special case
if (param === 'filename') {
(0, _emailjsMimeCodec.continuationEncode)(param, structured.params[param], 50)... | javascript | function buildHeaderValue(structured) {
var paramsArray = [];
Object.keys(structured.params || {}).forEach(function (param) {
// filename might include unicode characters so it is a special case
if (param === 'filename') {
(0, _emailjsMimeCodec.continuationEncode)(param, structured.params[param], 50)... | [
"function",
"buildHeaderValue",
"(",
"structured",
")",
"{",
"var",
"paramsArray",
"=",
"[",
"]",
";",
"Object",
".",
"keys",
"(",
"structured",
".",
"params",
"||",
"{",
"}",
")",
".",
"forEach",
"(",
"function",
"(",
"param",
")",
"{",
"// filename mig... | Joins parsed header value together as 'value; param1=value1; param2=value2'
@param {Object} structured Parsed header value
@return {String} joined header value | [
"Joins",
"parsed",
"header",
"value",
"together",
"as",
"value",
";",
"param1",
"=",
"value1",
";",
"param2",
"=",
"value2"
] | 7090355f1c82c32570640a322d02bacce2a94a2c | https://github.com/emailjs/emailjs-mime-builder/blob/7090355f1c82c32570640a322d02bacce2a94a2c/dist/utils.js#L213-L230 | train |
webduinoio/webduino-js | src/transport/NodeMqttTransport.js | NodeMqttTransport | function NodeMqttTransport(options) {
Transport.call(this, options);
this._options = options;
this._client = null;
this._sendTimer = null;
this._buf = [];
this._status = '';
this._connHandler = onConnect.bind(this);
this._messageHandler = onMessage.bind(this);
this._sendOutHandler = sendOut.bind(th... | javascript | function NodeMqttTransport(options) {
Transport.call(this, options);
this._options = options;
this._client = null;
this._sendTimer = null;
this._buf = [];
this._status = '';
this._connHandler = onConnect.bind(this);
this._messageHandler = onMessage.bind(this);
this._sendOutHandler = sendOut.bind(th... | [
"function",
"NodeMqttTransport",
"(",
"options",
")",
"{",
"Transport",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"_options",
"=",
"options",
";",
"this",
".",
"_client",
"=",
"null",
";",
"this",
".",
"_sendTimer",
"=",
"null",
... | Conveying messages over MQTT protocol, in Node.JS.
@namespace webduino.transport
@class NodeMqttTransport
@constructor
@param {Object} options Options to build a proper transport
@extends webduino.Transport | [
"Conveying",
"messages",
"over",
"MQTT",
"protocol",
"in",
"Node",
".",
"JS",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/src/transport/NodeMqttTransport.js#L39-L56 | train |
webduinoio/webduino-js | dist/webduino-all.js | function(error, substitutions) {
var text = error.text;
if (substitutions) {
var field,start;
for (var i=0; i<substitutions.length; i++) {
field = "{"+i+"}";
start = text.indexOf(field);
if(start > 0) {
var part1 = text.substring(0,start);
var part2 = text.substring(start+field.length);
... | javascript | function(error, substitutions) {
var text = error.text;
if (substitutions) {
var field,start;
for (var i=0; i<substitutions.length; i++) {
field = "{"+i+"}";
start = text.indexOf(field);
if(start > 0) {
var part1 = text.substring(0,start);
var part2 = text.substring(start+field.length);
... | [
"function",
"(",
"error",
",",
"substitutions",
")",
"{",
"var",
"text",
"=",
"error",
".",
"text",
";",
"if",
"(",
"substitutions",
")",
"{",
"var",
"field",
",",
"start",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"substitutions",
".",... | Format an error message text.
@private
@param {error} ERROR.KEY value above.
@param {substitutions} [array] substituted into the text.
@return the text with the substitutions made. | [
"Format",
"an",
"error",
"message",
"text",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L392-L407 | train | |
webduinoio/webduino-js | dist/webduino-all.js | UTF8Length | function UTF8Length(input) {
var output = 0;
for (var i = 0; i<input.length; i++)
{
var charCode = input.charCodeAt(i);
if (charCode > 0x7FF)
{
// Surrogate pair means its a 4 byte character
if (0xD800 <= charCode && charCode <= 0xDBFF)
{
i++;
output++;
}
... | javascript | function UTF8Length(input) {
var output = 0;
for (var i = 0; i<input.length; i++)
{
var charCode = input.charCodeAt(i);
if (charCode > 0x7FF)
{
// Surrogate pair means its a 4 byte character
if (0xD800 <= charCode && charCode <= 0xDBFF)
{
i++;
output++;
}
... | [
"function",
"UTF8Length",
"(",
"input",
")",
"{",
"var",
"output",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"input",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"charCode",
"=",
"input",
".",
"charCodeAt",
"(",
"i",
"... | Takes a String and calculates its length in bytes when encoded in UTF8.
@private | [
"Takes",
"a",
"String",
"and",
"calculates",
"its",
"length",
"in",
"bytes",
"when",
"encoded",
"in",
"UTF8",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L752-L773 | train |
webduinoio/webduino-js | dist/webduino-all.js | callback | function callback(ctx, err, result) {
if (typeof ctx.custom === 'function') {
var cust = function () {
// Bind the callback to itself, so the resolve and reject
// properties that we bound are available to the callback.
// Then we push it onto the end of the arguments array.
re... | javascript | function callback(ctx, err, result) {
if (typeof ctx.custom === 'function') {
var cust = function () {
// Bind the callback to itself, so the resolve and reject
// properties that we bound are available to the callback.
// Then we push it onto the end of the arguments array.
re... | [
"function",
"callback",
"(",
"ctx",
",",
"err",
",",
"result",
")",
"{",
"if",
"(",
"typeof",
"ctx",
".",
"custom",
"===",
"'function'",
")",
"{",
"var",
"cust",
"=",
"function",
"(",
")",
"{",
"// Bind the callback to itself, so the resolve and reject",
"// p... | Default callback function - rejects on truthy error, otherwise resolves | [
"Default",
"callback",
"function",
"-",
"rejects",
"on",
"truthy",
"error",
"otherwise",
"resolves"
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L3098-L3115 | train |
webduinoio/webduino-js | dist/webduino-all.js | MqttTransport | function MqttTransport(options) {
Transport.call(this, options);
this._options = options;
this._client = null;
this._timer = null;
this._sendTimer = null;
this._buf = [];
this._status = '';
this._connHandler = onConnect.bind(this);
this._connFailedHandler = onConnectFailed.bind(th... | javascript | function MqttTransport(options) {
Transport.call(this, options);
this._options = options;
this._client = null;
this._timer = null;
this._sendTimer = null;
this._buf = [];
this._status = '';
this._connHandler = onConnect.bind(this);
this._connFailedHandler = onConnectFailed.bind(th... | [
"function",
"MqttTransport",
"(",
"options",
")",
"{",
"Transport",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"_options",
"=",
"options",
";",
"this",
".",
"_client",
"=",
"null",
";",
"this",
".",
"_timer",
"=",
"null",
";",
"... | Conveying messages over MQTT protocol.
@namespace webduino.transport
@class MqttTransport
@constructor
@param {Object} options Options to build a proper transport
@extends webduino.Transport | [
"Conveying",
"messages",
"over",
"MQTT",
"protocol",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L3289-L3307 | train |
webduinoio/webduino-js | dist/webduino-all.js | Board | function Board(options) {
EventEmitter.call(this);
this._options = options;
this._buf = [];
this._digitalPort = [];
this._numPorts = 0;
this._analogPinMapping = [];
this._digitalPinMapping = [];
this._i2cPins = [];
this._ioPins = [];
this._totalPins = 0;
this._totalAnalogPin... | javascript | function Board(options) {
EventEmitter.call(this);
this._options = options;
this._buf = [];
this._digitalPort = [];
this._numPorts = 0;
this._analogPinMapping = [];
this._digitalPinMapping = [];
this._i2cPins = [];
this._ioPins = [];
this._totalPins = 0;
this._totalAnalogPin... | [
"function",
"Board",
"(",
"options",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_options",
"=",
"options",
";",
"this",
".",
"_buf",
"=",
"[",
"]",
";",
"this",
".",
"_digitalPort",
"=",
"[",
"]",
";",
"this",
".",
... | SYSEX_NON_REALTIME = 0x7E, SYSEX_REALTIME = 0x7F;
An abstract development board.
@namespace webduino
@class Board
@constructor
@param {Object} options Options to build the board instance.
@extends webduino.EventEmitter | [
"SYSEX_NON_REALTIME",
"=",
"0x7E",
"SYSEX_REALTIME",
"=",
"0x7F",
";",
"An",
"abstract",
"development",
"board",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L4098-L4132 | train |
webduinoio/webduino-js | dist/webduino-all.js | Led | function Led(board, pin, driveMode) {
Module.call(this);
this._board = board;
this._pin = pin;
this._driveMode = driveMode || Led.SOURCE_DRIVE;
this._supportsPWM = undefined;
this._blinkTimer = null;
this._board.on(BoardEvent.BEFOREDISCONNECT, this._clearBlinkTimer.bind(this));
this._b... | javascript | function Led(board, pin, driveMode) {
Module.call(this);
this._board = board;
this._pin = pin;
this._driveMode = driveMode || Led.SOURCE_DRIVE;
this._supportsPWM = undefined;
this._blinkTimer = null;
this._board.on(BoardEvent.BEFOREDISCONNECT, this._clearBlinkTimer.bind(this));
this._b... | [
"function",
"Led",
"(",
"board",
",",
"pin",
",",
"driveMode",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_board",
"=",
"board",
";",
"this",
".",
"_pin",
"=",
"pin",
";",
"this",
".",
"_driveMode",
"=",
"driveMode",
"||"... | The Led class.
@namespace webduino.module
@class Led
@constructor
@param {webduino.Board} board The board the LED is attached to.
@param {webduino.Pin} pin The pin the LED is connected to.
@param {Number} [driveMode] Drive mode the LED is operating at, either Led.SOURCE_DRIVE or Led.SYNC_DRIVE.
@extends webduino.Modul... | [
"The",
"Led",
"class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L6180-L6209 | train |
webduinoio/webduino-js | dist/webduino-all.js | RGBLed | function RGBLed(board, redLedPin, greenLedPin, blueLedPin, driveMode) {
Module.call(this);
if (driveMode === undefined) {
driveMode = RGBLed.COMMON_ANODE;
}
this._board = board;
this._redLed = new Led(board, redLedPin, driveMode);
this._greenLed = new Led(board, greenLedPin, driveMode);
... | javascript | function RGBLed(board, redLedPin, greenLedPin, blueLedPin, driveMode) {
Module.call(this);
if (driveMode === undefined) {
driveMode = RGBLed.COMMON_ANODE;
}
this._board = board;
this._redLed = new Led(board, redLedPin, driveMode);
this._greenLed = new Led(board, greenLedPin, driveMode);
... | [
"function",
"RGBLed",
"(",
"board",
",",
"redLedPin",
",",
"greenLedPin",
",",
"blueLedPin",
",",
"driveMode",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"if",
"(",
"driveMode",
"===",
"undefined",
")",
"{",
"driveMode",
"=",
"RGBLed",
".",
... | The RGBLed Class.
@namespace webduino.module
@class RGBLed
@constructor
@param {webduino.Board} board The board the RGB LED is attached to.
@param {webduino.Pin} redLedPin The pin the red LED is connected to.
@param {webduino.Pin} greenLedPin The pin the green LED is connected to.
@param {webduino.Pin} blueLedPin The ... | [
"The",
"RGBLed",
"Class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L6384-L6397 | train |
webduinoio/webduino-js | dist/webduino-all.js | Button | function Button(board, pin, buttonMode, sustainedPressInterval) {
Module.call(this);
this._board = board;
this._pin = pin;
this._repeatCount = 0;
this._timer = null;
this._timeout = null;
this._buttonMode = buttonMode || Button.PULL_DOWN;
this._sustainedPressInterval = sustainedPressIn... | javascript | function Button(board, pin, buttonMode, sustainedPressInterval) {
Module.call(this);
this._board = board;
this._pin = pin;
this._repeatCount = 0;
this._timer = null;
this._timeout = null;
this._buttonMode = buttonMode || Button.PULL_DOWN;
this._sustainedPressInterval = sustainedPressIn... | [
"function",
"Button",
"(",
"board",
",",
"pin",
",",
"buttonMode",
",",
"sustainedPressInterval",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_board",
"=",
"board",
";",
"this",
".",
"_pin",
"=",
"pin",
";",
"this",
".",
"_r... | The Button Class.
@namespace webduino.module
@class Button
@constructor
@param {webduino.Board} board The board the button is attached to.
@param {webduino.pin} pin The pin the button is connected to.
@param {Number} [buttonMode] Type of resistor the button is connected to, either Button.PULL_DOWN or Button.PULL_UP.
@... | [
"The",
"Button",
"Class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L6542-L6568 | train |
webduinoio/webduino-js | dist/webduino-all.js | Ultrasonic | function Ultrasonic(board, trigger, echo) {
Module.call(this);
this._type = 'HC-SR04';
this._board = board;
this._trigger = trigger;
this._echo = echo;
this._distance = null;
this._lastRecv = null;
this._pingTimer = null;
this._pingCallback = function () {};
this._board.on(Boar... | javascript | function Ultrasonic(board, trigger, echo) {
Module.call(this);
this._type = 'HC-SR04';
this._board = board;
this._trigger = trigger;
this._echo = echo;
this._distance = null;
this._lastRecv = null;
this._pingTimer = null;
this._pingCallback = function () {};
this._board.on(Boar... | [
"function",
"Ultrasonic",
"(",
"board",
",",
"trigger",
",",
"echo",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_type",
"=",
"'HC-SR04'",
";",
"this",
".",
"_board",
"=",
"board",
";",
"this",
".",
"_trigger",
"=",
"trigger... | The Ultrasonic class.
@namespace webduino.module
@class Ultrasonic
@constructor
@param {webduino.Board} board The board the ultrasonic sensor is attached to.
@param {webduino.Pin} trigger The trigger pin the sensor is connected to.
@param {webduino.Pin} echo The echo pin the sensor is connected to.
@extends webduino.M... | [
"The",
"Ultrasonic",
"class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L6737-L6752 | train |
webduinoio/webduino-js | dist/webduino-all.js | Dht | function Dht(board, pin) {
Module.call(this);
this._type = 'DHT11';
this._board = board;
this._pin = pin;
this._humidity = null;
this._temperature = null;
this._lastRecv = null;
this._readTimer = null;
this._readCallback = function () {};
this._board.on(BoardEvent.BEFOREDISCONN... | javascript | function Dht(board, pin) {
Module.call(this);
this._type = 'DHT11';
this._board = board;
this._pin = pin;
this._humidity = null;
this._temperature = null;
this._lastRecv = null;
this._readTimer = null;
this._readCallback = function () {};
this._board.on(BoardEvent.BEFOREDISCONN... | [
"function",
"Dht",
"(",
"board",
",",
"pin",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_type",
"=",
"'DHT11'",
";",
"this",
".",
"_board",
"=",
"board",
";",
"this",
".",
"_pin",
"=",
"pin",
";",
"this",
".",
"_humidit... | The Dht Class.
DHT is sensor for measuring temperature and humidity.
@namespace webduino.module
@class Dht
@constructor
@param {webduino.Board} board The board that the DHT is attached to.
@param {Integer} pin The pin that the DHT is connected to.
@extends webduino.Module | [
"The",
"Dht",
"Class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L7233-L7248 | train |
webduinoio/webduino-js | dist/webduino-all.js | Buzzer | function Buzzer(board, pin) {
Module.call(this);
this._board = board;
this._pin = pin;
this._timer = null;
this._sequence = null;
this._state = BUZZER_STATE.STOPPED;
this._board.on(BoardEvent.BEFOREDISCONNECT, this.stop.bind(this));
this._board.on(BoardEvent.ERROR, this.stop.bind(this)... | javascript | function Buzzer(board, pin) {
Module.call(this);
this._board = board;
this._pin = pin;
this._timer = null;
this._sequence = null;
this._state = BUZZER_STATE.STOPPED;
this._board.on(BoardEvent.BEFOREDISCONNECT, this.stop.bind(this));
this._board.on(BoardEvent.ERROR, this.stop.bind(this)... | [
"function",
"Buzzer",
"(",
"board",
",",
"pin",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_board",
"=",
"board",
";",
"this",
".",
"_pin",
"=",
"pin",
";",
"this",
".",
"_timer",
"=",
"null",
";",
"this",
".",
"_sequen... | The Buzzer Class.
@namespace webduino.module
@class Buzzer
@constructor
@param {webduino.Board} board The board that the buzzer is attached to.
@param {Integer} pin The pin that the buzzer is connected to.
@extends webduino.Module | [
"The",
"Buzzer",
"Class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L7531-L7542 | train |
webduinoio/webduino-js | dist/webduino-all.js | Max7219 | function Max7219(board, din, cs, clk) {
Module.call(this);
this._board = board;
this._din = din;
this._cs = cs;
this._clk = clk;
this._intensity = 0;
this._data = 'ffffffffffffffff';
this._board.on(BoardEvent.BEFOREDISCONNECT, this.animateStop.bind(this));
this._board.on(BoardEvent.... | javascript | function Max7219(board, din, cs, clk) {
Module.call(this);
this._board = board;
this._din = din;
this._cs = cs;
this._clk = clk;
this._intensity = 0;
this._data = 'ffffffffffffffff';
this._board.on(BoardEvent.BEFOREDISCONNECT, this.animateStop.bind(this));
this._board.on(BoardEvent.... | [
"function",
"Max7219",
"(",
"board",
",",
"din",
",",
"cs",
",",
"clk",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_board",
"=",
"board",
";",
"this",
".",
"_din",
"=",
"din",
";",
"this",
".",
"_cs",
"=",
"cs",
";",
... | The Max7219 Class.
MAX7219 is compact, serial input/output
common-cathode display drivers that interface
microprocessors (µPs) to 7-segment numeric LED displays
of up to 8 digits, bar-graph displays, or 64 individual LEDs.
@namespace webduino.module
@class Max7219
@constructor
@param {webduino.Board} board The board ... | [
"The",
"Max7219",
"Class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L7728-L7740 | train |
webduinoio/webduino-js | dist/webduino-all.js | ADXL345 | function ADXL345(board) {
Module.call(this);
this._board = board;
this._baseAxis = 'z';
this._sensitive = 10;
this._detectTime = 50;
this._messageHandler = onMessage.bind(this);
this._init = false;
this._info = {
x: 0,
y: 0,
z: 0,
fXg: 0,
fYg: 0,
fZg: ... | javascript | function ADXL345(board) {
Module.call(this);
this._board = board;
this._baseAxis = 'z';
this._sensitive = 10;
this._detectTime = 50;
this._messageHandler = onMessage.bind(this);
this._init = false;
this._info = {
x: 0,
y: 0,
z: 0,
fXg: 0,
fYg: 0,
fZg: ... | [
"function",
"ADXL345",
"(",
"board",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_board",
"=",
"board",
";",
"this",
".",
"_baseAxis",
"=",
"'z'",
";",
"this",
".",
"_sensitive",
"=",
"10",
";",
"this",
".",
"_detectTime",
... | The ADXL345 class.
ADXL345 is a small, thin, ultralow power, 3-axis accelerometer.
@namespace webduino.module
@class ADXL345
@constructor
@param {webduino.Board} board The board that the ADXL345 accelerometer is attached to.
@extends webduino.Module | [
"The",
"ADXL345",
"class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L7894-L7912 | train |
webduinoio/webduino-js | dist/webduino-all.js | HX711 | function HX711(board, sckPin, dtPin) {
Module.call(this);
this._board = board;
this._dt = !isNaN(dtPin) ? board.getDigitalPin(dtPin) : dtPin;
this._sck = !isNaN(sckPin) ? board.getDigitalPin(sckPin) : sckPin;
this._init = false;
this._weight = 0;
this._callback = function() {};
this._me... | javascript | function HX711(board, sckPin, dtPin) {
Module.call(this);
this._board = board;
this._dt = !isNaN(dtPin) ? board.getDigitalPin(dtPin) : dtPin;
this._sck = !isNaN(sckPin) ? board.getDigitalPin(sckPin) : sckPin;
this._init = false;
this._weight = 0;
this._callback = function() {};
this._me... | [
"function",
"HX711",
"(",
"board",
",",
"sckPin",
",",
"dtPin",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_board",
"=",
"board",
";",
"this",
".",
"_dt",
"=",
"!",
"isNaN",
"(",
"dtPin",
")",
"?",
"board",
".",
"getDig... | The HX711 Class.
HX711 is a precision 24-bit analogto-digital converter (ADC) designed for weigh scales.
@namespace webduino.module
@class HX711
@constructor
@param {webduino.Board} board The board that the IRLed is attached to.
@param {Integer} sckPin The pin that Serial Clock Input is attached to.
@param {Integer} ... | [
"The",
"HX711",
"Class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L8163-L8176 | train |
webduinoio/webduino-js | dist/webduino-all.js | Barcode | function Barcode(board, rxPin, txPin) {
Module.call(this);
this._board = board;
this._rx = !isNaN(rxPin) ? board.getDigitalPin(rxPin) : rxPin;
this._tx = !isNaN(txPin) ? board.getDigitalPin(txPin) : txPin;
this._init = false;
this._scanData = '';
this._callback = function () {};
this._m... | javascript | function Barcode(board, rxPin, txPin) {
Module.call(this);
this._board = board;
this._rx = !isNaN(rxPin) ? board.getDigitalPin(rxPin) : rxPin;
this._tx = !isNaN(txPin) ? board.getDigitalPin(txPin) : txPin;
this._init = false;
this._scanData = '';
this._callback = function () {};
this._m... | [
"function",
"Barcode",
"(",
"board",
",",
"rxPin",
",",
"txPin",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_board",
"=",
"board",
";",
"this",
".",
"_rx",
"=",
"!",
"isNaN",
"(",
"rxPin",
")",
"?",
"board",
".",
"getDi... | The Barcode class.
@namespace webduino.module
@class Barcode
@constructor
@param {webduino.Board} board The board the barcode scanner is attached to.
@param {webduino.Pin | Number} rxPin Receivin pin (number) the barcode scanner is connected to.
@param {webduino.Pin | Number} txPin Transmitting pin (number) the barcod... | [
"The",
"Barcode",
"class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L8433-L8446 | train |
webduinoio/webduino-js | dist/webduino-all.js | IRLed | function IRLed(board, encode) {
Module.call(this);
this._board = board;
this._encode = encode;
this._board.send([0xf4, 0x09, 0x03, 0xe9, 0x00, 0x00]);
} | javascript | function IRLed(board, encode) {
Module.call(this);
this._board = board;
this._encode = encode;
this._board.send([0xf4, 0x09, 0x03, 0xe9, 0x00, 0x00]);
} | [
"function",
"IRLed",
"(",
"board",
",",
"encode",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_board",
"=",
"board",
";",
"this",
".",
"_encode",
"=",
"encode",
";",
"this",
".",
"_board",
".",
"send",
"(",
"[",
"0xf4",
... | The IRLed Class.
IR LED (Infrared LED) is widely used for remote controls and night-vision cameras.
@namespace webduino.module
@class IRLed
@constructor
@param {webduino.Board} board The board that the IRLed is attached to.
@param {String} encode Encode which IRLed used.
@extends webduino.Module | [
"The",
"IRLed",
"Class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L8549-L8554 | train |
webduinoio/webduino-js | dist/webduino-all.js | IRRecv | function IRRecv(board, pin) {
Module.call(this);
this._board = board;
this._pin = pin;
this._messageHandler = onMessage.bind(this);
this._recvCallback = function () {};
this._recvErrorCallback = function () {};
this._board.send([0xf0, 0x04, 0x0A, 0x01, 0xf7]);
} | javascript | function IRRecv(board, pin) {
Module.call(this);
this._board = board;
this._pin = pin;
this._messageHandler = onMessage.bind(this);
this._recvCallback = function () {};
this._recvErrorCallback = function () {};
this._board.send([0xf0, 0x04, 0x0A, 0x01, 0xf7]);
} | [
"function",
"IRRecv",
"(",
"board",
",",
"pin",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_board",
"=",
"board",
";",
"this",
".",
"_pin",
"=",
"pin",
";",
"this",
".",
"_messageHandler",
"=",
"onMessage",
".",
"bind",
"... | The IRRecv Class.
@namespace webduino.module
@class IRRecv
@constructor
@param {webduino.Board} board The board that the IRLed is attached to.
@param {Integer} pin The pin that the IRLed is connected to.
@extends webduino.Module | [
"The",
"IRRecv",
"Class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L8642-L8650 | train |
webduinoio/webduino-js | dist/webduino-all.js | RFID | function RFID(board) {
Module.call(this);
this._board = board;
this._isReading = false;
this._enterHandlers = [];
this._leaveHandlers = [];
this._messageHandler = onMessage.bind(this);
this._board.on(BoardEvent.BEFOREDISCONNECT, this.destroy.bind(this));
this._board.on(BoardEvent.ERROR... | javascript | function RFID(board) {
Module.call(this);
this._board = board;
this._isReading = false;
this._enterHandlers = [];
this._leaveHandlers = [];
this._messageHandler = onMessage.bind(this);
this._board.on(BoardEvent.BEFOREDISCONNECT, this.destroy.bind(this));
this._board.on(BoardEvent.ERROR... | [
"function",
"RFID",
"(",
"board",
")",
"{",
"Module",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"_board",
"=",
"board",
";",
"this",
".",
"_isReading",
"=",
"false",
";",
"this",
".",
"_enterHandlers",
"=",
"[",
"]",
";",
"this",
".",
"_leav... | The RFID class.
RFID reader is used to track nearby tags by wirelessly reading a tag's unique ID.
@namespace webduino.module
@class RFID
@constructor
@param {webduino.Board} board Board that the RFID is attached to.
@extends webduino.Module | [
"The",
"RFID",
"class",
"."
] | 2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49 | https://github.com/webduinoio/webduino-js/blob/2ea8f0cc1005f5a5db62241bd33c0e1823ed1e49/dist/webduino-all.js#L9171-L9183 | train |
IcedFrisby/IcedFrisby | lib/pathMatch.js | setup | function setup(check) {
if (!check) {
throw new Error('Data to match is not defined')
} else if (!check.jsonBody) {
throw new Error('jsonBody is not defined')
} else if (!check.jsonTest) {
throw new Error('jsonTest is not defined')
}
// define the defaults
const defaults = {
isNot: false,
... | javascript | function setup(check) {
if (!check) {
throw new Error('Data to match is not defined')
} else if (!check.jsonBody) {
throw new Error('jsonBody is not defined')
} else if (!check.jsonTest) {
throw new Error('jsonTest is not defined')
}
// define the defaults
const defaults = {
isNot: false,
... | [
"function",
"setup",
"(",
"check",
")",
"{",
"if",
"(",
"!",
"check",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Data to match is not defined'",
")",
"}",
"else",
"if",
"(",
"!",
"check",
".",
"jsonBody",
")",
"{",
"throw",
"new",
"Error",
"(",
"'jsonBo... | performs a setup operation by checking the input data and merging the input data with a set of defaults returns the result of merging the default options and the input data | [
"performs",
"a",
"setup",
"operation",
"by",
"checking",
"the",
"input",
"data",
"and",
"merging",
"the",
"input",
"data",
"with",
"a",
"set",
"of",
"defaults",
"returns",
"the",
"result",
"of",
"merging",
"the",
"default",
"options",
"and",
"the",
"input",
... | ac152b715623fda078116d0963c5b391a9be51a4 | https://github.com/IcedFrisby/IcedFrisby/blob/ac152b715623fda078116d0963c5b391a9be51a4/lib/pathMatch.js#L16-L35 | train |
IcedFrisby/IcedFrisby | lib/pathMatch.js | function(jsonBody, lengthSegments) {
let len = 0
if (_.isObject(jsonBody)) {
len = Object.keys(jsonBody).length
} else {
len = jsonBody.length
}
let msg // message for expectation result
//TODO: in the future, use expect(jsonBody).to.have.length.below(lengthSegments.count + 1); or similar for non-... | javascript | function(jsonBody, lengthSegments) {
let len = 0
if (_.isObject(jsonBody)) {
len = Object.keys(jsonBody).length
} else {
len = jsonBody.length
}
let msg // message for expectation result
//TODO: in the future, use expect(jsonBody).to.have.length.below(lengthSegments.count + 1); or similar for non-... | [
"function",
"(",
"jsonBody",
",",
"lengthSegments",
")",
"{",
"let",
"len",
"=",
"0",
"if",
"(",
"_",
".",
"isObject",
"(",
"jsonBody",
")",
")",
"{",
"len",
"=",
"Object",
".",
"keys",
"(",
"jsonBody",
")",
".",
"length",
"}",
"else",
"{",
"len",
... | expect length function for matchJSONLength that does the comparison operations | [
"expect",
"length",
"function",
"for",
"matchJSONLength",
"that",
"does",
"the",
"comparison",
"operations"
] | ac152b715623fda078116d0963c5b391a9be51a4 | https://github.com/IcedFrisby/IcedFrisby/blob/ac152b715623fda078116d0963c5b391a9be51a4/lib/pathMatch.js#L503-L552 | train | |
IcedFrisby/IcedFrisby | lib/icedfrisby.js | _jsonParse | function _jsonParse(body) {
let json = ''
try {
json = typeof body === 'object' ? body : JSON.parse(body)
} catch (e) {
throw new Error(
'Error parsing JSON string: ' + e.message + '\n\tGiven: ' + body
)
}
return json
} | javascript | function _jsonParse(body) {
let json = ''
try {
json = typeof body === 'object' ? body : JSON.parse(body)
} catch (e) {
throw new Error(
'Error parsing JSON string: ' + e.message + '\n\tGiven: ' + body
)
}
return json
} | [
"function",
"_jsonParse",
"(",
"body",
")",
"{",
"let",
"json",
"=",
"''",
"try",
"{",
"json",
"=",
"typeof",
"body",
"===",
"'object'",
"?",
"body",
":",
"JSON",
".",
"parse",
"(",
"body",
")",
"}",
"catch",
"(",
"e",
")",
"{",
"throw",
"new",
"... | Parse body as JSON, ensuring not to re-parse when body is already an object
(thanks @dcaylor).
@param {object} body - json object
@return {object}
@desc parse response body as json | [
"Parse",
"body",
"as",
"JSON",
"ensuring",
"not",
"to",
"re",
"-",
"parse",
"when",
"body",
"is",
"already",
"an",
"object",
"(",
"thanks"
] | ac152b715623fda078116d0963c5b391a9be51a4 | https://github.com/IcedFrisby/IcedFrisby/blob/ac152b715623fda078116d0963c5b391a9be51a4/lib/icedfrisby.js#L55-L65 | train |
artsy/scroll-frame | scroll-frame.js | function(url) {
var prevHref = location.href;
var prevTitle = document.title;
// Change the history
history.pushState({ scrollFrame: true, href: location.href }, '', url);
// Create the wrapper & iframe modal
var body = document.getElementsByTagName('body')[0];
var iOS = navigator.userAgen... | javascript | function(url) {
var prevHref = location.href;
var prevTitle = document.title;
// Change the history
history.pushState({ scrollFrame: true, href: location.href }, '', url);
// Create the wrapper & iframe modal
var body = document.getElementsByTagName('body')[0];
var iOS = navigator.userAgen... | [
"function",
"(",
"url",
")",
"{",
"var",
"prevHref",
"=",
"location",
".",
"href",
";",
"var",
"prevTitle",
"=",
"document",
".",
"title",
";",
"// Change the history",
"history",
".",
"pushState",
"(",
"{",
"scrollFrame",
":",
"true",
",",
"href",
":",
... | Change pushState and open the iframe modal pointing to this url. @param {String} url | [
"Change",
"pushState",
"and",
"open",
"the",
"iframe",
"modal",
"pointing",
"to",
"this",
"url",
"."
] | f95bff6dfe0295696daeae1949c84c7f36369d9a | https://github.com/artsy/scroll-frame/blob/f95bff6dfe0295696daeae1949c84c7f36369d9a/scroll-frame.js#L38-L93 | train | |
artsy/scroll-frame | scroll-frame.js | function(e) {
if (location.href != prevHref) return;
wrapper.removeChild(iframe);
document.title = prevTitle;
body.removeChild(wrapper);
body.setAttribute('style',
body.getAttribute('style').replace('overflow: hidden;', ''));
removeEventListener('popstate', onPopState);
} | javascript | function(e) {
if (location.href != prevHref) return;
wrapper.removeChild(iframe);
document.title = prevTitle;
body.removeChild(wrapper);
body.setAttribute('style',
body.getAttribute('style').replace('overflow: hidden;', ''));
removeEventListener('popstate', onPopState);
} | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"location",
".",
"href",
"!=",
"prevHref",
")",
"return",
";",
"wrapper",
".",
"removeChild",
"(",
"iframe",
")",
";",
"document",
".",
"title",
"=",
"prevTitle",
";",
"body",
".",
"removeChild",
"(",
"wrapper... | On back-button remove the wrapper | [
"On",
"back",
"-",
"button",
"remove",
"the",
"wrapper"
] | f95bff6dfe0295696daeae1949c84c7f36369d9a | https://github.com/artsy/scroll-frame/blob/f95bff6dfe0295696daeae1949c84c7f36369d9a/scroll-frame.js#L83-L91 | train | |
Zlobin/es-event-emitter | src/event-emitter.js | internal | function internal(obj) {
if (!privateMap.has(obj)) {
privateMap.set(obj, {});
}
return privateMap.get(obj);
} | javascript | function internal(obj) {
if (!privateMap.has(obj)) {
privateMap.set(obj, {});
}
return privateMap.get(obj);
} | [
"function",
"internal",
"(",
"obj",
")",
"{",
"if",
"(",
"!",
"privateMap",
".",
"has",
"(",
"obj",
")",
")",
"{",
"privateMap",
".",
"set",
"(",
"obj",
",",
"{",
"}",
")",
";",
"}",
"return",
"privateMap",
".",
"get",
"(",
"obj",
")",
";",
"}"... | For making private properties. | [
"For",
"making",
"private",
"properties",
"."
] | 6f86b7052402e78dd7cfb26f7d44b105cd81617a | https://github.com/Zlobin/es-event-emitter/blob/6f86b7052402e78dd7cfb26f7d44b105cd81617a/src/event-emitter.js#L6-L12 | train |
WebReflection/ie8 | build/ie8.max.js | function (object, descriptors) {
for(var key in descriptors) {
if (hasOwnProperty.call(descriptors, key)) {
try {
defineProperty(object, key, descriptors[key]);
} catch(o_O) {
if (window.console) {
console.log(key + ' failed on object:', object, o_... | javascript | function (object, descriptors) {
for(var key in descriptors) {
if (hasOwnProperty.call(descriptors, key)) {
try {
defineProperty(object, key, descriptors[key]);
} catch(o_O) {
if (window.console) {
console.log(key + ' failed on object:', object, o_... | [
"function",
"(",
"object",
",",
"descriptors",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"descriptors",
")",
"{",
"if",
"(",
"hasOwnProperty",
".",
"call",
"(",
"descriptors",
",",
"key",
")",
")",
"{",
"try",
"{",
"defineProperty",
"(",
"object",
",",... | IE8 implemented defineProperty but not the plural... | [
"IE8",
"implemented",
"defineProperty",
"but",
"not",
"the",
"plural",
"..."
] | 0867473f3379729061764a72e8df2ff25adb303e | https://github.com/WebReflection/ie8/blob/0867473f3379729061764a72e8df2ff25adb303e/build/ie8.max.js#L40-L52 | train | |
airbrake/node-airbrake | lib/truncator.js | truncateObj | function truncateObj(obj, level) {
var dst = {};
for (var attr in obj) {
if (Object.prototype.hasOwnProperty.call(obj, attr)) {
dst[attr] = module.exports.truncate(obj[attr], level);
}
}
return dst;
} | javascript | function truncateObj(obj, level) {
var dst = {};
for (var attr in obj) {
if (Object.prototype.hasOwnProperty.call(obj, attr)) {
dst[attr] = module.exports.truncate(obj[attr], level);
}
}
return dst;
} | [
"function",
"truncateObj",
"(",
"obj",
",",
"level",
")",
"{",
"var",
"dst",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"attr",
"in",
"obj",
")",
"{",
"if",
"(",
"Object",
".",
"prototype",
".",
"hasOwnProperty",
".",
"call",
"(",
"obj",
",",
"attr",
... | truncateObj truncates each key in the object separately, which is useful for handling circular references. | [
"truncateObj",
"truncates",
"each",
"key",
"in",
"the",
"object",
"separately",
"which",
"is",
"useful",
"for",
"handling",
"circular",
"references",
"."
] | 24f76f5e73a5cbb379d6a512d980a4b7d608e61d | https://github.com/airbrake/node-airbrake/blob/24f76f5e73a5cbb379d6a512d980a4b7d608e61d/lib/truncator.js#L173-L182 | train |
jacomyal/emmett | emmett.js | shallowMerge | function shallowMerge(o1, o2) {
var o = {},
k;
for (k in o1) o[k] = o1[k];
for (k in o2) o[k] = o2[k];
return o;
} | javascript | function shallowMerge(o1, o2) {
var o = {},
k;
for (k in o1) o[k] = o1[k];
for (k in o2) o[k] = o2[k];
return o;
} | [
"function",
"shallowMerge",
"(",
"o1",
",",
"o2",
")",
"{",
"var",
"o",
"=",
"{",
"}",
",",
"k",
";",
"for",
"(",
"k",
"in",
"o1",
")",
"o",
"[",
"k",
"]",
"=",
"o1",
"[",
"k",
"]",
";",
"for",
"(",
"k",
"in",
"o2",
")",
"o",
"[",
"k",
... | A simple helper to shallowly merge two objects. The second one will "win"
over the first one.
@param {object} o1 First target object.
@param {object} o2 Second target object.
@return {object} Returns the merged object. | [
"A",
"simple",
"helper",
"to",
"shallowly",
"merge",
"two",
"objects",
".",
"The",
"second",
"one",
"will",
"win",
"over",
"the",
"first",
"one",
"."
] | 5af501ff5bfe80d2859683e3547d293514fe3889 | https://github.com/jacomyal/emmett/blob/5af501ff5bfe80d2859683e3547d293514fe3889/emmett.js#L26-L34 | train |
jacomyal/emmett | emmett.js | isPlainObject | function isPlainObject(v) {
return v &&
typeof v === 'object' &&
!Array.isArray(v) &&
!(v instanceof Function) &&
!(v instanceof RegExp);
} | javascript | function isPlainObject(v) {
return v &&
typeof v === 'object' &&
!Array.isArray(v) &&
!(v instanceof Function) &&
!(v instanceof RegExp);
} | [
"function",
"isPlainObject",
"(",
"v",
")",
"{",
"return",
"v",
"&&",
"typeof",
"v",
"===",
"'object'",
"&&",
"!",
"Array",
".",
"isArray",
"(",
"v",
")",
"&&",
"!",
"(",
"v",
"instanceof",
"Function",
")",
"&&",
"!",
"(",
"v",
"instanceof",
"RegExp"... | Is the given variable a plain JavaScript object?
@param {mixed} v Target.
@return {boolean} The boolean result. | [
"Is",
"the",
"given",
"variable",
"a",
"plain",
"JavaScript",
"object?"
] | 5af501ff5bfe80d2859683e3547d293514fe3889 | https://github.com/jacomyal/emmett/blob/5af501ff5bfe80d2859683e3547d293514fe3889/emmett.js#L42-L48 | train |
jacomyal/emmett | emmett.js | forIn | function forIn(object, fn, scope) {
var symbols,
k,
i,
l;
for (k in object)
fn.call(scope || null, k, object[k]);
if (Object.getOwnPropertySymbols) {
symbols = Object.getOwnPropertySymbols(object);
for (i = 0, l = symbols.length; i < l; i++)
fn.call(scope... | javascript | function forIn(object, fn, scope) {
var symbols,
k,
i,
l;
for (k in object)
fn.call(scope || null, k, object[k]);
if (Object.getOwnPropertySymbols) {
symbols = Object.getOwnPropertySymbols(object);
for (i = 0, l = symbols.length; i < l; i++)
fn.call(scope... | [
"function",
"forIn",
"(",
"object",
",",
"fn",
",",
"scope",
")",
"{",
"var",
"symbols",
",",
"k",
",",
"i",
",",
"l",
";",
"for",
"(",
"k",
"in",
"object",
")",
"fn",
".",
"call",
"(",
"scope",
"||",
"null",
",",
"k",
",",
"object",
"[",
"k"... | Iterate over an object that may have ES6 Symbols.
@param {object} object Object on which to iterate.
@param {function} fn Iterator function.
@param {object} [scope] Optional scope. | [
"Iterate",
"over",
"an",
"object",
"that",
"may",
"have",
"ES6",
"Symbols",
"."
] | 5af501ff5bfe80d2859683e3547d293514fe3889 | https://github.com/jacomyal/emmett/blob/5af501ff5bfe80d2859683e3547d293514fe3889/emmett.js#L57-L72 | train |
jacomyal/emmett | emmett.js | filter | function filter(target, fn) {
target = target || [];
var a = [],
l,
i;
for (i = 0, l = target.length; i < l; i++)
if (target[i].fn !== fn)
a.push(target[i]);
return a;
} | javascript | function filter(target, fn) {
target = target || [];
var a = [],
l,
i;
for (i = 0, l = target.length; i < l; i++)
if (target[i].fn !== fn)
a.push(target[i]);
return a;
} | [
"function",
"filter",
"(",
"target",
",",
"fn",
")",
"{",
"target",
"=",
"target",
"||",
"[",
"]",
";",
"var",
"a",
"=",
"[",
"]",
",",
"l",
",",
"i",
";",
"for",
"(",
"i",
"=",
"0",
",",
"l",
"=",
"target",
".",
"length",
";",
"i",
"<",
... | This method unbinds one or more functions from events of the emitter. So,
these functions will no more be executed when the related events are
emitted. If the functions were not bound to the events, nothing will
happen, and no error will be thrown.
Variant 1:
**********
> myEmitter.off('myEvent', myHandler);
@param ... | [
"This",
"method",
"unbinds",
"one",
"or",
"more",
"functions",
"from",
"events",
"of",
"the",
"emitter",
".",
"So",
"these",
"functions",
"will",
"no",
"more",
"be",
"executed",
"when",
"the",
"related",
"events",
"are",
"emitted",
".",
"If",
"the",
"funct... | 5af501ff5bfe80d2859683e3547d293514fe3889 | https://github.com/jacomyal/emmett/blob/5af501ff5bfe80d2859683e3547d293514fe3889/emmett.js#L312-L324 | train |
metadevpro/baucis-openapi3 | src/Controller.js | generateModelOpenApiSchema | function generateModelOpenApiSchema(schema, definitionName) {
var oaSchema = {
required: [],
properties: {}
};
mergePaths(oaSchema, schema.paths, definitionName);
mergePaths(oaSchema, schema.virtuals, definitionName);
//remove empty arrays -> OpenAPI 3.0 validates
if (oaSchema.requ... | javascript | function generateModelOpenApiSchema(schema, definitionName) {
var oaSchema = {
required: [],
properties: {}
};
mergePaths(oaSchema, schema.paths, definitionName);
mergePaths(oaSchema, schema.virtuals, definitionName);
//remove empty arrays -> OpenAPI 3.0 validates
if (oaSchema.requ... | [
"function",
"generateModelOpenApiSchema",
"(",
"schema",
",",
"definitionName",
")",
"{",
"var",
"oaSchema",
"=",
"{",
"required",
":",
"[",
"]",
",",
"properties",
":",
"{",
"}",
"}",
";",
"mergePaths",
"(",
"oaSchema",
",",
"schema",
".",
"paths",
",",
... | A method used to generate an OpenAPI model schema for a controller | [
"A",
"method",
"used",
"to",
"generate",
"an",
"OpenAPI",
"model",
"schema",
"for",
"a",
"controller"
] | d0076ecf0cd989043e26c7d4bec1343ec17bdc23 | https://github.com/metadevpro/baucis-openapi3/blob/d0076ecf0cd989043e26c7d4bec1343ec17bdc23/src/Controller.js#L400-L416 | train |
metadevpro/baucis-openapi3 | src/Api.js | generateResourceListing | function generateResourceListing(options) {
var controllers = options.controllers;
var opts = options.options || {};
var listing = {
openapi: '3.0.0',
info: buildInfo(opts),
servers: opts.servers || buildDefaultServers(),
tags: buildTags(opts, controllers),
paths: buildPaths(opts, controllers... | javascript | function generateResourceListing(options) {
var controllers = options.controllers;
var opts = options.options || {};
var listing = {
openapi: '3.0.0',
info: buildInfo(opts),
servers: opts.servers || buildDefaultServers(),
tags: buildTags(opts, controllers),
paths: buildPaths(opts, controllers... | [
"function",
"generateResourceListing",
"(",
"options",
")",
"{",
"var",
"controllers",
"=",
"options",
".",
"controllers",
";",
"var",
"opts",
"=",
"options",
".",
"options",
"||",
"{",
"}",
";",
"var",
"listing",
"=",
"{",
"openapi",
":",
"'3.0.0'",
",",
... | A method for generating OpenAPI resource listing | [
"A",
"method",
"for",
"generating",
"OpenAPI",
"resource",
"listing"
] | d0076ecf0cd989043e26c7d4bec1343ec17bdc23 | https://github.com/metadevpro/baucis-openapi3/blob/d0076ecf0cd989043e26c7d4bec1343ec17bdc23/src/Api.js#L98-L121 | train |
digitalsadhu/loopback-component-jsonapi | lib/patch.js | fixHttpMethod | function fixHttpMethod (fn, name) {
if (fn.http && fn.http.verb && fn.http.verb.toLowerCase() === 'put') {
fn.http.verb = 'patch'
}
} | javascript | function fixHttpMethod (fn, name) {
if (fn.http && fn.http.verb && fn.http.verb.toLowerCase() === 'put') {
fn.http.verb = 'patch'
}
} | [
"function",
"fixHttpMethod",
"(",
"fn",
",",
"name",
")",
"{",
"if",
"(",
"fn",
".",
"http",
"&&",
"fn",
".",
"http",
".",
"verb",
"&&",
"fn",
".",
"http",
".",
"verb",
".",
"toLowerCase",
"(",
")",
"===",
"'put'",
")",
"{",
"fn",
".",
"http",
... | Copied from loopbacks Model class. Changes `PUT` request to `PATCH`
@private
@memberOf {Patch}
@param {Function} fn
@param {String} name
@return {undefined} | [
"Copied",
"from",
"loopbacks",
"Model",
"class",
".",
"Changes",
"PUT",
"request",
"to",
"PATCH"
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/patch.js#L50-L54 | train |
digitalsadhu/loopback-component-jsonapi | lib/patch.js | convertNullToNotFoundError | function convertNullToNotFoundError (toModelName, ctx, cb) {
if (ctx.result !== null) return cb()
var fk = ctx.getArgByName('fk')
var msg = 'Unknown "' + toModelName + '" id "' + fk + '".'
var error = new Error(msg)
error.statusCode = error.status = statusCodes.NOT_FOUND
error.code = 'MODEL_NOT_FOUND'
cb... | javascript | function convertNullToNotFoundError (toModelName, ctx, cb) {
if (ctx.result !== null) return cb()
var fk = ctx.getArgByName('fk')
var msg = 'Unknown "' + toModelName + '" id "' + fk + '".'
var error = new Error(msg)
error.statusCode = error.status = statusCodes.NOT_FOUND
error.code = 'MODEL_NOT_FOUND'
cb... | [
"function",
"convertNullToNotFoundError",
"(",
"toModelName",
",",
"ctx",
",",
"cb",
")",
"{",
"if",
"(",
"ctx",
".",
"result",
"!==",
"null",
")",
"return",
"cb",
"(",
")",
"var",
"fk",
"=",
"ctx",
".",
"getArgByName",
"(",
"'fk'",
")",
"var",
"msg",
... | Copied in its entirity from loopbacks Model class.
it was necessary to do so as this function is used
in the other code below | [
"Copied",
"in",
"its",
"entirity",
"from",
"loopbacks",
"Model",
"class",
".",
"it",
"was",
"necessary",
"to",
"do",
"so",
"as",
"this",
"function",
"is",
"used",
"in",
"the",
"other",
"code",
"below"
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/patch.js#L61-L70 | train |
digitalsadhu/loopback-component-jsonapi | lib/patch.js | hasOneRemoting | function hasOneRemoting (relationName, relation, define) {
var pathName = (relation.options.http && relation.options.http.path) ||
relationName
var toModelName = relation.modelTo.modelName
define('__get__' + relationName, {
isStatic: false,
accessType: 'READ',
description: 'Fetches hasOne relatio... | javascript | function hasOneRemoting (relationName, relation, define) {
var pathName = (relation.options.http && relation.options.http.path) ||
relationName
var toModelName = relation.modelTo.modelName
define('__get__' + relationName, {
isStatic: false,
accessType: 'READ',
description: 'Fetches hasOne relatio... | [
"function",
"hasOneRemoting",
"(",
"relationName",
",",
"relation",
",",
"define",
")",
"{",
"var",
"pathName",
"=",
"(",
"relation",
".",
"options",
".",
"http",
"&&",
"relation",
".",
"options",
".",
"http",
".",
"path",
")",
"||",
"relationName",
"var",... | Defines has one remoting.
@public
@memberOf {Patch}
@param {String} relationName
@param {Object} relation
@param {Function} define
@return {undefined} | [
"Defines",
"has",
"one",
"remoting",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/patch.js#L138-L187 | train |
digitalsadhu/loopback-component-jsonapi | lib/patch.js | hasManyRemoting | function hasManyRemoting (relationName, relation, define) {
var pathName = (relation.options.http && relation.options.http.path) ||
relationName
var toModelName = relation.modelTo.modelName
var findHasManyRelationshipsFunc = function (cb) {
this['__get__' + pathName](cb)
}
define(
'__findRelatio... | javascript | function hasManyRemoting (relationName, relation, define) {
var pathName = (relation.options.http && relation.options.http.path) ||
relationName
var toModelName = relation.modelTo.modelName
var findHasManyRelationshipsFunc = function (cb) {
this['__get__' + pathName](cb)
}
define(
'__findRelatio... | [
"function",
"hasManyRemoting",
"(",
"relationName",
",",
"relation",
",",
"define",
")",
"{",
"var",
"pathName",
"=",
"(",
"relation",
".",
"options",
".",
"http",
"&&",
"relation",
".",
"options",
".",
"http",
".",
"path",
")",
"||",
"relationName",
"var"... | Defines has many remoting.
@public
@memberOf {Patch}
@param {String} relationName
@param {Object} relation
@param {Function} define
@return {undefined} | [
"Defines",
"has",
"many",
"remoting",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/patch.js#L198-L319 | train |
digitalsadhu/loopback-component-jsonapi | lib/patch.js | scopeRemoting | function scopeRemoting (scopeName, scope, define) {
var pathName = (scope.options &&
scope.options.http &&
scope.options.http.path) ||
scopeName
var isStatic = scope.isStatic
var toModelName = scope.modelTo.modelName
// https://github.com/strongloop/loopback/issues/811
// Check if the scope is fo... | javascript | function scopeRemoting (scopeName, scope, define) {
var pathName = (scope.options &&
scope.options.http &&
scope.options.http.path) ||
scopeName
var isStatic = scope.isStatic
var toModelName = scope.modelTo.modelName
// https://github.com/strongloop/loopback/issues/811
// Check if the scope is fo... | [
"function",
"scopeRemoting",
"(",
"scopeName",
",",
"scope",
",",
"define",
")",
"{",
"var",
"pathName",
"=",
"(",
"scope",
".",
"options",
"&&",
"scope",
".",
"options",
".",
"http",
"&&",
"scope",
".",
"options",
".",
"http",
".",
"path",
")",
"||",
... | Defines our scope remoting
@public
@memberOf {Patch}
@param {String} scopeName
@param {Object} scope
@param {Function} define
@return {undefined} | [
"Defines",
"our",
"scope",
"remoting"
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/patch.js#L330-L366 | train |
digitalsadhu/loopback-component-jsonapi | lib/errors.js | JSONAPIErrorHandler | function JSONAPIErrorHandler (err, req, res, next) {
debug('Handling error(s) using custom jsonapi error handler')
debug('Set Content-Type header to `application/vnd.api+json`')
res.set('Content-Type', 'application/vnd.api+json')
var errors = []
var statusCode = err.statusCode ||
err.status ||
status... | javascript | function JSONAPIErrorHandler (err, req, res, next) {
debug('Handling error(s) using custom jsonapi error handler')
debug('Set Content-Type header to `application/vnd.api+json`')
res.set('Content-Type', 'application/vnd.api+json')
var errors = []
var statusCode = err.statusCode ||
err.status ||
status... | [
"function",
"JSONAPIErrorHandler",
"(",
"err",
",",
"req",
",",
"res",
",",
"next",
")",
"{",
"debug",
"(",
"'Handling error(s) using custom jsonapi error handler'",
")",
"debug",
"(",
"'Set Content-Type header to `application/vnd.api+json`'",
")",
"res",
".",
"set",
"(... | Our JSON API Error handler.
@public
@memberOf {Errors}
@param {Object} err The error object
@param {Object} req The request object
@param {Object} res The response object
@param {Function} next
@return {undefined} | [
"Our",
"JSON",
"API",
"Error",
"handler",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/errors.js#L33-L123 | train |
digitalsadhu/loopback-component-jsonapi | lib/errors.js | buildErrorResponse | function buildErrorResponse (
httpStatusCode,
errorDetail,
errorCode,
errorName,
errorSource,
errorMeta
) {
var out = {
status: httpStatusCode || statusCodes.INTERNAL_SERVER_ERROR,
source: errorSource || {},
title: errorName || '',
code: errorCode || '',
detail: errorDetail || ''
}
... | javascript | function buildErrorResponse (
httpStatusCode,
errorDetail,
errorCode,
errorName,
errorSource,
errorMeta
) {
var out = {
status: httpStatusCode || statusCodes.INTERNAL_SERVER_ERROR,
source: errorSource || {},
title: errorName || '',
code: errorCode || '',
detail: errorDetail || ''
}
... | [
"function",
"buildErrorResponse",
"(",
"httpStatusCode",
",",
"errorDetail",
",",
"errorCode",
",",
"errorName",
",",
"errorSource",
",",
"errorMeta",
")",
"{",
"var",
"out",
"=",
"{",
"status",
":",
"httpStatusCode",
"||",
"statusCodes",
".",
"INTERNAL_SERVER_ERR... | Builds an error object for sending to the user.
@private
@memberOf {Errors}
@param {Number} httpStatusCode specific http status code
@param {String} errorDetail error message for the user, human readable
@param {String} errorCode internal system error code
@param {String} errorName error title for the user, human reada... | [
"Builds",
"an",
"error",
"object",
"for",
"sending",
"to",
"the",
"user",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/errors.js#L137-L158 | train |
digitalsadhu/loopback-component-jsonapi | lib/serializer.js | parseResource | function parseResource (type, data, relations, options) {
var resource = {}
var attributes = {}
var relationships
resource.type = type
relationships = parseRelations(data, relations, options)
if (!_.isEmpty(relationships)) {
resource.relationships = relationships
}
if (options.foreignKeys !== tru... | javascript | function parseResource (type, data, relations, options) {
var resource = {}
var attributes = {}
var relationships
resource.type = type
relationships = parseRelations(data, relations, options)
if (!_.isEmpty(relationships)) {
resource.relationships = relationships
}
if (options.foreignKeys !== tru... | [
"function",
"parseResource",
"(",
"type",
",",
"data",
",",
"relations",
",",
"options",
")",
"{",
"var",
"resource",
"=",
"{",
"}",
"var",
"attributes",
"=",
"{",
"}",
"var",
"relationships",
"resource",
".",
"type",
"=",
"type",
"relationships",
"=",
"... | Parses a a request and returns a resource
@private
@memberOf {Serializer}
@param {String} type
@param {Object} data
@param {Object} relations
@param {Object} options
@return {Object|null} | [
"Parses",
"a",
"a",
"request",
"and",
"returns",
"a",
"resource"
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/serializer.js#L117-L188 | train |
digitalsadhu/loopback-component-jsonapi | lib/serializer.js | parseCollection | function parseCollection (type, data, relations, options) {
var result = []
_.each(data, function (value) {
result.push(parseResource(type, value, relations, options))
})
return result
} | javascript | function parseCollection (type, data, relations, options) {
var result = []
_.each(data, function (value) {
result.push(parseResource(type, value, relations, options))
})
return result
} | [
"function",
"parseCollection",
"(",
"type",
",",
"data",
",",
"relations",
",",
"options",
")",
"{",
"var",
"result",
"=",
"[",
"]",
"_",
".",
"each",
"(",
"data",
",",
"function",
"(",
"value",
")",
"{",
"result",
".",
"push",
"(",
"parseResource",
... | Parses a collection of resources
@private
@memberOf {Serializer}
@param {String} type
@param {Object} data
@param {Object} relations
@param {Object} options
@return {Array} | [
"Parses",
"a",
"collection",
"of",
"resources"
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/serializer.js#L200-L208 | train |
digitalsadhu/loopback-component-jsonapi | lib/serializer.js | parseRelations | function parseRelations (data, relations, options) {
var relationships = {}
_.each(relations, function (relation, name) {
var fkName = relation.keyTo
// If relation is belongsTo then fk is the other way around
if (utils.relationFkOnModelFrom(relation)) {
fkName = relation.keyFrom
}
var ... | javascript | function parseRelations (data, relations, options) {
var relationships = {}
_.each(relations, function (relation, name) {
var fkName = relation.keyTo
// If relation is belongsTo then fk is the other way around
if (utils.relationFkOnModelFrom(relation)) {
fkName = relation.keyFrom
}
var ... | [
"function",
"parseRelations",
"(",
"data",
",",
"relations",
",",
"options",
")",
"{",
"var",
"relationships",
"=",
"{",
"}",
"_",
".",
"each",
"(",
"relations",
",",
"function",
"(",
"relation",
",",
"name",
")",
"{",
"var",
"fkName",
"=",
"relation",
... | Parses relations from the request.
@private
@memberOf {Serializer}
@param {Object} data
@param {Object} relations
@param {Object} options
@return {Object} | [
"Parses",
"relations",
"from",
"the",
"request",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/serializer.js#L219-L278 | train |
digitalsadhu/loopback-component-jsonapi | lib/serializer.js | makeRelation | function makeRelation (type, id, options) {
if (!_.includes(['string', 'number'], typeof id) || !id) {
return null
}
return {
type: type,
id: id
}
} | javascript | function makeRelation (type, id, options) {
if (!_.includes(['string', 'number'], typeof id) || !id) {
return null
}
return {
type: type,
id: id
}
} | [
"function",
"makeRelation",
"(",
"type",
",",
"id",
",",
"options",
")",
"{",
"if",
"(",
"!",
"_",
".",
"includes",
"(",
"[",
"'string'",
",",
"'number'",
"]",
",",
"typeof",
"id",
")",
"||",
"!",
"id",
")",
"{",
"return",
"null",
"}",
"return",
... | Responsible for making a relations.
@private
@memberOf {Serializer}
@param {String} type
@param {String|Number} id
@param {Object} options
@return {Object|null} | [
"Responsible",
"for",
"making",
"a",
"relations",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/serializer.js#L289-L298 | train |
digitalsadhu/loopback-component-jsonapi | lib/serializer.js | makeRelations | function makeRelations (type, ids, options) {
var res = []
_.each(ids, function (id) {
res.push(makeRelation(type, id, options))
})
return res
} | javascript | function makeRelations (type, ids, options) {
var res = []
_.each(ids, function (id) {
res.push(makeRelation(type, id, options))
})
return res
} | [
"function",
"makeRelations",
"(",
"type",
",",
"ids",
",",
"options",
")",
"{",
"var",
"res",
"=",
"[",
"]",
"_",
".",
"each",
"(",
"ids",
",",
"function",
"(",
"id",
")",
"{",
"res",
".",
"push",
"(",
"makeRelation",
"(",
"type",
",",
"id",
",",... | Handles a creating a collection of relations.
@private
@memberOf {Serializer}
@param {String} type
@param {Array} ids
@param {Object} options
@return {Array} | [
"Handles",
"a",
"creating",
"a",
"collection",
"of",
"relations",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/serializer.js#L309-L317 | train |
digitalsadhu/loopback-component-jsonapi | lib/serializer.js | makeLinks | function makeLinks (links, item) {
var retLinks = {}
_.each(links, function (value, name) {
if (_.isFunction(value)) {
retLinks[name] = value(item)
} else {
retLinks[name] = _(value).toString()
}
})
return retLinks
} | javascript | function makeLinks (links, item) {
var retLinks = {}
_.each(links, function (value, name) {
if (_.isFunction(value)) {
retLinks[name] = value(item)
} else {
retLinks[name] = _(value).toString()
}
})
return retLinks
} | [
"function",
"makeLinks",
"(",
"links",
",",
"item",
")",
"{",
"var",
"retLinks",
"=",
"{",
"}",
"_",
".",
"each",
"(",
"links",
",",
"function",
"(",
"value",
",",
"name",
")",
"{",
"if",
"(",
"_",
".",
"isFunction",
"(",
"value",
")",
")",
"{",
... | Makes links to an item.
@private
@memberOf {Serializer}
@param {Object} links
@param {Mixed} item
@return {Object} | [
"Makes",
"links",
"to",
"an",
"item",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/serializer.js#L327-L339 | train |
digitalsadhu/loopback-component-jsonapi | lib/serializer.js | handleIncludes | function handleIncludes (resp, includes, relations, options) {
var app = options.app
relations = utils.setIncludedRelations(relations, app)
var resources = _.isArray(resp.data) ? resp.data : [resp.data]
if (typeof includes === 'string') {
includes = [includes]
}
if (!_.isArray(includes)) {
throw... | javascript | function handleIncludes (resp, includes, relations, options) {
var app = options.app
relations = utils.setIncludedRelations(relations, app)
var resources = _.isArray(resp.data) ? resp.data : [resp.data]
if (typeof includes === 'string') {
includes = [includes]
}
if (!_.isArray(includes)) {
throw... | [
"function",
"handleIncludes",
"(",
"resp",
",",
"includes",
",",
"relations",
",",
"options",
")",
"{",
"var",
"app",
"=",
"options",
".",
"app",
"relations",
"=",
"utils",
".",
"setIncludedRelations",
"(",
"relations",
",",
"app",
")",
"var",
"resources",
... | Handles serializing the requested includes to a seperate included property
per JSON API spec.
@private
@memberOf {Serializer}
@param {Object} resp
@param {Array<String>|String}
@throws {Error}
@return {undefined} | [
"Handles",
"serializing",
"the",
"requested",
"includes",
"to",
"a",
"seperate",
"included",
"property",
"per",
"JSON",
"API",
"spec",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/serializer.js#L351-L463 | train |
digitalsadhu/loopback-component-jsonapi | lib/serializer.js | createCompoundIncludes | function createCompoundIncludes (
relationship,
key,
fk,
type,
includedRelations,
options
) {
var compoundInclude = makeRelation(type, String(relationship[key]))
if (options && !_.isEmpty(includedRelations)) {
var defaultModelPath = options.modelPath
options.modelPath = type
compoundInclud... | javascript | function createCompoundIncludes (
relationship,
key,
fk,
type,
includedRelations,
options
) {
var compoundInclude = makeRelation(type, String(relationship[key]))
if (options && !_.isEmpty(includedRelations)) {
var defaultModelPath = options.modelPath
options.modelPath = type
compoundInclud... | [
"function",
"createCompoundIncludes",
"(",
"relationship",
",",
"key",
",",
"fk",
",",
"type",
",",
"includedRelations",
",",
"options",
")",
"{",
"var",
"compoundInclude",
"=",
"makeRelation",
"(",
"type",
",",
"String",
"(",
"relationship",
"[",
"key",
"]",
... | Creates a compound include object.
@private
@memberOf {Serializer}
@param {Object} relationship
@param {String} key
@param {String} fk
@param {String} type
@param {Object} includedRelations
@param {Object} options
@return {Object} | [
"Creates",
"a",
"compound",
"include",
"object",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/serializer.js#L477-L508 | train |
digitalsadhu/loopback-component-jsonapi | lib/utils.js | pluralForModel | function pluralForModel (model) {
if (model.pluralModelName) {
return model.pluralModelName
}
if (model.settings && model.settings.plural) {
return model.settings.plural
}
if (
model.definition &&
model.definition.settings &&
model.definition.settings.plural
) {
return model.defini... | javascript | function pluralForModel (model) {
if (model.pluralModelName) {
return model.pluralModelName
}
if (model.settings && model.settings.plural) {
return model.settings.plural
}
if (
model.definition &&
model.definition.settings &&
model.definition.settings.plural
) {
return model.defini... | [
"function",
"pluralForModel",
"(",
"model",
")",
"{",
"if",
"(",
"model",
".",
"pluralModelName",
")",
"{",
"return",
"model",
".",
"pluralModelName",
"}",
"if",
"(",
"model",
".",
"settings",
"&&",
"model",
".",
"settings",
".",
"plural",
")",
"{",
"ret... | Returns the plural for a model.
@public
@memberOf {Utils}
@param {Object} model
@return {String} | [
"Returns",
"the",
"plural",
"for",
"a",
"model",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/utils.js#L40-L58 | train |
digitalsadhu/loopback-component-jsonapi | lib/utils.js | httpPathForModel | function httpPathForModel (model) {
if (model.settings && model.settings.http && model.settings.http.path) {
return model.settings.http.path
}
return pluralForModel(model)
} | javascript | function httpPathForModel (model) {
if (model.settings && model.settings.http && model.settings.http.path) {
return model.settings.http.path
}
return pluralForModel(model)
} | [
"function",
"httpPathForModel",
"(",
"model",
")",
"{",
"if",
"(",
"model",
".",
"settings",
"&&",
"model",
".",
"settings",
".",
"http",
"&&",
"model",
".",
"settings",
".",
"http",
".",
"path",
")",
"{",
"return",
"model",
".",
"settings",
".",
"http... | Returns the plural path for a model
@public
@memberOf {Utils}
@param {Object} model
@return {String} | [
"Returns",
"the",
"plural",
"path",
"for",
"a",
"model"
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/utils.js#L67-L72 | train |
digitalsadhu/loopback-component-jsonapi | lib/utils.js | urlFromContext | function urlFromContext (context) {
return context.req.protocol +
'://' +
context.req.get('host') +
context.req.originalUrl
} | javascript | function urlFromContext (context) {
return context.req.protocol +
'://' +
context.req.get('host') +
context.req.originalUrl
} | [
"function",
"urlFromContext",
"(",
"context",
")",
"{",
"return",
"context",
".",
"req",
".",
"protocol",
"+",
"'://'",
"+",
"context",
".",
"req",
".",
"get",
"(",
"'host'",
")",
"+",
"context",
".",
"req",
".",
"originalUrl",
"}"
] | Returns the fully qualified request url
@public
@memberOf {Utils}
@param {Object} context
@return {String} | [
"Returns",
"the",
"fully",
"qualified",
"request",
"url"
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/utils.js#L114-L119 | train |
digitalsadhu/loopback-component-jsonapi | lib/utils.js | getModelFromContext | function getModelFromContext (context, app) {
var type = getTypeFromContext(context)
if (app.models[type]) return app.models[type]
var name = modelNameFromContext(context)
return app.models[name]
} | javascript | function getModelFromContext (context, app) {
var type = getTypeFromContext(context)
if (app.models[type]) return app.models[type]
var name = modelNameFromContext(context)
return app.models[name]
} | [
"function",
"getModelFromContext",
"(",
"context",
",",
"app",
")",
"{",
"var",
"type",
"=",
"getTypeFromContext",
"(",
"context",
")",
"if",
"(",
"app",
".",
"models",
"[",
"type",
"]",
")",
"return",
"app",
".",
"models",
"[",
"type",
"]",
"var",
"na... | Returns a model from the app object.
@public
@memberOf {Utils}
@param {Object} context
@param {Object} app
@return {Object} | [
"Returns",
"a",
"model",
"from",
"the",
"app",
"object",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/utils.js#L129-L135 | train |
digitalsadhu/loopback-component-jsonapi | lib/utils.js | getTypeFromContext | function getTypeFromContext (context) {
if (!context.method.returns) return undefined
const returns = [].concat(context.method.returns)
for (var i = 0, l = returns.length; i < l; i++) {
if (typeof returns[i] !== 'object' || returns[i].root !== true) continue
return returns[i].type
}
} | javascript | function getTypeFromContext (context) {
if (!context.method.returns) return undefined
const returns = [].concat(context.method.returns)
for (var i = 0, l = returns.length; i < l; i++) {
if (typeof returns[i] !== 'object' || returns[i].root !== true) continue
return returns[i].type
}
} | [
"function",
"getTypeFromContext",
"(",
"context",
")",
"{",
"if",
"(",
"!",
"context",
".",
"method",
".",
"returns",
")",
"return",
"undefined",
"const",
"returns",
"=",
"[",
"]",
".",
"concat",
"(",
"context",
".",
"method",
".",
"returns",
")",
"for",... | Returns a model type from the context object.
Infer the type from the `root` returns in the remote.
@public
@memberOf {Utils}
@param {Object} context
@param {Object} app
@return {String} | [
"Returns",
"a",
"model",
"type",
"from",
"the",
"context",
"object",
".",
"Infer",
"the",
"type",
"from",
"the",
"root",
"returns",
"in",
"the",
"remote",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/utils.js#L146-L154 | train |
digitalsadhu/loopback-component-jsonapi | lib/utils.js | buildModelUrl | function buildModelUrl (protocol, host, apiRoot, modelName, id) {
var result
try {
result = url.format({
protocol: protocol,
host: host,
pathname: url.resolve('/', [apiRoot, modelName, id].join('/'))
})
} catch (e) {
return ''
}
return result
} | javascript | function buildModelUrl (protocol, host, apiRoot, modelName, id) {
var result
try {
result = url.format({
protocol: protocol,
host: host,
pathname: url.resolve('/', [apiRoot, modelName, id].join('/'))
})
} catch (e) {
return ''
}
return result
} | [
"function",
"buildModelUrl",
"(",
"protocol",
",",
"host",
",",
"apiRoot",
",",
"modelName",
",",
"id",
")",
"{",
"var",
"result",
"try",
"{",
"result",
"=",
"url",
".",
"format",
"(",
"{",
"protocol",
":",
"protocol",
",",
"host",
":",
"host",
",",
... | Builds a models url
@public
@memberOf {Utils}
@param {String} protocol
@param {String} host
@param {String} apiRoot
@param {String} modelName
@param {String|Number} id
@return {String} | [
"Builds",
"a",
"models",
"url"
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/utils.js#L201-L215 | train |
digitalsadhu/loopback-component-jsonapi | lib/deserialize.js | validateRequest | function validateRequest (data, requestMethod) {
if (!data.data) {
return 'JSON API resource object must contain `data` property'
}
if (!data.data.type) {
return 'JSON API resource object must contain `data.type` property'
}
if (['PATCH', 'PUT'].indexOf(requestMethod) > -1 && !data.data.id) {
re... | javascript | function validateRequest (data, requestMethod) {
if (!data.data) {
return 'JSON API resource object must contain `data` property'
}
if (!data.data.type) {
return 'JSON API resource object must contain `data.type` property'
}
if (['PATCH', 'PUT'].indexOf(requestMethod) > -1 && !data.data.id) {
re... | [
"function",
"validateRequest",
"(",
"data",
",",
"requestMethod",
")",
"{",
"if",
"(",
"!",
"data",
".",
"data",
")",
"{",
"return",
"'JSON API resource object must contain `data` property'",
"}",
"if",
"(",
"!",
"data",
".",
"data",
".",
"type",
")",
"{",
"... | Check for errors in the request. If it has an error it will return a string, otherwise false.
@private
@memberOf {Deserialize}
@param {Object} data
@param {String} requestMethod
@return {String|false} | [
"Check",
"for",
"errors",
"in",
"the",
"request",
".",
"If",
"it",
"has",
"an",
"error",
"it",
"will",
"return",
"a",
"string",
"otherwise",
"false",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/deserialize.js#L119-L133 | train |
digitalsadhu/loopback-component-jsonapi | lib/utilities/relationship-utils.js | getInvalidIncludesError | function getInvalidIncludesError (message) {
var error = new Error(
message || 'JSON API resource does not support `include`'
)
error.statusCode = statusCodes.BAD_REQUEST
error.code = statusCodes.BAD_REQUEST
error.status = statusCodes.BAD_REQUEST
return error
} | javascript | function getInvalidIncludesError (message) {
var error = new Error(
message || 'JSON API resource does not support `include`'
)
error.statusCode = statusCodes.BAD_REQUEST
error.code = statusCodes.BAD_REQUEST
error.status = statusCodes.BAD_REQUEST
return error
} | [
"function",
"getInvalidIncludesError",
"(",
"message",
")",
"{",
"var",
"error",
"=",
"new",
"Error",
"(",
"message",
"||",
"'JSON API resource does not support `include`'",
")",
"error",
".",
"statusCode",
"=",
"statusCodes",
".",
"BAD_REQUEST",
"error",
".",
"code... | Get the invalid includes error.
@public
@memberOf {RelationshipUtils}
@param {String} message
@return {Error} | [
"Get",
"the",
"invalid",
"includes",
"error",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/utilities/relationship-utils.js#L36-L45 | train |
digitalsadhu/loopback-component-jsonapi | lib/utilities/relationship-utils.js | getIncludesArray | function getIncludesArray (query) {
var relationships = query.include.split(',')
return relationships.map(function (val) {
return val.trim()
})
} | javascript | function getIncludesArray (query) {
var relationships = query.include.split(',')
return relationships.map(function (val) {
return val.trim()
})
} | [
"function",
"getIncludesArray",
"(",
"query",
")",
"{",
"var",
"relationships",
"=",
"query",
".",
"include",
".",
"split",
"(",
"','",
")",
"return",
"relationships",
".",
"map",
"(",
"function",
"(",
"val",
")",
"{",
"return",
"val",
".",
"trim",
"(",
... | Returns an array of relationships to include. Per JSON specification, they will
be in a comma-separated pattern.
@public
@memberOf {RelationshipUtils}
@param {Object} query
@return {Array} | [
"Returns",
"an",
"array",
"of",
"relationships",
"to",
"include",
".",
"Per",
"JSON",
"specification",
"they",
"will",
"be",
"in",
"a",
"comma",
"-",
"separated",
"pattern",
"."
] | a7083aad413b3404bc1466650b20b6437983133a | https://github.com/digitalsadhu/loopback-component-jsonapi/blob/a7083aad413b3404bc1466650b20b6437983133a/lib/utilities/relationship-utils.js#L75-L81 | train |
jviereck/regjsparser | parser.js | isIdentifierPart | function isIdentifierPart(ch) {
// Generated by `tools/generate-identifier-regex.js`.
var NonAsciiIdentifierPartOnly = /[0-9_\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u... | javascript | function isIdentifierPart(ch) {
// Generated by `tools/generate-identifier-regex.js`.
var NonAsciiIdentifierPartOnly = /[0-9_\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u... | [
"function",
"isIdentifierPart",
"(",
"ch",
")",
"{",
"// Generated by `tools/generate-identifier-regex.js`.",
"var",
"NonAsciiIdentifierPartOnly",
"=",
"/",
"[0-9_\\xB7\\u0300-\\u036F\\u0387\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u0669\\... | Taken from the Esprima parser. | [
"Taken",
"from",
"the",
"Esprima",
"parser",
"."
] | 0f12db12eb2ecb67143979ddba275c4aa87c40b2 | https://github.com/jviereck/regjsparser/blob/0f12db12eb2ecb67143979ddba275c4aa87c40b2/parser.js#L933-L940 | train |
Nike-Inc/lambda-logger-node | src/logger.js | Logger | function Logger ({
minimumLogLevel = null,
formatter = JsonFormatter,
useBearerRedactor = true,
useGlobalErrorHandler = true,
forceGlobalErrorHandler = false,
redactors = []
} = {}) {
const context = {
minimumLogLevel,
formatter,
events: new EventEmitter(),
contextPath: [],
keys: new M... | javascript | function Logger ({
minimumLogLevel = null,
formatter = JsonFormatter,
useBearerRedactor = true,
useGlobalErrorHandler = true,
forceGlobalErrorHandler = false,
redactors = []
} = {}) {
const context = {
minimumLogLevel,
formatter,
events: new EventEmitter(),
contextPath: [],
keys: new M... | [
"function",
"Logger",
"(",
"{",
"minimumLogLevel",
"=",
"null",
",",
"formatter",
"=",
"JsonFormatter",
",",
"useBearerRedactor",
"=",
"true",
",",
"useGlobalErrorHandler",
"=",
"true",
",",
"forceGlobalErrorHandler",
"=",
"false",
",",
"redactors",
"=",
"[",
"]... | Construct a new logger. Does not require "new".
@param {Object} [{
minimumLogLevel = null,
formatter = JsonFormatter,
useBearerRedactor = true,
useGlobalErrorHandler = true,
redactors = []
}={}] options
@param {Boolean} [null] options.minimumLogLevel hide log entries of lower severity
@param {Formatter} [JsonFormatter... | [
"Construct",
"a",
"new",
"logger",
".",
"Does",
"not",
"require",
"new",
"."
] | 6ec8ca98241e74882c225cdcb4306e942541b4ab | https://github.com/Nike-Inc/lambda-logger-node/blob/6ec8ca98241e74882c225cdcb4306e942541b4ab/src/logger.js#L43-L75 | 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.