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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
gethuman/pancakes-recipe | utils/i18n.js | interpolate | function interpolate(val, scope) {
// if no scope or value with {{ then no interpolation and can just return translated
if (!scope || !val || !val.match) { return val; }
// first, we need to get all values with a {{ }} in the string
var i18nVars = val.match(i18nVarExpr);
// lo... | javascript | function interpolate(val, scope) {
// if no scope or value with {{ then no interpolation and can just return translated
if (!scope || !val || !val.match) { return val; }
// first, we need to get all values with a {{ }} in the string
var i18nVars = val.match(i18nVarExpr);
// lo... | [
"function",
"interpolate",
"(",
"val",
",",
"scope",
")",
"{",
"// if no scope or value with {{ then no interpolation and can just return translated",
"if",
"(",
"!",
"scope",
"||",
"!",
"val",
"||",
"!",
"val",
".",
"match",
")",
"{",
"return",
"val",
";",
"}",
... | Attempt to interpolate the string
@param val
@param scope
@returns {*} | [
"Attempt",
"to",
"interpolate",
"the",
"string"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/i18n.js#L39-L55 | train |
gethuman/pancakes-recipe | utils/i18n.js | translate | function translate(val, scope, status) {
var app = (scope && scope.appName) || context.get('app') || '';
var lang = (scope && scope.lang) || context.get('lang') || 'en';
var translated;
// if just one character or is a number, don't do translation
if (!val || val.length < 2 || !... | javascript | function translate(val, scope, status) {
var app = (scope && scope.appName) || context.get('app') || '';
var lang = (scope && scope.lang) || context.get('lang') || 'en';
var translated;
// if just one character or is a number, don't do translation
if (!val || val.length < 2 || !... | [
"function",
"translate",
"(",
"val",
",",
"scope",
",",
"status",
")",
"{",
"var",
"app",
"=",
"(",
"scope",
"&&",
"scope",
".",
"appName",
")",
"||",
"context",
".",
"get",
"(",
"'app'",
")",
"||",
"''",
";",
"var",
"lang",
"=",
"(",
"scope",
"&... | Translate given text into the target language. If not in the target language,
look in english, and then finally just return back the value itself
@param val
@param scope
@param status
@returns {string} | [
"Translate",
"given",
"text",
"into",
"the",
"target",
"language",
".",
"If",
"not",
"in",
"the",
"target",
"language",
"look",
"in",
"english",
"and",
"then",
"finally",
"just",
"return",
"back",
"the",
"value",
"itself"
] | ea3feb8839e2edaf1b4577c052b8958953db4498 | https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/i18n.js#L66-L92 | train |
skerit/hawkejs | lib/client/dom_spotting.js | initialCheck | function initialCheck(attr_name) {
var elements = document.querySelectorAll('[' + attr_name + ']'),
element,
value,
i,
l;
for (i = 0; i < elements.length; i++) {
element = elements[i];
value = element.getAttribute(attr_name);
if (initial_seen.get(element)) {
continue;
}
if (attrib... | javascript | function initialCheck(attr_name) {
var elements = document.querySelectorAll('[' + attr_name + ']'),
element,
value,
i,
l;
for (i = 0; i < elements.length; i++) {
element = elements[i];
value = element.getAttribute(attr_name);
if (initial_seen.get(element)) {
continue;
}
if (attrib... | [
"function",
"initialCheck",
"(",
"attr_name",
")",
"{",
"var",
"elements",
"=",
"document",
".",
"querySelectorAll",
"(",
"'['",
"+",
"attr_name",
"+",
"']'",
")",
",",
"element",
",",
"value",
",",
"i",
",",
"l",
";",
"for",
"(",
"i",
"=",
"0",
";",... | Do an initial check for the given attribute name
@author Jelle De Loecker <jelle@develry.be>
@since 1.0.0
@version 1.1.2
@param {String} attr_name | [
"Do",
"an",
"initial",
"check",
"for",
"the",
"given",
"attribute",
"name"
] | 15ed7205183ac2c425362deb8c0796c0d16b898a | https://github.com/skerit/hawkejs/blob/15ed7205183ac2c425362deb8c0796c0d16b898a/lib/client/dom_spotting.js#L74-L97 | train |
skerit/hawkejs | lib/client/dom_spotting.js | checkChildren | function checkChildren(mutation, node, seen) {
var attr,
k,
l;
if (seen == null) {
seen = initial_seen;
}
// Ignore text nodes
if (node.nodeType === 3 || node.nodeType === 8) {
return;
}
// Only check attributes for nodes that haven't been checked before
if (!seen.get(node)) {
// Indicate t... | javascript | function checkChildren(mutation, node, seen) {
var attr,
k,
l;
if (seen == null) {
seen = initial_seen;
}
// Ignore text nodes
if (node.nodeType === 3 || node.nodeType === 8) {
return;
}
// Only check attributes for nodes that haven't been checked before
if (!seen.get(node)) {
// Indicate t... | [
"function",
"checkChildren",
"(",
"mutation",
",",
"node",
",",
"seen",
")",
"{",
"var",
"attr",
",",
"k",
",",
"l",
";",
"if",
"(",
"seen",
"==",
"null",
")",
"{",
"seen",
"=",
"initial_seen",
";",
"}",
"// Ignore text nodes",
"if",
"(",
"node",
"."... | Check this added node and all its children
@author Jelle De Loecker <jelle@develry.be>
@since 1.0.0
@version 1.0.0
@param {Object} mutation
@param {Node} node
@param {WeakMap} seen | [
"Check",
"this",
"added",
"node",
"and",
"all",
"its",
"children"
] | 15ed7205183ac2c425362deb8c0796c0d16b898a | https://github.com/skerit/hawkejs/blob/15ed7205183ac2c425362deb8c0796c0d16b898a/lib/client/dom_spotting.js#L110-L149 | train |
valiton/node-simple-pool | lib/simplepool.js | SimplePool | function SimplePool() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
this.current = 0;
this.pool = args.length === 1 && Array.isArray(args[0]) ? args[0] : args;
} | javascript | function SimplePool() {
var args;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
this.current = 0;
this.pool = args.length === 1 && Array.isArray(args[0]) ? args[0] : args;
} | [
"function",
"SimplePool",
"(",
")",
"{",
"var",
"args",
";",
"args",
"=",
"1",
"<=",
"arguments",
".",
"length",
"?",
"__slice",
".",
"call",
"(",
"arguments",
",",
"0",
")",
":",
"[",
"]",
";",
"this",
".",
"current",
"=",
"0",
";",
"this",
".",... | create a new SimplePool instance
@memberOf global
@constructor
@this {SimplePool} | [
"create",
"a",
"new",
"SimplePool",
"instance"
] | 5b6220a7f3b9d000dc66483280509b85e4b70d5d | https://github.com/valiton/node-simple-pool/blob/5b6220a7f3b9d000dc66483280509b85e4b70d5d/lib/simplepool.js#L26-L31 | train |
vibe-project/vibe-protocol | lib/transport-http-server.js | createBaseTransport | function createBaseTransport(req, res) {
// A transport object.
var self = new events.EventEmitter();
// Because HTTP transport consists of multiple exchanges, an universally
// unique identifier is required.
self.id = uuid.v4();
// A flag to check the transport is opened.
var opened = true;... | javascript | function createBaseTransport(req, res) {
// A transport object.
var self = new events.EventEmitter();
// Because HTTP transport consists of multiple exchanges, an universally
// unique identifier is required.
self.id = uuid.v4();
// A flag to check the transport is opened.
var opened = true;... | [
"function",
"createBaseTransport",
"(",
"req",
",",
"res",
")",
"{",
"// A transport object.",
"var",
"self",
"=",
"new",
"events",
".",
"EventEmitter",
"(",
")",
";",
"// Because HTTP transport consists of multiple exchanges, an universally",
"// unique identifier is require... | A base transport. | [
"A",
"base",
"transport",
"."
] | 4a350acade3760ea13e75d7b9ce0815cf8b1d688 | https://github.com/vibe-project/vibe-protocol/blob/4a350acade3760ea13e75d7b9ce0815cf8b1d688/lib/transport-http-server.js#L181-L202 | train |
vibe-project/vibe-protocol | lib/transport-http-server.js | createStreamTransport | function createStreamTransport(req, res) {
// A transport object.
var self = createBaseTransport(req, res);
// Any error on request-response should propagate to transport.
req.on("error", function(error) {
self.emit("error", error);
});
res.on("error", function(error) {
self.emit... | javascript | function createStreamTransport(req, res) {
// A transport object.
var self = createBaseTransport(req, res);
// Any error on request-response should propagate to transport.
req.on("error", function(error) {
self.emit("error", error);
});
res.on("error", function(error) {
self.emit... | [
"function",
"createStreamTransport",
"(",
"req",
",",
"res",
")",
"{",
"// A transport object.",
"var",
"self",
"=",
"createBaseTransport",
"(",
"req",
",",
"res",
")",
";",
"// Any error on request-response should propagate to transport.",
"req",
".",
"on",
"(",
"\"e... | The client performs a HTTP persistent connection and watches changes in response and the server prints chunk as data to response. | [
"The",
"client",
"performs",
"a",
"HTTP",
"persistent",
"connection",
"and",
"watches",
"changes",
"in",
"response",
"and",
"the",
"server",
"prints",
"chunk",
"as",
"data",
"to",
"response",
"."
] | 4a350acade3760ea13e75d7b9ce0815cf8b1d688 | https://github.com/vibe-project/vibe-protocol/blob/4a350acade3760ea13e75d7b9ce0815cf8b1d688/lib/transport-http-server.js#L206-L275 | train |
unshiftio/failure | index.js | toJSON | function toJSON() {
var obj = { message: this.message, stack: this.stack }, key;
for (key in this) {
if (
has.call(this, key)
&& 'function' !== typeof this[key]
) {
obj[key] = this[key];
}
}
return obj;
} | javascript | function toJSON() {
var obj = { message: this.message, stack: this.stack }, key;
for (key in this) {
if (
has.call(this, key)
&& 'function' !== typeof this[key]
) {
obj[key] = this[key];
}
}
return obj;
} | [
"function",
"toJSON",
"(",
")",
"{",
"var",
"obj",
"=",
"{",
"message",
":",
"this",
".",
"message",
",",
"stack",
":",
"this",
".",
"stack",
"}",
",",
"key",
";",
"for",
"(",
"key",
"in",
"this",
")",
"{",
"if",
"(",
"has",
".",
"call",
"(",
... | Return an object with all the information that should be in the JSON output.
It doesn't matter if we list keys that might not be in the err as the
JSON.stringify will remove properties who's values are set to `undefined`. So
we want to make sure that we include some common properties.
@returns {Object}
@api public | [
"Return",
"an",
"object",
"with",
"all",
"the",
"information",
"that",
"should",
"be",
"in",
"the",
"JSON",
"output",
".",
"It",
"doesn",
"t",
"matter",
"if",
"we",
"list",
"keys",
"that",
"might",
"not",
"be",
"in",
"the",
"err",
"as",
"the",
"JSON",
... | 085e848942f68d8169985799979fb69af553e196 | https://github.com/unshiftio/failure/blob/085e848942f68d8169985799979fb69af553e196/index.js#L14-L27 | train |
deepjs/autobahn | lib/app-init.js | function(session) {
if (session && session.user) {
if (session.user.roles)
return { roles: session.user.roles };
return { roles: "user" };
}
return { roles: "public" };
} | javascript | function(session) {
if (session && session.user) {
if (session.user.roles)
return { roles: session.user.roles };
return { roles: "user" };
}
return { roles: "public" };
} | [
"function",
"(",
"session",
")",
"{",
"if",
"(",
"session",
"&&",
"session",
".",
"user",
")",
"{",
"if",
"(",
"session",
".",
"user",
".",
"roles",
")",
"return",
"{",
"roles",
":",
"session",
".",
"user",
".",
"roles",
"}",
";",
"return",
"{",
... | default session modes handler | [
"default",
"session",
"modes",
"handler"
] | fe2dfa15c84a4a79bfde86abc1c63fc9f03e6cef | https://github.com/deepjs/autobahn/blob/fe2dfa15c84a4a79bfde86abc1c63fc9f03e6cef/lib/app-init.js#L179-L186 | train | |
vidi-insights/vidi-influx-sink | influx-sink.js | on_write | function on_write (metric, enc, done) {
var name = metric.name
var values = metric.values
var tags = metric.tags
locals.batch.list[name] = locals.batch.list[name] || []
locals.batch.list[name].push([values, tags])
locals.batch.count = locals.batch.count + 1
var exceeded = locals.batch.count >= locals.ba... | javascript | function on_write (metric, enc, done) {
var name = metric.name
var values = metric.values
var tags = metric.tags
locals.batch.list[name] = locals.batch.list[name] || []
locals.batch.list[name].push([values, tags])
locals.batch.count = locals.batch.count + 1
var exceeded = locals.batch.count >= locals.ba... | [
"function",
"on_write",
"(",
"metric",
",",
"enc",
",",
"done",
")",
"{",
"var",
"name",
"=",
"metric",
".",
"name",
"var",
"values",
"=",
"metric",
".",
"values",
"var",
"tags",
"=",
"metric",
".",
"tags",
"locals",
".",
"batch",
".",
"list",
"[",
... | Called each time the stream is written to | [
"Called",
"each",
"time",
"the",
"stream",
"is",
"written",
"to"
] | 613851b6f7372415e62384a8a09624d362887f0d | https://github.com/vidi-insights/vidi-influx-sink/blob/613851b6f7372415e62384a8a09624d362887f0d/influx-sink.js#L72-L89 | train |
therne/importer | lib/importer.js | importerSync | function importerSync(options, handler) {
var modulePath, recursive = false, parent = '';
if (typeof options === 'string') {
modulePath = options;
} else {
modulePath = options.path;
recursive = options.recursive || recursive;
parent = options.parent || parent;
if (... | javascript | function importerSync(options, handler) {
var modulePath, recursive = false, parent = '';
if (typeof options === 'string') {
modulePath = options;
} else {
modulePath = options.path;
recursive = options.recursive || recursive;
parent = options.parent || parent;
if (... | [
"function",
"importerSync",
"(",
"options",
",",
"handler",
")",
"{",
"var",
"modulePath",
",",
"recursive",
"=",
"false",
",",
"parent",
"=",
"''",
";",
"if",
"(",
"typeof",
"options",
"===",
"'string'",
")",
"{",
"modulePath",
"=",
"options",
";",
"}",... | Retrieves all sources in a given directory and calls handler.
@param options Import options. (or module directory path)
@param {eachModule} [handler] Called when import each module. | [
"Retrieves",
"all",
"sources",
"in",
"a",
"given",
"directory",
"and",
"calls",
"handler",
"."
] | 2c39ee45e434e7974139b96484dda11db72da467 | https://github.com/therne/importer/blob/2c39ee45e434e7974139b96484dda11db72da467/lib/importer.js#L22-L59 | train |
itsa-server/itsa-classes | classes.js | function (prototypes, force) {
var instance, proto, names, l, i, replaceMap, protectedMap, name, nameInProto, finalName, propDescriptor, extraInfo;
if (!prototypes) {
return;
}
instance = this; // the Class
proto = instance.prototype;
names = Object.getOwnProp... | javascript | function (prototypes, force) {
var instance, proto, names, l, i, replaceMap, protectedMap, name, nameInProto, finalName, propDescriptor, extraInfo;
if (!prototypes) {
return;
}
instance = this; // the Class
proto = instance.prototype;
names = Object.getOwnProp... | [
"function",
"(",
"prototypes",
",",
"force",
")",
"{",
"var",
"instance",
",",
"proto",
",",
"names",
",",
"l",
",",
"i",
",",
"replaceMap",
",",
"protectedMap",
",",
"name",
",",
"nameInProto",
",",
"finalName",
",",
"propDescriptor",
",",
"extraInfo",
... | Merges the given prototypes of properties into the `prototype` of the Class.
**Note1 ** to be used on instances --> ONLY on Classes
**Note2 ** properties with getters and/or unwritable will NOT be merged
The members in the hash prototypes will become members with
instances of the merged class.
By default, this metho... | [
"Merges",
"the",
"given",
"prototypes",
"of",
"properties",
"into",
"the",
"prototype",
"of",
"the",
"Class",
"."
] | 58f3355a5d68d528194d362fb99dd32ea31ec7cf | https://github.com/itsa-server/itsa-classes/blob/58f3355a5d68d528194d362fb99dd32ea31ec7cf/classes.js#L177-L254 | train | |
itsa-server/itsa-classes | classes.js | function (properties) {
var proto = this.prototype,
replaceMap = arguments[1] || REPLACE_CLASS_METHODS; // hidden feature, used by itags
Array.isArray(properties) || (properties=[properties]);
properties.forEach(function(prop) {
prop = replaceMap[prop] || prop;
... | javascript | function (properties) {
var proto = this.prototype,
replaceMap = arguments[1] || REPLACE_CLASS_METHODS; // hidden feature, used by itags
Array.isArray(properties) || (properties=[properties]);
properties.forEach(function(prop) {
prop = replaceMap[prop] || prop;
... | [
"function",
"(",
"properties",
")",
"{",
"var",
"proto",
"=",
"this",
".",
"prototype",
",",
"replaceMap",
"=",
"arguments",
"[",
"1",
"]",
"||",
"REPLACE_CLASS_METHODS",
";",
"// hidden feature, used by itags",
"Array",
".",
"isArray",
"(",
"properties",
")",
... | Removes the specified prototypes from the Class.
@method removePrototypes
@param properties {String|Array} Hash of properties to be removed from the Class
@chainable | [
"Removes",
"the",
"specified",
"prototypes",
"from",
"the",
"Class",
"."
] | 58f3355a5d68d528194d362fb99dd32ea31ec7cf | https://github.com/itsa-server/itsa-classes/blob/58f3355a5d68d528194d362fb99dd32ea31ec7cf/classes.js#L264-L273 | train | |
itsa-server/itsa-classes | classes.js | function(constructorFn, chainConstruct) {
var instance = this;
if (typeof constructorFn==='boolean') {
chainConstruct = constructorFn;
constructorFn = null;
}
(typeof chainConstruct === 'boolean') || (chainConstruct=DEFAULT_CHAIN_CONSTRUCT);
instance.$$con... | javascript | function(constructorFn, chainConstruct) {
var instance = this;
if (typeof constructorFn==='boolean') {
chainConstruct = constructorFn;
constructorFn = null;
}
(typeof chainConstruct === 'boolean') || (chainConstruct=DEFAULT_CHAIN_CONSTRUCT);
instance.$$con... | [
"function",
"(",
"constructorFn",
",",
"chainConstruct",
")",
"{",
"var",
"instance",
"=",
"this",
";",
"if",
"(",
"typeof",
"constructorFn",
"===",
"'boolean'",
")",
"{",
"chainConstruct",
"=",
"constructorFn",
";",
"constructorFn",
"=",
"null",
";",
"}",
"... | Redefines the constructor fo the Class
@method setConstructor
@param [constructorFn] {Function} The function that will serve as the new constructor for the class.
If `undefined` defaults to `NOOP`
@param [prototypes] {Object} Hash map of properties to be added to the prototype of the new class.
@param [chainConstruct=... | [
"Redefines",
"the",
"constructor",
"fo",
"the",
"Class"
] | 58f3355a5d68d528194d362fb99dd32ea31ec7cf | https://github.com/itsa-server/itsa-classes/blob/58f3355a5d68d528194d362fb99dd32ea31ec7cf/classes.js#L285-L295 | train | |
itsa-server/itsa-classes | classes.js | function (constructor, prototypes, chainConstruct) {
var instance = this,
constructorClosure = {},
baseProt, proto, constrFn;
if (typeof constructor === 'boolean') {
constructor = null;
prototypes = null;
chainConstruct = constructor;
... | javascript | function (constructor, prototypes, chainConstruct) {
var instance = this,
constructorClosure = {},
baseProt, proto, constrFn;
if (typeof constructor === 'boolean') {
constructor = null;
prototypes = null;
chainConstruct = constructor;
... | [
"function",
"(",
"constructor",
",",
"prototypes",
",",
"chainConstruct",
")",
"{",
"var",
"instance",
"=",
"this",
",",
"constructorClosure",
"=",
"{",
"}",
",",
"baseProt",
",",
"proto",
",",
"constrFn",
";",
"if",
"(",
"typeof",
"constructor",
"===",
"'... | Returns a newly created class inheriting from this class
using the given `constructor` with the
prototypes listed in `prototypes` merged in.
The newly created class has the `$$super` static property
available to access all of is ancestor's instance methods.
Further methods can be added via the [mergePrototypes](#met... | [
"Returns",
"a",
"newly",
"created",
"class",
"inheriting",
"from",
"this",
"class",
"using",
"the",
"given",
"constructor",
"with",
"the",
"prototypes",
"listed",
"in",
"prototypes",
"merged",
"in",
"."
] | 58f3355a5d68d528194d362fb99dd32ea31ec7cf | https://github.com/itsa-server/itsa-classes/blob/58f3355a5d68d528194d362fb99dd32ea31ec7cf/classes.js#L329-L394 | train | |
admoexperience/generator-admo | templates/bower/jquery.transit.js | checkTransform3dSupport | function checkTransform3dSupport() {
div.style[support.transform] = '';
div.style[support.transform] = 'rotateY(90deg)';
return div.style[support.transform] !== '';
} | javascript | function checkTransform3dSupport() {
div.style[support.transform] = '';
div.style[support.transform] = 'rotateY(90deg)';
return div.style[support.transform] !== '';
} | [
"function",
"checkTransform3dSupport",
"(",
")",
"{",
"div",
".",
"style",
"[",
"support",
".",
"transform",
"]",
"=",
"''",
";",
"div",
".",
"style",
"[",
"support",
".",
"transform",
"]",
"=",
"'rotateY(90deg)'",
";",
"return",
"div",
".",
"style",
"["... | Helper function to check if transform3D is supported. Should return true for Webkits and Firefox 10+. | [
"Helper",
"function",
"to",
"check",
"if",
"transform3D",
"is",
"supported",
".",
"Should",
"return",
"true",
"for",
"Webkits",
"and",
"Firefox",
"10",
"+",
"."
] | f27e261990948860e14f735f3cd7c59bf1130feb | https://github.com/admoexperience/generator-admo/blob/f27e261990948860e14f735f3cd7c59bf1130feb/templates/bower/jquery.transit.js#L56-L60 | train |
admoexperience/generator-admo | templates/bower/jquery.transit.js | function(elem, v) {
var value = v;
if (!(value instanceof Transform)) {
value = new Transform(value);
}
// We've seen the 3D version of Scale() not work in Chrome when the
// element being scaled extends outside of the viewport. Thus, we're
// forcing Chrome to not use the... | javascript | function(elem, v) {
var value = v;
if (!(value instanceof Transform)) {
value = new Transform(value);
}
// We've seen the 3D version of Scale() not work in Chrome when the
// element being scaled extends outside of the viewport. Thus, we're
// forcing Chrome to not use the... | [
"function",
"(",
"elem",
",",
"v",
")",
"{",
"var",
"value",
"=",
"v",
";",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"Transform",
")",
")",
"{",
"value",
"=",
"new",
"Transform",
"(",
"value",
")",
";",
"}",
"// We've seen the 3D version of Scale() no... | The setter accepts a `Transform` object or a string. | [
"The",
"setter",
"accepts",
"a",
"Transform",
"object",
"or",
"a",
"string",
"."
] | f27e261990948860e14f735f3cd7c59bf1130feb | https://github.com/admoexperience/generator-admo/blob/f27e261990948860e14f735f3cd7c59bf1130feb/templates/bower/jquery.transit.js#L143-L162 | train | |
admoexperience/generator-admo | templates/bower/jquery.transit.js | function() {
if (bound) { self.unbind(transitionEnd, cb); }
if (i > 0) {
self.each(function() {
this.style[support.transition] = (oldTransitions[this] || null);
});
}
if (typeof callback === 'function') { callback.apply(self); }
if (typeof nextCa... | javascript | function() {
if (bound) { self.unbind(transitionEnd, cb); }
if (i > 0) {
self.each(function() {
this.style[support.transition] = (oldTransitions[this] || null);
});
}
if (typeof callback === 'function') { callback.apply(self); }
if (typeof nextCa... | [
"function",
"(",
")",
"{",
"if",
"(",
"bound",
")",
"{",
"self",
".",
"unbind",
"(",
"transitionEnd",
",",
"cb",
")",
";",
"}",
"if",
"(",
"i",
">",
"0",
")",
"{",
"self",
".",
"each",
"(",
"function",
"(",
")",
"{",
"this",
".",
"style",
"["... | Prepare the callback. | [
"Prepare",
"the",
"callback",
"."
] | f27e261990948860e14f735f3cd7c59bf1130feb | https://github.com/admoexperience/generator-admo/blob/f27e261990948860e14f735f3cd7c59bf1130feb/templates/bower/jquery.transit.js#L589-L600 | train | |
admoexperience/generator-admo | templates/bower/jquery.transit.js | function(next) {
var i = 0;
// Durations that are too slow will get transitions mixed up.
// (Tested on Mac/FF 7.0.1)
if ((support.transition === 'MozTransition') && (i < 25)) { i = 25; }
window.setTimeout(function() { run(next); }, i);
} | javascript | function(next) {
var i = 0;
// Durations that are too slow will get transitions mixed up.
// (Tested on Mac/FF 7.0.1)
if ((support.transition === 'MozTransition') && (i < 25)) { i = 25; }
window.setTimeout(function() { run(next); }, i);
} | [
"function",
"(",
"next",
")",
"{",
"var",
"i",
"=",
"0",
";",
"// Durations that are too slow will get transitions mixed up.",
"// (Tested on Mac/FF 7.0.1)",
"if",
"(",
"(",
"support",
".",
"transition",
"===",
"'MozTransition'",
")",
"&&",
"(",
"i",
"<",
"25",
")... | Defer running. This allows the browser to paint any pending CSS it hasn't painted yet before doing the transitions. | [
"Defer",
"running",
".",
"This",
"allows",
"the",
"browser",
"to",
"paint",
"any",
"pending",
"CSS",
"it",
"hasn",
"t",
"painted",
"yet",
"before",
"doing",
"the",
"transitions",
"."
] | f27e261990948860e14f735f3cd7c59bf1130feb | https://github.com/admoexperience/generator-admo/blob/f27e261990948860e14f735f3cd7c59bf1130feb/templates/bower/jquery.transit.js#L622-L630 | train | |
getmillipede/millipede-node | lib/millipede.js | Millipede | function Millipede(size, options) {
options = options || {};
this.size = size;
this.reverse = options.reverse;
this.horizontal = options.horizontal;
this.position = options.position || 0;
this.top = options.top || 0;
this.left = options.left || 0;
this.validate();
} | javascript | function Millipede(size, options) {
options = options || {};
this.size = size;
this.reverse = options.reverse;
this.horizontal = options.horizontal;
this.position = options.position || 0;
this.top = options.top || 0;
this.left = options.left || 0;
this.validate();
} | [
"function",
"Millipede",
"(",
"size",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"size",
"=",
"size",
";",
"this",
".",
"reverse",
"=",
"options",
".",
"reverse",
";",
"this",
".",
"horizontal",
"=",
"optio... | Initialize a new `Millipede` with the given `size` and `options`.
@param {Number} size
@param {Object} options
@return {Millipede}
@public | [
"Initialize",
"a",
"new",
"Millipede",
"with",
"the",
"given",
"size",
"and",
"options",
"."
] | e68244e91e458a2916a09124847c655f993ff970 | https://github.com/getmillipede/millipede-node/blob/e68244e91e458a2916a09124847c655f993ff970/lib/millipede.js#L26-L38 | train |
interlockjs/plugins | packages/share/src/take.js | rawBundleFromFile | function rawBundleFromFile (dir, filename) {
return readFilePromise(path.join(dir, filename))
.then(content => {
return { dest: filename, raw: content };
});
} | javascript | function rawBundleFromFile (dir, filename) {
return readFilePromise(path.join(dir, filename))
.then(content => {
return { dest: filename, raw: content };
});
} | [
"function",
"rawBundleFromFile",
"(",
"dir",
",",
"filename",
")",
"{",
"return",
"readFilePromise",
"(",
"path",
".",
"join",
"(",
"dir",
",",
"filename",
")",
")",
".",
"then",
"(",
"content",
"=>",
"{",
"return",
"{",
"dest",
":",
"filename",
",",
"... | Given a directory and file in that directory, return a promise
that resolves to a bundle that contains the filename and raw
content.
@param {String} dir Valid path to directory containing Interlock bundles.
@param {String} filename Filename of bundle in dir.
@returns {Promise} Resolves to bundl... | [
"Given",
"a",
"directory",
"and",
"file",
"in",
"that",
"directory",
"return",
"a",
"promise",
"that",
"resolves",
"to",
"a",
"bundle",
"that",
"contains",
"the",
"filename",
"and",
"raw",
"content",
"."
] | 05197e4511b64d269260fe3c701ceff864897ab3 | https://github.com/interlockjs/plugins/blob/05197e4511b64d269260fe3c701ceff864897ab3/packages/share/src/take.js#L26-L31 | train |
JohnnieFucker/dreamix-rpc | lib/rpc-client/router.js | defRoute | function defRoute(session, msg, context, cb) {
const list = context.getServersByType(msg.serverType);
if (!list || !list.length) {
cb(new Error(`can not find server info for type:${msg.serverType}`));
return;
}
const uid = session ? (session.uid || '') : '';
const index = Math.abs(cr... | javascript | function defRoute(session, msg, context, cb) {
const list = context.getServersByType(msg.serverType);
if (!list || !list.length) {
cb(new Error(`can not find server info for type:${msg.serverType}`));
return;
}
const uid = session ? (session.uid || '') : '';
const index = Math.abs(cr... | [
"function",
"defRoute",
"(",
"session",
",",
"msg",
",",
"context",
",",
"cb",
")",
"{",
"const",
"list",
"=",
"context",
".",
"getServersByType",
"(",
"msg",
".",
"serverType",
")",
";",
"if",
"(",
"!",
"list",
"||",
"!",
"list",
".",
"length",
")",... | Calculate route info and return an appropriate server id.
@param session {Object} session object for current rpc request
@param msg {Object} rpc message. {serverType, service, method, args, opts}
@param context {Object} context of client
@param cb(err, serverId) | [
"Calculate",
"route",
"info",
"and",
"return",
"an",
"appropriate",
"server",
"id",
"."
] | eb29e247214148c025456b2bb0542e1094fd2edb | https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/router.js#L13-L22 | train |
JohnnieFucker/dreamix-rpc | lib/rpc-client/router.js | rdRoute | function rdRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
const index = Math.floor(Math.random() * serve... | javascript | function rdRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
const index = Math.floor(Math.random() * serve... | [
"function",
"rdRoute",
"(",
"client",
",",
"serverType",
",",
"msg",
",",
"cb",
")",
"{",
"const",
"servers",
"=",
"client",
".",
"_station",
".",
"serversMap",
"[",
"serverType",
"]",
";",
"if",
"(",
"!",
"servers",
"||",
"!",
"servers",
".",
"length"... | Random algorithm for calculating server id.
@param client {Object} rpc client.
@param serverType {String} rpc target serverType.
@param msg {Object} rpc message.
@param cb {Function} cb(err, serverId). | [
"Random",
"algorithm",
"for",
"calculating",
"server",
"id",
"."
] | eb29e247214148c025456b2bb0542e1094fd2edb | https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/router.js#L32-L40 | train |
JohnnieFucker/dreamix-rpc | lib/rpc-client/router.js | rrRoute | function rrRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
let index;
if (!client.rrParam) {
... | javascript | function rrRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
let index;
if (!client.rrParam) {
... | [
"function",
"rrRoute",
"(",
"client",
",",
"serverType",
",",
"msg",
",",
"cb",
")",
"{",
"const",
"servers",
"=",
"client",
".",
"_station",
".",
"serversMap",
"[",
"serverType",
"]",
";",
"if",
"(",
"!",
"servers",
"||",
"!",
"servers",
".",
"length"... | Round-Robin algorithm for calculating server id.
@param client {Object} rpc client.
@param serverType {String} rpc target serverType.
@param msg {Object} rpc message.
@param cb {Function} cb(err, serverId). | [
"Round",
"-",
"Robin",
"algorithm",
"for",
"calculating",
"server",
"id",
"."
] | eb29e247214148c025456b2bb0542e1094fd2edb | https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/router.js#L50-L70 | train |
JohnnieFucker/dreamix-rpc | lib/rpc-client/router.js | wrrRoute | function wrrRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
let index;
let weight;
if (!client.wr... | javascript | function wrrRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
let index;
let weight;
if (!client.wr... | [
"function",
"wrrRoute",
"(",
"client",
",",
"serverType",
",",
"msg",
",",
"cb",
")",
"{",
"const",
"servers",
"=",
"client",
".",
"_station",
".",
"serversMap",
"[",
"serverType",
"]",
";",
"if",
"(",
"!",
"servers",
"||",
"!",
"servers",
".",
"length... | Weight-Round-Robin algorithm for calculating server id.
@param client {Object} rpc client.
@param serverType {String} rpc target serverType.
@param msg {Object} rpc message.
@param cb {Function} cb(err, serverId). | [
"Weight",
"-",
"Round",
"-",
"Robin",
"algorithm",
"for",
"calculating",
"server",
"id",
"."
] | eb29e247214148c025456b2bb0542e1094fd2edb | https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/router.js#L80-L127 | train |
JohnnieFucker/dreamix-rpc | lib/rpc-client/router.js | laRoute | function laRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
const actives = [];
if (!client.laParam) {... | javascript | function laRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
const actives = [];
if (!client.laParam) {... | [
"function",
"laRoute",
"(",
"client",
",",
"serverType",
",",
"msg",
",",
"cb",
")",
"{",
"const",
"servers",
"=",
"client",
".",
"_station",
".",
"serversMap",
"[",
"serverType",
"]",
";",
"if",
"(",
"!",
"servers",
"||",
"!",
"servers",
".",
"length"... | Least-Active algorithm for calculating server id.
@param client {Object} rpc client.
@param serverType {String} rpc target serverType.
@param msg {Object} rpc message.
@param cb {Function} cb(err, serverId). | [
"Least",
"-",
"Active",
"algorithm",
"for",
"calculating",
"server",
"id",
"."
] | eb29e247214148c025456b2bb0542e1094fd2edb | https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/router.js#L137-L178 | train |
JohnnieFucker/dreamix-rpc | lib/rpc-client/router.js | chRoute | function chRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
let con;
if (!client.chParam) {
cl... | javascript | function chRoute(client, serverType, msg, cb) {
const servers = client._station.serversMap[serverType];
if (!servers || !servers.length) {
utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
return;
}
let con;
if (!client.chParam) {
cl... | [
"function",
"chRoute",
"(",
"client",
",",
"serverType",
",",
"msg",
",",
"cb",
")",
"{",
"const",
"servers",
"=",
"client",
".",
"_station",
".",
"serversMap",
"[",
"serverType",
"]",
";",
"if",
"(",
"!",
"servers",
"||",
"!",
"servers",
".",
"length"... | Consistent-Hash algorithm for calculating server id.
@param client {Object} rpc client.
@param serverType {String} rpc target serverType.
@param msg {Object} rpc message.
@param cb {Function} cb(err, serverId). | [
"Consistent",
"-",
"Hash",
"algorithm",
"for",
"calculating",
"server",
"id",
"."
] | eb29e247214148c025456b2bb0542e1094fd2edb | https://github.com/JohnnieFucker/dreamix-rpc/blob/eb29e247214148c025456b2bb0542e1094fd2edb/lib/rpc-client/router.js#L188-L208 | train |
demmer/validate-options | lib/validate-options.js | isValid | function isValid(options, key) {
var value = _.isFunction(options) ? options(key) : options[key];
if (typeof value === 'undefined') {
return false;
}
if (value === null) {
return false;
}
if (value === '') {
return false;
}
if (_.isNaN(value)) {
return... | javascript | function isValid(options, key) {
var value = _.isFunction(options) ? options(key) : options[key];
if (typeof value === 'undefined') {
return false;
}
if (value === null) {
return false;
}
if (value === '') {
return false;
}
if (_.isNaN(value)) {
return... | [
"function",
"isValid",
"(",
"options",
",",
"key",
")",
"{",
"var",
"value",
"=",
"_",
".",
"isFunction",
"(",
"options",
")",
"?",
"options",
"(",
"key",
")",
":",
"options",
"[",
"key",
"]",
";",
"if",
"(",
"typeof",
"value",
"===",
"'undefined'",
... | Check if the specified option is valid. | [
"Check",
"if",
"the",
"specified",
"option",
"is",
"valid",
"."
] | af18816366adca0b6da7347dcb31b9336b862a6d | https://github.com/demmer/validate-options/blob/af18816366adca0b6da7347dcb31b9336b862a6d/lib/validate-options.js#L11-L31 | train |
jsekamane/Cree | cree.js | function(user, stage, method){
switch (method) {
case 'withinRooms':
var room = user.getRoom();
if(stageCount(stage, room) == room.size) {
console.log("Finished syncronising in " + room.name + ". Enough members in stage " + stage);
// Once all members are present start experiment
f... | javascript | function(user, stage, method){
switch (method) {
case 'withinRooms':
var room = user.getRoom();
if(stageCount(stage, room) == room.size) {
console.log("Finished syncronising in " + room.name + ". Enough members in stage " + stage);
// Once all members are present start experiment
f... | [
"function",
"(",
"user",
",",
"stage",
",",
"method",
")",
"{",
"switch",
"(",
"method",
")",
"{",
"case",
"'withinRooms'",
":",
"var",
"room",
"=",
"user",
".",
"getRoom",
"(",
")",
";",
"if",
"(",
"stageCount",
"(",
"stage",
",",
"room",
")",
"==... | Syncronise user stages. E.g. wait for other users to catch up to the waiting stage. | [
"Syncronise",
"user",
"stages",
".",
"E",
".",
"g",
".",
"wait",
"for",
"other",
"users",
"to",
"catch",
"up",
"to",
"the",
"waiting",
"stage",
"."
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/cree.js#L161-L190 | train | |
jsekamane/Cree | cree.js | function(stage, room) {
i = 0;
var stagemembers = (typeof room === 'undefined') ? members : _.pluck(room.getMembers(true), 'id');
for(var key in stagemembers)
if(cloak.getUser(stagemembers[key]).data._stage == stage)
i++;
return i;
} | javascript | function(stage, room) {
i = 0;
var stagemembers = (typeof room === 'undefined') ? members : _.pluck(room.getMembers(true), 'id');
for(var key in stagemembers)
if(cloak.getUser(stagemembers[key]).data._stage == stage)
i++;
return i;
} | [
"function",
"(",
"stage",
",",
"room",
")",
"{",
"i",
"=",
"0",
";",
"var",
"stagemembers",
"=",
"(",
"typeof",
"room",
"===",
"'undefined'",
")",
"?",
"members",
":",
"_",
".",
"pluck",
"(",
"room",
".",
"getMembers",
"(",
"true",
")",
",",
"'id'"... | Counts and returns the number of users in a particular stage. | [
"Counts",
"and",
"returns",
"the",
"number",
"of",
"users",
"in",
"a",
"particular",
"stage",
"."
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/cree.js#L193-L200 | train | |
jsekamane/Cree | cree.js | function(url) {
i = 0;
for(var key in members)
if(cloak.getUser(members[key]).data._load == url)
i++;
return i;
} | javascript | function(url) {
i = 0;
for(var key in members)
if(cloak.getUser(members[key]).data._load == url)
i++;
return i;
} | [
"function",
"(",
"url",
")",
"{",
"i",
"=",
"0",
";",
"for",
"(",
"var",
"key",
"in",
"members",
")",
"if",
"(",
"cloak",
".",
"getUser",
"(",
"members",
"[",
"key",
"]",
")",
".",
"data",
".",
"_load",
"==",
"url",
")",
"i",
"++",
";",
"retu... | Counts and returns the number of users in a particular url. | [
"Counts",
"and",
"returns",
"the",
"number",
"of",
"users",
"in",
"a",
"particular",
"url",
"."
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/cree.js#L204-L210 | train | |
jsekamane/Cree | cree.js | function(user){
// First time nextStage() is called set the stage to zero. Otherwise keep track when continuing to the next stage
user.data._stage = (typeof user.data._stage === 'undefined') ? 0 : user.data._stage+1;
// Next stage is which type?
var type = (typeof experiment.stages[user.data._stage].type ... | javascript | function(user){
// First time nextStage() is called set the stage to zero. Otherwise keep track when continuing to the next stage
user.data._stage = (typeof user.data._stage === 'undefined') ? 0 : user.data._stage+1;
// Next stage is which type?
var type = (typeof experiment.stages[user.data._stage].type ... | [
"function",
"(",
"user",
")",
"{",
"// First time nextStage() is called set the stage to zero. Otherwise keep track when continuing to the next stage",
"user",
".",
"data",
".",
"_stage",
"=",
"(",
"typeof",
"user",
".",
"data",
".",
"_stage",
"===",
"'undefined'",
")",
"... | Push the user to the next stage | [
"Push",
"the",
"user",
"to",
"the",
"next",
"stage"
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/cree.js#L219-L250 | train | |
jsekamane/Cree | cree.js | function(){
console.log("Last user has finished the experiment!");
var userdata = new Object();
for(var key in cloak.getUsers()) {
cloak.getUsers()[key].data.device = parser.setUA(cloak.getUsers()[key].data._device).getResult(); // Parse the useragent before saving data.
userdata[cloak.getUsers()[key].id... | javascript | function(){
console.log("Last user has finished the experiment!");
var userdata = new Object();
for(var key in cloak.getUsers()) {
cloak.getUsers()[key].data.device = parser.setUA(cloak.getUsers()[key].data._device).getResult(); // Parse the useragent before saving data.
userdata[cloak.getUsers()[key].id... | [
"function",
"(",
")",
"{",
"console",
".",
"log",
"(",
"\"Last user has finished the experiment!\"",
")",
";",
"var",
"userdata",
"=",
"new",
"Object",
"(",
")",
";",
"for",
"(",
"var",
"key",
"in",
"cloak",
".",
"getUsers",
"(",
")",
")",
"{",
"cloak",
... | Finalize the experiment | [
"Finalize",
"the",
"experiment"
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/cree.js#L324-L395 | train | |
jsekamane/Cree | cree.js | function(ip) {
var unique = true;
for(var key in cloak.getLobby().getMembers()) {
if(ip == cloak.getLobby().getMembers()[key].data.ip)
unique = false;
}
return unique;
} | javascript | function(ip) {
var unique = true;
for(var key in cloak.getLobby().getMembers()) {
if(ip == cloak.getLobby().getMembers()[key].data.ip)
unique = false;
}
return unique;
} | [
"function",
"(",
"ip",
")",
"{",
"var",
"unique",
"=",
"true",
";",
"for",
"(",
"var",
"key",
"in",
"cloak",
".",
"getLobby",
"(",
")",
".",
"getMembers",
"(",
")",
")",
"{",
"if",
"(",
"ip",
"==",
"cloak",
".",
"getLobby",
"(",
")",
".",
"getM... | Check if user has same IP as a user in the lobby. | [
"Check",
"if",
"user",
"has",
"same",
"IP",
"as",
"a",
"user",
"in",
"the",
"lobby",
"."
] | ccff87d4bb5b95c8d96c44731033f29a82df871e | https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/cree.js#L420-L427 | train | |
fernandofranca/launchpod | lib/repl-socket-server.js | start | function start(config, setDefaultREPLCommands, getAppInstance) {
// Defines the IPC socket file path
var socketAddr = path.join(process.cwd(), 'socket-ctl');
// Deletes the file if already exists
if (fs.existsSync(socketAddr)) fs.unlinkSync(socketAddr);
// Create and start the socket server
socketServer ... | javascript | function start(config, setDefaultREPLCommands, getAppInstance) {
// Defines the IPC socket file path
var socketAddr = path.join(process.cwd(), 'socket-ctl');
// Deletes the file if already exists
if (fs.existsSync(socketAddr)) fs.unlinkSync(socketAddr);
// Create and start the socket server
socketServer ... | [
"function",
"start",
"(",
"config",
",",
"setDefaultREPLCommands",
",",
"getAppInstance",
")",
"{",
"// Defines the IPC socket file path",
"var",
"socketAddr",
"=",
"path",
".",
"join",
"(",
"process",
".",
"cwd",
"(",
")",
",",
"'socket-ctl'",
")",
";",
"// Del... | Starts an IPC socket server
Every new socket connection will be piped to a REPL | [
"Starts",
"an",
"IPC",
"socket",
"server",
"Every",
"new",
"socket",
"connection",
"will",
"be",
"piped",
"to",
"a",
"REPL"
] | 882d614a4271846e17b3ba0ca319340a607580bc | https://github.com/fernandofranca/launchpod/blob/882d614a4271846e17b3ba0ca319340a607580bc/lib/repl-socket-server.js#L16-L51 | train |
zland/zland-map | stores/MapStore.js | calculatePositionDiff | function calculatePositionDiff(position) {
if (!_lastDiffPosition) {
return _lastDiffPosition = position;
}
var dx, dy, p1, p2;
p1 = position;
p2 = _lastDiffPosition;
dx = p2.x - p1.x;
dy = p2.y - p1.y;
_calcMoveDiffX += dx;
_calcMoveDiffY += dy;
_overallMoveDiffY += dy;
_overallMoveDiffX += d... | javascript | function calculatePositionDiff(position) {
if (!_lastDiffPosition) {
return _lastDiffPosition = position;
}
var dx, dy, p1, p2;
p1 = position;
p2 = _lastDiffPosition;
dx = p2.x - p1.x;
dy = p2.y - p1.y;
_calcMoveDiffX += dx;
_calcMoveDiffY += dy;
_overallMoveDiffY += dy;
_overallMoveDiffX += d... | [
"function",
"calculatePositionDiff",
"(",
"position",
")",
"{",
"if",
"(",
"!",
"_lastDiffPosition",
")",
"{",
"return",
"_lastDiffPosition",
"=",
"position",
";",
"}",
"var",
"dx",
",",
"dy",
",",
"p1",
",",
"p2",
";",
"p1",
"=",
"position",
";",
"p2",
... | position diff methods | [
"position",
"diff",
"methods"
] | adff5510e3c267ce87e166f0a0354c7a85db8752 | https://github.com/zland/zland-map/blob/adff5510e3c267ce87e166f0a0354c7a85db8752/stores/MapStore.js#L220-L234 | train |
Encapsule-Annex/onm-server-rest-routes | routes.js | function(req, res) {
var packages = {};
var appJSON = require('../../package.json');
packages[appJSON.name] = appJSON;
packages['onm'] = require('../onm/package.json');
res.send(packages);
} | javascript | function(req, res) {
var packages = {};
var appJSON = require('../../package.json');
packages[appJSON.name] = appJSON;
packages['onm'] = require('../onm/package.json');
res.send(packages);
} | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"var",
"packages",
"=",
"{",
"}",
";",
"var",
"appJSON",
"=",
"require",
"(",
"'../../package.json'",
")",
";",
"packages",
"[",
"appJSON",
".",
"name",
"]",
"=",
"appJSON",
";",
"packages",
"[",
"'onm'",
... | Get basic information about this server endpoint. | [
"Get",
"basic",
"information",
"about",
"this",
"server",
"endpoint",
"."
] | 2d831d46e13be0191c3562df20b61378bed49ee6 | https://github.com/Encapsule-Annex/onm-server-rest-routes/blob/2d831d46e13be0191c3562df20b61378bed49ee6/routes.js#L14-L20 | train | |
Encapsule-Annex/onm-server-rest-routes | routes.js | function(req, res) {
var stores = [];
for (key in onmStoreDictionary) {
stores.push({
dataModel: onmStoreDictionary[key].model.jsonTag,
storeKey: key
});
}
res.send(200, stores);
} | javascript | function(req, res) {
var stores = [];
for (key in onmStoreDictionary) {
stores.push({
dataModel: onmStoreDictionary[key].model.jsonTag,
storeKey: key
});
}
res.send(200, stores);
} | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"var",
"stores",
"=",
"[",
"]",
";",
"for",
"(",
"key",
"in",
"onmStoreDictionary",
")",
"{",
"stores",
".",
"push",
"(",
"{",
"dataModel",
":",
"onmStoreDictionary",
"[",
"key",
"]",
".",
"model",
".",
... | Enumerate the in-memory onm stores managed by this node instance. | [
"Enumerate",
"the",
"in",
"-",
"memory",
"onm",
"stores",
"managed",
"by",
"this",
"node",
"instance",
"."
] | 2d831d46e13be0191c3562df20b61378bed49ee6 | https://github.com/Encapsule-Annex/onm-server-rest-routes/blob/2d831d46e13be0191c3562df20b61378bed49ee6/routes.js#L39-L48 | train | |
Encapsule-Annex/onm-server-rest-routes | routes.js | function(req, res) {
if (!req._body || (req.body == null) || !req.body) {
res.send(400, "Invalid POST missing required request body.");
return;
}
if ((req.body.model == null) || !req.body.model) {
res.send(400, "Invalid POST missing 'mo... | javascript | function(req, res) {
if (!req._body || (req.body == null) || !req.body) {
res.send(400, "Invalid POST missing required request body.");
return;
}
if ((req.body.model == null) || !req.body.model) {
res.send(400, "Invalid POST missing 'mo... | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"!",
"req",
".",
"_body",
"||",
"(",
"req",
".",
"body",
"==",
"null",
")",
"||",
"!",
"req",
".",
"body",
")",
"{",
"res",
".",
"send",
"(",
"400",
",",
"\"Invalid POST missing required requ... | Create a new in-memory data store instance using the the indicated onm data model. | [
"Create",
"a",
"new",
"in",
"-",
"memory",
"data",
"store",
"instance",
"using",
"the",
"the",
"indicated",
"onm",
"data",
"model",
"."
] | 2d831d46e13be0191c3562df20b61378bed49ee6 | https://github.com/Encapsule-Annex/onm-server-rest-routes/blob/2d831d46e13be0191c3562df20b61378bed49ee6/routes.js#L116-L138 | train | |
Encapsule-Annex/onm-server-rest-routes | routes.js | function(req, res) {
if (!req._body || (req.body == null) || !req.body) {
res.send(400, "Invalid POST missing required request body.");
return;
}
if ((req.body.store == null) || !req.body.store) {
res.send(400, "Invalid POST mising 'sto... | javascript | function(req, res) {
if (!req._body || (req.body == null) || !req.body) {
res.send(400, "Invalid POST missing required request body.");
return;
}
if ((req.body.store == null) || !req.body.store) {
res.send(400, "Invalid POST mising 'sto... | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"!",
"req",
".",
"_body",
"||",
"(",
"req",
".",
"body",
"==",
"null",
")",
"||",
"!",
"req",
".",
"body",
")",
"{",
"res",
".",
"send",
"(",
"400",
",",
"\"Invalid POST missing required requ... | Create a new component data resource in the indicated store using the specified address hash to indicate the specific component to create. | [
"Create",
"a",
"new",
"component",
"data",
"resource",
"in",
"the",
"indicated",
"store",
"using",
"the",
"specified",
"address",
"hash",
"to",
"indicate",
"the",
"specific",
"component",
"to",
"create",
"."
] | 2d831d46e13be0191c3562df20b61378bed49ee6 | https://github.com/Encapsule-Annex/onm-server-rest-routes/blob/2d831d46e13be0191c3562df20b61378bed49ee6/routes.js#L143-L178 | train | |
Encapsule-Annex/onm-server-rest-routes | routes.js | function(req, res) {
if (!req._body || (req.body == null) || !req.body) {
res.send(400, "Invalid POST missing required request body.");
return;
}
if ((req.body.store == null) || !req.body.store) {
res.send(400, "Invalid POST mising 'sto... | javascript | function(req, res) {
if (!req._body || (req.body == null) || !req.body) {
res.send(400, "Invalid POST missing required request body.");
return;
}
if ((req.body.store == null) || !req.body.store) {
res.send(400, "Invalid POST mising 'sto... | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"!",
"req",
".",
"_body",
"||",
"(",
"req",
".",
"body",
"==",
"null",
")",
"||",
"!",
"req",
".",
"body",
")",
"{",
"res",
".",
"send",
"(",
"400",
",",
"\"Invalid POST missing required requ... | Overwrite a specific data component in a specific store. | [
"Overwrite",
"a",
"specific",
"data",
"component",
"in",
"a",
"specific",
"store",
"."
] | 2d831d46e13be0191c3562df20b61378bed49ee6 | https://github.com/Encapsule-Annex/onm-server-rest-routes/blob/2d831d46e13be0191c3562df20b61378bed49ee6/routes.js#L182-L228 | train | |
Encapsule-Annex/onm-server-rest-routes | routes.js | function(req, res) {
if (!req._body || (req.body == null) || !req.body) {
res.send(400, "Invalid POST missing required request body.");
return;
}
if ((req.body.store == null) || !req.body.store) {
res.send(400, "Invalid POST missing 'st... | javascript | function(req, res) {
if (!req._body || (req.body == null) || !req.body) {
res.send(400, "Invalid POST missing required request body.");
return;
}
if ((req.body.store == null) || !req.body.store) {
res.send(400, "Invalid POST missing 'st... | [
"function",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"!",
"req",
".",
"_body",
"||",
"(",
"req",
".",
"body",
"==",
"null",
")",
"||",
"!",
"req",
".",
"body",
")",
"{",
"res",
".",
"send",
"(",
"400",
",",
"\"Invalid POST missing required requ... | Delete the named onm data store. Or, if an address is specified delete the addressed data component in the given store instead. | [
"Delete",
"the",
"named",
"onm",
"data",
"store",
".",
"Or",
"if",
"an",
"address",
"is",
"specified",
"delete",
"the",
"addressed",
"data",
"component",
"in",
"the",
"given",
"store",
"instead",
"."
] | 2d831d46e13be0191c3562df20b61378bed49ee6 | https://github.com/Encapsule-Annex/onm-server-rest-routes/blob/2d831d46e13be0191c3562df20b61378bed49ee6/routes.js#L243-L281 | train | |
vamship/wysknd-test | lib/object.js | function(target, expectedInterface, ignoreExtra) {
if (typeof target !== 'object' || target instanceof Array) {
throw new Error('target object not specified, or is not valid (arg #1)');
}
if (typeof expectedInterface !== 'object' || expectedInterface instanceof Array) {
... | javascript | function(target, expectedInterface, ignoreExtra) {
if (typeof target !== 'object' || target instanceof Array) {
throw new Error('target object not specified, or is not valid (arg #1)');
}
if (typeof expectedInterface !== 'object' || expectedInterface instanceof Array) {
... | [
"function",
"(",
"target",
",",
"expectedInterface",
",",
"ignoreExtra",
")",
"{",
"if",
"(",
"typeof",
"target",
"!==",
"'object'",
"||",
"target",
"instanceof",
"Array",
")",
"{",
"throw",
"new",
"Error",
"(",
"'target object not specified, or is not valid (arg #1... | Tests that the given object matches the specified interface.
NOTE: This functionality is also available via a few mocha assertions,
and those can be used instead. This method is being retained for
backwards compatibility purposes.
@param {Object} target The target object whose interface is being
verified.
@param {Obj... | [
"Tests",
"that",
"the",
"given",
"object",
"matches",
"the",
"specified",
"interface",
"."
] | b7791c42f1c1b36be7738e2c6d24748360634003 | https://github.com/vamship/wysknd-test/blob/b7791c42f1c1b36be7738e2c6d24748360634003/lib/object.js#L21-L58 | train | |
lyfeyaj/ovt | lib/types/any.js | function(ref, condition) {
condition = condition || {};
utils.assert(
condition.then || condition.otherwise ,
'one of condition.then or condition.otherwise must be existed'
);
utils.assert(
!condition.then || (condition.then && condition.then.isOvt),
'condition.then must be a va... | javascript | function(ref, condition) {
condition = condition || {};
utils.assert(
condition.then || condition.otherwise ,
'one of condition.then or condition.otherwise must be existed'
);
utils.assert(
!condition.then || (condition.then && condition.then.isOvt),
'condition.then must be a va... | [
"function",
"(",
"ref",
",",
"condition",
")",
"{",
"condition",
"=",
"condition",
"||",
"{",
"}",
";",
"utils",
".",
"assert",
"(",
"condition",
".",
"then",
"||",
"condition",
".",
"otherwise",
",",
"'one of condition.then or condition.otherwise must be existed'... | Check and parse ref and condition | [
"Check",
"and",
"parse",
"ref",
"and",
"condition"
] | ebd50a3531f1504cd356c869dda91200ad2f6539 | https://github.com/lyfeyaj/ovt/blob/ebd50a3531f1504cd356c869dda91200ad2f6539/lib/types/any.js#L92-L119 | train | |
unijs/bundle | build/web/c0.js | getHref | function getHref() {
return this.context.router.makeHref(this.props.to, this.props.params, this.props.query);
} | javascript | function getHref() {
return this.context.router.makeHref(this.props.to, this.props.params, this.props.query);
} | [
"function",
"getHref",
"(",
")",
"{",
"return",
"this",
".",
"context",
".",
"router",
".",
"makeHref",
"(",
"this",
".",
"props",
".",
"to",
",",
"this",
".",
"props",
".",
"params",
",",
"this",
".",
"props",
".",
"query",
")",
";",
"}"
] | Returns the value of the "href" attribute to use on the DOM element. | [
"Returns",
"the",
"value",
"of",
"the",
"href",
"attribute",
"to",
"use",
"on",
"the",
"DOM",
"element",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L217-L219 | train |
unijs/bundle | build/web/c0.js | makePath | function makePath(to, params, query) {
return this.context.router.makePath(to, params, query);
} | javascript | function makePath(to, params, query) {
return this.context.router.makePath(to, params, query);
} | [
"function",
"makePath",
"(",
"to",
",",
"params",
",",
"query",
")",
"{",
"return",
"this",
".",
"context",
".",
"router",
".",
"makePath",
"(",
"to",
",",
"params",
",",
"query",
")",
";",
"}"
] | Returns an absolute URL path created from the given route
name, URL parameters, and query values. | [
"Returns",
"an",
"absolute",
"URL",
"path",
"created",
"from",
"the",
"given",
"route",
"name",
"URL",
"parameters",
"and",
"query",
"values",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1073-L1075 | train |
unijs/bundle | build/web/c0.js | makeHref | function makeHref(to, params, query) {
return this.context.router.makeHref(to, params, query);
} | javascript | function makeHref(to, params, query) {
return this.context.router.makeHref(to, params, query);
} | [
"function",
"makeHref",
"(",
"to",
",",
"params",
",",
"query",
")",
"{",
"return",
"this",
".",
"context",
".",
"router",
".",
"makeHref",
"(",
"to",
",",
"params",
",",
"query",
")",
";",
"}"
] | Returns a string that may safely be used as the href of a
link to the route with the given name. | [
"Returns",
"a",
"string",
"that",
"may",
"safely",
"be",
"used",
"as",
"the",
"href",
"of",
"a",
"link",
"to",
"the",
"route",
"with",
"the",
"given",
"name",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1081-L1083 | train |
unijs/bundle | build/web/c0.js | isActive | function isActive(to, params, query) {
return this.context.router.isActive(to, params, query);
} | javascript | function isActive(to, params, query) {
return this.context.router.isActive(to, params, query);
} | [
"function",
"isActive",
"(",
"to",
",",
"params",
",",
"query",
")",
"{",
"return",
"this",
".",
"context",
".",
"router",
".",
"isActive",
"(",
"to",
",",
"params",
",",
"query",
")",
";",
"}"
] | A helper method to determine if a given route, params, and query
are active. | [
"A",
"helper",
"method",
"to",
"determine",
"if",
"a",
"given",
"route",
"params",
"and",
"query",
"are",
"active",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1180-L1182 | train |
unijs/bundle | build/web/c0.js | appendChild | function appendChild(route) {
invariant(route instanceof Route, 'route.appendChild must use a valid Route');
if (!this.childRoutes) this.childRoutes = [];
this.childRoutes.push(route);
} | javascript | function appendChild(route) {
invariant(route instanceof Route, 'route.appendChild must use a valid Route');
if (!this.childRoutes) this.childRoutes = [];
this.childRoutes.push(route);
} | [
"function",
"appendChild",
"(",
"route",
")",
"{",
"invariant",
"(",
"route",
"instanceof",
"Route",
",",
"'route.appendChild must use a valid Route'",
")",
";",
"if",
"(",
"!",
"this",
".",
"childRoutes",
")",
"this",
".",
"childRoutes",
"=",
"[",
"]",
";",
... | Appends the given route to this route's child routes. | [
"Appends",
"the",
"given",
"route",
"to",
"this",
"route",
"s",
"child",
"routes",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1223-L1229 | train |
unijs/bundle | build/web/c0.js | makePath | function makePath(to, params, query) {
var path;
if (PathUtils.isAbsolute(to)) {
path = to;
} else {
var route = to instanceof Route ? to : Router.namedRoutes[to];
invariant(route instanceof Route, 'Cannot find a route named "%s"', to);
path = route.path... | javascript | function makePath(to, params, query) {
var path;
if (PathUtils.isAbsolute(to)) {
path = to;
} else {
var route = to instanceof Route ? to : Router.namedRoutes[to];
invariant(route instanceof Route, 'Cannot find a route named "%s"', to);
path = route.path... | [
"function",
"makePath",
"(",
"to",
",",
"params",
",",
"query",
")",
"{",
"var",
"path",
";",
"if",
"(",
"PathUtils",
".",
"isAbsolute",
"(",
"to",
")",
")",
"{",
"path",
"=",
"to",
";",
"}",
"else",
"{",
"var",
"route",
"=",
"to",
"instanceof",
... | Returns an absolute URL path created from the given route
name, URL parameters, and query. | [
"Returns",
"an",
"absolute",
"URL",
"path",
"created",
"from",
"the",
"given",
"route",
"name",
"URL",
"parameters",
"and",
"query",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1665-L1678 | train |
unijs/bundle | build/web/c0.js | makeHref | function makeHref(to, params, query) {
var path = Router.makePath(to, params, query);
return location === HashLocation ? '#' + path : path;
} | javascript | function makeHref(to, params, query) {
var path = Router.makePath(to, params, query);
return location === HashLocation ? '#' + path : path;
} | [
"function",
"makeHref",
"(",
"to",
",",
"params",
",",
"query",
")",
"{",
"var",
"path",
"=",
"Router",
".",
"makePath",
"(",
"to",
",",
"params",
",",
"query",
")",
";",
"return",
"location",
"===",
"HashLocation",
"?",
"'#'",
"+",
"path",
":",
"pat... | Returns a string that may safely be used as the href of a link
to the route with the given name, URL parameters, and query. | [
"Returns",
"a",
"string",
"that",
"may",
"safely",
"be",
"used",
"as",
"the",
"href",
"of",
"a",
"link",
"to",
"the",
"route",
"with",
"the",
"given",
"name",
"URL",
"parameters",
"and",
"query",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1684-L1687 | train |
unijs/bundle | build/web/c0.js | goBack | function goBack() {
if (History.length > 1 || location === RefreshLocation) {
location.pop();
return true;
}
warning(false, 'goBack() was ignored because there is no router history');
return false;
} | javascript | function goBack() {
if (History.length > 1 || location === RefreshLocation) {
location.pop();
return true;
}
warning(false, 'goBack() was ignored because there is no router history');
return false;
} | [
"function",
"goBack",
"(",
")",
"{",
"if",
"(",
"History",
".",
"length",
">",
"1",
"||",
"location",
"===",
"RefreshLocation",
")",
"{",
"location",
".",
"pop",
"(",
")",
";",
"return",
"true",
";",
"}",
"warning",
"(",
"false",
",",
"'goBack() was ig... | Transitions to the previous URL if one is available. Returns true if the
router was able to go back, false otherwise.
Note: The router only tracks history entries in your application, not the
current browser session, so you can safely call this function without guarding
against sending the user back to some other site... | [
"Transitions",
"to",
"the",
"previous",
"URL",
"if",
"one",
"is",
"available",
".",
"Returns",
"true",
"if",
"the",
"router",
"was",
"able",
"to",
"go",
"back",
"false",
"otherwise",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1723-L1732 | train |
unijs/bundle | build/web/c0.js | isActive | function isActive(to, params, query) {
if (PathUtils.isAbsolute(to)) {
return to === state.path;
}return routeIsActive(state.routes, to) && paramsAreActive(state.params, params) && (query == null || queryIsActive(state.query, query));
} | javascript | function isActive(to, params, query) {
if (PathUtils.isAbsolute(to)) {
return to === state.path;
}return routeIsActive(state.routes, to) && paramsAreActive(state.params, params) && (query == null || queryIsActive(state.query, query));
} | [
"function",
"isActive",
"(",
"to",
",",
"params",
",",
"query",
")",
"{",
"if",
"(",
"PathUtils",
".",
"isAbsolute",
"(",
"to",
")",
")",
"{",
"return",
"to",
"===",
"state",
".",
"path",
";",
"}",
"return",
"routeIsActive",
"(",
"state",
".",
"route... | Returns true if the given route, params, and query are active. | [
"Returns",
"true",
"if",
"the",
"given",
"route",
"params",
"and",
"query",
"are",
"active",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L1935-L1939 | train |
unijs/bundle | build/web/c0.js | extractParams | function extractParams(pattern, path) {
var _compilePattern = compilePattern(pattern);
var matcher = _compilePattern.matcher;
var paramNames = _compilePattern.paramNames;
var match = path.match(matcher);
if (!match) {
return null;
}var params = {};
paramNames.forEach(function (para... | javascript | function extractParams(pattern, path) {
var _compilePattern = compilePattern(pattern);
var matcher = _compilePattern.matcher;
var paramNames = _compilePattern.paramNames;
var match = path.match(matcher);
if (!match) {
return null;
}var params = {};
paramNames.forEach(function (para... | [
"function",
"extractParams",
"(",
"pattern",
",",
"path",
")",
"{",
"var",
"_compilePattern",
"=",
"compilePattern",
"(",
"pattern",
")",
";",
"var",
"matcher",
"=",
"_compilePattern",
".",
"matcher",
";",
"var",
"paramNames",
"=",
"_compilePattern",
".",
"par... | Extracts the portions of the given URL path that match the given pattern
and returns an object of param name => value pairs. Returns null if the
pattern does not match the given path. | [
"Extracts",
"the",
"portions",
"of",
"the",
"given",
"URL",
"path",
"that",
"match",
"the",
"given",
"pattern",
"and",
"returns",
"an",
"object",
"of",
"param",
"name",
"=",
">",
"value",
"pairs",
".",
"Returns",
"null",
"if",
"the",
"pattern",
"does",
"... | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L2727-L2744 | train |
unijs/bundle | build/web/c0.js | injectParams | function injectParams(pattern, params) {
params = params || {};
var splatIndex = 0;
return pattern.replace(paramInjectMatcher, function (match, paramName) {
paramName = paramName || 'splat';
// If param is optional don't check for existence
if (paramName.slice(-1) === '?') {
par... | javascript | function injectParams(pattern, params) {
params = params || {};
var splatIndex = 0;
return pattern.replace(paramInjectMatcher, function (match, paramName) {
paramName = paramName || 'splat';
// If param is optional don't check for existence
if (paramName.slice(-1) === '?') {
par... | [
"function",
"injectParams",
"(",
"pattern",
",",
"params",
")",
"{",
"params",
"=",
"params",
"||",
"{",
"}",
";",
"var",
"splatIndex",
"=",
"0",
";",
"return",
"pattern",
".",
"replace",
"(",
"paramInjectMatcher",
",",
"function",
"(",
"match",
",",
"pa... | Returns a version of the given route path with params interpolated. Throws
if there is a dynamic segment of the route path for which there is no param. | [
"Returns",
"a",
"version",
"of",
"the",
"given",
"route",
"path",
"with",
"params",
"interpolated",
".",
"Throws",
"if",
"there",
"is",
"a",
"dynamic",
"segment",
"of",
"the",
"route",
"path",
"for",
"which",
"there",
"is",
"no",
"param",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L2750-L2778 | train |
unijs/bundle | build/web/c0.js | extractQuery | function extractQuery(path) {
var match = path.match(queryMatcher);
return match && qs.parse(match[1]);
} | javascript | function extractQuery(path) {
var match = path.match(queryMatcher);
return match && qs.parse(match[1]);
} | [
"function",
"extractQuery",
"(",
"path",
")",
"{",
"var",
"match",
"=",
"path",
".",
"match",
"(",
"queryMatcher",
")",
";",
"return",
"match",
"&&",
"qs",
".",
"parse",
"(",
"match",
"[",
"1",
"]",
")",
";",
"}"
] | Returns an object that is the result of parsing any query string contained
in the given path, null if the path contains no query string. | [
"Returns",
"an",
"object",
"that",
"is",
"the",
"result",
"of",
"parsing",
"any",
"query",
"string",
"contained",
"in",
"the",
"given",
"path",
"null",
"if",
"the",
"path",
"contains",
"no",
"query",
"string",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L2784-L2787 | train |
unijs/bundle | build/web/c0.js | withQuery | function withQuery(path, query) {
var existingQuery = PathUtils.extractQuery(path);
if (existingQuery) query = query ? assign(existingQuery, query) : existingQuery;
var queryString = qs.stringify(query, { arrayFormat: 'brackets' });
if (queryString) {
return PathUtils.withoutQuery(path) + '?' +... | javascript | function withQuery(path, query) {
var existingQuery = PathUtils.extractQuery(path);
if (existingQuery) query = query ? assign(existingQuery, query) : existingQuery;
var queryString = qs.stringify(query, { arrayFormat: 'brackets' });
if (queryString) {
return PathUtils.withoutQuery(path) + '?' +... | [
"function",
"withQuery",
"(",
"path",
",",
"query",
")",
"{",
"var",
"existingQuery",
"=",
"PathUtils",
".",
"extractQuery",
"(",
"path",
")",
";",
"if",
"(",
"existingQuery",
")",
"query",
"=",
"query",
"?",
"assign",
"(",
"existingQuery",
",",
"query",
... | Returns a version of the given path with the parameters in the given
query merged into the query string. | [
"Returns",
"a",
"version",
"of",
"the",
"given",
"path",
"with",
"the",
"parameters",
"in",
"the",
"given",
"query",
"merged",
"into",
"the",
"query",
"string",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L2800-L2810 | train |
unijs/bundle | build/web/c0.js | Transition | function Transition(path, retry) {
this.path = path;
this.abortReason = null;
// TODO: Change this to router.retryTransition(transition)
this.retry = retry.bind(this);
} | javascript | function Transition(path, retry) {
this.path = path;
this.abortReason = null;
// TODO: Change this to router.retryTransition(transition)
this.retry = retry.bind(this);
} | [
"function",
"Transition",
"(",
"path",
",",
"retry",
")",
"{",
"this",
".",
"path",
"=",
"path",
";",
"this",
".",
"abortReason",
"=",
"null",
";",
"// TODO: Change this to router.retryTransition(transition)",
"this",
".",
"retry",
"=",
"retry",
".",
"bind",
"... | Encapsulates a transition to a given path.
The willTransitionTo and willTransitionFrom handlers receive
an instance of this class as their first argument. | [
"Encapsulates",
"a",
"transition",
"to",
"a",
"given",
"path",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L2922-L2927 | train |
unijs/bundle | build/web/c0.js | findMatch | function findMatch(routes, path) {
var pathname = PathUtils.withoutQuery(path);
var query = PathUtils.extractQuery(path);
var match = null;
for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query);
return match;
} | javascript | function findMatch(routes, path) {
var pathname = PathUtils.withoutQuery(path);
var query = PathUtils.extractQuery(path);
var match = null;
for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query);
return match;
} | [
"function",
"findMatch",
"(",
"routes",
",",
"path",
")",
"{",
"var",
"pathname",
"=",
"PathUtils",
".",
"withoutQuery",
"(",
"path",
")",
";",
"var",
"query",
"=",
"PathUtils",
".",
"extractQuery",
"(",
"path",
")",
";",
"var",
"match",
"=",
"null",
"... | Attempts to match depth-first a route in the given route's
subtree against the given path and returns the match if it
succeeds, null if no match can be made. | [
"Attempts",
"to",
"match",
"depth",
"-",
"first",
"a",
"route",
"in",
"the",
"given",
"route",
"s",
"subtree",
"against",
"the",
"given",
"path",
"and",
"returns",
"the",
"match",
"if",
"it",
"succeeds",
"null",
"if",
"no",
"match",
"can",
"be",
"made",
... | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L3071-L3079 | train |
unijs/bundle | build/web/c0.js | bindAutoBindMethod | function bindAutoBindMethod(component, method) {
var boundMethod = method.bind(component);
if ("production" !== process.env.NODE_ENV) {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constr... | javascript | function bindAutoBindMethod(component, method) {
var boundMethod = method.bind(component);
if ("production" !== process.env.NODE_ENV) {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constr... | [
"function",
"bindAutoBindMethod",
"(",
"component",
",",
"method",
")",
"{",
"var",
"boundMethod",
"=",
"method",
".",
"bind",
"(",
"component",
")",
";",
"if",
"(",
"\"production\"",
"!==",
"process",
".",
"env",
".",
"NODE_ENV",
")",
"{",
"boundMethod",
... | Binds a method to the component.
@param {object} component Component whose method is going to be bound.
@param {function} method Method to be bound.
@return {function} The bound method. | [
"Binds",
"a",
"method",
"to",
"the",
"component",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L4280-L4319 | train |
unijs/bundle | build/web/c0.js | function(type, key, ref, owner, context, props) {
// Built-in properties that belong on the element
this.type = type;
this.key = key;
this.ref = ref;
// Record the component responsible for creating this element.
this._owner = owner;
// TODO: Deprecate withContext, and then the context becomes accessibl... | javascript | function(type, key, ref, owner, context, props) {
// Built-in properties that belong on the element
this.type = type;
this.key = key;
this.ref = ref;
// Record the component responsible for creating this element.
this._owner = owner;
// TODO: Deprecate withContext, and then the context becomes accessibl... | [
"function",
"(",
"type",
",",
"key",
",",
"ref",
",",
"owner",
",",
"context",
",",
"props",
")",
"{",
"// Built-in properties that belong on the element",
"this",
".",
"type",
"=",
"type",
";",
"this",
".",
"key",
"=",
"key",
";",
"this",
".",
"ref",
"=... | Base constructor for all React elements. This is only used to make this
work with a dynamic instanceof check. Nothing should live on this prototype.
@param {*} type
@param {string|object} ref
@param {*} key
@param {*} props
@internal | [
"Base",
"constructor",
"for",
"all",
"React",
"elements",
".",
"This",
"is",
"only",
"used",
"to",
"make",
"this",
"work",
"with",
"a",
"dynamic",
"instanceof",
"check",
".",
"Nothing",
"should",
"live",
"on",
"this",
"prototype",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L4780-L4824 | train | |
unijs/bundle | build/web/c0.js | getName | function getName(instance) {
var publicInstance = instance && instance.getPublicInstance();
if (!publicInstance) {
return undefined;
}
var constructor = publicInstance.constructor;
if (!constructor) {
return undefined;
}
return constructor.displayName || constructor.name || undefined;
} | javascript | function getName(instance) {
var publicInstance = instance && instance.getPublicInstance();
if (!publicInstance) {
return undefined;
}
var constructor = publicInstance.constructor;
if (!constructor) {
return undefined;
}
return constructor.displayName || constructor.name || undefined;
} | [
"function",
"getName",
"(",
"instance",
")",
"{",
"var",
"publicInstance",
"=",
"instance",
"&&",
"instance",
".",
"getPublicInstance",
"(",
")",
";",
"if",
"(",
"!",
"publicInstance",
")",
"{",
"return",
"undefined",
";",
"}",
"var",
"constructor",
"=",
"... | Gets the instance's name for use in warnings.
@internal
@return {?string} Display name or undefined | [
"Gets",
"the",
"instance",
"s",
"name",
"for",
"use",
"in",
"warnings",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5053-L5063 | train |
unijs/bundle | build/web/c0.js | validateExplicitKey | function validateExplicitKey(element, parentType) {
if (element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
warnAndMonitorForKeyUse(
'Each child in an array or iterator should have a unique "key" prop.',
element,
parentType
);
} | javascript | function validateExplicitKey(element, parentType) {
if (element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
warnAndMonitorForKeyUse(
'Each child in an array or iterator should have a unique "key" prop.',
element,
parentType
);
} | [
"function",
"validateExplicitKey",
"(",
"element",
",",
"parentType",
")",
"{",
"if",
"(",
"element",
".",
"_store",
".",
"validated",
"||",
"element",
".",
"key",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"element",
".",
"_store",
".",
"validated",
"=... | Warn if the element doesn't have an explicit key assigned to it.
This element is in an array. The array could grow and shrink or be
reordered. All children that haven't already been validated are required to
have a "key" property assigned to it.
@internal
@param {ReactElement} element Element that requires a key.
@par... | [
"Warn",
"if",
"the",
"element",
"doesn",
"t",
"have",
"an",
"explicit",
"key",
"assigned",
"to",
"it",
".",
"This",
"element",
"is",
"in",
"an",
"array",
".",
"The",
"array",
"could",
"grow",
"and",
"shrink",
"or",
"be",
"reordered",
".",
"All",
"child... | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5088-L5099 | train |
unijs/bundle | build/web/c0.js | validatePropertyKey | function validatePropertyKey(name, element, parentType) {
if (!NUMERIC_PROPERTY_REGEX.test(name)) {
return;
}
warnAndMonitorForKeyUse(
'Child objects should have non-numeric keys so ordering is preserved.',
element,
parentType
);
} | javascript | function validatePropertyKey(name, element, parentType) {
if (!NUMERIC_PROPERTY_REGEX.test(name)) {
return;
}
warnAndMonitorForKeyUse(
'Child objects should have non-numeric keys so ordering is preserved.',
element,
parentType
);
} | [
"function",
"validatePropertyKey",
"(",
"name",
",",
"element",
",",
"parentType",
")",
"{",
"if",
"(",
"!",
"NUMERIC_PROPERTY_REGEX",
".",
"test",
"(",
"name",
")",
")",
"{",
"return",
";",
"}",
"warnAndMonitorForKeyUse",
"(",
"'Child objects should have non-nume... | Warn if the key is being defined as an object property but has an incorrect
value.
@internal
@param {string} name Property name of the key.
@param {ReactElement} element Component that requires a key.
@param {*} parentType element's parent's type. | [
"Warn",
"if",
"the",
"key",
"is",
"being",
"defined",
"as",
"an",
"object",
"property",
"but",
"has",
"an",
"incorrect",
"value",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5110-L5119 | train |
unijs/bundle | build/web/c0.js | warnAndMonitorForKeyUse | function warnAndMonitorForKeyUse(message, element, parentType) {
var ownerName = getCurrentOwnerDisplayName();
var parentName = typeof parentType === 'string' ?
parentType : parentType.displayName || parentType.name;
var useName = ownerName || parentName;
var memoizer = ownerHasKeyUseWarning[message] || (
... | javascript | function warnAndMonitorForKeyUse(message, element, parentType) {
var ownerName = getCurrentOwnerDisplayName();
var parentName = typeof parentType === 'string' ?
parentType : parentType.displayName || parentType.name;
var useName = ownerName || parentName;
var memoizer = ownerHasKeyUseWarning[message] || (
... | [
"function",
"warnAndMonitorForKeyUse",
"(",
"message",
",",
"element",
",",
"parentType",
")",
"{",
"var",
"ownerName",
"=",
"getCurrentOwnerDisplayName",
"(",
")",
";",
"var",
"parentName",
"=",
"typeof",
"parentType",
"===",
"'string'",
"?",
"parentType",
":",
... | Shared warning and monitoring code for the key warnings.
@internal
@param {string} message The base warning that gets output.
@param {ReactElement} element Component that requires a key.
@param {*} parentType element's parent's type. | [
"Shared",
"warning",
"and",
"monitoring",
"code",
"for",
"the",
"key",
"warnings",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5129-L5167 | train |
unijs/bundle | build/web/c0.js | validateChildKeys | function validateChildKeys(node, parentType) {
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
if (ReactElement.isValidElement(child)) {
validateExplicitKey(child, parentType);
}
}
} else if (ReactElement.isValidElement(node)) {
// This e... | javascript | function validateChildKeys(node, parentType) {
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
if (ReactElement.isValidElement(child)) {
validateExplicitKey(child, parentType);
}
}
} else if (ReactElement.isValidElement(node)) {
// This e... | [
"function",
"validateChildKeys",
"(",
"node",
",",
"parentType",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"node",
")",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"node",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
... | Ensure that every element either is passed in a static location, in an
array with an explicit keys property defined, or in an object literal
with valid key property.
@internal
@param {ReactNode} node Statically passed child of any type.
@param {*} parentType node's parent's type. | [
"Ensure",
"that",
"every",
"element",
"either",
"is",
"passed",
"in",
"a",
"static",
"location",
"in",
"an",
"array",
"with",
"an",
"explicit",
"keys",
"property",
"defined",
"or",
"in",
"an",
"object",
"literal",
"with",
"valid",
"key",
"property",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5178-L5211 | train |
unijs/bundle | build/web/c0.js | is | function is(a, b) {
if (a !== a) {
// NaN
return b !== b;
}
if (a === 0 && b === 0) {
// +-0
return 1 / a === 1 / b;
}
return a === b;
} | javascript | function is(a, b) {
if (a !== a) {
// NaN
return b !== b;
}
if (a === 0 && b === 0) {
// +-0
return 1 / a === 1 / b;
}
return a === b;
} | [
"function",
"is",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"a",
"!==",
"a",
")",
"{",
"// NaN",
"return",
"b",
"!==",
"b",
";",
"}",
"if",
"(",
"a",
"===",
"0",
"&&",
"b",
"===",
"0",
")",
"{",
"// +-0",
"return",
"1",
"/",
"a",
"===",
"1... | Inline Object.is polyfill | [
"Inline",
"Object",
".",
"is",
"polyfill"
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5297-L5307 | train |
unijs/bundle | build/web/c0.js | isValidID | function isValidID(id) {
return id === '' || (
id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
);
} | javascript | function isValidID(id) {
return id === '' || (
id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR
);
} | [
"function",
"isValidID",
"(",
"id",
")",
"{",
"return",
"id",
"===",
"''",
"||",
"(",
"id",
".",
"charAt",
"(",
"0",
")",
"===",
"SEPARATOR",
"&&",
"id",
".",
"charAt",
"(",
"id",
".",
"length",
"-",
"1",
")",
"!==",
"SEPARATOR",
")",
";",
"}"
] | Checks if the supplied string is a valid React DOM ID.
@param {string} id A React DOM ID, maybe.
@return {boolean} True if the string is a valid React DOM ID.
@private | [
"Checks",
"if",
"the",
"supplied",
"string",
"is",
"a",
"valid",
"React",
"DOM",
"ID",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5969-L5973 | train |
unijs/bundle | build/web/c0.js | isAncestorIDOf | function isAncestorIDOf(ancestorID, descendantID) {
return (
descendantID.indexOf(ancestorID) === 0 &&
isBoundary(descendantID, ancestorID.length)
);
} | javascript | function isAncestorIDOf(ancestorID, descendantID) {
return (
descendantID.indexOf(ancestorID) === 0 &&
isBoundary(descendantID, ancestorID.length)
);
} | [
"function",
"isAncestorIDOf",
"(",
"ancestorID",
",",
"descendantID",
")",
"{",
"return",
"(",
"descendantID",
".",
"indexOf",
"(",
"ancestorID",
")",
"===",
"0",
"&&",
"isBoundary",
"(",
"descendantID",
",",
"ancestorID",
".",
"length",
")",
")",
";",
"}"
] | Checks if the first ID is an ancestor of or equal to the second ID.
@param {string} ancestorID
@param {string} descendantID
@return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
@internal | [
"Checks",
"if",
"the",
"first",
"ID",
"is",
"an",
"ancestor",
"of",
"or",
"equal",
"to",
"the",
"second",
"ID",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L5983-L5988 | train |
unijs/bundle | build/web/c0.js | function(nextComponent, container) {
("production" !== process.env.NODE_ENV ? invariant(
container && (
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
),
'_registerComponent(...): Target container is not a DOM element.'
) : invariant(container && (
... | javascript | function(nextComponent, container) {
("production" !== process.env.NODE_ENV ? invariant(
container && (
(container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE)
),
'_registerComponent(...): Target container is not a DOM element.'
) : invariant(container && (
... | [
"function",
"(",
"nextComponent",
",",
"container",
")",
"{",
"(",
"\"production\"",
"!==",
"process",
".",
"env",
".",
"NODE_ENV",
"?",
"invariant",
"(",
"container",
"&&",
"(",
"(",
"container",
".",
"nodeType",
"===",
"ELEMENT_NODE_TYPE",
"||",
"container",... | Register a component into the instance map and starts scroll value
monitoring
@param {ReactComponent} nextComponent component instance to render
@param {DOMElement} container container to render into
@return {string} reactRoot ID prefix | [
"Register",
"a",
"component",
"into",
"the",
"instance",
"map",
"and",
"starts",
"scroll",
"value",
"monitoring"
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L6601-L6616 | train | |
unijs/bundle | build/web/c0.js | function(
nextElement,
container,
shouldReuseMarkup
) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
("production" !== process.env.NODE_ENV ? warning(
ReactCurr... | javascript | function(
nextElement,
container,
shouldReuseMarkup
) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
("production" !== process.env.NODE_ENV ? warning(
ReactCurr... | [
"function",
"(",
"nextElement",
",",
"container",
",",
"shouldReuseMarkup",
")",
"{",
"// Various parts of our code (such as ReactCompositeComponent's",
"// _renderValidatedComponent) assume that calls to render aren't nested;",
"// verify that that's the case.",
"(",
"\"production\"",
"... | Render a new component into the DOM.
@param {ReactElement} nextElement element to render
@param {DOMElement} container container to render into
@param {boolean} shouldReuseMarkup if we should skip the markup insertion
@return {ReactComponent} nextComponent | [
"Render",
"a",
"new",
"component",
"into",
"the",
"DOM",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L6625-L6666 | train | |
unijs/bundle | build/web/c0.js | function(constructor, props, container) {
var element = ReactElement.createElement(constructor, props);
return ReactMount.render(element, container);
} | javascript | function(constructor, props, container) {
var element = ReactElement.createElement(constructor, props);
return ReactMount.render(element, container);
} | [
"function",
"(",
"constructor",
",",
"props",
",",
"container",
")",
"{",
"var",
"element",
"=",
"ReactElement",
".",
"createElement",
"(",
"constructor",
",",
"props",
")",
";",
"return",
"ReactMount",
".",
"render",
"(",
"element",
",",
"container",
")",
... | Constructs a component instance of `constructor` with `initialProps` and
renders it into the supplied `container`.
@param {function} constructor React component constructor.
@param {?object} props Initial props of the component instance.
@param {DOMElement} container DOM element to render into.
@return {ReactComponent... | [
"Constructs",
"a",
"component",
"instance",
"of",
"constructor",
"with",
"initialProps",
"and",
"renders",
"it",
"into",
"the",
"supplied",
"container",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L6760-L6763 | train | |
unijs/bundle | build/web/c0.js | function(id) {
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
var container = containersByReactRootID[reactRootID];
if ("production" !== process.env.NODE_ENV) {
var rootElement = rootElementsByReactRootID[reactRootID];
if (rootElement && rootElement.parentNode !== containe... | javascript | function(id) {
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
var container = containersByReactRootID[reactRootID];
if ("production" !== process.env.NODE_ENV) {
var rootElement = rootElementsByReactRootID[reactRootID];
if (rootElement && rootElement.parentNode !== containe... | [
"function",
"(",
"id",
")",
"{",
"var",
"reactRootID",
"=",
"ReactInstanceHandles",
".",
"getReactRootIDFromNodeID",
"(",
"id",
")",
";",
"var",
"container",
"=",
"containersByReactRootID",
"[",
"reactRootID",
"]",
";",
"if",
"(",
"\"production\"",
"!==",
"proce... | Finds the container DOM element that contains React component to which the
supplied DOM `id` belongs.
@param {string} id The ID of an element rendered by a React component.
@return {?DOMElement} DOM element that contains the `id`. | [
"Finds",
"the",
"container",
"DOM",
"element",
"that",
"contains",
"React",
"component",
"to",
"which",
"the",
"supplied",
"DOM",
"id",
"belongs",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L6878-L6913 | train | |
unijs/bundle | build/web/c0.js | function(node) {
if (node.nodeType !== 1) {
// Not a DOMElement, therefore not a React component
return false;
}
var id = ReactMount.getID(node);
return id ? id.charAt(0) === SEPARATOR : false;
} | javascript | function(node) {
if (node.nodeType !== 1) {
// Not a DOMElement, therefore not a React component
return false;
}
var id = ReactMount.getID(node);
return id ? id.charAt(0) === SEPARATOR : false;
} | [
"function",
"(",
"node",
")",
"{",
"if",
"(",
"node",
".",
"nodeType",
"!==",
"1",
")",
"{",
"// Not a DOMElement, therefore not a React component",
"return",
"false",
";",
"}",
"var",
"id",
"=",
"ReactMount",
".",
"getID",
"(",
"node",
")",
";",
"return",
... | True if the supplied `node` is rendered by React.
@param {*} node DOM Element to check.
@return {boolean} True if the DOM Element appears to be rendered by React.
@internal | [
"True",
"if",
"the",
"supplied",
"node",
"is",
"rendered",
"by",
"React",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L6933-L6940 | train | |
unijs/bundle | build/web/c0.js | function(node) {
var current = node;
while (current && current.parentNode !== current) {
if (ReactMount.isRenderedByReact(current)) {
return current;
}
current = current.parentNode;
}
return null;
} | javascript | function(node) {
var current = node;
while (current && current.parentNode !== current) {
if (ReactMount.isRenderedByReact(current)) {
return current;
}
current = current.parentNode;
}
return null;
} | [
"function",
"(",
"node",
")",
"{",
"var",
"current",
"=",
"node",
";",
"while",
"(",
"current",
"&&",
"current",
".",
"parentNode",
"!==",
"current",
")",
"{",
"if",
"(",
"ReactMount",
".",
"isRenderedByReact",
"(",
"current",
")",
")",
"{",
"return",
... | Traverses up the ancestors of the supplied node to find a node that is a
DOM representation of a React component.
@param {*} node
@return {?DOMEventTarget}
@internal | [
"Traverses",
"up",
"the",
"ancestors",
"of",
"the",
"supplied",
"node",
"to",
"find",
"a",
"node",
"that",
"is",
"a",
"DOM",
"representation",
"of",
"a",
"React",
"component",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L6950-L6959 | train | |
unijs/bundle | build/web/c0.js | function(publicInstance, partialProps) {
var internalInstance = getInternalInstanceReadyForUpdate(
publicInstance,
'setProps'
);
if (!internalInstance) {
return;
}
("production" !== process.env.NODE_ENV ? invariant(
internalInstance._isTopLevel,
'setProps(...): You ca... | javascript | function(publicInstance, partialProps) {
var internalInstance = getInternalInstanceReadyForUpdate(
publicInstance,
'setProps'
);
if (!internalInstance) {
return;
}
("production" !== process.env.NODE_ENV ? invariant(
internalInstance._isTopLevel,
'setProps(...): You ca... | [
"function",
"(",
"publicInstance",
",",
"partialProps",
")",
"{",
"var",
"internalInstance",
"=",
"getInternalInstanceReadyForUpdate",
"(",
"publicInstance",
",",
"'setProps'",
")",
";",
"if",
"(",
"!",
"internalInstance",
")",
"{",
"return",
";",
"}",
"(",
"\"p... | Sets a subset of the props.
@param {ReactClass} publicInstance The instance that should rerender.
@param {object} partialProps Subset of the next props.
@internal | [
"Sets",
"a",
"subset",
"of",
"the",
"props",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L8973-L9003 | train | |
unijs/bundle | build/web/c0.js | function(transaction, prevElement, nextElement, context) {
assertValidProps(this._currentElement.props);
this._updateDOMProperties(prevElement.props, transaction);
this._updateDOMChildren(prevElement.props, transaction, context);
} | javascript | function(transaction, prevElement, nextElement, context) {
assertValidProps(this._currentElement.props);
this._updateDOMProperties(prevElement.props, transaction);
this._updateDOMChildren(prevElement.props, transaction, context);
} | [
"function",
"(",
"transaction",
",",
"prevElement",
",",
"nextElement",
",",
"context",
")",
"{",
"assertValidProps",
"(",
"this",
".",
"_currentElement",
".",
"props",
")",
";",
"this",
".",
"_updateDOMProperties",
"(",
"prevElement",
".",
"props",
",",
"tran... | Updates a native DOM component after it has already been allocated and
attached to the DOM. Reconciles the root DOM node, then recurses.
@param {ReactReconcileTransaction} transaction
@param {ReactElement} prevElement
@param {ReactElement} nextElement
@internal
@overridable | [
"Updates",
"a",
"native",
"DOM",
"component",
"after",
"it",
"has",
"already",
"been",
"allocated",
"and",
"attached",
"to",
"the",
"DOM",
".",
"Reconciles",
"the",
"root",
"DOM",
"node",
"then",
"recurses",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L9699-L9703 | train | |
unijs/bundle | build/web/c0.js | isNode | function isNode(object) {
return !!(object && (
((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
typeof object.nodeType === 'number' &&
typeof object.nodeName === 'string'))
));
} | javascript | function isNode(object) {
return !!(object && (
((typeof Node === 'function' ? object instanceof Node : typeof object === 'object' &&
typeof object.nodeType === 'number' &&
typeof object.nodeName === 'string'))
));
} | [
"function",
"isNode",
"(",
"object",
")",
"{",
"return",
"!",
"!",
"(",
"object",
"&&",
"(",
"(",
"(",
"typeof",
"Node",
"===",
"'function'",
"?",
"object",
"instanceof",
"Node",
":",
"typeof",
"object",
"===",
"'object'",
"&&",
"typeof",
"object",
".",
... | Copyright 2013-2015, Facebook, Inc.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
@providesModule isNode
@typechecks
@para... | [
"Copyright",
"2013",
"-",
"2015",
"Facebook",
"Inc",
".",
"All",
"rights",
"reserved",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L10205-L10211 | train |
unijs/bundle | build/web/c0.js | function(id, name, value) {
var node = ReactMount.getNode(id);
("production" !== process.env.NODE_ENV ? invariant(
!INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
'updatePropertyByID(...): %s',
INVALID_PROPERTY_ERRORS[name]
) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
... | javascript | function(id, name, value) {
var node = ReactMount.getNode(id);
("production" !== process.env.NODE_ENV ? invariant(
!INVALID_PROPERTY_ERRORS.hasOwnProperty(name),
'updatePropertyByID(...): %s',
INVALID_PROPERTY_ERRORS[name]
) : invariant(!INVALID_PROPERTY_ERRORS.hasOwnProperty(name)));
... | [
"function",
"(",
"id",
",",
"name",
",",
"value",
")",
"{",
"var",
"node",
"=",
"ReactMount",
".",
"getNode",
"(",
"id",
")",
";",
"(",
"\"production\"",
"!==",
"process",
".",
"env",
".",
"NODE_ENV",
"?",
"invariant",
"(",
"!",
"INVALID_PROPERTY_ERRORS"... | Updates a DOM node with new property values. This should only be used to
update DOM properties in `DOMProperty`.
@param {string} id ID of the node to update.
@param {string} name A valid property name, see `DOMProperty`.
@param {*} value New value of the property.
@internal | [
"Updates",
"a",
"DOM",
"node",
"with",
"new",
"property",
"values",
".",
"This",
"should",
"only",
"be",
"used",
"to",
"update",
"DOM",
"properties",
"in",
"DOMProperty",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L10895-L10911 | train | |
unijs/bundle | build/web/c0.js | function(id, styles) {
var node = ReactMount.getNode(id);
CSSPropertyOperations.setValueForStyles(node, styles);
} | javascript | function(id, styles) {
var node = ReactMount.getNode(id);
CSSPropertyOperations.setValueForStyles(node, styles);
} | [
"function",
"(",
"id",
",",
"styles",
")",
"{",
"var",
"node",
"=",
"ReactMount",
".",
"getNode",
"(",
"id",
")",
";",
"CSSPropertyOperations",
".",
"setValueForStyles",
"(",
"node",
",",
"styles",
")",
";",
"}"
] | Updates a DOM node with new style values. If a value is specified as '',
the corresponding style property will be unset.
@param {string} id ID of the node to update.
@param {object} styles Mapping from styles to values.
@internal | [
"Updates",
"a",
"DOM",
"node",
"with",
"new",
"style",
"values",
".",
"If",
"a",
"value",
"is",
"specified",
"as",
"the",
"corresponding",
"style",
"property",
"will",
"be",
"unset",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L10939-L10942 | train | |
unijs/bundle | build/web/c0.js | function(id, content) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.updateTextContent(node, content);
} | javascript | function(id, content) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.updateTextContent(node, content);
} | [
"function",
"(",
"id",
",",
"content",
")",
"{",
"var",
"node",
"=",
"ReactMount",
".",
"getNode",
"(",
"id",
")",
";",
"DOMChildrenOperations",
".",
"updateTextContent",
"(",
"node",
",",
"content",
")",
";",
"}"
] | Updates a DOM node's text content set by `props.content`.
@param {string} id ID of the node to update.
@param {string} content Text content.
@internal | [
"Updates",
"a",
"DOM",
"node",
"s",
"text",
"content",
"set",
"by",
"props",
".",
"content",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L10963-L10966 | train | |
unijs/bundle | build/web/c0.js | insertChildAt | function insertChildAt(parentNode, childNode, index) {
// By exploiting arrays returning `undefined` for an undefined index, we can
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it w... | javascript | function insertChildAt(parentNode, childNode, index) {
// By exploiting arrays returning `undefined` for an undefined index, we can
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it w... | [
"function",
"insertChildAt",
"(",
"parentNode",
",",
"childNode",
",",
"index",
")",
"{",
"// By exploiting arrays returning `undefined` for an undefined index, we can",
"// rely exclusively on `insertBefore(node, null)` instead of also using",
"// `appendChild(node)`. However, using `undefi... | Inserts `childNode` as a child of `parentNode` at the `index`.
@param {DOMElement} parentNode Parent node in which to insert.
@param {DOMElement} childNode Child node to insert.
@param {number} index Index at which to insert the child.
@internal | [
"Inserts",
"childNode",
"as",
"a",
"child",
"of",
"parentNode",
"at",
"the",
"index",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L11933-L11942 | train |
unijs/bundle | build/web/c0.js | findParent | function findParent(node) {
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
// traversal, but caching is difficult to do correctly without using a
// mutation observer to listen for all DOM changes.
var nodeID = ReactMount.getID(node);
var rootID = ReactInstanceHandles.getReactRootIDFr... | javascript | function findParent(node) {
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
// traversal, but caching is difficult to do correctly without using a
// mutation observer to listen for all DOM changes.
var nodeID = ReactMount.getID(node);
var rootID = ReactInstanceHandles.getReactRootIDFr... | [
"function",
"findParent",
"(",
"node",
")",
"{",
"// TODO: It may be a good idea to cache this to prevent unnecessary DOM",
"// traversal, but caching is difficult to do correctly without using a",
"// mutation observer to listen for all DOM changes.",
"var",
"nodeID",
"=",
"ReactMount",
"... | Finds the parent React component of `node`.
@param {*} node
@return {?DOMEventTarget} Parent container, or `null` if the specified node
is not nested. | [
"Finds",
"the",
"parent",
"React",
"component",
"of",
"node",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L15626-L15635 | train |
unijs/bundle | build/web/c0.js | function() {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
ReactPutListenerQueue.release(this.putListenerQueue);
this.putListenerQueue = null;
} | javascript | function() {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
ReactPutListenerQueue.release(this.putListenerQueue);
this.putListenerQueue = null;
} | [
"function",
"(",
")",
"{",
"CallbackQueue",
".",
"release",
"(",
"this",
".",
"reactMountReady",
")",
";",
"this",
".",
"reactMountReady",
"=",
"null",
";",
"ReactPutListenerQueue",
".",
"release",
"(",
"this",
".",
"putListenerQueue",
")",
";",
"this",
".",... | `PooledClass` looks for this, and will invoke this before allowing this
instance to be resused. | [
"PooledClass",
"looks",
"for",
"this",
"and",
"will",
"invoke",
"this",
"before",
"allowing",
"this",
"instance",
"to",
"be",
"resused",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L15980-L15986 | train | |
unijs/bundle | build/web/c0.js | isInternalComponentType | function isInternalComponentType(type) {
return (
typeof type === 'function' &&
typeof type.prototype !== 'undefined' &&
typeof type.prototype.mountComponent === 'function' &&
typeof type.prototype.receiveComponent === 'function'
);
} | javascript | function isInternalComponentType(type) {
return (
typeof type === 'function' &&
typeof type.prototype !== 'undefined' &&
typeof type.prototype.mountComponent === 'function' &&
typeof type.prototype.receiveComponent === 'function'
);
} | [
"function",
"isInternalComponentType",
"(",
"type",
")",
"{",
"return",
"(",
"typeof",
"type",
"===",
"'function'",
"&&",
"typeof",
"type",
".",
"prototype",
"!==",
"'undefined'",
"&&",
"typeof",
"type",
".",
"prototype",
".",
"mountComponent",
"===",
"'function... | Check if the type reference is a known internal type. I.e. not a user
provided composite type.
@param {function} type
@return {boolean} Returns true if this is a valid internal type. | [
"Check",
"if",
"the",
"type",
"reference",
"is",
"a",
"known",
"internal",
"type",
".",
"I",
".",
"e",
".",
"not",
"a",
"user",
"provided",
"composite",
"type",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L18573-L18580 | train |
unijs/bundle | build/web/c0.js | enqueueMarkup | function enqueueMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
textContent: null,
fromIndex: null,
toIndex:... | javascript | function enqueueMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
textContent: null,
fromIndex: null,
toIndex:... | [
"function",
"enqueueMarkup",
"(",
"parentID",
",",
"markup",
",",
"toIndex",
")",
"{",
"// NOTE: Null values reduce hidden classes.",
"updateQueue",
".",
"push",
"(",
"{",
"parentID",
":",
"parentID",
",",
"parentNode",
":",
"null",
",",
"type",
":",
"ReactMultiCh... | Enqueues markup to be rendered and inserted at a supplied index.
@param {string} parentID ID of the parent component.
@param {string} markup Markup that renders into an element.
@param {number} toIndex Destination index.
@private | [
"Enqueues",
"markup",
"to",
"be",
"rendered",
"and",
"inserted",
"at",
"a",
"supplied",
"index",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L18943-L18954 | train |
unijs/bundle | build/web/c0.js | function(nextNestedChildren, transaction, context) {
updateDepth++;
var errorThrown = true;
try {
this._updateChildren(nextNestedChildren, transaction, context);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
... | javascript | function(nextNestedChildren, transaction, context) {
updateDepth++;
var errorThrown = true;
try {
this._updateChildren(nextNestedChildren, transaction, context);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
... | [
"function",
"(",
"nextNestedChildren",
",",
"transaction",
",",
"context",
")",
"{",
"updateDepth",
"++",
";",
"var",
"errorThrown",
"=",
"true",
";",
"try",
"{",
"this",
".",
"_updateChildren",
"(",
"nextNestedChildren",
",",
"transaction",
",",
"context",
")... | Updates the rendered children with new children.
@param {?object} nextNestedChildren Nested child maps.
@param {ReactReconcileTransaction} transaction
@internal | [
"Updates",
"the",
"rendered",
"children",
"with",
"new",
"children",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L19134-L19151 | train | |
unijs/bundle | build/web/c0.js | adler32 | function adler32(data) {
var a = 1;
var b = 0;
for (var i = 0; i < data.length; i++) {
a = (a + data.charCodeAt(i)) % MOD;
b = (b + a) % MOD;
}
return a | (b << 16);
} | javascript | function adler32(data) {
var a = 1;
var b = 0;
for (var i = 0; i < data.length; i++) {
a = (a + data.charCodeAt(i)) % MOD;
b = (b + a) % MOD;
}
return a | (b << 16);
} | [
"function",
"adler32",
"(",
"data",
")",
"{",
"var",
"a",
"=",
"1",
";",
"var",
"b",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"a",
"=",
"(",
"a",
"+",
"data",
".",
... | This is a clean-room implementation of adler32 designed for detecting if markup is not what we expect it to be. It does not need to be cryptographically strong, only reasonably good at detecting if markup generated on the server is different than that on the client. | [
"This",
"is",
"a",
"clean",
"-",
"room",
"implementation",
"of",
"adler32",
"designed",
"for",
"detecting",
"if",
"markup",
"is",
"not",
"what",
"we",
"expect",
"it",
"to",
"be",
".",
"It",
"does",
"not",
"need",
"to",
"be",
"cryptographically",
"strong",
... | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L20963-L20971 | train |
unijs/bundle | build/web/c0.js | function(partialProps, callback) {
// This is a deoptimized path. We optimize for always having an element.
// This creates an extra internal element.
var element = this._pendingElement || this._currentElement;
this._pendingElement = ReactElement.cloneAndReplaceProps(
element,
assign({}, ele... | javascript | function(partialProps, callback) {
// This is a deoptimized path. We optimize for always having an element.
// This creates an extra internal element.
var element = this._pendingElement || this._currentElement;
this._pendingElement = ReactElement.cloneAndReplaceProps(
element,
assign({}, ele... | [
"function",
"(",
"partialProps",
",",
"callback",
")",
"{",
"// This is a deoptimized path. We optimize for always having an element.",
"// This creates an extra internal element.",
"var",
"element",
"=",
"this",
".",
"_pendingElement",
"||",
"this",
".",
"_currentElement",
";"... | Schedule a partial update to the props. Only used for internal testing.
@param {object} partialProps Subset of the next props.
@param {?function} callback Called after props are updated.
@final
@internal | [
"Schedule",
"a",
"partial",
"update",
"to",
"the",
"props",
".",
"Only",
"used",
"for",
"internal",
"testing",
"."
] | 15f627df9d8c83a59d3e613f68ef4769f15569fc | https://github.com/unijs/bundle/blob/15f627df9d8c83a59d3e613f68ef4769f15569fc/build/web/c0.js#L21595-L21604 | train | |
Nazariglez/perenquen | lib/pixi/src/core/graphics/Graphics.js | Graphics | function Graphics()
{
Container.call(this);
/**
* The alpha value used when filling the Graphics object.
*
* @member {number}
* @default 1
*/
this.fillAlpha = 1;
/**
* The width (thickness) of any lines drawn.
*
* @member {number}
* @default 0
*/
t... | javascript | function Graphics()
{
Container.call(this);
/**
* The alpha value used when filling the Graphics object.
*
* @member {number}
* @default 1
*/
this.fillAlpha = 1;
/**
* The width (thickness) of any lines drawn.
*
* @member {number}
* @default 0
*/
t... | [
"function",
"Graphics",
"(",
")",
"{",
"Container",
".",
"call",
"(",
"this",
")",
";",
"/**\n * The alpha value used when filling the Graphics object.\n *\n * @member {number}\n * @default 1\n */",
"this",
".",
"fillAlpha",
"=",
"1",
";",
"/**\n * The w... | The Graphics class contains methods used to draw primitive shapes such as lines, circles and
rectangles to the display, and to color and fill them.
@class
@extends Container
@memberof PIXI | [
"The",
"Graphics",
"class",
"contains",
"methods",
"used",
"to",
"draw",
"primitive",
"shapes",
"such",
"as",
"lines",
"circles",
"and",
"rectangles",
"to",
"the",
"display",
"and",
"to",
"color",
"and",
"fill",
"them",
"."
] | e023964d05afeefebdcac4e2044819fdfa3899ae | https://github.com/Nazariglez/perenquen/blob/e023964d05afeefebdcac4e2044819fdfa3899ae/lib/pixi/src/core/graphics/Graphics.js#L19-L146 | train |
linyngfly/omelo-rpc | lib/rpc-client/mailstation.js | function(opts) {
EventEmitter.call(this);
this.opts = opts;
this.servers = {}; // remote server info map, key: server id, value: info
this.serversMap = {}; // remote server info map, key: serverType, value: servers array
this.onlines = {}; // remote server online map, key: server id, value: 0/offline 1/online... | javascript | function(opts) {
EventEmitter.call(this);
this.opts = opts;
this.servers = {}; // remote server info map, key: server id, value: info
this.serversMap = {}; // remote server info map, key: serverType, value: servers array
this.onlines = {}; // remote server online map, key: server id, value: 0/offline 1/online... | [
"function",
"(",
"opts",
")",
"{",
"EventEmitter",
".",
"call",
"(",
"this",
")",
";",
"this",
".",
"opts",
"=",
"opts",
";",
"this",
".",
"servers",
"=",
"{",
"}",
";",
"// remote server info map, key: server id, value: info",
"this",
".",
"serversMap",
"="... | station has closed
Mail station constructor.
@param {Object} opts construct parameters | [
"station",
"has",
"closed",
"Mail",
"station",
"constructor",
"."
] | a8d64a4f098f1d174550f0f648d5ccc7716624b8 | https://github.com/linyngfly/omelo-rpc/blob/a8d64a4f098f1d174550f0f648d5ccc7716624b8/lib/rpc-client/mailstation.js#L18-L41 | train | |
integreat-io/integreat-adapter-couchdb | lib/adapters/couchdb.js | couchdb | function couchdb (json) {
return {
prepareEndpoint (endpointOptions, sourceOptions) {
return prepareEndpoint(json, endpointOptions, sourceOptions)
},
async send (request) {
return send(json, request)
},
async serialize (data, request) {
const serializedData = await serializeDat... | javascript | function couchdb (json) {
return {
prepareEndpoint (endpointOptions, sourceOptions) {
return prepareEndpoint(json, endpointOptions, sourceOptions)
},
async send (request) {
return send(json, request)
},
async serialize (data, request) {
const serializedData = await serializeDat... | [
"function",
"couchdb",
"(",
"json",
")",
"{",
"return",
"{",
"prepareEndpoint",
"(",
"endpointOptions",
",",
"sourceOptions",
")",
"{",
"return",
"prepareEndpoint",
"(",
"json",
",",
"endpointOptions",
",",
"sourceOptions",
")",
"}",
",",
"async",
"send",
"(",... | Wrap json adapter to provide adjustments for couchdb.
@param {Object} json - The json adapter
@returns {Object} The couchdb adapter | [
"Wrap",
"json",
"adapter",
"to",
"provide",
"adjustments",
"for",
"couchdb",
"."
] | e792aaa3e85c5dae41959bc449ed3b0e149f7ebf | https://github.com/integreat-io/integreat-adapter-couchdb/blob/e792aaa3e85c5dae41959bc449ed3b0e149f7ebf/lib/adapters/couchdb.js#L11-L31 | train |
PropellerHealth/asthma-forecast-sdk-node | index.js | function(zip, callback) {
var queryString = "?postalCode="+zip;
httpGet(queryString, function(err, results) {
callback(err, results);
});
} | javascript | function(zip, callback) {
var queryString = "?postalCode="+zip;
httpGet(queryString, function(err, results) {
callback(err, results);
});
} | [
"function",
"(",
"zip",
",",
"callback",
")",
"{",
"var",
"queryString",
"=",
"\"?postalCode=\"",
"+",
"zip",
";",
"httpGet",
"(",
"queryString",
",",
"function",
"(",
"err",
",",
"results",
")",
"{",
"callback",
"(",
"err",
",",
"results",
")",
";",
"... | callback for getForecastByZipCode
@callback module:asthma-forecast/client~getForecastByZipCodeCallback
@param {Object} [err] error calling Propeller API
@param {Object} [result] forecast
getForecastByZipCode
@param {String} options.zipCode Zip code
@param {module:asthma-forecast/client~getForecastByZipCodeCallback} [... | [
"callback",
"for",
"getForecastByZipCode"
] | 683611c2b1ea89d644afcc2ff0e2bbb0a4e4dd05 | https://github.com/PropellerHealth/asthma-forecast-sdk-node/blob/683611c2b1ea89d644afcc2ff0e2bbb0a4e4dd05/index.js#L69-L76 | train | |
PropellerHealth/asthma-forecast-sdk-node | index.js | function(lat, lon, callback) {
var queryString = "?latitude="+lat+"&longitude="+lon;
httpGet(queryString, function(err, results) {
callback(err, results);
});
} | javascript | function(lat, lon, callback) {
var queryString = "?latitude="+lat+"&longitude="+lon;
httpGet(queryString, function(err, results) {
callback(err, results);
});
} | [
"function",
"(",
"lat",
",",
"lon",
",",
"callback",
")",
"{",
"var",
"queryString",
"=",
"\"?latitude=\"",
"+",
"lat",
"+",
"\"&longitude=\"",
"+",
"lon",
";",
"httpGet",
"(",
"queryString",
",",
"function",
"(",
"err",
",",
"results",
")",
"{",
"callba... | callback for getForecastByLatLong
@callback module:asthma-forecast/client~getForecastByLatLongCallback
@param {Object} [err] error calling asthma-forecast
@param {Object} [result] forecast
getForecastByLatLong
@param {Number} latitude Latitude in decimal degrees
@param {Number} longitude longitude in decimal degrees
... | [
"callback",
"for",
"getForecastByLatLong"
] | 683611c2b1ea89d644afcc2ff0e2bbb0a4e4dd05 | https://github.com/PropellerHealth/asthma-forecast-sdk-node/blob/683611c2b1ea89d644afcc2ff0e2bbb0a4e4dd05/index.js#L89-L96 | train | |
emiljohansson/captn | captn.dom.hasclass/index.js | hasClass | function hasClass(element, className) {
if (!hasClassNameProperty(element)) {
return false;
}
return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
} | javascript | function hasClass(element, className) {
if (!hasClassNameProperty(element)) {
return false;
}
return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
} | [
"function",
"hasClass",
"(",
"element",
",",
"className",
")",
"{",
"if",
"(",
"!",
"hasClassNameProperty",
"(",
"element",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"' '",
"+",
"element",
".",
"className",
"+",
"' '",
")",
".",
"index... | Returns true if the element's class name contains className.
@static
@param {DOMElement} element The DOM element to be checked.
@param {string} className The name to match.
@return {boolean} Returns `true` if `className` exist within the elements className.
@example
hasClass(el, 'container');
// => true | [
"Returns",
"true",
"if",
"the",
"element",
"s",
"class",
"name",
"contains",
"className",
"."
] | dae7520116dc2148b4de06af7e1d7a47a3a3ac37 | https://github.com/emiljohansson/captn/blob/dae7520116dc2148b4de06af7e1d7a47a3a3ac37/captn.dom.hasclass/index.js#L17-L22 | train |
gethuman/pancakes-angular | lib/ngapp/state.helper.js | goToUrl | function goToUrl(url) {
if (!url) { return; }
if (_.isArray(url)) {
url = url.join('/');
}
var hasHttp = url.indexOf('http') === 0;
if (!hasHttp && url.indexOf('/') !== 0) {
url = '/' + url;
}
hasHttp ? $window.location.href = url : $loc... | javascript | function goToUrl(url) {
if (!url) { return; }
if (_.isArray(url)) {
url = url.join('/');
}
var hasHttp = url.indexOf('http') === 0;
if (!hasHttp && url.indexOf('/') !== 0) {
url = '/' + url;
}
hasHttp ? $window.location.href = url : $loc... | [
"function",
"goToUrl",
"(",
"url",
")",
"{",
"if",
"(",
"!",
"url",
")",
"{",
"return",
";",
"}",
"if",
"(",
"_",
".",
"isArray",
"(",
"url",
")",
")",
"{",
"url",
"=",
"url",
".",
"join",
"(",
"'/'",
")",
";",
"}",
"var",
"hasHttp",
"=",
"... | Simply go to the url and allow the state to change
@param url | [
"Simply",
"go",
"to",
"the",
"url",
"and",
"allow",
"the",
"state",
"to",
"change"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/state.helper.js#L15-L28 | train |
gethuman/pancakes-angular | lib/ngapp/state.helper.js | getQueryParams | function getQueryParams(params) {
params = params || {};
var url = $location.url();
var idx = url.indexOf('?');
// if there is a query string
if (idx < 0) { return {}; }
// get the query string and split the keyvals
var query = url.substring(idx + 1);
va... | javascript | function getQueryParams(params) {
params = params || {};
var url = $location.url();
var idx = url.indexOf('?');
// if there is a query string
if (idx < 0) { return {}; }
// get the query string and split the keyvals
var query = url.substring(idx + 1);
va... | [
"function",
"getQueryParams",
"(",
"params",
")",
"{",
"params",
"=",
"params",
"||",
"{",
"}",
";",
"var",
"url",
"=",
"$location",
".",
"url",
"(",
")",
";",
"var",
"idx",
"=",
"url",
".",
"indexOf",
"(",
"'?'",
")",
";",
"// if there is a query stri... | Get params from the URL | [
"Get",
"params",
"from",
"the",
"URL"
] | 9589b7ba09619843e271293088005c62ed23f355 | https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/ngapp/state.helper.js#L48-L67 | train |
sendanor/nor-newrelic | src/cli.js | save_config | function save_config(path, config) {
debug.assert(path).is('string');
debug.assert(config).is('object');
return $Q.fcall(function stringify_json() {
return JSON.stringify(config, null, 2);
}).then(function write_to_file(data) {
return FS.writeFile(path, data, {'encoding':'utf8'});
});
} | javascript | function save_config(path, config) {
debug.assert(path).is('string');
debug.assert(config).is('object');
return $Q.fcall(function stringify_json() {
return JSON.stringify(config, null, 2);
}).then(function write_to_file(data) {
return FS.writeFile(path, data, {'encoding':'utf8'});
});
} | [
"function",
"save_config",
"(",
"path",
",",
"config",
")",
"{",
"debug",
".",
"assert",
"(",
"path",
")",
".",
"is",
"(",
"'string'",
")",
";",
"debug",
".",
"assert",
"(",
"config",
")",
".",
"is",
"(",
"'object'",
")",
";",
"return",
"$Q",
".",
... | Save configurations to disk | [
"Save",
"configurations",
"to",
"disk"
] | 638c97036c9a1ff79ab2b114abb3c61ceacc81b7 | https://github.com/sendanor/nor-newrelic/blob/638c97036c9a1ff79ab2b114abb3c61ceacc81b7/src/cli.js#L50-L58 | train |
toranb/gulp-ember-handlebarz | index.js | function (name) {
var n = path.extname(name).length;
return n === 0 ? name : name.slice(0, -n);
} | javascript | function (name) {
var n = path.extname(name).length;
return n === 0 ? name : name.slice(0, -n);
} | [
"function",
"(",
"name",
")",
"{",
"var",
"n",
"=",
"path",
".",
"extname",
"(",
"name",
")",
".",
"length",
";",
"return",
"n",
"===",
"0",
"?",
"name",
":",
"name",
".",
"slice",
"(",
"0",
",",
"-",
"n",
")",
";",
"}"
] | Default name function returns the template filename without extension. | [
"Default",
"name",
"function",
"returns",
"the",
"template",
"filename",
"without",
"extension",
"."
] | 2480533ccb6c3feb4a31373474038705c4d3aada | https://github.com/toranb/gulp-ember-handlebarz/blob/2480533ccb6c3feb4a31373474038705c4d3aada/index.js#L9-L12 | train | |
psalaets/grid-walk | lib/walker.js | walk | function walk(start, end, fn) {
this.start = new Vec2(start);
this.end = new Vec2(end);
this.direction = calcDirection(this.start, this.end);
// positive deltas go right and down
this.cellStepDelta = {
horizontal: 0,
vertical: 0
}
this.tMax = new Vec2();
this.tDelta = new Vec2();
this.curre... | javascript | function walk(start, end, fn) {
this.start = new Vec2(start);
this.end = new Vec2(end);
this.direction = calcDirection(this.start, this.end);
// positive deltas go right and down
this.cellStepDelta = {
horizontal: 0,
vertical: 0
}
this.tMax = new Vec2();
this.tDelta = new Vec2();
this.curre... | [
"function",
"walk",
"(",
"start",
",",
"end",
",",
"fn",
")",
"{",
"this",
".",
"start",
"=",
"new",
"Vec2",
"(",
"start",
")",
";",
"this",
".",
"end",
"=",
"new",
"Vec2",
"(",
"end",
")",
";",
"this",
".",
"direction",
"=",
"calcDirection",
"("... | Walk along a line through the grid.
@param {object} start - Start point of line, object with x/y properties.
@param {object} end - End point of line, object with x/y properties.
@param {function} fn - Callback to be invoked *synchronously* for each cell
visited with grid coordinate
{column: number, row: number} as the... | [
"Walk",
"along",
"a",
"line",
"through",
"the",
"grid",
"."
] | 6969e4c9aa0a18289dd3af7da136f7966bcb022d | https://github.com/psalaets/grid-walk/blob/6969e4c9aa0a18289dd3af7da136f7966bcb022d/lib/walker.js#L34-L62 | 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.