repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Reportr/dashboard | public/build/static/application.js | baseForOwnRight | function baseForOwnRight(object, callback) {
var props = keys(object),
length = props.length;
while (length--) {
var key = props[length];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
} | javascript | function baseForOwnRight(object, callback) {
var props = keys(object),
length = props.length;
while (length--) {
var key = props[length];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
} | [
"function",
"baseForOwnRight",
"(",
"object",
",",
"callback",
")",
"{",
"var",
"props",
"=",
"keys",
"(",
"object",
")",
",",
"length",
"=",
"props",
".",
"length",
";",
"while",
"(",
"length",
"--",
")",
"{",
"var",
"key",
"=",
"props",
"[",
"lengt... | The base implementation of `_.forOwnRight` without support for callback
shorthands or `thisArg` binding.
@private
@param {Object} object The object to iterate over.
@param {Function} callback The function called per iteration.
@returns {Object} Returns `object`. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"forOwnRight",
"without",
"support",
"for",
"callback",
"shorthands",
"or",
"thisArg",
"binding",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L14636-L14647 | train |
Reportr/dashboard | public/build/static/application.js | baseMerge | function baseMerge(object, source, callback, stackA, stackB) {
(isArray(source) ? baseEach : baseForOwn)(source, function(source, key) {
var found,
isArr,
result = source,
value = object[key];
if (source && ((isArr = isArray(source)) || isPlainObject(source))) ... | javascript | function baseMerge(object, source, callback, stackA, stackB) {
(isArray(source) ? baseEach : baseForOwn)(source, function(source, key) {
var found,
isArr,
result = source,
value = object[key];
if (source && ((isArr = isArray(source)) || isPlainObject(source))) ... | [
"function",
"baseMerge",
"(",
"object",
",",
"source",
",",
"callback",
",",
"stackA",
",",
"stackB",
")",
"{",
"(",
"isArray",
"(",
"source",
")",
"?",
"baseEach",
":",
"baseForOwn",
")",
"(",
"source",
",",
"function",
"(",
"source",
",",
"key",
")",... | The base implementation of `_.merge` without argument juggling or support
for `thisArg` binding.
@private
@param {Object} object The destination object.
@param {Object} source The source object.
@param {Function} [callback] The function to customize merging properties.
@param {Array} [stackA=[]] Tracks traversed sourc... | [
"The",
"base",
"implementation",
"of",
"_",
".",
"merge",
"without",
"argument",
"juggling",
"or",
"support",
"for",
"thisArg",
"binding",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L14836-L14888 | train |
Reportr/dashboard | public/build/static/application.js | createAggregator | function createAggregator(setter, retArray) {
return function(collection, callback, thisArg) {
var result = retArray ? [[], []] : {};
callback = lodash.createCallback(callback, thisArg, 3);
if (isArray(collection)) {
var index = -1,
length = collection.length;
... | javascript | function createAggregator(setter, retArray) {
return function(collection, callback, thisArg) {
var result = retArray ? [[], []] : {};
callback = lodash.createCallback(callback, thisArg, 3);
if (isArray(collection)) {
var index = -1,
length = collection.length;
... | [
"function",
"createAggregator",
"(",
"setter",
",",
"retArray",
")",
"{",
"return",
"function",
"(",
"collection",
",",
"callback",
",",
"thisArg",
")",
"{",
"var",
"result",
"=",
"retArray",
"?",
"[",
"[",
"]",
",",
"[",
"]",
"]",
":",
"{",
"}",
";"... | Creates a function that aggregates a collection, creating an object or
array composed from the results of running each element of the collection
through a callback. The given `setter` function sets the keys and values
of the composed object or array.
@private
@param {Function} setter The setter function.
@param {boole... | [
"Creates",
"a",
"function",
"that",
"aggregates",
"a",
"collection",
"creating",
"an",
"object",
"or",
"array",
"composed",
"from",
"the",
"results",
"of",
"running",
"each",
"element",
"of",
"the",
"collection",
"through",
"a",
"callback",
".",
"The",
"given"... | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L15020-L15040 | train |
Reportr/dashboard | public/build/static/application.js | createIterator | function createIterator(options) {
options.shadowedProps = shadowedProps;
options.support = support;
// create the function factory
var factory = Function(
'errorClass, errorProto, hasOwnProperty, isArguments, isObject, objectProto, ' +
'nonEnumProps, stringClass, stringProt... | javascript | function createIterator(options) {
options.shadowedProps = shadowedProps;
options.support = support;
// create the function factory
var factory = Function(
'errorClass, errorProto, hasOwnProperty, isArguments, isObject, objectProto, ' +
'nonEnumProps, stringClass, stringProt... | [
"function",
"createIterator",
"(",
"options",
")",
"{",
"options",
".",
"shadowedProps",
"=",
"shadowedProps",
";",
"options",
".",
"support",
"=",
"support",
";",
"// create the function factory",
"var",
"factory",
"=",
"Function",
"(",
"'errorClass, errorProto, hasO... | Creates compiled iteration functions.
@private
@param {Object} [options] The compile options object.
@param {string} [options.args] A comma separated string of iteration function arguments.
@param {string} [options.init] The string representation of the initial `result` value.
@param {string} [options.loop] Code to ex... | [
"Creates",
"compiled",
"iteration",
"functions",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L15176-L15192 | train |
Reportr/dashboard | public/build/static/application.js | getHolders | function getHolders(array) {
var index = -1,
length = array.length,
result = [];
while (++index < length) {
if (array[index] === lodash) {
result.push(index);
}
}
return result;
} | javascript | function getHolders(array) {
var index = -1,
length = array.length,
result = [];
while (++index < length) {
if (array[index] === lodash) {
result.push(index);
}
}
return result;
} | [
"function",
"getHolders",
"(",
"array",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"array",
".",
"length",
",",
"result",
"=",
"[",
"]",
";",
"while",
"(",
"++",
"index",
"<",
"length",
")",
"{",
"if",
"(",
"array",
"[",
"index"... | Finds the indexes of all placeholder elements in a given array.
@private
@param {Array} array The array to inspect.
@returns {Array} Returns a new array of placeholder indexes. | [
"Finds",
"the",
"indexes",
"of",
"all",
"placeholder",
"elements",
"in",
"a",
"given",
"array",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L15201-L15212 | train |
Reportr/dashboard | public/build/static/application.js | sample | function sample(collection, n, guard) {
if (collection && typeof collection.length != 'number') {
collection = values(collection);
} else if (support.unindexedChars && isString(collection)) {
collection = collection.split('');
}
if (n == null || guard) {
return collection... | javascript | function sample(collection, n, guard) {
if (collection && typeof collection.length != 'number') {
collection = values(collection);
} else if (support.unindexedChars && isString(collection)) {
collection = collection.split('');
}
if (n == null || guard) {
return collection... | [
"function",
"sample",
"(",
"collection",
",",
"n",
",",
"guard",
")",
"{",
"if",
"(",
"collection",
"&&",
"typeof",
"collection",
".",
"length",
"!=",
"'number'",
")",
"{",
"collection",
"=",
"values",
"(",
"collection",
")",
";",
"}",
"else",
"if",
"(... | Retrieves a random element or `n` random elements from a collection.
@static
@memberOf _
@category Collections
@param {Array|Object|string} collection The collection to sample.
@param {number} [n] The number of elements to sample.
@param- {Object} [guard] Enables use as a callback for functions like `_.map`.
@returns ... | [
"Retrieves",
"a",
"random",
"element",
"or",
"n",
"random",
"elements",
"from",
"a",
"collection",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L17557-L17569 | train |
Reportr/dashboard | public/build/static/application.js | partialRight | function partialRight(func) {
if (func) {
var arity = func[expando] ? func[expando][2] : func.length,
partialRightArgs = slice(arguments, 1);
arity -= partialRightArgs.length;
}
return createWrapper(func, PARTIAL_RIGHT_FLAG, arity, null, null, partialRightArgs);
} | javascript | function partialRight(func) {
if (func) {
var arity = func[expando] ? func[expando][2] : func.length,
partialRightArgs = slice(arguments, 1);
arity -= partialRightArgs.length;
}
return createWrapper(func, PARTIAL_RIGHT_FLAG, arity, null, null, partialRightArgs);
} | [
"function",
"partialRight",
"(",
"func",
")",
"{",
"if",
"(",
"func",
")",
"{",
"var",
"arity",
"=",
"func",
"[",
"expando",
"]",
"?",
"func",
"[",
"expando",
"]",
"[",
"2",
"]",
":",
"func",
".",
"length",
",",
"partialRightArgs",
"=",
"slice",
"(... | This method is like `_.partial` except that partially applied arguments
are appended to those provided to the new function.
Note: This method does not set the `length` property of partially applied
functions.
@static
@memberOf _
@category Functions
@param {Function} func The function to partially apply arguments to.
... | [
"This",
"method",
"is",
"like",
"_",
".",
"partial",
"except",
"that",
"partially",
"applied",
"arguments",
"are",
"appended",
"to",
"those",
"provided",
"to",
"the",
"new",
"function",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L18401-L18409 | train |
Reportr/dashboard | public/build/static/application.js | functions | function functions(object) {
var result = [];
baseForIn(object, function(value, key) {
if (isFunction(value)) {
result.push(key);
}
});
return result.sort();
} | javascript | function functions(object) {
var result = [];
baseForIn(object, function(value, key) {
if (isFunction(value)) {
result.push(key);
}
});
return result.sort();
} | [
"function",
"functions",
"(",
"object",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"baseForIn",
"(",
"object",
",",
"function",
"(",
"value",
",",
"key",
")",
"{",
"if",
"(",
"isFunction",
"(",
"value",
")",
")",
"{",
"result",
".",
"push",
"("... | Creates a sorted array of property names of all enumerable properties,
own and inherited, of `object` that have function values.
@static
@memberOf _
@alias methods
@category Objects
@param {Object} object The object to inspect.
@returns {Array} Returns an array of property names that have function values.
@example
_.... | [
"Creates",
"a",
"sorted",
"array",
"of",
"property",
"names",
"of",
"all",
"enumerable",
"properties",
"own",
"and",
"inherited",
"of",
"object",
"that",
"have",
"function",
"values",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L19000-L19008 | train |
Reportr/dashboard | public/build/static/application.js | matches | function matches(source) {
source || (source = {});
var props = keys(source),
key = props[0],
a = source[key];
// fast path the common case of providing an object with a single
// property containing a primitive value
if (props.length == 1 && a === a && !isObject(a)) ... | javascript | function matches(source) {
source || (source = {});
var props = keys(source),
key = props[0],
a = source[key];
// fast path the common case of providing an object with a single
// property containing a primitive value
if (props.length == 1 && a === a && !isObject(a)) ... | [
"function",
"matches",
"(",
"source",
")",
"{",
"source",
"||",
"(",
"source",
"=",
"{",
"}",
")",
";",
"var",
"props",
"=",
"keys",
"(",
"source",
")",
",",
"key",
"=",
"props",
"[",
"0",
"]",
",",
"a",
"=",
"source",
"[",
"key",
"]",
";",
"... | Creates a "_.where" style function, which performs a deep comparison
between a given object and the `source` object, returning `true` if the
given object has equivalent property values, else `false`.
@static
@memberOf _
@category Utilities
@param {Object} source The object of property values to match.
@returns {Functi... | [
"Creates",
"a",
"_",
".",
"where",
"style",
"function",
"which",
"performs",
"a",
"deep",
"comparison",
"between",
"a",
"given",
"object",
"and",
"the",
"source",
"object",
"returning",
"true",
"if",
"the",
"given",
"object",
"has",
"equivalent",
"property",
... | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L20306-L20337 | train |
Reportr/dashboard | public/build/static/application.js | mixin | function mixin(object, source, options) {
var chain = true,
methodNames = source && functions(source);
if (!source || (!options && !methodNames.length)) {
if (options == null) {
options = source;
}
source = object;
object = lodash;
methodNames = f... | javascript | function mixin(object, source, options) {
var chain = true,
methodNames = source && functions(source);
if (!source || (!options && !methodNames.length)) {
if (options == null) {
options = source;
}
source = object;
object = lodash;
methodNames = f... | [
"function",
"mixin",
"(",
"object",
",",
"source",
",",
"options",
")",
"{",
"var",
"chain",
"=",
"true",
",",
"methodNames",
"=",
"source",
"&&",
"functions",
"(",
"source",
")",
";",
"if",
"(",
"!",
"source",
"||",
"(",
"!",
"options",
"&&",
"!",
... | Adds function properties of a source object to the destination object.
If `object` is a function methods will be added to its prototype as well.
@static
@memberOf _
@category Utilities
@param {Function|Object} [object=lodash] object The destination object.
@param {Object} source The object of functions to add.
@param ... | [
"Adds",
"function",
"properties",
"of",
"a",
"source",
"object",
"to",
"the",
"destination",
"object",
".",
"If",
"object",
"is",
"a",
"function",
"methods",
"will",
"be",
"added",
"to",
"its",
"prototype",
"as",
"well",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L20369-L20415 | train |
Reportr/dashboard | public/build/static/application.js | result | function result(object, key, defaultValue) {
var value = object == null ? undefined : object[key];
if (typeof value == 'undefined') {
return defaultValue;
}
return isFunction(value) ? object[key]() : value;
} | javascript | function result(object, key, defaultValue) {
var value = object == null ? undefined : object[key];
if (typeof value == 'undefined') {
return defaultValue;
}
return isFunction(value) ? object[key]() : value;
} | [
"function",
"result",
"(",
"object",
",",
"key",
",",
"defaultValue",
")",
"{",
"var",
"value",
"=",
"object",
"==",
"null",
"?",
"undefined",
":",
"object",
"[",
"key",
"]",
";",
"if",
"(",
"typeof",
"value",
"==",
"'undefined'",
")",
"{",
"return",
... | Resolves the value of property `key` on `object`. If `key` is a function
it will be invoked with the `this` binding of `object` and its result
returned, else the property value is returned. If `object` is `null` or
`undefined` then `undefined` is returned. If a default value is provided
it will be returned if the prope... | [
"Resolves",
"the",
"value",
"of",
"property",
"key",
"on",
"object",
".",
"If",
"key",
"is",
"a",
"function",
"it",
"will",
"be",
"invoked",
"with",
"the",
"this",
"binding",
"of",
"object",
"and",
"its",
"result",
"returned",
"else",
"the",
"property",
... | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L20617-L20623 | train |
Reportr/dashboard | public/build/static/application.js | function(obj, name, callback) {
var listeningTo = this._listeningTo;
if (!listeningTo) return this;
var remove = !name && !callback;
if (!callback && typeof name === 'object') callback = this;
if (obj) (listeningTo = {})[obj.cid] = obj;
for (var i... | javascript | function(obj, name, callback) {
var listeningTo = this._listeningTo;
if (!listeningTo) return this;
var remove = !name && !callback;
if (!callback && typeof name === 'object') callback = this;
if (obj) (listeningTo = {})[obj.cid] = obj;
for (var i... | [
"function",
"(",
"obj",
",",
"name",
",",
"callback",
")",
"{",
"var",
"listeningTo",
"=",
"this",
".",
"_listeningTo",
";",
"if",
"(",
"!",
"listeningTo",
")",
"return",
"this",
";",
"var",
"remove",
"=",
"!",
"name",
"&&",
"!",
"callback",
";",
"if... | Tell this object to stop listening to either specific events or
to every object it's currently listening to.
@method stopListening
@param {Class} [obj] object to stop listening to
@param {string} [name] event to stop listening for
@param {function} [callback] callback to stop listening for
@chainable | [
"Tell",
"this",
"object",
"to",
"stop",
"listening",
"to",
"either",
"specific",
"events",
"or",
"to",
"every",
"object",
"it",
"s",
"currently",
"listening",
"to",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L21363-L21376 | train | |
Reportr/dashboard | public/build/static/application.js | function(namespace, key) {
key = JSON.stringify(key);
return "cache_" + configs.revision + "_" + namespace + "_" + key;
} | javascript | function(namespace, key) {
key = JSON.stringify(key);
return "cache_" + configs.revision + "_" + namespace + "_" + key;
} | [
"function",
"(",
"namespace",
",",
"key",
")",
"{",
"key",
"=",
"JSON",
".",
"stringify",
"(",
"key",
")",
";",
"return",
"\"cache_\"",
"+",
"configs",
".",
"revision",
"+",
"\"_\"",
"+",
"namespace",
"+",
"\"_\"",
"+",
"key",
";",
"}"
] | Transform a key in cache key
@method key
@param {string} namespace namespace for this key
@param {string} key key of the data to cache
@return {string} complete key for the cache | [
"Transform",
"a",
"key",
"in",
"cache",
"key"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L21907-L21910 | train | |
Reportr/dashboard | public/build/static/application.js | function(namespace, key) {
var ckey = Cache.key(namespace, key);
var ctime = (new Date()).getTime();
var v = Storage.get(ckey);
if (v == null) {
return null;
} else {
if (v.expiration == -1 || v.expiration > ctime) {
... | javascript | function(namespace, key) {
var ckey = Cache.key(namespace, key);
var ctime = (new Date()).getTime();
var v = Storage.get(ckey);
if (v == null) {
return null;
} else {
if (v.expiration == -1 || v.expiration > ctime) {
... | [
"function",
"(",
"namespace",
",",
"key",
")",
"{",
"var",
"ckey",
"=",
"Cache",
".",
"key",
"(",
"namespace",
",",
"key",
")",
";",
"var",
"ctime",
"=",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
";",
"var",
"v",
"=",
"Storag... | Get data from the cache
@method get
@param {string} namespace namespace for this key
@param {string} key key of the data to cache
@return {object} value from the cache | [
"Get",
"data",
"from",
"the",
"cache"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L21920-L21935 | train | |
Reportr/dashboard | public/build/static/application.js | function(namespace, key) {
var ckey = Cache.key(namespace, key);
var ctime = (new Date()).getTime();
Storage.remove(ckey);
} | javascript | function(namespace, key) {
var ckey = Cache.key(namespace, key);
var ctime = (new Date()).getTime();
Storage.remove(ckey);
} | [
"function",
"(",
"namespace",
",",
"key",
")",
"{",
"var",
"ckey",
"=",
"Cache",
".",
"key",
"(",
"namespace",
",",
"key",
")",
";",
"var",
"ctime",
"=",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")",
";",
"Storage",
".",
"remove",
... | Delete a cache value
@method remove
@param {string} namespace namespace for this key
@param {string} key key of the data to cache | [
"Delete",
"a",
"cache",
"value"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L21944-L21948 | train | |
Reportr/dashboard | public/build/static/application.js | function(namespace, key, value, expiration) {
var ckey = Cache.key(namespace, key);
var ctime = (new Date()).getTime();
if (expiration > 0) {
expiration = ctime + expiration * 1000;
} else {
expiration = -1;
}
Stor... | javascript | function(namespace, key, value, expiration) {
var ckey = Cache.key(namespace, key);
var ctime = (new Date()).getTime();
if (expiration > 0) {
expiration = ctime + expiration * 1000;
} else {
expiration = -1;
}
Stor... | [
"function",
"(",
"namespace",
",",
"key",
",",
"value",
",",
"expiration",
")",
"{",
"var",
"ckey",
"=",
"Cache",
".",
"key",
"(",
"namespace",
",",
"key",
")",
";",
"var",
"ctime",
"=",
"(",
"new",
"Date",
"(",
")",
")",
".",
"getTime",
"(",
")"... | Set a data in the cache
@method get
@param {string} namespace namespace for this key
@param {string} key key of the data to cache
@param {object} value value to store in teh cache associated to this key
@param {number} [expiration] seconds before epiration of this value in the cache | [
"Set",
"a",
"data",
"in",
"the",
"cache"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L21959-L21974 | train | |
Reportr/dashboard | public/build/static/application.js | function() {
var s = Storage.storage();
if (s == null) {
return false;
}
Object.keys(s).forEach(function(key){
if (/^(cache_)/.test(key)) {
s.removeItem(key);
}
});
} | javascript | function() {
var s = Storage.storage();
if (s == null) {
return false;
}
Object.keys(s).forEach(function(key){
if (/^(cache_)/.test(key)) {
s.removeItem(key);
}
});
} | [
"function",
"(",
")",
"{",
"var",
"s",
"=",
"Storage",
".",
"storage",
"(",
")",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"Object",
".",
"keys",
"(",
"s",
")",
".",
"forEach",
"(",
"function",
"(",
"key",
")",
... | Clear the entire cache
@method clear | [
"Clear",
"the",
"entire",
"cache"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L21981-L21991 | train | |
Reportr/dashboard | public/build/static/application.js | function(namespace) {
var ncache = {};
_.each(cache_methods, function(method) {
ncache[method] = _.partial(Cache[method], namespace);
})
return ncache;
} | javascript | function(namespace) {
var ncache = {};
_.each(cache_methods, function(method) {
ncache[method] = _.partial(Cache[method], namespace);
})
return ncache;
} | [
"function",
"(",
"namespace",
")",
"{",
"var",
"ncache",
"=",
"{",
"}",
";",
"_",
".",
"each",
"(",
"cache_methods",
",",
"function",
"(",
"method",
")",
"{",
"ncache",
"[",
"method",
"]",
"=",
"_",
".",
"partial",
"(",
"Cache",
"[",
"method",
"]",... | Return a cahce interface for a specific namespace
@method namespace
@param {string} namespace name of the namespace | [
"Return",
"a",
"cahce",
"interface",
"for",
"a",
"specific",
"namespace"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L21999-L22005 | train | |
Reportr/dashboard | public/build/static/application.js | function() {
if (!this.available) return;
if (window.applicationCache.status === window.applicationCache.UPDATEREADY) {
this.trigger("update");
}
return window.applicationCache.status === window.applicationCache.UPDATEREADY;
} | javascript | function() {
if (!this.available) return;
if (window.applicationCache.status === window.applicationCache.UPDATEREADY) {
this.trigger("update");
}
return window.applicationCache.status === window.applicationCache.UPDATEREADY;
} | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"available",
")",
"return",
";",
"if",
"(",
"window",
".",
"applicationCache",
".",
"status",
"===",
"window",
".",
"applicationCache",
".",
"UPDATEREADY",
")",
"{",
"this",
".",
"trigger",
"(",
"... | Check for cache update | [
"Check",
"for",
"cache",
"update"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L22490-L22497 | train | |
Reportr/dashboard | public/build/static/application.js | function(state) {
if (state == this.state) return;
this.state = state;
logging.log("state ", this.state);
this.trigger("state", this.state);
} | javascript | function(state) {
if (state == this.state) return;
this.state = state;
logging.log("state ", this.state);
this.trigger("state", this.state);
} | [
"function",
"(",
"state",
")",
"{",
"if",
"(",
"state",
"==",
"this",
".",
"state",
")",
"return",
";",
"this",
".",
"state",
"=",
"state",
";",
"logging",
".",
"log",
"(",
"\"state \"",
",",
"this",
".",
"state",
")",
";",
"this",
".",
"trigger",
... | Set connexion status | [
"Set",
"connexion",
"status"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L22500-L22506 | train | |
Reportr/dashboard | public/build/static/application.js | function(title) {
if (this._preTitle.length > 0) title = this._preTitle + " " + title;
if (_.size(title) == 0) return this.app.name;
return title + " - " + this.app.name;
} | javascript | function(title) {
if (this._preTitle.length > 0) title = this._preTitle + " " + title;
if (_.size(title) == 0) return this.app.name;
return title + " - " + this.app.name;
} | [
"function",
"(",
"title",
")",
"{",
"if",
"(",
"this",
".",
"_preTitle",
".",
"length",
">",
"0",
")",
"title",
"=",
"this",
".",
"_preTitle",
"+",
"\" \"",
"+",
"title",
";",
"if",
"(",
"_",
".",
"size",
"(",
"title",
")",
"==",
"0",
")",
"ret... | Transform a page name in complete title
@method completeTitle
@param {string} title title of the page
@return {string} complete name with application name | [
"Transform",
"a",
"page",
"name",
"in",
"complete",
"title"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L23076-L23080 | train | |
Reportr/dashboard | public/build/static/application.js | function(name, value, metaName) {
if (_.isObject(name)) {
_.each(name, function(value, name) {
this.meta(name, value);
}, this);
return;
}
if (metaName == null) metaName = "name";
var mt = this.$('meta['... | javascript | function(name, value, metaName) {
if (_.isObject(name)) {
_.each(name, function(value, name) {
this.meta(name, value);
}, this);
return;
}
if (metaName == null) metaName = "name";
var mt = this.$('meta['... | [
"function",
"(",
"name",
",",
"value",
",",
"metaName",
")",
"{",
"if",
"(",
"_",
".",
"isObject",
"(",
"name",
")",
")",
"{",
"_",
".",
"each",
"(",
"name",
",",
"function",
"(",
"value",
",",
"name",
")",
"{",
"this",
".",
"meta",
"(",
"name"... | Set or get a meta tag value
@method meta
@param {string} name name of the meta tag
@param {string} [value] value to set on the meta tag
@param {string} [metaName="name"] selector for the meta name
@return {string} value of the meta tag | [
"Set",
"or",
"get",
"a",
"meta",
"tag",
"value"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L23091-L23110 | train | |
Reportr/dashboard | public/build/static/application.js | function(rel, href, mimetype) {
if (_.isObject(rel)) {
_.each(rel, function(value, name) {
this.link(name, value);
}, this);
return;
}
var mt = this.$('link[rel="'+rel+'"]');
if (mt.length === 0) {
... | javascript | function(rel, href, mimetype) {
if (_.isObject(rel)) {
_.each(rel, function(value, name) {
this.link(name, value);
}, this);
return;
}
var mt = this.$('link[rel="'+rel+'"]');
if (mt.length === 0) {
... | [
"function",
"(",
"rel",
",",
"href",
",",
"mimetype",
")",
"{",
"if",
"(",
"_",
".",
"isObject",
"(",
"rel",
")",
")",
"{",
"_",
".",
"each",
"(",
"rel",
",",
"function",
"(",
"value",
",",
"name",
")",
"{",
"this",
".",
"link",
"(",
"name",
... | Set or get a link tag value
@method link
@param {string} ref name of the link tag
@param {string} [href] value to set on the link tag
@param {string} [mimetype] mimetype for this link
@return {string} value of the link tag | [
"Set",
"or",
"get",
"a",
"link",
"tag",
"value"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L23121-L23139 | train | |
Reportr/dashboard | public/build/static/application.js | function(value, absolute) {
var mt = this.$('title');
if (mt.length === 0) {
mt = $("<title>", {}).appendTo(this.$el);
}
if (value != null) {
this._title = value;
if (absolute !== false) value = this.completeTitle(value);
... | javascript | function(value, absolute) {
var mt = this.$('title');
if (mt.length === 0) {
mt = $("<title>", {}).appendTo(this.$el);
}
if (value != null) {
this._title = value;
if (absolute !== false) value = this.completeTitle(value);
... | [
"function",
"(",
"value",
",",
"absolute",
")",
"{",
"var",
"mt",
"=",
"this",
".",
"$",
"(",
"'title'",
")",
";",
"if",
"(",
"mt",
".",
"length",
"===",
"0",
")",
"{",
"mt",
"=",
"$",
"(",
"\"<title>\"",
",",
"{",
"}",
")",
".",
"appendTo",
... | Set or get the page title
@method title
@param {string} value value for the title
@param {boolean} [absolute] if true, it'll not use completeTitle
@return {string} value of the title | [
"Set",
"or",
"get",
"the",
"page",
"title"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L23149-L23161 | train | |
Reportr/dashboard | public/build/static/application.js | function(index, follow) {
if (_.isNull(follow)) follow = index;
var value = "";
value = index ? "index" : "noindex";
value = value + "," + (follow ? "follow" : "nofollow");
this.meta("robots", value);
return this;
} | javascript | function(index, follow) {
if (_.isNull(follow)) follow = index;
var value = "";
value = index ? "index" : "noindex";
value = value + "," + (follow ? "follow" : "nofollow");
this.meta("robots", value);
return this;
} | [
"function",
"(",
"index",
",",
"follow",
")",
"{",
"if",
"(",
"_",
".",
"isNull",
"(",
"follow",
")",
")",
"follow",
"=",
"index",
";",
"var",
"value",
"=",
"\"\"",
";",
"value",
"=",
"index",
"?",
"\"index\"",
":",
"\"noindex\"",
";",
"value",
"="... | Active or desactive page indexation using robots meta tag
@method setCrawling
@param {boolean} index
@return {boolean} follow | [
"Active",
"or",
"desactive",
"page",
"indexation",
"using",
"robots",
"meta",
"tag"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L23195-L23202 | train | |
Reportr/dashboard | public/build/static/application.js | function() {
if (this.started) {
logging.warn("routing history already started");
return false;
}
var self = this;
var $window = $(window);
var rootUrl = document.location.protocol+'//'+(document.location.hostname||document.loc... | javascript | function() {
if (this.started) {
logging.warn("routing history already started");
return false;
}
var self = this;
var $window = $(window);
var rootUrl = document.location.protocol+'//'+(document.location.hostname||document.loc... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"started",
")",
"{",
"logging",
".",
"warn",
"(",
"\"routing history already started\"",
")",
";",
"return",
"false",
";",
"}",
"var",
"self",
"=",
"this",
";",
"var",
"$window",
"=",
"$",
"(",
"window... | Add the navigation handling
@method start
@chainable | [
"Add",
"the",
"navigation",
"handling"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L23262-L23279 | train | |
Reportr/dashboard | public/build/static/application.js | function(route, args) {
url = urls.route(route, args);
logging.log("navigate to ", url);
window.location.hash = url;
return this;
} | javascript | function(route, args) {
url = urls.route(route, args);
logging.log("navigate to ", url);
window.location.hash = url;
return this;
} | [
"function",
"(",
"route",
",",
"args",
")",
"{",
"url",
"=",
"urls",
".",
"route",
"(",
"route",
",",
"args",
")",
";",
"logging",
".",
"log",
"(",
"\"navigate to \"",
",",
"url",
")",
";",
"window",
".",
"location",
".",
"hash",
"=",
"url",
";",
... | Navigation to a specific route
@method navigate
@param {string} route to navigate to
@param {object} [args] arguments for the route
@chainable | [
"Navigation",
"to",
"a",
"specific",
"route"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L23289-L23294 | train | |
Reportr/dashboard | public/build/static/application.js | function(route, name) {
var handler;
if (_.isObject(route) && !_.isRegExp(route)) {
_.each(route, function(callback, route) {
this.route(route, callback);
}, this);
return this;
}
handler = this[name];
... | javascript | function(route, name) {
var handler;
if (_.isObject(route) && !_.isRegExp(route)) {
_.each(route, function(callback, route) {
this.route(route, callback);
}, this);
return this;
}
handler = this[name];
... | [
"function",
"(",
"route",
",",
"name",
")",
"{",
"var",
"handler",
";",
"if",
"(",
"_",
".",
"isObject",
"(",
"route",
")",
"&&",
"!",
"_",
".",
"isRegExp",
"(",
"route",
")",
")",
"{",
"_",
".",
"each",
"(",
"route",
",",
"function",
"(",
"cal... | Add new route
@method route
@param {string} route regex or route string
@param {string} name method to use as a route callback
@return {string} page title | [
"Add",
"new",
"route"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L23560-L23587 | train | |
Reportr/dashboard | public/build/static/application.js | function(models, options) {
options = _.defaults(options || {}, {
totalCount: false
});
// Manage {list:[], n:0} for infinite list
if (_.size(models) == 2
&& models.list != null && models.n != null) {
this._totalCount = models.... | javascript | function(models, options) {
options = _.defaults(options || {}, {
totalCount: false
});
// Manage {list:[], n:0} for infinite list
if (_.size(models) == 2
&& models.list != null && models.n != null) {
this._totalCount = models.... | [
"function",
"(",
"models",
",",
"options",
")",
"{",
"options",
"=",
"_",
".",
"defaults",
"(",
"options",
"||",
"{",
"}",
",",
"{",
"totalCount",
":",
"false",
"}",
")",
";",
"// Manage {list:[], n:0} for infinite list",
"if",
"(",
"_",
".",
"size",
"("... | Reset the collection with new models or new data.
@method reset
@param {array} models array of models or data to set in the collection
@param {object} [options] options for reseting
@chainable | [
"Reset",
"the",
"collection",
"with",
"new",
"models",
"or",
"new",
"data",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L24829-L24856 | train | |
Reportr/dashboard | public/build/static/application.js | function(model, options) {
var index;
if (_.isArray(model)) {
_.each(model, function(m) {
this.remove(m, options);
}, this);
return this;
}
options = _.defaults(options || {}, {
silent: ... | javascript | function(model, options) {
var index;
if (_.isArray(model)) {
_.each(model, function(m) {
this.remove(m, options);
}, this);
return this;
}
options = _.defaults(options || {}, {
silent: ... | [
"function",
"(",
"model",
",",
"options",
")",
"{",
"var",
"index",
";",
"if",
"(",
"_",
".",
"isArray",
"(",
"model",
")",
")",
"{",
"_",
".",
"each",
"(",
"model",
",",
"function",
"(",
"m",
")",
"{",
"this",
".",
"remove",
"(",
"m",
",",
"... | Remove a model from the collection.
@method remove
@param {Model} model model or data to remove
@param {object} [options] options for removing
@chainable | [
"Remove",
"a",
"model",
"from",
"the",
"collection",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L24929-L24961 | train | |
Reportr/dashboard | public/build/static/application.js | function(model, options) {
model = this._prepareModel(model, options);
this.add(model, options);
return model;
} | javascript | function(model, options) {
model = this._prepareModel(model, options);
this.add(model, options);
return model;
} | [
"function",
"(",
"model",
",",
"options",
")",
"{",
"model",
"=",
"this",
".",
"_prepareModel",
"(",
"model",
",",
"options",
")",
";",
"this",
".",
"add",
"(",
"model",
",",
"options",
")",
";",
"return",
"model",
";",
"}"
] | Add a model at the end of the collection.
@method push
@param {Model} model model or data to add
@param {object} [options] options for adding
@return {Model} Return the new added model | [
"Add",
"a",
"model",
"at",
"the",
"end",
"of",
"the",
"collection",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L25000-L25004 | train | |
Reportr/dashboard | public/build/static/application.js | function(options) {
this.queue.defer(function() {
options = _.defaults(options || {}, {
refresh: false
});
var d, self = this;
if (this.options.loader == null) return this;
if (options.refresh) {
... | javascript | function(options) {
this.queue.defer(function() {
options = _.defaults(options || {}, {
refresh: false
});
var d, self = this;
if (this.options.loader == null) return this;
if (options.refresh) {
... | [
"function",
"(",
"options",
")",
"{",
"this",
".",
"queue",
".",
"defer",
"(",
"function",
"(",
")",
"{",
"options",
"=",
"_",
".",
"defaults",
"(",
"options",
"||",
"{",
"}",
",",
"{",
"refresh",
":",
"false",
"}",
")",
";",
"var",
"d",
",",
"... | Get more elements from an infinite collection
@method getMore
@chainable | [
"Get",
"more",
"elements",
"from",
"an",
"infinite",
"collection"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L25134-L25162 | train | |
Reportr/dashboard | public/build/static/application.js | function(method, properties) {
if (this.methods[method]) throw "Method already define for this backend: "+method;
properties.id = method;
properties.regexp = this.routeToRegExp(method);
this.methods[method] = properties;
return this;
} | javascript | function(method, properties) {
if (this.methods[method]) throw "Method already define for this backend: "+method;
properties.id = method;
properties.regexp = this.routeToRegExp(method);
this.methods[method] = properties;
return this;
} | [
"function",
"(",
"method",
",",
"properties",
")",
"{",
"if",
"(",
"this",
".",
"methods",
"[",
"method",
"]",
")",
"throw",
"\"Method already define for this backend: \"",
"+",
"method",
";",
"properties",
".",
"id",
"=",
"method",
";",
"properties",
".",
"... | Add a backend method
@method addMethod
@param {string} method name for this method
@param {object} informations about this method | [
"Add",
"a",
"backend",
"method"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L25705-L25713 | train | |
Reportr/dashboard | public/build/static/application.js | function(method, sId) {
sId = sId || method;
sId = this.options.prefix+"."+sId;
return this.addMethod(method, {
fallback: function(args, options, method) {
return Storage.get(sId+"."+method);
},
after: function(args,... | javascript | function(method, sId) {
sId = sId || method;
sId = this.options.prefix+"."+sId;
return this.addMethod(method, {
fallback: function(args, options, method) {
return Storage.get(sId+"."+method);
},
after: function(args,... | [
"function",
"(",
"method",
",",
"sId",
")",
"{",
"sId",
"=",
"sId",
"||",
"method",
";",
"sId",
"=",
"this",
".",
"options",
".",
"prefix",
"+",
"\".\"",
"+",
"sId",
";",
"return",
"this",
".",
"addMethod",
"(",
"method",
",",
"{",
"fallback",
":",... | Add a cached method for offline mode only
@method addCachedMethod
@param {string} method name for this method
@param {string} [sId] id used for caching | [
"Add",
"a",
"cached",
"method",
"for",
"offline",
"mode",
"only"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L25722-L25733 | train | |
Reportr/dashboard | public/build/static/application.js | function(method) {
return _.find(this.methods, function(handler) {
return handler.regexp.test(method);
}) || this.defaultHandler;
} | javascript | function(method) {
return _.find(this.methods, function(handler) {
return handler.regexp.test(method);
}) || this.defaultHandler;
} | [
"function",
"(",
"method",
")",
"{",
"return",
"_",
".",
"find",
"(",
"this",
".",
"methods",
",",
"function",
"(",
"handler",
")",
"{",
"return",
"handler",
".",
"regexp",
".",
"test",
"(",
"method",
")",
";",
"}",
")",
"||",
"this",
".",
"default... | Get the method handler to use for a method
@method getHandler | [
"Get",
"the",
"method",
"handler",
"to",
"use",
"for",
"a",
"method"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L25740-L25744 | train | |
Reportr/dashboard | public/build/static/application.js | function(method, args, options) {
var that = this, methodHandler;
options = options || {};
var handler = this.getHandler(method);
if (!handler) return Q.reject(new Error("No handler found for method: "+method));
// Is offline
if (!Offline.isConn... | javascript | function(method, args, options) {
var that = this, methodHandler;
options = options || {};
var handler = this.getHandler(method);
if (!handler) return Q.reject(new Error("No handler found for method: "+method));
// Is offline
if (!Offline.isConn... | [
"function",
"(",
"method",
",",
"args",
",",
"options",
")",
"{",
"var",
"that",
"=",
"this",
",",
"methodHandler",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"var",
"handler",
"=",
"this",
".",
"getHandler",
"(",
"method",
")",
";",
"if",
... | Execute a method
@method execute
@param {string} method name of the method to execute
@param {object} args arguments for this method
@param {options} [options] options for execution
@return {promise<object>} | [
"Execute",
"a",
"method"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L25767-L25799 | train | |
Reportr/dashboard | public/build/static/application.js | function (url, protocol, hostname, port) {
var match = text.xdRegExp.exec(url),
uProtocol, uHostName, uPort;
if (!match) {
return true;
}
uProtocol = match[2];
uHostName = match[3];
u... | javascript | function (url, protocol, hostname, port) {
var match = text.xdRegExp.exec(url),
uProtocol, uHostName, uPort;
if (!match) {
return true;
}
uProtocol = match[2];
uHostName = match[3];
u... | [
"function",
"(",
"url",
",",
"protocol",
",",
"hostname",
",",
"port",
")",
"{",
"var",
"match",
"=",
"text",
".",
"xdRegExp",
".",
"exec",
"(",
"url",
")",
",",
"uProtocol",
",",
"uHostName",
",",
"uPort",
";",
"if",
"(",
"!",
"match",
")",
"{",
... | Is an URL on another domain. Only works for browser use, returns
false in non-browser environments. Only used to know if an
optimized .js version of a text resource should be loaded
instead.
@param {String} url
@returns Boolean | [
"Is",
"an",
"URL",
"on",
"another",
"domain",
".",
"Only",
"works",
"for",
"browser",
"use",
"returns",
"false",
"in",
"non",
"-",
"browser",
"environments",
".",
"Only",
"used",
"to",
"know",
"if",
"an",
"optimized",
".",
"js",
"version",
"of",
"a",
"... | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L26162-L26178 | train | |
Reportr/dashboard | public/build/static/application.js | function(cls, options) {
var d = Q.defer();
cls = cls || DialogView;
var diag = new cls(options);
diag.once("close", function(result, e) {
if (result != null) {
d.resolve(result);
} else {
d.reject(... | javascript | function(cls, options) {
var d = Q.defer();
cls = cls || DialogView;
var diag = new cls(options);
diag.once("close", function(result, e) {
if (result != null) {
d.resolve(result);
} else {
d.reject(... | [
"function",
"(",
"cls",
",",
"options",
")",
"{",
"var",
"d",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"cls",
"=",
"cls",
"||",
"DialogView",
";",
"var",
"diag",
"=",
"new",
"cls",
"(",
"options",
")",
";",
"diag",
".",
"once",
"(",
"\"close\"",
... | Open a dialog from a specific view class with some configuration
@param {DialogView} cls dialog view class
@param {options} options dialog view constructor options
@return {promise} | [
"Open",
"a",
"dialog",
"from",
"a",
"specific",
"view",
"class",
"with",
"some",
"configuration"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L26446-L26465 | train | |
Reportr/dashboard | public/build/static/application.js | function(title, message, defaultmsg) {
return Dialogs.open(null, {
"title": title,
"message": message,
"dialog": "prompt",
"default": defaultmsg,
"autoFocus": true,
"valueSelector": "selectorPrompt"
}... | javascript | function(title, message, defaultmsg) {
return Dialogs.open(null, {
"title": title,
"message": message,
"dialog": "prompt",
"default": defaultmsg,
"autoFocus": true,
"valueSelector": "selectorPrompt"
}... | [
"function",
"(",
"title",
",",
"message",
",",
"defaultmsg",
")",
"{",
"return",
"Dialogs",
".",
"open",
"(",
"null",
",",
"{",
"\"title\"",
":",
"title",
",",
"\"message\"",
":",
"message",
",",
"\"dialog\"",
":",
"\"prompt\"",
",",
"\"default\"",
":",
... | Open a prompt modal dialog
@param {string} title
@param {string} message
@param {string} defaultmsg | [
"Open",
"a",
"prompt",
"modal",
"dialog"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L26512-L26521 | train | |
Reportr/dashboard | public/build/static/application.js | function(title, message, choices, defaultChoice) {
return Dialogs.open(null, {
"title": title,
"message": message,
"dialog": "select",
"default": defaultChoice,
"choices": choices,
"autoFocus": true,
... | javascript | function(title, message, choices, defaultChoice) {
return Dialogs.open(null, {
"title": title,
"message": message,
"dialog": "select",
"default": defaultChoice,
"choices": choices,
"autoFocus": true,
... | [
"function",
"(",
"title",
",",
"message",
",",
"choices",
",",
"defaultChoice",
")",
"{",
"return",
"Dialogs",
".",
"open",
"(",
"null",
",",
"{",
"\"title\"",
":",
"title",
",",
"\"message\"",
":",
"message",
",",
"\"dialog\"",
":",
"\"select\"",
",",
"... | Open a select modal dialog
@param {string} title
@param {string} message
@param {object} choices
@param {string} defaultChoice | [
"Open",
"a",
"select",
"modal",
"dialog"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L26531-L26541 | train | |
Reportr/dashboard | public/build/static/application.js | function(title, message) {
if (!message) {
message = title;
title = null;
}
return Dialogs.open(null, {
"title": title,
"message": message,
"dialog": "confirm"
});
} | javascript | function(title, message) {
if (!message) {
message = title;
title = null;
}
return Dialogs.open(null, {
"title": title,
"message": message,
"dialog": "confirm"
});
} | [
"function",
"(",
"title",
",",
"message",
")",
"{",
"if",
"(",
"!",
"message",
")",
"{",
"message",
"=",
"title",
";",
"title",
"=",
"null",
";",
"}",
"return",
"Dialogs",
".",
"open",
"(",
"null",
",",
"{",
"\"title\"",
":",
"title",
",",
"\"messa... | Open a confirmation modal dialog
@param {string} title
@param {string} message | [
"Open",
"a",
"confirmation",
"modal",
"dialog"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L26549-L26560 | train | |
Reportr/dashboard | public/build/static/application.js | function(err) {
Dialogs.alert("Error:", err.message || err);
console.error(err.stack || err.message || err);
return Q.reject(err);
} | javascript | function(err) {
Dialogs.alert("Error:", err.message || err);
console.error(err.stack || err.message || err);
return Q.reject(err);
} | [
"function",
"(",
"err",
")",
"{",
"Dialogs",
".",
"alert",
"(",
"\"Error:\"",
",",
"err",
".",
"message",
"||",
"err",
")",
";",
"console",
".",
"error",
"(",
"err",
".",
"stack",
"||",
"err",
".",
"message",
"||",
"err",
")",
";",
"return",
"Q",
... | Show an error message | [
"Show",
"an",
"error",
"message"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L26579-L26583 | train | |
Reportr/dashboard | public/build/static/application.js | dfl | function dfl(a, b, c) {
switch (arguments.length) {
case 2: return a != null ? a : b;
case 3: return a != null ? a : b != null ? b : c;
default: throw new Error("Implement me");
}
} | javascript | function dfl(a, b, c) {
switch (arguments.length) {
case 2: return a != null ? a : b;
case 3: return a != null ? a : b != null ? b : c;
default: throw new Error("Implement me");
}
} | [
"function",
"dfl",
"(",
"a",
",",
"b",
",",
"c",
")",
"{",
"switch",
"(",
"arguments",
".",
"length",
")",
"{",
"case",
"2",
":",
"return",
"a",
"!=",
"null",
"?",
"a",
":",
"b",
";",
"case",
"3",
":",
"return",
"a",
"!=",
"null",
"?",
"a",
... | Pick the first defined of two or three arguments. dfl comes from default. | [
"Pick",
"the",
"first",
"defined",
"of",
"two",
"or",
"three",
"arguments",
".",
"dfl",
"comes",
"from",
"default",
"."
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L27061-L27067 | train |
Reportr/dashboard | public/build/static/application.js | setProjection | function setProjection( element, options ) {
var width = options.width || element.offsetWidth;
var height = options.height || element.offsetHeight;
var projection, path;
if ( options && typeof options.scope === 'undefined') {
options.scope = 'world';
}
if ( options.scope === 'usa' ) {
... | javascript | function setProjection( element, options ) {
var width = options.width || element.offsetWidth;
var height = options.height || element.offsetHeight;
var projection, path;
if ( options && typeof options.scope === 'undefined') {
options.scope = 'world';
}
if ( options.scope === 'usa' ) {
... | [
"function",
"setProjection",
"(",
"element",
",",
"options",
")",
"{",
"var",
"width",
"=",
"options",
".",
"width",
"||",
"element",
".",
"offsetWidth",
";",
"var",
"height",
"=",
"options",
".",
"height",
"||",
"element",
".",
"offsetHeight",
";",
"var",... | setProjection takes the svg element and options | [
"setProjection",
"takes",
"the",
"svg",
"element",
"and",
"options"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L43432-L43455 | train |
Reportr/dashboard | public/build/static/application.js | addLegend | function addLegend(layer, data, options) {
data = data || {};
if ( !this.options.fills ) {
return;
}
var html = '<dl>';
var label = '';
if ( data.legendTitle ) {
html = '<h2>' + data.legendTitle + '</h2>' + html;
}
for ( var fillKey in this.options.fills ) {
if ( fill... | javascript | function addLegend(layer, data, options) {
data = data || {};
if ( !this.options.fills ) {
return;
}
var html = '<dl>';
var label = '';
if ( data.legendTitle ) {
html = '<h2>' + data.legendTitle + '</h2>' + html;
}
for ( var fillKey in this.options.fills ) {
if ( fill... | [
"function",
"addLegend",
"(",
"layer",
",",
"data",
",",
"options",
")",
"{",
"data",
"=",
"data",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"this",
".",
"options",
".",
"fills",
")",
"{",
"return",
";",
"}",
"var",
"html",
"=",
"'<dl>'",
";",
"var",
... | plugin to add a simple map legend | [
"plugin",
"to",
"add",
"a",
"simple",
"map",
"legend"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L43563-L43596 | train |
Reportr/dashboard | public/build/static/application.js | defaults | function defaults(obj) {
Array.prototype.slice.call(arguments, 1).forEach(function(source) {
if (source) {
for (var prop in source) {
if (obj[prop] == null) obj[prop] = source[prop];
}
}
});
return obj;
} | javascript | function defaults(obj) {
Array.prototype.slice.call(arguments, 1).forEach(function(source) {
if (source) {
for (var prop in source) {
if (obj[prop] == null) obj[prop] = source[prop];
}
}
});
return obj;
} | [
"function",
"defaults",
"(",
"obj",
")",
"{",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
".",
"forEach",
"(",
"function",
"(",
"source",
")",
"{",
"if",
"(",
"source",
")",
"{",
"for",
"(",
"var",
"prop",... | stolen from underscore.js | [
"stolen",
"from",
"underscore",
".",
"js"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L43811-L43820 | train |
Reportr/dashboard | public/build/static/application.js | function(data) {
var that = this;
data = data || this.toJSON();
return api.execute("put:report/"+this.get("id"), data)
.then(function(_data) {
that.set(_data);
return that;
});
} | javascript | function(data) {
var that = this;
data = data || this.toJSON();
return api.execute("put:report/"+this.get("id"), data)
.then(function(_data) {
that.set(_data);
return that;
});
} | [
"function",
"(",
"data",
")",
"{",
"var",
"that",
"=",
"this",
";",
"data",
"=",
"data",
"||",
"this",
".",
"toJSON",
"(",
")",
";",
"return",
"api",
".",
"execute",
"(",
"\"put:report/\"",
"+",
"this",
".",
"get",
"(",
"\"id\"",
")",
",",
"data",
... | Update a report | [
"Update",
"a",
"report"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L55720-L55729 | train | |
Reportr/dashboard | public/build/static/application.js | function() {
var that = this;
return api.execute("get:alerts")
.then(function(data) {
console.log("alerts", data);
that.reset(data);
return that;
});
} | javascript | function() {
var that = this;
return api.execute("get:alerts")
.then(function(data) {
console.log("alerts", data);
that.reset(data);
return that;
});
} | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"return",
"api",
".",
"execute",
"(",
"\"get:alerts\"",
")",
".",
"then",
"(",
"function",
"(",
"data",
")",
"{",
"console",
".",
"log",
"(",
"\"alerts\"",
",",
"data",
")",
";",
"that",
"... | Load all alerts | [
"Load",
"all",
"alerts"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L55893-L55902 | train | |
Reportr/dashboard | public/build/static/application.js | function(r) {
r = r.toJSON? r.toJSON() : r;
this.report.del("visualizations", { silent: true });
this.report.set(r);
hr.History.navigate("report/"+this.report.get("id"));
} | javascript | function(r) {
r = r.toJSON? r.toJSON() : r;
this.report.del("visualizations", { silent: true });
this.report.set(r);
hr.History.navigate("report/"+this.report.get("id"));
} | [
"function",
"(",
"r",
")",
"{",
"r",
"=",
"r",
".",
"toJSON",
"?",
"r",
".",
"toJSON",
"(",
")",
":",
"r",
";",
"this",
".",
"report",
".",
"del",
"(",
"\"visualizations\"",
",",
"{",
"silent",
":",
"true",
"}",
")",
";",
"this",
".",
"report",... | Set active report | [
"Set",
"active",
"report"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L56542-L56548 | train | |
Reportr/dashboard | public/build/static/application.js | function() {
var that = this;
return that.reports.loadAll()
.then(function() {
return dialogs.select(
i18n.t("reports.select.title"),
i18n.t("reports.select.message"),
_.object(that.reports.map(function(r) {... | javascript | function() {
var that = this;
return that.reports.loadAll()
.then(function() {
return dialogs.select(
i18n.t("reports.select.title"),
i18n.t("reports.select.message"),
_.object(that.reports.map(function(r) {... | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"return",
"that",
".",
"reports",
".",
"loadAll",
"(",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"dialogs",
".",
"select",
"(",
"i18n",
".",
"t",
"(",
"\"reports.select.tit... | Change current report | [
"Change",
"current",
"report"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L56551-L56571 | train | |
Reportr/dashboard | public/build/static/application.js | function() {
var that = this;
return dialogs.fields(i18n.t("reports.create.title"), {
"title": {
label: i18n.t("reports.create.fields.title"),
type: "text"
}
})
.then(function(args) {
... | javascript | function() {
var that = this;
return dialogs.fields(i18n.t("reports.create.title"), {
"title": {
label: i18n.t("reports.create.fields.title"),
type: "text"
}
})
.then(function(args) {
... | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"return",
"dialogs",
".",
"fields",
"(",
"i18n",
".",
"t",
"(",
"\"reports.create.title\"",
")",
",",
"{",
"\"title\"",
":",
"{",
"label",
":",
"i18n",
".",
"t",
"(",
"\"reports.create.fields.ti... | Create a new report | [
"Create",
"a",
"new",
"report"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L56574-L56586 | train | |
Reportr/dashboard | public/build/static/application.js | function() {
var that = this;
return dialogs.fields(i18n.t("reports.edit.title"), {
"title": {
label: i18n.t("reports.edit.fields.title"),
type: "text"
}
}, this.report.toJSON())
.then(function(data) ... | javascript | function() {
var that = this;
return dialogs.fields(i18n.t("reports.edit.title"), {
"title": {
label: i18n.t("reports.edit.fields.title"),
type: "text"
}
}, this.report.toJSON())
.then(function(data) ... | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"return",
"dialogs",
".",
"fields",
"(",
"i18n",
".",
"t",
"(",
"\"reports.edit.title\"",
")",
",",
"{",
"\"title\"",
":",
"{",
"label",
":",
"i18n",
".",
"t",
"(",
"\"reports.edit.fields.title\... | Edit current report | [
"Edit",
"current",
"report"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L56589-L56600 | train | |
Reportr/dashboard | public/build/static/application.js | function() {
var that = this;
return dialogs.confirm(i18n.t("reports.remove.title"))
.then(function() {
return that.report.remove();
})
.then(function() {
that.report.clear();
return that.reports.loadAll();
... | javascript | function() {
var that = this;
return dialogs.confirm(i18n.t("reports.remove.title"))
.then(function() {
return that.report.remove();
})
.then(function() {
that.report.clear();
return that.reports.loadAll();
... | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"return",
"dialogs",
".",
"confirm",
"(",
"i18n",
".",
"t",
"(",
"\"reports.remove.title\"",
")",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"that",
".",
"report",
".",
"rem... | Remove current report | [
"Remove",
"current",
"report"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L56603-L56618 | train | |
Reportr/dashboard | public/build/static/application.js | function() {
var that = this;
return api.execute("get:types")
.then(function(types) {
return dialogs.fields(i18n.t("visualization.create.title"), {
"eventName": {
'label': i18n.t("visualization.create.fields.eventName"),
... | javascript | function() {
var that = this;
return api.execute("get:types")
.then(function(types) {
return dialogs.fields(i18n.t("visualization.create.title"), {
"eventName": {
'label': i18n.t("visualization.create.fields.eventName"),
... | [
"function",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"return",
"api",
".",
"execute",
"(",
"\"get:types\"",
")",
".",
"then",
"(",
"function",
"(",
"types",
")",
"{",
"return",
"dialogs",
".",
"fields",
"(",
"i18n",
".",
"t",
"(",
"\"visualiza... | Create a new visualization | [
"Create",
"a",
"new",
"visualization"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L56621-L56657 | train | |
Reportr/dashboard | public/build/static/application.js | function(e) {
if (e) e.preventDefault();
var that = this;
return api.execute("get:types")
.fail(dialogs.error)
.then(function(events) {
return dialogs.fields(i18n.t("alerts.create.title"), {
"title": {
... | javascript | function(e) {
if (e) e.preventDefault();
var that = this;
return api.execute("get:types")
.fail(dialogs.error)
.then(function(events) {
return dialogs.fields(i18n.t("alerts.create.title"), {
"title": {
... | [
"function",
"(",
"e",
")",
"{",
"if",
"(",
"e",
")",
"e",
".",
"preventDefault",
"(",
")",
";",
"var",
"that",
"=",
"this",
";",
"return",
"api",
".",
"execute",
"(",
"\"get:types\"",
")",
".",
"fail",
"(",
"dialogs",
".",
"error",
")",
".",
"the... | Create an alert | [
"Create",
"an",
"alert"
] | bff0ea7f324de78ab8bf8c4301ce30696ad7d960 | https://github.com/Reportr/dashboard/blob/bff0ea7f324de78ab8bf8c4301ce30696ad7d960/public/build/static/application.js#L56672-L56729 | train | |
APIDevTools/swagger-cli | bin/swagger-cli.js | parseArgs | function parseArgs () {
// Configure the argument parser
yargs
.option("schema", {
type: "boolean",
default: true,
})
.option("spec", {
type: "boolean",
default: true,
})
.option("o", {
alias: "outfile",
type: "string",
normalize: true,
})
.optio... | javascript | function parseArgs () {
// Configure the argument parser
yargs
.option("schema", {
type: "boolean",
default: true,
})
.option("spec", {
type: "boolean",
default: true,
})
.option("o", {
alias: "outfile",
type: "string",
normalize: true,
})
.optio... | [
"function",
"parseArgs",
"(",
")",
"{",
"// Configure the argument parser",
"yargs",
".",
"option",
"(",
"\"schema\"",
",",
"{",
"type",
":",
"\"boolean\"",
",",
"default",
":",
"true",
",",
"}",
")",
".",
"option",
"(",
"\"spec\"",
",",
"{",
"type",
":",
... | Parses the command-line arguments
@returns {object} - The parsed arguments | [
"Parses",
"the",
"command",
"-",
"line",
"arguments"
] | e3cc39e223e2e5dcb92128447d297649ca338076 | https://github.com/APIDevTools/swagger-cli/blob/e3cc39e223e2e5dcb92128447d297649ca338076/bin/swagger-cli.js#L56-L134 | train |
APIDevTools/swagger-cli | bin/swagger-cli.js | bundle | function bundle (file, options) {
api.bundle(file, options)
.then((bundled) => {
if (options.outfile) {
console.log("Created %s from %s", options.outfile, file);
}
else {
// Write the bundled API to stdout
console.log(bundled);
}
})
.catch(errorHandler);
} | javascript | function bundle (file, options) {
api.bundle(file, options)
.then((bundled) => {
if (options.outfile) {
console.log("Created %s from %s", options.outfile, file);
}
else {
// Write the bundled API to stdout
console.log(bundled);
}
})
.catch(errorHandler);
} | [
"function",
"bundle",
"(",
"file",
",",
"options",
")",
"{",
"api",
".",
"bundle",
"(",
"file",
",",
"options",
")",
".",
"then",
"(",
"(",
"bundled",
")",
"=>",
"{",
"if",
"(",
"options",
".",
"outfile",
")",
"{",
"console",
".",
"log",
"(",
"\"... | Bundles a multi-file API definition
@param {string} file - The path of the file to validate
@param {object} options - Validation options | [
"Bundles",
"a",
"multi",
"-",
"file",
"API",
"definition"
] | e3cc39e223e2e5dcb92128447d297649ca338076 | https://github.com/APIDevTools/swagger-cli/blob/e3cc39e223e2e5dcb92128447d297649ca338076/bin/swagger-cli.js#L160-L172 | train |
APIDevTools/swagger-cli | bin/swagger-cli.js | errorHandler | function errorHandler (err) {
let errorMessage = process.env.DEBUG ? err.stack : err.message;
console.error(chalk.red(errorMessage));
process.exit(1);
} | javascript | function errorHandler (err) {
let errorMessage = process.env.DEBUG ? err.stack : err.message;
console.error(chalk.red(errorMessage));
process.exit(1);
} | [
"function",
"errorHandler",
"(",
"err",
")",
"{",
"let",
"errorMessage",
"=",
"process",
".",
"env",
".",
"DEBUG",
"?",
"err",
".",
"stack",
":",
"err",
".",
"message",
";",
"console",
".",
"error",
"(",
"chalk",
".",
"red",
"(",
"errorMessage",
")",
... | Writes error information to stderr and exits with a non-zero code
@param {Error} err | [
"Writes",
"error",
"information",
"to",
"stderr",
"and",
"exits",
"with",
"a",
"non",
"-",
"zero",
"code"
] | e3cc39e223e2e5dcb92128447d297649ca338076 | https://github.com/APIDevTools/swagger-cli/blob/e3cc39e223e2e5dcb92128447d297649ca338076/bin/swagger-cli.js#L192-L196 | train |
APIDevTools/swagger-cli | lib/bundle.js | toYAML | function toYAML (api, spaces, wrap) {
const jsYaml = require("js-yaml");
return jsYaml.dump(api, {
indent: spaces,
lineWidth: wrap,
noRefs: true
});
} | javascript | function toYAML (api, spaces, wrap) {
const jsYaml = require("js-yaml");
return jsYaml.dump(api, {
indent: spaces,
lineWidth: wrap,
noRefs: true
});
} | [
"function",
"toYAML",
"(",
"api",
",",
"spaces",
",",
"wrap",
")",
"{",
"const",
"jsYaml",
"=",
"require",
"(",
"\"js-yaml\"",
")",
";",
"return",
"jsYaml",
".",
"dump",
"(",
"api",
",",
"{",
"indent",
":",
"spaces",
",",
"lineWidth",
":",
"wrap",
",... | Serializes the given API as YAML, using the given spaces for formatting.
@param {object} api API to convert to YAML
@param {string|number} spaces number of spaces to ident
@param {number} wrap the column to word-wrap at | [
"Serializes",
"the",
"given",
"API",
"as",
"YAML",
"using",
"the",
"given",
"spaces",
"for",
"formatting",
"."
] | e3cc39e223e2e5dcb92128447d297649ca338076 | https://github.com/APIDevTools/swagger-cli/blob/e3cc39e223e2e5dcb92128447d297649ca338076/lib/bundle.js#L91-L99 | train |
ethul/purs-loader | src/to-javascript.js | makeBundleJS | function makeBundleJS(psModule) {
const bundleOutput = psModule.options.bundleOutput;
const name = psModule.name;
const srcDir = psModule.srcDir;
const escaped = jsStringEscape(path.relative(srcDir, bundleOutput));
const result = `module.exports = require("${escaped}")["${name}"]`;
return Promise.resol... | javascript | function makeBundleJS(psModule) {
const bundleOutput = psModule.options.bundleOutput;
const name = psModule.name;
const srcDir = psModule.srcDir;
const escaped = jsStringEscape(path.relative(srcDir, bundleOutput));
const result = `module.exports = require("${escaped}")["${name}"]`;
return Promise.resol... | [
"function",
"makeBundleJS",
"(",
"psModule",
")",
"{",
"const",
"bundleOutput",
"=",
"psModule",
".",
"options",
".",
"bundleOutput",
";",
"const",
"name",
"=",
"psModule",
".",
"name",
";",
"const",
"srcDir",
"=",
"psModule",
".",
"srcDir",
";",
"const",
... | Reference the bundle. | [
"Reference",
"the",
"bundle",
"."
] | f5a2abb1da6068203698255c123f097979443b6b | https://github.com/ethul/purs-loader/blob/f5a2abb1da6068203698255c123f097979443b6b/src/to-javascript.js#L51-L63 | train |
ethul/purs-loader | src/to-javascript.js | makeJS | function makeJS(psModule, psModuleMap, js) {
const requireRE = /require\(['"]\.\.\/([\w\.]+)(?:\/index\.js)?['"]\)/g;
const foreignRE = /require\(['"]\.\/foreign(?:\.js)?['"]\)/g;
const name = psModule.name;
const imports = psModuleMap[name].imports;
var replacedImports = [];
const result = js
.rep... | javascript | function makeJS(psModule, psModuleMap, js) {
const requireRE = /require\(['"]\.\.\/([\w\.]+)(?:\/index\.js)?['"]\)/g;
const foreignRE = /require\(['"]\.\/foreign(?:\.js)?['"]\)/g;
const name = psModule.name;
const imports = psModuleMap[name].imports;
var replacedImports = [];
const result = js
.rep... | [
"function",
"makeJS",
"(",
"psModule",
",",
"psModuleMap",
",",
"js",
")",
"{",
"const",
"requireRE",
"=",
"/",
"require\\(['\"]\\.\\.\\/([\\w\\.]+)(?:\\/index\\.js)?['\"]\\)",
"/",
"g",
";",
"const",
"foreignRE",
"=",
"/",
"require\\(['\"]\\.\\/foreign(?:\\.js)?['\"]\\)"... | Replace require paths to output files generated by psc with paths to purescript sources, which are then also run through this loader. Additionally, the imports replaced are tracked so that in the event the compiler fails to compile the PureScript source, we can tack on any new imports in order to allow webpack to watch... | [
"Replace",
"require",
"paths",
"to",
"output",
"files",
"generated",
"by",
"psc",
"with",
"paths",
"to",
"purescript",
"sources",
"which",
"are",
"then",
"also",
"run",
"through",
"this",
"loader",
".",
"Additionally",
"the",
"imports",
"replaced",
"are",
"tra... | f5a2abb1da6068203698255c123f097979443b6b | https://github.com/ethul/purs-loader/blob/f5a2abb1da6068203698255c123f097979443b6b/src/to-javascript.js#L71-L135 | train |
nolimits4web/dom7 | dist/dom7.module.js | addClass | function addClass(className) {
if (typeof className === 'undefined') {
return this;
}
const classes = className.split(' ');
for (let i = 0; i < classes.length; i += 1) {
for (let j = 0; j < this.length; j += 1) {
if (typeof this[j] !== 'undefined' && typeof this[j].classList !== 'undefined') this[... | javascript | function addClass(className) {
if (typeof className === 'undefined') {
return this;
}
const classes = className.split(' ');
for (let i = 0; i < classes.length; i += 1) {
for (let j = 0; j < this.length; j += 1) {
if (typeof this[j] !== 'undefined' && typeof this[j].classList !== 'undefined') this[... | [
"function",
"addClass",
"(",
"className",
")",
"{",
"if",
"(",
"typeof",
"className",
"===",
"'undefined'",
")",
"{",
"return",
"this",
";",
"}",
"const",
"classes",
"=",
"className",
".",
"split",
"(",
"' '",
")",
";",
"for",
"(",
"let",
"i",
"=",
"... | Classes and attributes | [
"Classes",
"and",
"attributes"
] | 28b0db30d77fa765ccae9497a2f0e3dfbc2cf55f | https://github.com/nolimits4web/dom7/blob/28b0db30d77fa765ccae9497a2f0e3dfbc2cf55f/dist/dom7.module.js#L107-L118 | train |
nolimits4web/dom7 | dist/dom7.module.js | transform | function transform(transform) {
for (let i = 0; i < this.length; i += 1) {
const elStyle = this[i].style;
elStyle.webkitTransform = transform;
elStyle.transform = transform;
}
return this;
} | javascript | function transform(transform) {
for (let i = 0; i < this.length; i += 1) {
const elStyle = this[i].style;
elStyle.webkitTransform = transform;
elStyle.transform = transform;
}
return this;
} | [
"function",
"transform",
"(",
"transform",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"length",
";",
"i",
"+=",
"1",
")",
"{",
"const",
"elStyle",
"=",
"this",
"[",
"i",
"]",
".",
"style",
";",
"elStyle",
".",
"webk... | Transforms eslint-disable-next-line | [
"Transforms",
"eslint",
"-",
"disable",
"-",
"next",
"-",
"line"
] | 28b0db30d77fa765ccae9497a2f0e3dfbc2cf55f | https://github.com/nolimits4web/dom7/blob/28b0db30d77fa765ccae9497a2f0e3dfbc2cf55f/dist/dom7.module.js#L285-L292 | train |
nolimits4web/dom7 | dist/dom7.module.js | each | function each(callback) {
// Don't bother continuing without a callback
if (!callback) return this;
// Iterate over the current collection
for (let i = 0; i < this.length; i += 1) {
// If the callback returns false
if (callback.call(this[i], i, this[i]) === false) {
// End the loop early
ret... | javascript | function each(callback) {
// Don't bother continuing without a callback
if (!callback) return this;
// Iterate over the current collection
for (let i = 0; i < this.length; i += 1) {
// If the callback returns false
if (callback.call(this[i], i, this[i]) === false) {
// End the loop early
ret... | [
"function",
"each",
"(",
"callback",
")",
"{",
"// Don't bother continuing without a callback",
"if",
"(",
"!",
"callback",
")",
"return",
"this",
";",
"// Iterate over the current collection",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"lengt... | Iterate over the collection passing elements to `callback` | [
"Iterate",
"over",
"the",
"collection",
"passing",
"elements",
"to",
"callback"
] | 28b0db30d77fa765ccae9497a2f0e3dfbc2cf55f | https://github.com/nolimits4web/dom7/blob/28b0db30d77fa765ccae9497a2f0e3dfbc2cf55f/dist/dom7.module.js#L604-L617 | train |
bitovi/funcunit | site/examples/todo/js/todos/todos.js | function (el, e) {
var value = can.trim(el.val());
if (e.keyCode === ENTER_KEY && value !== '') {
new Models.Todo({
text : value,
complete : false
}).save(function () {
el.val('');
});
}
} | javascript | function (el, e) {
var value = can.trim(el.val());
if (e.keyCode === ENTER_KEY && value !== '') {
new Models.Todo({
text : value,
complete : false
}).save(function () {
el.val('');
});
}
} | [
"function",
"(",
"el",
",",
"e",
")",
"{",
"var",
"value",
"=",
"can",
".",
"trim",
"(",
"el",
".",
"val",
"(",
")",
")",
";",
"if",
"(",
"e",
".",
"keyCode",
"===",
"ENTER_KEY",
"&&",
"value",
"!==",
"''",
")",
"{",
"new",
"Models",
".",
"To... | Listen for when a new Todo has been entered | [
"Listen",
"for",
"when",
"a",
"new",
"Todo",
"has",
"been",
"entered"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/todos/todos.js#L19-L29 | train | |
bitovi/funcunit | site/examples/todo/js/todos/todos.js | function (list, e, item) {
this.options.todos.push(item);
// Reset the filter so that you always see your new todo
this.options.state.attr('filter', '');
} | javascript | function (list, e, item) {
this.options.todos.push(item);
// Reset the filter so that you always see your new todo
this.options.state.attr('filter', '');
} | [
"function",
"(",
"list",
",",
"e",
",",
"item",
")",
"{",
"this",
".",
"options",
".",
"todos",
".",
"push",
"(",
"item",
")",
";",
"// Reset the filter so that you always see your new todo",
"this",
".",
"options",
".",
"state",
".",
"attr",
"(",
"'filter'"... | Handle a newly created Todo | [
"Handle",
"a",
"newly",
"created",
"Todo"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/todos/todos.js#L32-L36 | train | |
bitovi/funcunit | site/examples/todo/js/todos/todos.js | function () {
// Remove the `selected` class from the old link and add it to the link for the current location hash
this.element.find('#filters').find('a').removeClass('selected')
.end().find('[href="' + window.location.hash + '"]').addClass('selected');
} | javascript | function () {
// Remove the `selected` class from the old link and add it to the link for the current location hash
this.element.find('#filters').find('a').removeClass('selected')
.end().find('[href="' + window.location.hash + '"]').addClass('selected');
} | [
"function",
"(",
")",
"{",
"// Remove the `selected` class from the old link and add it to the link for the current location hash",
"this",
".",
"element",
".",
"find",
"(",
"'#filters'",
")",
".",
"find",
"(",
"'a'",
")",
".",
"removeClass",
"(",
"'selected'",
")",
"."... | Listener for when the route changes | [
"Listener",
"for",
"when",
"the",
"route",
"changes"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/todos/todos.js#L39-L43 | train | |
bitovi/funcunit | site/examples/todo/js/todos/todos.js | function (el) {
var value = can.trim(el.val()),
todo = el.closest('.todo').data('todo');
// If we don't have a todo we don't need to do anything
if (!todo) {
return;
}
if (value === '') {
todo.destroy();
} else {
todo.attr({
editing : false,
text : value
}).save();
}... | javascript | function (el) {
var value = can.trim(el.val()),
todo = el.closest('.todo').data('todo');
// If we don't have a todo we don't need to do anything
if (!todo) {
return;
}
if (value === '') {
todo.destroy();
} else {
todo.attr({
editing : false,
text : value
}).save();
}... | [
"function",
"(",
"el",
")",
"{",
"var",
"value",
"=",
"can",
".",
"trim",
"(",
"el",
".",
"val",
"(",
")",
")",
",",
"todo",
"=",
"el",
".",
"closest",
"(",
"'.todo'",
")",
".",
"data",
"(",
"'todo'",
")",
";",
"// If we don't have a todo we don't ne... | Update a todo | [
"Update",
"a",
"todo"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/todos/todos.js#L53-L70 | train | |
bitovi/funcunit | site/examples/todo/js/todos/todos.js | function (el) {
var toggle = el.prop('checked');
can.each(this.options.todos, function (todo) {
todo.attr('complete', toggle).save();
});
} | javascript | function (el) {
var toggle = el.prop('checked');
can.each(this.options.todos, function (todo) {
todo.attr('complete', toggle).save();
});
} | [
"function",
"(",
"el",
")",
"{",
"var",
"toggle",
"=",
"el",
".",
"prop",
"(",
"'checked'",
")",
";",
"can",
".",
"each",
"(",
"this",
".",
"options",
".",
"todos",
",",
"function",
"(",
"todo",
")",
"{",
"todo",
".",
"attr",
"(",
"'complete'",
"... | Listen for toggle all completed Todos | [
"Listen",
"for",
"toggle",
"all",
"completed",
"Todos"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/todos/todos.js#L94-L99 | train | |
bitovi/funcunit | site/examples/todo/js/todos/todos.js | function () {
for (var i = this.options.todos.length - 1, todo; i > -1 && (todo = this.options.todos[i]); i--) {
if (todo.attr('complete')) {
todo.destroy();
}
}
} | javascript | function () {
for (var i = this.options.todos.length - 1, todo; i > -1 && (todo = this.options.todos[i]); i--) {
if (todo.attr('complete')) {
todo.destroy();
}
}
} | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"this",
".",
"options",
".",
"todos",
".",
"length",
"-",
"1",
",",
"todo",
";",
"i",
">",
"-",
"1",
"&&",
"(",
"todo",
"=",
"this",
".",
"options",
".",
"todos",
"[",
"i",
"]",
")",
"... | Listen for removing all completed Todos | [
"Listen",
"for",
"removing",
"all",
"completed",
"Todos"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/todos/todos.js#L102-L108 | train | |
bitovi/funcunit | site/examples/resources/funcunit.js | function( type, options, element ) {
options || (options = {});
var create = Syn.create,
setup = create[type] && create[type].setup,
kind = key.test(type) ? 'key' : (page.test(type) ? "page" : "mouse"),
createType = create[type] || {},
createKind = create[kind],
event, ret, autoPrevent, dispa... | javascript | function( type, options, element ) {
options || (options = {});
var create = Syn.create,
setup = create[type] && create[type].setup,
kind = key.test(type) ? 'key' : (page.test(type) ? "page" : "mouse"),
createType = create[type] || {},
createKind = create[kind],
event, ret, autoPrevent, dispa... | [
"function",
"(",
"type",
",",
"options",
",",
"element",
")",
"{",
"options",
"||",
"(",
"options",
"=",
"{",
"}",
")",
";",
"var",
"create",
"=",
"Syn",
".",
"create",
",",
"setup",
"=",
"create",
"[",
"type",
"]",
"&&",
"create",
"[",
"type",
"... | Creates a synthetic event and dispatches it on the element.
This will run any default actions for the element.
Typically you want to use Syn, but if you want the return value, use this.
@param {String} type
@param {Object} options
@param {HTMLElement} element
@return {Boolean} true if default events were run, false if ... | [
"Creates",
"a",
"synthetic",
"event",
"and",
"dispatches",
"it",
"on",
"the",
"element",
".",
"This",
"will",
"run",
"any",
"default",
"actions",
"for",
"the",
"element",
".",
"Typically",
"you",
"want",
"to",
"use",
"Syn",
"but",
"if",
"you",
"want",
"t... | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/resources/funcunit.js#L608-L644 | train | |
bitovi/funcunit | site/examples/resources/funcunit.js | function( type, options, element ) {
//check if options is character or has character
options = typeof options != "object" ? {
character: options
} : options;
//don't change the orignial
options = h.extend({}, options)
if ( options.character ) {
h.extend(options, Syn.key.options(optio... | javascript | function( type, options, element ) {
//check if options is character or has character
options = typeof options != "object" ? {
character: options
} : options;
//don't change the orignial
options = h.extend({}, options)
if ( options.character ) {
h.extend(options, Syn.key.options(optio... | [
"function",
"(",
"type",
",",
"options",
",",
"element",
")",
"{",
"//check if options is character or has character",
"options",
"=",
"typeof",
"options",
"!=",
"\"object\"",
"?",
"{",
"character",
":",
"options",
"}",
":",
"options",
";",
"//don't change the orign... | return the options for a key event | [
"return",
"the",
"options",
"for",
"a",
"key",
"event"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/resources/funcunit.js#L1951-L1972 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function (elems, context) {
var oldFragment = $.buildFragment,
ret;
elems = [elems];
// Set context per 1.8 logic
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument ... | javascript | function (elems, context) {
var oldFragment = $.buildFragment,
ret;
elems = [elems];
// Set context per 1.8 logic
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument ... | [
"function",
"(",
"elems",
",",
"context",
")",
"{",
"var",
"oldFragment",
"=",
"$",
".",
"buildFragment",
",",
"ret",
";",
"elems",
"=",
"[",
"elems",
"]",
";",
"// Set context per 1.8 logic",
"context",
"=",
"context",
"||",
"document",
";",
"context",
"=... | jquery caches fragments, we always needs a new one | [
"jquery",
"caches",
"fragments",
"we",
"always",
"needs",
"a",
"new",
"one"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L74-L87 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function (content) {
// Convert bad values into empty strings
var isInvalid = content === null || content === undefined || (isNaN(content) && ("" + content === 'NaN'));
return ("" + (isInvalid ? '' : content)).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace... | javascript | function (content) {
// Convert bad values into empty strings
var isInvalid = content === null || content === undefined || (isNaN(content) && ("" + content === 'NaN'));
return ("" + (isInvalid ? '' : content)).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace... | [
"function",
"(",
"content",
")",
"{",
"// Convert bad values into empty strings",
"var",
"isInvalid",
"=",
"content",
"===",
"null",
"||",
"content",
"===",
"undefined",
"||",
"(",
"isNaN",
"(",
"content",
")",
"&&",
"(",
"\"\"",
"+",
"content",
"===",
"'NaN'"... | Escapes strings for HTML. | [
"Escapes",
"strings",
"for",
"HTML",
"."
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L149-L153 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function (s) {
return s.replace(strColons, '/').replace(strWords, '$1_$2').replace(strLowUp, '$1_$2').replace(strDash, '_').toLowerCase();
} | javascript | function (s) {
return s.replace(strColons, '/').replace(strWords, '$1_$2').replace(strLowUp, '$1_$2').replace(strDash, '_').toLowerCase();
} | [
"function",
"(",
"s",
")",
"{",
"return",
"s",
".",
"replace",
"(",
"strColons",
",",
"'/'",
")",
".",
"replace",
"(",
"strWords",
",",
"'$1_$2'",
")",
".",
"replace",
"(",
"strLowUp",
",",
"'$1_$2'",
")",
".",
"replace",
"(",
"strDash",
",",
"'_'",
... | Underscores a string. | [
"Underscores",
"a",
"string",
"."
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L208-L210 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function (str, data, remove) {
var obs = [];
obs.push(str.replace(strReplacer, function (whole, inside) {
// Convert inside to type.
var ob = can.getObject(inside, data, remove === undefined ? remove : !remove);
if (ob === undefined) {
... | javascript | function (str, data, remove) {
var obs = [];
obs.push(str.replace(strReplacer, function (whole, inside) {
// Convert inside to type.
var ob = can.getObject(inside, data, remove === undefined ? remove : !remove);
if (ob === undefined) {
... | [
"function",
"(",
"str",
",",
"data",
",",
"remove",
")",
"{",
"var",
"obs",
"=",
"[",
"]",
";",
"obs",
".",
"push",
"(",
"str",
".",
"replace",
"(",
"strReplacer",
",",
"function",
"(",
"whole",
",",
"inside",
")",
"{",
"// Convert inside to type.",
... | Micro-templating. | [
"Micro",
"-",
"templating",
"."
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L212-L235 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function (result) {
var frag = can.buildFragment(result, document.body);
// If we have an empty frag...
if (!frag.childNodes.length) {
frag.appendChild(document.createTextNode(''));
}
return frag;
} | javascript | function (result) {
var frag = can.buildFragment(result, document.body);
// If we have an empty frag...
if (!frag.childNodes.length) {
frag.appendChild(document.createTextNode(''));
}
return frag;
} | [
"function",
"(",
"result",
")",
"{",
"var",
"frag",
"=",
"can",
".",
"buildFragment",
"(",
"result",
",",
"document",
".",
"body",
")",
";",
"// If we have an empty frag...",
"if",
"(",
"!",
"frag",
".",
"childNodes",
".",
"length",
")",
"{",
"frag",
"."... | simply creates a frag this is used internally to create a frag insert it then hook it up | [
"simply",
"creates",
"a",
"frag",
"this",
"is",
"used",
"internally",
"to",
"create",
"a",
"frag",
"insert",
"it",
"then",
"hook",
"it",
"up"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L2194-L2201 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function (src) {
return can.map(src.toString().split(/\/|\./g), function (part) {
// Dont include empty strings in toId functions
if (part) {
return part;
}
}).join("_");
} | javascript | function (src) {
return can.map(src.toString().split(/\/|\./g), function (part) {
// Dont include empty strings in toId functions
if (part) {
return part;
}
}).join("_");
} | [
"function",
"(",
"src",
")",
"{",
"return",
"can",
".",
"map",
"(",
"src",
".",
"toString",
"(",
")",
".",
"split",
"(",
"/",
"\\/|\\.",
"/",
"g",
")",
",",
"function",
"(",
"part",
")",
"{",
"// Dont include empty strings in toId functions",
"if",
"(",
... | Convert a path like string into something that's ok for an `element` ID. | [
"Convert",
"a",
"path",
"like",
"string",
"into",
"something",
"that",
"s",
"ok",
"for",
"an",
"element",
"ID",
"."
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L2204-L2211 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function (url, async) {
var suffix = url.match(/\.[\w\d]+$/),
type,
// If we are reading a script element for the content of the template,
// `el` will be set to that script element.
el,
// A unique identifier for the view (used... | javascript | function (url, async) {
var suffix = url.match(/\.[\w\d]+$/),
type,
// If we are reading a script element for the content of the template,
// `el` will be set to that script element.
el,
// A unique identifier for the view (used... | [
"function",
"(",
"url",
",",
"async",
")",
"{",
"var",
"suffix",
"=",
"url",
".",
"match",
"(",
"/",
"\\.[\\w\\d]+$",
"/",
")",
",",
"type",
",",
"// If we are reading a script element for the content of the template,",
"// `el` will be set to that script element.",
"el... | Makes sure there's a template, if not, have `steal` provide a warning. | [
"Makes",
"sure",
"there",
"s",
"a",
"template",
"if",
"not",
"have",
"steal",
"provide",
"a",
"warning",
"."
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L2398-L2472 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function () {
for (var name in observing) {
var ob = observing[name];
ob.observe.obj.unbind(ob.observe.attr, onchanged);
delete observing[name];
}
} | javascript | function () {
for (var name in observing) {
var ob = observing[name];
ob.observe.obj.unbind(ob.observe.attr, onchanged);
delete observing[name];
}
} | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"name",
"in",
"observing",
")",
"{",
"var",
"ob",
"=",
"observing",
"[",
"name",
"]",
";",
"ob",
".",
"observe",
".",
"obj",
".",
"unbind",
"(",
"ob",
".",
"observe",
".",
"attr",
",",
"onchanged",
")... | a teardown method that stops listening | [
"a",
"teardown",
"method",
"that",
"stops",
"listening"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L2592-L2598 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function (ev) {
// If the compute is no longer bound (because the same change event led to an unbind)
// then do not call getValueAndBind, or we will leak bindings.
if (computeState && !computeState.bound) {
return;
}
if... | javascript | function (ev) {
// If the compute is no longer bound (because the same change event led to an unbind)
// then do not call getValueAndBind, or we will leak bindings.
if (computeState && !computeState.bound) {
return;
}
if... | [
"function",
"(",
"ev",
")",
"{",
"// If the compute is no longer bound (because the same change event led to an unbind)",
"// then do not call getValueAndBind, or we will leak bindings.",
"if",
"(",
"computeState",
"&&",
"!",
"computeState",
".",
"bound",
")",
"{",
"return",
";",... | when a property value is changed | [
"when",
"a",
"property",
"value",
"is",
"changed"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L2603-L2624 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function () {
var info = getValueAndObserved(getterSetter, context),
newObserveSet = info.observed;
var value = info.value;
matched = !matched;
// go through every attribute read by this observe
can.each(newObserveSet,... | javascript | function () {
var info = getValueAndObserved(getterSetter, context),
newObserveSet = info.observed;
var value = info.value;
matched = !matched;
// go through every attribute read by this observe
can.each(newObserveSet,... | [
"function",
"(",
")",
"{",
"var",
"info",
"=",
"getValueAndObserved",
"(",
"getterSetter",
",",
"context",
")",
",",
"newObserveSet",
"=",
"info",
".",
"observed",
";",
"var",
"value",
"=",
"info",
".",
"value",
";",
"matched",
"=",
"!",
"matched",
";",
... | gets the value returned by `getterSetter` and also binds to any attributes read by the call | [
"gets",
"the",
"value",
"returned",
"by",
"getterSetter",
"and",
"also",
"binds",
"to",
"any",
"attributes",
"read",
"by",
"the",
"call"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L2628-L2661 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function (el, parentNode) {
// updates the text of the text node
update = function (newVal) {
node.nodeValue = "" + newVal;
teardownCheck(node.parentNode);
};
var parent = getParentNode(el, p... | javascript | function (el, parentNode) {
// updates the text of the text node
update = function (newVal) {
node.nodeValue = "" + newVal;
teardownCheck(node.parentNode);
};
var parent = getParentNode(el, p... | [
"function",
"(",
"el",
",",
"parentNode",
")",
"{",
"// updates the text of the text node",
"update",
"=",
"function",
"(",
"newVal",
")",
"{",
"node",
".",
"nodeValue",
"=",
"\"\"",
"+",
"newVal",
";",
"teardownCheck",
"(",
"node",
".",
"parentNode",
")",
"... | If we are escaping, replace the parentNode with a text node who's value is `func`'s return value. | [
"If",
"we",
"are",
"escaping",
"replace",
"the",
"parentNode",
"with",
"a",
"text",
"node",
"who",
"s",
"value",
"is",
"func",
"s",
"return",
"value",
"."
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L3433-L3456 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function (span, parentNode) {
// updates the elements with the new content
update = function (newVal) {
// is this still part of the DOM?
var attached = nodes[0].parentNode;
// update the nodes in the DOM wit... | javascript | function (span, parentNode) {
// updates the elements with the new content
update = function (newVal) {
// is this still part of the DOM?
var attached = nodes[0].parentNode;
// update the nodes in the DOM wit... | [
"function",
"(",
"span",
",",
"parentNode",
")",
"{",
"// updates the elements with the new content",
"update",
"=",
"function",
"(",
"newVal",
")",
"{",
"// is this still part of the DOM?",
"var",
"attached",
"=",
"nodes",
"[",
"0",
"]",
".",
"parentNode",
";",
"... | If we are not escaping, replace the parentNode with a documentFragment created as with `func`'s return value. | [
"If",
"we",
"are",
"not",
"escaping",
"replace",
"the",
"parentNode",
"with",
"a",
"documentFragment",
"created",
"as",
"with",
"func",
"s",
"return",
"value",
"."
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L3461-L3516 | train | |
bitovi/funcunit | site/examples/todo/js/lib/canjs/can.jquery.js | function (val) {
// create the fragment, but don't hook it up
// we need to insert it into the document first
var frag = can.view.frag(val, parentNode),
// keep a reference to each node
newNod... | javascript | function (val) {
// create the fragment, but don't hook it up
// we need to insert it into the document first
var frag = can.view.frag(val, parentNode),
// keep a reference to each node
newNod... | [
"function",
"(",
"val",
")",
"{",
"// create the fragment, but don't hook it up",
"// we need to insert it into the document first",
"var",
"frag",
"=",
"can",
".",
"view",
".",
"frag",
"(",
"val",
",",
"parentNode",
")",
",",
"// keep a reference to each node",
"newNodes... | A helper function to manage inserting the contents and removing the old contents | [
"A",
"helper",
"function",
"to",
"manage",
"inserting",
"the",
"contents",
"and",
"removing",
"the",
"old",
"contents"
] | 6c0056bed585927c76c3a22c0f482adb48b0fde2 | https://github.com/bitovi/funcunit/blob/6c0056bed585927c76c3a22c0f482adb48b0fde2/site/examples/todo/js/lib/canjs/can.jquery.js#L3477-L3509 | train | |
deseretdigital/dayzed | src/utils.js | getStartDate | function getStartDate(date, minDate, maxDate) {
let startDate = startOfDay(date);
if (minDate) {
const minDateNormalized = startOfDay(minDate);
if (isBefore(startDate, minDateNormalized)) {
startDate = minDateNormalized;
}
}
if (maxDate) {
const maxDateNormalized = startOfDay(maxDate);
... | javascript | function getStartDate(date, minDate, maxDate) {
let startDate = startOfDay(date);
if (minDate) {
const minDateNormalized = startOfDay(minDate);
if (isBefore(startDate, minDateNormalized)) {
startDate = minDateNormalized;
}
}
if (maxDate) {
const maxDateNormalized = startOfDay(maxDate);
... | [
"function",
"getStartDate",
"(",
"date",
",",
"minDate",
",",
"maxDate",
")",
"{",
"let",
"startDate",
"=",
"startOfDay",
"(",
"date",
")",
";",
"if",
"(",
"minDate",
")",
"{",
"const",
"minDateNormalized",
"=",
"startOfDay",
"(",
"minDate",
")",
";",
"i... | Figures out the actual start date based on
the min and max dates available.
@param {Date} date The we want to start the calendar at
@param {Date} minDate The earliest date available to start at
@param {Date} maxDate The latest date available to start at
@returns {Date} The actual start date | [
"Figures",
"out",
"the",
"actual",
"start",
"date",
"based",
"on",
"the",
"min",
"and",
"max",
"dates",
"available",
"."
] | 93499eb6d9434219d6f0697bb8c8a99bde704109 | https://github.com/deseretdigital/dayzed/blob/93499eb6d9434219d6f0697bb8c8a99bde704109/src/utils.js#L174-L189 | train |
deseretdigital/dayzed | src/utils.js | fillFrontWeek | function fillFrontWeek({
firstDayOfMonth,
minDate,
maxDate,
selectedDates,
firstDayOfWeek,
showOutsideDays
}) {
const dates = [];
let firstDay = (firstDayOfMonth.getDay() + 7 - firstDayOfWeek) % 7;
if (showOutsideDays) {
const lastDayOfPrevMonth = addDays(firstDayOfMonth, -1);
const prevDate ... | javascript | function fillFrontWeek({
firstDayOfMonth,
minDate,
maxDate,
selectedDates,
firstDayOfWeek,
showOutsideDays
}) {
const dates = [];
let firstDay = (firstDayOfMonth.getDay() + 7 - firstDayOfWeek) % 7;
if (showOutsideDays) {
const lastDayOfPrevMonth = addDays(firstDayOfMonth, -1);
const prevDate ... | [
"function",
"fillFrontWeek",
"(",
"{",
"firstDayOfMonth",
",",
"minDate",
",",
"maxDate",
",",
"selectedDates",
",",
"firstDayOfWeek",
",",
"showOutsideDays",
"}",
")",
"{",
"const",
"dates",
"=",
"[",
"]",
";",
"let",
"firstDay",
"=",
"(",
"firstDayOfMonth",
... | Fill front week with either empty buffer or dates from previous month,
depending on showOutsideDays flag
@param {Object} param The param object
@param {Array.<Date>} param.selectedDates An array of dates currently selected
@param {Date} param.minDate The earliest date available
@param {Date} param.maxDate The furthest ... | [
"Fill",
"front",
"week",
"with",
"either",
"empty",
"buffer",
"or",
"dates",
"from",
"previous",
"month",
"depending",
"on",
"showOutsideDays",
"flag"
] | 93499eb6d9434219d6f0697bb8c8a99bde704109 | https://github.com/deseretdigital/dayzed/blob/93499eb6d9434219d6f0697bb8c8a99bde704109/src/utils.js#L284-L327 | train |
deseretdigital/dayzed | src/utils.js | fillBackWeek | function fillBackWeek({
lastDayOfMonth,
minDate,
maxDate,
selectedDates,
firstDayOfWeek,
showOutsideDays
}) {
const dates = [];
let lastDay = (lastDayOfMonth.getDay() + 7 - firstDayOfWeek) % 7;
if (showOutsideDays) {
const firstDayOfNextMonth = addDays(lastDayOfMonth, 1);
const nextDateMonth ... | javascript | function fillBackWeek({
lastDayOfMonth,
minDate,
maxDate,
selectedDates,
firstDayOfWeek,
showOutsideDays
}) {
const dates = [];
let lastDay = (lastDayOfMonth.getDay() + 7 - firstDayOfWeek) % 7;
if (showOutsideDays) {
const firstDayOfNextMonth = addDays(lastDayOfMonth, 1);
const nextDateMonth ... | [
"function",
"fillBackWeek",
"(",
"{",
"lastDayOfMonth",
",",
"minDate",
",",
"maxDate",
",",
"selectedDates",
",",
"firstDayOfWeek",
",",
"showOutsideDays",
"}",
")",
"{",
"const",
"dates",
"=",
"[",
"]",
";",
"let",
"lastDay",
"=",
"(",
"lastDayOfMonth",
".... | Fill back weeks with either empty buffer or dates from next month,
depending on showOutsideDays flag
@param {Object} param The param object
@param {Array.<Date>} param.selectedDates An array of dates currently selected
@param {Date} param.minDate The earliest date available
@param {Date} param.maxDate The furthest date... | [
"Fill",
"back",
"weeks",
"with",
"either",
"empty",
"buffer",
"or",
"dates",
"from",
"next",
"month",
"depending",
"on",
"showOutsideDays",
"flag"
] | 93499eb6d9434219d6f0697bb8c8a99bde704109 | https://github.com/deseretdigital/dayzed/blob/93499eb6d9434219d6f0697bb8c8a99bde704109/src/utils.js#L341-L383 | train |
deseretdigital/dayzed | src/utils.js | getWeeks | function getWeeks(dates) {
const weeksLength = Math.ceil(dates.length / 7);
const weeks = [];
for (let i = 0; i < weeksLength; i++) {
weeks[i] = [];
for (let x = 0; x < 7; x++) {
weeks[i].push(dates[i * 7 + x]);
}
}
return weeks;
} | javascript | function getWeeks(dates) {
const weeksLength = Math.ceil(dates.length / 7);
const weeks = [];
for (let i = 0; i < weeksLength; i++) {
weeks[i] = [];
for (let x = 0; x < 7; x++) {
weeks[i].push(dates[i * 7 + x]);
}
}
return weeks;
} | [
"function",
"getWeeks",
"(",
"dates",
")",
"{",
"const",
"weeksLength",
"=",
"Math",
".",
"ceil",
"(",
"dates",
".",
"length",
"/",
"7",
")",
";",
"const",
"weeks",
"=",
"[",
"]",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<",
"weeksLength... | Takes an array of dates, and turns them into a multi dimensional
array with 7 entries for each week.
@param {Array.<Object>} dates An array of dates
@returns {Array} The weeks as a multi dimensional array | [
"Takes",
"an",
"array",
"of",
"dates",
"and",
"turns",
"them",
"into",
"a",
"multi",
"dimensional",
"array",
"with",
"7",
"entries",
"for",
"each",
"week",
"."
] | 93499eb6d9434219d6f0697bb8c8a99bde704109 | https://github.com/deseretdigital/dayzed/blob/93499eb6d9434219d6f0697bb8c8a99bde704109/src/utils.js#L416-L426 | train |
deseretdigital/dayzed | src/utils.js | isSelected | function isSelected(selectedDates, date) {
selectedDates = Array.isArray(selectedDates)
? selectedDates
: [selectedDates];
return selectedDates.some(selectedDate => {
if (
selectedDate instanceof Date &&
startOfDay(selectedDate).getTime() === startOfDay(date).getTime()
) {
return t... | javascript | function isSelected(selectedDates, date) {
selectedDates = Array.isArray(selectedDates)
? selectedDates
: [selectedDates];
return selectedDates.some(selectedDate => {
if (
selectedDate instanceof Date &&
startOfDay(selectedDate).getTime() === startOfDay(date).getTime()
) {
return t... | [
"function",
"isSelected",
"(",
"selectedDates",
",",
"date",
")",
"{",
"selectedDates",
"=",
"Array",
".",
"isArray",
"(",
"selectedDates",
")",
"?",
"selectedDates",
":",
"[",
"selectedDates",
"]",
";",
"return",
"selectedDates",
".",
"some",
"(",
"selectedDa... | Normalizes dates to the beginning of the day,
then checks to see if the day given is found
in the selectedDates.
@param {Array.<Date>} selectedDates An array of dates currently selected
@param {Date} date The date to search with against selectedDates
@returns {Boolean} Whether day is found in selectedDates | [
"Normalizes",
"dates",
"to",
"the",
"beginning",
"of",
"the",
"day",
"then",
"checks",
"to",
"see",
"if",
"the",
"day",
"given",
"is",
"found",
"in",
"the",
"selectedDates",
"."
] | 93499eb6d9434219d6f0697bb8c8a99bde704109 | https://github.com/deseretdigital/dayzed/blob/93499eb6d9434219d6f0697bb8c8a99bde704109/src/utils.js#L436-L449 | train |
deseretdigital/dayzed | src/utils.js | isSelectable | function isSelectable(minDate, maxDate, date) {
if (
(minDate && isBefore(date, minDate)) ||
(maxDate && isBefore(maxDate, date))
) {
return false;
}
return true;
} | javascript | function isSelectable(minDate, maxDate, date) {
if (
(minDate && isBefore(date, minDate)) ||
(maxDate && isBefore(maxDate, date))
) {
return false;
}
return true;
} | [
"function",
"isSelectable",
"(",
"minDate",
",",
"maxDate",
",",
"date",
")",
"{",
"if",
"(",
"(",
"minDate",
"&&",
"isBefore",
"(",
"date",
",",
"minDate",
")",
")",
"||",
"(",
"maxDate",
"&&",
"isBefore",
"(",
"maxDate",
",",
"date",
")",
")",
")",... | Checks to see if the date given is
between the min and max dates.
@param {Date} minDate The earliest date available
@param {Date} maxDate The furthest date available
@param {Date} date The date to compare with
@returns {Boolean} Whether the date is between min and max date | [
"Checks",
"to",
"see",
"if",
"the",
"date",
"given",
"is",
"between",
"the",
"min",
"and",
"max",
"dates",
"."
] | 93499eb6d9434219d6f0697bb8c8a99bde704109 | https://github.com/deseretdigital/dayzed/blob/93499eb6d9434219d6f0697bb8c8a99bde704109/src/utils.js#L459-L467 | train |
taromero/swal-forms | swal-forms.js | extendPreventingOverrides | function extendPreventingOverrides (a, b) {
Object.keys(b).forEach(addContentFromBtoA)
return a
function addContentFromBtoA (key) {
if (a.hasOwnProperty(key)) {
mergeIntoAnArray(a, b, key)
} else {
a[key] = b[key]
}
... | javascript | function extendPreventingOverrides (a, b) {
Object.keys(b).forEach(addContentFromBtoA)
return a
function addContentFromBtoA (key) {
if (a.hasOwnProperty(key)) {
mergeIntoAnArray(a, b, key)
} else {
a[key] = b[key]
}
... | [
"function",
"extendPreventingOverrides",
"(",
"a",
",",
"b",
")",
"{",
"Object",
".",
"keys",
"(",
"b",
")",
".",
"forEach",
"(",
"addContentFromBtoA",
")",
"return",
"a",
"function",
"addContentFromBtoA",
"(",
"key",
")",
"{",
"if",
"(",
"a",
".",
"hasO... | for checkboxes we want to obtain all selected values in an array | [
"for",
"checkboxes",
"we",
"want",
"to",
"obtain",
"all",
"selected",
"values",
"in",
"an",
"array"
] | 8095f1f89d60eedf0c24dc6850b65f32116925e7 | https://github.com/taromero/swal-forms/blob/8095f1f89d60eedf0c24dc6850b65f32116925e7/swal-forms.js#L91-L102 | train |
taromero/swal-forms | swal-forms.js | t | function t (template, data) {
for (var key in data) {
template = template.replace(new RegExp('{' + key + '}', 'g'), data[key] || '')
}
return template
} | javascript | function t (template, data) {
for (var key in data) {
template = template.replace(new RegExp('{' + key + '}', 'g'), data[key] || '')
}
return template
} | [
"function",
"t",
"(",
"template",
",",
"data",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"data",
")",
"{",
"template",
"=",
"template",
".",
"replace",
"(",
"new",
"RegExp",
"(",
"'{'",
"+",
"key",
"+",
"'}'",
",",
"'g'",
")",
",",
"data",
"[",
... | string interpolation hack | [
"string",
"interpolation",
"hack"
] | 8095f1f89d60eedf0c24dc6850b65f32116925e7 | https://github.com/taromero/swal-forms/blob/8095f1f89d60eedf0c24dc6850b65f32116925e7/swal-forms.js#L230-L235 | train |
kentcdodds/rtl-css-js | src/internal/utils.js | getValuesAsList | function getValuesAsList(value) {
return (
value
.replace(/ +/g, ' ') // remove all extraneous spaces
.split(' ')
.map(i => i.trim()) // get rid of extra space before/after each item
.filter(Boolean) // get rid of empty strings
// join items which are within parenthese
// lucki... | javascript | function getValuesAsList(value) {
return (
value
.replace(/ +/g, ' ') // remove all extraneous spaces
.split(' ')
.map(i => i.trim()) // get rid of extra space before/after each item
.filter(Boolean) // get rid of empty strings
// join items which are within parenthese
// lucki... | [
"function",
"getValuesAsList",
"(",
"value",
")",
"{",
"return",
"(",
"value",
".",
"replace",
"(",
"/",
" +",
"/",
"g",
",",
"' '",
")",
"// remove all extraneous spaces",
".",
"split",
"(",
"' '",
")",
".",
"map",
"(",
"i",
"=>",
"i",
".",
"trim",
... | This takes a list of CSS values and converts it to an array
@param {String} value - something like `1px`, `1px 2em`, or `3pt rgb(150, 230, 550) 40px calc(100% - 5px)`
@return {Array} the split values (for example: `['3pt', 'rgb(150, 230, 550)', '40px', 'calc(100% - 5px)']`) | [
"This",
"takes",
"a",
"list",
"of",
"CSS",
"values",
"and",
"converts",
"it",
"to",
"an",
"array"
] | b148865ce6a4c994eba292015b8f44b5dae7edaa | https://github.com/kentcdodds/rtl-css-js/blob/b148865ce6a4c994eba292015b8f44b5dae7edaa/src/internal/utils.js#L89-L113 | train |
kentcdodds/rtl-css-js | src/internal/utils.js | handleQuartetValues | function handleQuartetValues(value) {
const splitValues = getValuesAsList(value)
if (splitValues.length <= 3 || splitValues.length > 4) {
return value
}
const [top, right, bottom, left] = splitValues
return [top, left, bottom, right].join(' ')
} | javascript | function handleQuartetValues(value) {
const splitValues = getValuesAsList(value)
if (splitValues.length <= 3 || splitValues.length > 4) {
return value
}
const [top, right, bottom, left] = splitValues
return [top, left, bottom, right].join(' ')
} | [
"function",
"handleQuartetValues",
"(",
"value",
")",
"{",
"const",
"splitValues",
"=",
"getValuesAsList",
"(",
"value",
")",
"if",
"(",
"splitValues",
".",
"length",
"<=",
"3",
"||",
"splitValues",
".",
"length",
">",
"4",
")",
"{",
"return",
"value",
"}"... | This is intended for properties that are `top right bottom left` and will switch them to `top left bottom right`
@param {String} value - `1px 2px 3px 4px` for example, but also handles cases where there are too few/too many and
simply returns the value in those cases (which is the correct behavior)
@return {String} the... | [
"This",
"is",
"intended",
"for",
"properties",
"that",
"are",
"top",
"right",
"bottom",
"left",
"and",
"will",
"switch",
"them",
"to",
"top",
"left",
"bottom",
"right"
] | b148865ce6a4c994eba292015b8f44b5dae7edaa | https://github.com/kentcdodds/rtl-css-js/blob/b148865ce6a4c994eba292015b8f44b5dae7edaa/src/internal/utils.js#L121-L128 | train |
kentcdodds/rtl-css-js | src/index.js | convert | function convert(object) {
return Object.keys(object).reduce((newObj, originalKey) => {
let originalValue = object[originalKey]
if (isString(originalValue)) {
// you're welcome to later code 😺
originalValue = originalValue.trim()
}
// Some properties should never be transformed
if (i... | javascript | function convert(object) {
return Object.keys(object).reduce((newObj, originalKey) => {
let originalValue = object[originalKey]
if (isString(originalValue)) {
// you're welcome to later code 😺
originalValue = originalValue.trim()
}
// Some properties should never be transformed
if (i... | [
"function",
"convert",
"(",
"object",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"object",
")",
".",
"reduce",
"(",
"(",
"newObj",
",",
"originalKey",
")",
"=>",
"{",
"let",
"originalValue",
"=",
"object",
"[",
"originalKey",
"]",
"if",
"(",
"isSt... | converts properties and values in the CSS in JS object to their corresponding RTL values
@param {Object} object the CSS in JS object
@return {Object} the RTL converted object | [
"converts",
"properties",
"and",
"values",
"in",
"the",
"CSS",
"in",
"JS",
"object",
"to",
"their",
"corresponding",
"RTL",
"values"
] | b148865ce6a4c994eba292015b8f44b5dae7edaa | https://github.com/kentcdodds/rtl-css-js/blob/b148865ce6a4c994eba292015b8f44b5dae7edaa/src/index.js#L61-L79 | train |
kentcdodds/rtl-css-js | src/index.js | convertProperty | function convertProperty(originalKey, originalValue) {
const isNoFlip = /\/\*\s?@noflip\s?\*\//.test(originalValue)
const key = isNoFlip ? originalKey : getPropertyDoppelganger(originalKey)
const value = isNoFlip
? originalValue
: getValueDoppelganger(key, originalValue)
return {key, value}
} | javascript | function convertProperty(originalKey, originalValue) {
const isNoFlip = /\/\*\s?@noflip\s?\*\//.test(originalValue)
const key = isNoFlip ? originalKey : getPropertyDoppelganger(originalKey)
const value = isNoFlip
? originalValue
: getValueDoppelganger(key, originalValue)
return {key, value}
} | [
"function",
"convertProperty",
"(",
"originalKey",
",",
"originalValue",
")",
"{",
"const",
"isNoFlip",
"=",
"/",
"\\/\\*\\s?@noflip\\s?\\*\\/",
"/",
".",
"test",
"(",
"originalValue",
")",
"const",
"key",
"=",
"isNoFlip",
"?",
"originalKey",
":",
"getPropertyDopp... | Converts a property and its value to the corresponding RTL key and value
@param {String} originalKey the original property key
@param {Number|String|Object} originalValue the original css property value
@return {Object} the new {key, value} pair | [
"Converts",
"a",
"property",
"and",
"its",
"value",
"to",
"the",
"corresponding",
"RTL",
"key",
"and",
"value"
] | b148865ce6a4c994eba292015b8f44b5dae7edaa | https://github.com/kentcdodds/rtl-css-js/blob/b148865ce6a4c994eba292015b8f44b5dae7edaa/src/index.js#L87-L94 | train |
kentcdodds/rtl-css-js | src/index.js | getValueDoppelganger | function getValueDoppelganger(key, originalValue) {
/* eslint complexity:[2, 9] */ // let's try to keep the complexity down... If we have to do this much more, let's break this up
if (isNullOrUndefined(originalValue) || isBoolean(originalValue)) {
return originalValue
}
if (isObject(originalValue)) {
r... | javascript | function getValueDoppelganger(key, originalValue) {
/* eslint complexity:[2, 9] */ // let's try to keep the complexity down... If we have to do this much more, let's break this up
if (isNullOrUndefined(originalValue) || isBoolean(originalValue)) {
return originalValue
}
if (isObject(originalValue)) {
r... | [
"function",
"getValueDoppelganger",
"(",
"key",
",",
"originalValue",
")",
"{",
"/* eslint complexity:[2, 9] */",
"// let's try to keep the complexity down... If we have to do this much more, let's break this up",
"if",
"(",
"isNullOrUndefined",
"(",
"originalValue",
")",
"||",
"is... | This converts the given value to the RTL version of that value based on the key
@param {String} key this is the key (note: this should be the RTL version of the originalKey)
@param {String|Number|Object} originalValue the original css property value. If it's an object, then we'll convert that as well
@return {String|Nu... | [
"This",
"converts",
"the",
"given",
"value",
"to",
"the",
"RTL",
"version",
"of",
"that",
"value",
"based",
"on",
"the",
"key"
] | b148865ce6a4c994eba292015b8f44b5dae7edaa | https://github.com/kentcdodds/rtl-css-js/blob/b148865ce6a4c994eba292015b8f44b5dae7edaa/src/index.js#L111-L143 | train |
chain/chain | docs/common/js/layout.js | selectOSTab | function selectOSTab(target, osName) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get ... | javascript | function selectOSTab(target, osName) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get ... | [
"function",
"selectOSTab",
"(",
"target",
",",
"osName",
")",
"{",
"// Declare all variables",
"var",
"i",
",",
"tabcontent",
",",
"tablinks",
";",
"// Get all elements with class=\"tabcontent\" and hide them",
"tabcontent",
"=",
"document",
".",
"getElementsByClassName",
... | switcher between the navtabs for operating systems | [
"switcher",
"between",
"the",
"navtabs",
"for",
"operating",
"systems"
] | 4e9b90d76fe9a4c53adadf03cf8db96a0a5ff38c | https://github.com/chain/chain/blob/4e9b90d76fe9a4c53adadf03cf8db96a0a5ff38c/docs/common/js/layout.js#L104-L123 | train |
chain/chain | docs/common/js/layout.js | showSignUpForm | function showSignUpForm() {
var modal = document.getElementById('downloadModal');
// Make sure modal is in the body, not where it was originally deployed.
$("body").append($(modal))
// Get the button that opens the modal
var btn = document.getElementById("downloadBtn");
// Get the <span> element that closes ... | javascript | function showSignUpForm() {
var modal = document.getElementById('downloadModal');
// Make sure modal is in the body, not where it was originally deployed.
$("body").append($(modal))
// Get the button that opens the modal
var btn = document.getElementById("downloadBtn");
// Get the <span> element that closes ... | [
"function",
"showSignUpForm",
"(",
")",
"{",
"var",
"modal",
"=",
"document",
".",
"getElementById",
"(",
"'downloadModal'",
")",
";",
"// Make sure modal is in the body, not where it was originally deployed.",
"$",
"(",
"\"body\"",
")",
".",
"append",
"(",
"$",
"(",
... | Modal to sign up for newsletter | [
"Modal",
"to",
"sign",
"up",
"for",
"newsletter"
] | 4e9b90d76fe9a4c53adadf03cf8db96a0a5ff38c | https://github.com/chain/chain/blob/4e9b90d76fe9a4c53adadf03cf8db96a0a5ff38c/docs/common/js/layout.js#L133-L159 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.