id int32 0 58k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
44,000 | WebReflection/es-class | build/es-class.max.amd.js | addMixins | function addMixins(mixins, target, inherits, isNOTExtendingNative) {
for (var
source,
init = [],
i = 0; i < mixins.length; i++
) {
source = transformMixin(mixins[i]);
if (hOP.call(source, INIT)) {
init.push(source[INIT]);
}
copyOwn(source, target, inherits, fals... | javascript | function addMixins(mixins, target, inherits, isNOTExtendingNative) {
for (var
source,
init = [],
i = 0; i < mixins.length; i++
) {
source = transformMixin(mixins[i]);
if (hOP.call(source, INIT)) {
init.push(source[INIT]);
}
copyOwn(source, target, inherits, fals... | [
"function",
"addMixins",
"(",
"mixins",
",",
"target",
",",
"inherits",
",",
"isNOTExtendingNative",
")",
"{",
"for",
"(",
"var",
"source",
",",
"init",
"=",
"[",
"]",
",",
"i",
"=",
"0",
";",
"i",
"<",
"mixins",
".",
"length",
";",
"i",
"++",
")",... | copy all imported enumerable methods and properties | [
"copy",
"all",
"imported",
"enumerable",
"methods",
"and",
"properties"
] | 8e3f3b65a67955d11e15820e8f44e2cdaac4bd50 | https://github.com/WebReflection/es-class/blob/8e3f3b65a67955d11e15820e8f44e2cdaac4bd50/build/es-class.max.amd.js#L219-L232 |
44,001 | WebReflection/es-class | build/es-class.max.amd.js | copyMerged | function copyMerged(source, target) {
for (var
key, descriptor, value, tvalue,
names = oK(source),
i = 0; i < names.length; i++
) {
key = names[i];
descriptor = gOPD(source, key);
// target already has this property
if (hOP.call(target, key)) {
// verify the des... | javascript | function copyMerged(source, target) {
for (var
key, descriptor, value, tvalue,
names = oK(source),
i = 0; i < names.length; i++
) {
key = names[i];
descriptor = gOPD(source, key);
// target already has this property
if (hOP.call(target, key)) {
// verify the des... | [
"function",
"copyMerged",
"(",
"source",
",",
"target",
")",
"{",
"for",
"(",
"var",
"key",
",",
"descriptor",
",",
"value",
",",
"tvalue",
",",
"names",
"=",
"oK",
"(",
"source",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"names",
".",
"length",
";... | given two objects, performs a deep copy per each property not present in the target otherwise merges, without overwriting, all properties within the object | [
"given",
"two",
"objects",
"performs",
"a",
"deep",
"copy",
"per",
"each",
"property",
"not",
"present",
"in",
"the",
"target",
"otherwise",
"merges",
"without",
"overwriting",
"all",
"properties",
"within",
"the",
"object"
] | 8e3f3b65a67955d11e15820e8f44e2cdaac4bd50 | https://github.com/WebReflection/es-class/blob/8e3f3b65a67955d11e15820e8f44e2cdaac4bd50/build/es-class.max.amd.js#L256-L292 |
44,002 | WebReflection/es-class | build/es-class.max.amd.js | copyOwn | function copyOwn(source, target, inherits, publicStatic, allowInit, isNOTExtendingNative) {
for (var
key,
noFunctionCheck = typeof source !== 'function',
names = oK(source),
i = 0; i < names.length; i++
) {
key = names[i];
if (
(noFunctionCheck || indexOf.call(nativeF... | javascript | function copyOwn(source, target, inherits, publicStatic, allowInit, isNOTExtendingNative) {
for (var
key,
noFunctionCheck = typeof source !== 'function',
names = oK(source),
i = 0; i < names.length; i++
) {
key = names[i];
if (
(noFunctionCheck || indexOf.call(nativeF... | [
"function",
"copyOwn",
"(",
"source",
",",
"target",
",",
"inherits",
",",
"publicStatic",
",",
"allowInit",
",",
"isNOTExtendingNative",
")",
"{",
"for",
"(",
"var",
"key",
",",
"noFunctionCheck",
"=",
"typeof",
"source",
"!==",
"'function'",
",",
"names",
... | configure source own properties in the target | [
"configure",
"source",
"own",
"properties",
"in",
"the",
"target"
] | 8e3f3b65a67955d11e15820e8f44e2cdaac4bd50 | https://github.com/WebReflection/es-class/blob/8e3f3b65a67955d11e15820e8f44e2cdaac4bd50/build/es-class.max.amd.js#L295-L313 |
44,003 | WebReflection/es-class | build/es-class.max.amd.js | copyValueIfObject | function copyValueIfObject(where, how) {
var what = where[VALUE];
if (isObject(what)) {
where[VALUE] = how(what);
}
} | javascript | function copyValueIfObject(where, how) {
var what = where[VALUE];
if (isObject(what)) {
where[VALUE] = how(what);
}
} | [
"function",
"copyValueIfObject",
"(",
"where",
",",
"how",
")",
"{",
"var",
"what",
"=",
"where",
"[",
"VALUE",
"]",
";",
"if",
"(",
"isObject",
"(",
"what",
")",
")",
"{",
"where",
"[",
"VALUE",
"]",
"=",
"how",
"(",
"what",
")",
";",
"}",
"}"
] | shortcut to copy objects into descriptor.value | [
"shortcut",
"to",
"copy",
"objects",
"into",
"descriptor",
".",
"value"
] | 8e3f3b65a67955d11e15820e8f44e2cdaac4bd50 | https://github.com/WebReflection/es-class/blob/8e3f3b65a67955d11e15820e8f44e2cdaac4bd50/build/es-class.max.amd.js#L316-L321 |
44,004 | WebReflection/es-class | build/es-class.max.amd.js | createConstructor | function createConstructor(hasParentPrototype, parent) {
var Class = function Class() {};
return hasParentPrototype && ('' + parent) !== ('' + Class) ?
function Class() {
return parent.apply(this, arguments);
} :
Class
;
} | javascript | function createConstructor(hasParentPrototype, parent) {
var Class = function Class() {};
return hasParentPrototype && ('' + parent) !== ('' + Class) ?
function Class() {
return parent.apply(this, arguments);
} :
Class
;
} | [
"function",
"createConstructor",
"(",
"hasParentPrototype",
",",
"parent",
")",
"{",
"var",
"Class",
"=",
"function",
"Class",
"(",
")",
"{",
"}",
";",
"return",
"hasParentPrototype",
"&&",
"(",
"''",
"+",
"parent",
")",
"!==",
"(",
"''",
"+",
"Class",
"... | return the right constructor analyzing the parent. if the parent is empty there is no need to call it. | [
"return",
"the",
"right",
"constructor",
"analyzing",
"the",
"parent",
".",
"if",
"the",
"parent",
"is",
"empty",
"there",
"is",
"no",
"need",
"to",
"call",
"it",
"."
] | 8e3f3b65a67955d11e15820e8f44e2cdaac4bd50 | https://github.com/WebReflection/es-class/blob/8e3f3b65a67955d11e15820e8f44e2cdaac4bd50/build/es-class.max.amd.js#L326-L334 |
44,005 | WebReflection/es-class | build/es-class.max.amd.js | define | function define(target, key, value, publicStatic) {
var configurable = isConfigurable(key, publicStatic);
defineProperty(target, key, {
enumerable: false, // was: publicStatic,
configurable: configurable,
writable: configurable,
value: value
});
} | javascript | function define(target, key, value, publicStatic) {
var configurable = isConfigurable(key, publicStatic);
defineProperty(target, key, {
enumerable: false, // was: publicStatic,
configurable: configurable,
writable: configurable,
value: value
});
} | [
"function",
"define",
"(",
"target",
",",
"key",
",",
"value",
",",
"publicStatic",
")",
"{",
"var",
"configurable",
"=",
"isConfigurable",
"(",
"key",
",",
"publicStatic",
")",
";",
"defineProperty",
"(",
"target",
",",
"key",
",",
"{",
"enumerable",
":",... | common defineProperty wrapper | [
"common",
"defineProperty",
"wrapper"
] | 8e3f3b65a67955d11e15820e8f44e2cdaac4bd50 | https://github.com/WebReflection/es-class/blob/8e3f3b65a67955d11e15820e8f44e2cdaac4bd50/build/es-class.max.amd.js#L337-L345 |
44,006 | WebReflection/es-class | build/es-class.max.amd.js | isNotASpecialKey | function isNotASpecialKey(key, allowInit) {
return key !== CONSTRUCTOR &&
key !== EXTENDS &&
key !== IMPLEMENTS &&
// Blackberry 7 and old WebKit bug only:
// user defined functions have
// enumerable prototype and constructor
key !== PROTOT... | javascript | function isNotASpecialKey(key, allowInit) {
return key !== CONSTRUCTOR &&
key !== EXTENDS &&
key !== IMPLEMENTS &&
// Blackberry 7 and old WebKit bug only:
// user defined functions have
// enumerable prototype and constructor
key !== PROTOT... | [
"function",
"isNotASpecialKey",
"(",
"key",
",",
"allowInit",
")",
"{",
"return",
"key",
"!==",
"CONSTRUCTOR",
"&&",
"key",
"!==",
"EXTENDS",
"&&",
"key",
"!==",
"IMPLEMENTS",
"&&",
"// Blackberry 7 and old WebKit bug only:",
"// user defined functions have",
"// enum... | verifies a key is not special for the class | [
"verifies",
"a",
"key",
"is",
"not",
"special",
"for",
"the",
"class"
] | 8e3f3b65a67955d11e15820e8f44e2cdaac4bd50 | https://github.com/WebReflection/es-class/blob/8e3f3b65a67955d11e15820e8f44e2cdaac4bd50/build/es-class.max.amd.js#L364-L376 |
44,007 | WebReflection/es-class | build/es-class.max.amd.js | isPublicStatic | function isPublicStatic(key) {
for(var c, i = 0; i < key.length; i++) {
c = key.charCodeAt(i);
if ((c < 65 || 90 < c) && c !== 95) {
return false;
}
}
return true;
} | javascript | function isPublicStatic(key) {
for(var c, i = 0; i < key.length; i++) {
c = key.charCodeAt(i);
if ((c < 65 || 90 < c) && c !== 95) {
return false;
}
}
return true;
} | [
"function",
"isPublicStatic",
"(",
"key",
")",
"{",
"for",
"(",
"var",
"c",
",",
"i",
"=",
"0",
";",
"i",
"<",
"key",
".",
"length",
";",
"i",
"++",
")",
"{",
"c",
"=",
"key",
".",
"charCodeAt",
"(",
"i",
")",
";",
"if",
"(",
"(",
"c",
"<",... | verifies the entire string is upper case and contains eventually an underscore used to avoid RegExp for non RegExp aware environment | [
"verifies",
"the",
"entire",
"string",
"is",
"upper",
"case",
"and",
"contains",
"eventually",
"an",
"underscore",
"used",
"to",
"avoid",
"RegExp",
"for",
"non",
"RegExp",
"aware",
"environment"
] | 8e3f3b65a67955d11e15820e8f44e2cdaac4bd50 | https://github.com/WebReflection/es-class/blob/8e3f3b65a67955d11e15820e8f44e2cdaac4bd50/build/es-class.max.amd.js#L387-L395 |
44,008 | WebReflection/es-class | build/es-class.max.amd.js | transformMixin | function transformMixin(trait) {
if (isObject(trait)) return trait;
else {
var i, key, keys, object, proto;
if (trait.isClass) {
if (trait.length) {
warn((trait.name || 'Class') + ' should not expect arguments');
}
for (
object = {init: trait},
p... | javascript | function transformMixin(trait) {
if (isObject(trait)) return trait;
else {
var i, key, keys, object, proto;
if (trait.isClass) {
if (trait.length) {
warn((trait.name || 'Class') + ' should not expect arguments');
}
for (
object = {init: trait},
p... | [
"function",
"transformMixin",
"(",
"trait",
")",
"{",
"if",
"(",
"isObject",
"(",
"trait",
")",
")",
"return",
"trait",
";",
"else",
"{",
"var",
"i",
",",
"key",
",",
"keys",
",",
"object",
",",
"proto",
";",
"if",
"(",
"trait",
".",
"isClass",
")"... | will eventually convert classes or constructors into trait objects, before assigning them as such | [
"will",
"eventually",
"convert",
"classes",
"or",
"constructors",
"into",
"trait",
"objects",
"before",
"assigning",
"them",
"as",
"such"
] | 8e3f3b65a67955d11e15820e8f44e2cdaac4bd50 | https://github.com/WebReflection/es-class/blob/8e3f3b65a67955d11e15820e8f44e2cdaac4bd50/build/es-class.max.amd.js#L399-L443 |
44,009 | WebReflection/es-class | build/es-class.max.amd.js | setProperty | function setProperty(inherits, target, key, descriptor, publicStatic, isNOTExtendingNative) {
var
hasValue = hOP.call(descriptor, VALUE),
configurable,
value
;
if (publicStatic) {
if (hOP.call(target, key)) {
// in case the value is not a static one
if (
inh... | javascript | function setProperty(inherits, target, key, descriptor, publicStatic, isNOTExtendingNative) {
var
hasValue = hOP.call(descriptor, VALUE),
configurable,
value
;
if (publicStatic) {
if (hOP.call(target, key)) {
// in case the value is not a static one
if (
inh... | [
"function",
"setProperty",
"(",
"inherits",
",",
"target",
",",
"key",
",",
"descriptor",
",",
"publicStatic",
",",
"isNOTExtendingNative",
")",
"{",
"var",
"hasValue",
"=",
"hOP",
".",
"call",
"(",
"descriptor",
",",
"VALUE",
")",
",",
"configurable",
",",
... | set a property via defineProperty using a common descriptor only if properties where not defined yet. If publicStatic is true, properties are both non configurable and non writable | [
"set",
"a",
"property",
"via",
"defineProperty",
"using",
"a",
"common",
"descriptor",
"only",
"if",
"properties",
"where",
"not",
"defined",
"yet",
".",
"If",
"publicStatic",
"is",
"true",
"properties",
"are",
"both",
"non",
"configurable",
"and",
"non",
"wri... | 8e3f3b65a67955d11e15820e8f44e2cdaac4bd50 | https://github.com/WebReflection/es-class/blob/8e3f3b65a67955d11e15820e8f44e2cdaac4bd50/build/es-class.max.amd.js#L448-L485 |
44,010 | WebReflection/es-class | build/es-class.max.amd.js | verifyImplementations | function verifyImplementations(interfaces, target) {
for (var
current,
key,
i = 0; i < interfaces.length; i++
) {
current = interfaces[i];
for (key in current) {
if (hOP.call(current, key) && !hOP.call(target, key)) {
warn(key.toString() + ' is not implemented');
... | javascript | function verifyImplementations(interfaces, target) {
for (var
current,
key,
i = 0; i < interfaces.length; i++
) {
current = interfaces[i];
for (key in current) {
if (hOP.call(current, key) && !hOP.call(target, key)) {
warn(key.toString() + ' is not implemented');
... | [
"function",
"verifyImplementations",
"(",
"interfaces",
",",
"target",
")",
"{",
"for",
"(",
"var",
"current",
",",
"key",
",",
"i",
"=",
"0",
";",
"i",
"<",
"interfaces",
".",
"length",
";",
"i",
"++",
")",
"{",
"current",
"=",
"interfaces",
"[",
"i... | basic check against expected properties or methods used when `implements` is used | [
"basic",
"check",
"against",
"expected",
"properties",
"or",
"methods",
"used",
"when",
"implements",
"is",
"used"
] | 8e3f3b65a67955d11e15820e8f44e2cdaac4bd50 | https://github.com/WebReflection/es-class/blob/8e3f3b65a67955d11e15820e8f44e2cdaac4bd50/build/es-class.max.amd.js#L489-L502 |
44,011 | yoshuawuyts/vel | index.js | vel | function vel (rend) {
assert.equal(typeof rend, 'function')
var update = null
render.toString = toString
render.render = render
render.vtree = vtree
return render
// render the element's vdom tree to DOM nodes
// which can be mounted on the DOM
// any? -> DOMNode
function render (state) {
if (... | javascript | function vel (rend) {
assert.equal(typeof rend, 'function')
var update = null
render.toString = toString
render.render = render
render.vtree = vtree
return render
// render the element's vdom tree to DOM nodes
// which can be mounted on the DOM
// any? -> DOMNode
function render (state) {
if (... | [
"function",
"vel",
"(",
"rend",
")",
"{",
"assert",
".",
"equal",
"(",
"typeof",
"rend",
",",
"'function'",
")",
"var",
"update",
"=",
"null",
"render",
".",
"toString",
"=",
"toString",
"render",
".",
"render",
"=",
"render",
"render",
".",
"vtree",
"... | initialize a new virtual element fn -> null | [
"initialize",
"a",
"new",
"virtual",
"element",
"fn",
"-",
">",
"null"
] | 7c8b701da8a034937150b76974754d6c0fb1aef0 | https://github.com/yoshuawuyts/vel/blob/7c8b701da8a034937150b76974754d6c0fb1aef0/index.js#L18-L48 |
44,012 | yoshuawuyts/vel | index.js | render | function render (state) {
if (update) return update(state)
const loop = mainLoop(state, renderFn(rend), vdom)
update = loop.update
return loop.target
} | javascript | function render (state) {
if (update) return update(state)
const loop = mainLoop(state, renderFn(rend), vdom)
update = loop.update
return loop.target
} | [
"function",
"render",
"(",
"state",
")",
"{",
"if",
"(",
"update",
")",
"return",
"update",
"(",
"state",
")",
"const",
"loop",
"=",
"mainLoop",
"(",
"state",
",",
"renderFn",
"(",
"rend",
")",
",",
"vdom",
")",
"update",
"=",
"loop",
".",
"update",
... | render the element's vdom tree to DOM nodes which can be mounted on the DOM any? -> DOMNode | [
"render",
"the",
"element",
"s",
"vdom",
"tree",
"to",
"DOM",
"nodes",
"which",
"can",
"be",
"mounted",
"on",
"the",
"DOM",
"any?",
"-",
">",
"DOMNode"
] | 7c8b701da8a034937150b76974754d6c0fb1aef0 | https://github.com/yoshuawuyts/vel/blob/7c8b701da8a034937150b76974754d6c0fb1aef0/index.js#L30-L35 |
44,013 | DanielBaulig/chat.io | lib/chat.io.js | disconnect | function disconnect(socket) {
if (socket.namespace.name === '') return socket.disconnect();
socket.packet({type:'disconnect'});
socket.manager.onLeave(socket, socket.namespace.name);
socket.$emit('disconnect', 'booted');
} | javascript | function disconnect(socket) {
if (socket.namespace.name === '') return socket.disconnect();
socket.packet({type:'disconnect'});
socket.manager.onLeave(socket, socket.namespace.name);
socket.$emit('disconnect', 'booted');
} | [
"function",
"disconnect",
"(",
"socket",
")",
"{",
"if",
"(",
"socket",
".",
"namespace",
".",
"name",
"===",
"''",
")",
"return",
"socket",
".",
"disconnect",
"(",
")",
";",
"socket",
".",
"packet",
"(",
"{",
"type",
":",
"'disconnect'",
"}",
")",
"... | hack until socket.disconnect is fixed | [
"hack",
"until",
"socket",
".",
"disconnect",
"is",
"fixed"
] | cd99c6ccd90487bfab459c45a375a192f7baf242 | https://github.com/DanielBaulig/chat.io/blob/cd99c6ccd90487bfab459c45a375a192f7baf242/lib/chat.io.js#L13-L18 |
44,014 | feross/location-history | index.js | back | function back (self, cb, cancel) {
if (!cb) cb = noop
if (self._back.length === 0 || self._pending) return cb(null)
var previous = self._back.pop()
var current = self.current()
load(self, previous, done)
function done (err) {
if (err) return cb(err)
if (!cancel) self._forward.push(current)
sel... | javascript | function back (self, cb, cancel) {
if (!cb) cb = noop
if (self._back.length === 0 || self._pending) return cb(null)
var previous = self._back.pop()
var current = self.current()
load(self, previous, done)
function done (err) {
if (err) return cb(err)
if (!cancel) self._forward.push(current)
sel... | [
"function",
"back",
"(",
"self",
",",
"cb",
",",
"cancel",
")",
"{",
"if",
"(",
"!",
"cb",
")",
"cb",
"=",
"noop",
"if",
"(",
"self",
".",
"_back",
".",
"length",
"===",
"0",
"||",
"self",
".",
"_pending",
")",
"return",
"cb",
"(",
"null",
")",... | Goes back to the previous screen If 'cancel' is true, removes the current screen from history If 'cancel' if false, the user can return by going forward | [
"Goes",
"back",
"to",
"the",
"previous",
"screen",
"If",
"cancel",
"is",
"true",
"removes",
"the",
"current",
"screen",
"from",
"history",
"If",
"cancel",
"if",
"false",
"the",
"user",
"can",
"return",
"by",
"going",
"forward"
] | b20392494dc0aef81afd4b4102dbd2da74d5ab7a | https://github.com/feross/location-history/blob/b20392494dc0aef81afd4b4102dbd2da74d5ab7a/index.js#L39-L54 |
44,015 | dcodeIO/colour.js | colour.js | addProperty | function addProperty(col, func) {
// Exposed on top of the namespace
colour[col] = function(str) {
return func.apply(str);
};
// And on top of all strings
try {
String.prototype.__defineGetter__(col, func);
definedGetters[col] = func;
}... | javascript | function addProperty(col, func) {
// Exposed on top of the namespace
colour[col] = function(str) {
return func.apply(str);
};
// And on top of all strings
try {
String.prototype.__defineGetter__(col, func);
definedGetters[col] = func;
}... | [
"function",
"addProperty",
"(",
"col",
",",
"func",
")",
"{",
"// Exposed on top of the namespace",
"colour",
"[",
"col",
"]",
"=",
"function",
"(",
"str",
")",
"{",
"return",
"func",
".",
"apply",
"(",
"str",
")",
";",
"}",
";",
"// And on top of all string... | Prototypes the string object to have additional properties that wraps the current string in colours when accessed.
@param {string} col Colour / property name
@param {function(string):string} func Wrapper function
@private | [
"Prototypes",
"the",
"string",
"object",
"to",
"have",
"additional",
"properties",
"that",
"wraps",
"the",
"current",
"string",
"in",
"colours",
"when",
"accessed",
"."
] | 66a2f044ac9d8b1ae12062dbbc434c621c08368f | https://github.com/dcodeIO/colour.js/blob/66a2f044ac9d8b1ae12062dbbc434c621c08368f/colour.js#L136-L146 |
44,016 | dcodeIO/colour.js | colour.js | stylize | function stylize(str, style) {
if (colour.mode == 'console') {
return consoleStyles[style][0] + str + consoleStyles[style][1];
} else if (colour.mode == 'browser') {
return browserStyles[style][0] + str + browserStyles[style][1];
} else if (colour.mode == 'browser-css') {... | javascript | function stylize(str, style) {
if (colour.mode == 'console') {
return consoleStyles[style][0] + str + consoleStyles[style][1];
} else if (colour.mode == 'browser') {
return browserStyles[style][0] + str + browserStyles[style][1];
} else if (colour.mode == 'browser-css') {... | [
"function",
"stylize",
"(",
"str",
",",
"style",
")",
"{",
"if",
"(",
"colour",
".",
"mode",
"==",
"'console'",
")",
"{",
"return",
"consoleStyles",
"[",
"style",
"]",
"[",
"0",
"]",
"+",
"str",
"+",
"consoleStyles",
"[",
"style",
"]",
"[",
"1",
"]... | Applies a style to a string.
@param {string} str String to stylize
@param {string} style Style to apply
@returns {string}
@private | [
"Applies",
"a",
"style",
"to",
"a",
"string",
"."
] | 66a2f044ac9d8b1ae12062dbbc434c621c08368f | https://github.com/dcodeIO/colour.js/blob/66a2f044ac9d8b1ae12062dbbc434c621c08368f/colour.js#L198-L207 |
44,017 | dcodeIO/colour.js | colour.js | applyTheme | function applyTheme(theme) {
Object.keys(theme).forEach(function(prop) {
if (prototypeBlacklist.indexOf(prop) >= 0) {
return;
}
if (typeof theme[prop] == 'string') {
// Multiple colours white-space seperated #45, e.g. "red bold", #18
... | javascript | function applyTheme(theme) {
Object.keys(theme).forEach(function(prop) {
if (prototypeBlacklist.indexOf(prop) >= 0) {
return;
}
if (typeof theme[prop] == 'string') {
// Multiple colours white-space seperated #45, e.g. "red bold", #18
... | [
"function",
"applyTheme",
"(",
"theme",
")",
"{",
"Object",
".",
"keys",
"(",
"theme",
")",
".",
"forEach",
"(",
"function",
"(",
"prop",
")",
"{",
"if",
"(",
"prototypeBlacklist",
".",
"indexOf",
"(",
"prop",
")",
">=",
"0",
")",
"{",
"return",
";",... | Applies a theme.
@param {!Object} theme Theme to apply | [
"Applies",
"a",
"theme",
"."
] | 66a2f044ac9d8b1ae12062dbbc434c621c08368f | https://github.com/dcodeIO/colour.js/blob/66a2f044ac9d8b1ae12062dbbc434c621c08368f/colour.js#L233-L250 |
44,018 | dcodeIO/colour.js | colour.js | sequencer | function sequencer(map) {
return function () {
if (this == undefined) return "";
var i=0;
return String.prototype.split.apply(this, [""]).map(map).join("");
};
} | javascript | function sequencer(map) {
return function () {
if (this == undefined) return "";
var i=0;
return String.prototype.split.apply(this, [""]).map(map).join("");
};
} | [
"function",
"sequencer",
"(",
"map",
")",
"{",
"return",
"function",
"(",
")",
"{",
"if",
"(",
"this",
"==",
"undefined",
")",
"return",
"\"\"",
";",
"var",
"i",
"=",
"0",
";",
"return",
"String",
".",
"prototype",
".",
"split",
".",
"apply",
"(",
... | Extends a mapper with the current index inside the string as a second argument.
@param {function(string, number):string} map Sequencing function
@returns {function(string):string} Wrapped sequencer
@private | [
"Extends",
"a",
"mapper",
"with",
"the",
"current",
"index",
"inside",
"the",
"string",
"as",
"a",
"second",
"argument",
"."
] | 66a2f044ac9d8b1ae12062dbbc434c621c08368f | https://github.com/dcodeIO/colour.js/blob/66a2f044ac9d8b1ae12062dbbc434c621c08368f/colour.js#L282-L288 |
44,019 | sequitur/blotter | lib/engine.js | choiceListener | function choiceListener(index) {
return function (event) {
event.preventDefault();
if (choicesAnimating) return;
clearChoiceListeners();
story.ChooseChoiceIndex(index);
saveGame(index);
clearOldChoices().then(() => progressGame());
}
} | javascript | function choiceListener(index) {
return function (event) {
event.preventDefault();
if (choicesAnimating) return;
clearChoiceListeners();
story.ChooseChoiceIndex(index);
saveGame(index);
clearOldChoices().then(() => progressGame());
}
} | [
"function",
"choiceListener",
"(",
"index",
")",
"{",
"return",
"function",
"(",
"event",
")",
"{",
"event",
".",
"preventDefault",
"(",
")",
";",
"if",
"(",
"choicesAnimating",
")",
"return",
";",
"clearChoiceListeners",
"(",
")",
";",
"story",
".",
"Choo... | Create a listener function to attach to one of the li elements that represents a player choice. | [
"Create",
"a",
"listener",
"function",
"to",
"attach",
"to",
"one",
"of",
"the",
"li",
"elements",
"that",
"represents",
"a",
"player",
"choice",
"."
] | f2f22e6ff95e6e0c19ea2c3d939bad63b2de6830 | https://github.com/sequitur/blotter/blob/f2f22e6ff95e6e0c19ea2c3d939bad63b2de6830/lib/engine.js#L212-L221 |
44,020 | sequitur/blotter | lib/engine.js | createChoiceListener | function createChoiceListener(li, index) {
li.clickListener = choiceListener(index);
li.addEventListener('click', li.clickListener);
li.clearListener = (function () {
this.removeEventListener('click', this.clickListener);
}).bind(li);
} | javascript | function createChoiceListener(li, index) {
li.clickListener = choiceListener(index);
li.addEventListener('click', li.clickListener);
li.clearListener = (function () {
this.removeEventListener('click', this.clickListener);
}).bind(li);
} | [
"function",
"createChoiceListener",
"(",
"li",
",",
"index",
")",
"{",
"li",
".",
"clickListener",
"=",
"choiceListener",
"(",
"index",
")",
";",
"li",
".",
"addEventListener",
"(",
"'click'",
",",
"li",
".",
"clickListener",
")",
";",
"li",
".",
"clearLis... | Attach that listener to the element. | [
"Attach",
"that",
"listener",
"to",
"the",
"element",
"."
] | f2f22e6ff95e6e0c19ea2c3d939bad63b2de6830 | https://github.com/sequitur/blotter/blob/f2f22e6ff95e6e0c19ea2c3d939bad63b2de6830/lib/engine.js#L246-L252 |
44,021 | sequitur/blotter | lib/engine.js | clearChoiceListeners | function clearChoiceListeners() {
const lis = document.querySelectorAll('li');
Array.from(lis).forEach(li => {
if (li.clearListener) li.clearListener();
})
} | javascript | function clearChoiceListeners() {
const lis = document.querySelectorAll('li');
Array.from(lis).forEach(li => {
if (li.clearListener) li.clearListener();
})
} | [
"function",
"clearChoiceListeners",
"(",
")",
"{",
"const",
"lis",
"=",
"document",
".",
"querySelectorAll",
"(",
"'li'",
")",
";",
"Array",
".",
"from",
"(",
"lis",
")",
".",
"forEach",
"(",
"li",
"=>",
"{",
"if",
"(",
"li",
".",
"clearListener",
")",... | Clean up event listeners from choices once one of them was selected. | [
"Clean",
"up",
"event",
"listeners",
"from",
"choices",
"once",
"one",
"of",
"them",
"was",
"selected",
"."
] | f2f22e6ff95e6e0c19ea2c3d939bad63b2de6830 | https://github.com/sequitur/blotter/blob/f2f22e6ff95e6e0c19ea2c3d939bad63b2de6830/lib/engine.js#L255-L260 |
44,022 | sequitur/blotter | lib/engine.js | createChoiceUl | function createChoiceUl () {
const lis = story.currentChoices
.map(choice => {
const li = document.createElement('li');
li.innerHTML = choice.text;
createChoiceListener(li, choice.index);
return li;
});
const ul = document.createElement('ul');
Array.from(lis).forEach(li => ul.appen... | javascript | function createChoiceUl () {
const lis = story.currentChoices
.map(choice => {
const li = document.createElement('li');
li.innerHTML = choice.text;
createChoiceListener(li, choice.index);
return li;
});
const ul = document.createElement('ul');
Array.from(lis).forEach(li => ul.appen... | [
"function",
"createChoiceUl",
"(",
")",
"{",
"const",
"lis",
"=",
"story",
".",
"currentChoices",
".",
"map",
"(",
"choice",
"=>",
"{",
"const",
"li",
"=",
"document",
".",
"createElement",
"(",
"'li'",
")",
";",
"li",
".",
"innerHTML",
"=",
"choice",
... | Create the ul element that contains a batch of choices. | [
"Create",
"the",
"ul",
"element",
"that",
"contains",
"a",
"batch",
"of",
"choices",
"."
] | f2f22e6ff95e6e0c19ea2c3d939bad63b2de6830 | https://github.com/sequitur/blotter/blob/f2f22e6ff95e6e0c19ea2c3d939bad63b2de6830/lib/engine.js#L263-L275 |
44,023 | sequitur/blotter | lib/engine.js | placeChoices | function placeChoices () {
const ul = createChoiceUl();
ul.addEventListener('animationend', () => choicesAnimating = false);
choicesAnimating = true;
choiceDiv.appendChild(ul);
} | javascript | function placeChoices () {
const ul = createChoiceUl();
ul.addEventListener('animationend', () => choicesAnimating = false);
choicesAnimating = true;
choiceDiv.appendChild(ul);
} | [
"function",
"placeChoices",
"(",
")",
"{",
"const",
"ul",
"=",
"createChoiceUl",
"(",
")",
";",
"ul",
".",
"addEventListener",
"(",
"'animationend'",
",",
"(",
")",
"=>",
"choicesAnimating",
"=",
"false",
")",
";",
"choicesAnimating",
"=",
"true",
";",
"ch... | Insert a choice list into the container div. | [
"Insert",
"a",
"choice",
"list",
"into",
"the",
"container",
"div",
"."
] | f2f22e6ff95e6e0c19ea2c3d939bad63b2de6830 | https://github.com/sequitur/blotter/blob/f2f22e6ff95e6e0c19ea2c3d939bad63b2de6830/lib/engine.js#L278-L283 |
44,024 | sequitur/blotter | lib/engine.js | clearOldChoices | function clearOldChoices () {
const oldChoices = choiceDiv.querySelector('.choices.current');
return new Promise(resolve => {
oldChoices.addEventListener('transitionend', () => {
oldChoices.remove();
resolve();
});
oldChoices.className = "choices old";
})
} | javascript | function clearOldChoices () {
const oldChoices = choiceDiv.querySelector('.choices.current');
return new Promise(resolve => {
oldChoices.addEventListener('transitionend', () => {
oldChoices.remove();
resolve();
});
oldChoices.className = "choices old";
})
} | [
"function",
"clearOldChoices",
"(",
")",
"{",
"const",
"oldChoices",
"=",
"choiceDiv",
".",
"querySelector",
"(",
"'.choices.current'",
")",
";",
"return",
"new",
"Promise",
"(",
"resolve",
"=>",
"{",
"oldChoices",
".",
"addEventListener",
"(",
"'transitionend'",
... | Mark used choice lists as old and remove them from the view. | [
"Mark",
"used",
"choice",
"lists",
"as",
"old",
"and",
"remove",
"them",
"from",
"the",
"view",
"."
] | f2f22e6ff95e6e0c19ea2c3d939bad63b2de6830 | https://github.com/sequitur/blotter/blob/f2f22e6ff95e6e0c19ea2c3d939bad63b2de6830/lib/engine.js#L286-L295 |
44,025 | wala/jsdelta | src/delta_multi.js | deltaDebugFiles | function deltaDebugFiles(file) {
try {
logging.increaseIndentation();
state.fileUnderTest = file;
logging.logTargetChange(file, state.tmpDir);
// try removing fileUnderTest completely
var backup = makeBackupFileName();
fs.renameSync(file, ... | javascript | function deltaDebugFiles(file) {
try {
logging.increaseIndentation();
state.fileUnderTest = file;
logging.logTargetChange(file, state.tmpDir);
// try removing fileUnderTest completely
var backup = makeBackupFileName();
fs.renameSync(file, ... | [
"function",
"deltaDebugFiles",
"(",
"file",
")",
"{",
"try",
"{",
"logging",
".",
"increaseIndentation",
"(",
")",
";",
"state",
".",
"fileUnderTest",
"=",
"file",
";",
"logging",
".",
"logTargetChange",
"(",
"file",
",",
"state",
".",
"tmpDir",
")",
";",
... | Recursively pass through the file-hierarchy and invoke delta_single.main on all files
@return boolean true if at least one reduction was performed successfully. | [
"Recursively",
"pass",
"through",
"the",
"file",
"-",
"hierarchy",
"and",
"invoke",
"delta_single",
".",
"main",
"on",
"all",
"files"
] | 355febea1ee23e9e909ba2bfa087ffb2499a3295 | https://github.com/wala/jsdelta/blob/355febea1ee23e9e909ba2bfa087ffb2499a3295/src/delta_multi.js#L127-L159 |
44,026 | ariatemplates/hashspace | docs/libs/jx.js | function () {
var http = false;
// Use IE's ActiveX items to load the file.
if (typeof ActiveXObject != 'undefined') {
try {
http = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http = new ActiveXObject("Micro... | javascript | function () {
var http = false;
// Use IE's ActiveX items to load the file.
if (typeof ActiveXObject != 'undefined') {
try {
http = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http = new ActiveXObject("Micro... | [
"function",
"(",
")",
"{",
"var",
"http",
"=",
"false",
";",
"// Use IE's ActiveX items to load the file.",
"if",
"(",
"typeof",
"ActiveXObject",
"!=",
"'undefined'",
")",
"{",
"try",
"{",
"http",
"=",
"new",
"ActiveXObject",
"(",
"\"Msxml2.XMLHTTP\"",
")",
";",... | Create a xmlHttpRequest object - this is the constructor. | [
"Create",
"a",
"xmlHttpRequest",
"object",
"-",
"this",
"is",
"the",
"constructor",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/docs/libs/jx.js#L7-L29 | |
44,027 | mljs/fft | src/FFTUtils.js | ifft2DArray | function ifft2DArray(ft, ftRows, ftCols) {
var tempTransform = new Array(ftRows * ftCols);
var nRows = ftRows / 2;
var nCols = (ftCols - 1) * 2;
// reverse transform columns
FFT.init(nRows);
var tmpCols = {re: new Array(nRows), im: new Array(nRows)};
var iRow, iCol;
for (iCol = 0; iCol <... | javascript | function ifft2DArray(ft, ftRows, ftCols) {
var tempTransform = new Array(ftRows * ftCols);
var nRows = ftRows / 2;
var nCols = (ftCols - 1) * 2;
// reverse transform columns
FFT.init(nRows);
var tmpCols = {re: new Array(nRows), im: new Array(nRows)};
var iRow, iCol;
for (iCol = 0; iCol <... | [
"function",
"ifft2DArray",
"(",
"ft",
",",
"ftRows",
",",
"ftCols",
")",
"{",
"var",
"tempTransform",
"=",
"new",
"Array",
"(",
"ftRows",
"*",
"ftCols",
")",
";",
"var",
"nRows",
"=",
"ftRows",
"/",
"2",
";",
"var",
"nCols",
"=",
"(",
"ftCols",
"-",
... | Calculates the inverse of a 2D Fourier transform
@param ft
@param ftRows
@param ftCols
@return | [
"Calculates",
"the",
"inverse",
"of",
"a",
"2D",
"Fourier",
"transform"
] | 436ff9535ded13393f359b50d55c68e94e2e8d51 | https://github.com/mljs/fft/blob/436ff9535ded13393f359b50d55c68e94e2e8d51/src/FFTUtils.js#L13-L57 |
44,028 | mljs/fft | src/FFTUtils.js | convolute2DI | function convolute2DI(ftSignal, ftFilter, ftRows, ftCols) {
var re, im;
for (var iRow = 0; iRow < ftRows / 2; iRow++) {
for (var iCol = 0; iCol < ftCols; iCol++) {
//
re = ftSignal[(iRow * 2) * ftCols + iCol]
* ftFilter[(iRow * 2) * ftCols + iCol]
... | javascript | function convolute2DI(ftSignal, ftFilter, ftRows, ftCols) {
var re, im;
for (var iRow = 0; iRow < ftRows / 2; iRow++) {
for (var iCol = 0; iCol < ftCols; iCol++) {
//
re = ftSignal[(iRow * 2) * ftCols + iCol]
* ftFilter[(iRow * 2) * ftCols + iCol]
... | [
"function",
"convolute2DI",
"(",
"ftSignal",
",",
"ftFilter",
",",
"ftRows",
",",
"ftCols",
")",
"{",
"var",
"re",
",",
"im",
";",
"for",
"(",
"var",
"iRow",
"=",
"0",
";",
"iRow",
"<",
"ftRows",
"/",
"2",
";",
"iRow",
"++",
")",
"{",
"for",
"(",... | In place version of convolute 2D
@param ftSignal
@param ftFilter
@param ftRows
@param ftCols
@return | [
"In",
"place",
"version",
"of",
"convolute",
"2D"
] | 436ff9535ded13393f359b50d55c68e94e2e8d51 | https://github.com/mljs/fft/blob/436ff9535ded13393f359b50d55c68e94e2e8d51/src/FFTUtils.js#L187-L205 |
44,029 | mljs/fft | src/FFTUtils.js | crop | function crop(data, rows, cols, nRows, nCols) {
if (rows === nRows && cols === nCols) {
//Do nothing. Returns the same input!!! Be careful
return data;
}
var output = new Array(nCols * nRows);
var shiftR = Math.floor((rows - nRows) / 2);
var shiftC = Math.floor((cols - nCols) / 2)... | javascript | function crop(data, rows, cols, nRows, nCols) {
if (rows === nRows && cols === nCols) {
//Do nothing. Returns the same input!!! Be careful
return data;
}
var output = new Array(nCols * nRows);
var shiftR = Math.floor((rows - nRows) / 2);
var shiftC = Math.floor((cols - nCols) / 2)... | [
"function",
"crop",
"(",
"data",
",",
"rows",
",",
"cols",
",",
"nRows",
",",
"nCols",
")",
"{",
"if",
"(",
"rows",
"===",
"nRows",
"&&",
"cols",
"===",
"nCols",
")",
"{",
"//Do nothing. Returns the same input!!! Be careful",
"return",
"data",
";",
"}",
"v... | Crop the given matrix to fit the corresponding number of rows and columns | [
"Crop",
"the",
"given",
"matrix",
"to",
"fit",
"the",
"corresponding",
"number",
"of",
"rows",
"and",
"columns"
] | 436ff9535ded13393f359b50d55c68e94e2e8d51 | https://github.com/mljs/fft/blob/436ff9535ded13393f359b50d55c68e94e2e8d51/src/FFTUtils.js#L295-L316 |
44,030 | ariatemplates/hashspace | hsp/rt/cptwrapper.js | function (Cptfn) {
if (!Cptfn || Cptfn.constructor !== Function) {
log.error("[CptWrapper] Invalid Component constructor!");
} else {
this.cpt = new Cptfn();
this.nodeInstance = null; // reference to set the node instance adirty when an attribute changes
t... | javascript | function (Cptfn) {
if (!Cptfn || Cptfn.constructor !== Function) {
log.error("[CptWrapper] Invalid Component constructor!");
} else {
this.cpt = new Cptfn();
this.nodeInstance = null; // reference to set the node instance adirty when an attribute changes
t... | [
"function",
"(",
"Cptfn",
")",
"{",
"if",
"(",
"!",
"Cptfn",
"||",
"Cptfn",
".",
"constructor",
"!==",
"Function",
")",
"{",
"log",
".",
"error",
"(",
"\"[CptWrapper] Invalid Component constructor!\"",
")",
";",
"}",
"else",
"{",
"this",
".",
"cpt",
"=",
... | Observer constructor.
@param Cptfn {Function} the component constructor | [
"Observer",
"constructor",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptwrapper.js#L96-L151 | |
44,031 | ariatemplates/hashspace | hsp/rt/cptwrapper.js | function (change) {
var chg = change, cpt = this.cpt;
if (change.constructor === Array) {
if (change.length > 0) {
chg = change[0];
} else {
log.error('[CptNode] Invalid change - nbr of changes: '+change.length);
return;
... | javascript | function (change) {
var chg = change, cpt = this.cpt;
if (change.constructor === Array) {
if (change.length > 0) {
chg = change[0];
} else {
log.error('[CptNode] Invalid change - nbr of changes: '+change.length);
return;
... | [
"function",
"(",
"change",
")",
"{",
"var",
"chg",
"=",
"change",
",",
"cpt",
"=",
"this",
".",
"cpt",
";",
"if",
"(",
"change",
".",
"constructor",
"===",
"Array",
")",
"{",
"if",
"(",
"change",
".",
"length",
">",
"0",
")",
"{",
"chg",
"=",
"... | Check if not already in event handler stack and call the change event handler | [
"Check",
"if",
"not",
"already",
"in",
"event",
"handler",
"stack",
"and",
"call",
"the",
"change",
"event",
"handler"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptwrapper.js#L276-L348 | |
44,032 | ariatemplates/hashspace | hsp/rt/cptwrapper.js | createCptWrapper | function createCptWrapper(Ctl, cptArgs) {
var cw = new CptWrapper(Ctl), att, t, v; // will also create a new controller instance
if (cptArgs) {
var cpt=cw.cpt, ni=cptArgs.nodeInstance;
if (ni.isCptComponent || ni.isCptAttElement) {
// set the nodeInstance reference on the component
... | javascript | function createCptWrapper(Ctl, cptArgs) {
var cw = new CptWrapper(Ctl), att, t, v; // will also create a new controller instance
if (cptArgs) {
var cpt=cw.cpt, ni=cptArgs.nodeInstance;
if (ni.isCptComponent || ni.isCptAttElement) {
// set the nodeInstance reference on the component
... | [
"function",
"createCptWrapper",
"(",
"Ctl",
",",
"cptArgs",
")",
"{",
"var",
"cw",
"=",
"new",
"CptWrapper",
"(",
"Ctl",
")",
",",
"att",
",",
"t",
",",
"v",
";",
"// will also create a new controller instance",
"if",
"(",
"cptArgs",
")",
"{",
"var",
"cpt"... | Create a Component wrapper and initialize it correctly according to the attributes passed as arguments
@param {Object} cptArgs the component arguments
e.g. { nodeInstance:x, $attributes:{att1:{}, att2:{}}, $content:[] } | [
"Create",
"a",
"Component",
"wrapper",
"and",
"initialize",
"it",
"correctly",
"according",
"to",
"the",
"attributes",
"passed",
"as",
"arguments"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptwrapper.js#L388-L428 |
44,033 | fardog/node-xkcd-password | index.js | XKCDPassword | function XKCDPassword() {
if (!(this instanceof XKCDPassword)) return new XKCDPassword()
var self = this
events.EventEmitter.call(self)
self.wordlist = null
self.wordfile = null
// if we've got a wordlist at the ready
self.ready = false
self.initialized = false
return this
} | javascript | function XKCDPassword() {
if (!(this instanceof XKCDPassword)) return new XKCDPassword()
var self = this
events.EventEmitter.call(self)
self.wordlist = null
self.wordfile = null
// if we've got a wordlist at the ready
self.ready = false
self.initialized = false
return this
} | [
"function",
"XKCDPassword",
"(",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"XKCDPassword",
")",
")",
"return",
"new",
"XKCDPassword",
"(",
")",
"var",
"self",
"=",
"this",
"events",
".",
"EventEmitter",
".",
"call",
"(",
"self",
")",
"self",
... | Creates the password generator.
@constructor
@since 0.0.1
@returns {Generator} the word generator | [
"Creates",
"the",
"password",
"generator",
"."
] | a45ec266a7489977b83e9cdf48239e7adf269271 | https://github.com/fardog/node-xkcd-password/blob/a45ec266a7489977b83e9cdf48239e7adf269271/index.js#L34-L49 |
44,034 | mljs/fft | src/fftlib.js | fft2d | function fft2d(re, im) {
var tre = [],
tim = [],
i = 0;
// x-axis
for (var y = 0; y < _n; y++) {
i = y * _n;
for (var x1 = 0; x1 < _n; x1++) {
tre[x1] = re[x1 + i];
tim[x1] = im[x1 + i];
}
fft1d(tre, tim);
for (var x2 = 0; x2 < ... | javascript | function fft2d(re, im) {
var tre = [],
tim = [],
i = 0;
// x-axis
for (var y = 0; y < _n; y++) {
i = y * _n;
for (var x1 = 0; x1 < _n; x1++) {
tre[x1] = re[x1 + i];
tim[x1] = im[x1 + i];
}
fft1d(tre, tim);
for (var x2 = 0; x2 < ... | [
"function",
"fft2d",
"(",
"re",
",",
"im",
")",
"{",
"var",
"tre",
"=",
"[",
"]",
",",
"tim",
"=",
"[",
"]",
",",
"i",
"=",
"0",
";",
"// x-axis",
"for",
"(",
"var",
"y",
"=",
"0",
";",
"y",
"<",
"_n",
";",
"y",
"++",
")",
"{",
"i",
"="... | 2D-FFT Not very useful if the number of rows have to be equal to cols | [
"2D",
"-",
"FFT",
"Not",
"very",
"useful",
"if",
"the",
"number",
"of",
"rows",
"have",
"to",
"be",
"equal",
"to",
"cols"
] | 436ff9535ded13393f359b50d55c68e94e2e8d51 | https://github.com/mljs/fft/blob/436ff9535ded13393f359b50d55c68e94e2e8d51/src/fftlib.js#L42-L73 |
44,035 | mljs/fft | src/fftlib.js | ifft2d | function ifft2d(re, im) {
var tre = [],
tim = [],
i = 0;
// x-axis
for (var y = 0; y < _n; y++) {
i = y * _n;
for (var x1 = 0; x1 < _n; x1++) {
tre[x1] = re[x1 + i];
tim[x1] = im[x1 + i];
}
ifft1d(tre, tim);
for (var x2 = 0; x2 ... | javascript | function ifft2d(re, im) {
var tre = [],
tim = [],
i = 0;
// x-axis
for (var y = 0; y < _n; y++) {
i = y * _n;
for (var x1 = 0; x1 < _n; x1++) {
tre[x1] = re[x1 + i];
tim[x1] = im[x1 + i];
}
ifft1d(tre, tim);
for (var x2 = 0; x2 ... | [
"function",
"ifft2d",
"(",
"re",
",",
"im",
")",
"{",
"var",
"tre",
"=",
"[",
"]",
",",
"tim",
"=",
"[",
"]",
",",
"i",
"=",
"0",
";",
"// x-axis",
"for",
"(",
"var",
"y",
"=",
"0",
";",
"y",
"<",
"_n",
";",
"y",
"++",
")",
"{",
"i",
"=... | 2D-IFFT | [
"2D",
"-",
"IFFT"
] | 436ff9535ded13393f359b50d55c68e94e2e8d51 | https://github.com/mljs/fft/blob/436ff9535ded13393f359b50d55c68e94e2e8d51/src/fftlib.js#L76-L107 |
44,036 | ariatemplates/hashspace | hsp/compiler/jsgenerator/processors.js | formatExpression | function formatExpression (expression, firstIndex, walker) {
var category = expression.category, codeStmts, code = '', nextIndex = firstIndex;
var exprIndex = firstIndex;
var expAst;
if (category === 'jsexptext') {
//compile the expression to detect errors and parse-out identifiers
try ... | javascript | function formatExpression (expression, firstIndex, walker) {
var category = expression.category, codeStmts, code = '', nextIndex = firstIndex;
var exprIndex = firstIndex;
var expAst;
if (category === 'jsexptext') {
//compile the expression to detect errors and parse-out identifiers
try ... | [
"function",
"formatExpression",
"(",
"expression",
",",
"firstIndex",
",",
"walker",
")",
"{",
"var",
"category",
"=",
"expression",
".",
"category",
",",
"codeStmts",
",",
"code",
"=",
"''",
",",
"nextIndex",
"=",
"firstIndex",
";",
"var",
"exprIndex",
"=",... | Formats an expression according to its category.
@param {Object} expression the expression to format.
@param {Integer} firstIndex index of the expression.
@param {TemplateWalker} walker the template walker instance.
@return {Object} the expression string and the next expression index that can be used | [
"Formats",
"an",
"expression",
"according",
"to",
"its",
"category",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/jsgenerator/processors.js#L343-L377 |
44,037 | ariatemplates/hashspace | hsp/compiler/jsgenerator/processors.js | formatTextBlock | function formatTextBlock (node, nextExprIndex, walker) {
var content = node.content, item, exprArray = [], args = [], index = 0; // idx is the index in the $text array
// (=args)
for (var i = 0; i < content.length; i++) {
it... | javascript | function formatTextBlock (node, nextExprIndex, walker) {
var content = node.content, item, exprArray = [], args = [], index = 0; // idx is the index in the $text array
// (=args)
for (var i = 0; i < content.length; i++) {
it... | [
"function",
"formatTextBlock",
"(",
"node",
",",
"nextExprIndex",
",",
"walker",
")",
"{",
"var",
"content",
"=",
"node",
".",
"content",
",",
"item",
",",
"exprArray",
"=",
"[",
"]",
",",
"args",
"=",
"[",
"]",
",",
"index",
"=",
"0",
";",
"// idx i... | Format the textblock content for textblock and attribute nodes.
@param {Node} node the current Node object as built by the treebuilder.
@param {Integer} nextExprIndex the index of the next expression.
@param {TreeWalker} walker the template walker instance.
@return {Object} a snippet of Javascript code built from the n... | [
"Format",
"the",
"textblock",
"content",
"for",
"textblock",
"and",
"attribute",
"nodes",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/jsgenerator/processors.js#L386-L434 |
44,038 | ariatemplates/hashspace | hsp/rt/log.js | formatValue | function formatValue(v,depth) {
if (depth===undefined || depth===null) {
depth=1;
}
var tp=typeof(v), val;
if (v===null) {
return "null";
} else if (v===undefined) {
return "undefined";
} else if (tp==='object') {
if (depth>0) {
var properties=[];
... | javascript | function formatValue(v,depth) {
if (depth===undefined || depth===null) {
depth=1;
}
var tp=typeof(v), val;
if (v===null) {
return "null";
} else if (v===undefined) {
return "undefined";
} else if (tp==='object') {
if (depth>0) {
var properties=[];
... | [
"function",
"formatValue",
"(",
"v",
",",
"depth",
")",
"{",
"if",
"(",
"depth",
"===",
"undefined",
"||",
"depth",
"===",
"null",
")",
"{",
"depth",
"=",
"1",
";",
"}",
"var",
"tp",
"=",
"typeof",
"(",
"v",
")",
",",
"val",
";",
"if",
"(",
"v"... | Format a JS entity for the log
@param v {Object} the value to format
@param depth {Number} the formatting of objects and arrays (default: 1) | [
"Format",
"a",
"JS",
"entity",
"for",
"the",
"log"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/log.js#L248-L306 |
44,039 | ariatemplates/hashspace | hsp/expressions/manipulator.js | function(scope, defaultValue) {
var val = evaluator(tree, scope);
if( typeof defaultValue === 'undefined') {
return val;
} else {
return (val === undefined || val === null || val != val) ? defaultValue : val;
}
} | javascript | function(scope, defaultValue) {
var val = evaluator(tree, scope);
if( typeof defaultValue === 'undefined') {
return val;
} else {
return (val === undefined || val === null || val != val) ? defaultValue : val;
}
} | [
"function",
"(",
"scope",
",",
"defaultValue",
")",
"{",
"var",
"val",
"=",
"evaluator",
"(",
"tree",
",",
"scope",
")",
";",
"if",
"(",
"typeof",
"defaultValue",
"===",
"'undefined'",
")",
"{",
"return",
"val",
";",
"}",
"else",
"{",
"return",
"(",
... | Evaluates an expression against a scope
@param scope
@return {*} - value of an expression in a given scope | [
"Evaluates",
"an",
"expression",
"against",
"a",
"scope"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/expressions/manipulator.js#L38-L45 | |
44,040 | ariatemplates/hashspace | hsp/expressions/manipulator.js | function(scope, newValue) {
if (!isAssignable) {
throw new Error('Expression "' + input + '" is not assignable');
}
if (tree.a === 'idn') {
json.set(scope, tree.v, newValue);
} else if (tree.a === 'bnr') {
json.set(evaluator... | javascript | function(scope, newValue) {
if (!isAssignable) {
throw new Error('Expression "' + input + '" is not assignable');
}
if (tree.a === 'idn') {
json.set(scope, tree.v, newValue);
} else if (tree.a === 'bnr') {
json.set(evaluator... | [
"function",
"(",
"scope",
",",
"newValue",
")",
"{",
"if",
"(",
"!",
"isAssignable",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Expression \"'",
"+",
"input",
"+",
"'\" is not assignable'",
")",
";",
"}",
"if",
"(",
"tree",
".",
"a",
"===",
"'idn'",
")"... | Sets value of an expression on a scope. Not all expressions
are assignable.
@param scope - scope that should be modified
@param {*} a new value for a given expression and scope | [
"Sets",
"value",
"of",
"an",
"expression",
"on",
"a",
"scope",
".",
"Not",
"all",
"expressions",
"are",
"assignable",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/expressions/manipulator.js#L52-L62 | |
44,041 | sbisbee/sag-js | src/server.private.js | setURLParameter | function setURLParameter(url, key, value) {
if(typeof url !== 'string') {
throw new Error('URLs must be a string');
}
if(urlUtils) {
//node.js
url = urlUtils.parse(url);
url.search = ((url.search) ? url.search + '&' : '?') + key + '=' + value;
url = urlUtils.format(url);
}
else {
//... | javascript | function setURLParameter(url, key, value) {
if(typeof url !== 'string') {
throw new Error('URLs must be a string');
}
if(urlUtils) {
//node.js
url = urlUtils.parse(url);
url.search = ((url.search) ? url.search + '&' : '?') + key + '=' + value;
url = urlUtils.format(url);
}
else {
//... | [
"function",
"setURLParameter",
"(",
"url",
",",
"key",
",",
"value",
")",
"{",
"if",
"(",
"typeof",
"url",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'URLs must be a string'",
")",
";",
"}",
"if",
"(",
"urlUtils",
")",
"{",
"//node.js",
... | Adds a query param to a URL. | [
"Adds",
"a",
"query",
"param",
"to",
"a",
"URL",
"."
] | f9aa69d07e2e6320894bb63859ff293c2285a586 | https://github.com/sbisbee/sag-js/blob/f9aa69d07e2e6320894bb63859ff293c2285a586/src/server.private.js#L242-L265 |
44,042 | vigneshshanmugam/js-cpa | lib/hash.js | hashcons | function hashcons(node) {
const keys = t.VISITOR_KEYS[node.type];
if (!keys) return;
let hash = hashcode(node);
for (const key of keys) {
const subNode = node[key];
if (Array.isArray(subNode)) {
for (const child of subNode) {
if (child) {
hash += hashcons(child);
}
... | javascript | function hashcons(node) {
const keys = t.VISITOR_KEYS[node.type];
if (!keys) return;
let hash = hashcode(node);
for (const key of keys) {
const subNode = node[key];
if (Array.isArray(subNode)) {
for (const child of subNode) {
if (child) {
hash += hashcons(child);
}
... | [
"function",
"hashcons",
"(",
"node",
")",
"{",
"const",
"keys",
"=",
"t",
".",
"VISITOR_KEYS",
"[",
"node",
".",
"type",
"]",
";",
"if",
"(",
"!",
"keys",
")",
"return",
";",
"let",
"hash",
"=",
"hashcode",
"(",
"node",
")",
";",
"for",
"(",
"con... | Hashconsing - return the hash of an ASTNode computed recursively
@param {ASTNode} node | [
"Hashconsing",
"-",
"return",
"the",
"hash",
"of",
"an",
"ASTNode",
"computed",
"recursively"
] | ebcc5952ecc1909cbe5e3ca69a974409b65ccdf8 | https://github.com/vigneshshanmugam/js-cpa/blob/ebcc5952ecc1909cbe5e3ca69a974409b65ccdf8/lib/hash.js#L12-L33 |
44,043 | ariatemplates/hashspace | hsp/compiler/jsgenerator/jsvalidator/validator.js | formatError | function formatError (error, input) {
var message = error.toString().replace(/\s*\(\d*\:\d*\)\s*$/i, ''); // remove line number / col number
var beforeMatch = ('' + input.slice(0, error.pos)).match(/.*$/i);
var afterMatch = ('' + input.slice(error.pos)).match(/.*/i);
var before = beforeMatch ? beforeMa... | javascript | function formatError (error, input) {
var message = error.toString().replace(/\s*\(\d*\:\d*\)\s*$/i, ''); // remove line number / col number
var beforeMatch = ('' + input.slice(0, error.pos)).match(/.*$/i);
var afterMatch = ('' + input.slice(error.pos)).match(/.*/i);
var before = beforeMatch ? beforeMa... | [
"function",
"formatError",
"(",
"error",
",",
"input",
")",
"{",
"var",
"message",
"=",
"error",
".",
"toString",
"(",
")",
".",
"replace",
"(",
"/",
"\\s*\\(\\d*\\:\\d*\\)\\s*$",
"/",
"i",
",",
"''",
")",
";",
"// remove line number / col number",
"var",
"b... | Formats the error as an error structure with line extract information.
@param {Object} error the exception.
@param {String} input the Javascript string.
@return {Object} the structured error. | [
"Formats",
"the",
"error",
"as",
"an",
"error",
"structure",
"with",
"line",
"extract",
"information",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/jsgenerator/jsvalidator/validator.js#L34-L65 |
44,044 | bbx10/node-htu21d | index.js | raspi_i2c_devname | function raspi_i2c_devname()
{
try {
var revisionBuffer = fs.readFileSync('/sys/module/bcm2708/parameters/boardrev');
var revisionInt = parseInt(revisionBuffer.toString(), 10);
//console.log('Raspberry Pi board revision: ', revisionInt);
// Older boards use i2c-0, newer boards use i2... | javascript | function raspi_i2c_devname()
{
try {
var revisionBuffer = fs.readFileSync('/sys/module/bcm2708/parameters/boardrev');
var revisionInt = parseInt(revisionBuffer.toString(), 10);
//console.log('Raspberry Pi board revision: ', revisionInt);
// Older boards use i2c-0, newer boards use i2... | [
"function",
"raspi_i2c_devname",
"(",
")",
"{",
"try",
"{",
"var",
"revisionBuffer",
"=",
"fs",
".",
"readFileSync",
"(",
"'/sys/module/bcm2708/parameters/boardrev'",
")",
";",
"var",
"revisionInt",
"=",
"parseInt",
"(",
"revisionBuffer",
".",
"toString",
"(",
")"... | If the system is a Raspberry Pi return the correct i2c device name. Else return empty string. | [
"If",
"the",
"system",
"is",
"a",
"Raspberry",
"Pi",
"return",
"the",
"correct",
"i2c",
"device",
"name",
".",
"Else",
"return",
"empty",
"string",
"."
] | 135e81b53ab5e98282cb16ea9d27ce193dc9bf0a | https://github.com/bbx10/node-htu21d/blob/135e81b53ab5e98282cb16ea9d27ce193dc9bf0a/index.js#L154-L177 |
44,045 | ariatemplates/hashspace | hsp/rt/cptcomponent.js | function() {
// determine if cpt supports template arguments
if (this.template) {
// as template can be changed dynamically we have to sync the constructor
this.ctlConstuctor=this.template.controllerConstructor;
}
var ctlProto=this.ctlConstuctor.prototype;
this.ctlAttributes=ctlProto.$at... | javascript | function() {
// determine if cpt supports template arguments
if (this.template) {
// as template can be changed dynamically we have to sync the constructor
this.ctlConstuctor=this.template.controllerConstructor;
}
var ctlProto=this.ctlConstuctor.prototype;
this.ctlAttributes=ctlProto.$at... | [
"function",
"(",
")",
"{",
"// determine if cpt supports template arguments",
"if",
"(",
"this",
".",
"template",
")",
"{",
"// as template can be changed dynamically we have to sync the constructor",
"this",
".",
"ctlConstuctor",
"=",
"this",
".",
"template",
".",
"control... | Process and retrieve the component arguments that are needed to init the component template | [
"Process",
"and",
"retrieve",
"the",
"component",
"arguments",
"that",
"are",
"needed",
"to",
"init",
"the",
"component",
"template"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptcomponent.js#L61-L110 | |
44,046 | ariatemplates/hashspace | hsp/rt/cptcomponent.js | function(localPropOnly) {
if (this.ctlWrapper) {
this.ctlWrapper.$dispose();
this.ctlWrapper=null;
this.controller=null;
}
this.ctlAttributes=null;
this.cleanObjectProperties(localPropOnly);
this.ctlConstuctor=null;
var tpa=this.tplAttributes;
if (tpa) {
for (var k in... | javascript | function(localPropOnly) {
if (this.ctlWrapper) {
this.ctlWrapper.$dispose();
this.ctlWrapper=null;
this.controller=null;
}
this.ctlAttributes=null;
this.cleanObjectProperties(localPropOnly);
this.ctlConstuctor=null;
var tpa=this.tplAttributes;
if (tpa) {
for (var k in... | [
"function",
"(",
"localPropOnly",
")",
"{",
"if",
"(",
"this",
".",
"ctlWrapper",
")",
"{",
"this",
".",
"ctlWrapper",
".",
"$dispose",
"(",
")",
";",
"this",
".",
"ctlWrapper",
"=",
"null",
";",
"this",
".",
"controller",
"=",
"null",
";",
"}",
"thi... | Safely cut all dependencies before object is deleted
@param {Boolean} localPropOnly if true only local properties will be deleted (optional)
must be used when a new instance is created to adapt to a path change | [
"Safely",
"cut",
"all",
"dependencies",
"before",
"object",
"is",
"deleted"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptcomponent.js#L140-L172 | |
44,047 | ariatemplates/hashspace | hsp/rt/cptcomponent.js | function () {
this.attEltNodes=null;
this._attGenerators=null;
// determine the possible template attribute names
var tpAttNames={}, ca=this.ctlAttributes, defaultTplAtt=null, lastTplAtt=null, count=0;
for (var k in ca) {
if (ca.hasOwnProperty(k) && ca[k].type==="template") {
// k is ... | javascript | function () {
this.attEltNodes=null;
this._attGenerators=null;
// determine the possible template attribute names
var tpAttNames={}, ca=this.ctlAttributes, defaultTplAtt=null, lastTplAtt=null, count=0;
for (var k in ca) {
if (ca.hasOwnProperty(k) && ca[k].type==="template") {
// k is ... | [
"function",
"(",
")",
"{",
"this",
".",
"attEltNodes",
"=",
"null",
";",
"this",
".",
"_attGenerators",
"=",
"null",
";",
"// determine the possible template attribute names",
"var",
"tpAttNames",
"=",
"{",
"}",
",",
"ca",
"=",
"this",
".",
"ctlAttributes",
",... | Load the component sub-nodes that correspond to template attributes | [
"Load",
"the",
"component",
"sub",
"-",
"nodes",
"that",
"correspond",
"to",
"template",
"attributes"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptcomponent.js#L177-L255 | |
44,048 | ariatemplates/hashspace | hsp/rt/cptcomponent.js | function (defaultTplAtt) {
if (!this.children) {
return;
}
// TODO memoize result at prototype level to avoid processing this multiple times
var ct=this.getCptContentType(), loadCpts=true;
if (ct==="ERROR") {
loadCpts=false;
log.error(this.info+" Component content cannot mix attr... | javascript | function (defaultTplAtt) {
if (!this.children) {
return;
}
// TODO memoize result at prototype level to avoid processing this multiple times
var ct=this.getCptContentType(), loadCpts=true;
if (ct==="ERROR") {
loadCpts=false;
log.error(this.info+" Component content cannot mix attr... | [
"function",
"(",
"defaultTplAtt",
")",
"{",
"if",
"(",
"!",
"this",
".",
"children",
")",
"{",
"return",
";",
"}",
"// TODO memoize result at prototype level to avoid processing this multiple times",
"var",
"ct",
"=",
"this",
".",
"getCptContentType",
"(",
")",
",",... | Check if a default attribute element has to be created and create one if necessary | [
"Check",
"if",
"a",
"default",
"attribute",
"element",
"has",
"to",
"be",
"created",
"and",
"create",
"one",
"if",
"necessary"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptcomponent.js#L260-L298 | |
44,049 | ariatemplates/hashspace | hsp/rt/cptcomponent.js | function() {
var aen=this.attEltNodes;
if (!aen) {
return null;
}
var attElts=[], cta=this.ctlAttributes;
for (var i=0,sz=aen.length; sz>i;i++) {
aen[i].registerAttElements(attElts);
}
// check that all elements are valid (i.e. have valid names)
var nm, elt, ok, elts=[], cte=... | javascript | function() {
var aen=this.attEltNodes;
if (!aen) {
return null;
}
var attElts=[], cta=this.ctlAttributes;
for (var i=0,sz=aen.length; sz>i;i++) {
aen[i].registerAttElements(attElts);
}
// check that all elements are valid (i.e. have valid names)
var nm, elt, ok, elts=[], cte=... | [
"function",
"(",
")",
"{",
"var",
"aen",
"=",
"this",
".",
"attEltNodes",
";",
"if",
"(",
"!",
"aen",
")",
"{",
"return",
"null",
";",
"}",
"var",
"attElts",
"=",
"[",
"]",
",",
"cta",
"=",
"this",
".",
"ctlAttributes",
";",
"for",
"(",
"var",
... | Retrieve all child attribute elements
and update the tplAttributes and childElements collections | [
"Retrieve",
"all",
"child",
"attribute",
"elements",
"and",
"update",
"the",
"tplAttributes",
"and",
"childElements",
"collections"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptcomponent.js#L304-L344 | |
44,050 | ariatemplates/hashspace | hsp/rt/cptcomponent.js | function() {
var ce=this.childElements;
if (!ce || !ce.length) {
return;
}
var cw;
for (var i=0,sz=ce.length;sz>i;i++) {
cw=ce[i].ctlWrapper;
if (cw && !cw.initialized) {
cw.init(null,this.controller);
}
}
} | javascript | function() {
var ce=this.childElements;
if (!ce || !ce.length) {
return;
}
var cw;
for (var i=0,sz=ce.length;sz>i;i++) {
cw=ce[i].ctlWrapper;
if (cw && !cw.initialized) {
cw.init(null,this.controller);
}
}
} | [
"function",
"(",
")",
"{",
"var",
"ce",
"=",
"this",
".",
"childElements",
";",
"if",
"(",
"!",
"ce",
"||",
"!",
"ce",
".",
"length",
")",
"{",
"return",
";",
"}",
"var",
"cw",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"sz",
"=",
"ce",
".... | Initializes the attribute elements of type component that have not been
already initialized | [
"Initializes",
"the",
"attribute",
"elements",
"of",
"type",
"component",
"that",
"have",
"not",
"been",
"already",
"initialized"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptcomponent.js#L350-L362 | |
44,051 | ariatemplates/hashspace | hsp/rt/cptcomponent.js | function (evt) {
var evh = this.evtHandlers, et = evt.type;
if (evh) {
for (var i = 0, sz = evh.length; sz > i; i++) {
if (evh[i].evtType === et) {
evh[i].executeCb(evt, this.eh, this.parent.vscope);
break;
}
}
}
} | javascript | function (evt) {
var evh = this.evtHandlers, et = evt.type;
if (evh) {
for (var i = 0, sz = evh.length; sz > i; i++) {
if (evh[i].evtType === et) {
evh[i].executeCb(evt, this.eh, this.parent.vscope);
break;
}
}
}
} | [
"function",
"(",
"evt",
")",
"{",
"var",
"evh",
"=",
"this",
".",
"evtHandlers",
",",
"et",
"=",
"evt",
".",
"type",
";",
"if",
"(",
"evh",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"sz",
"=",
"evh",
".",
"length",
";",
"sz",
">",
"i... | Callback called by the controller observer when the controller raises an event | [
"Callback",
"called",
"by",
"the",
"controller",
"observer",
"when",
"the",
"controller",
"raises",
"an",
"event"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptcomponent.js#L382-L392 | |
44,052 | ariatemplates/hashspace | hsp/rt/cptcomponent.js | function (prevNode, newNode) {
if (prevNode === newNode) {
return;
}
TNode.replaceNodeBy.call(this,prevNode, newNode);
var aen=this.attEltNodes;
if (aen) {
for (var i=0,sz=aen.length; sz>i;i++) {
aen[i].replaceNodeBy(prevNode, newNode);
}
}... | javascript | function (prevNode, newNode) {
if (prevNode === newNode) {
return;
}
TNode.replaceNodeBy.call(this,prevNode, newNode);
var aen=this.attEltNodes;
if (aen) {
for (var i=0,sz=aen.length; sz>i;i++) {
aen[i].replaceNodeBy(prevNode, newNode);
}
}... | [
"function",
"(",
"prevNode",
",",
"newNode",
")",
"{",
"if",
"(",
"prevNode",
"===",
"newNode",
")",
"{",
"return",
";",
"}",
"TNode",
".",
"replaceNodeBy",
".",
"call",
"(",
"this",
",",
"prevNode",
",",
"newNode",
")",
";",
"var",
"aen",
"=",
"this... | Recursively replace the DOM node by another node if it matches the preNode passed as argument | [
"Recursively",
"replace",
"the",
"DOM",
"node",
"by",
"another",
"node",
"if",
"it",
"matches",
"the",
"preNode",
"passed",
"as",
"argument"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptcomponent.js#L397-L408 | |
44,053 | ariatemplates/hashspace | hsp/rt/cptcomponent.js | function() {
var c=[], ce=this.childElements, celts=this.ctlElements, eltType;
if (ce && ce.length) {
for (var i=0, sz=ce.length;sz>i;i++) {
eltType=celts[ce[i].name].type;
if (eltType==="component") {
c.push(ce[i].controller);
} else if (eltType==="template") {
... | javascript | function() {
var c=[], ce=this.childElements, celts=this.ctlElements, eltType;
if (ce && ce.length) {
for (var i=0, sz=ce.length;sz>i;i++) {
eltType=celts[ce[i].name].type;
if (eltType==="component") {
c.push(ce[i].controller);
} else if (eltType==="template") {
... | [
"function",
"(",
")",
"{",
"var",
"c",
"=",
"[",
"]",
",",
"ce",
"=",
"this",
".",
"childElements",
",",
"celts",
"=",
"this",
".",
"ctlElements",
",",
"eltType",
";",
"if",
"(",
"ce",
"&&",
"ce",
".",
"length",
")",
"{",
"for",
"(",
"var",
"i"... | Calculate the content array that will be set on component's controller | [
"Calculate",
"the",
"content",
"array",
"that",
"will",
"be",
"set",
"on",
"component",
"s",
"controller"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptcomponent.js#L413-L428 | |
44,054 | ariatemplates/hashspace | hsp/rt/cptcomponent.js | function () {
if (this.edirty) {
var en=this.attEltNodes;
if (en) {
for (var i=0,sz=en.length; sz>i; i++) {
en[i].refresh();
}
// if content changed we have to rebuild childElements
this.retrieveAttElements();
... | javascript | function () {
if (this.edirty) {
var en=this.attEltNodes;
if (en) {
for (var i=0,sz=en.length; sz>i; i++) {
en[i].refresh();
}
// if content changed we have to rebuild childElements
this.retrieveAttElements();
... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"edirty",
")",
"{",
"var",
"en",
"=",
"this",
".",
"attEltNodes",
";",
"if",
"(",
"en",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"sz",
"=",
"en",
".",
"length",
";",
"sz",
">",
"i",... | Refresh the sub-template arguments and the child nodes, if needed | [
"Refresh",
"the",
"sub",
"-",
"template",
"arguments",
"and",
"the",
"child",
"nodes",
"if",
"needed"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt/cptcomponent.js#L433-L456 | |
44,055 | floridoo/scarab | lib/routing.js | getAction | function getAction(controllerName, actionName) {
controllerName = controllerName.camelize();
var controller = app.controllers[controllerName];
if (controller === undefined && app.models[controllerName])
controller = defaultController;
if (controller)
return controller[actionName || 'index'];
else
re... | javascript | function getAction(controllerName, actionName) {
controllerName = controllerName.camelize();
var controller = app.controllers[controllerName];
if (controller === undefined && app.models[controllerName])
controller = defaultController;
if (controller)
return controller[actionName || 'index'];
else
re... | [
"function",
"getAction",
"(",
"controllerName",
",",
"actionName",
")",
"{",
"controllerName",
"=",
"controllerName",
".",
"camelize",
"(",
")",
";",
"var",
"controller",
"=",
"app",
".",
"controllers",
"[",
"controllerName",
"]",
";",
"if",
"(",
"controller",... | Find the action function based on controller name and action name.
If no controller but a model is found, the default controller is taken.
@param {String} controllerName controller name
@param {String} actionName action name
@return {Function} action function | [
"Find",
"the",
"action",
"function",
"based",
"on",
"controller",
"name",
"and",
"action",
"name",
".",
"If",
"no",
"controller",
"but",
"a",
"model",
"is",
"found",
"the",
"default",
"controller",
"is",
"taken",
"."
] | 377ebd79563b8fa654bb18324aed00d72500e7f6 | https://github.com/floridoo/scarab/blob/377ebd79563b8fa654bb18324aed00d72500e7f6/lib/routing.js#L18-L28 |
44,056 | floridoo/scarab | lib/routing.js | addSingleRoute | function addSingleRoute(verb, routePath, controllerName, actionName) {
// add controller and action fields to the request
var reqExtender = function(req, res, next) {
req.controller = controllerName;
req.action = actionName || 'index';
next();
};
var params = [routePath, reqExtender];
params = param... | javascript | function addSingleRoute(verb, routePath, controllerName, actionName) {
// add controller and action fields to the request
var reqExtender = function(req, res, next) {
req.controller = controllerName;
req.action = actionName || 'index';
next();
};
var params = [routePath, reqExtender];
params = param... | [
"function",
"addSingleRoute",
"(",
"verb",
",",
"routePath",
",",
"controllerName",
",",
"actionName",
")",
"{",
"// add controller and action fields to the request",
"var",
"reqExtender",
"=",
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"req",
".",... | adds a single route
@param {String} verb HTTP verb
@param {String} routePath routing path
@param {String} controllerName controller name
@param {String} actionName action name | [
"adds",
"a",
"single",
"route"
] | 377ebd79563b8fa654bb18324aed00d72500e7f6 | https://github.com/floridoo/scarab/blob/377ebd79563b8fa654bb18324aed00d72500e7f6/lib/routing.js#L37-L50 |
44,057 | floridoo/scarab | lib/routing.js | function(req, res, next) {
req.controller = controllerName;
req.action = actionName || 'index';
next();
} | javascript | function(req, res, next) {
req.controller = controllerName;
req.action = actionName || 'index';
next();
} | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"req",
".",
"controller",
"=",
"controllerName",
";",
"req",
".",
"action",
"=",
"actionName",
"||",
"'index'",
";",
"next",
"(",
")",
";",
"}"
] | add controller and action fields to the request | [
"add",
"controller",
"and",
"action",
"fields",
"to",
"the",
"request"
] | 377ebd79563b8fa654bb18324aed00d72500e7f6 | https://github.com/floridoo/scarab/blob/377ebd79563b8fa654bb18324aed00d72500e7f6/lib/routing.js#L39-L43 | |
44,058 | floridoo/scarab | lib/routing.js | getPolicies | function getPolicies(controller, action) {
var policies = config.policies;
var currentPolicies = [];
if (policies[controller] && policies[controller][action]) {
currentPolicies = policies[controller][action];
} else if (Object.isString(policies[controller])) {
currentPolicies = policies[controller];
} e... | javascript | function getPolicies(controller, action) {
var policies = config.policies;
var currentPolicies = [];
if (policies[controller] && policies[controller][action]) {
currentPolicies = policies[controller][action];
} else if (Object.isString(policies[controller])) {
currentPolicies = policies[controller];
} e... | [
"function",
"getPolicies",
"(",
"controller",
",",
"action",
")",
"{",
"var",
"policies",
"=",
"config",
".",
"policies",
";",
"var",
"currentPolicies",
"=",
"[",
"]",
";",
"if",
"(",
"policies",
"[",
"controller",
"]",
"&&",
"policies",
"[",
"controller",... | gets the policies in effect for a given controller and action
@param {String} controller
@param {String} action
@return {Array} policies | [
"gets",
"the",
"policies",
"in",
"effect",
"for",
"a",
"given",
"controller",
"and",
"action"
] | 377ebd79563b8fa654bb18324aed00d72500e7f6 | https://github.com/floridoo/scarab/blob/377ebd79563b8fa654bb18324aed00d72500e7f6/lib/routing.js#L58-L84 |
44,059 | floridoo/scarab | lib/routing.js | addResourceRoute | function addResourceRoute(routePath, controllerName) {
resourceRouting.forEach(function(route) {
var actionPath = route.path.replace(':controller', controllerName);
route.verbs.forEach(function (verb) {
addSingleRoute(verb, actionPath, controllerName, route.target.action);
});
});
} | javascript | function addResourceRoute(routePath, controllerName) {
resourceRouting.forEach(function(route) {
var actionPath = route.path.replace(':controller', controllerName);
route.verbs.forEach(function (verb) {
addSingleRoute(verb, actionPath, controllerName, route.target.action);
});
});
} | [
"function",
"addResourceRoute",
"(",
"routePath",
",",
"controllerName",
")",
"{",
"resourceRouting",
".",
"forEach",
"(",
"function",
"(",
"route",
")",
"{",
"var",
"actionPath",
"=",
"route",
".",
"path",
".",
"replace",
"(",
"':controller'",
",",
"controlle... | add a resource route
@param {String} routePath route path
@param {String} controllerName controller name | [
"add",
"a",
"resource",
"route"
] | 377ebd79563b8fa654bb18324aed00d72500e7f6 | https://github.com/floridoo/scarab/blob/377ebd79563b8fa654bb18324aed00d72500e7f6/lib/routing.js#L108-L115 |
44,060 | floridoo/scarab | lib/routing.js | addStaticRoute | function addStaticRoute(routePath, targets) {
if (!Object.isArray(targets)) {
targets = [targets];
}
targets.forEach(function(target) {
if (target)
app.use(routePath, app.middleware.static(path.resolve(config.rootDir, target)));
});
} | javascript | function addStaticRoute(routePath, targets) {
if (!Object.isArray(targets)) {
targets = [targets];
}
targets.forEach(function(target) {
if (target)
app.use(routePath, app.middleware.static(path.resolve(config.rootDir, target)));
});
} | [
"function",
"addStaticRoute",
"(",
"routePath",
",",
"targets",
")",
"{",
"if",
"(",
"!",
"Object",
".",
"isArray",
"(",
"targets",
")",
")",
"{",
"targets",
"=",
"[",
"targets",
"]",
";",
"}",
"targets",
".",
"forEach",
"(",
"function",
"(",
"target",... | add a static route
@param {String} routePath route path
@param {String} target target path (relative to the scarab root) | [
"add",
"a",
"static",
"route"
] | 377ebd79563b8fa654bb18324aed00d72500e7f6 | https://github.com/floridoo/scarab/blob/377ebd79563b8fa654bb18324aed00d72500e7f6/lib/routing.js#L122-L130 |
44,061 | floridoo/scarab | lib/routing.js | parseRoute | function parseRoute(route, target) {
var verbs, routePath, routeParts;
routeParts = route.split(' ');
if (routeParts.length === 1) {
verbs = ['all'];
routePath = routeParts[0];
} else {
verbs = routeParts[0].split(',');
verbs.map(function (verb) {
return verb.trim().toLowerCase();
});
rou... | javascript | function parseRoute(route, target) {
var verbs, routePath, routeParts;
routeParts = route.split(' ');
if (routeParts.length === 1) {
verbs = ['all'];
routePath = routeParts[0];
} else {
verbs = routeParts[0].split(',');
verbs.map(function (verb) {
return verb.trim().toLowerCase();
});
rou... | [
"function",
"parseRoute",
"(",
"route",
",",
"target",
")",
"{",
"var",
"verbs",
",",
"routePath",
",",
"routeParts",
";",
"routeParts",
"=",
"route",
".",
"split",
"(",
"' '",
")",
";",
"if",
"(",
"routeParts",
".",
"length",
"===",
"1",
")",
"{",
"... | parse a route
@param {String} route a route definition
@param {Object} target target definition
@return {Object} route parsed into verbs, path and target | [
"parse",
"a",
"route"
] | 377ebd79563b8fa654bb18324aed00d72500e7f6 | https://github.com/floridoo/scarab/blob/377ebd79563b8fa654bb18324aed00d72500e7f6/lib/routing.js#L169-L184 |
44,062 | vega/vega-runtime | src/parameters.js | parseParameter | function parseParameter(spec, ctx, params) {
if (!spec || !isObject(spec)) return spec;
for (var i=0, n=PARSERS.length, p; i<n; ++i) {
p = PARSERS[i];
if (spec.hasOwnProperty(p.key)) {
return p.parse(spec, ctx, params);
}
}
return spec;
} | javascript | function parseParameter(spec, ctx, params) {
if (!spec || !isObject(spec)) return spec;
for (var i=0, n=PARSERS.length, p; i<n; ++i) {
p = PARSERS[i];
if (spec.hasOwnProperty(p.key)) {
return p.parse(spec, ctx, params);
}
}
return spec;
} | [
"function",
"parseParameter",
"(",
"spec",
",",
"ctx",
",",
"params",
")",
"{",
"if",
"(",
"!",
"spec",
"||",
"!",
"isObject",
"(",
"spec",
")",
")",
"return",
"spec",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"n",
"=",
"PARSERS",
".",
"length"... | Parse a single parameter. | [
"Parse",
"a",
"single",
"parameter",
"."
] | 05491b95035b70d5bafb05c5eebef9fa0c06c509 | https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L26-L36 |
44,063 | vega/vega-runtime | src/parameters.js | getExpression | function getExpression(_, ctx, params) {
if (_.$params) { // parse expression parameters
parseParameters(_.$params, ctx, params);
}
var k = 'e:' + _.$expr + '_' + _.$name;
return ctx.fn[k]
|| (ctx.fn[k] = accessor(parameterExpression(_.$expr, ctx), _.$fields, _.$name));
} | javascript | function getExpression(_, ctx, params) {
if (_.$params) { // parse expression parameters
parseParameters(_.$params, ctx, params);
}
var k = 'e:' + _.$expr + '_' + _.$name;
return ctx.fn[k]
|| (ctx.fn[k] = accessor(parameterExpression(_.$expr, ctx), _.$fields, _.$name));
} | [
"function",
"getExpression",
"(",
"_",
",",
"ctx",
",",
"params",
")",
"{",
"if",
"(",
"_",
".",
"$params",
")",
"{",
"// parse expression parameters",
"parseParameters",
"(",
"_",
".",
"$params",
",",
"ctx",
",",
"params",
")",
";",
"}",
"var",
"k",
"... | Resolve an expression reference. | [
"Resolve",
"an",
"expression",
"reference",
"."
] | 05491b95035b70d5bafb05c5eebef9fa0c06c509 | https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L61-L68 |
44,064 | vega/vega-runtime | src/parameters.js | getKey | function getKey(_, ctx) {
var k = 'k:' + _.$key + '_' + (!!_.$flat);
return ctx.fn[k] || (ctx.fn[k] = key(_.$key, _.$flat));
} | javascript | function getKey(_, ctx) {
var k = 'k:' + _.$key + '_' + (!!_.$flat);
return ctx.fn[k] || (ctx.fn[k] = key(_.$key, _.$flat));
} | [
"function",
"getKey",
"(",
"_",
",",
"ctx",
")",
"{",
"var",
"k",
"=",
"'k:'",
"+",
"_",
".",
"$key",
"+",
"'_'",
"+",
"(",
"!",
"!",
"_",
".",
"$flat",
")",
";",
"return",
"ctx",
".",
"fn",
"[",
"k",
"]",
"||",
"(",
"ctx",
".",
"fn",
"["... | Resolve a key accessor reference. | [
"Resolve",
"a",
"key",
"accessor",
"reference",
"."
] | 05491b95035b70d5bafb05c5eebef9fa0c06c509 | https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L73-L76 |
44,065 | vega/vega-runtime | src/parameters.js | getField | function getField(_, ctx) {
if (!_.$field) return null;
var k = 'f:' + _.$field + '_' + _.$name;
return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name));
} | javascript | function getField(_, ctx) {
if (!_.$field) return null;
var k = 'f:' + _.$field + '_' + _.$name;
return ctx.fn[k] || (ctx.fn[k] = field(_.$field, _.$name));
} | [
"function",
"getField",
"(",
"_",
",",
"ctx",
")",
"{",
"if",
"(",
"!",
"_",
".",
"$field",
")",
"return",
"null",
";",
"var",
"k",
"=",
"'f:'",
"+",
"_",
".",
"$field",
"+",
"'_'",
"+",
"_",
".",
"$name",
";",
"return",
"ctx",
".",
"fn",
"["... | Resolve a field accessor reference. | [
"Resolve",
"a",
"field",
"accessor",
"reference",
"."
] | 05491b95035b70d5bafb05c5eebef9fa0c06c509 | https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L81-L85 |
44,066 | vega/vega-runtime | src/parameters.js | getCompare | function getCompare(_, ctx) {
var k = 'c:' + _.$compare + '_' + _.$order,
c = array(_.$compare).map(function(_) {
return (_ && _.$tupleid) ? tupleid : _;
});
return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order));
} | javascript | function getCompare(_, ctx) {
var k = 'c:' + _.$compare + '_' + _.$order,
c = array(_.$compare).map(function(_) {
return (_ && _.$tupleid) ? tupleid : _;
});
return ctx.fn[k] || (ctx.fn[k] = compare(c, _.$order));
} | [
"function",
"getCompare",
"(",
"_",
",",
"ctx",
")",
"{",
"var",
"k",
"=",
"'c:'",
"+",
"_",
".",
"$compare",
"+",
"'_'",
"+",
"_",
".",
"$order",
",",
"c",
"=",
"array",
"(",
"_",
".",
"$compare",
")",
".",
"map",
"(",
"function",
"(",
"_",
... | Resolve a comparator function reference. | [
"Resolve",
"a",
"comparator",
"function",
"reference",
"."
] | 05491b95035b70d5bafb05c5eebef9fa0c06c509 | https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L90-L96 |
44,067 | vega/vega-runtime | src/parameters.js | getEncode | function getEncode(_, ctx) {
var spec = _.$encode,
encode = {}, name, enc;
for (name in spec) {
enc = spec[name];
encode[name] = accessor(encodeExpression(enc.$expr, ctx), enc.$fields);
encode[name].output = enc.$output;
}
return encode;
} | javascript | function getEncode(_, ctx) {
var spec = _.$encode,
encode = {}, name, enc;
for (name in spec) {
enc = spec[name];
encode[name] = accessor(encodeExpression(enc.$expr, ctx), enc.$fields);
encode[name].output = enc.$output;
}
return encode;
} | [
"function",
"getEncode",
"(",
"_",
",",
"ctx",
")",
"{",
"var",
"spec",
"=",
"_",
".",
"$encode",
",",
"encode",
"=",
"{",
"}",
",",
"name",
",",
"enc",
";",
"for",
"(",
"name",
"in",
"spec",
")",
"{",
"enc",
"=",
"spec",
"[",
"name",
"]",
";... | Resolve an encode operator reference. | [
"Resolve",
"an",
"encode",
"operator",
"reference",
"."
] | 05491b95035b70d5bafb05c5eebef9fa0c06c509 | https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L101-L111 |
44,068 | vega/vega-runtime | src/parameters.js | getSubflow | function getSubflow(_, ctx) {
var spec = _.$subflow;
return function(dataflow, key, parent) {
var subctx = parseDataflow(spec, ctx.fork()),
op = subctx.get(spec.operators[0].id),
p = subctx.signals.parent;
if (p) p.set(parent);
return op;
};
} | javascript | function getSubflow(_, ctx) {
var spec = _.$subflow;
return function(dataflow, key, parent) {
var subctx = parseDataflow(spec, ctx.fork()),
op = subctx.get(spec.operators[0].id),
p = subctx.signals.parent;
if (p) p.set(parent);
return op;
};
} | [
"function",
"getSubflow",
"(",
"_",
",",
"ctx",
")",
"{",
"var",
"spec",
"=",
"_",
".",
"$subflow",
";",
"return",
"function",
"(",
"dataflow",
",",
"key",
",",
"parent",
")",
"{",
"var",
"subctx",
"=",
"parseDataflow",
"(",
"spec",
",",
"ctx",
".",
... | Resolve a recursive subflow specification. | [
"Resolve",
"a",
"recursive",
"subflow",
"specification",
"."
] | 05491b95035b70d5bafb05c5eebef9fa0c06c509 | https://github.com/vega/vega-runtime/blob/05491b95035b70d5bafb05c5eebef9fa0c06c509/src/parameters.js#L123-L132 |
44,069 | vutran/hot-reload-server | lib/index.js | start | function start() {
// Listen to the port
app.listen(hrsConfigs.port, function (err) {
if (err) {
info(err);
}
info('Running on http://%s:%s', hrsConfigs.address, hrsConfigs.port);
});
} | javascript | function start() {
// Listen to the port
app.listen(hrsConfigs.port, function (err) {
if (err) {
info(err);
}
info('Running on http://%s:%s', hrsConfigs.address, hrsConfigs.port);
});
} | [
"function",
"start",
"(",
")",
"{",
"// Listen to the port",
"app",
".",
"listen",
"(",
"hrsConfigs",
".",
"port",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"info",
"(",
"err",
")",
";",
"}",
"info",
"(",
"'Running on http://%s... | Starts the hot-reload-server | [
"Starts",
"the",
"hot",
"-",
"reload",
"-",
"server"
] | c02a838350b8f98975900c4a0486d39cb3b13ce4 | https://github.com/vutran/hot-reload-server/blob/c02a838350b8f98975900c4a0486d39cb3b13ce4/lib/index.js#L35-L43 |
44,070 | franck34/qjobs | examples/simple.js | function(args,next) {
// do nothing now but in 1 sec
setTimeout(function() {
// if i'm job id 10 or 20, let's add
// another job dynamicaly in the queue.
// It can be usefull for network operation (retry on timeout)
if (args._jobId==10||args._jobId==20) {
myQueueJ... | javascript | function(args,next) {
// do nothing now but in 1 sec
setTimeout(function() {
// if i'm job id 10 or 20, let's add
// another job dynamicaly in the queue.
// It can be usefull for network operation (retry on timeout)
if (args._jobId==10||args._jobId==20) {
myQueueJ... | [
"function",
"(",
"args",
",",
"next",
")",
"{",
"// do nothing now but in 1 sec",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"// if i'm job id 10 or 20, let's add",
"// another job dynamicaly in the queue.",
"// It can be usefull for network operation (retry on timeout)",
"if",
... | My non blocking main job | [
"My",
"non",
"blocking",
"main",
"job"
] | e065459d6cbfcadaa20c0aadc1d0a6c836b39aa1 | https://github.com/franck34/qjobs/blob/e065459d6cbfcadaa20c0aadc1d0a6c836b39aa1/examples/simple.js#L3-L18 | |
44,071 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | isVoidElement | function isVoidElement(elName) {
var result = false;
if (elName && elName.toLowerCase) {
result = VOID_HTML_ELEMENTS.hasOwnProperty(elName.toLowerCase());
}
return result;
} | javascript | function isVoidElement(elName) {
var result = false;
if (elName && elName.toLowerCase) {
result = VOID_HTML_ELEMENTS.hasOwnProperty(elName.toLowerCase());
}
return result;
} | [
"function",
"isVoidElement",
"(",
"elName",
")",
"{",
"var",
"result",
"=",
"false",
";",
"if",
"(",
"elName",
"&&",
"elName",
".",
"toLowerCase",
")",
"{",
"result",
"=",
"VOID_HTML_ELEMENTS",
".",
"hasOwnProperty",
"(",
"elName",
".",
"toLowerCase",
"(",
... | Checks if an element is a void one.
@param {String} the element name.
@return {Boolean} true if the element is a void one. | [
"Checks",
"if",
"an",
"element",
"is",
"a",
"void",
"one",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L30-L36 |
44,072 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (blockList) {
this.errors = [];
this.tree = new Node("file", null);
this.tree.content = [];
this._advance(blockList, 0, this.tree.content);
this._postProcessTree();
} | javascript | function (blockList) {
this.errors = [];
this.tree = new Node("file", null);
this.tree.content = [];
this._advance(blockList, 0, this.tree.content);
this._postProcessTree();
} | [
"function",
"(",
"blockList",
")",
"{",
"this",
".",
"errors",
"=",
"[",
"]",
";",
"this",
".",
"tree",
"=",
"new",
"Node",
"(",
"\"file\"",
",",
"null",
")",
";",
"this",
".",
"tree",
".",
"content",
"=",
"[",
"]",
";",
"this",
".",
"_advance",
... | Generate the syntax tree from the root block list.
@param {Object} blockList the block list. | [
"Generate",
"the",
"syntax",
"tree",
"from",
"the",
"root",
"block",
"list",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L69-L77 | |
44,073 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (description, errdesc) {
//TODO: errdesc is a bit vague
var desc = {
description : description
};
if (errdesc) {
if (errdesc.line) { // Integers
desc.line = errdesc.line;
desc.column = errdesc.column;
}
... | javascript | function (description, errdesc) {
//TODO: errdesc is a bit vague
var desc = {
description : description
};
if (errdesc) {
if (errdesc.line) { // Integers
desc.line = errdesc.line;
desc.column = errdesc.column;
}
... | [
"function",
"(",
"description",
",",
"errdesc",
")",
"{",
"//TODO: errdesc is a bit vague",
"var",
"desc",
"=",
"{",
"description",
":",
"description",
"}",
";",
"if",
"(",
"errdesc",
")",
"{",
"if",
"(",
"errdesc",
".",
"line",
")",
"{",
"// Integers",
"d... | Adds an error to the current error list.
@param {String} description the error description
@param {Object} errdesc additional object (block, node, ...) which can contain additional info about the error (line/column number, code). | [
"Adds",
"an",
"error",
"to",
"the",
"current",
"error",
"list",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L84-L103 | |
44,074 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function(expAst, attribute) {
//verify that an event handler is a function call
if (expAst && isEventHandlerAttr(attribute.name) && expAst.v !== '(') {
this._logError("Event handler attribute only support function expressions", attribute.value[0]);
}
} | javascript | function(expAst, attribute) {
//verify that an event handler is a function call
if (expAst && isEventHandlerAttr(attribute.name) && expAst.v !== '(') {
this._logError("Event handler attribute only support function expressions", attribute.value[0]);
}
} | [
"function",
"(",
"expAst",
",",
"attribute",
")",
"{",
"//verify that an event handler is a function call",
"if",
"(",
"expAst",
"&&",
"isEventHandlerAttr",
"(",
"attribute",
".",
"name",
")",
"&&",
"expAst",
".",
"v",
"!==",
"'('",
")",
"{",
"this",
".",
"_lo... | Logs an error if the value of an event handler attribute is not a function expression. | [
"Logs",
"an",
"error",
"if",
"the",
"value",
"of",
"an",
"event",
"handler",
"attribute",
"is",
"not",
"a",
"function",
"expression",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L123-L128 | |
44,075 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (blocks, startIndex, out, optEndFn) {
var block, type;
if (blocks) {
for (var i = startIndex; i < blocks.length; i++) {
block = blocks[i];
type = block.type;
if (optEndFn && optEndFn(type, block.name)) {
// we stop... | javascript | function (blocks, startIndex, out, optEndFn) {
var block, type;
if (blocks) {
for (var i = startIndex; i < blocks.length; i++) {
block = blocks[i];
type = block.type;
if (optEndFn && optEndFn(type, block.name)) {
// we stop... | [
"function",
"(",
"blocks",
",",
"startIndex",
",",
"out",
",",
"optEndFn",
")",
"{",
"var",
"block",
",",
"type",
";",
"if",
"(",
"blocks",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"startIndex",
";",
"i",
"<",
"blocks",
".",
"length",
";",
"i",
"++... | Process a list of blocks and advance the cursor index that scans the collection.
@param {Array} blocks the full list of blocks.
@param {Integer} startIndex the index from which the process has to start.
@param {Array} out the output as an array of Node.
@param {Function} optEndFn an optional end function that takes a n... | [
"Process",
"a",
"list",
"of",
"blocks",
"and",
"advance",
"the",
"cursor",
"index",
"that",
"scans",
"the",
"collection",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L138-L158 | |
44,076 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function() {
var nodes = this.tree.content;
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].type === "template") {
this._processNodeContent(nodes[i].content,nodes[i]);
}
}
} | javascript | function() {
var nodes = this.tree.content;
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].type === "template") {
this._processNodeContent(nodes[i].content,nodes[i]);
}
}
} | [
"function",
"(",
")",
"{",
"var",
"nodes",
"=",
"this",
".",
"tree",
".",
"content",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"nodes",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"nodes",
"[",
"i",
"]",
".",
"type",
"==... | Post validation once the tree is properly parsed. | [
"Post",
"validation",
"once",
"the",
"tree",
"is",
"properly",
"parsed",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L163-L170 | |
44,077 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function(nodeList, parent) {
// Ensure that {let} nodes are always at the beginning of a containter element
var node, contentFound = false; // true when a node different from let is found
for (var i = 0; i < nodeList.length; i++) {
node = nodeList[i];
//console.log(i+":"+... | javascript | function(nodeList, parent) {
// Ensure that {let} nodes are always at the beginning of a containter element
var node, contentFound = false; // true when a node different from let is found
for (var i = 0; i < nodeList.length; i++) {
node = nodeList[i];
//console.log(i+":"+... | [
"function",
"(",
"nodeList",
",",
"parent",
")",
"{",
"// Ensure that {let} nodes are always at the beginning of a containter element",
"var",
"node",
",",
"contentFound",
"=",
"false",
";",
"// true when a node different from let is found",
"for",
"(",
"var",
"i",
"=",
"0"... | Validates the content of a container node.
@param {Array} nodeList the content of a container node
@param {Node} parent the parent node | [
"Validates",
"the",
"content",
"of",
"a",
"container",
"node",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L177-L212 | |
44,078 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (index, blocks, out) {
var node = new Node("template");
var block = blocks[index];
var validationResults = this._processTemplateStart(block.attributes, block.closingBrace);
if (validationResults.errors.length > 0) {
this._logError("Invalid template declaration", {
... | javascript | function (index, blocks, out) {
var node = new Node("template");
var block = blocks[index];
var validationResults = this._processTemplateStart(block.attributes, block.closingBrace);
if (validationResults.errors.length > 0) {
this._logError("Invalid template declaration", {
... | [
"function",
"(",
"index",
",",
"blocks",
",",
"out",
")",
"{",
"var",
"node",
"=",
"new",
"Node",
"(",
"\"template\"",
")",
";",
"var",
"block",
"=",
"blocks",
"[",
"index",
"]",
";",
"var",
"validationResults",
"=",
"this",
".",
"_processTemplateStart",... | Manages a template block.
@param {Array} blocks the full list of blocks.
@param {Integer} index the index of the block to manage.
@param {Array} out the output as an array of Node.
@return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled. | [
"Manages",
"a",
"template",
"block",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L363-L404 | |
44,079 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (index, blocks, out) {
var node = new Node("plaintext"), block = blocks[index];
node.value = block.value;
out.push(node);
return index;
} | javascript | function (index, blocks, out) {
var node = new Node("plaintext"), block = blocks[index];
node.value = block.value;
out.push(node);
return index;
} | [
"function",
"(",
"index",
",",
"blocks",
",",
"out",
")",
"{",
"var",
"node",
"=",
"new",
"Node",
"(",
"\"plaintext\"",
")",
",",
"block",
"=",
"blocks",
"[",
"index",
"]",
";",
"node",
".",
"value",
"=",
"block",
".",
"value",
";",
"out",
".",
"... | Manages a text block.
@param {Array} blocks the full list of blocks.
@param {Integer} index the index of the block to manage.
@param {Array} out the output as an array of Node.
@return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled. | [
"Manages",
"a",
"text",
"block",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L413-L418 | |
44,080 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (index, blocks, out) {
var node = new Node("log"), block = blocks[index];
node.line = block.line;
node.column = block.column;
node.exprs = block.exprs;
out.push(node);
return index;
} | javascript | function (index, blocks, out) {
var node = new Node("log"), block = blocks[index];
node.line = block.line;
node.column = block.column;
node.exprs = block.exprs;
out.push(node);
return index;
} | [
"function",
"(",
"index",
",",
"blocks",
",",
"out",
")",
"{",
"var",
"node",
"=",
"new",
"Node",
"(",
"\"log\"",
")",
",",
"block",
"=",
"blocks",
"[",
"index",
"]",
";",
"node",
".",
"line",
"=",
"block",
".",
"line",
";",
"node",
".",
"column"... | Manages a log statement.
@param {Array} blocks the full list of blocks.
@param {Integer} index the index of the block to manage.
@param {Array} out the output as an array of Node.
@return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled. | [
"Manages",
"a",
"log",
"statement",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L443-L450 | |
44,081 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (index, blocks, out) {
//creates the if node
var node = new Node("if"), block = blocks[index], lastValidIndex = index;
node.condition = {
"category": block.condition.category,
"value": block.condition.value,
"line": block.condition.line,
"... | javascript | function (index, blocks, out) {
//creates the if node
var node = new Node("if"), block = blocks[index], lastValidIndex = index;
node.condition = {
"category": block.condition.category,
"value": block.condition.value,
"line": block.condition.line,
"... | [
"function",
"(",
"index",
",",
"blocks",
",",
"out",
")",
"{",
"//creates the if node",
"var",
"node",
"=",
"new",
"Node",
"(",
"\"if\"",
")",
",",
"block",
"=",
"blocks",
"[",
"index",
"]",
",",
"lastValidIndex",
"=",
"index",
";",
"node",
".",
"condi... | Manages an if block.
@param {Array} blocks the full list of blocks.
@param {Integer} index the index of the block to manage.
@param {Array} out the output as an array of Node.
@return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled. | [
"Manages",
"an",
"if",
"block",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L562-L606 | |
44,082 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (index, blocks, out) {
//creates the foreach node
var node = new Node("foreach"), block = blocks[index];
node.item = block.item;
node.key = block.key;
node.collection = block.colref;
node.content = [];
out.push(node);
//fills node.content with t... | javascript | function (index, blocks, out) {
//creates the foreach node
var node = new Node("foreach"), block = blocks[index];
node.item = block.item;
node.key = block.key;
node.collection = block.colref;
node.content = [];
out.push(node);
//fills node.content with t... | [
"function",
"(",
"index",
",",
"blocks",
",",
"out",
")",
"{",
"//creates the foreach node",
"var",
"node",
"=",
"new",
"Node",
"(",
"\"foreach\"",
")",
",",
"block",
"=",
"blocks",
"[",
"index",
"]",
";",
"node",
".",
"item",
"=",
"block",
".",
"item"... | Manages a foreach block.
@param {Array} blocks the full list of blocks.
@param {Integer} index the index of the block to manage.
@param {Array} out the output as an array of Node.
@return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled. | [
"Manages",
"a",
"foreach",
"block",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L666-L683 | |
44,083 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (index, blocks, out) {
var block = blocks[index];
if (isVoidElement(block.name)) {
block.closed=true;
}
return this._elementOrComponent("element", index, blocks, out);
} | javascript | function (index, blocks, out) {
var block = blocks[index];
if (isVoidElement(block.name)) {
block.closed=true;
}
return this._elementOrComponent("element", index, blocks, out);
} | [
"function",
"(",
"index",
",",
"blocks",
",",
"out",
")",
"{",
"var",
"block",
"=",
"blocks",
"[",
"index",
"]",
";",
"if",
"(",
"isVoidElement",
"(",
"block",
".",
"name",
")",
")",
"{",
"block",
".",
"closed",
"=",
"true",
";",
"}",
"return",
"... | Manages an element block.
@param {Array} blocks the full list of blocks.
@param {Integer} index the index of the block to manage.
@param {Array} out the output as an array of Node.
@return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled. | [
"Manages",
"an",
"element",
"block",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L715-L721 | |
44,084 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (blockType, index, blocks, out) {
var node = new Node(blockType), block = blocks[index], blockValue, expAst;
node.name = block.name;
node.closed = block.closed;
if (block.ref) {
// only for components
node.ref = block.ref;
}
// Handle att... | javascript | function (blockType, index, blocks, out) {
var node = new Node(blockType), block = blocks[index], blockValue, expAst;
node.name = block.name;
node.closed = block.closed;
if (block.ref) {
// only for components
node.ref = block.ref;
}
// Handle att... | [
"function",
"(",
"blockType",
",",
"index",
",",
"blocks",
",",
"out",
")",
"{",
"var",
"node",
"=",
"new",
"Node",
"(",
"blockType",
")",
",",
"block",
"=",
"blocks",
"[",
"index",
"]",
",",
"blockValue",
",",
"expAst",
";",
"node",
".",
"name",
"... | Processing function for elements, components and component attributes
@arg blockType {String} "element", "component" or "cptattribute".
@param {Array} blocks the full list of blocks.
@param {Integer} index the index of the block to manage.
@param {Array} out the output as an array of Node.
@return {Integer} the index o... | [
"Processing",
"function",
"for",
"elements",
"components",
"and",
"component",
"attributes"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L753-L912 | |
44,085 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function(ref) {
if (ref.category !== "objectref" || !ref.path || !ref.path.length || !ref.path.join) {
return null;
}
return ref.path.join(".");
} | javascript | function(ref) {
if (ref.category !== "objectref" || !ref.path || !ref.path.length || !ref.path.join) {
return null;
}
return ref.path.join(".");
} | [
"function",
"(",
"ref",
")",
"{",
"if",
"(",
"ref",
".",
"category",
"!==",
"\"objectref\"",
"||",
"!",
"ref",
".",
"path",
"||",
"!",
"ref",
".",
"path",
".",
"length",
"||",
"!",
"ref",
".",
"path",
".",
"join",
")",
"{",
"return",
"null",
";",... | Transform a component path into a string - useful for error checking
If path is invalid null is returned
@param {Object} ref the ref structure returned by the PEG parser for components and endcomponents
@retrun {String} the path as a string | [
"Transform",
"a",
"component",
"path",
"into",
"a",
"string",
"-",
"useful",
"for",
"error",
"checking",
"If",
"path",
"is",
"invalid",
"null",
"is",
"returned"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L920-L925 | |
44,086 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (index, blocks, out) {
// only called in case of error
var block = blocks[index];
var msg = "Invalid HTML element syntax";
if (block.code && block.code.match(/^<\/?@/)) {
//when it starts with <@ or </@
msg = "Invalid component attribute syntax";
... | javascript | function (index, blocks, out) {
// only called in case of error
var block = blocks[index];
var msg = "Invalid HTML element syntax";
if (block.code && block.code.match(/^<\/?@/)) {
//when it starts with <@ or </@
msg = "Invalid component attribute syntax";
... | [
"function",
"(",
"index",
",",
"blocks",
",",
"out",
")",
"{",
"// only called in case of error",
"var",
"block",
"=",
"blocks",
"[",
"index",
"]",
";",
"var",
"msg",
"=",
"\"Invalid HTML element syntax\"",
";",
"if",
"(",
"block",
".",
"code",
"&&",
"block"... | Catches invalid element errors.
@param {Array} blocks the full list of blocks.
@param {Integer} index the index of the block to manage.
@param {Array} out the output as an array of Node.
@return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled. | [
"Catches",
"invalid",
"element",
"errors",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L934-L944 | |
44,087 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (index, blocks, out) {
// only called in case of error, i.e not digested by _elementOrComponent
var block = blocks[index], name = block.name;
if (isVoidElement(name)) {
this._logError("The end element </" + name + "> was rejected as <" + name + "> is a void HTML element and ca... | javascript | function (index, blocks, out) {
// only called in case of error, i.e not digested by _elementOrComponent
var block = blocks[index], name = block.name;
if (isVoidElement(name)) {
this._logError("The end element </" + name + "> was rejected as <" + name + "> is a void HTML element and ca... | [
"function",
"(",
"index",
",",
"blocks",
",",
"out",
")",
"{",
"// only called in case of error, i.e not digested by _elementOrComponent",
"var",
"block",
"=",
"blocks",
"[",
"index",
"]",
",",
"name",
"=",
"block",
".",
"name",
";",
"if",
"(",
"isVoidElement",
... | Captures isolated end elements to raise an error.
@param {Array} blocks the full list of blocks.
@param {Integer} index the index of the block to manage.
@param {Array} out the output as an array of Node.
@return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled. | [
"Captures",
"isolated",
"end",
"elements",
"to",
"raise",
"an",
"error",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L964-L973 | |
44,088 | ariatemplates/hashspace | hsp/compiler/treebuilder/syntaxTree.js | function (index, blocks, out) {
// only called in case of error, i.e not digested by _elementOrComponent
var block = blocks[index], path = this._getComponentPathAsString(block.ref) ;
this._logError("End component </#" + path + "> does not match any <#" + path + "> component", block);
ret... | javascript | function (index, blocks, out) {
// only called in case of error, i.e not digested by _elementOrComponent
var block = blocks[index], path = this._getComponentPathAsString(block.ref) ;
this._logError("End component </#" + path + "> does not match any <#" + path + "> component", block);
ret... | [
"function",
"(",
"index",
",",
"blocks",
",",
"out",
")",
"{",
"// only called in case of error, i.e not digested by _elementOrComponent",
"var",
"block",
"=",
"blocks",
"[",
"index",
"]",
",",
"path",
"=",
"this",
".",
"_getComponentPathAsString",
"(",
"block",
"."... | Captures isolated end components to raise an error.
@param {Array} blocks the full list of blocks.
@param {Integer} index the index of the block to manage.
@param {Array} out the output as an array of Node.
@return {Integer} the index of the block where the function stopped or -1 if all blocks have been handled. | [
"Captures",
"isolated",
"end",
"components",
"to",
"raise",
"an",
"error",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/treebuilder/syntaxTree.js#L982-L987 | |
44,089 | mbouclas/loopback-connector-mailgun | lib/mailgun.js | Connector | function Connector(settings) {
this.mailgun = Mailgun({apiKey: settings.apikey, domain: settings.domain});
} | javascript | function Connector(settings) {
this.mailgun = Mailgun({apiKey: settings.apikey, domain: settings.domain});
} | [
"function",
"Connector",
"(",
"settings",
")",
"{",
"this",
".",
"mailgun",
"=",
"Mailgun",
"(",
"{",
"apiKey",
":",
"settings",
".",
"apikey",
",",
"domain",
":",
"settings",
".",
"domain",
"}",
")",
";",
"}"
] | Configure and create an instance of the connector | [
"Configure",
"and",
"create",
"an",
"instance",
"of",
"the",
"connector"
] | 9ab78b861da4f568a6b2be1af7f27e3ad11e006d | https://github.com/mbouclas/loopback-connector-mailgun/blob/9ab78b861da4f568a6b2be1af7f27e3ad11e006d/lib/mailgun.js#L15-L17 |
44,090 | ariatemplates/hashspace | hsp/json.js | callObservers | function callObservers(object, chgeset) {
var ln = object[OBSERVER_PROPERTY];
if (ln) {
var elt;
for (var i = 0, sz = ln.length; sz > i; i++) {
elt = ln[i];
if (elt.constructor === Function) {
elt(chgeset);
}
}
}
} | javascript | function callObservers(object, chgeset) {
var ln = object[OBSERVER_PROPERTY];
if (ln) {
var elt;
for (var i = 0, sz = ln.length; sz > i; i++) {
elt = ln[i];
if (elt.constructor === Function) {
elt(chgeset);
}
}
}
} | [
"function",
"callObservers",
"(",
"object",
",",
"chgeset",
")",
"{",
"var",
"ln",
"=",
"object",
"[",
"OBSERVER_PROPERTY",
"]",
";",
"if",
"(",
"ln",
")",
"{",
"var",
"elt",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"sz",
"=",
"ln",
".",
"leng... | Call all observers for a givent object
@param {Object} object reference to the object that is being observed
@param {Array} chgeset an array of change descriptors (cf. changeDesc()) | [
"Call",
"all",
"observers",
"for",
"a",
"givent",
"object"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/json.js#L222-L233 |
44,091 | ariatemplates/hashspace | hsp/json.js | function (object, property, value) {
if (object[OBSERVER_PROPERTY]) {
var existed = ownProperty.call(object, property), oldVal = object[property];
delete object[property];
if (existed) {
var chgset=[changeDesc(object, property, object[property], oldVal, "dele... | javascript | function (object, property, value) {
if (object[OBSERVER_PROPERTY]) {
var existed = ownProperty.call(object, property), oldVal = object[property];
delete object[property];
if (existed) {
var chgset=[changeDesc(object, property, object[property], oldVal, "dele... | [
"function",
"(",
"object",
",",
"property",
",",
"value",
")",
"{",
"if",
"(",
"object",
"[",
"OBSERVER_PROPERTY",
"]",
")",
"{",
"var",
"existed",
"=",
"ownProperty",
".",
"call",
"(",
"object",
",",
"property",
")",
",",
"oldVal",
"=",
"object",
"[",... | Delete a property in a JSON object and automatically notifies all observers of the change | [
"Delete",
"a",
"property",
"in",
"a",
"JSON",
"object",
"and",
"automatically",
"notifies",
"all",
"observers",
"of",
"the",
"change"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/json.js#L275-L287 | |
44,092 | ariatemplates/hashspace | hsp/rt.js | function (tplctxt, scopevars, ctlWrapper, ctlInitArgs, rootscope) {
var vs = rootscope ? Object.create(rootscope) : {}, nm, argNames = []; // array of argument names
if (scopevars) {
for (var i = 0, sz = scopevars.length; sz > i; i += 2) {
nm = scopevars[i];
v... | javascript | function (tplctxt, scopevars, ctlWrapper, ctlInitArgs, rootscope) {
var vs = rootscope ? Object.create(rootscope) : {}, nm, argNames = []; // array of argument names
if (scopevars) {
for (var i = 0, sz = scopevars.length; sz > i; i += 2) {
nm = scopevars[i];
v... | [
"function",
"(",
"tplctxt",
",",
"scopevars",
",",
"ctlWrapper",
",",
"ctlInitArgs",
",",
"rootscope",
")",
"{",
"var",
"vs",
"=",
"rootscope",
"?",
"Object",
".",
"create",
"(",
"rootscope",
")",
":",
"{",
"}",
",",
"nm",
",",
"argNames",
"=",
"[",
... | Main method called to generate the document fragment associated to a template for a given set of arguments This
creates a new set of node instances from the node definitions passed in the ng constructor
@param {Array} scopevars the list of the scope variables (actually the template arguments) - e.g.
["person",person] o... | [
"Main",
"method",
"called",
"to",
"generate",
"the",
"document",
"fragment",
"associated",
"to",
"a",
"template",
"for",
"a",
"given",
"set",
"of",
"arguments",
"This",
"creates",
"a",
"new",
"set",
"of",
"node",
"instances",
"from",
"the",
"node",
"definiti... | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt.js#L49-L70 | |
44,093 | ariatemplates/hashspace | hsp/rt.js | getGlobalRef | function getGlobalRef(name) {
var r=global[name];
if (r===undefined) {
r=null;
}
return r;
} | javascript | function getGlobalRef(name) {
var r=global[name];
if (r===undefined) {
r=null;
}
return r;
} | [
"function",
"getGlobalRef",
"(",
"name",
")",
"{",
"var",
"r",
"=",
"global",
"[",
"name",
"]",
";",
"if",
"(",
"r",
"===",
"undefined",
")",
"{",
"r",
"=",
"null",
";",
"}",
"return",
"r",
";",
"}"
] | Return the global reference corresponding to a given name
This function is used by template to retrieve global references that are first searched in the template module
scope, then in the hashspace global object. Null is returned if no reference is found
@param {String} name the name of the reference to look for
@param... | [
"Return",
"the",
"global",
"reference",
"corresponding",
"to",
"a",
"given",
"name",
"This",
"function",
"is",
"used",
"by",
"template",
"to",
"retrieve",
"global",
"references",
"that",
"are",
"first",
"searched",
"in",
"the",
"template",
"module",
"scope",
"... | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/rt.js#L106-L112 |
44,094 | ariatemplates/hashspace | hsp/compiler/jsgenerator/index.js | _validate | function _validate (code, lineMap) {
var validationResult = jsv.validate(code);
var result = {isValid: validationResult.isValid};
if (!validationResult.isValid) {
// translate error line numbers
var error, lineNumber;
for (var i = 0; i < validationResult.errors.length; i++) {
... | javascript | function _validate (code, lineMap) {
var validationResult = jsv.validate(code);
var result = {isValid: validationResult.isValid};
if (!validationResult.isValid) {
// translate error line numbers
var error, lineNumber;
for (var i = 0; i < validationResult.errors.length; i++) {
... | [
"function",
"_validate",
"(",
"code",
",",
"lineMap",
")",
"{",
"var",
"validationResult",
"=",
"jsv",
".",
"validate",
"(",
"code",
")",
";",
"var",
"result",
"=",
"{",
"isValid",
":",
"validationResult",
".",
"isValid",
"}",
";",
"if",
"(",
"!",
"val... | Validates a javascript string using the jsvalidator module, and generates an error report if not valid.
@param {String} code the javascript string.
@param {Object} lineMap the line mapping between the source template and the compiled one
@return {Object} a result map | [
"Validates",
"a",
"javascript",
"string",
"using",
"the",
"jsvalidator",
"module",
"and",
"generates",
"an",
"error",
"report",
"if",
"not",
"valid",
"."
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/jsgenerator/index.js#L102-L123 |
44,095 | ariatemplates/hashspace | hsp/compiler/jsgenerator/index.js | _getErrorScript | function _getErrorScript (errors, fileName) {
var result = '';
if (errors && errors.length) {
var err=errors[0];
var ctxt={
type:"error",
file:fileName,
code:err.code,
line:err.line,
column:err.column
};
var suberrors = ... | javascript | function _getErrorScript (errors, fileName) {
var result = '';
if (errors && errors.length) {
var err=errors[0];
var ctxt={
type:"error",
file:fileName,
code:err.code,
line:err.line,
column:err.column
};
var suberrors = ... | [
"function",
"_getErrorScript",
"(",
"errors",
",",
"fileName",
")",
"{",
"var",
"result",
"=",
"''",
";",
"if",
"(",
"errors",
"&&",
"errors",
".",
"length",
")",
"{",
"var",
"err",
"=",
"errors",
"[",
"0",
"]",
";",
"var",
"ctxt",
"=",
"{",
"type"... | Generate an error script to include in the template compiled script in order to show errors in the browser when the script is loaded
@param {Array} errors the errror list
@param {String} fileName the name of the file being compiled
@return {String} the javascript snippet to be included | [
"Generate",
"an",
"error",
"script",
"to",
"include",
"in",
"the",
"template",
"compiled",
"script",
"in",
"order",
"to",
"show",
"errors",
"in",
"the",
"browser",
"when",
"the",
"script",
"is",
"loaded"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/jsgenerator/index.js#L131-L156 |
44,096 | ariatemplates/hashspace | hsp/compiler/jsgenerator/index.js | _generateLineMap | function _generateLineMap (res, file) {
if (res.errors && res.errors.length) {
return;
}
var syntaxTree = res.syntaxTree, templates = [];
// identify the templates in the syntax tree
for (var i = 0; i < syntaxTree.length; i++) {
if (syntaxTree[i].type === 'template') {
te... | javascript | function _generateLineMap (res, file) {
if (res.errors && res.errors.length) {
return;
}
var syntaxTree = res.syntaxTree, templates = [];
// identify the templates in the syntax tree
for (var i = 0; i < syntaxTree.length; i++) {
if (syntaxTree[i].type === 'template') {
te... | [
"function",
"_generateLineMap",
"(",
"res",
",",
"file",
")",
"{",
"if",
"(",
"res",
".",
"errors",
"&&",
"res",
".",
"errors",
".",
"length",
")",
"{",
"return",
";",
"}",
"var",
"syntaxTree",
"=",
"res",
".",
"syntaxTree",
",",
"templates",
"=",
"[... | Generate the line map of a compilatin result
@param {JSON} res the result object of a compilation - cf. compile function
@param {String} file the template file (before compilation) | [
"Generate",
"the",
"line",
"map",
"of",
"a",
"compilatin",
"result"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/compiler/jsgenerator/index.js#L173-L223 |
44,097 | ariatemplates/hashspace | hsp/propobserver.js | function () {
json.unobserve(this.target, this.callback);
this.props=null;
this.callback=null;
this.target=null;
} | javascript | function () {
json.unobserve(this.target, this.callback);
this.props=null;
this.callback=null;
this.target=null;
} | [
"function",
"(",
")",
"{",
"json",
".",
"unobserve",
"(",
"this",
".",
"target",
",",
"this",
".",
"callback",
")",
";",
"this",
".",
"props",
"=",
"null",
";",
"this",
".",
"callback",
"=",
"null",
";",
"this",
".",
"target",
"=",
"null",
";",
"... | Safely delete all internal dependencies Must be called before deleting the object | [
"Safely",
"delete",
"all",
"internal",
"dependencies",
"Must",
"be",
"called",
"before",
"deleting",
"the",
"object"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/propobserver.js#L40-L45 | |
44,098 | ariatemplates/hashspace | hsp/propobserver.js | function (observer, property) {
if (!property)
property = ALL;
var arr = this.props[property];
if (!arr) {
// property is not observed yet
arr = [];
this.props[property] = arr;
}
arr.push(observer);
} | javascript | function (observer, property) {
if (!property)
property = ALL;
var arr = this.props[property];
if (!arr) {
// property is not observed yet
arr = [];
this.props[property] = arr;
}
arr.push(observer);
} | [
"function",
"(",
"observer",
",",
"property",
")",
"{",
"if",
"(",
"!",
"property",
")",
"property",
"=",
"ALL",
";",
"var",
"arr",
"=",
"this",
".",
"props",
"[",
"property",
"]",
";",
"if",
"(",
"!",
"arr",
")",
"{",
"// property is not observed yet"... | Add a new observer for a given property
@param {object} observer object with a onPropChange() method
@param {string} property the property name to observe (optional) | [
"Add",
"a",
"new",
"observer",
"for",
"a",
"given",
"property"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/propobserver.js#L51-L61 | |
44,099 | ariatemplates/hashspace | hsp/propobserver.js | PropObserver_notifyChanges | function PropObserver_notifyChanges (chglist) {
var c;
for (var i = 0, sz = chglist.length; sz > i; i++) {
c = chglist[i];
if (!c)
continue;
// check if we listen to this property
if (this.props[c.name]) {
PropObserver_notifyChange(this, c, c.name);
... | javascript | function PropObserver_notifyChanges (chglist) {
var c;
for (var i = 0, sz = chglist.length; sz > i; i++) {
c = chglist[i];
if (!c)
continue;
// check if we listen to this property
if (this.props[c.name]) {
PropObserver_notifyChange(this, c, c.name);
... | [
"function",
"PropObserver_notifyChanges",
"(",
"chglist",
")",
"{",
"var",
"c",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"sz",
"=",
"chglist",
".",
"length",
";",
"sz",
">",
"i",
";",
"i",
"++",
")",
"{",
"c",
"=",
"chglist",
"[",
"i",
"]",
... | Notify the change to the registered observers i.e. call their onPropChange method with the change description as
parameter
@private | [
"Notify",
"the",
"change",
"to",
"the",
"registered",
"observers",
"i",
".",
"e",
".",
"call",
"their",
"onPropChange",
"method",
"with",
"the",
"change",
"description",
"as",
"parameter"
] | 24cb510288566eba0e33ff55949adb54c0a89fac | https://github.com/ariatemplates/hashspace/blob/24cb510288566eba0e33ff55949adb54c0a89fac/hsp/propobserver.js#L91-L105 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.