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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(o) {
return gui.Type.isGuiClass(o) &&
gui.Class.ancestorsAndSelf(o).some(function(C) {
return C === edb.Object || C === edb.Array;
});
} | javascript | function(o) {
return gui.Type.isGuiClass(o) &&
gui.Class.ancestorsAndSelf(o).some(function(C) {
return C === edb.Object || C === edb.Array;
});
} | [
"function",
"(",
"o",
")",
"{",
"return",
"gui",
".",
"Type",
".",
"isGuiClass",
"(",
"o",
")",
"&&",
"gui",
".",
"Class",
".",
"ancestorsAndSelf",
"(",
"o",
")",
".",
"some",
"(",
"function",
"(",
"C",
")",
"{",
"return",
"C",
"===",
"edb",
".",... | Something is a Type constructor?
@param {object} o
@returns {boolean} | [
"Something",
"is",
"a",
"Type",
"constructor?"
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L187-L192 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
return Array.map(this, function(thing) {
if (edb.Type.is(thing)) {
return thing.toJSON();
}
return thing;
});
} | javascript | function() {
return Array.map(this, function(thing) {
if (edb.Type.is(thing)) {
return thing.toJSON();
}
return thing;
});
} | [
"function",
"(",
")",
"{",
"return",
"Array",
".",
"map",
"(",
"this",
",",
"function",
"(",
"thing",
")",
"{",
"if",
"(",
"edb",
".",
"Type",
".",
"is",
"(",
"thing",
")",
")",
"{",
"return",
"thing",
".",
"toJSON",
"(",
")",
";",
"}",
"return... | Create true array without expando properties, recursively
normalizing nested EDB types. Returns the type of array we
would typically transmit back to the server or something.
@returns {Array} | [
"Create",
"true",
"array",
"without",
"expando",
"properties",
"recursively",
"normalizing",
"nested",
"EDB",
"types",
".",
"Returns",
"the",
"type",
"of",
"array",
"we",
"would",
"typically",
"transmit",
"back",
"to",
"the",
"server",
"or",
"something",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L746-L753 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | observes | function observes(array) {
var key = array.$instanceid;
return edb.Array._observers[key] ? true : false;
} | javascript | function observes(array) {
var key = array.$instanceid;
return edb.Array._observers[key] ? true : false;
} | [
"function",
"observes",
"(",
"array",
")",
"{",
"var",
"key",
"=",
"array",
".",
"$instanceid",
";",
"return",
"edb",
".",
"Array",
".",
"_observers",
"[",
"key",
"]",
"?",
"true",
":",
"false",
";",
"}"
] | Array is being observed?
@param {edb.Array} array
@returns {boolean} | [
"Array",
"is",
"being",
"observed?"
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L786-L789 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(tick) {
var snapshot, handlers, observers = this._observers;
if (tick.type === edb.TICK_PUBLISH_CHANGES) {
snapshot = gui.Object.copy(this._changes);
this._changes = Object.create(null);
gui.Object.each(snapshot, function(instanceid, changes) {
if ((handlers = observers[instanceid])) {
ha... | javascript | function(tick) {
var snapshot, handlers, observers = this._observers;
if (tick.type === edb.TICK_PUBLISH_CHANGES) {
snapshot = gui.Object.copy(this._changes);
this._changes = Object.create(null);
gui.Object.each(snapshot, function(instanceid, changes) {
if ((handlers = observers[instanceid])) {
ha... | [
"function",
"(",
"tick",
")",
"{",
"var",
"snapshot",
",",
"handlers",
",",
"observers",
"=",
"this",
".",
"_observers",
";",
"if",
"(",
"tick",
".",
"type",
"===",
"edb",
".",
"TICK_PUBLISH_CHANGES",
")",
"{",
"snapshot",
"=",
"gui",
".",
"Object",
".... | Publishing change summaries async.
@param {gui.Tick} tick | [
"Publishing",
"change",
"summaries",
"async",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L822-L835 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | decorateAccess | function decorateAccess(proto, methods) {
methods.forEach(function(method) {
proto[method] = beforeaccess(proto[method]);
});
} | javascript | function decorateAccess(proto, methods) {
methods.forEach(function(method) {
proto[method] = beforeaccess(proto[method]);
});
} | [
"function",
"decorateAccess",
"(",
"proto",
",",
"methods",
")",
"{",
"methods",
".",
"forEach",
"(",
"function",
"(",
"method",
")",
"{",
"proto",
"[",
"method",
"]",
"=",
"beforeaccess",
"(",
"proto",
"[",
"method",
"]",
")",
";",
"}",
")",
";",
"}... | Decorate getter methods on prototype.
@param {object} proto Prototype to decorate
@param {Array<String>} methods List of method names
@returns {object} | [
"Decorate",
"getter",
"methods",
"on",
"prototype",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L906-L910 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | lookupDescriptor | function lookupDescriptor(proto, key) {
if (proto.hasOwnProperty(key)) {
return Object.getOwnPropertyDescriptor(proto, key);
} else if ((proto = Object.getPrototypeOf(proto))) {
return lookupDescriptor(proto, key);
} else {
return null;
}
} | javascript | function lookupDescriptor(proto, key) {
if (proto.hasOwnProperty(key)) {
return Object.getOwnPropertyDescriptor(proto, key);
} else if ((proto = Object.getPrototypeOf(proto))) {
return lookupDescriptor(proto, key);
} else {
return null;
}
} | [
"function",
"lookupDescriptor",
"(",
"proto",
",",
"key",
")",
"{",
"if",
"(",
"proto",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"return",
"Object",
".",
"getOwnPropertyDescriptor",
"(",
"proto",
",",
"key",
")",
";",
"}",
"else",
"if",
"(",
"... | Lookup property descriptor for key.
@param {object} proto
@param {string} key
@returns {object} | [
"Lookup",
"property",
"descriptor",
"for",
"key",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L1053-L1061 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | guidedconvert | function guidedconvert(args, array) {
return args.map(function(o) {
if (o !== undefined) {
if (gui.Type.isConstructor(array.$of)) {
o = constructas(array.$of, o);
} else {
o = filterfrom(function(x) {
return array.$of(x);
}, o);
}
}
return o;
});
} | javascript | function guidedconvert(args, array) {
return args.map(function(o) {
if (o !== undefined) {
if (gui.Type.isConstructor(array.$of)) {
o = constructas(array.$of, o);
} else {
o = filterfrom(function(x) {
return array.$of(x);
}, o);
}
}
return o;
});
} | [
"function",
"guidedconvert",
"(",
"args",
",",
"array",
")",
"{",
"return",
"args",
".",
"map",
"(",
"function",
"(",
"o",
")",
"{",
"if",
"(",
"o",
"!==",
"undefined",
")",
"{",
"if",
"(",
"gui",
".",
"Type",
".",
"isConstructor",
"(",
"array",
".... | Convert via constructor or via filter
function which returns a constructor.
@param {Array} args
@param {edb.Array} array
@returns {Array<edb.Type>} | [
"Convert",
"via",
"constructor",
"or",
"via",
"filter",
"function",
"which",
"returns",
"a",
"constructor",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L1244-L1257 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(array, args) {
args = gui.Array.from(args);
if (!gui.Type.isNull(array.$of)) {
if (gui.Type.isFunction(array.$of)) {
return guidedconvert(args, array);
} else {
var type = gui.Type.of(array.$of);
throw new Error(array + ' cannot be $of ' + type);
}
} else {
return autoco... | javascript | function(array, args) {
args = gui.Array.from(args);
if (!gui.Type.isNull(array.$of)) {
if (gui.Type.isFunction(array.$of)) {
return guidedconvert(args, array);
} else {
var type = gui.Type.of(array.$of);
throw new Error(array + ' cannot be $of ' + type);
}
} else {
return autoco... | [
"function",
"(",
"array",
",",
"args",
")",
"{",
"args",
"=",
"gui",
".",
"Array",
".",
"from",
"(",
"args",
")",
";",
"if",
"(",
"!",
"gui",
".",
"Type",
".",
"isNull",
"(",
"array",
".",
"$of",
")",
")",
"{",
"if",
"(",
"gui",
".",
"Type",
... | Convert arguments.
@param {edb.Array} array
@param {Arguments|array} args
@returns {Array} | [
"Convert",
"arguments",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L1310-L1322 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | getter | function getter(key, base) {
return function() {
var result = base.apply(this);
if (edb.$accessaware && !suspend) {
edb.Object.$onaccess(this, key);
}
return result;
};
} | javascript | function getter(key, base) {
return function() {
var result = base.apply(this);
if (edb.$accessaware && !suspend) {
edb.Object.$onaccess(this, key);
}
return result;
};
} | [
"function",
"getter",
"(",
"key",
",",
"base",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"result",
"=",
"base",
".",
"apply",
"(",
"this",
")",
";",
"if",
"(",
"edb",
".",
"$accessaware",
"&&",
"!",
"suspend",
")",
"{",
"edb",
".",
"O... | Create observable getter for key.
@param {String} key
@param {function} base
@returns {function} | [
"Create",
"observable",
"getter",
"for",
"key",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L1347-L1355 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(type, target) {
var handler, input = this._configure(type.constructor, type);
if (target) {
console.error("Deprecated API is deprecated", target.spirit);
if ((handler = target.$oninput || target.oninput)) {
handler.call(target, input);
}
} else {
gui.Broadcast.dispatch(edb.BROADCAST_OUTPU... | javascript | function(type, target) {
var handler, input = this._configure(type.constructor, type);
if (target) {
console.error("Deprecated API is deprecated", target.spirit);
if ((handler = target.$oninput || target.oninput)) {
handler.call(target, input);
}
} else {
gui.Broadcast.dispatch(edb.BROADCAST_OUTPU... | [
"function",
"(",
"type",
",",
"target",
")",
"{",
"var",
"handler",
",",
"input",
"=",
"this",
".",
"_configure",
"(",
"type",
".",
"constructor",
",",
"type",
")",
";",
"if",
"(",
"target",
")",
"{",
"console",
".",
"error",
"(",
"\"Deprecated API is ... | Output Type instance.
@returns {edb.Object|edb.Array}
@param @optional {object} target
TODO: rename to 'output'? | [
"Output",
"Type",
"instance",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L1649-L1659 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(Type) {
if (Type) {
if (this._map) {
var classid = Type.$classid;
var typeobj = this._map[classid];
return typeobj ? true : false;
}
return false;
} else {
throw new Error("Something is undefined");
}
} | javascript | function(Type) {
if (Type) {
if (this._map) {
var classid = Type.$classid;
var typeobj = this._map[classid];
return typeobj ? true : false;
}
return false;
} else {
throw new Error("Something is undefined");
}
} | [
"function",
"(",
"Type",
")",
"{",
"if",
"(",
"Type",
")",
"{",
"if",
"(",
"this",
".",
"_map",
")",
"{",
"var",
"classid",
"=",
"Type",
".",
"$classid",
";",
"var",
"typeobj",
"=",
"this",
".",
"_map",
"[",
"classid",
"]",
";",
"return",
"typeob... | Instance of given Type has been output to context?
@param {function} type Type constructor
@returns {boolean} | [
"Instance",
"of",
"given",
"Type",
"has",
"been",
"output",
"to",
"context?"
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L1681-L1692 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(Type, type) {
var classid = Type.$classid;
this._map[classid] = type;
return new edb.Input(Type, type);
} | javascript | function(Type, type) {
var classid = Type.$classid;
this._map[classid] = type;
return new edb.Input(Type, type);
} | [
"function",
"(",
"Type",
",",
"type",
")",
"{",
"var",
"classid",
"=",
"Type",
".",
"$classid",
";",
"this",
".",
"_map",
"[",
"classid",
"]",
"=",
"type",
";",
"return",
"new",
"edb",
".",
"Input",
"(",
"Type",
",",
"type",
")",
";",
"}"
] | Configure Type instance for output.
@param {function} Type constructor
@param {edb.Object|edb.Array} type instance
@returns {edb.Input} | [
"Configure",
"Type",
"instance",
"for",
"output",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L1709-L1713 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(type, filter, tabs) {
if (isType(type)) {
return JSON.stringify(parse(type), filter, tabs);
} else {
throw new TypeError("Expected edb.Object|edb.Array");
}
} | javascript | function(type, filter, tabs) {
if (isType(type)) {
return JSON.stringify(parse(type), filter, tabs);
} else {
throw new TypeError("Expected edb.Object|edb.Array");
}
} | [
"function",
"(",
"type",
",",
"filter",
",",
"tabs",
")",
"{",
"if",
"(",
"isType",
"(",
"type",
")",
")",
"{",
"return",
"JSON",
".",
"stringify",
"(",
"parse",
"(",
"type",
")",
",",
"filter",
",",
"tabs",
")",
";",
"}",
"else",
"{",
"throw",
... | Serialize type.
@param {edb.Object|edb.Array} type
@param @optional {function} filter
@param @optional {String|number} tabs
@returns {String} | [
"Serialize",
"type",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L1818-L1824 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | asObject | function asObject(type) {
var map = gui.Object.map(type, mapObject, type);
return {
$object: gui.Object.extend({
$classname: type.$classname,
$instanceid: type.$instanceid,
$originalid: type.$originalid
}, map)
};
} | javascript | function asObject(type) {
var map = gui.Object.map(type, mapObject, type);
return {
$object: gui.Object.extend({
$classname: type.$classname,
$instanceid: type.$instanceid,
$originalid: type.$originalid
}, map)
};
} | [
"function",
"asObject",
"(",
"type",
")",
"{",
"var",
"map",
"=",
"gui",
".",
"Object",
".",
"map",
"(",
"type",
",",
"mapObject",
",",
"type",
")",
";",
"return",
"{",
"$object",
":",
"gui",
".",
"Object",
".",
"extend",
"(",
"{",
"$classname",
":... | Compute object node.
@param {edb.Object|edb.Array} type
@returns {object} | [
"Compute",
"object",
"node",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L1863-L1872 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | mapObject | function mapObject(key, value) {
var c = key.charAt(0);
if (c === "_" || c === "$") {
return undefined;
} else if (isArray(this) && key.match(INTRINSIC)) {
return undefined;
} else if (isType(value)) {
return parse(value);
} else if (gui.Type.isComplex(value)) {
switch (value.constructor) {
ca... | javascript | function mapObject(key, value) {
var c = key.charAt(0);
if (c === "_" || c === "$") {
return undefined;
} else if (isArray(this) && key.match(INTRINSIC)) {
return undefined;
} else if (isType(value)) {
return parse(value);
} else if (gui.Type.isComplex(value)) {
switch (value.constructor) {
ca... | [
"function",
"mapObject",
"(",
"key",
",",
"value",
")",
"{",
"var",
"c",
"=",
"key",
".",
"charAt",
"(",
"0",
")",
";",
"if",
"(",
"c",
"===",
"\"_\"",
"||",
"c",
"===",
"\"$\"",
")",
"{",
"return",
"undefined",
";",
"}",
"else",
"if",
"(",
"is... | Map the object properties of a type.
- Skip private (underscore) fields.
- Skip all array intrinsic properties.
- Skip what looks like instance objects.
- Skip getters and setters.
@param {String} key
@param {object} value | [
"Map",
"the",
"object",
"properties",
"of",
"a",
"type",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L1895-L1920 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | mapArray | function mapArray(type) {
return Array.map(type, function(thing) {
return isType(thing) ? parse(thing) : thing;
});
} | javascript | function mapArray(type) {
return Array.map(type, function(thing) {
return isType(thing) ? parse(thing) : thing;
});
} | [
"function",
"mapArray",
"(",
"type",
")",
"{",
"return",
"Array",
".",
"map",
"(",
"type",
",",
"function",
"(",
"thing",
")",
"{",
"return",
"isType",
"(",
"thing",
")",
"?",
"parse",
"(",
"thing",
")",
":",
"thing",
";",
"}",
")",
";",
"}"
] | Map array members.
@param {edb.Array} type | [
"Map",
"array",
"members",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L1926-L1930 | train |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(input) {
var needstesting = !this._matches.length;
if (needstesting || this._matches.every(function(match) {
return match.$instanceid !== input.$instanceid;
})) {
return this._maybeinput(input);
}
return false;
} | javascript | function(input) {
var needstesting = !this._matches.length;
if (needstesting || this._matches.every(function(match) {
return match.$instanceid !== input.$instanceid;
})) {
return this._maybeinput(input);
}
return false;
} | [
"function",
"(",
"input",
")",
"{",
"var",
"needstesting",
"=",
"!",
"this",
".",
"_matches",
".",
"length",
";",
"if",
"(",
"needstesting",
"||",
"this",
".",
"_matches",
".",
"every",
"(",
"function",
"(",
"match",
")",
"{",
"return",
"match",
".",
... | Collect matching input.
@param {edb.Input} input | [
"Collect",
"matching",
"input",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2153-L2161 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(types, handler, required) {
types.forEach(function(Type) {
if (gui.Type.isDefined(Type)) {
this._addchecks(Type.$classid, [handler]);
this._watches.push(Type);
if (required) {
this._needing.push(Type);
}
} else {
throw new TypeError("Could not register input for undefined Type"... | javascript | function(types, handler, required) {
types.forEach(function(Type) {
if (gui.Type.isDefined(Type)) {
this._addchecks(Type.$classid, [handler]);
this._watches.push(Type);
if (required) {
this._needing.push(Type);
}
} else {
throw new TypeError("Could not register input for undefined Type"... | [
"function",
"(",
"types",
",",
"handler",
",",
"required",
")",
"{",
"types",
".",
"forEach",
"(",
"function",
"(",
"Type",
")",
"{",
"if",
"(",
"gui",
".",
"Type",
".",
"isDefined",
"(",
"Type",
")",
")",
"{",
"this",
".",
"_addchecks",
"(",
"Type... | Add input handler for types.
@param {Array<function>} types
@param {IInputHandler} handler
@param {boolean} required | [
"Add",
"input",
"handler",
"for",
"types",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2206-L2225 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(types, handler) {
types.forEach(function(Type) {
gui.Array.remove(this._watches, Type);
gui.Array.remove(this._needing, Type);
this._removechecks(Type.$classid, [handler]);
if (!this._watches.length) {
this._subscribe(false);
}
}, this);
} | javascript | function(types, handler) {
types.forEach(function(Type) {
gui.Array.remove(this._watches, Type);
gui.Array.remove(this._needing, Type);
this._removechecks(Type.$classid, [handler]);
if (!this._watches.length) {
this._subscribe(false);
}
}, this);
} | [
"function",
"(",
"types",
",",
"handler",
")",
"{",
"types",
".",
"forEach",
"(",
"function",
"(",
"Type",
")",
"{",
"gui",
".",
"Array",
".",
"remove",
"(",
"this",
".",
"_watches",
",",
"Type",
")",
";",
"gui",
".",
"Array",
".",
"remove",
"(",
... | Remove input handler for types.
@param {Array<function>} types
@param {IInputHandler} handler | [
"Remove",
"input",
"handler",
"for",
"types",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2232-L2241 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(input) {
var best = edb.InputPlugin._bestmatch(input.type, this._watches, true);
if (best) {
this._updatematch(input, best);
this.done = this._done();
this._updatehandlers(input);
return true;
}
return false;
} | javascript | function(input) {
var best = edb.InputPlugin._bestmatch(input.type, this._watches, true);
if (best) {
this._updatematch(input, best);
this.done = this._done();
this._updatehandlers(input);
return true;
}
return false;
} | [
"function",
"(",
"input",
")",
"{",
"var",
"best",
"=",
"edb",
".",
"InputPlugin",
".",
"_bestmatch",
"(",
"input",
".",
"type",
",",
"this",
".",
"_watches",
",",
"true",
")",
";",
"if",
"(",
"best",
")",
"{",
"this",
".",
"_updatematch",
"(",
"in... | If input matches registered type, update handlers.
@param {edb.Input} input | [
"If",
"input",
"matches",
"registered",
"type",
"update",
"handlers",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2247-L2256 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(input) {
var matches = this._matches;
var watches = this._watches;
var best = edb.InputPlugin._bestmatch(input.type, watches, true);
if (best) {
var oldinput = matches.filter(function(input) {
return input.type === best;
})[0];
var index = matches.indexOf(oldinput);
matches.splice(index... | javascript | function(input) {
var matches = this._matches;
var watches = this._watches;
var best = edb.InputPlugin._bestmatch(input.type, watches, true);
if (best) {
var oldinput = matches.filter(function(input) {
return input.type === best;
})[0];
var index = matches.indexOf(oldinput);
matches.splice(index... | [
"function",
"(",
"input",
")",
"{",
"var",
"matches",
"=",
"this",
".",
"_matches",
";",
"var",
"watches",
"=",
"this",
".",
"_watches",
";",
"var",
"best",
"=",
"edb",
".",
"InputPlugin",
".",
"_bestmatch",
"(",
"input",
".",
"type",
",",
"watches",
... | Evaluate revoked output.
@param {edb.Input} input | [
"Evaluate",
"revoked",
"output",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2262-L2278 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(input) {
gui.Class.ancestorsAndSelf(input.type, function(Type) {
var list = this._trackedtypes[Type.$classid];
if (list) {
list.forEach(function(checks) {
var handler = checks[0];
handler.oninput(input);
});
}
}, this);
} | javascript | function(input) {
gui.Class.ancestorsAndSelf(input.type, function(Type) {
var list = this._trackedtypes[Type.$classid];
if (list) {
list.forEach(function(checks) {
var handler = checks[0];
handler.oninput(input);
});
}
}, this);
} | [
"function",
"(",
"input",
")",
"{",
"gui",
".",
"Class",
".",
"ancestorsAndSelf",
"(",
"input",
".",
"type",
",",
"function",
"(",
"Type",
")",
"{",
"var",
"list",
"=",
"this",
".",
"_trackedtypes",
"[",
"Type",
".",
"$classid",
"]",
";",
"if",
"(",
... | Update input handlers.
@param {edb.Input} input | [
"Update",
"input",
"handlers",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2307-L2317 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
var needs = this._needing;
var haves = this._matches;
return needs.every(function(Type) {
return haves.some(function(input) {
return (input.data instanceof Type);
});
});
} | javascript | function() {
var needs = this._needing;
var haves = this._matches;
return needs.every(function(Type) {
return haves.some(function(input) {
return (input.data instanceof Type);
});
});
} | [
"function",
"(",
")",
"{",
"var",
"needs",
"=",
"this",
".",
"_needing",
";",
"var",
"haves",
"=",
"this",
".",
"_matches",
";",
"return",
"needs",
".",
"every",
"(",
"function",
"(",
"Type",
")",
"{",
"return",
"haves",
".",
"some",
"(",
"function",... | All required inputs has been aquired?
@returns {boolean} | [
"All",
"required",
"inputs",
"has",
"been",
"aquired?"
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2323-L2331 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(arg, context) {
switch (gui.Type.of(arg)) {
case "function":
return [arg];
case "string":
return this._breakarray(arg.split(" "), context);
case "object":
console.error("Expected function. Got object.");
}
} | javascript | function(arg, context) {
switch (gui.Type.of(arg)) {
case "function":
return [arg];
case "string":
return this._breakarray(arg.split(" "), context);
case "object":
console.error("Expected function. Got object.");
}
} | [
"function",
"(",
"arg",
",",
"context",
")",
"{",
"switch",
"(",
"gui",
".",
"Type",
".",
"of",
"(",
"arg",
")",
")",
"{",
"case",
"\"function\"",
":",
"return",
"[",
"arg",
"]",
";",
"case",
"\"string\"",
":",
"return",
"this",
".",
"_breakarray",
... | Breakdown unarray.
@param {function|String|object} arg
@returns {Array<function>}
@param {Window} context
@returns {Array<function>} | [
"Breakdown",
"unarray",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2384-L2393 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(target, types, up, action) {
types.forEach(function(type) {
action(type, this._rateone(
up ? target : type, up ? type : target
));
}, this);
} | javascript | function(target, types, up, action) {
types.forEach(function(type) {
action(type, this._rateone(
up ? target : type, up ? type : target
));
}, this);
} | [
"function",
"(",
"target",
",",
"types",
",",
"up",
",",
"action",
")",
"{",
"types",
".",
"forEach",
"(",
"function",
"(",
"type",
")",
"{",
"action",
"(",
"type",
",",
"this",
".",
"_rateone",
"(",
"up",
"?",
"target",
":",
"type",
",",
"up",
"... | Rate all types.
@param {function} t
@param {Array<function>} types
@param {boolean} up Rate ancestor?
@param {function} action | [
"Rate",
"all",
"types",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2421-L2427 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(id) {
var config, script;
return {
as: function($edbml) {
config = edbml.$runtimeconfigure($edbml);
script = gui.Object.assert(id, config);
script.$bind = function() {
console.error('Deprecated API is deprecated: $bind');
};
script.lock = function(out) {
return script({
... | javascript | function(id) {
var config, script;
return {
as: function($edbml) {
config = edbml.$runtimeconfigure($edbml);
script = gui.Object.assert(id, config);
script.$bind = function() {
console.error('Deprecated API is deprecated: $bind');
};
script.lock = function(out) {
return script({
... | [
"function",
"(",
"id",
")",
"{",
"var",
"config",
",",
"script",
";",
"return",
"{",
"as",
":",
"function",
"(",
"$edbml",
")",
"{",
"config",
"=",
"edbml",
".",
"$runtimeconfigure",
"(",
"$edbml",
")",
";",
"script",
"=",
"gui",
".",
"Object",
".",
... | EDBML script declaration micro DSL.
@param {String} id | [
"EDBML",
"script",
"declaration",
"micro",
"DSL",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2506-L2526 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function($edbml) {
return function configured($in) {
$edbml.$out = ($in && $in.$out) ? $in.$out : new edbml.Out();
$edbml.$att = new edbml.Att();
$edbml.$input = function(Type) {
return this.script.$input.get(Type);
}.bind(this);
return $edbml.apply(this, arguments);
};
} | javascript | function($edbml) {
return function configured($in) {
$edbml.$out = ($in && $in.$out) ? $in.$out : new edbml.Out();
$edbml.$att = new edbml.Att();
$edbml.$input = function(Type) {
return this.script.$input.get(Type);
}.bind(this);
return $edbml.apply(this, arguments);
};
} | [
"function",
"(",
"$edbml",
")",
"{",
"return",
"function",
"configured",
"(",
"$in",
")",
"{",
"$edbml",
".",
"$out",
"=",
"(",
"$in",
"&&",
"$in",
".",
"$out",
")",
"?",
"$in",
".",
"$out",
":",
"new",
"edbml",
".",
"Out",
"(",
")",
";",
"$edbml... | Configure EDBML function for runtime use. Note
that `this` refers to the spirit instance here.
@see {ts.gui.ScriptPlugin#_runtimeconfigure}
@param {function} $edbml The (compiled) function as served to the page
@returns {function} | [
"Configure",
"EDBML",
"function",
"for",
"runtime",
"use",
".",
"Note",
"that",
"this",
"refers",
"to",
"the",
"spirit",
"instance",
"here",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2581-L2590 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(func, thisp) {
var key = gui.KeyMaster.generateKey();
this._invokables[key] = function(value, checked) {
return func.apply(thisp, [gui.Type.cast(value), checked]);
};
return key;
} | javascript | function(func, thisp) {
var key = gui.KeyMaster.generateKey();
this._invokables[key] = function(value, checked) {
return func.apply(thisp, [gui.Type.cast(value), checked]);
};
return key;
} | [
"function",
"(",
"func",
",",
"thisp",
")",
"{",
"var",
"key",
"=",
"gui",
".",
"KeyMaster",
".",
"generateKey",
"(",
")",
";",
"this",
".",
"_invokables",
"[",
"key",
"]",
"=",
"function",
"(",
"value",
",",
"checked",
")",
"{",
"return",
"func",
... | Map function to generated key and return the key.
@param {function} func
@param {object} thisp
@returns {String} | [
"Map",
"function",
"to",
"generated",
"key",
"and",
"return",
"the",
"key",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2614-L2620 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(e) {
this._latestevent = e ? {
type: e.type,
value: e.target.value,
checked: e.target.checked
} : null;
} | javascript | function(e) {
this._latestevent = e ? {
type: e.type,
value: e.target.value,
checked: e.target.checked
} : null;
} | [
"function",
"(",
"e",
")",
"{",
"this",
".",
"_latestevent",
"=",
"e",
"?",
"{",
"type",
":",
"e",
".",
"type",
",",
"value",
":",
"e",
".",
"target",
".",
"value",
",",
"checked",
":",
"e",
".",
"target",
".",
"checked",
"}",
":",
"null",
";",... | Keep a log on the latest DOM event. Perhaps it's
because events don't take to async implementation,
though it's probably so we can send it to sandbox.
@param {Event} e | [
"Keep",
"a",
"log",
"on",
"the",
"latest",
"DOM",
"event",
".",
"Perhaps",
"it",
"s",
"because",
"events",
"don",
"t",
"take",
"to",
"async",
"implementation",
"though",
"it",
"s",
"probably",
"so",
"we",
"can",
"send",
"it",
"to",
"sandbox",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2701-L2707 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
var html = "";
gui.Object.nonmethods(this).forEach(function(att) {
html += this._out(att);
}, this);
return html;
} | javascript | function() {
var html = "";
gui.Object.nonmethods(this).forEach(function(att) {
html += this._out(att);
}, this);
return html;
} | [
"function",
"(",
")",
"{",
"var",
"html",
"=",
"\"\"",
";",
"gui",
".",
"Object",
".",
"nonmethods",
"(",
"this",
")",
".",
"forEach",
"(",
"function",
"(",
"att",
")",
"{",
"html",
"+=",
"this",
".",
"_out",
"(",
"att",
")",
";",
"}",
",",
"th... | Resolve all key-values to HTML attribute declarations.
@returns {String} | [
"Resolve",
"all",
"key",
"-",
"values",
"to",
"HTML",
"attribute",
"declarations",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L2772-L2778 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(html) {
this._newdom = this._parse(html);
this._crawl(this._newdom, this._olddom, this._newdom, this._keyid, {});
this._olddom = this._newdom;
} | javascript | function(html) {
this._newdom = this._parse(html);
this._crawl(this._newdom, this._olddom, this._newdom, this._keyid, {});
this._olddom = this._newdom;
} | [
"function",
"(",
"html",
")",
"{",
"this",
".",
"_newdom",
"=",
"this",
".",
"_parse",
"(",
"html",
")",
";",
"this",
".",
"_crawl",
"(",
"this",
".",
"_newdom",
",",
"this",
".",
"_olddom",
",",
"this",
".",
"_newdom",
",",
"this",
".",
"_keyid",
... | Next update.
@param {String} html | [
"Next",
"update",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L3052-L3056 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(newnode, oldnode, lastnode, id, ids) {
var result = true,
oldid = this._assistant.id(oldnode);
if ((result = this._check(newnode, oldnode, lastnode, id, ids))) {
if (oldid) {
ids = gui.Object.copy(ids);
lastnode = newnode;
ids[oldid] = true;
id = oldid;
}
result = this._crawl(ne... | javascript | function(newnode, oldnode, lastnode, id, ids) {
var result = true,
oldid = this._assistant.id(oldnode);
if ((result = this._check(newnode, oldnode, lastnode, id, ids))) {
if (oldid) {
ids = gui.Object.copy(ids);
lastnode = newnode;
ids[oldid] = true;
id = oldid;
}
result = this._crawl(ne... | [
"function",
"(",
"newnode",
",",
"oldnode",
",",
"lastnode",
",",
"id",
",",
"ids",
")",
"{",
"var",
"result",
"=",
"true",
",",
"oldid",
"=",
"this",
".",
"_assistant",
".",
"id",
"(",
"oldnode",
")",
";",
"if",
"(",
"(",
"result",
"=",
"this",
... | Scan elements.
@param {Element} newnode
@param {Element} oldnode
@param {Element} lastnode
@param {String} id
@param {Map<String,boolean>} ids
@returns {boolean} | [
"Scan",
"elements",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L3107-L3120 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(newnode, oldnode, ids) {
var result = true;
var update = null;
if (this._attschanged(newnode.attributes, oldnode.attributes, ids)) {
var newid = this._assistant.id(newnode);
var oldid = this._assistant.id(oldnode);
if (newid && newid === oldid) {
update = new edbml.AttsUpdate(this._doc).setu... | javascript | function(newnode, oldnode, ids) {
var result = true;
var update = null;
if (this._attschanged(newnode.attributes, oldnode.attributes, ids)) {
var newid = this._assistant.id(newnode);
var oldid = this._assistant.id(oldnode);
if (newid && newid === oldid) {
update = new edbml.AttsUpdate(this._doc).setu... | [
"function",
"(",
"newnode",
",",
"oldnode",
",",
"ids",
")",
"{",
"var",
"result",
"=",
"true",
";",
"var",
"update",
"=",
"null",
";",
"if",
"(",
"this",
".",
"_attschanged",
"(",
"newnode",
".",
"attributes",
",",
"oldnode",
".",
"attributes",
",",
... | Same id trigges attribute synchronization;
different id triggers hard update of ancestor.
@param {Element} newnode
@param {Element} oldnode
@param {Map<String,boolean>} ids
@returns {boolean} When false, replace "hard" and stop crawling. | [
"Same",
"id",
"trigges",
"attribute",
"synchronization",
";",
"different",
"id",
"triggers",
"hard",
"update",
"of",
"ancestor",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L3194-L3208 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(newnode, oldnode) {
if (newnode && oldnode) {
return newnode.id && newnode.id === oldnode.id &&
this._maybesoft(newnode) &&
this._maybesoft(oldnode);
} else {
return Array.every(newnode.childNodes, function(node) {
var res = true;
switch (node.nodeType) {
case Node.TEXT_NODE:
... | javascript | function(newnode, oldnode) {
if (newnode && oldnode) {
return newnode.id && newnode.id === oldnode.id &&
this._maybesoft(newnode) &&
this._maybesoft(oldnode);
} else {
return Array.every(newnode.childNodes, function(node) {
var res = true;
switch (node.nodeType) {
case Node.TEXT_NODE:
... | [
"function",
"(",
"newnode",
",",
"oldnode",
")",
"{",
"if",
"(",
"newnode",
"&&",
"oldnode",
")",
"{",
"return",
"newnode",
".",
"id",
"&&",
"newnode",
".",
"id",
"===",
"oldnode",
".",
"id",
"&&",
"this",
".",
"_maybesoft",
"(",
"newnode",
")",
"&&"... | Are element children candidates for "soft" sibling updates?
1) Both parents must have the same ID
2) All children must have a specified ID
3) All children must be elements or whitespace-only textnodes
@param {Element} newnode
@param {Element} oldnode
@return {boolean} | [
"Are",
"element",
"children",
"candidates",
"for",
"soft",
"sibling",
"updates?",
"1",
")",
"Both",
"parents",
"must",
"have",
"the",
"same",
"ID",
"2",
")",
"All",
"children",
"must",
"have",
"a",
"specified",
"ID",
"3",
")",
"All",
"children",
"must",
... | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L3267-L3286 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(newnode, oldnode, ids) {
var updates = [];
var news = this._assistant.index(newnode.childNodes);
var olds = this._assistant.index(oldnode.childNodes);
/*
* Add elements?
*/
var child = newnode.lastElementChild,
topid = this._assistant.id(oldnode),
oldid = null,
newid = null;
while (c... | javascript | function(newnode, oldnode, ids) {
var updates = [];
var news = this._assistant.index(newnode.childNodes);
var olds = this._assistant.index(oldnode.childNodes);
/*
* Add elements?
*/
var child = newnode.lastElementChild,
topid = this._assistant.id(oldnode),
oldid = null,
newid = null;
while (c... | [
"function",
"(",
"newnode",
",",
"oldnode",
",",
"ids",
")",
"{",
"var",
"updates",
"=",
"[",
"]",
";",
"var",
"news",
"=",
"this",
".",
"_assistant",
".",
"index",
"(",
"newnode",
".",
"childNodes",
")",
";",
"var",
"olds",
"=",
"this",
".",
"_ass... | Update "soft" siblings.
@param {Element} newnode
@param {Element} oldnode
@param {Map<String,boolean>} ids
@return {boolean} | [
"Update",
"soft",
"siblings",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L3321-L3372 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(update, ids) {
this._updates.push(update);
if (update.type === edbml.Update.TYPE_HARD) {
this._hardupdates[update.id] = true;
} else {
update.ids = ids || {};
}
return this;
} | javascript | function(update, ids) {
this._updates.push(update);
if (update.type === edbml.Update.TYPE_HARD) {
this._hardupdates[update.id] = true;
} else {
update.ids = ids || {};
}
return this;
} | [
"function",
"(",
"update",
",",
"ids",
")",
"{",
"this",
".",
"_updates",
".",
"push",
"(",
"update",
")",
";",
"if",
"(",
"update",
".",
"type",
"===",
"edbml",
".",
"Update",
".",
"TYPE_HARD",
")",
"{",
"this",
".",
"_hardupdates",
"[",
"update",
... | Collect update candidate. All updates may not be evaluated, see below.
@param {edbml.Update} update
@param {Map<String,boolean>} ids Indexing ID of ancestor elements
@returns {edbml.UpdateCollector} | [
"Collect",
"update",
"candidate",
".",
"All",
"updates",
"may",
"not",
"be",
"evaluated",
"see",
"below",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L3399-L3407 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(report) {
if (edbml.debug) {
if (gui.KeyMaster.isKey(this.id)) {
report = report.replace(this.id, "(anonymous)");
}
console.debug(report);
}
} | javascript | function(report) {
if (edbml.debug) {
if (gui.KeyMaster.isKey(this.id)) {
report = report.replace(this.id, "(anonymous)");
}
console.debug(report);
}
} | [
"function",
"(",
"report",
")",
"{",
"if",
"(",
"edbml",
".",
"debug",
")",
"{",
"if",
"(",
"gui",
".",
"KeyMaster",
".",
"isKey",
"(",
"this",
".",
"id",
")",
")",
"{",
"report",
"=",
"report",
".",
"replace",
"(",
"this",
".",
"id",
",",
"\"(... | Report update in debug mode.
@param {String} report | [
"Report",
"update",
"in",
"debug",
"mode",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L3596-L3603 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
edbml.Update.prototype.update.call(this);
var element = this.element();
if (this._beforeUpdate(element)) {
this._update(element);
this._afterUpdate(element);
this._report();
}
} | javascript | function() {
edbml.Update.prototype.update.call(this);
var element = this.element();
if (this._beforeUpdate(element)) {
this._update(element);
this._afterUpdate(element);
this._report();
}
} | [
"function",
"(",
")",
"{",
"edbml",
".",
"Update",
".",
"prototype",
".",
"update",
".",
"call",
"(",
"this",
")",
";",
"var",
"element",
"=",
"this",
".",
"element",
"(",
")",
";",
"if",
"(",
"this",
".",
"_beforeUpdate",
"(",
"element",
")",
")",... | Update attributes. | [
"Update",
"attributes",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L3713-L3721 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
var summary = this._summary.join(', ');
var message = 'edbml.AttsUpdate "#' + this.id + '" ' + summary;
edbml.Update.prototype._report.call(this, message);
// TODO: this would break super keyword algorithm!!!
// edbml.Update.prototype._report.call(this, edbml.AttsUpdate \# +
// this.id + \ + t... | javascript | function() {
var summary = this._summary.join(', ');
var message = 'edbml.AttsUpdate "#' + this.id + '" ' + summary;
edbml.Update.prototype._report.call(this, message);
// TODO: this would break super keyword algorithm!!!
// edbml.Update.prototype._report.call(this, edbml.AttsUpdate \# +
// this.id + \ + t... | [
"function",
"(",
")",
"{",
"var",
"summary",
"=",
"this",
".",
"_summary",
".",
"join",
"(",
"', '",
")",
";",
"var",
"message",
"=",
"'edbml.AttsUpdate \"#'",
"+",
"this",
".",
"id",
"+",
"'\" '",
"+",
"summary",
";",
"edbml",
".",
"Update",
".",
"p... | Debug changes. | [
"Debug",
"changes",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L3818-L3825 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
edbml.Update.prototype.update.call(this);
var element = this.element();
if (element && this._beforeUpdate(element)) {
//gui.DOMPlugin.html ( element, this.xelement.outerHTML );
gui.DOMPlugin.html(element, this.xelement.innerHTML);
this._afterUpdate(element);
this._report();
}
} | javascript | function() {
edbml.Update.prototype.update.call(this);
var element = this.element();
if (element && this._beforeUpdate(element)) {
//gui.DOMPlugin.html ( element, this.xelement.outerHTML );
gui.DOMPlugin.html(element, this.xelement.innerHTML);
this._afterUpdate(element);
this._report();
}
} | [
"function",
"(",
")",
"{",
"edbml",
".",
"Update",
".",
"prototype",
".",
"update",
".",
"call",
"(",
"this",
")",
";",
"var",
"element",
"=",
"this",
".",
"element",
"(",
")",
";",
"if",
"(",
"element",
"&&",
"this",
".",
"_beforeUpdate",
"(",
"el... | Replace target subtree. | [
"Replace",
"target",
"subtree",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L3864-L3873 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
var count = 0,
elm = this.element();
if (this._map) {
if ((count = edbml.FunctionUpdate._remap(elm, this._map))) {
this._report("remapped " + count + " keys");
}
} else {
if ((count = edbml.FunctionUpdate._revoke(elm))) {
this._report("revoked " + count + " keys");
}
}
} | javascript | function() {
var count = 0,
elm = this.element();
if (this._map) {
if ((count = edbml.FunctionUpdate._remap(elm, this._map))) {
this._report("remapped " + count + " keys");
}
} else {
if ((count = edbml.FunctionUpdate._revoke(elm))) {
this._report("revoked " + count + " keys");
}
}
} | [
"function",
"(",
")",
"{",
"var",
"count",
"=",
"0",
",",
"elm",
"=",
"this",
".",
"element",
"(",
")",
";",
"if",
"(",
"this",
".",
"_map",
")",
"{",
"if",
"(",
"(",
"count",
"=",
"edbml",
".",
"FunctionUpdate",
".",
"_remap",
"(",
"elm",
",",... | Do the update. | [
"Do",
"the",
"update",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4130-L4142 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(element) {
var atts = [];
new gui.Crawler('functionupdate').descend(element, {
handleElement: function(elm) {
if (elm !== element) {
Array.forEach(elm.attributes, function(att) {
if (att.value.contains("edbml.$run")) {
atts.push([elm, att]);
}
});
if (elm.spirit && ... | javascript | function(element) {
var atts = [];
new gui.Crawler('functionupdate').descend(element, {
handleElement: function(elm) {
if (elm !== element) {
Array.forEach(elm.attributes, function(att) {
if (att.value.contains("edbml.$run")) {
atts.push([elm, att]);
}
});
if (elm.spirit && ... | [
"function",
"(",
"element",
")",
"{",
"var",
"atts",
"=",
"[",
"]",
";",
"new",
"gui",
".",
"Crawler",
"(",
"'functionupdate'",
")",
".",
"descend",
"(",
"element",
",",
"{",
"handleElement",
":",
"function",
"(",
"elm",
")",
"{",
"if",
"(",
"elm",
... | Collect attributes from DOM subtree that
somewhat resemble EDBML poke statements.
@returns {Array<Array<Node>>} | [
"Collect",
"attributes",
"from",
"DOM",
"subtree",
"that",
"somewhat",
"resemble",
"EDBML",
"poke",
"statements",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4210-L4227 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
gui.Plugin.prototype.ondestruct.call(this);
if (this.loaded) {
gui.Tick.cancelFrame(this._frameindex);
this.spirit.life.remove(gui.LIFE_ENTER, this);
gui.Broadcast.remove(edb.BROADCAST_ACCESS, this);
if (this.$input) { // TODO: interface for this (dispose)
this.$input.ondestruct(... | javascript | function() {
gui.Plugin.prototype.ondestruct.call(this);
if (this.loaded) {
gui.Tick.cancelFrame(this._frameindex);
this.spirit.life.remove(gui.LIFE_ENTER, this);
gui.Broadcast.remove(edb.BROADCAST_ACCESS, this);
if (this.$input) { // TODO: interface for this (dispose)
this.$input.ondestruct(... | [
"function",
"(",
")",
"{",
"gui",
".",
"Plugin",
".",
"prototype",
".",
"ondestruct",
".",
"call",
"(",
"this",
")",
";",
"if",
"(",
"this",
".",
"loaded",
")",
"{",
"gui",
".",
"Tick",
".",
"cancelFrame",
"(",
"this",
".",
"_frameindex",
")",
";",... | Destruction time. | [
"Destruction",
"time",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4274-L4285 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(html) {
var changed = this._html !== html;
var focused = this._focusedfield();
if (changed) {
this._html = html;
this._updater.update(html);
if(focused) {
this._restorefocus(focused);
}
}
this._status(this.spirit);
this.ran = true; // TODO: deprecate and use 'spirit.life.... | javascript | function(html) {
var changed = this._html !== html;
var focused = this._focusedfield();
if (changed) {
this._html = html;
this._updater.update(html);
if(focused) {
this._restorefocus(focused);
}
}
this._status(this.spirit);
this.ran = true; // TODO: deprecate and use 'spirit.life.... | [
"function",
"(",
"html",
")",
"{",
"var",
"changed",
"=",
"this",
".",
"_html",
"!==",
"html",
";",
"var",
"focused",
"=",
"this",
".",
"_focusedfield",
"(",
")",
";",
"if",
"(",
"changed",
")",
"{",
"this",
".",
"_html",
"=",
"html",
";",
"this",
... | Write the actual HTML to screen. You should probably only
call this method if you are producing your own markup
somehow, ie. not using EDBML templates out of the box.
@param {String} html | [
"Write",
"the",
"actual",
"HTML",
"to",
"screen",
".",
"You",
"should",
"probably",
"only",
"call",
"this",
"method",
"if",
"you",
"are",
"producing",
"your",
"own",
"markup",
"somehow",
"ie",
".",
"not",
"using",
"EDBML",
"templates",
"out",
"of",
"the",
... | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4350-L4362 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(changes) {
if (changes.some(function(c) {
var id = c.object.$instanceid,
clas = c.object.$classname,
name = c.name;
if(edbml.$rendering && edbml.$rendering[id]) {
console.error(
'Don\'t update "' + name + '" of the ' + clas + ' while ' +
'rendering, it will cause the ren... | javascript | function(changes) {
if (changes.some(function(c) {
var id = c.object.$instanceid,
clas = c.object.$classname,
name = c.name;
if(edbml.$rendering && edbml.$rendering[id]) {
console.error(
'Don\'t update "' + name + '" of the ' + clas + ' while ' +
'rendering, it will cause the ren... | [
"function",
"(",
"changes",
")",
"{",
"if",
"(",
"changes",
".",
"some",
"(",
"function",
"(",
"c",
")",
"{",
"var",
"id",
"=",
"c",
".",
"object",
".",
"$instanceid",
",",
"clas",
"=",
"c",
".",
"object",
".",
"$classname",
",",
"name",
"=",
"c"... | Handle change.
@param {Array<edb.Change>} changes | [
"Handle",
"change",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4426-L4451 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(l) {
if (l.type === gui.LIFE_ENTER) {
if (!this.spirit.life.rendered) { // spirit did a manual run?
this.run.apply(this, this._arguments || []);
}
this.spirit.life.remove(l.type, this);
this._arguments = null;
}
} | javascript | function(l) {
if (l.type === gui.LIFE_ENTER) {
if (!this.spirit.life.rendered) { // spirit did a manual run?
this.run.apply(this, this._arguments || []);
}
this.spirit.life.remove(l.type, this);
this._arguments = null;
}
} | [
"function",
"(",
"l",
")",
"{",
"if",
"(",
"l",
".",
"type",
"===",
"gui",
".",
"LIFE_ENTER",
")",
"{",
"if",
"(",
"!",
"this",
".",
"spirit",
".",
"life",
".",
"rendered",
")",
"{",
"// spirit did a manual run?",
"this",
".",
"run",
".",
"apply",
... | Handle life.
@param {gui.Life} life | [
"Handle",
"life",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4457-L4465 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
edbml.$rendering = this._oldfokkers || {};
gui.Broadcast.add(edb.BROADCAST_ACCESS, this);
edb.$accessaware = true;
this._newfokkers = {};
} | javascript | function() {
edbml.$rendering = this._oldfokkers || {};
gui.Broadcast.add(edb.BROADCAST_ACCESS, this);
edb.$accessaware = true;
this._newfokkers = {};
} | [
"function",
"(",
")",
"{",
"edbml",
".",
"$rendering",
"=",
"this",
".",
"_oldfokkers",
"||",
"{",
"}",
";",
"gui",
".",
"Broadcast",
".",
"add",
"(",
"edb",
".",
"BROADCAST_ACCESS",
",",
"this",
")",
";",
"edb",
".",
"$accessaware",
"=",
"true",
";"... | Start it. | [
"Start",
"it",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4553-L4558 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
var oldfokkers = this._oldfokkers,
newfokkers = this._newfokkers;
edbml.$rendering = null;
gui.Broadcast.remove(edb.BROADCAST_ACCESS, this);
edb.$accessaware = false;
Object.keys(oldfokkers).forEach(function(id) {
if (!newfokkers[id]) {
oldfokkers[id].object.removeObserver(this... | javascript | function() {
var oldfokkers = this._oldfokkers,
newfokkers = this._newfokkers;
edbml.$rendering = null;
gui.Broadcast.remove(edb.BROADCAST_ACCESS, this);
edb.$accessaware = false;
Object.keys(oldfokkers).forEach(function(id) {
if (!newfokkers[id]) {
oldfokkers[id].object.removeObserver(this... | [
"function",
"(",
")",
"{",
"var",
"oldfokkers",
"=",
"this",
".",
"_oldfokkers",
",",
"newfokkers",
"=",
"this",
".",
"_newfokkers",
";",
"edbml",
".",
"$rendering",
"=",
"null",
";",
"gui",
".",
"Broadcast",
".",
"remove",
"(",
"edb",
".",
"BROADCAST_AC... | Stop it. | [
"Stop",
"it",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4563-L4589 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
gui.Tick.cancelFrame(this._frameindex);
var spirit = this.spirit;
var input = this.$input;
var runnow = function() {
if (!spirit.life.destructed && (!input || input.done)) {
this.run();
}
}.bind(this);
if (spirit.life.entered) {
if (spirit.life.rendered) {
this._fram... | javascript | function() {
gui.Tick.cancelFrame(this._frameindex);
var spirit = this.spirit;
var input = this.$input;
var runnow = function() {
if (!spirit.life.destructed && (!input || input.done)) {
this.run();
}
}.bind(this);
if (spirit.life.entered) {
if (spirit.life.rendered) {
this._fram... | [
"function",
"(",
")",
"{",
"gui",
".",
"Tick",
".",
"cancelFrame",
"(",
"this",
".",
"_frameindex",
")",
";",
"var",
"spirit",
"=",
"this",
".",
"spirit",
";",
"var",
"input",
"=",
"this",
".",
"$input",
";",
"var",
"runnow",
"=",
"function",
"(",
... | Schedule rendering. | [
"Schedule",
"rendering",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4594-L4612 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(elm) {
var index = -1;
var parts = [];
function hasid(elm) {
if (elm.id) {
try {
gui.DOMPlugin.q(elm.parentNode, elm.id);
return true;
} catch (malformedexception) {}
}
return false;
}
while (elm && elm.nodeType === Node.ELEMENT_NODE) {
if (hasid(elm)) {
... | javascript | function(elm) {
var index = -1;
var parts = [];
function hasid(elm) {
if (elm.id) {
try {
gui.DOMPlugin.q(elm.parentNode, elm.id);
return true;
} catch (malformedexception) {}
}
return false;
}
while (elm && elm.nodeType === Node.ELEMENT_NODE) {
if (hasid(elm)) {
... | [
"function",
"(",
"elm",
")",
"{",
"var",
"index",
"=",
"-",
"1",
";",
"var",
"parts",
"=",
"[",
"]",
";",
"function",
"hasid",
"(",
"elm",
")",
"{",
"if",
"(",
"elm",
".",
"id",
")",
"{",
"try",
"{",
"gui",
".",
"DOMPlugin",
".",
"q",
"(",
... | Compute selector for form field. We scope it to
nearest element ID or fallback to document body.
@param {Element} element
@returns {string} | [
"Compute",
"selector",
"for",
"form",
"field",
".",
"We",
"scope",
"it",
"to",
"nearest",
"element",
"ID",
"or",
"fallback",
"to",
"document",
"body",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4691-L4719 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function(selector) {
var texts = 'textarea, input:not([type=checkbox]):not([type=radio])';
var field = gui.DOMPlugin.qdoc(selector);
if(field && field !== document.activeElement) {
field.focus();
if (gui.CSSPlugin.matches(field, texts)) {
field.setSelectionRange(
field.value.length,
fi... | javascript | function(selector) {
var texts = 'textarea, input:not([type=checkbox]):not([type=radio])';
var field = gui.DOMPlugin.qdoc(selector);
if(field && field !== document.activeElement) {
field.focus();
if (gui.CSSPlugin.matches(field, texts)) {
field.setSelectionRange(
field.value.length,
fi... | [
"function",
"(",
"selector",
")",
"{",
"var",
"texts",
"=",
"'textarea, input:not([type=checkbox]):not([type=radio])'",
";",
"var",
"field",
"=",
"gui",
".",
"DOMPlugin",
".",
"qdoc",
"(",
"selector",
")",
";",
"if",
"(",
"field",
"&&",
"field",
"!==",
"docume... | Refocus that form field.
@param {string} selector | [
"Refocus",
"that",
"form",
"field",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4725-L4737 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
gui.Spirit.prototype.onconfigure.call(this);
if (this.dom.embedded()) {
var id, parent = this.dom.parent(gui.Spirit);
if (parent && (id = this.scriptid)) {
parent.script.load(gui.Object.lookup(id));
}
}
} | javascript | function() {
gui.Spirit.prototype.onconfigure.call(this);
if (this.dom.embedded()) {
var id, parent = this.dom.parent(gui.Spirit);
if (parent && (id = this.scriptid)) {
parent.script.load(gui.Object.lookup(id));
}
}
} | [
"function",
"(",
")",
"{",
"gui",
".",
"Spirit",
".",
"prototype",
".",
"onconfigure",
".",
"call",
"(",
"this",
")",
";",
"if",
"(",
"this",
".",
"dom",
".",
"embedded",
"(",
")",
")",
"{",
"var",
"id",
",",
"parent",
"=",
"this",
".",
"dom",
... | Load script into parent spirit. This spirit will
automatically destruct when the script executes. | [
"Load",
"script",
"into",
"parent",
"spirit",
".",
"This",
"spirit",
"will",
"automatically",
"destruct",
"when",
"the",
"script",
"executes",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4761-L4769 | train | |
wunderbyte/grunt-spiritual-dox | src/js/libs/spiritual-edb.js | function() {
/*
* Automatically load spirit scripts by naming convention?
* ns.MySpirit would automatically load ns.MySpirit.edbml
*/
var edbmlscript, basespirit = gui.Spirit.prototype;
gui.Function.decorateAfter(basespirit, 'onconfigure', function() {
if (edbml.bootload && !this.script.loaded) {
... | javascript | function() {
/*
* Automatically load spirit scripts by naming convention?
* ns.MySpirit would automatically load ns.MySpirit.edbml
*/
var edbmlscript, basespirit = gui.Spirit.prototype;
gui.Function.decorateAfter(basespirit, 'onconfigure', function() {
if (edbml.bootload && !this.script.loaded) {
... | [
"function",
"(",
")",
"{",
"/*\n\t\t * Automatically load spirit scripts by naming convention?\n\t\t * ns.MySpirit would automatically load ns.MySpirit.edbml\n\t\t */",
"var",
"edbmlscript",
",",
"basespirit",
"=",
"gui",
".",
"Spirit",
".",
"prototype",
";",
"gui",
".",
"Functio... | Setup environment. | [
"Setup",
"environment",
"."
] | 5afcfe31ddbf7d654166aa15b938553b61de5811 | https://github.com/wunderbyte/grunt-spiritual-dox/blob/5afcfe31ddbf7d654166aa15b938553b61de5811/src/js/libs/spiritual-edb.js#L4851-L4877 | train | |
cafjs/caf_conduit | lib/conduit.js | function(node) {
var newNode = function(data, next) {
var that = {};
that.getData = function() {
return data;
};
that.getNext = function() {
return next;
};
return that;
};
var top ... | javascript | function(node) {
var newNode = function(data, next) {
var that = {};
that.getData = function() {
return data;
};
that.getNext = function() {
return next;
};
return that;
};
var top ... | [
"function",
"(",
"node",
")",
"{",
"var",
"newNode",
"=",
"function",
"(",
"data",
",",
"next",
")",
"{",
"var",
"that",
"=",
"{",
"}",
";",
"that",
".",
"getData",
"=",
"function",
"(",
")",
"{",
"return",
"data",
";",
"}",
";",
"that",
".",
"... | An immutable stack as base class. | [
"An",
"immutable",
"stack",
"as",
"base",
"class",
"."
] | 72b4856dddfca76be7de605c1c60bcd1b8315996 | https://github.com/cafjs/caf_conduit/blob/72b4856dddfca76be7de605c1c60bcd1b8315996/lib/conduit.js#L134-L186 | train | |
redisjs/jsr-server | lib/command/database/hash/hscan.js | execute | function execute(req, res) {
//console.dir(req.args);
var hmap = req.db.getKey(req.args[0], req);
if(hmap === undefined) {
return res.send(null, [0, []]);
}
//console.dir(hmap.getKeys())
var scanner = new Scanner(
hmap.getKeys(),
req.info.cursor,
req.info.pattern,
req.info.count,
hma... | javascript | function execute(req, res) {
//console.dir(req.args);
var hmap = req.db.getKey(req.args[0], req);
if(hmap === undefined) {
return res.send(null, [0, []]);
}
//console.dir(hmap.getKeys())
var scanner = new Scanner(
hmap.getKeys(),
req.info.cursor,
req.info.pattern,
req.info.count,
hma... | [
"function",
"execute",
"(",
"req",
",",
"res",
")",
"{",
"//console.dir(req.args);",
"var",
"hmap",
"=",
"req",
".",
"db",
".",
"getKey",
"(",
"req",
".",
"args",
"[",
"0",
"]",
",",
"req",
")",
";",
"if",
"(",
"hmap",
"===",
"undefined",
")",
"{",... | Respond to the HSCAN command. | [
"Respond",
"to",
"the",
"HSCAN",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/hash/hscan.js#L19-L34 | train |
hbouvier/node-tagger | lib/util/rest.js | lexPhrase | function lexPhrase(req, res) {
var now = elapse.start();
var body = req ? req.body : null;
var phrase = typeof(body) === 'object' ? body.phrase : null;
if (!phrase) {
return res.jsonp(412, {"code":412, "message": meta.module + '|lex|EXCEPTION|invalid request body: ' + (b... | javascript | function lexPhrase(req, res) {
var now = elapse.start();
var body = req ? req.body : null;
var phrase = typeof(body) === 'object' ? body.phrase : null;
if (!phrase) {
return res.jsonp(412, {"code":412, "message": meta.module + '|lex|EXCEPTION|invalid request body: ' + (b... | [
"function",
"lexPhrase",
"(",
"req",
",",
"res",
")",
"{",
"var",
"now",
"=",
"elapse",
".",
"start",
"(",
")",
";",
"var",
"body",
"=",
"req",
"?",
"req",
".",
"body",
":",
"null",
";",
"var",
"phrase",
"=",
"typeof",
"(",
"body",
")",
"===",
... | HTTP Request to lex a phrase
@param req: an HTTP request
@param res: an HTTP response
curl -X POST -H "Content-Type: application/json" -d '{"phrase":"bye there"}' http://tagger.beeker.c9.io/ws/lex/phrase | [
"HTTP",
"Request",
"to",
"lex",
"a",
"phrase"
] | 51a6a9b6158e83cbbc4d3d4f10fde19ac796510b | https://github.com/hbouvier/node-tagger/blob/51a6a9b6158e83cbbc4d3d4f10fde19ac796510b/lib/util/rest.js#L27-L37 | train |
eliascodes/modload | lib/tree.js | walk | function walk (dir, mapper, exclude, include, stopfile) {
let files = fs.readdirSync(dir).map((file) => path.join(dir, file))
if (exclude)
files = files.filter((file) => !exclude.test(file))
let directories = files.filter(utils.is.dir)
files = files.filter(utils.is.file)
if (include)
files = files.... | javascript | function walk (dir, mapper, exclude, include, stopfile) {
let files = fs.readdirSync(dir).map((file) => path.join(dir, file))
if (exclude)
files = files.filter((file) => !exclude.test(file))
let directories = files.filter(utils.is.dir)
files = files.filter(utils.is.file)
if (include)
files = files.... | [
"function",
"walk",
"(",
"dir",
",",
"mapper",
",",
"exclude",
",",
"include",
",",
"stopfile",
")",
"{",
"let",
"files",
"=",
"fs",
".",
"readdirSync",
"(",
"dir",
")",
".",
"map",
"(",
"(",
"file",
")",
"=>",
"path",
".",
"join",
"(",
"dir",
",... | Recursively walk a directory and return array of files
@returns {array} of files found in the directory
@param {string} dir - Root directory to traverse
@param {function} mapper - (Optional) Transforms each filepath
@param {RegExp} exclude - (Optional) Pattern for files to exclude from results
@param {RegExp} include -... | [
"Recursively",
"walk",
"a",
"directory",
"and",
"return",
"array",
"of",
"files"
] | bc3bad88c8b677970bb9154764db7bbf72401d3a | https://github.com/eliascodes/modload/blob/bc3bad88c8b677970bb9154764db7bbf72401d3a/lib/tree.js#L19-L47 | train |
jmarthernandez/chat-parser | src/emoticons.js | getEmoticons | function getEmoticons(arr) {
var nested = arr.map(function (str) {
return str.match(between);
});
return flatten(nested)
.filter(function (el) {
return el;
})
.filter(emoticonsPredicate)
.map(function (str) {
return str.slice(1, str.length - 1);
});
} | javascript | function getEmoticons(arr) {
var nested = arr.map(function (str) {
return str.match(between);
});
return flatten(nested)
.filter(function (el) {
return el;
})
.filter(emoticonsPredicate)
.map(function (str) {
return str.slice(1, str.length - 1);
});
} | [
"function",
"getEmoticons",
"(",
"arr",
")",
"{",
"var",
"nested",
"=",
"arr",
".",
"map",
"(",
"function",
"(",
"str",
")",
"{",
"return",
"str",
".",
"match",
"(",
"between",
")",
";",
"}",
")",
";",
"return",
"flatten",
"(",
"nested",
")",
".",
... | Parses tokenized array into emoticon strings
@func
@param {array} arr - a chat input string split on whitespace | [
"Parses",
"tokenized",
"array",
"into",
"emoticon",
"strings"
] | 62e7e28cca35318158e4a807b30dd8d5d88718ac | https://github.com/jmarthernandez/chat-parser/blob/62e7e28cca35318158e4a807b30dd8d5d88718ac/src/emoticons.js#L31-L44 | train |
kevoree/kevoree-js-node-javascript | lib/AdaptationEngine.js | function (diffSeq, targetModel) {
var self = this;
this.targetModel = targetModel;
// know if a trace has already been added to cmdList for {path <-> AdaptationPrimitive}
var traceAlreadyProcessed = function (cmd) {
return self.alreadyProcessedTraces[cmd.modelElement.path()] && self.alreadyProcessedTraces[c... | javascript | function (diffSeq, targetModel) {
var self = this;
this.targetModel = targetModel;
// know if a trace has already been added to cmdList for {path <-> AdaptationPrimitive}
var traceAlreadyProcessed = function (cmd) {
return self.alreadyProcessedTraces[cmd.modelElement.path()] && self.alreadyProcessedTraces[c... | [
"function",
"(",
"diffSeq",
",",
"targetModel",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"targetModel",
"=",
"targetModel",
";",
"// know if a trace has already been added to cmdList for {path <-> AdaptationPrimitive}",
"var",
"traceAlreadyProcessed",
"=",
... | Process traces to find the right adaptation primitive command
Returns a command to execute in order to do the adaptation logic
@param diffSeq
@param targetModel
@returns {Array} | [
"Process",
"traces",
"to",
"find",
"the",
"right",
"adaptation",
"primitive",
"command",
"Returns",
"a",
"command",
"to",
"execute",
"in",
"order",
"to",
"do",
"the",
"adaptation",
"logic"
] | a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d | https://github.com/kevoree/kevoree-js-node-javascript/blob/a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d/lib/AdaptationEngine.js#L78-L132 | train | |
kevoree/kevoree-js-node-javascript | lib/AdaptationEngine.js | function (cmd) {
self.alreadyProcessedTraces[cmd.modelElement.path()] = self.alreadyProcessedTraces[cmd.modelElement.path()] || {};
self.alreadyProcessedTraces[cmd.modelElement.path()][cmd.toString()] = cmd;
} | javascript | function (cmd) {
self.alreadyProcessedTraces[cmd.modelElement.path()] = self.alreadyProcessedTraces[cmd.modelElement.path()] || {};
self.alreadyProcessedTraces[cmd.modelElement.path()][cmd.toString()] = cmd;
} | [
"function",
"(",
"cmd",
")",
"{",
"self",
".",
"alreadyProcessedTraces",
"[",
"cmd",
".",
"modelElement",
".",
"path",
"(",
")",
"]",
"=",
"self",
".",
"alreadyProcessedTraces",
"[",
"cmd",
".",
"modelElement",
".",
"path",
"(",
")",
"]",
"||",
"{",
"}... | add a trace to the processed trace map | [
"add",
"a",
"trace",
"to",
"the",
"processed",
"trace",
"map"
] | a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d | https://github.com/kevoree/kevoree-js-node-javascript/blob/a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d/lib/AdaptationEngine.js#L88-L91 | train | |
kevoree/kevoree-js-node-javascript | lib/AdaptationEngine.js | function (element) {
if (element) {
if (element.metaClassName() === 'org.kevoree.ComponentInstance') {
// if parent is this node platform: it's ok
return (element.eContainer().name === this.node.getName());
} else if (element.metaClassName() === 'org.kevoree.Channel') {
// if this channel has bindi... | javascript | function (element) {
if (element) {
if (element.metaClassName() === 'org.kevoree.ComponentInstance') {
// if parent is this node platform: it's ok
return (element.eContainer().name === this.node.getName());
} else if (element.metaClassName() === 'org.kevoree.Channel') {
// if this channel has bindi... | [
"function",
"(",
"element",
")",
"{",
"if",
"(",
"element",
")",
"{",
"if",
"(",
"element",
".",
"metaClassName",
"(",
")",
"===",
"'org.kevoree.ComponentInstance'",
")",
"{",
"// if parent is this node platform: it's ok",
"return",
"(",
"element",
".",
"eContaine... | know if an modelElement is related to the current plarform node
@param element
@returns {boolean} | [
"know",
"if",
"an",
"modelElement",
"is",
"related",
"to",
"the",
"current",
"plarform",
"node"
] | a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d | https://github.com/kevoree/kevoree-js-node-javascript/blob/a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d/lib/AdaptationEngine.js#L476-L524 | train | |
kevoree/kevoree-js-node-javascript | lib/AdaptationEngine.js | function (list) {
list.sort(function (a, b) {
if (COMMAND_RANK[a.toString()] > COMMAND_RANK[b.toString()]) {
return 1;
} else if (COMMAND_RANK[a.toString()] < COMMAND_RANK[b.toString()]) {
return -1;
} else {
return 0;
}
});
return list;
} | javascript | function (list) {
list.sort(function (a, b) {
if (COMMAND_RANK[a.toString()] > COMMAND_RANK[b.toString()]) {
return 1;
} else if (COMMAND_RANK[a.toString()] < COMMAND_RANK[b.toString()]) {
return -1;
} else {
return 0;
}
});
return list;
} | [
"function",
"(",
"list",
")",
"{",
"list",
".",
"sort",
"(",
"function",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"COMMAND_RANK",
"[",
"a",
".",
"toString",
"(",
")",
"]",
">",
"COMMAND_RANK",
"[",
"b",
".",
"toString",
"(",
")",
"]",
")",
"{",... | Sorts primitives array according to COMMAND_RANK
@param list
@returns {*} | [
"Sorts",
"primitives",
"array",
"according",
"to",
"COMMAND_RANK"
] | a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d | https://github.com/kevoree/kevoree-js-node-javascript/blob/a1bcce1b76317bc90eb2d0c1c0c70525eaa1d70d/lib/AdaptationEngine.js#L599-L611 | train | |
redisjs/jsr-store | lib/command/keys.js | del | function del(/* key-1, key-N, req */) {
var args = slice.call(arguments, 0)
, req = typeof args[args.length-1] === 'object' ? args.pop() : null;
var deleted = 0;
for(var i = 0;i < args.length;i++) {
if(this.keyExists(args[i])) {
this.delKey(args[i], req);
deleted++;
}
}
return deleted;... | javascript | function del(/* key-1, key-N, req */) {
var args = slice.call(arguments, 0)
, req = typeof args[args.length-1] === 'object' ? args.pop() : null;
var deleted = 0;
for(var i = 0;i < args.length;i++) {
if(this.keyExists(args[i])) {
this.delKey(args[i], req);
deleted++;
}
}
return deleted;... | [
"function",
"del",
"(",
"/* key-1, key-N, req */",
")",
"{",
"var",
"args",
"=",
"slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
",",
"req",
"=",
"typeof",
"args",
"[",
"args",
".",
"length",
"-",
"1",
"]",
"===",
"'object'",
"?",
"args",
".",... | Removes the specified keys. A key is ignored if it does not exist. | [
"Removes",
"the",
"specified",
"keys",
".",
"A",
"key",
"is",
"ignored",
"if",
"it",
"does",
"not",
"exist",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/keys.js#L9-L20 | train |
redisjs/jsr-store | lib/command/keys.js | rename | function rename(key, newkey, req) {
var val = this.getKey(key);
this.delKey(key);
this.setKey(newkey, val);
return OK;
} | javascript | function rename(key, newkey, req) {
var val = this.getKey(key);
this.delKey(key);
this.setKey(newkey, val);
return OK;
} | [
"function",
"rename",
"(",
"key",
",",
"newkey",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
")",
";",
"this",
".",
"delKey",
"(",
"key",
")",
";",
"this",
".",
"setKey",
"(",
"newkey",
",",
"val",
")",
";",
"ret... | Rename a key.
Expected that command validation has already check that the key names
do not match and that the target key does exist. | [
"Rename",
"a",
"key",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/keys.js#L28-L33 | train |
redisjs/jsr-store | lib/command/keys.js | renamenx | function renamenx(key, newkey, req) {
var exists = this.keyExists(newkey);
if(!exists) {
this.rename(key, newkey, req);
}
return exists ? 0 : 1;
} | javascript | function renamenx(key, newkey, req) {
var exists = this.keyExists(newkey);
if(!exists) {
this.rename(key, newkey, req);
}
return exists ? 0 : 1;
} | [
"function",
"renamenx",
"(",
"key",
",",
"newkey",
",",
"req",
")",
"{",
"var",
"exists",
"=",
"this",
".",
"keyExists",
"(",
"newkey",
")",
";",
"if",
"(",
"!",
"exists",
")",
"{",
"this",
".",
"rename",
"(",
"key",
",",
"newkey",
",",
"req",
")... | Rename a key, only if the new key does not exist.
Expected that the command has validated according the rules for
RENAME. | [
"Rename",
"a",
"key",
"only",
"if",
"the",
"new",
"key",
"does",
"not",
"exist",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/keys.js#L41-L47 | train |
redisjs/jsr-store | lib/command/keys.js | move | function move(key, index, req) {
var val = this.getKey(key)
, db = this.store.getDatabase(index, this.options);
//console.dir(val);
if(!val || db.keyExists(key)) return 0;
db.setKey(key, val);
this.delKey(key);
return 1;
} | javascript | function move(key, index, req) {
var val = this.getKey(key)
, db = this.store.getDatabase(index, this.options);
//console.dir(val);
if(!val || db.keyExists(key)) return 0;
db.setKey(key, val);
this.delKey(key);
return 1;
} | [
"function",
"move",
"(",
"key",
",",
"index",
",",
"req",
")",
"{",
"var",
"val",
"=",
"this",
".",
"getKey",
"(",
"key",
")",
",",
"db",
"=",
"this",
".",
"store",
".",
"getDatabase",
"(",
"index",
",",
"this",
".",
"options",
")",
";",
"//conso... | Move a key from this database to another database. | [
"Move",
"a",
"key",
"from",
"this",
"database",
"to",
"another",
"database",
"."
] | b2b5c5b0347819f8a388b5d67e121ee8d73f328c | https://github.com/redisjs/jsr-store/blob/b2b5c5b0347819f8a388b5d67e121ee8d73f328c/lib/command/keys.js#L66-L74 | train |
gethuman/pancakes-angular | lib/transformers/ng.app.transformer.js | transform | function transform(flapjack, options) {
var filePath = options.filePath;
var appName = this.getAppName(filePath, options.appName);
var appInfo = this.pancakes.cook(flapjack, null);
var validations = this.getSchemaValidations(appInfo, null);
var schema = this.stringify(validations);
var deps = (o... | javascript | function transform(flapjack, options) {
var filePath = options.filePath;
var appName = this.getAppName(filePath, options.appName);
var appInfo = this.pancakes.cook(flapjack, null);
var validations = this.getSchemaValidations(appInfo, null);
var schema = this.stringify(validations);
var deps = (o... | [
"function",
"transform",
"(",
"flapjack",
",",
"options",
")",
"{",
"var",
"filePath",
"=",
"options",
".",
"filePath",
";",
"var",
"appName",
"=",
"this",
".",
"getAppName",
"(",
"filePath",
",",
"options",
".",
"appName",
")",
";",
"var",
"appInfo",
"=... | Pull together the template model and generate the template
@param flapjack
@param options
@returns {Q} | [
"Pull",
"together",
"the",
"template",
"model",
"and",
"generate",
"the",
"template"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.app.transformer.js#L15-L33 | train |
gethuman/pancakes-angular | lib/transformers/ng.app.transformer.js | getSchemaValidations | function getSchemaValidations(appInfo, resources) {
if (!appInfo.includeSchemas) { return null; }
// if resources not passed in, then get from pancakes
resources = resources || this.pancakes.cook('resources', null);
var validations = {};
_.each(resources, function (resource) {
_.each(resou... | javascript | function getSchemaValidations(appInfo, resources) {
if (!appInfo.includeSchemas) { return null; }
// if resources not passed in, then get from pancakes
resources = resources || this.pancakes.cook('resources', null);
var validations = {};
_.each(resources, function (resource) {
_.each(resou... | [
"function",
"getSchemaValidations",
"(",
"appInfo",
",",
"resources",
")",
"{",
"if",
"(",
"!",
"appInfo",
".",
"includeSchemas",
")",
"{",
"return",
"null",
";",
"}",
"// if resources not passed in, then get from pancakes",
"resources",
"=",
"resources",
"||",
"thi... | Get the stringified version of the schem
@param appInfo
@param resources
@returns {*} | [
"Get",
"the",
"stringified",
"version",
"of",
"the",
"schem"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.app.transformer.js#L41-L60 | train |
gethuman/pancakes-angular | lib/transformers/ng.app.transformer.js | stringify | function stringify(validations) {
if (!validations) { return ''; }
return JSON.stringify(validations, function (key, value) {
if (_.isRegExp(value)) { return value.toString(); }
switch (value) {
case String: return 'String';
case Boolean: return 'Boolean';
... | javascript | function stringify(validations) {
if (!validations) { return ''; }
return JSON.stringify(validations, function (key, value) {
if (_.isRegExp(value)) { return value.toString(); }
switch (value) {
case String: return 'String';
case Boolean: return 'Boolean';
... | [
"function",
"stringify",
"(",
"validations",
")",
"{",
"if",
"(",
"!",
"validations",
")",
"{",
"return",
"''",
";",
"}",
"return",
"JSON",
".",
"stringify",
"(",
"validations",
",",
"function",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"_",
"."... | Stringify the validations object
@param validations
@returns {*} | [
"Stringify",
"the",
"validations",
"object"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.app.transformer.js#L67-L81 | train |
hypergroup/hyper-client-superagent | index.js | Client | function Client(API_URL, token, opts) {
if (!(this instanceof Client)) return new Client(API_URL, token, opts);
if (typeof token == 'object') {
opts = token;
token = null;
}
Emitter.call(this);
var self = this;
opts = opts || {};
self.cache = new LRU(opts.maxSize || 500);
self.pending = {};
... | javascript | function Client(API_URL, token, opts) {
if (!(this instanceof Client)) return new Client(API_URL, token, opts);
if (typeof token == 'object') {
opts = token;
token = null;
}
Emitter.call(this);
var self = this;
opts = opts || {};
self.cache = new LRU(opts.maxSize || 500);
self.pending = {};
... | [
"function",
"Client",
"(",
"API_URL",
",",
"token",
",",
"opts",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Client",
")",
")",
"return",
"new",
"Client",
"(",
"API_URL",
",",
"token",
",",
"opts",
")",
";",
"if",
"(",
"typeof",
"token",
... | Create a client | [
"Create",
"a",
"client"
] | 4c1c7c2014386ac93b4804b50eabfe1c3b5a23f6 | https://github.com/hypergroup/hyper-client-superagent/blob/4c1c7c2014386ac93b4804b50eabfe1c3b5a23f6/index.js#L24-L50 | train |
hypergroup/hyper-client-superagent | index.js | HyperError | function HyperError(res) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.name = 'HyperError';
this.status = res.status;
if (res.body && res.body.error) this.message = res.body.error.message;
else this.message = res.text;
} | javascript | function HyperError(res) {
Error.call(this);
Error.captureStackTrace(this, arguments.callee);
this.name = 'HyperError';
this.status = res.status;
if (res.body && res.body.error) this.message = res.body.error.message;
else this.message = res.text;
} | [
"function",
"HyperError",
"(",
"res",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"Error",
".",
"captureStackTrace",
"(",
"this",
",",
"arguments",
".",
"callee",
")",
";",
"this",
".",
"name",
"=",
"'HyperError'",
";",
"this",
".",
"status"... | Create a hyper error given a superagent response
@param {Response} res | [
"Create",
"a",
"hyper",
"error",
"given",
"a",
"superagent",
"response"
] | 4c1c7c2014386ac93b4804b50eabfe1c3b5a23f6 | https://github.com/hypergroup/hyper-client-superagent/blob/4c1c7c2014386ac93b4804b50eabfe1c3b5a23f6/index.js#L270-L277 | train |
akaspin/tav | index.js | function(spec, banner, strict) {
spec = spec || {};
banner = banner || "Usage:";
var self = this;
var incoming = process.argv.slice(2); // incoming params
/**
* Returns extra items frob b
* @param a
* @param b
* @returns {Array}
... | javascript | function(spec, banner, strict) {
spec = spec || {};
banner = banner || "Usage:";
var self = this;
var incoming = process.argv.slice(2); // incoming params
/**
* Returns extra items frob b
* @param a
* @param b
* @returns {Array}
... | [
"function",
"(",
"spec",
",",
"banner",
",",
"strict",
")",
"{",
"spec",
"=",
"spec",
"||",
"{",
"}",
";",
"banner",
"=",
"banner",
"||",
"\"Usage:\"",
";",
"var",
"self",
"=",
"this",
";",
"var",
"incoming",
"=",
"process",
".",
"argv",
".",
"slic... | Sets options.
@param spec Specification
@param banner Banner
@param strict Assume unexpected params as error. | [
"Sets",
"options",
"."
] | 1a7402ba5cd59cacecabad80e4a51f4a3ca66f1e | https://github.com/akaspin/tav/blob/1a7402ba5cd59cacecabad80e4a51f4a3ca66f1e/index.js#L16-L134 | train | |
akaspin/tav | index.js | function(parsed) {
var end = false, message = "", code = 0, outer = console.log;
var setted = Object.keys(self);
var specced = Object.keys(parsed);
var required = arrayDiff(setted, specced);
var unexpected = arrayDiff(specced, setted);
... | javascript | function(parsed) {
var end = false, message = "", code = 0, outer = console.log;
var setted = Object.keys(self);
var specced = Object.keys(parsed);
var required = arrayDiff(setted, specced);
var unexpected = arrayDiff(specced, setted);
... | [
"function",
"(",
"parsed",
")",
"{",
"var",
"end",
"=",
"false",
",",
"message",
"=",
"\"\"",
",",
"code",
"=",
"0",
",",
"outer",
"=",
"console",
".",
"log",
";",
"var",
"setted",
"=",
"Object",
".",
"keys",
"(",
"self",
")",
";",
"var",
"specce... | Check conditions. If help setted - always exit.
@param parsed Parsed specs | [
"Check",
"conditions",
".",
"If",
"help",
"setted",
"-",
"always",
"exit",
"."
] | 1a7402ba5cd59cacecabad80e4a51f4a3ca66f1e | https://github.com/akaspin/tav/blob/1a7402ba5cd59cacecabad80e4a51f4a3ca66f1e/index.js#L37-L83 | train | |
redisjs/jsr-server | lib/command/database/string/bitop.js | validate | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var op = ('' + args[0]).toLowerCase();
if(op !== BITOP.AND && op !== BITOP.OR
&& op !== BITOP.XOR && op !== BITOP.NOT) {
throw CommandSyntax;
}
if(op === BITOP.NOT && args.length !== 3) {
throw BitopNot... | javascript | function validate(cmd, args, info) {
AbstractCommand.prototype.validate.apply(this, arguments);
var op = ('' + args[0]).toLowerCase();
if(op !== BITOP.AND && op !== BITOP.OR
&& op !== BITOP.XOR && op !== BITOP.NOT) {
throw CommandSyntax;
}
if(op === BITOP.NOT && args.length !== 3) {
throw BitopNot... | [
"function",
"validate",
"(",
"cmd",
",",
"args",
",",
"info",
")",
"{",
"AbstractCommand",
".",
"prototype",
".",
"validate",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"op",
"=",
"(",
"''",
"+",
"args",
"[",
"0",
"]",
")",
".",
... | Validate the BITOP command. | [
"Validate",
"the",
"BITOP",
"command",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/command/database/string/bitop.js#L21-L32 | train |
redisjs/jsr-server | lib/state.js | ServerState | function ServerState() {
// server configuration
this._conf = new Configuration();
this._conf.once('load', this.onConfigLoad.bind(this));
// the server bind address information
// if listen() is never called this is null
this._addr = null;
// timestamp for the last save of the rdb file
this._lastsave... | javascript | function ServerState() {
// server configuration
this._conf = new Configuration();
this._conf.once('load', this.onConfigLoad.bind(this));
// the server bind address information
// if listen() is never called this is null
this._addr = null;
// timestamp for the last save of the rdb file
this._lastsave... | [
"function",
"ServerState",
"(",
")",
"{",
"// server configuration",
"this",
".",
"_conf",
"=",
"new",
"Configuration",
"(",
")",
";",
"this",
".",
"_conf",
".",
"once",
"(",
"'load'",
",",
"this",
".",
"onConfigLoad",
".",
"bind",
"(",
"this",
")",
")",... | Encapsulates the state of the server. | [
"Encapsulates",
"the",
"state",
"of",
"the",
"server",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/state.js#L19-L74 | train |
redisjs/jsr-server | lib/state.js | pause | function pause(timeout) {
var log = this._logger;
// keep list of matching clients
var clients = [];
this._conn.forEach(function(conn) {
if(!conn.client.isSlave()) {
clients.push(conn);
conn.pause();
}
})
function resume() {
log.notice('resume %s connections', clients.length);
cl... | javascript | function pause(timeout) {
var log = this._logger;
// keep list of matching clients
var clients = [];
this._conn.forEach(function(conn) {
if(!conn.client.isSlave()) {
clients.push(conn);
conn.pause();
}
})
function resume() {
log.notice('resume %s connections', clients.length);
cl... | [
"function",
"pause",
"(",
"timeout",
")",
"{",
"var",
"log",
"=",
"this",
".",
"_logger",
";",
"// keep list of matching clients",
"var",
"clients",
"=",
"[",
"]",
";",
"this",
".",
"_conn",
".",
"forEach",
"(",
"function",
"(",
"conn",
")",
"{",
"if",
... | Pause normal and pubsub clients. | [
"Pause",
"normal",
"and",
"pubsub",
"clients",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/state.js#L81-L99 | train |
redisjs/jsr-server | lib/state.js | expire | function expire() {
var dbs = this._store.databases, i;
for(i in dbs) {
dbs[i].delExpiredKeys();
}
} | javascript | function expire() {
var dbs = this._store.databases, i;
for(i in dbs) {
dbs[i].delExpiredKeys();
}
} | [
"function",
"expire",
"(",
")",
"{",
"var",
"dbs",
"=",
"this",
".",
"_store",
".",
"databases",
",",
"i",
";",
"for",
"(",
"i",
"in",
"dbs",
")",
"{",
"dbs",
"[",
"i",
"]",
".",
"delExpiredKeys",
"(",
")",
";",
"}",
"}"
] | Scheduler tick event that handles expiring keys.
Passive expiry. | [
"Scheduler",
"tick",
"event",
"that",
"handles",
"expiring",
"keys",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/state.js#L106-L111 | train |
redisjs/jsr-server | lib/state.js | debug | function debug(rusage, memory) {
var dbs = this._store.databases
, i
, db
, size;
for(i in dbs) {
db = dbs[i];
size = db.dbsize();
if(size) {
this._logger.debug('DB %s: %s keys (%s volatile)', i, size, db.expiring);
}
}
this._logger.debug('%s clients connected, %s heap, %s rss ... | javascript | function debug(rusage, memory) {
var dbs = this._store.databases
, i
, db
, size;
for(i in dbs) {
db = dbs[i];
size = db.dbsize();
if(size) {
this._logger.debug('DB %s: %s keys (%s volatile)', i, size, db.expiring);
}
}
this._logger.debug('%s clients connected, %s heap, %s rss ... | [
"function",
"debug",
"(",
"rusage",
",",
"memory",
")",
"{",
"var",
"dbs",
"=",
"this",
".",
"_store",
".",
"databases",
",",
"i",
",",
"db",
",",
"size",
";",
"for",
"(",
"i",
"in",
"dbs",
")",
"{",
"db",
"=",
"dbs",
"[",
"i",
"]",
";",
"siz... | Listener for the debug log event. | [
"Listener",
"for",
"the",
"debug",
"log",
"event",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/state.js#L116-L130 | train |
redisjs/jsr-server | lib/state.js | onConfigLoad | function onConfigLoad() {
var file = this._conf.get(ConfigName.LOGFILE);
this._logger.level(this._conf.get(ConfigName.LOGLEVEL));
//console.dir('config loaded.');
if(file && !this._conf.get(ConfigName.DAEMONIZE)) {
this._logger.stream(file);
}
if(this._conf.isDefault()) {
this._logger.warning('no co... | javascript | function onConfigLoad() {
var file = this._conf.get(ConfigName.LOGFILE);
this._logger.level(this._conf.get(ConfigName.LOGLEVEL));
//console.dir('config loaded.');
if(file && !this._conf.get(ConfigName.DAEMONIZE)) {
this._logger.stream(file);
}
if(this._conf.isDefault()) {
this._logger.warning('no co... | [
"function",
"onConfigLoad",
"(",
")",
"{",
"var",
"file",
"=",
"this",
".",
"_conf",
".",
"get",
"(",
"ConfigName",
".",
"LOGFILE",
")",
";",
"this",
".",
"_logger",
".",
"level",
"(",
"this",
".",
"_conf",
".",
"get",
"(",
"ConfigName",
".",
"LOGLEV... | Listener for the config load event. | [
"Listener",
"for",
"the",
"config",
"load",
"event",
"."
] | 49413052d3039524fbdd2ade0ef9bae26cb4d647 | https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/state.js#L135-L150 | train |
Wizcorp/panopticon | index.js | Panopticon | function Panopticon(options) {
var isInstance = this instanceof Panopticon;
if (!isInstance) {
return new Panopticon(options);
}
EventEmitter.call(this);
this.id = instanceCount;
instanceCount += 1;
// First we sort out the methods and data which handle are local to this process.
genericSetup(this, options... | javascript | function Panopticon(options) {
var isInstance = this instanceof Panopticon;
if (!isInstance) {
return new Panopticon(options);
}
EventEmitter.call(this);
this.id = instanceCount;
instanceCount += 1;
// First we sort out the methods and data which handle are local to this process.
genericSetup(this, options... | [
"function",
"Panopticon",
"(",
"options",
")",
"{",
"var",
"isInstance",
"=",
"this",
"instanceof",
"Panopticon",
";",
"if",
"(",
"!",
"isInstance",
")",
"{",
"return",
"new",
"Panopticon",
"(",
"options",
")",
";",
"}",
"EventEmitter",
".",
"call",
"(",
... | The constructor for Panopticon. Handles the differences between master and worker processes.
Please refer to the README for more information.
@param {Object} options The configuration object.
@param {Number} options.startTime Time in ms elapsed since 1 January 1970 00:00:00 UTC.
@param {String} ... | [
"The",
"constructor",
"for",
"Panopticon",
".",
"Handles",
"the",
"differences",
"between",
"master",
"and",
"worker",
"processes",
".",
"Please",
"refer",
"to",
"the",
"README",
"for",
"more",
"information",
"."
] | e0d660cd5287b45aafdb5a91e54affa7364b14e0 | https://github.com/Wizcorp/panopticon/blob/e0d660cd5287b45aafdb5a91e54affa7364b14e0/index.js#L48-L71 | train |
killmenot/jasmine-spy-matchers | lib/mixins/CallTracker.js | function(index) {
var calls = this.all();
var call = calls[index];
return call ? call.object : null;
} | javascript | function(index) {
var calls = this.all();
var call = calls[index];
return call ? call.object : null;
} | [
"function",
"(",
"index",
")",
"{",
"var",
"calls",
"=",
"this",
".",
"all",
"(",
")",
";",
"var",
"call",
"=",
"calls",
"[",
"index",
"]",
";",
"return",
"call",
"?",
"call",
".",
"object",
":",
"null",
";",
"}"
] | Get the this that were passed to a specific invocation of this spy.
@name Spy#calls#thisArgFor
@function
@param {Integer} index The 0-based invocation index.
@return {Object} | [
"Get",
"the",
"this",
"that",
"were",
"passed",
"to",
"a",
"specific",
"invocation",
"of",
"this",
"spy",
"."
] | dc1ad0988220bbc2cfb44eaabc3473a00145c2a2 | https://github.com/killmenot/jasmine-spy-matchers/blob/dc1ad0988220bbc2cfb44eaabc3473a00145c2a2/lib/mixins/CallTracker.js#L13-L18 | train | |
viatsyshyn/emp.ria | syntax/tokenizer.js | isBuildInType | function isBuildInType(type) {
return type === Function
|| type === String
|| type === Boolean
|| type === Number
|| type === RegExp
|| type === Object
|| type === Array
|| type === Date
} | javascript | function isBuildInType(type) {
return type === Function
|| type === String
|| type === Boolean
|| type === Number
|| type === RegExp
|| type === Object
|| type === Array
|| type === Date
} | [
"function",
"isBuildInType",
"(",
"type",
")",
"{",
"return",
"type",
"===",
"Function",
"||",
"type",
"===",
"String",
"||",
"type",
"===",
"Boolean",
"||",
"type",
"===",
"Number",
"||",
"type",
"===",
"RegExp",
"||",
"type",
"===",
"Object",
"||",
"ty... | Checks if type is native js constructor
@param {*} type
@return {Boolean} | [
"Checks",
"if",
"type",
"is",
"native",
"js",
"constructor"
] | 59286e792748a69fc463597e082daf7873529fae | https://github.com/viatsyshyn/emp.ria/blob/59286e792748a69fc463597e082daf7873529fae/syntax/tokenizer.js#L12-L21 | train |
viatsyshyn/emp.ria | syntax/tokenizer.js | isCustomType | function isCustomType(type) {
return ria.__API.isClassConstructor(type)
|| ria.__API.isInterface(type)
|| ria.__API.isEnum(type)
|| ria.__API.isIdentifier(type)
|| ria.__API.isDelegate(type)
|| ria.__API.isSpecification(type);
//|| ArrayOfD... | javascript | function isCustomType(type) {
return ria.__API.isClassConstructor(type)
|| ria.__API.isInterface(type)
|| ria.__API.isEnum(type)
|| ria.__API.isIdentifier(type)
|| ria.__API.isDelegate(type)
|| ria.__API.isSpecification(type);
//|| ArrayOfD... | [
"function",
"isCustomType",
"(",
"type",
")",
"{",
"return",
"ria",
".",
"__API",
".",
"isClassConstructor",
"(",
"type",
")",
"||",
"ria",
".",
"__API",
".",
"isInterface",
"(",
"type",
")",
"||",
"ria",
".",
"__API",
".",
"isEnum",
"(",
"type",
")",
... | Checks if type is ria enabled custom constructor
@param {*} type
@return {Boolean} | [
"Checks",
"if",
"type",
"is",
"ria",
"enabled",
"custom",
"constructor"
] | 59286e792748a69fc463597e082daf7873529fae | https://github.com/viatsyshyn/emp.ria/blob/59286e792748a69fc463597e082daf7873529fae/syntax/tokenizer.js#L28-L37 | train |
aaronmccall/ampersand-model-patch-mixin | lib/utils.js | smartIndexOf | function smartIndexOf(array, test) {
var index = -1;
if (!array || !test) return index;
var length = array.length;
if (!length) return index;
while (++index < length) {
if (test(array[index], index, array)) return index;
}
return -1;
} | javascript | function smartIndexOf(array, test) {
var index = -1;
if (!array || !test) return index;
var length = array.length;
if (!length) return index;
while (++index < length) {
if (test(array[index], index, array)) return index;
}
return -1;
} | [
"function",
"smartIndexOf",
"(",
"array",
",",
"test",
")",
"{",
"var",
"index",
"=",
"-",
"1",
";",
"if",
"(",
"!",
"array",
"||",
"!",
"test",
")",
"return",
"index",
";",
"var",
"length",
"=",
"array",
".",
"length",
";",
"if",
"(",
"!",
"leng... | Find index of array member that passes test | [
"Find",
"index",
"of",
"array",
"member",
"that",
"passes",
"test"
] | 28dd7797a306dcaa79d2eefdf904a4bb4fbdebbc | https://github.com/aaronmccall/ampersand-model-patch-mixin/blob/28dd7797a306dcaa79d2eefdf904a4bb4fbdebbc/lib/utils.js#L2-L11 | train |
aaronmccall/ampersand-model-patch-mixin | lib/utils.js | indexById | function indexById(array, id) {
if (!array) return -1;
return smartIndexOf(array, function (obj) {
return obj.id === id;
});
} | javascript | function indexById(array, id) {
if (!array) return -1;
return smartIndexOf(array, function (obj) {
return obj.id === id;
});
} | [
"function",
"indexById",
"(",
"array",
",",
"id",
")",
"{",
"if",
"(",
"!",
"array",
")",
"return",
"-",
"1",
";",
"return",
"smartIndexOf",
"(",
"array",
",",
"function",
"(",
"obj",
")",
"{",
"return",
"obj",
".",
"id",
"===",
"id",
";",
"}",
"... | Returns index of object with matching id property | [
"Returns",
"index",
"of",
"object",
"with",
"matching",
"id",
"property"
] | 28dd7797a306dcaa79d2eefdf904a4bb4fbdebbc | https://github.com/aaronmccall/ampersand-model-patch-mixin/blob/28dd7797a306dcaa79d2eefdf904a4bb4fbdebbc/lib/utils.js#L15-L20 | train |
gtuk/tvmaze-api | tvmaze.js | querySearch | function querySearch( query, single, embed, callback ) {
var embd = '';
if ( single ) {
for ( var key in embed ) {
if ( embed.hasOwnProperty(key) ) {
embd += '&embed[]=' + embed[key];
}
}
}
var url = apiBaseUrl + ( single ? endpoints['query']... | javascript | function querySearch( query, single, embed, callback ) {
var embd = '';
if ( single ) {
for ( var key in embed ) {
if ( embed.hasOwnProperty(key) ) {
embd += '&embed[]=' + embed[key];
}
}
}
var url = apiBaseUrl + ( single ? endpoints['query']... | [
"function",
"querySearch",
"(",
"query",
",",
"single",
",",
"embed",
",",
"callback",
")",
"{",
"var",
"embd",
"=",
"''",
";",
"if",
"(",
"single",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"embed",
")",
"{",
"if",
"(",
"embed",
".",
"hasOwnProper... | Search by query string
@param query
@param single
@param embed
@param callback | [
"Search",
"by",
"query",
"string"
] | 94597b17ac5ce84846e3348e0c557f7be106d8c4 | https://github.com/gtuk/tvmaze-api/blob/94597b17ac5ce84846e3348e0c557f7be106d8c4/tvmaze.js#L29-L44 | train |
gtuk/tvmaze-api | tvmaze.js | idSearch | function idSearch( id, type, callback ) {
if ( ! endpoints['id'].hasOwnProperty(type) ) {
return callback(new Error('No valid type'));
}
var url = apiBaseUrl+endpoints['id'][type] + id;
fetch(url, function(result) {
callback(result);
});
} | javascript | function idSearch( id, type, callback ) {
if ( ! endpoints['id'].hasOwnProperty(type) ) {
return callback(new Error('No valid type'));
}
var url = apiBaseUrl+endpoints['id'][type] + id;
fetch(url, function(result) {
callback(result);
});
} | [
"function",
"idSearch",
"(",
"id",
",",
"type",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"endpoints",
"[",
"'id'",
"]",
".",
"hasOwnProperty",
"(",
"type",
")",
")",
"{",
"return",
"callback",
"(",
"new",
"Error",
"(",
"'No valid type'",
")",
")",
... | Search by imdb, tvrage or tvdb id
@param id
@param type
@param callback | [
"Search",
"by",
"imdb",
"tvrage",
"or",
"tvdb",
"id"
] | 94597b17ac5ce84846e3348e0c557f7be106d8c4 | https://github.com/gtuk/tvmaze-api/blob/94597b17ac5ce84846e3348e0c557f7be106d8c4/tvmaze.js#L53-L63 | train |
gtuk/tvmaze-api | tvmaze.js | showSearch | function showSearch( id, embed, callback ) {
var embd = '';
for ( var key in embed ) {
if ( embed.hasOwnProperty(key) ) {
embd += ( 0 == key ? '?' : '&' ) + 'embed[]=' + embed[key];
}
}
var url = apiBaseUrl+endpoints['show'] + id + embd;
fetch(url, function(result) {
... | javascript | function showSearch( id, embed, callback ) {
var embd = '';
for ( var key in embed ) {
if ( embed.hasOwnProperty(key) ) {
embd += ( 0 == key ? '?' : '&' ) + 'embed[]=' + embed[key];
}
}
var url = apiBaseUrl+endpoints['show'] + id + embd;
fetch(url, function(result) {
... | [
"function",
"showSearch",
"(",
"id",
",",
"embed",
",",
"callback",
")",
"{",
"var",
"embd",
"=",
"''",
";",
"for",
"(",
"var",
"key",
"in",
"embed",
")",
"{",
"if",
"(",
"embed",
".",
"hasOwnProperty",
"(",
"key",
")",
")",
"{",
"embd",
"+=",
"(... | Get show infos by id
@param id
@param embed
@param callback | [
"Get",
"show",
"infos",
"by",
"id"
] | 94597b17ac5ce84846e3348e0c557f7be106d8c4 | https://github.com/gtuk/tvmaze-api/blob/94597b17ac5ce84846e3348e0c557f7be106d8c4/tvmaze.js#L72-L85 | train |
gtuk/tvmaze-api | tvmaze.js | showPeople | function showPeople( id, callback ) {
var url = apiBaseUrl+endpoints['people'] + id;
fetch(url, function(result) {
callback(result);
});
} | javascript | function showPeople( id, callback ) {
var url = apiBaseUrl+endpoints['people'] + id;
fetch(url, function(result) {
callback(result);
});
} | [
"function",
"showPeople",
"(",
"id",
",",
"callback",
")",
"{",
"var",
"url",
"=",
"apiBaseUrl",
"+",
"endpoints",
"[",
"'people'",
"]",
"+",
"id",
";",
"fetch",
"(",
"url",
",",
"function",
"(",
"result",
")",
"{",
"callback",
"(",
"result",
")",
";... | Get people main information by id
@param id
@param callback | [
"Get",
"people",
"main",
"information",
"by",
"id"
] | 94597b17ac5ce84846e3348e0c557f7be106d8c4 | https://github.com/gtuk/tvmaze-api/blob/94597b17ac5ce84846e3348e0c557f7be106d8c4/tvmaze.js#L93-L99 | train |
gtuk/tvmaze-api | tvmaze.js | scheduleSearch | function scheduleSearch( country, date, callback ) {
var url = apiBaseUrl+endpoints['schedule'].replace('$1', country).replace('$2', date);
fetch(url, function(result) {
callback(result);
});
} | javascript | function scheduleSearch( country, date, callback ) {
var url = apiBaseUrl+endpoints['schedule'].replace('$1', country).replace('$2', date);
fetch(url, function(result) {
callback(result);
});
} | [
"function",
"scheduleSearch",
"(",
"country",
",",
"date",
",",
"callback",
")",
"{",
"var",
"url",
"=",
"apiBaseUrl",
"+",
"endpoints",
"[",
"'schedule'",
"]",
".",
"replace",
"(",
"'$1'",
",",
"country",
")",
".",
"replace",
"(",
"'$2'",
",",
"date",
... | Search schedule for specific country and date
@param country
@param date
@param callback | [
"Search",
"schedule",
"for",
"specific",
"country",
"and",
"date"
] | 94597b17ac5ce84846e3348e0c557f7be106d8c4 | https://github.com/gtuk/tvmaze-api/blob/94597b17ac5ce84846e3348e0c557f7be106d8c4/tvmaze.js#L108-L114 | train |
gtuk/tvmaze-api | tvmaze.js | fetch | function fetch( url, callback ) {
request({ url: url, json: true }, function( err, resp, data ) {
if (err) {
return callback(err);
}
if ( 200 != resp.statusCode ) {
return callback(new Error(resp.statusMessage));
}
callback(data);
});
} | javascript | function fetch( url, callback ) {
request({ url: url, json: true }, function( err, resp, data ) {
if (err) {
return callback(err);
}
if ( 200 != resp.statusCode ) {
return callback(new Error(resp.statusMessage));
}
callback(data);
});
} | [
"function",
"fetch",
"(",
"url",
",",
"callback",
")",
"{",
"request",
"(",
"{",
"url",
":",
"url",
",",
"json",
":",
"true",
"}",
",",
"function",
"(",
"err",
",",
"resp",
",",
"data",
")",
"{",
"if",
"(",
"err",
")",
"{",
"return",
"callback",
... | Actual request against the tvmaze api
@param url
@param callback | [
"Actual",
"request",
"against",
"the",
"tvmaze",
"api"
] | 94597b17ac5ce84846e3348e0c557f7be106d8c4 | https://github.com/gtuk/tvmaze-api/blob/94597b17ac5ce84846e3348e0c557f7be106d8c4/tvmaze.js#L122-L134 | train |
tolokoban/ToloFrameWork | lib/context.js | function( packageFilename, options ) {
if( typeof options === 'undefined' ) options = {};
packageFilename = Path.resolve( packageFilename );
if( false == FS.existsSync() )
this.fatal( "Package file not found: \"" + packageFilename + "\"" );
var prjDir = Path.dirname( packageFilename );
... | javascript | function( packageFilename, options ) {
if( typeof options === 'undefined' ) options = {};
packageFilename = Path.resolve( packageFilename );
if( false == FS.existsSync() )
this.fatal( "Package file not found: \"" + packageFilename + "\"" );
var prjDir = Path.dirname( packageFilename );
... | [
"function",
"(",
"packageFilename",
",",
"options",
")",
"{",
"if",
"(",
"typeof",
"options",
"===",
"'undefined'",
")",
"options",
"=",
"{",
"}",
";",
"packageFilename",
"=",
"Path",
".",
"resolve",
"(",
"packageFilename",
")",
";",
"if",
"(",
"false",
... | This is the context of a project. A project is definied by its `package.json` file. | [
"This",
"is",
"the",
"context",
"of",
"a",
"project",
".",
"A",
"project",
"is",
"definied",
"by",
"its",
"package",
".",
"json",
"file",
"."
] | 730845a833a9660ebfdb60ad027ebaab5ac871b6 | https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/context.js#L10-L26 | train | |
beemo-js/beemo | lib/components/validation/annotations/constraints.js | addAnnotation | function addAnnotation(target, key, index, data) {
const classAnnotationsStore = container.get(AnnotationsServiceName.ClassAnnotationsStore);
if (index === undefined) {
// property
classAnnotationsStore.addPropertyAnnotation(target.constructor, key, Constraints, data);
}
else {
/... | javascript | function addAnnotation(target, key, index, data) {
const classAnnotationsStore = container.get(AnnotationsServiceName.ClassAnnotationsStore);
if (index === undefined) {
// property
classAnnotationsStore.addPropertyAnnotation(target.constructor, key, Constraints, data);
}
else {
/... | [
"function",
"addAnnotation",
"(",
"target",
",",
"key",
",",
"index",
",",
"data",
")",
"{",
"const",
"classAnnotationsStore",
"=",
"container",
".",
"get",
"(",
"AnnotationsServiceName",
".",
"ClassAnnotationsStore",
")",
";",
"if",
"(",
"index",
"===",
"unde... | Annotation to property or method | [
"Annotation",
"to",
"property",
"or",
"method"
] | b3fb926c03f55803ae49bf730c09ecbbdd78b8b8 | https://github.com/beemo-js/beemo/blob/b3fb926c03f55803ae49bf730c09ecbbdd78b8b8/lib/components/validation/annotations/constraints.js#L5-L15 | train |
derdesign/protos | middleware/static_server/static_server.js | createStaticFileRegex | function createStaticFileRegex() {
var regex = '^\\/(',
staticViews = this.views.static;
// Get directories in public/
var files = getStaticDirs.call(this);
// Iterate over files and append to regex
for (var path, dir, re, i=0; i < files.length; i++) {
dir = files[i];
path = dir.replace(this.re... | javascript | function createStaticFileRegex() {
var regex = '^\\/(',
staticViews = this.views.static;
// Get directories in public/
var files = getStaticDirs.call(this);
// Iterate over files and append to regex
for (var path, dir, re, i=0; i < files.length; i++) {
dir = files[i];
path = dir.replace(this.re... | [
"function",
"createStaticFileRegex",
"(",
")",
"{",
"var",
"regex",
"=",
"'^\\\\/('",
",",
"staticViews",
"=",
"this",
".",
"views",
".",
"static",
";",
"// Get directories in public/",
"var",
"files",
"=",
"getStaticDirs",
".",
"call",
"(",
"this",
")",
";",
... | Creates the static file regex
@private | [
"Creates",
"the",
"static",
"file",
"regex"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/middleware/static_server/static_server.js#L45-L72 | train |
derdesign/protos | middleware/static_server/static_server.js | getStaticDirs | function getStaticDirs() {
var files = fs.readdirSync(this.path + '/' + this.paths.public),
dirs = [];
for (var file, stat, i=0; i < files.length; i++) {
file = files[i];
stat = fs.lstatSync(this.path + '/' + this.paths.public + file);
if ( stat.isDirectory() ) dirs.push(file);
}
return dirs;
} | javascript | function getStaticDirs() {
var files = fs.readdirSync(this.path + '/' + this.paths.public),
dirs = [];
for (var file, stat, i=0; i < files.length; i++) {
file = files[i];
stat = fs.lstatSync(this.path + '/' + this.paths.public + file);
if ( stat.isDirectory() ) dirs.push(file);
}
return dirs;
} | [
"function",
"getStaticDirs",
"(",
")",
"{",
"var",
"files",
"=",
"fs",
".",
"readdirSync",
"(",
"this",
".",
"path",
"+",
"'/'",
"+",
"this",
".",
"paths",
".",
"public",
")",
",",
"dirs",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"file",
",",
"stat... | Gets the static directories available in the application's public
@returns {array}
@private | [
"Gets",
"the",
"static",
"directories",
"available",
"in",
"the",
"application",
"s",
"public"
] | 0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9 | https://github.com/derdesign/protos/blob/0b679b2a7581dfbb5d065fd4b0914436ef4ef2c9/middleware/static_server/static_server.js#L81-L90 | train |
byron-dupreez/aws-stream-consumer-core | sequencing.js | sequenceMessages | function sequenceMessages(batch, context) {
const states = batch.states;
const messages = batch.messages;
if (messages.length < 2 || !context.streamProcessing.sequencingRequired) {
return messages;
}
// First prepare the messages for sequencing by normalizing all of the messages' sequence numbers
prep... | javascript | function sequenceMessages(batch, context) {
const states = batch.states;
const messages = batch.messages;
if (messages.length < 2 || !context.streamProcessing.sequencingRequired) {
return messages;
}
// First prepare the messages for sequencing by normalizing all of the messages' sequence numbers
prep... | [
"function",
"sequenceMessages",
"(",
"batch",
",",
"context",
")",
"{",
"const",
"states",
"=",
"batch",
".",
"states",
";",
"const",
"messages",
"=",
"batch",
".",
"messages",
";",
"if",
"(",
"messages",
".",
"length",
"<",
"2",
"||",
"!",
"context",
... | Sequences the given entire batch of messages by linking messages with the same keys to each other via their
nextMessage and prevMessage properties in sequences determined by their sequence numbers.
@param {Batch} batch - the batch containing the messages to be sequenced
@param {StreamConsumerContext} context - the cont... | [
"Sequences",
"the",
"given",
"entire",
"batch",
"of",
"messages",
"by",
"linking",
"messages",
"with",
"the",
"same",
"keys",
"to",
"each",
"other",
"via",
"their",
"nextMessage",
"and",
"prevMessage",
"properties",
"in",
"sequences",
"determined",
"by",
"their"... | 9b256084297f80d373bcf483aaf68a9da176b3d7 | https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/sequencing.js#L283-L351 | train |
Frederikbh/tickspotv2-api | lib/service.js | getAuthorization | function getAuthorization(user, auth) {
if (auth === AUTH_BASIC) {
return 'Basic ' + btoa(user.username + ':' + user.password);
} else if (auth === AUTH_TOKEN) {
return 'Token token=' + user.token;
}
} | javascript | function getAuthorization(user, auth) {
if (auth === AUTH_BASIC) {
return 'Basic ' + btoa(user.username + ':' + user.password);
} else if (auth === AUTH_TOKEN) {
return 'Token token=' + user.token;
}
} | [
"function",
"getAuthorization",
"(",
"user",
",",
"auth",
")",
"{",
"if",
"(",
"auth",
"===",
"AUTH_BASIC",
")",
"{",
"return",
"'Basic '",
"+",
"btoa",
"(",
"user",
".",
"username",
"+",
"':'",
"+",
"user",
".",
"password",
")",
";",
"}",
"else",
"i... | Gets the correctly formatted authorization header | [
"Gets",
"the",
"correctly",
"formatted",
"authorization",
"header"
] | 07fb0cdf62e9eb9cb05f74be07130c7472b2bf84 | https://github.com/Frederikbh/tickspotv2-api/blob/07fb0cdf62e9eb9cb05f74be07130c7472b2bf84/lib/service.js#L10-L16 | train |
Frederikbh/tickspotv2-api | lib/service.js | getParams | function getParams(user, auth, url, options, headers) {
return _.extend({
url: url,
headers: _.extend({
'User-Agent': user.userAgent,
'Authorization': getAuthorization(user, auth)
}, headers)
}, options);
} | javascript | function getParams(user, auth, url, options, headers) {
return _.extend({
url: url,
headers: _.extend({
'User-Agent': user.userAgent,
'Authorization': getAuthorization(user, auth)
}, headers)
}, options);
} | [
"function",
"getParams",
"(",
"user",
",",
"auth",
",",
"url",
",",
"options",
",",
"headers",
")",
"{",
"return",
"_",
".",
"extend",
"(",
"{",
"url",
":",
"url",
",",
"headers",
":",
"_",
".",
"extend",
"(",
"{",
"'User-Agent'",
":",
"user",
".",... | Creates the params object for the request | [
"Creates",
"the",
"params",
"object",
"for",
"the",
"request"
] | 07fb0cdf62e9eb9cb05f74be07130c7472b2bf84 | https://github.com/Frederikbh/tickspotv2-api/blob/07fb0cdf62e9eb9cb05f74be07130c7472b2bf84/lib/service.js#L19-L27 | train |
Frederikbh/tickspotv2-api | lib/service.js | makeRequest | function makeRequest(user, auth, url, cb, options = {}, headers = {}) {
const params = getParams(user, auth, url, options, headers);
const promise = new Promise((resolve, reject) => {
request(params, (err, response, body) => {
if (!err && [200, 201, 204, 301].indexOf(response.statusCode) > ... | javascript | function makeRequest(user, auth, url, cb, options = {}, headers = {}) {
const params = getParams(user, auth, url, options, headers);
const promise = new Promise((resolve, reject) => {
request(params, (err, response, body) => {
if (!err && [200, 201, 204, 301].indexOf(response.statusCode) > ... | [
"function",
"makeRequest",
"(",
"user",
",",
"auth",
",",
"url",
",",
"cb",
",",
"options",
"=",
"{",
"}",
",",
"headers",
"=",
"{",
"}",
")",
"{",
"const",
"params",
"=",
"getParams",
"(",
"user",
",",
"auth",
",",
"url",
",",
"options",
",",
"h... | Makes the http request | [
"Makes",
"the",
"http",
"request"
] | 07fb0cdf62e9eb9cb05f74be07130c7472b2bf84 | https://github.com/Frederikbh/tickspotv2-api/blob/07fb0cdf62e9eb9cb05f74be07130c7472b2bf84/lib/service.js#L30-L47 | train |
Frederikbh/tickspotv2-api | lib/service.js | extractHeaders | function extractHeaders(options) {
let headers = {};
if (options && options.headers) {
headers = options.headers;
delete options.headers;
}
return headers;
} | javascript | function extractHeaders(options) {
let headers = {};
if (options && options.headers) {
headers = options.headers;
delete options.headers;
}
return headers;
} | [
"function",
"extractHeaders",
"(",
"options",
")",
"{",
"let",
"headers",
"=",
"{",
"}",
";",
"if",
"(",
"options",
"&&",
"options",
".",
"headers",
")",
"{",
"headers",
"=",
"options",
".",
"headers",
";",
"delete",
"options",
".",
"headers",
";",
"}"... | Extract headers from options object | [
"Extract",
"headers",
"from",
"options",
"object"
] | 07fb0cdf62e9eb9cb05f74be07130c7472b2bf84 | https://github.com/Frederikbh/tickspotv2-api/blob/07fb0cdf62e9eb9cb05f74be07130c7472b2bf84/lib/service.js#L64-L71 | 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.