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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | baseInverter | function baseInverter(object, setter, iteratee, accumulator) {
baseForOwn(object, function(value, key, object) {
setter(accumulator, iteratee(value), key, object);
});
return accumulator;
} | javascript | function baseInverter(object, setter, iteratee, accumulator) {
baseForOwn(object, function(value, key, object) {
setter(accumulator, iteratee(value), key, object);
});
return accumulator;
} | [
"function",
"baseInverter",
"(",
"object",
",",
"setter",
",",
"iteratee",
",",
"accumulator",
")",
"{",
"baseForOwn",
"(",
"object",
",",
"function",
"(",
"value",
",",
"key",
",",
"object",
")",
"{",
"setter",
"(",
"accumulator",
",",
"iteratee",
"(",
... | The base implementation of `_.invert` and `_.invertBy` which inverts
`object` with values transformed by `iteratee` and set by `setter`.
@private
@param {Object} object The object to iterate over.
@param {Function} setter The function to set `accumulator` values.
@param {Function} iteratee The iteratee to transform va... | [
"The",
"base",
"implementation",
"of",
"_",
".",
"invert",
"and",
"_",
".",
"invertBy",
"which",
"inverts",
"object",
"with",
"values",
"transformed",
"by",
"iteratee",
"and",
"set",
"by",
"setter",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L3314-L3319 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | basePullAt | function basePullAt(array, indexes) {
var length = array ? indexes.length : 0,
lastIndex = length - 1;
while (length--) {
var index = indexes[length];
if (length == lastIndex || index !== previous) {
var previous = index;
if (isIndex(index)) {
splic... | javascript | function basePullAt(array, indexes) {
var length = array ? indexes.length : 0,
lastIndex = length - 1;
while (length--) {
var index = indexes[length];
if (length == lastIndex || index !== previous) {
var previous = index;
if (isIndex(index)) {
splic... | [
"function",
"basePullAt",
"(",
"array",
",",
"indexes",
")",
"{",
"var",
"length",
"=",
"array",
"?",
"indexes",
".",
"length",
":",
"0",
",",
"lastIndex",
"=",
"length",
"-",
"1",
";",
"while",
"(",
"length",
"--",
")",
"{",
"var",
"index",
"=",
"... | The base implementation of `_.pullAt` without support for individual
indexes or capturing the removed elements.
@private
@param {Array} array The array to modify.
@param {number[]} indexes The indexes of elements to remove.
@returns {Array} Returns `array`. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"pullAt",
"without",
"support",
"for",
"individual",
"indexes",
"or",
"capturing",
"the",
"removed",
"elements",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L3955-L3971 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | baseRepeat | function baseRepeat(string, n) {
var result = '';
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
return result;
}
// Leverage the exponentiation by squaring algorithm for a faster repeat.
// See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
do {
... | javascript | function baseRepeat(string, n) {
var result = '';
if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
return result;
}
// Leverage the exponentiation by squaring algorithm for a faster repeat.
// See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
do {
... | [
"function",
"baseRepeat",
"(",
"string",
",",
"n",
")",
"{",
"var",
"result",
"=",
"''",
";",
"if",
"(",
"!",
"string",
"||",
"n",
"<",
"1",
"||",
"n",
">",
"MAX_SAFE_INTEGER",
")",
"{",
"return",
"result",
";",
"}",
"// Leverage the exponentiation by sq... | The base implementation of `_.repeat` which doesn't coerce arguments.
@private
@param {string} string The string to repeat.
@param {number} n The number of times to repeat the string.
@returns {string} Returns the repeated string. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"repeat",
"which",
"doesn",
"t",
"coerce",
"arguments",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L4017-L4035 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | baseSampleSize | function baseSampleSize(collection, n) {
var array = values(collection);
return shuffleSelf(array, baseClamp(n, 0, array.length));
} | javascript | function baseSampleSize(collection, n) {
var array = values(collection);
return shuffleSelf(array, baseClamp(n, 0, array.length));
} | [
"function",
"baseSampleSize",
"(",
"collection",
",",
"n",
")",
"{",
"var",
"array",
"=",
"values",
"(",
"collection",
")",
";",
"return",
"shuffleSelf",
"(",
"array",
",",
"baseClamp",
"(",
"n",
",",
"0",
",",
"array",
".",
"length",
")",
")",
";",
... | The base implementation of `_.sampleSize` without param guards.
@private
@param {Array|Object} collection The collection to sample.
@param {number} n The number of elements to sample.
@returns {Array} Returns the random elements. | [
"The",
"base",
"implementation",
"of",
"_",
".",
"sampleSize",
"without",
"param",
"guards",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L4068-L4071 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | baseSortedIndex | function baseSortedIndex(array, value, retHighest) {
var low = 0,
high = array == null ? low : array.length;
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
while (low < high) {
var mid = (low + high) >>> 1,
computed = array[mid]... | javascript | function baseSortedIndex(array, value, retHighest) {
var low = 0,
high = array == null ? low : array.length;
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
while (low < high) {
var mid = (low + high) >>> 1,
computed = array[mid]... | [
"function",
"baseSortedIndex",
"(",
"array",
",",
"value",
",",
"retHighest",
")",
"{",
"var",
"low",
"=",
"0",
",",
"high",
"=",
"array",
"==",
"null",
"?",
"low",
":",
"array",
".",
"length",
";",
"if",
"(",
"typeof",
"value",
"==",
"'number'",
"&&... | The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
performs a binary search of `array` to determine the index at which `value`
should be inserted into `array` in order to maintain its sort order.
@private
@param {Array} array The sorted array to inspect.
@param {*} value The value to evaluate.
@p... | [
"The",
"base",
"implementation",
"of",
"_",
".",
"sortedIndex",
"and",
"_",
".",
"sortedLastIndex",
"which",
"performs",
"a",
"binary",
"search",
"of",
"array",
"to",
"determine",
"the",
"index",
"at",
"which",
"value",
"should",
"be",
"inserted",
"into",
"a... | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L4215-L4234 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | baseUpdate | function baseUpdate(object, path, updater, customizer) {
return baseSet(object, path, updater(baseGet(object, path)), customizer);
} | javascript | function baseUpdate(object, path, updater, customizer) {
return baseSet(object, path, updater(baseGet(object, path)), customizer);
} | [
"function",
"baseUpdate",
"(",
"object",
",",
"path",
",",
"updater",
",",
"customizer",
")",
"{",
"return",
"baseSet",
"(",
"object",
",",
"path",
",",
"updater",
"(",
"baseGet",
"(",
"object",
",",
"path",
")",
")",
",",
"customizer",
")",
";",
"}"
] | The base implementation of `_.update`.
@private
@param {Object} object The object to modify.
@param {Array|string} path The path of the property to update.
@param {Function} updater The function to produce the updated value.
@param {Function} [customizer] The function to customize path creation.
@returns {Object} Retu... | [
"The",
"base",
"implementation",
"of",
"_",
".",
"update",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L4443-L4445 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | createBind | function createBind(func, bitmask, thisArg) {
var isBind = bitmask & WRAP_BIND_FLAG,
Ctor = createCtor(func);
function wrapper() {
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
return fn.apply(isBind ? thisArg : this, arguments);
}
return w... | javascript | function createBind(func, bitmask, thisArg) {
var isBind = bitmask & WRAP_BIND_FLAG,
Ctor = createCtor(func);
function wrapper() {
var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;
return fn.apply(isBind ? thisArg : this, arguments);
}
return w... | [
"function",
"createBind",
"(",
"func",
",",
"bitmask",
",",
"thisArg",
")",
"{",
"var",
"isBind",
"=",
"bitmask",
"&",
"WRAP_BIND_FLAG",
",",
"Ctor",
"=",
"createCtor",
"(",
"func",
")",
";",
"function",
"wrapper",
"(",
")",
"{",
"var",
"fn",
"=",
"(",... | Creates a function that wraps `func` to invoke it with the optional `this`
binding of `thisArg`.
@private
@param {Function} func The function to wrap.
@param {number} bitmask The bitmask flags. See `createWrap` for more details.
@param {*} [thisArg] The `this` binding of `func`.
@returns {Function} Returns the new wra... | [
"Creates",
"a",
"function",
"that",
"wraps",
"func",
"to",
"invoke",
"it",
"with",
"the",
"optional",
"this",
"binding",
"of",
"thisArg",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L5069-L5078 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | createRelationalOperation | function createRelationalOperation(operator) {
return function(value, other) {
if (!(typeof value == 'string' && typeof other == 'string')) {
value = toNumber(value);
other = toNumber(other);
}
return operator(value, other);
};
} | javascript | function createRelationalOperation(operator) {
return function(value, other) {
if (!(typeof value == 'string' && typeof other == 'string')) {
value = toNumber(value);
other = toNumber(other);
}
return operator(value, other);
};
} | [
"function",
"createRelationalOperation",
"(",
"operator",
")",
"{",
"return",
"function",
"(",
"value",
",",
"other",
")",
"{",
"if",
"(",
"!",
"(",
"typeof",
"value",
"==",
"'string'",
"&&",
"typeof",
"other",
"==",
"'string'",
")",
")",
"{",
"value",
"... | Creates a function that performs a relational operation on two values.
@private
@param {Function} operator The function to perform the operation.
@returns {Function} Returns the new relational operation function. | [
"Creates",
"a",
"function",
"that",
"performs",
"a",
"relational",
"operation",
"on",
"two",
"values",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L5500-L5508 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | customDefaultsAssignIn | function customDefaultsAssignIn(objValue, srcValue, key, object) {
if (objValue === undefined ||
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
return srcValue;
}
return objValue;
} | javascript | function customDefaultsAssignIn(objValue, srcValue, key, object) {
if (objValue === undefined ||
(eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
return srcValue;
}
return objValue;
} | [
"function",
"customDefaultsAssignIn",
"(",
"objValue",
",",
"srcValue",
",",
"key",
",",
"object",
")",
"{",
"if",
"(",
"objValue",
"===",
"undefined",
"||",
"(",
"eq",
"(",
"objValue",
",",
"objectProto",
"[",
"key",
"]",
")",
"&&",
"!",
"hasOwnProperty",... | Used by `_.defaults` to customize its `_.assignIn` use to assign properties
of source objects to the destination object for all destination properties
that resolve to `undefined`.
@private
@param {*} objValue The destination value.
@param {*} srcValue The source value.
@param {string} key The key of the property to as... | [
"Used",
"by",
"_",
".",
"defaults",
"to",
"customize",
"its",
"_",
".",
"assignIn",
"use",
"to",
"assign",
"properties",
"of",
"source",
"objects",
"to",
"the",
"destination",
"object",
"for",
"all",
"destination",
"properties",
"that",
"resolve",
"to",
"und... | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L5701-L5707 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | getFuncName | function getFuncName(func) {
var result = (func.name + ''),
array = realNames[result],
length = hasOwnProperty.call(realNames, result) ? array.length : 0;
while (length--) {
var data = array[length],
otherFunc = data.func;
if (otherFunc == null || otherFunc =... | javascript | function getFuncName(func) {
var result = (func.name + ''),
array = realNames[result],
length = hasOwnProperty.call(realNames, result) ? array.length : 0;
while (length--) {
var data = array[length],
otherFunc = data.func;
if (otherFunc == null || otherFunc =... | [
"function",
"getFuncName",
"(",
"func",
")",
"{",
"var",
"result",
"=",
"(",
"func",
".",
"name",
"+",
"''",
")",
",",
"array",
"=",
"realNames",
"[",
"result",
"]",
",",
"length",
"=",
"hasOwnProperty",
".",
"call",
"(",
"realNames",
",",
"result",
... | Gets the name of `func`.
@private
@param {Function} func The function to query.
@returns {string} Returns the function name. | [
"Gets",
"the",
"name",
"of",
"func",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L6031-L6044 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | getWrapDetails | function getWrapDetails(source) {
var match = source.match(reWrapDetails);
return match ? match[1].split(reSplitDetails) : [];
} | javascript | function getWrapDetails(source) {
var match = source.match(reWrapDetails);
return match ? match[1].split(reSplitDetails) : [];
} | [
"function",
"getWrapDetails",
"(",
"source",
")",
"{",
"var",
"match",
"=",
"source",
".",
"match",
"(",
"reWrapDetails",
")",
";",
"return",
"match",
"?",
"match",
"[",
"1",
"]",
".",
"split",
"(",
"reSplitDetails",
")",
":",
"[",
"]",
";",
"}"
] | Extracts wrapper details from the `source` body comment.
@private
@param {string} source The source to inspect.
@returns {Array} Returns the wrapper details. | [
"Extracts",
"wrapper",
"details",
"from",
"the",
"source",
"body",
"comment",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L6251-L6254 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | setWrapToString | function setWrapToString(wrapper, reference, bitmask) {
var source = (reference + '');
return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
} | javascript | function setWrapToString(wrapper, reference, bitmask) {
var source = (reference + '');
return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
} | [
"function",
"setWrapToString",
"(",
"wrapper",
",",
"reference",
",",
"bitmask",
")",
"{",
"var",
"source",
"=",
"(",
"reference",
"+",
"''",
")",
";",
"return",
"setToString",
"(",
"wrapper",
",",
"insertWrapDetails",
"(",
"source",
",",
"updateWrapDetails",
... | Sets the `toString` method of `wrapper` to mimic the source of `reference`
with wrapper details in a comment at the top of the source body.
@private
@param {Function} wrapper The function to modify.
@param {Function} reference The reference function.
@param {number} bitmask The bitmask flags. See `createWrap` for more... | [
"Sets",
"the",
"toString",
"method",
"of",
"wrapper",
"to",
"mimic",
"the",
"source",
"of",
"reference",
"with",
"wrapper",
"details",
"in",
"a",
"comment",
"at",
"the",
"top",
"of",
"the",
"source",
"body",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L6793-L6796 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | wrapperClone | function wrapperClone(wrapper) {
if (wrapper instanceof LazyWrapper) {
return wrapper.clone();
}
var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
result.__actions__ = copyArray(wrapper.__actions__);
result.__index__ = wrapper.__index__;
result.__values... | javascript | function wrapperClone(wrapper) {
if (wrapper instanceof LazyWrapper) {
return wrapper.clone();
}
var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
result.__actions__ = copyArray(wrapper.__actions__);
result.__index__ = wrapper.__index__;
result.__values... | [
"function",
"wrapperClone",
"(",
"wrapper",
")",
"{",
"if",
"(",
"wrapper",
"instanceof",
"LazyWrapper",
")",
"{",
"return",
"wrapper",
".",
"clone",
"(",
")",
";",
"}",
"var",
"result",
"=",
"new",
"LodashWrapper",
"(",
"wrapper",
".",
"__wrapped__",
",",... | Creates a clone of `wrapper`.
@private
@param {Object} wrapper The wrapper to clone.
@returns {Object} Returns the cloned wrapper. | [
"Creates",
"a",
"clone",
"of",
"wrapper",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L6929-L6938 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | dropRight | function dropRight(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = (guard || n === undefined) ? 1 : toInteger(n);
n = length - n;
return baseSlice(array, 0, n < 0 ? 0 : n);
} | javascript | function dropRight(array, n, guard) {
var length = array == null ? 0 : array.length;
if (!length) {
return [];
}
n = (guard || n === undefined) ? 1 : toInteger(n);
n = length - n;
return baseSlice(array, 0, n < 0 ? 0 : n);
} | [
"function",
"dropRight",
"(",
"array",
",",
"n",
",",
"guard",
")",
"{",
"var",
"length",
"=",
"array",
"==",
"null",
"?",
"0",
":",
"array",
".",
"length",
";",
"if",
"(",
"!",
"length",
")",
"{",
"return",
"[",
"]",
";",
"}",
"n",
"=",
"(",
... | Creates a slice of `array` with `n` elements dropped from the end.
@static
@memberOf _
@since 3.0.0
@category Array
@param {Array} array The array to query.
@param {number} [n=1] The number of elements to drop.
@param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
@returns {Array} Returns the s... | [
"Creates",
"a",
"slice",
"of",
"array",
"with",
"n",
"elements",
"dropped",
"from",
"the",
"end",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L7205-L7213 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | findIndex | function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseFindIndex(a... | javascript | function findIndex(array, predicate, fromIndex) {
var length = array == null ? 0 : array.length;
if (!length) {
return -1;
}
var index = fromIndex == null ? 0 : toInteger(fromIndex);
if (index < 0) {
index = nativeMax(length + index, 0);
}
return baseFindIndex(a... | [
"function",
"findIndex",
"(",
"array",
",",
"predicate",
",",
"fromIndex",
")",
"{",
"var",
"length",
"=",
"array",
"==",
"null",
"?",
"0",
":",
"array",
".",
"length",
";",
"if",
"(",
"!",
"length",
")",
"{",
"return",
"-",
"1",
";",
"}",
"var",
... | This method is like `_.find` except that it returns the index of the first
element `predicate` returns truthy for instead of the element itself.
@static
@memberOf _
@since 1.1.0
@category Array
@param {Array} array The array to inspect.
@param {Function} [predicate=_.identity] The function invoked per iteration.
@para... | [
"This",
"method",
"is",
"like",
"_",
".",
"find",
"except",
"that",
"it",
"returns",
"the",
"index",
"of",
"the",
"first",
"element",
"predicate",
"returns",
"truthy",
"for",
"instead",
"of",
"the",
"element",
"itself",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L7373-L7383 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | flattenDeep | function flattenDeep(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, INFINITY) : [];
} | javascript | function flattenDeep(array) {
var length = array == null ? 0 : array.length;
return length ? baseFlatten(array, INFINITY) : [];
} | [
"function",
"flattenDeep",
"(",
"array",
")",
"{",
"var",
"length",
"=",
"array",
"==",
"null",
"?",
"0",
":",
"array",
".",
"length",
";",
"return",
"length",
"?",
"baseFlatten",
"(",
"array",
",",
"INFINITY",
")",
":",
"[",
"]",
";",
"}"
] | Recursively flattens `array`.
@static
@memberOf _
@since 3.0.0
@category Array
@param {Array} array The array to flatten.
@returns {Array} Returns the new flattened array.
@example
_.flattenDeep([1, [2, [3, [4]], 5]]);
// => [1, 2, 3, 4, 5] | [
"Recursively",
"flattens",
"array",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L7468-L7471 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | fromPairs | function fromPairs(pairs) {
var index = -1,
length = pairs == null ? 0 : pairs.length,
result = {};
while (++index < length) {
var pair = pairs[index];
result[pair[0]] = pair[1];
}
return result;
} | javascript | function fromPairs(pairs) {
var index = -1,
length = pairs == null ? 0 : pairs.length,
result = {};
while (++index < length) {
var pair = pairs[index];
result[pair[0]] = pair[1];
}
return result;
} | [
"function",
"fromPairs",
"(",
"pairs",
")",
"{",
"var",
"index",
"=",
"-",
"1",
",",
"length",
"=",
"pairs",
"==",
"null",
"?",
"0",
":",
"pairs",
".",
"length",
",",
"result",
"=",
"{",
"}",
";",
"while",
"(",
"++",
"index",
"<",
"length",
")",
... | The inverse of `_.toPairs`; this method returns an object composed
from key-value `pairs`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} pairs The key-value pairs.
@returns {Object} Returns the new object.
@example
_.fromPairs([['a', 1], ['b', 2]]);
// => { 'a': 1, 'b': 2 } | [
"The",
"inverse",
"of",
"_",
".",
"toPairs",
";",
"this",
"method",
"returns",
"an",
"object",
"composed",
"from",
"key",
"-",
"value",
"pairs",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L7517-L7527 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | initial | function initial(array) {
var length = array == null ? 0 : array.length;
return length ? baseSlice(array, 0, -1) : [];
} | javascript | function initial(array) {
var length = array == null ? 0 : array.length;
return length ? baseSlice(array, 0, -1) : [];
} | [
"function",
"initial",
"(",
"array",
")",
"{",
"var",
"length",
"=",
"array",
"==",
"null",
"?",
"0",
":",
"array",
".",
"length",
";",
"return",
"length",
"?",
"baseSlice",
"(",
"array",
",",
"0",
",",
"-",
"1",
")",
":",
"[",
"]",
";",
"}"
] | Gets all but the last element of `array`.
@static
@memberOf _
@since 0.1.0
@category Array
@param {Array} array The array to query.
@returns {Array} Returns the slice of `array`.
@example
_.initial([1, 2, 3]);
// => [1, 2] | [
"Gets",
"all",
"but",
"the",
"last",
"element",
"of",
"array",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L7600-L7603 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | sortedIndexOf | function sortedIndexOf(array, value) {
var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value);
if (index < length && eq(array[index], value)) {
return index;
}
}
return -1;
} | javascript | function sortedIndexOf(array, value) {
var length = array == null ? 0 : array.length;
if (length) {
var index = baseSortedIndex(array, value);
if (index < length && eq(array[index], value)) {
return index;
}
}
return -1;
} | [
"function",
"sortedIndexOf",
"(",
"array",
",",
"value",
")",
"{",
"var",
"length",
"=",
"array",
"==",
"null",
"?",
"0",
":",
"array",
".",
"length",
";",
"if",
"(",
"length",
")",
"{",
"var",
"index",
"=",
"baseSortedIndex",
"(",
"array",
",",
"val... | This method is like `_.indexOf` except that it performs a binary
search on a sorted `array`.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} array The array to inspect.
@param {*} value The value to search for.
@returns {number} Returns the index of the matched value, else `-1`.
@example
_.sortedIndex... | [
"This",
"method",
"is",
"like",
"_",
".",
"indexOf",
"except",
"that",
"it",
"performs",
"a",
"binary",
"search",
"on",
"a",
"sorted",
"array",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L8117-L8126 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | sortedUniqBy | function sortedUniqBy(array, iteratee) {
return (array && array.length)
? baseSortedUniq(array, getIteratee(iteratee, 2))
: [];
} | javascript | function sortedUniqBy(array, iteratee) {
return (array && array.length)
? baseSortedUniq(array, getIteratee(iteratee, 2))
: [];
} | [
"function",
"sortedUniqBy",
"(",
"array",
",",
"iteratee",
")",
"{",
"return",
"(",
"array",
"&&",
"array",
".",
"length",
")",
"?",
"baseSortedUniq",
"(",
"array",
",",
"getIteratee",
"(",
"iteratee",
",",
"2",
")",
")",
":",
"[",
"]",
";",
"}"
] | This method is like `_.uniqBy` except that it's designed and optimized
for sorted arrays.
@static
@memberOf _
@since 4.0.0
@category Array
@param {Array} array The array to inspect.
@param {Function} [iteratee] The iteratee invoked per element.
@returns {Array} Returns the new duplicate free array.
@example
_.sortedU... | [
"This",
"method",
"is",
"like",
"_",
".",
"uniqBy",
"except",
"that",
"it",
"s",
"designed",
"and",
"optimized",
"for",
"sorted",
"arrays",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L8243-L8247 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | unzip | function unzip(array) {
if (!(array && array.length)) {
return [];
}
var length = 0;
array = arrayFilter(array, function(group) {
if (isArrayLikeObject(group)) {
length = nativeMax(group.length, length);
return true;
}
});
return baseTimes(... | javascript | function unzip(array) {
if (!(array && array.length)) {
return [];
}
var length = 0;
array = arrayFilter(array, function(group) {
if (isArrayLikeObject(group)) {
length = nativeMax(group.length, length);
return true;
}
});
return baseTimes(... | [
"function",
"unzip",
"(",
"array",
")",
"{",
"if",
"(",
"!",
"(",
"array",
"&&",
"array",
".",
"length",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"var",
"length",
"=",
"0",
";",
"array",
"=",
"arrayFilter",
"(",
"array",
",",
"function",
"(",... | This method is like `_.zip` except that it accepts an array of grouped
elements and creates an array regrouping the elements to their pre-zip
configuration.
@static
@memberOf _
@since 1.2.0
@category Array
@param {Array} array The array of grouped elements to process.
@returns {Array} Returns the new array of regroupe... | [
"This",
"method",
"is",
"like",
"_",
".",
"zip",
"except",
"that",
"it",
"accepts",
"an",
"array",
"of",
"grouped",
"elements",
"and",
"creates",
"an",
"array",
"regrouping",
"the",
"elements",
"to",
"their",
"pre",
"-",
"zip",
"configuration",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L8589-L8603 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | forEachRight | function forEachRight(collection, iteratee) {
var func = isArray(collection) ? arrayEachRight : baseEachRight;
return func(collection, getIteratee(iteratee, 3));
} | javascript | function forEachRight(collection, iteratee) {
var func = isArray(collection) ? arrayEachRight : baseEachRight;
return func(collection, getIteratee(iteratee, 3));
} | [
"function",
"forEachRight",
"(",
"collection",
",",
"iteratee",
")",
"{",
"var",
"func",
"=",
"isArray",
"(",
"collection",
")",
"?",
"arrayEachRight",
":",
"baseEachRight",
";",
"return",
"func",
"(",
"collection",
",",
"getIteratee",
"(",
"iteratee",
",",
... | This method is like `_.forEach` except that it iterates over elements of
`collection` from right to left.
@static
@memberOf _
@since 2.0.0
@alias eachRight
@category Collection
@param {Array|Object} collection The collection to iterate over.
@param {Function} [iteratee=_.identity] The function invoked per iteration.
@... | [
"This",
"method",
"is",
"like",
"_",
".",
"forEach",
"except",
"that",
"it",
"iterates",
"over",
"elements",
"of",
"collection",
"from",
"right",
"to",
"left",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L9489-L9492 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | negate | function negate(predicate) {
if (typeof predicate != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return function() {
var args = arguments;
switch (args.length) {
case 0: return !predicate.call(this);
case 1: return !predicate.call(this, args[0]);
... | javascript | function negate(predicate) {
if (typeof predicate != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return function() {
var args = arguments;
switch (args.length) {
case 0: return !predicate.call(this);
case 1: return !predicate.call(this, args[0]);
... | [
"function",
"negate",
"(",
"predicate",
")",
"{",
"if",
"(",
"typeof",
"predicate",
"!=",
"'function'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"FUNC_ERROR_TEXT",
")",
";",
"}",
"return",
"function",
"(",
")",
"{",
"var",
"args",
"=",
"arguments",
";... | Creates a function that negates the result of the predicate `func`. The
`func` predicate is invoked with the `this` binding and arguments of the
created function.
@static
@memberOf _
@since 3.0.0
@category Function
@param {Function} predicate The predicate to negate.
@returns {Function} Returns the new negated functio... | [
"Creates",
"a",
"function",
"that",
"negates",
"the",
"result",
"of",
"the",
"predicate",
"func",
".",
"The",
"func",
"predicate",
"is",
"invoked",
"with",
"the",
"this",
"binding",
"and",
"arguments",
"of",
"the",
"created",
"function",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L10704-L10718 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | conformsTo | function conformsTo(object, source) {
return source == null || baseConformsTo(object, source, keys(source));
} | javascript | function conformsTo(object, source) {
return source == null || baseConformsTo(object, source, keys(source));
} | [
"function",
"conformsTo",
"(",
"object",
",",
"source",
")",
"{",
"return",
"source",
"==",
"null",
"||",
"baseConformsTo",
"(",
"object",
",",
"source",
",",
"keys",
"(",
"source",
")",
")",
";",
"}"
] | Checks if `object` conforms to `source` by invoking the predicate
properties of `source` with the corresponding property values of `object`.
**Note:** This method is equivalent to `_.conforms` when `source` is
partially applied.
@static
@memberOf _
@since 4.14.0
@category Lang
@param {Object} object The object to ins... | [
"Checks",
"if",
"object",
"conforms",
"to",
"source",
"by",
"invoking",
"the",
"predicate",
"properties",
"of",
"source",
"with",
"the",
"corresponding",
"property",
"values",
"of",
"object",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L11269-L11271 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | create | function create(prototype, properties) {
var result = baseCreate(prototype);
return properties == null ? result : baseAssign(result, properties);
} | javascript | function create(prototype, properties) {
var result = baseCreate(prototype);
return properties == null ? result : baseAssign(result, properties);
} | [
"function",
"create",
"(",
"prototype",
",",
"properties",
")",
"{",
"var",
"result",
"=",
"baseCreate",
"(",
"prototype",
")",
";",
"return",
"properties",
"==",
"null",
"?",
"result",
":",
"baseAssign",
"(",
"result",
",",
"properties",
")",
";",
"}"
] | Creates an object that inherits from the `prototype` object. If a
`properties` object is given, its own enumerable string keyed properties
are assigned to the created object.
@static
@memberOf _
@since 2.3.0
@category Object
@param {Object} prototype The object to inherit from.
@param {Object} [properties] The propert... | [
"Creates",
"an",
"object",
"that",
"inherits",
"from",
"the",
"prototype",
"object",
".",
"If",
"a",
"properties",
"object",
"is",
"given",
"its",
"own",
"enumerable",
"string",
"keyed",
"properties",
"are",
"assigned",
"to",
"the",
"created",
"object",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L12881-L12884 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | replace | function replace() {
var args = arguments,
string = toString(args[0]);
return args.length < 3 ? string : string.replace(args[1], args[2]);
} | javascript | function replace() {
var args = arguments,
string = toString(args[0]);
return args.length < 3 ? string : string.replace(args[1], args[2]);
} | [
"function",
"replace",
"(",
")",
"{",
"var",
"args",
"=",
"arguments",
",",
"string",
"=",
"toString",
"(",
"args",
"[",
"0",
"]",
")",
";",
"return",
"args",
".",
"length",
"<",
"3",
"?",
"string",
":",
"string",
".",
"replace",
"(",
"args",
"[",
... | Replaces matches for `pattern` in `string` with `replacement`.
**Note:** This method is based on
[`String#replace`](https://mdn.io/String/replace).
@static
@memberOf _
@since 4.0.0
@category String
@param {string} [string=''] The string to modify.
@param {RegExp|string} pattern The pattern to replace.
@param {Functio... | [
"Replaces",
"matches",
"for",
"pattern",
"in",
"string",
"with",
"replacement",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L14621-L14626 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | startsWith | function startsWith(string, target, position) {
string = toString(string);
position = position == null
? 0
: baseClamp(toInteger(position), 0, string.length);
target = baseToString(target);
return string.slice(position, position + target.length) == target;
} | javascript | function startsWith(string, target, position) {
string = toString(string);
position = position == null
? 0
: baseClamp(toInteger(position), 0, string.length);
target = baseToString(target);
return string.slice(position, position + target.length) == target;
} | [
"function",
"startsWith",
"(",
"string",
",",
"target",
",",
"position",
")",
"{",
"string",
"=",
"toString",
"(",
"string",
")",
";",
"position",
"=",
"position",
"==",
"null",
"?",
"0",
":",
"baseClamp",
"(",
"toInteger",
"(",
"position",
")",
",",
"... | Checks if `string` starts with the given target string.
@static
@memberOf _
@since 3.0.0
@category String
@param {string} [string=''] The string to inspect.
@param {string} [target] The string to search for.
@param {number} [position=0] The position to search from.
@returns {boolean} Returns `true` if `string` starts ... | [
"Checks",
"if",
"string",
"starts",
"with",
"the",
"given",
"target",
"string",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L14741-L14749 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | truncate | function truncate(string, options) {
var length = DEFAULT_TRUNC_LENGTH,
omission = DEFAULT_TRUNC_OMISSION;
if (isObject(options)) {
var separator = 'separator' in options ? options.separator : separator;
length = 'length' in options ? toInteger(options.length) : length;
om... | javascript | function truncate(string, options) {
var length = DEFAULT_TRUNC_LENGTH,
omission = DEFAULT_TRUNC_OMISSION;
if (isObject(options)) {
var separator = 'separator' in options ? options.separator : separator;
length = 'length' in options ? toInteger(options.length) : length;
om... | [
"function",
"truncate",
"(",
"string",
",",
"options",
")",
"{",
"var",
"length",
"=",
"DEFAULT_TRUNC_LENGTH",
",",
"omission",
"=",
"DEFAULT_TRUNC_OMISSION",
";",
"if",
"(",
"isObject",
"(",
"options",
")",
")",
"{",
"var",
"separator",
"=",
"'separator'",
... | Truncates `string` if it's longer than the given maximum string length.
The last characters of the truncated string are replaced with the omission
string which defaults to "...".
@static
@memberOf _
@since 4.0.0
@category String
@param {string} [string=''] The string to truncate.
@param {Object} [options={}] The optio... | [
"Truncates",
"string",
"if",
"it",
"s",
"longer",
"than",
"the",
"given",
"maximum",
"string",
"length",
".",
"The",
"last",
"characters",
"of",
"the",
"truncated",
"string",
"are",
"replaced",
"with",
"the",
"omission",
"string",
"which",
"defaults",
"to",
... | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L15154-L15208 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | cond | function cond(pairs) {
var length = pairs == null ? 0 : pairs.length,
toIteratee = getIteratee();
pairs = !length ? [] : arrayMap(pairs, function(pair) {
if (typeof pair[1] != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return [toIteratee(pair[0]), pair... | javascript | function cond(pairs) {
var length = pairs == null ? 0 : pairs.length,
toIteratee = getIteratee();
pairs = !length ? [] : arrayMap(pairs, function(pair) {
if (typeof pair[1] != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
return [toIteratee(pair[0]), pair... | [
"function",
"cond",
"(",
"pairs",
")",
"{",
"var",
"length",
"=",
"pairs",
"==",
"null",
"?",
"0",
":",
"pairs",
".",
"length",
",",
"toIteratee",
"=",
"getIteratee",
"(",
")",
";",
"pairs",
"=",
"!",
"length",
"?",
"[",
"]",
":",
"arrayMap",
"(",
... | Creates a function that iterates over `pairs` and invokes the corresponding
function of the first predicate to return truthy. The predicate-function
pairs are invoked with the `this` binding and arguments of the created
function.
@static
@memberOf _
@since 4.0.0
@category Util
@param {Array} pairs The predicate-functi... | [
"Creates",
"a",
"function",
"that",
"iterates",
"over",
"pairs",
"and",
"invokes",
"the",
"corresponding",
"function",
"of",
"the",
"first",
"predicate",
"to",
"return",
"truthy",
".",
"The",
"predicate",
"-",
"function",
"pairs",
"are",
"invoked",
"with",
"th... | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L15403-L15423 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | nthArg | function nthArg(n) {
n = toInteger(n);
return baseRest(function(args) {
return baseNth(args, n);
});
} | javascript | function nthArg(n) {
n = toInteger(n);
return baseRest(function(args) {
return baseNth(args, n);
});
} | [
"function",
"nthArg",
"(",
"n",
")",
"{",
"n",
"=",
"toInteger",
"(",
"n",
")",
";",
"return",
"baseRest",
"(",
"function",
"(",
"args",
")",
"{",
"return",
"baseNth",
"(",
"args",
",",
"n",
")",
";",
"}",
")",
";",
"}"
] | Creates a function that gets the argument at index `n`. If `n` is negative,
the nth argument from the end is returned.
@static
@memberOf _
@since 4.0.0
@category Util
@param {number} [n=0] The index of the argument to return.
@returns {Function} Returns the new pass-thru function.
@example
var func = _.nthArg(1);
fun... | [
"Creates",
"a",
"function",
"that",
"gets",
"the",
"argument",
"at",
"index",
"n",
".",
"If",
"n",
"is",
"negative",
"the",
"nth",
"argument",
"from",
"the",
"end",
"is",
"returned",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L15864-L15869 | train |
zhanziyang/vue-croppa | docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js | toPath | function toPath(value) {
if (isArray(value)) {
return arrayMap(value, toKey);
}
return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
} | javascript | function toPath(value) {
if (isArray(value)) {
return arrayMap(value, toKey);
}
return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
} | [
"function",
"toPath",
"(",
"value",
")",
"{",
"if",
"(",
"isArray",
"(",
"value",
")",
")",
"{",
"return",
"arrayMap",
"(",
"value",
",",
"toKey",
")",
";",
"}",
"return",
"isSymbol",
"(",
"value",
")",
"?",
"[",
"value",
"]",
":",
"copyArray",
"("... | Converts `value` to a property path array.
@static
@memberOf _
@since 4.0.0
@category Util
@param {*} value The value to convert.
@returns {Array} Returns the new property path array.
@example
_.toPath('a.b.c');
// => ['a', 'b', 'c']
_.toPath('a[0].b.c');
// => ['a', '0', 'b', 'c'] | [
"Converts",
"value",
"to",
"a",
"property",
"path",
"array",
"."
] | 46632d9ce254b834150d7fab2febb666e1c7d2a4 | https://github.com/zhanziyang/vue-croppa/blob/46632d9ce254b834150d7fab2febb666e1c7d2a4/docs/static/kute-page_files/undefined.cd4343636fa2ca97594c.js#L16226-L16231 | train |
tracespace/tracespace | packages/gerber-plotter/lib/_pad-shape.js | function(cx, cy, r, width) {
return {type: 'ring', cx: cx, cy: cy, r: r, width: width}
} | javascript | function(cx, cy, r, width) {
return {type: 'ring', cx: cx, cy: cy, r: r, width: width}
} | [
"function",
"(",
"cx",
",",
"cy",
",",
"r",
",",
"width",
")",
"{",
"return",
"{",
"type",
":",
"'ring'",
",",
"cx",
":",
"cx",
",",
"cy",
":",
"cy",
",",
"r",
":",
"r",
",",
"width",
":",
"width",
"}",
"}"
] | just returns a ring object, does not return a box | [
"just",
"returns",
"a",
"ring",
"object",
"does",
"not",
"return",
"a",
"box"
] | e1cd3af69766ae2f08491cb2309a62013ff1f815 | https://github.com/tracespace/tracespace/blob/e1cd3af69766ae2f08491cb2309a62013ff1f815/packages/gerber-plotter/lib/_pad-shape.js#L165-L167 | train | |
tracespace/tracespace | packages/pcb-stackup/index.js | renderStackup | function renderStackup(stackupLayers, next) {
var stackup = createStackup(stackupLayers, options)
stackup.layers = stackupLayers
next(null, stackup)
} | javascript | function renderStackup(stackupLayers, next) {
var stackup = createStackup(stackupLayers, options)
stackup.layers = stackupLayers
next(null, stackup)
} | [
"function",
"renderStackup",
"(",
"stackupLayers",
",",
"next",
")",
"{",
"var",
"stackup",
"=",
"createStackup",
"(",
"stackupLayers",
",",
"options",
")",
"stackup",
".",
"layers",
"=",
"stackupLayers",
"next",
"(",
"null",
",",
"stackup",
")",
"}"
] | using the result of renderAllLayers, build the stackup | [
"using",
"the",
"result",
"of",
"renderAllLayers",
"build",
"the",
"stackup"
] | e1cd3af69766ae2f08491cb2309a62013ff1f815 | https://github.com/tracespace/tracespace/blob/e1cd3af69766ae2f08491cb2309a62013ff1f815/packages/pcb-stackup/index.js#L52-L56 | train |
tracespace/tracespace | packages/pcb-stackup/index.js | makeRenderLayerTask | function makeRenderLayerTask(layer) {
return function renderLayer(next) {
var stackupLayer = makeBaseStackupLayer(layer)
if (stackupLayer.converter) return next(null, stackupLayer)
var converter = gerberToSvg(
stackupLayer.gerber,
stackupLayer.options,
function handleLaye... | javascript | function makeRenderLayerTask(layer) {
return function renderLayer(next) {
var stackupLayer = makeBaseStackupLayer(layer)
if (stackupLayer.converter) return next(null, stackupLayer)
var converter = gerberToSvg(
stackupLayer.gerber,
stackupLayer.options,
function handleLaye... | [
"function",
"makeRenderLayerTask",
"(",
"layer",
")",
"{",
"return",
"function",
"renderLayer",
"(",
"next",
")",
"{",
"var",
"stackupLayer",
"=",
"makeBaseStackupLayer",
"(",
"layer",
")",
"if",
"(",
"stackupLayer",
".",
"converter",
")",
"return",
"next",
"(... | map an pcb-stackup input layer into a function that will call a callback once a pcb-stackup-core input layer is ready | [
"map",
"an",
"pcb",
"-",
"stackup",
"input",
"layer",
"into",
"a",
"function",
"that",
"will",
"call",
"a",
"callback",
"once",
"a",
"pcb",
"-",
"stackup",
"-",
"core",
"input",
"layer",
"is",
"ready"
] | e1cd3af69766ae2f08491cb2309a62013ff1f815 | https://github.com/tracespace/tracespace/blob/e1cd3af69766ae2f08491cb2309a62013ff1f815/packages/pcb-stackup/index.js#L70-L86 | train |
tracespace/tracespace | packages/pcb-stackup/index.js | makeBaseStackupLayer | function makeBaseStackupLayer(layer) {
var layerSide = layer.side
var layerType = layer.type
if (
layer.filename &&
typeof layerSide === 'undefined' &&
typeof layerType === 'undefined'
) {
var gerberId = layerTypes[layer.filename]
layerSide = gerberId.side
layerType ... | javascript | function makeBaseStackupLayer(layer) {
var layerSide = layer.side
var layerType = layer.type
if (
layer.filename &&
typeof layerSide === 'undefined' &&
typeof layerType === 'undefined'
) {
var gerberId = layerTypes[layer.filename]
layerSide = gerberId.side
layerType ... | [
"function",
"makeBaseStackupLayer",
"(",
"layer",
")",
"{",
"var",
"layerSide",
"=",
"layer",
".",
"side",
"var",
"layerType",
"=",
"layer",
".",
"type",
"if",
"(",
"layer",
".",
"filename",
"&&",
"typeof",
"layerSide",
"===",
"'undefined'",
"&&",
"typeof",
... | extend pcb-stackup input layer with necessary details for pcb-stackup-core | [
"extend",
"pcb",
"-",
"stackup",
"input",
"layer",
"with",
"necessary",
"details",
"for",
"pcb",
"-",
"stackup",
"-",
"core"
] | e1cd3af69766ae2f08491cb2309a62013ff1f815 | https://github.com/tracespace/tracespace/blob/e1cd3af69766ae2f08491cb2309a62013ff1f815/packages/pcb-stackup/index.js#L89-L122 | train |
tracespace/tracespace | packages/gerber-parser/lib/_parse-macro-expression.js | function() {
var t = tokens.shift()
var exp
if (RE_NUMBER.test(t)) {
exp = {type: 'n', val: t}
} else {
exp = parseExpression()
tokens.shift()
}
return exp
} | javascript | function() {
var t = tokens.shift()
var exp
if (RE_NUMBER.test(t)) {
exp = {type: 'n', val: t}
} else {
exp = parseExpression()
tokens.shift()
}
return exp
} | [
"function",
"(",
")",
"{",
"var",
"t",
"=",
"tokens",
".",
"shift",
"(",
")",
"var",
"exp",
"if",
"(",
"RE_NUMBER",
".",
"test",
"(",
"t",
")",
")",
"{",
"exp",
"=",
"{",
"type",
":",
"'n'",
",",
"val",
":",
"t",
"}",
"}",
"else",
"{",
"exp... | primary tokens are numbers and parentheses | [
"primary",
"tokens",
"are",
"numbers",
"and",
"parentheses"
] | e1cd3af69766ae2f08491cb2309a62013ff1f815 | https://github.com/tracespace/tracespace/blob/e1cd3af69766ae2f08491cb2309a62013ff1f815/packages/gerber-parser/lib/_parse-macro-expression.js#L16-L27 | train | |
tracespace/tracespace | packages/gerber-parser/lib/_parse-macro-expression.js | function() {
var exp = parsePrimary()
var t = tokens[0]
if (t === 'X') {
parser._warn("multiplication in macros should use 'x', not 'X'")
t = 'x'
}
while (t === 'x' || t === '/') {
tokens.shift()
var right = parsePrimary()
exp = {type: t, left: exp, right: right}
... | javascript | function() {
var exp = parsePrimary()
var t = tokens[0]
if (t === 'X') {
parser._warn("multiplication in macros should use 'x', not 'X'")
t = 'x'
}
while (t === 'x' || t === '/') {
tokens.shift()
var right = parsePrimary()
exp = {type: t, left: exp, right: right}
... | [
"function",
"(",
")",
"{",
"var",
"exp",
"=",
"parsePrimary",
"(",
")",
"var",
"t",
"=",
"tokens",
"[",
"0",
"]",
"if",
"(",
"t",
"===",
"'X'",
")",
"{",
"parser",
".",
"_warn",
"(",
"\"multiplication in macros should use 'x', not 'X'\"",
")",
"t",
"=",
... | parse multiplication and division tokens | [
"parse",
"multiplication",
"and",
"division",
"tokens"
] | e1cd3af69766ae2f08491cb2309a62013ff1f815 | https://github.com/tracespace/tracespace/blob/e1cd3af69766ae2f08491cb2309a62013ff1f815/packages/gerber-parser/lib/_parse-macro-expression.js#L30-L45 | train | |
tracespace/tracespace | packages/gerber-parser/lib/_parse-macro-expression.js | function(op, mods) {
var getValue = function(t) {
if (t[0] === '$') {
return Number(mods[t])
}
return Number(t)
}
var type = op.type
if (type === 'n') {
return getValue(op.val)
}
if (type === '+') {
return evaluate(op.left, mods) + evaluate(op.right, mods)
... | javascript | function(op, mods) {
var getValue = function(t) {
if (t[0] === '$') {
return Number(mods[t])
}
return Number(t)
}
var type = op.type
if (type === 'n') {
return getValue(op.val)
}
if (type === '+') {
return evaluate(op.left, mods) + evaluate(op.right, mods)
... | [
"function",
"(",
"op",
",",
"mods",
")",
"{",
"var",
"getValue",
"=",
"function",
"(",
"t",
")",
"{",
"if",
"(",
"t",
"[",
"0",
"]",
"===",
"'$'",
")",
"{",
"return",
"Number",
"(",
"mods",
"[",
"t",
"]",
")",
"}",
"return",
"Number",
"(",
"t... | evalute by recursively traversing the tree | [
"evalute",
"by",
"recursively",
"traversing",
"the",
"tree"
] | e1cd3af69766ae2f08491cb2309a62013ff1f815 | https://github.com/tracespace/tracespace/blob/e1cd3af69766ae2f08491cb2309a62013ff1f815/packages/gerber-parser/lib/_parse-macro-expression.js#L64-L87 | train | |
zerobias/telegram-mtproto | src/vendor/leemon.js | findPrimes | function findPrimes(n) {
var i, s, p, ans;
s=new Array(n);
for (i=0; i<n; i++)
s[i]=0;
s[0]=2;
p=0; //first p elements of s are primes, the rest are a sieve
for (;s[p]<n;) { //s[p] is the pth prime
for (i=s[p]*s[p]; i<n; i+=s[p]) //mark multiples of s[p]
s[i]=1;
p++;
... | javascript | function findPrimes(n) {
var i, s, p, ans;
s=new Array(n);
for (i=0; i<n; i++)
s[i]=0;
s[0]=2;
p=0; //first p elements of s are primes, the rest are a sieve
for (;s[p]<n;) { //s[p] is the pth prime
for (i=s[p]*s[p]; i<n; i+=s[p]) //mark multiples of s[p]
s[i]=1;
p++;
... | [
"function",
"findPrimes",
"(",
"n",
")",
"{",
"var",
"i",
",",
"s",
",",
"p",
",",
"ans",
";",
"s",
"=",
"new",
"Array",
"(",
"n",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"s",
"[",
"i",
"]",
"=",
... | return array of all primes less than integer n | [
"return",
"array",
"of",
"all",
"primes",
"less",
"than",
"integer",
"n"
] | 3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522 | https://github.com/zerobias/telegram-mtproto/blob/3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522/src/vendor/leemon.js#L224-L242 | train |
zerobias/telegram-mtproto | src/vendor/leemon.js | millerRabinInt | function millerRabinInt(x, b) {
if (mr_x1.length!=x.length) {
mr_x1=dup(x);
mr_r=dup(x);
mr_a=dup(x);
}
copyInt_(mr_a, b);
return millerRabin(x, mr_a);
} | javascript | function millerRabinInt(x, b) {
if (mr_x1.length!=x.length) {
mr_x1=dup(x);
mr_r=dup(x);
mr_a=dup(x);
}
copyInt_(mr_a, b);
return millerRabin(x, mr_a);
} | [
"function",
"millerRabinInt",
"(",
"x",
",",
"b",
")",
"{",
"if",
"(",
"mr_x1",
".",
"length",
"!=",
"x",
".",
"length",
")",
"{",
"mr_x1",
"=",
"dup",
"(",
"x",
")",
";",
"mr_r",
"=",
"dup",
"(",
"x",
")",
";",
"mr_a",
"=",
"dup",
"(",
"x",
... | does a single round of Miller-Rabin base b consider x to be a possible prime? x is a bigInt, and b is an integer, with b<x | [
"does",
"a",
"single",
"round",
"of",
"Miller",
"-",
"Rabin",
"base",
"b",
"consider",
"x",
"to",
"be",
"a",
"possible",
"prime?",
"x",
"is",
"a",
"bigInt",
"and",
"b",
"is",
"an",
"integer",
"with",
"b<x"
] | 3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522 | https://github.com/zerobias/telegram-mtproto/blob/3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522/src/vendor/leemon.js#L247-L256 | train |
zerobias/telegram-mtproto | src/vendor/leemon.js | bitSize | function bitSize(x) {
var j, z, w;
for (j=x.length-1; (x[j]==0) && (j>0); j--);
for (z=0, w=x[j]; w; (w>>=1), z++);
z+=bpe*j;
return z;
} | javascript | function bitSize(x) {
var j, z, w;
for (j=x.length-1; (x[j]==0) && (j>0); j--);
for (z=0, w=x[j]; w; (w>>=1), z++);
z+=bpe*j;
return z;
} | [
"function",
"bitSize",
"(",
"x",
")",
"{",
"var",
"j",
",",
"z",
",",
"w",
";",
"for",
"(",
"j",
"=",
"x",
".",
"length",
"-",
"1",
";",
"(",
"x",
"[",
"j",
"]",
"==",
"0",
")",
"&&",
"(",
"j",
">",
"0",
")",
";",
"j",
"--",
")",
";",... | returns how many bits long the bigInt is, not counting leading zeros. | [
"returns",
"how",
"many",
"bits",
"long",
"the",
"bigInt",
"is",
"not",
"counting",
"leading",
"zeros",
"."
] | 3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522 | https://github.com/zerobias/telegram-mtproto/blob/3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522/src/vendor/leemon.js#L309-L315 | train |
zerobias/telegram-mtproto | src/vendor/leemon.js | expand | function expand(x, n) {
var ans=int2bigInt(0, (x.length>n ? x.length : n)*bpe, 0);
copy_(ans, x);
return ans;
} | javascript | function expand(x, n) {
var ans=int2bigInt(0, (x.length>n ? x.length : n)*bpe, 0);
copy_(ans, x);
return ans;
} | [
"function",
"expand",
"(",
"x",
",",
"n",
")",
"{",
"var",
"ans",
"=",
"int2bigInt",
"(",
"0",
",",
"(",
"x",
".",
"length",
">",
"n",
"?",
"x",
".",
"length",
":",
"n",
")",
"*",
"bpe",
",",
"0",
")",
";",
"copy_",
"(",
"ans",
",",
"x",
... | return a copy of x with at least n elements, adding leading zeros if needed | [
"return",
"a",
"copy",
"of",
"x",
"with",
"at",
"least",
"n",
"elements",
"adding",
"leading",
"zeros",
"if",
"needed"
] | 3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522 | https://github.com/zerobias/telegram-mtproto/blob/3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522/src/vendor/leemon.js#L318-L322 | train |
zerobias/telegram-mtproto | src/vendor/leemon.js | randTruePrime | function randTruePrime(k) {
var ans=int2bigInt(0, k, 0);
randTruePrime_(ans, k);
return trim(ans, 1);
} | javascript | function randTruePrime(k) {
var ans=int2bigInt(0, k, 0);
randTruePrime_(ans, k);
return trim(ans, 1);
} | [
"function",
"randTruePrime",
"(",
"k",
")",
"{",
"var",
"ans",
"=",
"int2bigInt",
"(",
"0",
",",
"k",
",",
"0",
")",
";",
"randTruePrime_",
"(",
"ans",
",",
"k",
")",
";",
"return",
"trim",
"(",
"ans",
",",
"1",
")",
";",
"}"
] | return a k-bit true random prime using Maurer's algorithm. | [
"return",
"a",
"k",
"-",
"bit",
"true",
"random",
"prime",
"using",
"Maurer",
"s",
"algorithm",
"."
] | 3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522 | https://github.com/zerobias/telegram-mtproto/blob/3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522/src/vendor/leemon.js#L325-L329 | train |
zerobias/telegram-mtproto | src/vendor/leemon.js | randProbPrime | function randProbPrime(k) {
if (k>=600) return randProbPrimeRounds(k, 2); //numbers from HAC table 4.3
if (k>=550) return randProbPrimeRounds(k, 4);
if (k>=500) return randProbPrimeRounds(k, 5);
if (k>=400) return randProbPrimeRounds(k, 6);
if (k>=350) return randProbPrimeRounds(k, 7);
if (k>=300) return ra... | javascript | function randProbPrime(k) {
if (k>=600) return randProbPrimeRounds(k, 2); //numbers from HAC table 4.3
if (k>=550) return randProbPrimeRounds(k, 4);
if (k>=500) return randProbPrimeRounds(k, 5);
if (k>=400) return randProbPrimeRounds(k, 6);
if (k>=350) return randProbPrimeRounds(k, 7);
if (k>=300) return ra... | [
"function",
"randProbPrime",
"(",
"k",
")",
"{",
"if",
"(",
"k",
">=",
"600",
")",
"return",
"randProbPrimeRounds",
"(",
"k",
",",
"2",
")",
";",
"//numbers from HAC table 4.3",
"if",
"(",
"k",
">=",
"550",
")",
"return",
"randProbPrimeRounds",
"(",
"k",
... | return a k-bit random probable prime with probability of error < 2^-80 | [
"return",
"a",
"k",
"-",
"bit",
"random",
"probable",
"prime",
"with",
"probability",
"of",
"error",
"<",
"2^",
"-",
"80"
] | 3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522 | https://github.com/zerobias/telegram-mtproto/blob/3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522/src/vendor/leemon.js#L332-L344 | train |
zerobias/telegram-mtproto | src/vendor/leemon.js | randBigInt_ | function randBigInt_(b, n, s) {
var i, a;
for (i=0; i<b.length; i++)
b[i]=0;
a=Math.floor((n-1)/bpe)+1; //# array elements to hold the BigInt
for (i=0; i<a; i++) {
b[i]=Math.floor(Math.random()*(1<<(bpe-1)));
}
b[a-1] &= (2<<((n-1)%bpe))-1;
if (s==1)
b[a-1] |= (1<<((n-1)%bpe));
} | javascript | function randBigInt_(b, n, s) {
var i, a;
for (i=0; i<b.length; i++)
b[i]=0;
a=Math.floor((n-1)/bpe)+1; //# array elements to hold the BigInt
for (i=0; i<a; i++) {
b[i]=Math.floor(Math.random()*(1<<(bpe-1)));
}
b[a-1] &= (2<<((n-1)%bpe))-1;
if (s==1)
b[a-1] |= (1<<((n-1)%bpe));
} | [
"function",
"randBigInt_",
"(",
"b",
",",
"n",
",",
"s",
")",
"{",
"var",
"i",
",",
"a",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"b",
".",
"length",
";",
"i",
"++",
")",
"b",
"[",
"i",
"]",
"=",
"0",
";",
"a",
"=",
"Math",
".",
... | Set b to an n-bit random BigInt. If s=1, then the most significant of those n bits is set to 1. Array b must be big enough to hold the result. Must have n>=1 | [
"Set",
"b",
"to",
"an",
"n",
"-",
"bit",
"random",
"BigInt",
".",
"If",
"s",
"=",
"1",
"then",
"the",
"most",
"significant",
"of",
"those",
"n",
"bits",
"is",
"set",
"to",
"1",
".",
"Array",
"b",
"must",
"be",
"big",
"enough",
"to",
"hold",
"the"... | 3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522 | https://github.com/zerobias/telegram-mtproto/blob/3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522/src/vendor/leemon.js#L593-L604 | train |
zerobias/telegram-mtproto | src/vendor/leemon.js | carry_ | function carry_(x) {
var i, k, c, b;
k=x.length;
c=0;
for (i=0; i<k; i++) {
c+=x[i];
b=0;
if (c<0) {
b=-(c>>bpe);
c+=b*radix;
}
x[i]=c & mask;
c=(c>>bpe)-b;
}
} | javascript | function carry_(x) {
var i, k, c, b;
k=x.length;
c=0;
for (i=0; i<k; i++) {
c+=x[i];
b=0;
if (c<0) {
b=-(c>>bpe);
c+=b*radix;
}
x[i]=c & mask;
c=(c>>bpe)-b;
}
} | [
"function",
"carry_",
"(",
"x",
")",
"{",
"var",
"i",
",",
"k",
",",
"c",
",",
"b",
";",
"k",
"=",
"x",
".",
"length",
";",
"c",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"k",
";",
"i",
"++",
")",
"{",
"c",
"+=",
"x",
... | do carries and borrows so each element of the bigInt x fits in bpe bits. | [
"do",
"carries",
"and",
"borrows",
"so",
"each",
"element",
"of",
"the",
"bigInt",
"x",
"fits",
"in",
"bpe",
"bits",
"."
] | 3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522 | https://github.com/zerobias/telegram-mtproto/blob/3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522/src/vendor/leemon.js#L944-L958 | train |
zerobias/telegram-mtproto | src/vendor/leemon.js | modInt | function modInt(x, n) {
var i, c=0;
for (i=x.length-1; i>=0; i--)
c=(c*radix+x[i])%n;
return c;
} | javascript | function modInt(x, n) {
var i, c=0;
for (i=x.length-1; i>=0; i--)
c=(c*radix+x[i])%n;
return c;
} | [
"function",
"modInt",
"(",
"x",
",",
"n",
")",
"{",
"var",
"i",
",",
"c",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"x",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"c",
"=",
"(",
"c",
"*",
"radix",
"+",
"x",
"[",
"i... | return x mod n for bigInt x and integer n. | [
"return",
"x",
"mod",
"n",
"for",
"bigInt",
"x",
"and",
"integer",
"n",
"."
] | 3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522 | https://github.com/zerobias/telegram-mtproto/blob/3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522/src/vendor/leemon.js#L961-L966 | train |
zerobias/telegram-mtproto | src/vendor/leemon.js | equals | function equals(x, y) {
var i;
var k=x.length<y.length ? x.length : y.length;
for (i=0; i<k; i++)
if (x[i]!=y[i])
return 0;
if (x.length>y.length) {
for (;i<x.length; i++)
if (x[i])
return 0;
} else {
for (;i<y.length; i++)
if (y[i])
return 0;
}
return 1;
} | javascript | function equals(x, y) {
var i;
var k=x.length<y.length ? x.length : y.length;
for (i=0; i<k; i++)
if (x[i]!=y[i])
return 0;
if (x.length>y.length) {
for (;i<x.length; i++)
if (x[i])
return 0;
} else {
for (;i<y.length; i++)
if (y[i])
return 0;
}
return 1;
} | [
"function",
"equals",
"(",
"x",
",",
"y",
")",
"{",
"var",
"i",
";",
"var",
"k",
"=",
"x",
".",
"length",
"<",
"y",
".",
"length",
"?",
"x",
".",
"length",
":",
"y",
".",
"length",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"k",
";",
... | are bigints x and y equal? this works even if x and y are different lengths and have arbitrarily many leading zeros | [
"are",
"bigints",
"x",
"and",
"y",
"equal?",
"this",
"works",
"even",
"if",
"x",
"and",
"y",
"are",
"different",
"lengths",
"and",
"have",
"arbitrarily",
"many",
"leading",
"zeros"
] | 3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522 | https://github.com/zerobias/telegram-mtproto/blob/3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522/src/vendor/leemon.js#L1048-L1064 | train |
zerobias/telegram-mtproto | src/vendor/leemon.js | mod_ | function mod_(x, n) {
if (s4.length!=x.length)
s4=dup(x);
else
copy_(s4, x);
if (s5.length!=x.length)
s5=dup(x);
divide_(s4, n, s5, x); //x = remainder of s4 / n
} | javascript | function mod_(x, n) {
if (s4.length!=x.length)
s4=dup(x);
else
copy_(s4, x);
if (s5.length!=x.length)
s5=dup(x);
divide_(s4, n, s5, x); //x = remainder of s4 / n
} | [
"function",
"mod_",
"(",
"x",
",",
"n",
")",
"{",
"if",
"(",
"s4",
".",
"length",
"!=",
"x",
".",
"length",
")",
"s4",
"=",
"dup",
"(",
"x",
")",
";",
"else",
"copy_",
"(",
"s4",
",",
"x",
")",
";",
"if",
"(",
"s5",
".",
"length",
"!=",
"... | do x=x mod n for bigInts x and n. | [
"do",
"x",
"=",
"x",
"mod",
"n",
"for",
"bigInts",
"x",
"and",
"n",
"."
] | 3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522 | https://github.com/zerobias/telegram-mtproto/blob/3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522/src/vendor/leemon.js#L1345-L1353 | train |
zerobias/telegram-mtproto | src/vendor/leemon.js | trim | function trim(x, k) {
var i, y;
for (i=x.length; i>0 && !x[i-1]; i--);
y=new Array(i+k);
copy_(y, x);
return y;
} | javascript | function trim(x, k) {
var i, y;
for (i=x.length; i>0 && !x[i-1]; i--);
y=new Array(i+k);
copy_(y, x);
return y;
} | [
"function",
"trim",
"(",
"x",
",",
"k",
")",
"{",
"var",
"i",
",",
"y",
";",
"for",
"(",
"i",
"=",
"x",
".",
"length",
";",
"i",
">",
"0",
"&&",
"!",
"x",
"[",
"i",
"-",
"1",
"]",
";",
"i",
"--",
")",
";",
"y",
"=",
"new",
"Array",
"(... | return x with exactly k leading zero elements | [
"return",
"x",
"with",
"exactly",
"k",
"leading",
"zero",
"elements"
] | 3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522 | https://github.com/zerobias/telegram-mtproto/blob/3f8ba3c69974f4d4d6cc183ed2893b8ef30f3522/src/vendor/leemon.js#L1393-L1399 | train |
lucasferreira/react-native-flash-message | src/FlashMessage.js | parseIcon | function parseIcon(icon = "none") {
if (!!icon && icon !== "none") {
if (typeof icon === "string") {
return { icon, position: "left", style: {} };
}
return { position: "left", style: {}, ...icon };
}
return null;
} | javascript | function parseIcon(icon = "none") {
if (!!icon && icon !== "none") {
if (typeof icon === "string") {
return { icon, position: "left", style: {} };
}
return { position: "left", style: {}, ...icon };
}
return null;
} | [
"function",
"parseIcon",
"(",
"icon",
"=",
"\"none\"",
")",
"{",
"if",
"(",
"!",
"!",
"icon",
"&&",
"icon",
"!==",
"\"none\"",
")",
"{",
"if",
"(",
"typeof",
"icon",
"===",
"\"string\"",
")",
"{",
"return",
"{",
"icon",
",",
"position",
":",
"\"left\... | Translates icon prop value into complex internal object | [
"Translates",
"icon",
"prop",
"value",
"into",
"complex",
"internal",
"object"
] | 88caa5ac87f61988f5e43f39ccb137f855e1d2b8 | https://github.com/lucasferreira/react-native-flash-message/blob/88caa5ac87f61988f5e43f39ccb137f855e1d2b8/src/FlashMessage.js#L50-L60 | train |
vuikit/vuikit | packages/vuikit/src/core/v-position/directive.js | getOptions | function getOptions (ctx) {
const { vnode } = ctx
const { value } = ctx.binding
if (process.env.NODE_ENV !== 'production' && (isUndefined(value) || !isObject(value))) {
warn('v-position -> configuration is missing or is not an Object', vnode.context)
}
const options = assign({
target: null,
posi... | javascript | function getOptions (ctx) {
const { vnode } = ctx
const { value } = ctx.binding
if (process.env.NODE_ENV !== 'production' && (isUndefined(value) || !isObject(value))) {
warn('v-position -> configuration is missing or is not an Object', vnode.context)
}
const options = assign({
target: null,
posi... | [
"function",
"getOptions",
"(",
"ctx",
")",
"{",
"const",
"{",
"vnode",
"}",
"=",
"ctx",
"const",
"{",
"value",
"}",
"=",
"ctx",
".",
"binding",
"if",
"(",
"process",
".",
"env",
".",
"NODE_ENV",
"!==",
"'production'",
"&&",
"(",
"isUndefined",
"(",
"... | Get the directive props | [
"Get",
"the",
"directive",
"props"
] | 98be3d9414edbb43cfc227d8120f090b6edab97e | https://github.com/vuikit/vuikit/blob/98be3d9414edbb43cfc227d8120f090b6edab97e/packages/vuikit/src/core/v-position/directive.js#L87-L105 | train |
vuikit/vuikit | packages/vuikit/src/core/v-position/directive.js | getContext | function getContext (el, binding, vnode) {
const ctx = { el, binding, vnode }
ctx.props = getOptions(ctx)
if (!ctx.props) {
binding.def.unbind(el, binding)
return
}
return ctx
} | javascript | function getContext (el, binding, vnode) {
const ctx = { el, binding, vnode }
ctx.props = getOptions(ctx)
if (!ctx.props) {
binding.def.unbind(el, binding)
return
}
return ctx
} | [
"function",
"getContext",
"(",
"el",
",",
"binding",
",",
"vnode",
")",
"{",
"const",
"ctx",
"=",
"{",
"el",
",",
"binding",
",",
"vnode",
"}",
"ctx",
".",
"props",
"=",
"getOptions",
"(",
"ctx",
")",
"if",
"(",
"!",
"ctx",
".",
"props",
")",
"{"... | Get the context used across | [
"Get",
"the",
"context",
"used",
"across"
] | 98be3d9414edbb43cfc227d8120f090b6edab97e | https://github.com/vuikit/vuikit/blob/98be3d9414edbb43cfc227d8120f090b6edab97e/packages/vuikit/src/core/v-position/directive.js#L110-L120 | train |
WP-API/node-wpapi | lib/resource-handler-spec.js | extractSetterFromNode | function extractSetterFromNode( handler, node ) {
assignSetterFnForNode( handler, node );
if ( node.children ) {
// Recurse down to this node's children
Object.keys( node.children ).forEach( ( key ) => {
extractSetterFromNode( handler, node.children[ key ] );
} );
}
} | javascript | function extractSetterFromNode( handler, node ) {
assignSetterFnForNode( handler, node );
if ( node.children ) {
// Recurse down to this node's children
Object.keys( node.children ).forEach( ( key ) => {
extractSetterFromNode( handler, node.children[ key ] );
} );
}
} | [
"function",
"extractSetterFromNode",
"(",
"handler",
",",
"node",
")",
"{",
"assignSetterFnForNode",
"(",
"handler",
",",
"node",
")",
";",
"if",
"(",
"node",
".",
"children",
")",
"{",
"// Recurse down to this node's children",
"Object",
".",
"keys",
"(",
"node... | Walk the tree of a specific resource node to create the setter methods
The API we want to produce from the node tree looks like this:
wp.posts(); /wp/v2/posts
wp.posts().id( 7 ); /wp/v2/posts/7
wp.posts().id( 7 ).revisions(); /wp/v2/posts/7/revisions
wp.posts().id( 7 ).revisio... | [
"Walk",
"the",
"tree",
"of",
"a",
"specific",
"resource",
"node",
"to",
"create",
"the",
"setter",
"methods"
] | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/lib/resource-handler-spec.js#L72-L82 | train |
WP-API/node-wpapi | lib/resource-handler-spec.js | createNodeHandlerSpec | function createNodeHandlerSpec( routeDefinition, resource ) {
const handler = {
// A "path" is an ordered (by key) set of values composed into the final URL
_path: {
'0': resource,
},
// A "level" is a level-keyed object representing the valid options for
// one level of the resource URL
_levels: {},
... | javascript | function createNodeHandlerSpec( routeDefinition, resource ) {
const handler = {
// A "path" is an ordered (by key) set of values composed into the final URL
_path: {
'0': resource,
},
// A "level" is a level-keyed object representing the valid options for
// one level of the resource URL
_levels: {},
... | [
"function",
"createNodeHandlerSpec",
"(",
"routeDefinition",
",",
"resource",
")",
"{",
"const",
"handler",
"=",
"{",
"// A \"path\" is an ordered (by key) set of values composed into the final URL",
"_path",
":",
"{",
"'0'",
":",
"resource",
",",
"}",
",",
"// A \"level\... | Create a node handler specification object from a route definition object
@name create
@param {object} routeDefinition A route definition object
@param {string} resource The string key of the resource for which to create a handler
@returns {object} A handler spec object with _path, _levels and _setters properties | [
"Create",
"a",
"node",
"handler",
"specification",
"object",
"from",
"a",
"route",
"definition",
"object"
] | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/lib/resource-handler-spec.js#L92-L122 | train |
WP-API/node-wpapi | lib/path-part-setter.js | createPathPartSetter | function createPathPartSetter( node ) {
// Local references to `node` properties used by returned functions
const nodeLevel = node.level;
const nodeName = node.names[ 0 ];
const supportedMethods = node.methods || [];
const dynamicChildren = node.children ?
Object.keys( node.children )
.map( key => node.childr... | javascript | function createPathPartSetter( node ) {
// Local references to `node` properties used by returned functions
const nodeLevel = node.level;
const nodeName = node.names[ 0 ];
const supportedMethods = node.methods || [];
const dynamicChildren = node.children ?
Object.keys( node.children )
.map( key => node.childr... | [
"function",
"createPathPartSetter",
"(",
"node",
")",
"{",
"// Local references to `node` properties used by returned functions",
"const",
"nodeLevel",
"=",
"node",
".",
"level",
";",
"const",
"nodeName",
"=",
"node",
".",
"names",
"[",
"0",
"]",
";",
"const",
"supp... | Return a function to set part of the request URL path.
Path part setter methods may be either dynamic (*i.e.* may represent a
"named group") or non-dynamic (representing a static part of the URL, which
is usually a collection endpoint of some sort). Which type of function is
returned depends on whether a given route h... | [
"Return",
"a",
"function",
"to",
"set",
"part",
"of",
"the",
"request",
"URL",
"path",
"."
] | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/lib/path-part-setter.js#L18-L83 | train |
WP-API/node-wpapi | lib/wp-register-route.js | registerRoute | function registerRoute( namespace, restBase, options = {} ) {
// Support all methods until requested to do otherwise
let supportedMethods = [ 'head', 'get', 'patch', 'put', 'post', 'delete' ];
if ( Array.isArray( options.methods ) ) {
// Permit supported methods to be specified as an array
supportedMethods = op... | javascript | function registerRoute( namespace, restBase, options = {} ) {
// Support all methods until requested to do otherwise
let supportedMethods = [ 'head', 'get', 'patch', 'put', 'post', 'delete' ];
if ( Array.isArray( options.methods ) ) {
// Permit supported methods to be specified as an array
supportedMethods = op... | [
"function",
"registerRoute",
"(",
"namespace",
",",
"restBase",
",",
"options",
"=",
"{",
"}",
")",
"{",
"// Support all methods until requested to do otherwise",
"let",
"supportedMethods",
"=",
"[",
"'head'",
",",
"'get'",
",",
"'patch'",
",",
"'put'",
",",
"'pos... | Create and return a handler for an arbitrary WP REST API endpoint.
The first two parameters mirror `register_rest_route` in the REST API
codebase:
@memberof! WPAPI#
@param {string} namespace A namespace string, e.g. 'myplugin/v1'
@param {string} restBase A REST route string, e.g. '/author/(?P<id>... | [
"Create",
"and",
"return",
"a",
"handler",
"for",
"an",
"arbitrary",
"WP",
"REST",
"API",
"endpoint",
"."
] | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/lib/wp-register-route.js#L23-L100 | train |
WP-API/node-wpapi | lib/route-tree.js | reduceRouteComponents | function reduceRouteComponents( routeObj, topLevel, parentLevel, component, idx, components ) {
// Check to see if this component is a dynamic URL segment (i.e. defined by
// a named capture group regular expression). namedGroup will be `null` if
// the regexp does not match, or else an array defining the RegExp mat... | javascript | function reduceRouteComponents( routeObj, topLevel, parentLevel, component, idx, components ) {
// Check to see if this component is a dynamic URL segment (i.e. defined by
// a named capture group regular expression). namedGroup will be `null` if
// the regexp does not match, or else an array defining the RegExp mat... | [
"function",
"reduceRouteComponents",
"(",
"routeObj",
",",
"topLevel",
",",
"parentLevel",
",",
"component",
",",
"idx",
",",
"components",
")",
"{",
"// Check to see if this component is a dynamic URL segment (i.e. defined by",
"// a named capture group regular expression). namedG... | Method to use when reducing route components array.
@private
@param {object} routeObj A route definition object (set via .bind partial application)
@param {object} topLevel The top-level route tree object for this set of routes (set
via .bind partial application)
@param {object} parentLevel The memo object, w... | [
"Method",
"to",
"use",
"when",
"reducing",
"route",
"components",
"array",
"."
] | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/lib/route-tree.js#L25-L127 | train |
WP-API/node-wpapi | wpapi.js | WPAPI | function WPAPI( options ) {
// Enforce `new`
if ( this instanceof WPAPI === false ) {
return new WPAPI( options );
}
if ( typeof options.endpoint !== 'string' ) {
throw new Error( 'options hash must contain an API endpoint URL string' );
}
// Dictionary to be filled by handlers for default namespaces
this... | javascript | function WPAPI( options ) {
// Enforce `new`
if ( this instanceof WPAPI === false ) {
return new WPAPI( options );
}
if ( typeof options.endpoint !== 'string' ) {
throw new Error( 'options hash must contain an API endpoint URL string' );
}
// Dictionary to be filled by handlers for default namespaces
this... | [
"function",
"WPAPI",
"(",
"options",
")",
"{",
"// Enforce `new`",
"if",
"(",
"this",
"instanceof",
"WPAPI",
"===",
"false",
")",
"{",
"return",
"new",
"WPAPI",
"(",
"options",
")",
";",
"}",
"if",
"(",
"typeof",
"options",
".",
"endpoint",
"!==",
"'stri... | Construct a REST API client instance object to create
@constructor WPAPI
@param {Object} options An options hash to configure the instance
@param {String} options.endpoint The URI for a WP-API endpoint
@param {String} [options.username] A WP-API Basic Auth username
@param {String} [options.password] A... | [
"Construct",
"a",
"REST",
"API",
"client",
"instance",
"object",
"to",
"create"
] | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/wpapi.js#L54-L83 | train |
WP-API/node-wpapi | lib/constructors/wp-request.js | WPRequest | function WPRequest( options ) {
/**
* Configuration options for the request
*
* @property _options
* @type Object
* @private
* @default {}
*/
this._options = [
// Whitelisted options keys
'auth',
'endpoint',
'headers',
'username',
'password',
'nonce',
].reduce( ( localOptions, key ) => {
... | javascript | function WPRequest( options ) {
/**
* Configuration options for the request
*
* @property _options
* @type Object
* @private
* @default {}
*/
this._options = [
// Whitelisted options keys
'auth',
'endpoint',
'headers',
'username',
'password',
'nonce',
].reduce( ( localOptions, key ) => {
... | [
"function",
"WPRequest",
"(",
"options",
")",
"{",
"/**\n\t * Configuration options for the request\n\t *\n\t * @property _options\n\t * @type Object\n\t * @private\n\t * @default {}\n\t */",
"this",
".",
"_options",
"=",
"[",
"// Whitelisted options keys",
"'auth'",
",",
"'endpoint'",... | WPRequest is the base API request object constructor
@constructor WPRequest
@param {Object} options A hash of options for the WPRequest instance
@param {String} options.endpoint The endpoint URI for the invoking WPAPI instance
@param {Object} options.transport An object of http transport methods (get, post, etc)
@para... | [
"WPRequest",
"is",
"the",
"base",
"API",
"request",
"object",
"constructor"
] | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/lib/constructors/wp-request.js#L22-L87 | train |
WP-API/node-wpapi | lib/endpoint-request.js | createEndpointRequest | function createEndpointRequest( handlerSpec, resource, namespace ) {
// Create the constructor function for this endpoint
class EndpointRequest extends WPRequest {
constructor( options ) {
super( options );
/**
* Semi-private instance property specifying the available URL path options
* for this end... | javascript | function createEndpointRequest( handlerSpec, resource, namespace ) {
// Create the constructor function for this endpoint
class EndpointRequest extends WPRequest {
constructor( options ) {
super( options );
/**
* Semi-private instance property specifying the available URL path options
* for this end... | [
"function",
"createEndpointRequest",
"(",
"handlerSpec",
",",
"resource",
",",
"namespace",
")",
"{",
"// Create the constructor function for this endpoint",
"class",
"EndpointRequest",
"extends",
"WPRequest",
"{",
"constructor",
"(",
"options",
")",
"{",
"super",
"(",
... | Create an endpoint request handler constructor for a specific resource tree
@method create
@param {Object} handlerSpec A resource handler specification object
@param {String} resource The root resource of requests created from the returned factory
@param {String} namespace The namespace string for the returned fa... | [
"Create",
"an",
"endpoint",
"request",
"handler",
"constructor",
"for",
"a",
"specific",
"resource",
"tree"
] | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/lib/endpoint-request.js#L20-L68 | train |
WP-API/node-wpapi | superagent/http-transport.js | _setHeaders | function _setHeaders( request, options ) {
// If there's no headers, do nothing
if ( ! options.headers ) {
return request;
}
return objectReduce(
options.headers,
( request, value, key ) => request.set( key, value ),
request
);
} | javascript | function _setHeaders( request, options ) {
// If there's no headers, do nothing
if ( ! options.headers ) {
return request;
}
return objectReduce(
options.headers,
( request, value, key ) => request.set( key, value ),
request
);
} | [
"function",
"_setHeaders",
"(",
"request",
",",
"options",
")",
"{",
"// If there's no headers, do nothing",
"if",
"(",
"!",
"options",
".",
"headers",
")",
"{",
"return",
"request",
";",
"}",
"return",
"objectReduce",
"(",
"options",
".",
"headers",
",",
"(",... | Set any provided headers on the outgoing request object. Runs after _auth.
@method _setHeaders
@private
@param {Object} request A superagent request object
@param {Object} options A WPRequest _options object
@param {Object} A superagent request object, with any available headers set | [
"Set",
"any",
"provided",
"headers",
"on",
"the",
"outgoing",
"request",
"object",
".",
"Runs",
"after",
"_auth",
"."
] | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/superagent/http-transport.js#L23-L34 | train |
WP-API/node-wpapi | superagent/http-transport.js | _auth | function _auth( request, options, forceAuthentication ) {
// If we're not supposed to authenticate, don't even start
if ( ! forceAuthentication && ! options.auth && ! options.nonce ) {
return request;
}
// Enable nonce in options for Cookie authentication http://wp-api.org/guides/authentication.html
if ( option... | javascript | function _auth( request, options, forceAuthentication ) {
// If we're not supposed to authenticate, don't even start
if ( ! forceAuthentication && ! options.auth && ! options.nonce ) {
return request;
}
// Enable nonce in options for Cookie authentication http://wp-api.org/guides/authentication.html
if ( option... | [
"function",
"_auth",
"(",
"request",
",",
"options",
",",
"forceAuthentication",
")",
"{",
"// If we're not supposed to authenticate, don't even start",
"if",
"(",
"!",
"forceAuthentication",
"&&",
"!",
"options",
".",
"auth",
"&&",
"!",
"options",
".",
"nonce",
")"... | Conditionally set basic authentication on a server request object.
@method _auth
@private
@param {Object} request A superagent request object
@param {Object} options A WPRequest _options object
@param {Boolean} forceAuthentication whether to force authentication on the request
@param {Object} A superagent request obje... | [
"Conditionally",
"set",
"basic",
"authentication",
"on",
"a",
"server",
"request",
"object",
"."
] | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/superagent/http-transport.js#L46-L69 | train |
WP-API/node-wpapi | superagent/http-transport.js | createPaginationObject | function createPaginationObject( result, options, httpTransport ) {
let _paging = null;
if ( ! result.headers ) {
// No headers: return as-is
return _paging;
}
// Guard against capitalization inconsistencies in returned headers
Object.keys( result.headers ).forEach( ( header ) => {
result.headers[ header.t... | javascript | function createPaginationObject( result, options, httpTransport ) {
let _paging = null;
if ( ! result.headers ) {
// No headers: return as-is
return _paging;
}
// Guard against capitalization inconsistencies in returned headers
Object.keys( result.headers ).forEach( ( header ) => {
result.headers[ header.t... | [
"function",
"createPaginationObject",
"(",
"result",
",",
"options",
",",
"httpTransport",
")",
"{",
"let",
"_paging",
"=",
"null",
";",
"if",
"(",
"!",
"result",
".",
"headers",
")",
"{",
"// No headers: return as-is",
"return",
"_paging",
";",
"}",
"// Guard... | If the response is not paged, return the body as-is. If pagination
information is present in the response headers, parse those headers into
a custom `_paging` property on the response body. `_paging` contains links
to the previous and next pages in the collection, as well as metadata
about the size and number of pages ... | [
"If",
"the",
"response",
"is",
"not",
"paged",
"return",
"the",
"body",
"as",
"-",
"is",
".",
"If",
"pagination",
"information",
"is",
"present",
"in",
"the",
"response",
"headers",
"parse",
"those",
"headers",
"into",
"a",
"custom",
"_paging",
"property",
... | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/superagent/http-transport.js#L120-L176 | train |
WP-API/node-wpapi | superagent/http-transport.js | returnBody | function returnBody( wpreq, result ) {
const body = extractResponseBody( result );
const _paging = createPaginationObject( result, wpreq._options, wpreq.transport );
if ( _paging ) {
body._paging = _paging;
}
return body;
} | javascript | function returnBody( wpreq, result ) {
const body = extractResponseBody( result );
const _paging = createPaginationObject( result, wpreq._options, wpreq.transport );
if ( _paging ) {
body._paging = _paging;
}
return body;
} | [
"function",
"returnBody",
"(",
"wpreq",
",",
"result",
")",
"{",
"const",
"body",
"=",
"extractResponseBody",
"(",
"result",
")",
";",
"const",
"_paging",
"=",
"createPaginationObject",
"(",
"result",
",",
"wpreq",
".",
"_options",
",",
"wpreq",
".",
"transp... | Return the body of the request, augmented with pagination information if the
result is a paged collection.
@private
@param {WPRequest} wpreq The WPRequest representing the returned HTTP response
@param {Object} result The results from the HTTP request
@returns {Object} The "body" property of the result, conditionally ... | [
"Return",
"the",
"body",
"of",
"the",
"request",
"augmented",
"with",
"pagination",
"information",
"if",
"the",
"result",
"is",
"a",
"paged",
"collection",
"."
] | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/superagent/http-transport.js#L240-L247 | train |
WP-API/node-wpapi | superagent/http-transport.js | _httpPost | function _httpPost( wpreq, data, callback ) {
checkMethodSupport( 'post', wpreq );
const url = wpreq.toString();
data = data || {};
let request = _auth( agent.post( url ), wpreq._options, true );
request = _setHeaders( request, wpreq._options );
if ( wpreq._attachment ) {
// Data must be form-encoded alongside... | javascript | function _httpPost( wpreq, data, callback ) {
checkMethodSupport( 'post', wpreq );
const url = wpreq.toString();
data = data || {};
let request = _auth( agent.post( url ), wpreq._options, true );
request = _setHeaders( request, wpreq._options );
if ( wpreq._attachment ) {
// Data must be form-encoded alongside... | [
"function",
"_httpPost",
"(",
"wpreq",
",",
"data",
",",
"callback",
")",
"{",
"checkMethodSupport",
"(",
"'post'",
",",
"wpreq",
")",
";",
"const",
"url",
"=",
"wpreq",
".",
"toString",
"(",
")",
";",
"data",
"=",
"data",
"||",
"{",
"}",
";",
"let",... | Invoke an HTTP "POST" request against the provided endpoint
@method post
@async
@param {WPRequest} wpreq A WPRequest query object
@param {Object} data The data for the POST request
@param {Function} [callback] A callback to invoke with the results of the POST request
@returns {Promise} A promise to the results of the H... | [
"Invoke",
"an",
"HTTP",
"POST",
"request",
"against",
"the",
"provided",
"endpoint"
] | 613655cde217548bf1d7e2842b1b5e7a338114fd | https://github.com/WP-API/node-wpapi/blob/613655cde217548bf1d7e2842b1b5e7a338114fd/superagent/http-transport.js#L289-L308 | train |
zeit/now-env | lib/apply-env.js | applyEnv | function applyEnv(env, secrets = {}, required = {}) {
if (Array.isArray(env)) {
env.forEach(key => {
// if the key already exists don't overwrite it
if (!process.env[key]) {
const value = getValue(key, {}, secrets, required)
process.env[key] = value
}
})
} else {
Object... | javascript | function applyEnv(env, secrets = {}, required = {}) {
if (Array.isArray(env)) {
env.forEach(key => {
// if the key already exists don't overwrite it
if (!process.env[key]) {
const value = getValue(key, {}, secrets, required)
process.env[key] = value
}
})
} else {
Object... | [
"function",
"applyEnv",
"(",
"env",
",",
"secrets",
"=",
"{",
"}",
",",
"required",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"env",
")",
")",
"{",
"env",
".",
"forEach",
"(",
"key",
"=>",
"{",
"// if the key already exists do... | Apply the environment variables to `process.env`
@param {Object} env Map of environment variables
@param {Object} secrets Map of secrets
@param {Object} required Map of required values | [
"Apply",
"the",
"environment",
"variables",
"to",
"process",
".",
"env"
] | 7761209e7c2500a17ca89398e62f65e6eb31af5d | https://github.com/zeit/now-env/blob/7761209e7c2500a17ca89398e62f65e6eb31af5d/lib/apply-env.js#L9-L27 | train |
zeit/now-env | index.js | config | function config() {
// only run this if it's not running inside Now.sh
if (Boolean(process.env.NOW_REGION || process.env.NOW)) return
const secrets = loadSecrets()
const required = loadRequired()
// load environment variables from now.json
loadNowJSON(secrets, required)
} | javascript | function config() {
// only run this if it's not running inside Now.sh
if (Boolean(process.env.NOW_REGION || process.env.NOW)) return
const secrets = loadSecrets()
const required = loadRequired()
// load environment variables from now.json
loadNowJSON(secrets, required)
} | [
"function",
"config",
"(",
")",
"{",
"// only run this if it's not running inside Now.sh",
"if",
"(",
"Boolean",
"(",
"process",
".",
"env",
".",
"NOW_REGION",
"||",
"process",
".",
"env",
".",
"NOW",
")",
")",
"return",
"const",
"secrets",
"=",
"loadSecrets",
... | Check if is running inside Now.sh and apply variables and secrets to `process.env` | [
"Check",
"if",
"is",
"running",
"inside",
"Now",
".",
"sh",
"and",
"apply",
"variables",
"and",
"secrets",
"to",
"process",
".",
"env"
] | 7761209e7c2500a17ca89398e62f65e6eb31af5d | https://github.com/zeit/now-env/blob/7761209e7c2500a17ca89398e62f65e6eb31af5d/index.js#L11-L20 | train |
RasCarlito/axios-cache-adapter | src/index.js | setupCache | function setupCache (config = {}) {
// Extend default configuration
config = makeConfig(config)
// Axios adapter. Receives the axios request configuration as only parameter
async function adapter (req) {
// Merge the per-request config with the instance config.
const reqConfig = mergeRequestConfig(conf... | javascript | function setupCache (config = {}) {
// Extend default configuration
config = makeConfig(config)
// Axios adapter. Receives the axios request configuration as only parameter
async function adapter (req) {
// Merge the per-request config with the instance config.
const reqConfig = mergeRequestConfig(conf... | [
"function",
"setupCache",
"(",
"config",
"=",
"{",
"}",
")",
"{",
"// Extend default configuration",
"config",
"=",
"makeConfig",
"(",
"config",
")",
"// Axios adapter. Receives the axios request configuration as only parameter",
"async",
"function",
"adapter",
"(",
"req",
... | Configure cache adapter
@param {object} [config={}] Cache adapter options
@returns {object} Object containing cache `adapter` and `store` | [
"Configure",
"cache",
"adapter"
] | af9808c2e862b32ac76a0921e9b27a310be83c67 | https://github.com/RasCarlito/axios-cache-adapter/blob/af9808c2e862b32ac76a0921e9b27a310be83c67/src/index.js#L16-L80 | train |
parro-it/libui-node | examples/histogram.js | buildSolidBrush | function buildSolidBrush(color, alpha) {
let component;
component = (color >> 16) & 0xff;
const R = component / 255;
component = (color >> 8) & 0xff;
const G = component / 255;
component = color & 0xff;
const B = component / 255;
const A = alpha;
const brush = new libui.DrawBrush();
brush.color = new libui.... | javascript | function buildSolidBrush(color, alpha) {
let component;
component = (color >> 16) & 0xff;
const R = component / 255;
component = (color >> 8) & 0xff;
const G = component / 255;
component = color & 0xff;
const B = component / 255;
const A = alpha;
const brush = new libui.DrawBrush();
brush.color = new libui.... | [
"function",
"buildSolidBrush",
"(",
"color",
",",
"alpha",
")",
"{",
"let",
"component",
";",
"component",
"=",
"(",
"color",
">>",
"16",
")",
"&",
"0xff",
";",
"const",
"R",
"=",
"component",
"/",
"255",
";",
"component",
"=",
"(",
"color",
">>",
"8... | Helper to quickly set a brush color | [
"Helper",
"to",
"quickly",
"set",
"a",
"brush",
"color"
] | 7da20e42f446cae99088c6fbacad18ab2944061b | https://github.com/parro-it/libui-node/blob/7da20e42f446cae99088c6fbacad18ab2944061b/examples/histogram.js#L177-L193 | train |
aishek/jquery-animateNumber | jquery.animateNumber.js | function(suffix) {
return function(now, tween) {
var floored_number = Math.floor(now),
target = $(tween.elem);
target.prop('number', now).text(floored_number + suffix);
};
} | javascript | function(suffix) {
return function(now, tween) {
var floored_number = Math.floor(now),
target = $(tween.elem);
target.prop('number', now).text(floored_number + suffix);
};
} | [
"function",
"(",
"suffix",
")",
"{",
"return",
"function",
"(",
"now",
",",
"tween",
")",
"{",
"var",
"floored_number",
"=",
"Math",
".",
"floor",
"(",
"now",
")",
",",
"target",
"=",
"$",
"(",
"tween",
".",
"elem",
")",
";",
"target",
".",
"prop",... | Creates numberStep handler, which appends string to floored animated number on each step.
@example
// will animate to 100 with "1 %", "2 %", "3 %", ...
$('#someid').animateNumber({
number: 100,
numberStep: $.animateNumber.numberStepFactories.append(' %')
});
@params {String} suffix string to append to animated number... | [
"Creates",
"numberStep",
"handler",
"which",
"appends",
"string",
"to",
"floored",
"animated",
"number",
"on",
"each",
"step",
"."
] | 59fa20d3f12b76ad19876ab7d04a9feb10b0ed80 | https://github.com/aishek/jquery-animateNumber/blob/59fa20d3f12b76ad19876ab7d04a9feb10b0ed80/jquery.animateNumber.js#L86-L93 | train | |
aishek/jquery-animateNumber | jquery.animateNumber.js | function(separator, group_length, suffix) {
separator = separator || ' ';
group_length = group_length || 3;
suffix = suffix || '';
return function(now, tween) {
var negative = now < 0,
floored_number = Math.floor((negative ? -1 : 1) * now),
separate... | javascript | function(separator, group_length, suffix) {
separator = separator || ' ';
group_length = group_length || 3;
suffix = suffix || '';
return function(now, tween) {
var negative = now < 0,
floored_number = Math.floor((negative ? -1 : 1) * now),
separate... | [
"function",
"(",
"separator",
",",
"group_length",
",",
"suffix",
")",
"{",
"separator",
"=",
"separator",
"||",
"' '",
";",
"group_length",
"=",
"group_length",
"||",
"3",
";",
"suffix",
"=",
"suffix",
"||",
"''",
";",
"return",
"function",
"(",
"now",
... | Creates numberStep handler, which format floored numbers by separating them to groups.
@example
// will animate with 1 ... 217,980 ... 95,217,980 ... 7,095,217,980
$('#world-population').animateNumber({
number: 7095217980,
numberStep: $.animateNumber.numberStepFactories.separator(',')
});
@example
// will animate with... | [
"Creates",
"numberStep",
"handler",
"which",
"format",
"floored",
"numbers",
"by",
"separating",
"them",
"to",
"groups",
"."
] | 59fa20d3f12b76ad19876ab7d04a9feb10b0ed80 | https://github.com/aishek/jquery-animateNumber/blob/59fa20d3f12b76ad19876ab7d04a9feb10b0ed80/jquery.animateNumber.js#L116-L136 | train | |
Vestride/Shuffle | docs/js/demos/ajax.js | getMarkupFromData | function getMarkupFromData(dataForSingleItem) {
var name = dataForSingleItem.first_name + ' ' + dataForSingleItem.last_name;
// https://www.paulirish.com/2009/random-hex-color-code-snippets/
var randomColor = ('000000' + Math.random().toString(16).slice(2, 8)).slice(-6);
return [
'<div class="js-item col-3@... | javascript | function getMarkupFromData(dataForSingleItem) {
var name = dataForSingleItem.first_name + ' ' + dataForSingleItem.last_name;
// https://www.paulirish.com/2009/random-hex-color-code-snippets/
var randomColor = ('000000' + Math.random().toString(16).slice(2, 8)).slice(-6);
return [
'<div class="js-item col-3@... | [
"function",
"getMarkupFromData",
"(",
"dataForSingleItem",
")",
"{",
"var",
"name",
"=",
"dataForSingleItem",
".",
"first_name",
"+",
"' '",
"+",
"dataForSingleItem",
".",
"last_name",
";",
"// https://www.paulirish.com/2009/random-hex-color-code-snippets/",
"var",
"randomC... | Convert an object to HTML markup for an item.
@param {object} dataForSingleItem Data object.
@return {string} | [
"Convert",
"an",
"object",
"to",
"HTML",
"markup",
"for",
"an",
"item",
"."
] | 9fd4b557b6030e23c5b4b8e68233a42833df423f | https://github.com/Vestride/Shuffle/blob/9fd4b557b6030e23c5b4b8e68233a42833df423f/docs/js/demos/ajax.js#L66-L77 | train |
Vestride/Shuffle | docs/js/demos/ajax.js | replaceLoadMoreButton | function replaceLoadMoreButton() {
var text = document.createTextNode('All users loaded');
var replacement = document.createElement('p');
replacement.appendChild(text);
loadMoreButton.parentNode.replaceChild(replacement, loadMoreButton);
} | javascript | function replaceLoadMoreButton() {
var text = document.createTextNode('All users loaded');
var replacement = document.createElement('p');
replacement.appendChild(text);
loadMoreButton.parentNode.replaceChild(replacement, loadMoreButton);
} | [
"function",
"replaceLoadMoreButton",
"(",
")",
"{",
"var",
"text",
"=",
"document",
".",
"createTextNode",
"(",
"'All users loaded'",
")",
";",
"var",
"replacement",
"=",
"document",
".",
"createElement",
"(",
"'p'",
")",
";",
"replacement",
".",
"appendChild",
... | Remove the load more button so that the user cannot click it again. | [
"Remove",
"the",
"load",
"more",
"button",
"so",
"that",
"the",
"user",
"cannot",
"click",
"it",
"again",
"."
] | 9fd4b557b6030e23c5b4b8e68233a42833df423f | https://github.com/Vestride/Shuffle/blob/9fd4b557b6030e23c5b4b8e68233a42833df423f/docs/js/demos/ajax.js#L101-L106 | train |
Vestride/Shuffle | docs/js/demos/react.js | PhotoItem | function PhotoItem({ id, username, src, name }) {
return (
<div key={id} className="col-3@xs col-4@sm photo-item">
<div className="aspect aspect--4x3">
<div className="aspect__inner">
<img src={src} />
<PhotoAttribution username={username} name={name} />
</div>
</di... | javascript | function PhotoItem({ id, username, src, name }) {
return (
<div key={id} className="col-3@xs col-4@sm photo-item">
<div className="aspect aspect--4x3">
<div className="aspect__inner">
<img src={src} />
<PhotoAttribution username={username} name={name} />
</div>
</di... | [
"function",
"PhotoItem",
"(",
"{",
"id",
",",
"username",
",",
"src",
",",
"name",
"}",
")",
"{",
"return",
"(",
"<",
"div",
"key",
"=",
"{",
"id",
"}",
"className",
"=",
"\"col-3@xs col-4@sm photo-item\"",
">",
"\n ",
"<",
"div",
"className",
"=",
... | A grid item for a photo.
@param {{ id: number, username: string, src: string, name: string }} props Component props.
@return {JSX.Element} | [
"A",
"grid",
"item",
"for",
"a",
"photo",
"."
] | 9fd4b557b6030e23c5b4b8e68233a42833df423f | https://github.com/Vestride/Shuffle/blob/9fd4b557b6030e23c5b4b8e68233a42833df423f/docs/js/demos/react.js#L123-L134 | train |
Vestride/Shuffle | docs/js/demos/react.js | PhotoAttribution | function PhotoAttribution({ username, name }) {
if (!username) {
return null;
}
const href = `https://unsplash.com/${username}?utm_medium=referral&utm_campaign=photographer-credit&utm_content=creditBadge`;
const title = `Download free do whatever you want high-resolution photos from ${name}`;
ret... | javascript | function PhotoAttribution({ username, name }) {
if (!username) {
return null;
}
const href = `https://unsplash.com/${username}?utm_medium=referral&utm_campaign=photographer-credit&utm_content=creditBadge`;
const title = `Download free do whatever you want high-resolution photos from ${name}`;
ret... | [
"function",
"PhotoAttribution",
"(",
"{",
"username",
",",
"name",
"}",
")",
"{",
"if",
"(",
"!",
"username",
")",
"{",
"return",
"null",
";",
"}",
"const",
"href",
"=",
"`",
"${",
"username",
"}",
"`",
";",
"const",
"title",
"=",
"`",
"${",
"name"... | A small badge with a link to the author of the photo's profile.
@param {{ username: string, name: string }} props Component props.
@return {JSX.Element} | [
"A",
"small",
"badge",
"with",
"a",
"link",
"to",
"the",
"author",
"of",
"the",
"photo",
"s",
"profile",
"."
] | 9fd4b557b6030e23c5b4b8e68233a42833df423f | https://github.com/Vestride/Shuffle/blob/9fd4b557b6030e23c5b4b8e68233a42833df423f/docs/js/demos/react.js#L141-L158 | train |
ondras/rot.js | lib/map/ellermaze.js | addToList | function addToList(i, L, R) {
R[L[i + 1]] = R[i];
L[R[i]] = L[i + 1];
R[i] = i + 1;
L[i + 1] = i;
} | javascript | function addToList(i, L, R) {
R[L[i + 1]] = R[i];
L[R[i]] = L[i + 1];
R[i] = i + 1;
L[i + 1] = i;
} | [
"function",
"addToList",
"(",
"i",
",",
"L",
",",
"R",
")",
"{",
"R",
"[",
"L",
"[",
"i",
"+",
"1",
"]",
"]",
"=",
"R",
"[",
"i",
"]",
";",
"L",
"[",
"R",
"[",
"i",
"]",
"]",
"=",
"L",
"[",
"i",
"+",
"1",
"]",
";",
"R",
"[",
"i",
... | Join lists with "i" and "i+1" | [
"Join",
"lists",
"with",
"i",
"and",
"i",
"+",
"1"
] | 57c4c9e22fa4614f69f42d34ccc83f679615bbf1 | https://github.com/ondras/rot.js/blob/57c4c9e22fa4614f69f42d34ccc83f679615bbf1/lib/map/ellermaze.js#L6-L11 | train |
ondras/rot.js | lib/map/ellermaze.js | removeFromList | function removeFromList(i, L, R) {
R[L[i]] = R[i];
L[R[i]] = L[i];
R[i] = i;
L[i] = i;
} | javascript | function removeFromList(i, L, R) {
R[L[i]] = R[i];
L[R[i]] = L[i];
R[i] = i;
L[i] = i;
} | [
"function",
"removeFromList",
"(",
"i",
",",
"L",
",",
"R",
")",
"{",
"R",
"[",
"L",
"[",
"i",
"]",
"]",
"=",
"R",
"[",
"i",
"]",
";",
"L",
"[",
"R",
"[",
"i",
"]",
"]",
"=",
"L",
"[",
"i",
"]",
";",
"R",
"[",
"i",
"]",
"=",
"i",
";... | Remove "i" from its list | [
"Remove",
"i",
"from",
"its",
"list"
] | 57c4c9e22fa4614f69f42d34ccc83f679615bbf1 | https://github.com/ondras/rot.js/blob/57c4c9e22fa4614f69f42d34ccc83f679615bbf1/lib/map/ellermaze.js#L15-L20 | train |
ondras/rot.js | lib/text.js | breakInsideToken | function breakInsideToken(tokens, tokenIndex, breakIndex, removeBreakChar) {
let newBreakToken = {
type: TYPE_NEWLINE
};
let newTextToken = {
type: TYPE_TEXT,
value: tokens[tokenIndex].value.substring(breakIndex + (removeBreakChar ? 1 : 0))
};
tokens.splice(tokenIndex + 1, 0,... | javascript | function breakInsideToken(tokens, tokenIndex, breakIndex, removeBreakChar) {
let newBreakToken = {
type: TYPE_NEWLINE
};
let newTextToken = {
type: TYPE_TEXT,
value: tokens[tokenIndex].value.substring(breakIndex + (removeBreakChar ? 1 : 0))
};
tokens.splice(tokenIndex + 1, 0,... | [
"function",
"breakInsideToken",
"(",
"tokens",
",",
"tokenIndex",
",",
"breakIndex",
",",
"removeBreakChar",
")",
"{",
"let",
"newBreakToken",
"=",
"{",
"type",
":",
"TYPE_NEWLINE",
"}",
";",
"let",
"newTextToken",
"=",
"{",
"type",
":",
"TYPE_TEXT",
",",
"v... | Create new tokens and insert them into the stream
@param {object[]} tokens
@param {int} tokenIndex Token being processed
@param {int} breakIndex Index within current token's value
@param {bool} removeBreakChar Do we want to remove the breaking character?
@returns {string} remaining unbroken token value | [
"Create",
"new",
"tokens",
"and",
"insert",
"them",
"into",
"the",
"stream"
] | 57c4c9e22fa4614f69f42d34ccc83f679615bbf1 | https://github.com/ondras/rot.js/blob/57c4c9e22fa4614f69f42d34ccc83f679615bbf1/lib/text.js#L172-L182 | train |
aframevr/aframe-inspector | src/lib/entity.js | insertAfter | function insertAfter(newNode, referenceNode) {
if (!referenceNode.parentNode) {
referenceNode = AFRAME.INSPECTOR.selectedEntity;
}
if (!referenceNode) {
AFRAME.INSPECTOR.sceneEl.appendChild(newNode);
} else {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
} | javascript | function insertAfter(newNode, referenceNode) {
if (!referenceNode.parentNode) {
referenceNode = AFRAME.INSPECTOR.selectedEntity;
}
if (!referenceNode) {
AFRAME.INSPECTOR.sceneEl.appendChild(newNode);
} else {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
} | [
"function",
"insertAfter",
"(",
"newNode",
",",
"referenceNode",
")",
"{",
"if",
"(",
"!",
"referenceNode",
".",
"parentNode",
")",
"{",
"referenceNode",
"=",
"AFRAME",
".",
"INSPECTOR",
".",
"selectedEntity",
";",
"}",
"if",
"(",
"!",
"referenceNode",
")",
... | Insert an node after a referenced node.
@param {Element} newNode Node to insert.
@param {Element} referenceNode Node used as reference to insert after it. | [
"Insert",
"an",
"node",
"after",
"a",
"referenced",
"node",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L112-L122 | train |
aframevr/aframe-inspector | src/lib/entity.js | prepareForSerialization | function prepareForSerialization(entity) {
var clone = entity.cloneNode(false);
var children = entity.childNodes;
for (var i = 0, l = children.length; i < l; i++) {
var child = children[i];
if (
child.nodeType !== Node.ELEMENT_NODE ||
(!child.hasAttribute('aframe-injected') &&
!child.h... | javascript | function prepareForSerialization(entity) {
var clone = entity.cloneNode(false);
var children = entity.childNodes;
for (var i = 0, l = children.length; i < l; i++) {
var child = children[i];
if (
child.nodeType !== Node.ELEMENT_NODE ||
(!child.hasAttribute('aframe-injected') &&
!child.h... | [
"function",
"prepareForSerialization",
"(",
"entity",
")",
"{",
"var",
"clone",
"=",
"entity",
".",
"cloneNode",
"(",
"false",
")",
";",
"var",
"children",
"=",
"entity",
".",
"childNodes",
";",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"childre... | Returns a copy of the DOM hierarchy prepared for serialization.
The process optimises component representation to avoid values coming from
primitive attributes, mixins and defaults.
@param {Element} entity Root of the DOM hierarchy.
@return {Elment} Copy of the DOM hierarchy ready for serialization. | [
"Returns",
"a",
"copy",
"of",
"the",
"DOM",
"hierarchy",
"prepared",
"for",
"serialization",
".",
"The",
"process",
"optimises",
"component",
"representation",
"to",
"avoid",
"values",
"coming",
"from",
"primitive",
"attributes",
"mixins",
"and",
"defaults",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L171-L187 | train |
aframevr/aframe-inspector | src/lib/entity.js | optimizeComponents | function optimizeComponents(copy, source) {
var removeAttribute = HTMLElement.prototype.removeAttribute;
var setAttribute = HTMLElement.prototype.setAttribute;
var components = source.components || {};
Object.keys(components).forEach(function(name) {
var component = components[name];
var result = getImp... | javascript | function optimizeComponents(copy, source) {
var removeAttribute = HTMLElement.prototype.removeAttribute;
var setAttribute = HTMLElement.prototype.setAttribute;
var components = source.components || {};
Object.keys(components).forEach(function(name) {
var component = components[name];
var result = getImp... | [
"function",
"optimizeComponents",
"(",
"copy",
",",
"source",
")",
"{",
"var",
"removeAttribute",
"=",
"HTMLElement",
".",
"prototype",
".",
"removeAttribute",
";",
"var",
"setAttribute",
"=",
"HTMLElement",
".",
"prototype",
".",
"setAttribute",
";",
"var",
"co... | Removes from copy those components or components' properties that comes from
primitive attributes, mixins, injected default components or schema defaults.
@param {Element} copy Destinatary element for the optimization.
@param {Element} source Element to be optimized. | [
"Removes",
"from",
"copy",
"those",
"components",
"or",
"components",
"properties",
"that",
"comes",
"from",
"primitive",
"attributes",
"mixins",
"injected",
"default",
"components",
"or",
"schema",
"defaults",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L196-L220 | train |
aframevr/aframe-inspector | src/lib/entity.js | getImplicitValue | function getImplicitValue(component, source) {
var isInherited = false;
var value = (isSingleProperty(component.schema) ? _single : _multi)();
return [value, isInherited];
function _single() {
var value = getMixedValue(component, null, source);
if (value === undefined) {
value = getInjectedValue(... | javascript | function getImplicitValue(component, source) {
var isInherited = false;
var value = (isSingleProperty(component.schema) ? _single : _multi)();
return [value, isInherited];
function _single() {
var value = getMixedValue(component, null, source);
if (value === undefined) {
value = getInjectedValue(... | [
"function",
"getImplicitValue",
"(",
"component",
",",
"source",
")",
"{",
"var",
"isInherited",
"=",
"false",
";",
"var",
"value",
"=",
"(",
"isSingleProperty",
"(",
"component",
".",
"schema",
")",
"?",
"_single",
":",
"_multi",
")",
"(",
")",
";",
"re... | Computes the value for a component coming from primitive attributes,
mixins, primitive defaults, a-frame default components and schema defaults.
In this specific order.
In other words, it is the value of the component if the author would have not
overridden it explicitly.
@param {Component} component Component to cal... | [
"Computes",
"the",
"value",
"for",
"a",
"component",
"coming",
"from",
"primitive",
"attributes",
"mixins",
"primitive",
"defaults",
"a",
"-",
"frame",
"default",
"components",
"and",
"schema",
"defaults",
".",
"In",
"this",
"specific",
"order",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L262-L310 | train |
aframevr/aframe-inspector | src/lib/entity.js | getFromAttribute | function getFromAttribute(component, propertyName, source) {
var value;
var mappings = source.mappings || {};
var route = component.name + '.' + propertyName;
var primitiveAttribute = findAttribute(mappings, route);
if (primitiveAttribute && source.hasAttribute(primitiveAttribute)) {
value = source.getAtt... | javascript | function getFromAttribute(component, propertyName, source) {
var value;
var mappings = source.mappings || {};
var route = component.name + '.' + propertyName;
var primitiveAttribute = findAttribute(mappings, route);
if (primitiveAttribute && source.hasAttribute(primitiveAttribute)) {
value = source.getAtt... | [
"function",
"getFromAttribute",
"(",
"component",
",",
"propertyName",
",",
"source",
")",
"{",
"var",
"value",
";",
"var",
"mappings",
"=",
"source",
".",
"mappings",
"||",
"{",
"}",
";",
"var",
"route",
"=",
"component",
".",
"name",
"+",
"'.'",
"+",
... | Gets the value for the component's property coming from a primitive
attribute.
Primitives have mappings from attributes to component's properties.
The function looks for a present attribute in the source element which
maps to the specified component's property.
@param {Component} component Component to be found.
... | [
"Gets",
"the",
"value",
"for",
"the",
"component",
"s",
"property",
"coming",
"from",
"a",
"primitive",
"attribute",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L327-L347 | train |
aframevr/aframe-inspector | src/lib/entity.js | getMixedValue | function getMixedValue(component, propertyName, source) {
var value;
var reversedMixins = source.mixinEls.reverse();
for (var i = 0; value === undefined && i < reversedMixins.length; i++) {
var mixin = reversedMixins[i];
if (mixin.attributes.hasOwnProperty(component.name)) {
if (!propertyName) {
... | javascript | function getMixedValue(component, propertyName, source) {
var value;
var reversedMixins = source.mixinEls.reverse();
for (var i = 0; value === undefined && i < reversedMixins.length; i++) {
var mixin = reversedMixins[i];
if (mixin.attributes.hasOwnProperty(component.name)) {
if (!propertyName) {
... | [
"function",
"getMixedValue",
"(",
"component",
",",
"propertyName",
",",
"source",
")",
"{",
"var",
"value",
";",
"var",
"reversedMixins",
"=",
"source",
".",
"mixinEls",
".",
"reverse",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"value",
"=... | Gets the value for a component or component's property coming from mixins of
an element.
If the component or component's property is not provided by mixins, the
functions will return `undefined`.
@param {Component} component Component to be found.
@param {string} [propertyName] If provided, component's proper... | [
"Gets",
"the",
"value",
"for",
"a",
"component",
"or",
"component",
"s",
"property",
"coming",
"from",
"mixins",
"of",
"an",
"element",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L363-L377 | train |
aframevr/aframe-inspector | src/lib/entity.js | getInjectedValue | function getInjectedValue(component, propertyName, source) {
var value;
var primitiveDefaults = source.defaultComponentsFromPrimitive || {};
var aFrameDefaults = source.defaultComponents || {};
var defaultSources = [primitiveDefaults, aFrameDefaults];
for (var i = 0; value === undefined && i < defaultSources.... | javascript | function getInjectedValue(component, propertyName, source) {
var value;
var primitiveDefaults = source.defaultComponentsFromPrimitive || {};
var aFrameDefaults = source.defaultComponents || {};
var defaultSources = [primitiveDefaults, aFrameDefaults];
for (var i = 0; value === undefined && i < defaultSources.... | [
"function",
"getInjectedValue",
"(",
"component",
",",
"propertyName",
",",
"source",
")",
"{",
"var",
"value",
";",
"var",
"primitiveDefaults",
"=",
"source",
".",
"defaultComponentsFromPrimitive",
"||",
"{",
"}",
";",
"var",
"aFrameDefaults",
"=",
"source",
".... | Gets the value for a component or component's property coming from primitive
defaults or a-frame defaults. In this specific order.
@param {Component} component Component to be found.
@param {string} [propertyName] If provided, component's property to be
found.
@param {Element} source Element owning t... | [
"Gets",
"the",
"value",
"for",
"a",
"component",
"or",
"component",
"s",
"property",
"coming",
"from",
"primitive",
"defaults",
"or",
"a",
"-",
"frame",
"defaults",
".",
"In",
"this",
"specific",
"order",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L390-L406 | train |
aframevr/aframe-inspector | src/lib/entity.js | getDefaultValue | function getDefaultValue(component, propertyName, source) {
if (!propertyName) {
return component.schema.default;
}
return component.schema[propertyName].default;
} | javascript | function getDefaultValue(component, propertyName, source) {
if (!propertyName) {
return component.schema.default;
}
return component.schema[propertyName].default;
} | [
"function",
"getDefaultValue",
"(",
"component",
",",
"propertyName",
",",
"source",
")",
"{",
"if",
"(",
"!",
"propertyName",
")",
"{",
"return",
"component",
".",
"schema",
".",
"default",
";",
"}",
"return",
"component",
".",
"schema",
"[",
"propertyName"... | Gets the value for a component or component's property coming from schema
defaults.
@param {Component} component Component to be found.
@param {string} [propertyName] If provided, component's property to be
found.
@param {Element} source Element owning the component.
@return ... | [
"Gets",
"the",
"value",
"for",
"a",
"component",
"or",
"component",
"s",
"property",
"coming",
"from",
"schema",
"defaults",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L419-L424 | train |
aframevr/aframe-inspector | src/lib/entity.js | getOptimalUpdate | function getOptimalUpdate(component, implicit, reference) {
if (equal(implicit, reference)) {
return null;
}
if (isSingleProperty(component.schema)) {
return reference;
}
var optimal = {};
Object.keys(reference).forEach(function(key) {
var needsUpdate = !equal(reference[key], implicit[key]);
... | javascript | function getOptimalUpdate(component, implicit, reference) {
if (equal(implicit, reference)) {
return null;
}
if (isSingleProperty(component.schema)) {
return reference;
}
var optimal = {};
Object.keys(reference).forEach(function(key) {
var needsUpdate = !equal(reference[key], implicit[key]);
... | [
"function",
"getOptimalUpdate",
"(",
"component",
",",
"implicit",
",",
"reference",
")",
"{",
"if",
"(",
"equal",
"(",
"implicit",
",",
"reference",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"isSingleProperty",
"(",
"component",
".",
"schema",... | Returns the minimum value for a component with an implicit value to equal a
reference value. A `null` optimal value means that there is no need for an
update since the implicit value and the reference are equal.
@param {Component} component Component of the computed value.
@param {any} implicit The implicit val... | [
"Returns",
"the",
"minimum",
"value",
"for",
"a",
"component",
"with",
"an",
"implicit",
"value",
"to",
"equal",
"a",
"reference",
"value",
".",
"A",
"null",
"optimal",
"value",
"means",
"that",
"there",
"is",
"no",
"need",
"for",
"an",
"update",
"since",
... | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L437-L452 | train |
aframevr/aframe-inspector | src/lib/entity.js | getUniqueId | function getUniqueId(baseId) {
if (!document.getElementById(baseId)) {
return baseId;
}
var i = 2;
// If the baseId ends with _#, it extracts the baseId removing the suffix
var groups = baseId.match(/(\w+)-(\d+)/);
if (groups) {
baseId = groups[1];
i = groups[2];
}
while (document.getEleme... | javascript | function getUniqueId(baseId) {
if (!document.getElementById(baseId)) {
return baseId;
}
var i = 2;
// If the baseId ends with _#, it extracts the baseId removing the suffix
var groups = baseId.match(/(\w+)-(\d+)/);
if (groups) {
baseId = groups[1];
i = groups[2];
}
while (document.getEleme... | [
"function",
"getUniqueId",
"(",
"baseId",
")",
"{",
"if",
"(",
"!",
"document",
".",
"getElementById",
"(",
"baseId",
")",
")",
"{",
"return",
"baseId",
";",
"}",
"var",
"i",
"=",
"2",
";",
"// If the baseId ends with _#, it extracts the baseId removing the suffix... | Detect element's Id collision and returns a valid one
@param {string} baseId Proposed Id
@return {string} Valid Id based on the proposed Id | [
"Detect",
"element",
"s",
"Id",
"collision",
"and",
"returns",
"a",
"valid",
"one"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L467-L485 | train |
aframevr/aframe-inspector | src/lib/entity.js | getModifiedProperties | function getModifiedProperties(entity, componentName) {
var data = entity.components[componentName].data;
var defaultData = entity.components[componentName].schema;
var diff = {};
for (var key in data) {
// Prevent adding unknown attributes
if (!defaultData[key]) {
continue;
}
... | javascript | function getModifiedProperties(entity, componentName) {
var data = entity.components[componentName].data;
var defaultData = entity.components[componentName].schema;
var diff = {};
for (var key in data) {
// Prevent adding unknown attributes
if (!defaultData[key]) {
continue;
}
... | [
"function",
"getModifiedProperties",
"(",
"entity",
",",
"componentName",
")",
"{",
"var",
"data",
"=",
"entity",
".",
"components",
"[",
"componentName",
"]",
".",
"data",
";",
"var",
"defaultData",
"=",
"entity",
".",
"components",
"[",
"componentName",
"]",... | Get the list of modified properties
@param {Element} entity Entity where the component belongs
@param {string} componentName Component name
@return {object} List of modified properties with their value | [
"Get",
"the",
"list",
"of",
"modified",
"properties"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/entity.js#L494-L513 | train |
aframevr/aframe-inspector | src/index.js | function(focusEl) {
this.opened = true;
Events.emit('inspectortoggle', true);
if (this.sceneEl.hasAttribute('embedded')) {
// Remove embedded styles, but keep track of it.
this.sceneEl.removeAttribute('embedded');
this.sceneEl.setAttribute('aframe-inspector-removed-embedded');
}
... | javascript | function(focusEl) {
this.opened = true;
Events.emit('inspectortoggle', true);
if (this.sceneEl.hasAttribute('embedded')) {
// Remove embedded styles, but keep track of it.
this.sceneEl.removeAttribute('embedded');
this.sceneEl.setAttribute('aframe-inspector-removed-embedded');
}
... | [
"function",
"(",
"focusEl",
")",
"{",
"this",
".",
"opened",
"=",
"true",
";",
"Events",
".",
"emit",
"(",
"'inspectortoggle'",
",",
"true",
")",
";",
"if",
"(",
"this",
".",
"sceneEl",
".",
"hasAttribute",
"(",
"'embedded'",
")",
")",
"{",
"// Remove ... | Open the editor UI | [
"Open",
"the",
"editor",
"UI"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/index.js#L244-L280 | train | |
aframevr/aframe-inspector | src/index.js | function() {
this.opened = false;
Events.emit('inspectortoggle', false);
// Untrick scene when we enabled this to run the cursor tick.
this.sceneEl.isPlaying = false;
this.sceneEl.play();
this.cursor.pause();
if (this.sceneEl.hasAttribute('aframe-inspector-removed-embedded')) {
this... | javascript | function() {
this.opened = false;
Events.emit('inspectortoggle', false);
// Untrick scene when we enabled this to run the cursor tick.
this.sceneEl.isPlaying = false;
this.sceneEl.play();
this.cursor.pause();
if (this.sceneEl.hasAttribute('aframe-inspector-removed-embedded')) {
this... | [
"function",
"(",
")",
"{",
"this",
".",
"opened",
"=",
"false",
";",
"Events",
".",
"emit",
"(",
"'inspectortoggle'",
",",
"false",
")",
";",
"// Untrick scene when we enabled this to run the cursor tick.",
"this",
".",
"sceneEl",
".",
"isPlaying",
"=",
"false",
... | Closes the editor and gives the control back to the scene
@return {[type]} [description] | [
"Closes",
"the",
"editor",
"and",
"gives",
"the",
"control",
"back",
"to",
"the",
"scene"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/index.js#L286-L303 | train | |
aframevr/aframe-inspector | src/lib/assetsLoader.js | function() {
var xhr = new XMLHttpRequest();
var url = assetsBaseUrl + assetsRelativeUrl['images'];
// @todo Remove the sync call and use a callback
xhr.open('GET', url);
xhr.onload = () => {
var data = JSON.parse(xhr.responseText);
this.images = data.images;
this.images.forEach(... | javascript | function() {
var xhr = new XMLHttpRequest();
var url = assetsBaseUrl + assetsRelativeUrl['images'];
// @todo Remove the sync call and use a callback
xhr.open('GET', url);
xhr.onload = () => {
var data = JSON.parse(xhr.responseText);
this.images = data.images;
this.images.forEach(... | [
"function",
"(",
")",
"{",
"var",
"xhr",
"=",
"new",
"XMLHttpRequest",
"(",
")",
";",
"var",
"url",
"=",
"assetsBaseUrl",
"+",
"assetsRelativeUrl",
"[",
"'images'",
"]",
";",
"// @todo Remove the sync call and use a callback",
"xhr",
".",
"open",
"(",
"'GET'",
... | XHR the assets JSON. | [
"XHR",
"the",
"assets",
"JSON",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/assetsLoader.js#L19-L42 | train | |
aframevr/aframe-inspector | src/lib/raycaster.js | onDoubleClick | function onDoubleClick(event) {
const array = getMousePosition(
inspector.container,
event.clientX,
event.clientY
);
onDoubleClickPosition.fromArray(array);
const intersectedEl = mouseCursor.components.cursor.intersectedEl;
if (!intersectedEl) {
return;
}
Events.emit(... | javascript | function onDoubleClick(event) {
const array = getMousePosition(
inspector.container,
event.clientX,
event.clientY
);
onDoubleClickPosition.fromArray(array);
const intersectedEl = mouseCursor.components.cursor.intersectedEl;
if (!intersectedEl) {
return;
}
Events.emit(... | [
"function",
"onDoubleClick",
"(",
"event",
")",
"{",
"const",
"array",
"=",
"getMousePosition",
"(",
"inspector",
".",
"container",
",",
"event",
".",
"clientX",
",",
"event",
".",
"clientY",
")",
";",
"onDoubleClickPosition",
".",
"fromArray",
"(",
"array",
... | Focus on double click. | [
"Focus",
"on",
"double",
"click",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/src/lib/raycaster.js#L127-L139 | train |
aframevr/aframe-inspector | vendor/GLTFExporter.js | equalArray | function equalArray(array1, array2) {
return (
array1.length === array2.length &&
array1.every(function(element, index) {
return element === array2[index];
})
);
} | javascript | function equalArray(array1, array2) {
return (
array1.length === array2.length &&
array1.every(function(element, index) {
return element === array2[index];
})
);
} | [
"function",
"equalArray",
"(",
"array1",
",",
"array2",
")",
"{",
"return",
"(",
"array1",
".",
"length",
"===",
"array2",
".",
"length",
"&&",
"array1",
".",
"every",
"(",
"function",
"(",
"element",
",",
"index",
")",
"{",
"return",
"element",
"===",
... | Compare two arrays
Compare two arrays
@param {Array} array1 Array 1 to compare
@param {Array} array2 Array 2 to compare
@return {Boolean} Returns true if both arrays are equal | [
"Compare",
"two",
"arrays",
"Compare",
"two",
"arrays"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L115-L122 | train |
aframevr/aframe-inspector | vendor/GLTFExporter.js | stringToArrayBuffer | function stringToArrayBuffer(text) {
if (window.TextEncoder !== undefined) {
return new TextEncoder().encode(text).buffer;
}
var array = new Uint8Array(new ArrayBuffer(text.length));
for (var i = 0, il = text.length; i < il; i++) {
var value = text.charCodeAt(i);
// Re... | javascript | function stringToArrayBuffer(text) {
if (window.TextEncoder !== undefined) {
return new TextEncoder().encode(text).buffer;
}
var array = new Uint8Array(new ArrayBuffer(text.length));
for (var i = 0, il = text.length; i < il; i++) {
var value = text.charCodeAt(i);
// Re... | [
"function",
"stringToArrayBuffer",
"(",
"text",
")",
"{",
"if",
"(",
"window",
".",
"TextEncoder",
"!==",
"undefined",
")",
"{",
"return",
"new",
"TextEncoder",
"(",
")",
".",
"encode",
"(",
"text",
")",
".",
"buffer",
";",
"}",
"var",
"array",
"=",
"n... | Converts a string to an ArrayBuffer.
@param {string} text
@return {ArrayBuffer} | [
"Converts",
"a",
"string",
"to",
"an",
"ArrayBuffer",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L129-L144 | train |
aframevr/aframe-inspector | vendor/GLTFExporter.js | getMinMax | function getMinMax(attribute, start, count) {
var output = {
min: new Array(attribute.itemSize).fill(Number.POSITIVE_INFINITY),
max: new Array(attribute.itemSize).fill(Number.NEGATIVE_INFINITY)
};
for (var i = start; i < start + count; i++) {
for (var a = 0; a < attribute.item... | javascript | function getMinMax(attribute, start, count) {
var output = {
min: new Array(attribute.itemSize).fill(Number.POSITIVE_INFINITY),
max: new Array(attribute.itemSize).fill(Number.NEGATIVE_INFINITY)
};
for (var i = start; i < start + count; i++) {
for (var a = 0; a < attribute.item... | [
"function",
"getMinMax",
"(",
"attribute",
",",
"start",
",",
"count",
")",
"{",
"var",
"output",
"=",
"{",
"min",
":",
"new",
"Array",
"(",
"attribute",
".",
"itemSize",
")",
".",
"fill",
"(",
"Number",
".",
"POSITIVE_INFINITY",
")",
",",
"max",
":",
... | Get the min and max vectors from the given attribute
@param {THREE.BufferAttribute} attribute Attribute to find the min/max in range from start to start + count
@param {Integer} start
@param {Integer} count
@return {Object} Object containing the `min` and `max` values (As an array of attribute.itemSize components) | [
"Get",
"the",
"min",
"and",
"max",
"vectors",
"from",
"the",
"given",
"attribute"
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L153-L168 | train |
aframevr/aframe-inspector | vendor/GLTFExporter.js | isNormalizedNormalAttribute | function isNormalizedNormalAttribute(normal) {
if (cachedData.attributes.has(normal)) {
return false;
}
var v = new THREE.Vector3();
for (var i = 0, il = normal.count; i < il; i++) {
// 0.0005 is from glTF-validator
if (Math.abs(v.fromArray(normal.array, i * 3).length()... | javascript | function isNormalizedNormalAttribute(normal) {
if (cachedData.attributes.has(normal)) {
return false;
}
var v = new THREE.Vector3();
for (var i = 0, il = normal.count; i < il; i++) {
// 0.0005 is from glTF-validator
if (Math.abs(v.fromArray(normal.array, i * 3).length()... | [
"function",
"isNormalizedNormalAttribute",
"(",
"normal",
")",
"{",
"if",
"(",
"cachedData",
".",
"attributes",
".",
"has",
"(",
"normal",
")",
")",
"{",
"return",
"false",
";",
"}",
"var",
"v",
"=",
"new",
"THREE",
".",
"Vector3",
"(",
")",
";",
"for"... | Checks if normal attribute values are normalized.
@param {THREE.BufferAttribute} normal
@returns {Boolean} | [
"Checks",
"if",
"normal",
"attribute",
"values",
"are",
"normalized",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L191-L205 | train |
aframevr/aframe-inspector | vendor/GLTFExporter.js | createNormalizedNormalAttribute | function createNormalizedNormalAttribute(normal) {
if (cachedData.attributes.has(normal)) {
return cachedData.attributes.get(normal);
}
var attribute = normal.clone();
var v = new THREE.Vector3();
for (var i = 0, il = attribute.count; i < il; i++) {
v.fromArray(attribute... | javascript | function createNormalizedNormalAttribute(normal) {
if (cachedData.attributes.has(normal)) {
return cachedData.attributes.get(normal);
}
var attribute = normal.clone();
var v = new THREE.Vector3();
for (var i = 0, il = attribute.count; i < il; i++) {
v.fromArray(attribute... | [
"function",
"createNormalizedNormalAttribute",
"(",
"normal",
")",
"{",
"if",
"(",
"cachedData",
".",
"attributes",
".",
"has",
"(",
"normal",
")",
")",
"{",
"return",
"cachedData",
".",
"attributes",
".",
"get",
"(",
"normal",
")",
";",
"}",
"var",
"attri... | Creates normalized normal buffer attribute.
@param {THREE.BufferAttribute} normal
@returns {THREE.BufferAttribute} | [
"Creates",
"normalized",
"normal",
"buffer",
"attribute",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L214-L239 | train |
aframevr/aframe-inspector | vendor/GLTFExporter.js | getPaddedArrayBuffer | function getPaddedArrayBuffer(arrayBuffer, paddingByte) {
paddingByte = paddingByte || 0;
var paddedLength = getPaddedBufferSize(arrayBuffer.byteLength);
if (paddedLength !== arrayBuffer.byteLength) {
var array = new Uint8Array(paddedLength);
array.set(new Uint8Array(arrayBuffer));
... | javascript | function getPaddedArrayBuffer(arrayBuffer, paddingByte) {
paddingByte = paddingByte || 0;
var paddedLength = getPaddedBufferSize(arrayBuffer.byteLength);
if (paddedLength !== arrayBuffer.byteLength) {
var array = new Uint8Array(paddedLength);
array.set(new Uint8Array(arrayBuffer));
... | [
"function",
"getPaddedArrayBuffer",
"(",
"arrayBuffer",
",",
"paddingByte",
")",
"{",
"paddingByte",
"=",
"paddingByte",
"||",
"0",
";",
"var",
"paddedLength",
"=",
"getPaddedBufferSize",
"(",
"arrayBuffer",
".",
"byteLength",
")",
";",
"if",
"(",
"paddedLength",
... | Returns a buffer aligned to 4-byte boundary.
@param {ArrayBuffer} arrayBuffer Buffer to pad
@param {Integer} paddingByte (Optional)
@returns {ArrayBuffer} The same buffer if it's already aligned to 4-byte boundary or a new buffer | [
"Returns",
"a",
"buffer",
"aligned",
"to",
"4",
"-",
"byte",
"boundary",
"."
] | bb0de5e92e4f0ee727726d5f580a0876d5e49047 | https://github.com/aframevr/aframe-inspector/blob/bb0de5e92e4f0ee727726d5f580a0876d5e49047/vendor/GLTFExporter.js#L260-L279 | 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.