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
zthun/zbuildtools
src/webpack/zwebpack.js
rule
function rule(test, loaders, exclude) { var rule = { test: test, use: loaders }; if (exclude) { rule.exclude = exclude; } return rule; }
javascript
function rule(test, loaders, exclude) { var rule = { test: test, use: loaders }; if (exclude) { rule.exclude = exclude; } return rule; }
[ "function", "rule", "(", "test", ",", "loaders", ",", "exclude", ")", "{", "var", "rule", "=", "{", "test", ":", "test", ",", "use", ":", "loaders", "}", ";", "if", "(", "exclude", ")", "{", "rule", ".", "exclude", "=", "exclude", ";", "}", "retu...
Constructs a rule object. @param {RegEx} test The regular expression to use when testing a file path name. @param {Array} loaders The list of loaders to run the file through if it matches the test regex. @param {RegEx} exclude The regular express to use when excluding specific files that match the test regex.
[ "Constructs", "a", "rule", "object", "." ]
f9b339fc3c3b8188638ccd17a96cb44d457bafd4
https://github.com/zthun/zbuildtools/blob/f9b339fc3c3b8188638ccd17a96cb44d457bafd4/src/webpack/zwebpack.js#L13-L24
train
tab58/minimatrix
src/math-helpers.js
rrefInPlace
function rrefInPlace (M, TOL = 1e-14) { const me = M.elements; // iterate through all rows to get to REF for (let i = 0; i < 3; ++i) { // search for largest in col and swap const k = findLargestInCol(M, i, i); if (k !== i) { swapRowsInPlace(M, i, k); } // scale and add current row to all...
javascript
function rrefInPlace (M, TOL = 1e-14) { const me = M.elements; // iterate through all rows to get to REF for (let i = 0; i < 3; ++i) { // search for largest in col and swap const k = findLargestInCol(M, i, i); if (k !== i) { swapRowsInPlace(M, i, k); } // scale and add current row to all...
[ "function", "rrefInPlace", "(", "M", ",", "TOL", "=", "1e-14", ")", "{", "const", "me", "=", "M", ".", "elements", ";", "// iterate through all rows to get to REF", "for", "(", "let", "i", "=", "0", ";", "i", "<", "3", ";", "++", "i", ")", "{", "// s...
Reduces a matrix to reduced row echelon form. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} M The matrix. @param {number} TOL The numerical tolerance for zero comparison.
[ "Reduces", "a", "matrix", "to", "reduced", "row", "echelon", "form", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L16-L50
train
tab58/minimatrix
src/math-helpers.js
isRowNonzero
function isRowNonzero (M, i, TOL = 1e-14) { const me = M.elements; return !(Compare.isZero(me[i], TOL) && Compare.isZero(me[i + 3], TOL) && Compare.isZero(me[i + 6], TOL)); }
javascript
function isRowNonzero (M, i, TOL = 1e-14) { const me = M.elements; return !(Compare.isZero(me[i], TOL) && Compare.isZero(me[i + 3], TOL) && Compare.isZero(me[i + 6], TOL)); }
[ "function", "isRowNonzero", "(", "M", ",", "i", ",", "TOL", "=", "1e-14", ")", "{", "const", "me", "=", "M", ".", "elements", ";", "return", "!", "(", "Compare", ".", "isZero", "(", "me", "[", "i", "]", ",", "TOL", ")", "&&", "Compare", ".", "i...
Tests if a row in a matrix is nonzero. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} M The matrix. @param {number} i The row index. @param {number} TOL The numerical tolerance.
[ "Tests", "if", "a", "row", "in", "a", "matrix", "is", "nonzero", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L59-L64
train
tab58/minimatrix
src/math-helpers.js
findLargestAbsElement
function findLargestAbsElement (M) { const te = M.elements; const n = M.dimension; let max = _Math.abs(te[0]); let rowCol = { row: 0, column: 0, value: te[0] }; for (let i = 0; i < n; ++i) { for (let j = 0; j < n; ++j) { const val = te[i * n + j]; const ti = _Math.abs(val); ...
javascript
function findLargestAbsElement (M) { const te = M.elements; const n = M.dimension; let max = _Math.abs(te[0]); let rowCol = { row: 0, column: 0, value: te[0] }; for (let i = 0; i < n; ++i) { for (let j = 0; j < n; ++j) { const val = te[i * n + j]; const ti = _Math.abs(val); ...
[ "function", "findLargestAbsElement", "(", "M", ")", "{", "const", "te", "=", "M", ".", "elements", ";", "const", "n", "=", "M", ".", "dimension", ";", "let", "max", "=", "_Math", ".", "abs", "(", "te", "[", "0", "]", ")", ";", "let", "rowCol", "=...
Finds the largest absolute valued element in a matrix. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} M The matrix.
[ "Finds", "the", "largest", "absolute", "valued", "element", "in", "a", "matrix", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L71-L93
train
tab58/minimatrix
src/math-helpers.js
findLargestInRow
function findLargestInRow (M, i) { // get the row: const m = M.elements; const n = M.dimension; const offset = i; let j = 0; let lrgElem = _Math.abs(m[offset]); let lrgCol = j; for (j = 1; j < n; ++j) { const val = _Math.abs(m[offset + j * n]); if (val > lrgElem) { lrgCol = j; lrgEl...
javascript
function findLargestInRow (M, i) { // get the row: const m = M.elements; const n = M.dimension; const offset = i; let j = 0; let lrgElem = _Math.abs(m[offset]); let lrgCol = j; for (j = 1; j < n; ++j) { const val = _Math.abs(m[offset + j * n]); if (val > lrgElem) { lrgCol = j; lrgEl...
[ "function", "findLargestInRow", "(", "M", ",", "i", ")", "{", "// get the row:", "const", "m", "=", "M", ".", "elements", ";", "const", "n", "=", "M", ".", "dimension", ";", "const", "offset", "=", "i", ";", "let", "j", "=", "0", ";", "let", "lrgEl...
Finds the largest element in the matrix row. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} M The matrix. @param {number} i The row index. @returns {number} The column index of the row's largest element.
[ "Finds", "the", "largest", "element", "in", "the", "matrix", "row", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L102-L119
train
tab58/minimatrix
src/math-helpers.js
findLargestInCol
function findLargestInCol (M, i, startAtRow = 0) { let me = M.elements; let n = M.dimension; let offset = i * n; let maxIdx = startAtRow; let maxVal = _Math.abs(me[offset + maxIdx]); for (let i = maxIdx + 1; i < n; ++i) { let val = _Math.abs(me[offset + i]); if (val > maxVal) { maxIdx = i; ...
javascript
function findLargestInCol (M, i, startAtRow = 0) { let me = M.elements; let n = M.dimension; let offset = i * n; let maxIdx = startAtRow; let maxVal = _Math.abs(me[offset + maxIdx]); for (let i = maxIdx + 1; i < n; ++i) { let val = _Math.abs(me[offset + i]); if (val > maxVal) { maxIdx = i; ...
[ "function", "findLargestInCol", "(", "M", ",", "i", ",", "startAtRow", "=", "0", ")", "{", "let", "me", "=", "M", ".", "elements", ";", "let", "n", "=", "M", ".", "dimension", ";", "let", "offset", "=", "i", "*", "n", ";", "let", "maxIdx", "=", ...
Finds the largest element in the matrix column. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} M The matrix. @param {number} i The column index. @returns {number} The row index of the column's largest element.
[ "Finds", "the", "largest", "element", "in", "the", "matrix", "column", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L128-L142
train
tab58/minimatrix
src/math-helpers.js
findFirstNonvanishing
function findFirstNonvanishing (M, TOL) { const te = M.elements; const n = M.dimension; let rowCol = { row: 0, column: 0, value: te[0] }; if (Compare.isZero(te[0], TOL)) { for (let i = 0; i < n; ++i) { for (let j = 0; j < n; ++j) { const val = te[i * n + j]; if (!Compare....
javascript
function findFirstNonvanishing (M, TOL) { const te = M.elements; const n = M.dimension; let rowCol = { row: 0, column: 0, value: te[0] }; if (Compare.isZero(te[0], TOL)) { for (let i = 0; i < n; ++i) { for (let j = 0; j < n; ++j) { const val = te[i * n + j]; if (!Compare....
[ "function", "findFirstNonvanishing", "(", "M", ",", "TOL", ")", "{", "const", "te", "=", "M", ".", "elements", ";", "const", "n", "=", "M", ".", "dimension", ";", "let", "rowCol", "=", "{", "row", ":", "0", ",", "column", ":", "0", ",", "value", ...
Finds the first nonvanishing element. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} M The matrix. @param {number} TOL The numerical tolerance. @returns {Object} The information for the nonvanishing element.
[ "Finds", "the", "first", "nonvanishing", "element", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L151-L173
train
tab58/minimatrix
src/math-helpers.js
swapValuesInArray
function swapValuesInArray (A, i, j) { if (i !== j) { const tmp = A[i]; A[i] = A[j]; A[j] = tmp; } return A; }
javascript
function swapValuesInArray (A, i, j) { if (i !== j) { const tmp = A[i]; A[i] = A[j]; A[j] = tmp; } return A; }
[ "function", "swapValuesInArray", "(", "A", ",", "i", ",", "j", ")", "{", "if", "(", "i", "!==", "j", ")", "{", "const", "tmp", "=", "A", "[", "i", "]", ";", "A", "[", "i", "]", "=", "A", "[", "j", "]", ";", "A", "[", "j", "]", "=", "tmp...
Swaps the values in the array. @memberof Helpers @param {number[]} A The array. @param {number} i The index of the first value. @param {number} j The index of the second value.
[ "Swaps", "the", "values", "in", "the", "array", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L182-L189
train
tab58/minimatrix
src/math-helpers.js
swapRowsInPlace
function swapRowsInPlace (M, i, j) { const me = M.elements; let a1 = me[i]; let a2 = me[i + 3]; let a3 = me[i + 6]; me[i] = me[j]; me[i + 3] = me[j + 3]; me[i + 6] = me[j + 6]; me[j] = a1; me[j + 3] = a2; me[j + 6] = a3; }
javascript
function swapRowsInPlace (M, i, j) { const me = M.elements; let a1 = me[i]; let a2 = me[i + 3]; let a3 = me[i + 6]; me[i] = me[j]; me[i + 3] = me[j + 3]; me[i + 6] = me[j + 6]; me[j] = a1; me[j + 3] = a2; me[j + 6] = a3; }
[ "function", "swapRowsInPlace", "(", "M", ",", "i", ",", "j", ")", "{", "const", "me", "=", "M", ".", "elements", ";", "let", "a1", "=", "me", "[", "i", "]", ";", "let", "a2", "=", "me", "[", "i", "+", "3", "]", ";", "let", "a3", "=", "me", ...
Swaps two rows in the matrix. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} M The matrix. @param {number} i The first row index. @param {number} j The second row index.
[ "Swaps", "two", "rows", "in", "the", "matrix", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L198-L211
train
tab58/minimatrix
src/math-helpers.js
scaleRow
function scaleRow (M, row, scale) { const me = M.elements; let i = row; let alpha = (scale === undefined ? 1.0 : scale); me[i] *= alpha; me[i + 3] *= alpha; me[i + 6] *= alpha; }
javascript
function scaleRow (M, row, scale) { const me = M.elements; let i = row; let alpha = (scale === undefined ? 1.0 : scale); me[i] *= alpha; me[i + 3] *= alpha; me[i + 6] *= alpha; }
[ "function", "scaleRow", "(", "M", ",", "row", ",", "scale", ")", "{", "const", "me", "=", "M", ".", "elements", ";", "let", "i", "=", "row", ";", "let", "alpha", "=", "(", "scale", "===", "undefined", "?", "1.0", ":", "scale", ")", ";", "me", "...
Scales the row in the matrix given by the index. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} M The matrix. @param {number} row The row index. @param {number} scale The number to scale by.
[ "Scales", "the", "row", "in", "the", "matrix", "given", "by", "the", "index", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L220-L227
train
tab58/minimatrix
src/math-helpers.js
scaleAndAddRow
function scaleAndAddRow (m, srcRow, destRow, scale) { const me = m.elements; let i = destRow; let j = srcRow; let alpha = (scale === undefined ? 1.0 : scale); me[i] += me[j] * alpha; me[i + 3] += me[j + 3] * alpha; me[i + 6] += me[j + 6] * alpha; }
javascript
function scaleAndAddRow (m, srcRow, destRow, scale) { const me = m.elements; let i = destRow; let j = srcRow; let alpha = (scale === undefined ? 1.0 : scale); me[i] += me[j] * alpha; me[i + 3] += me[j + 3] * alpha; me[i + 6] += me[j + 6] * alpha; }
[ "function", "scaleAndAddRow", "(", "m", ",", "srcRow", ",", "destRow", ",", "scale", ")", "{", "const", "me", "=", "m", ".", "elements", ";", "let", "i", "=", "destRow", ";", "let", "j", "=", "srcRow", ";", "let", "alpha", "=", "(", "scale", "===",...
Scales and adds the source row to the destination row. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} m The matrix. @param {number} srcRow The original row index. @param {number} destRow The destination row index for the sum to be in. @param {number} scale The number to scale the source row by.
[ "Scales", "and", "adds", "the", "source", "row", "to", "the", "destination", "row", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L237-L245
train
tab58/minimatrix
src/math-helpers.js
thresholdToZero
function thresholdToZero (m, TOL) { const me = m.elements; for (let i = 0; i < 9; ++i) { if (Compare.isZero(me[i], TOL)) { me[i] = 0; } } return m; }
javascript
function thresholdToZero (m, TOL) { const me = m.elements; for (let i = 0; i < 9; ++i) { if (Compare.isZero(me[i], TOL)) { me[i] = 0; } } return m; }
[ "function", "thresholdToZero", "(", "m", ",", "TOL", ")", "{", "const", "me", "=", "m", ".", "elements", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "9", ";", "++", "i", ")", "{", "if", "(", "Compare", ".", "isZero", "(", "me", "[",...
Thresholds all values of a matrix whose magnitude is less than the numerical tolerance. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} m The matrix. @param {number} TOL The numerical tolerance.
[ "Thresholds", "all", "values", "of", "a", "matrix", "whose", "magnitude", "is", "less", "than", "the", "numerical", "tolerance", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L253-L261
train
tab58/minimatrix
src/math-helpers.js
luSolve
function luSolve (A, P, b, X) { // Since PA = LU, then L(U x) = Pb const a = A.elements; const n = A.dimension; // L * y = P * b, solve for y. // Implicit 1's on the diagonal. for (let i = 0; i < n; ++i) { let sum = 0; for (let j = 0; j < i; ++j) { sum += a[i + j * n] * X.getComponent(j); ...
javascript
function luSolve (A, P, b, X) { // Since PA = LU, then L(U x) = Pb const a = A.elements; const n = A.dimension; // L * y = P * b, solve for y. // Implicit 1's on the diagonal. for (let i = 0; i < n; ++i) { let sum = 0; for (let j = 0; j < i; ++j) { sum += a[i + j * n] * X.getComponent(j); ...
[ "function", "luSolve", "(", "A", ",", "P", ",", "b", ",", "X", ")", "{", "// Since PA = LU, then L(U x) = Pb", "const", "a", "=", "A", ".", "elements", ";", "const", "n", "=", "A", ".", "dimension", ";", "// L * y = P * b, solve for y.", "// Implicit 1's on t...
Solves the Ax=b problem with an LU decomposition. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} A The LU decomposed matrix. @param {number[]} P The permutation array. @param {Vector2|Vector3|Vector4} b The right side vector in the Ax=b problem. @param {Vector2|Vector3|Vector4} X The solution to the problem.
[ "Solves", "the", "Ax", "=", "b", "problem", "with", "an", "LU", "decomposition", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L271-L299
train
tab58/minimatrix
src/math-helpers.js
luDecomposition
function luDecomposition (A, inPlace) { const n = A.dimension; const AA = inPlace ? A : A.clone(); const a = AA.elements; // indexed via a_ij = a[i + j * n] const P = []; const rowScalers = []; for (let i = 0; i < n; ++i) { P.push(i); const col = findLargestInRow(A, i); const scaler = a[col * n...
javascript
function luDecomposition (A, inPlace) { const n = A.dimension; const AA = inPlace ? A : A.clone(); const a = AA.elements; // indexed via a_ij = a[i + j * n] const P = []; const rowScalers = []; for (let i = 0; i < n; ++i) { P.push(i); const col = findLargestInRow(A, i); const scaler = a[col * n...
[ "function", "luDecomposition", "(", "A", ",", "inPlace", ")", "{", "const", "n", "=", "A", ".", "dimension", ";", "const", "AA", "=", "inPlace", "?", "A", ":", "A", ".", "clone", "(", ")", ";", "const", "a", "=", "AA", ".", "elements", ";", "// i...
Computes the LU decomposition. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} A The matrix to decompose. @param {boolean} inPlace Overwrites the A matrix with the LU decomposition if true, creates a new matrix if false.
[ "Computes", "the", "LU", "decomposition", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L307-L365
train
tab58/minimatrix
src/math-helpers.js
proj
function proj (u, v) { return u.clone().multiplyScalar(u.dot(v) / u.dot(u)); }
javascript
function proj (u, v) { return u.clone().multiplyScalar(u.dot(v) / u.dot(u)); }
[ "function", "proj", "(", "u", ",", "v", ")", "{", "return", "u", ".", "clone", "(", ")", ".", "multiplyScalar", "(", "u", ".", "dot", "(", "v", ")", "/", "u", ".", "dot", "(", "u", ")", ")", ";", "}" ]
Computes the projection of one vector against another. @memberof Helpers @param {Vector2|Vector3|Vector4} u The vector to project. @param {Vector2|Vector3|Vector4} v The vector to be projected against.
[ "Computes", "the", "projection", "of", "one", "vector", "against", "another", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L373-L375
train
tab58/minimatrix
src/math-helpers.js
modifiedGramSchmidt
function modifiedGramSchmidt (m) { const n = m.dimension; const v0 = m.getColumn(0); const u0 = v0; const v1 = m.getColumn(1); const u1 = v1.clone().sub(proj(u0, v1)); if (n === 2) { m.setColumns(v0, v1); return; } const v2 = m.getColumn(2); const u2t = v2.clone().sub(proj(u0, v2)); const u...
javascript
function modifiedGramSchmidt (m) { const n = m.dimension; const v0 = m.getColumn(0); const u0 = v0; const v1 = m.getColumn(1); const u1 = v1.clone().sub(proj(u0, v1)); if (n === 2) { m.setColumns(v0, v1); return; } const v2 = m.getColumn(2); const u2t = v2.clone().sub(proj(u0, v2)); const u...
[ "function", "modifiedGramSchmidt", "(", "m", ")", "{", "const", "n", "=", "m", ".", "dimension", ";", "const", "v0", "=", "m", ".", "getColumn", "(", "0", ")", ";", "const", "u0", "=", "v0", ";", "const", "v1", "=", "m", ".", "getColumn", "(", "1...
Orthogonalizes a matrix using the modified Gram-Schmidt algorithm. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} m The matrix.
[ "Orthogonalizes", "a", "matrix", "using", "the", "modified", "Gram", "-", "Schmidt", "algorithm", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L382-L400
train
tab58/minimatrix
src/math-helpers.js
rotg
function rotg (a, b, csr) { // Based on Algorithm 4 from "Discontinuous Plane // Rotations and the Symmetric Eigenvalue Problem" // by Anderson, 2000. let c = 0; let s = 0; let r = 0; let t = 0; let u = 0; if (b === 0) { c = _Math.sign(a); s = 0; r = _Math.abs(a); } else if (a === 0) { ...
javascript
function rotg (a, b, csr) { // Based on Algorithm 4 from "Discontinuous Plane // Rotations and the Symmetric Eigenvalue Problem" // by Anderson, 2000. let c = 0; let s = 0; let r = 0; let t = 0; let u = 0; if (b === 0) { c = _Math.sign(a); s = 0; r = _Math.abs(a); } else if (a === 0) { ...
[ "function", "rotg", "(", "a", ",", "b", ",", "csr", ")", "{", "// Based on Algorithm 4 from \"Discontinuous Plane", "// Rotations and the Symmetric Eigenvalue Problem\"", "// by Anderson, 2000.", "let", "c", "=", "0", ";", "let", "s", "=", "0", ";", "let", "r", "=",...
Computes the Givens rotation values for a vector. @memberof Helpers @param {number} a The x-component of a vector rotated back to a vector on the X-axis. @param {number} b The y-component of a vector rotated back to a vector on the X-axis. @param {array} csr (Optional) An array for the values to saved into, if provided...
[ "Computes", "the", "Givens", "rotation", "values", "for", "a", "vector", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L409-L448
train
tab58/minimatrix
src/math-helpers.js
qrDecomposition
function qrDecomposition (A, inPlace) { const Q = A.clone().identity(); const R = inPlace ? A : A.clone(); const qe = Q.elements; const re = R.elements; const csr = [0, 0, 0]; const DIM = Q.dimension; const m = DIM; const n = DIM; for (let j = 0; j < n; ++j) { for (let i = m - 1; i >= j + 1; --i)...
javascript
function qrDecomposition (A, inPlace) { const Q = A.clone().identity(); const R = inPlace ? A : A.clone(); const qe = Q.elements; const re = R.elements; const csr = [0, 0, 0]; const DIM = Q.dimension; const m = DIM; const n = DIM; for (let j = 0; j < n; ++j) { for (let i = m - 1; i >= j + 1; --i)...
[ "function", "qrDecomposition", "(", "A", ",", "inPlace", ")", "{", "const", "Q", "=", "A", ".", "clone", "(", ")", ".", "identity", "(", ")", ";", "const", "R", "=", "inPlace", "?", "A", ":", "A", ".", "clone", "(", ")", ";", "const", "qe", "="...
Computes the QR decomposition of a matrix. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} A The matrix to decompose. @param {boolean} inPlace Overwrites the A matrix with the R matrix.
[ "Computes", "the", "QR", "decomposition", "of", "a", "matrix", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L456-L499
train
tab58/minimatrix
src/math-helpers.js
getRank
function getRank (M, EPS) { const n = M.dimension; const { R } = qrDecomposition(M); // TODO: this is a bad way of doing this probably R.thresholdEntriesToZero(100 * EPS); let rank = 0; rrefInPlace(R); for (let i = 0; i < n; ++i) { if (isRowNonzero(R, i)) { rank++; } } return rank; }
javascript
function getRank (M, EPS) { const n = M.dimension; const { R } = qrDecomposition(M); // TODO: this is a bad way of doing this probably R.thresholdEntriesToZero(100 * EPS); let rank = 0; rrefInPlace(R); for (let i = 0; i < n; ++i) { if (isRowNonzero(R, i)) { rank++; } } return rank; }
[ "function", "getRank", "(", "M", ",", "EPS", ")", "{", "const", "n", "=", "M", ".", "dimension", ";", "const", "{", "R", "}", "=", "qrDecomposition", "(", "M", ")", ";", "// TODO: this is a bad way of doing this probably", "R", ".", "thresholdEntriesToZero", ...
Computes the rank of a matrix. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} M The matrix to get the rank of. @param {number} EPS The numerical tolerance for an element to be zero.
[ "Computes", "the", "rank", "of", "a", "matrix", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L507-L520
train
tab58/minimatrix
src/math-helpers.js
householderTransform
function householderTransform (x) { // Based on "Matrix Computations" by Golub, Van Loan const n = x.dimension; const v = x.clone(); v.x = 1; let sigma = 0; for (let i = 1; i < n; ++i) { const vi = v.getComponent(i); sigma += vi * vi; } let beta = 0; if (sigma !== 0) { const x1 = x.x; ...
javascript
function householderTransform (x) { // Based on "Matrix Computations" by Golub, Van Loan const n = x.dimension; const v = x.clone(); v.x = 1; let sigma = 0; for (let i = 1; i < n; ++i) { const vi = v.getComponent(i); sigma += vi * vi; } let beta = 0; if (sigma !== 0) { const x1 = x.x; ...
[ "function", "householderTransform", "(", "x", ")", "{", "// Based on \"Matrix Computations\" by Golub, Van Loan", "const", "n", "=", "x", ".", "dimension", ";", "const", "v", "=", "x", ".", "clone", "(", ")", ";", "v", ".", "x", "=", "1", ";", "let", "sigm...
Computes the Householder transform vector and scale. @memberof Helpers @param {Vector2|Vector3|Vector4} x The vector to rotate.
[ "Computes", "the", "Householder", "transform", "vector", "and", "scale", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L527-L550
train
tab58/minimatrix
src/math-helpers.js
hessenbergQRStep
function hessenbergQRStep (M) { const n = M.dimension; const me = M.elements; const csr = [0, 0, 0]; const cs = []; for (let k = 0; k < n - 1; ++k) { const row1 = k; const row2 = k + 1; const colK = k * n; const a = me[row1 + colK]; const b = me[row2 + colK]; rotg(a, b, csr); const...
javascript
function hessenbergQRStep (M) { const n = M.dimension; const me = M.elements; const csr = [0, 0, 0]; const cs = []; for (let k = 0; k < n - 1; ++k) { const row1 = k; const row2 = k + 1; const colK = k * n; const a = me[row1 + colK]; const b = me[row2 + colK]; rotg(a, b, csr); const...
[ "function", "hessenbergQRStep", "(", "M", ")", "{", "const", "n", "=", "M", ".", "dimension", ";", "const", "me", "=", "M", ".", "elements", ";", "const", "csr", "=", "[", "0", ",", "0", ",", "0", "]", ";", "const", "cs", "=", "[", "]", ";", ...
Computes a Hessenberg step of the QR algorithm. @memberof Helpers @param {Matrix2|Matrix3|Matrix4} M The matrix to step.
[ "Computes", "a", "Hessenberg", "step", "of", "the", "QR", "algorithm", "." ]
542f1d964b7ae92f96b1069ff5f3495561fe75cd
https://github.com/tab58/minimatrix/blob/542f1d964b7ae92f96b1069ff5f3495561fe75cd/src/math-helpers.js#L557-L596
train
unshiftio/hang
index.js
bro
function bro() { var self = this; // // Time has passed since we've generated this function so we're going to // assume that this function is already executed async. // if (+(new Date()) > start) { return fn.apply(self, arguments); } for (var i = 0, l = arguments.length, args = n...
javascript
function bro() { var self = this; // // Time has passed since we've generated this function so we're going to // assume that this function is already executed async. // if (+(new Date()) > start) { return fn.apply(self, arguments); } for (var i = 0, l = arguments.length, args = n...
[ "function", "bro", "(", ")", "{", "var", "self", "=", "this", ";", "//", "// Time has passed since we've generated this function so we're going to", "// assume that this function is already executed async.", "//", "if", "(", "+", "(", "new", "Date", "(", ")", ")", ">", ...
The wrapped function. @api private
[ "The", "wrapped", "function", "." ]
375f30d5bdb0ad22349dabe52855b123dda9b8b4
https://github.com/unshiftio/hang/blob/375f30d5bdb0ad22349dabe52855b123dda9b8b4/index.js#L18-L37
train
fin-hypergrid/hyper-analytics
js/util/Mappy.js
betterIndexOf
function betterIndexOf(arr, value) { if (value != value || value === 0) { // eslint-disable-line eqeqeq var i = arr.length; while (i-- && !is(arr[i], value)) { // eslint-disable-line no-empty } } else { i = [].indexOf.call(arr, value); } return i; }
javascript
function betterIndexOf(arr, value) { if (value != value || value === 0) { // eslint-disable-line eqeqeq var i = arr.length; while (i-- && !is(arr[i], value)) { // eslint-disable-line no-empty } } else { i = [].indexOf.call(arr, value); } return i; }
[ "function", "betterIndexOf", "(", "arr", ",", "value", ")", "{", "if", "(", "value", "!=", "value", "||", "value", "===", "0", ")", "{", "// eslint-disable-line eqeqeq", "var", "i", "=", "arr", ".", "length", ";", "while", "(", "i", "--", "&&", "!", ...
More reliable indexOf, courtesy of @WebReflection
[ "More", "reliable", "indexOf", "courtesy", "of" ]
70257bf0d0388d29177ce86192d0d08508b2a22e
https://github.com/fin-hypergrid/hyper-analytics/blob/70257bf0d0388d29177ce86192d0d08508b2a22e/js/util/Mappy.js#L173-L183
train
andrewscwei/requiem
src/helpers/isCustomElement.js
isCustomElement
function isCustomElement(element) { assertType(element, Node, false, 'Invalid element specified'); let is = getAttribute(element, 'is'); let tag = element.tagName.toLowerCase(); if (is && (getElementRegistry(is) !== undefined)) return true; if (tag && (getElementRegistry(tag) !== undefined)) return true; ...
javascript
function isCustomElement(element) { assertType(element, Node, false, 'Invalid element specified'); let is = getAttribute(element, 'is'); let tag = element.tagName.toLowerCase(); if (is && (getElementRegistry(is) !== undefined)) return true; if (tag && (getElementRegistry(tag) !== undefined)) return true; ...
[ "function", "isCustomElement", "(", "element", ")", "{", "assertType", "(", "element", ",", "Node", ",", "false", ",", "'Invalid element specified'", ")", ";", "let", "is", "=", "getAttribute", "(", "element", ",", "'is'", ")", ";", "let", "tag", "=", "ele...
Verifies that the specified element is a custom Requiem element. @param {Node} element - Target element. @return {boolean} True if recognized as custom Requiem element, false otherwise. @alias module:requiem~helpers.isCustomElement
[ "Verifies", "that", "the", "specified", "element", "is", "a", "custom", "Requiem", "element", "." ]
c4182bfffc9841c6de5718f689ad3c2060511777
https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/helpers/isCustomElement.js#L19-L28
train
vkiding/judpack-lib
src/gitclone.js
clone
function clone(git_url, git_ref, clone_dir){ var needsGitCheckout = !!git_ref; if (!shell.which('git')) { return Q.reject(new Error('"git" command line tool is not installed: make sure it is accessible on your PATH.')); } // If no clone_dir is specified, create a tmp dir which git will clo...
javascript
function clone(git_url, git_ref, clone_dir){ var needsGitCheckout = !!git_ref; if (!shell.which('git')) { return Q.reject(new Error('"git" command line tool is not installed: make sure it is accessible on your PATH.')); } // If no clone_dir is specified, create a tmp dir which git will clo...
[ "function", "clone", "(", "git_url", ",", "git_ref", ",", "clone_dir", ")", "{", "var", "needsGitCheckout", "=", "!", "!", "git_ref", ";", "if", "(", "!", "shell", ".", "which", "(", "'git'", ")", ")", "{", "return", "Q", ".", "reject", "(", "new", ...
clone_dir, if provided is the directory that git will clone into. if no clone_dir is supplied, a temp directory will be created and used by git.
[ "clone_dir", "if", "provided", "is", "the", "directory", "that", "git", "will", "clone", "into", ".", "if", "no", "clone_dir", "is", "supplied", "a", "temp", "directory", "will", "be", "created", "and", "used", "by", "git", "." ]
8657cecfec68221109279106adca8dbc81f430f4
https://github.com/vkiding/judpack-lib/blob/8657cecfec68221109279106adca8dbc81f430f4/src/gitclone.js#L32-L69
train
repetere/periodicjs.core.cache
lib/viewcache.js
function (options) { var defaultOptions = { viewCacheDir: viewCacheDir, expires: 3600 }; this.type='flatfile'; this.prefix='flatfile'; this.driver = 'fs'; this._size = 0; this._hits = 0; this._misses = 0; this.options = merge(defaultOptions,options); this.expires = this.options.expires; viewCacheDir = th...
javascript
function (options) { var defaultOptions = { viewCacheDir: viewCacheDir, expires: 3600 }; this.type='flatfile'; this.prefix='flatfile'; this.driver = 'fs'; this._size = 0; this._hits = 0; this._misses = 0; this.options = merge(defaultOptions,options); this.expires = this.options.expires; viewCacheDir = th...
[ "function", "(", "options", ")", "{", "var", "defaultOptions", "=", "{", "viewCacheDir", ":", "viewCacheDir", ",", "expires", ":", "3600", "}", ";", "this", ".", "type", "=", "'flatfile'", ";", "this", ".", "prefix", "=", "'flatfile'", ";", "this", ".", ...
A core constructor that provides numerous cache helper functions. @{@link https://github.com/typesettin/periodicjs.core.cache} @author Yaw Joseph Etse @constructor @copyright Copyright (c) 2014 Typesettin. All rights reserved. @license MIT @requires module:fs-extra @requires module:path @requires module:du @param {obje...
[ "A", "core", "constructor", "that", "provides", "numerous", "cache", "helper", "functions", "." ]
c78f633b575d8ba5d59f3517b525860b59e05927
https://github.com/repetere/periodicjs.core.cache/blob/c78f633b575d8ba5d59f3517b525860b59e05927/lib/viewcache.js#L28-L47
train
aureooms/js-grammar
lib/util/setadd.js
setadd
function setadd(set, element) { if (set.has(element)) return false; set.add(element); return true; }
javascript
function setadd(set, element) { if (set.has(element)) return false; set.add(element); return true; }
[ "function", "setadd", "(", "set", ",", "element", ")", "{", "if", "(", "set", ".", "has", "(", "element", ")", ")", "return", "false", ";", "set", ".", "add", "(", "element", ")", ";", "return", "true", ";", "}" ]
Adds an element to a set and returns true if the set has changed. @param {Set} set - The set to add to. @param {Object} element - The element to add to the set. @returns {Boolean} Whether <code>set</code> has changed.
[ "Adds", "an", "element", "to", "a", "set", "and", "returns", "true", "if", "the", "set", "has", "changed", "." ]
28c4d1a3175327b33766c34539eab317303e26c5
https://github.com/aureooms/js-grammar/blob/28c4d1a3175327b33766c34539eab317303e26c5/lib/util/setadd.js#L15-L19
train
redisjs/jsr-server
lib/argv.js
argv
function argv(args) { var out = {directives: {}} , i = 0; /* istanbul ignore next: never use process.argv in tests */ args = args || process.argv.slice(2); if(!args.length) return out; // read conf from stdin if(args[i] === STDIN) { out.stdin = true; i++; // conf should be first arg }else ...
javascript
function argv(args) { var out = {directives: {}} , i = 0; /* istanbul ignore next: never use process.argv in tests */ args = args || process.argv.slice(2); if(!args.length) return out; // read conf from stdin if(args[i] === STDIN) { out.stdin = true; i++; // conf should be first arg }else ...
[ "function", "argv", "(", "args", ")", "{", "var", "out", "=", "{", "directives", ":", "{", "}", "}", ",", "i", "=", "0", ";", "/* istanbul ignore next: never use process.argv in tests */", "args", "=", "args", "||", "process", ".", "argv", ".", "slice", "(...
Parse arguments redis-server style.
[ "Parse", "arguments", "redis", "-", "server", "style", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/argv.js#L7-L61
train
redisjs/jsr-server
lib/connection.js
Connection
function Connection(socket) { events.EventEmitter.call(this); // underlying socket this._socket = socket; // flag whether this connection is paused this._paused = false; // external or in-process client connection this._tcp = (this._socket instanceof Socket); // state information this._client = ne...
javascript
function Connection(socket) { events.EventEmitter.call(this); // underlying socket this._socket = socket; // flag whether this connection is paused this._paused = false; // external or in-process client connection this._tcp = (this._socket instanceof Socket); // state information this._client = ne...
[ "function", "Connection", "(", "socket", ")", "{", "events", ".", "EventEmitter", ".", "call", "(", "this", ")", ";", "// underlying socket", "this", ".", "_socket", "=", "socket", ";", "// flag whether this connection is paused", "this", ".", "_paused", "=", "f...
Encapsulates a client socket connection.
[ "Encapsulates", "a", "client", "socket", "connection", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/connection.js#L24-L61
train
redisjs/jsr-server
lib/connection.js
resume
function resume() { this._paused = false; if(this.client._qbuf.length) { this.data(this.client._qbuf); this.client._qbuf = new Buffer(0); } }
javascript
function resume() { this._paused = false; if(this.client._qbuf.length) { this.data(this.client._qbuf); this.client._qbuf = new Buffer(0); } }
[ "function", "resume", "(", ")", "{", "this", ".", "_paused", "=", "false", ";", "if", "(", "this", ".", "client", ".", "_qbuf", ".", "length", ")", "{", "this", ".", "data", "(", "this", ".", "client", ".", "_qbuf", ")", ";", "this", ".", "client...
Resume this client connection and flush buffered commands.
[ "Resume", "this", "client", "connection", "and", "flush", "buffered", "commands", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/connection.js#L76-L82
train
redisjs/jsr-server
lib/connection.js
onWrite
function onWrite(req) { if(!this.transaction || !this.watched || req.conn.id === this.id) { return false; } //console.dir(req.keys); //console.dir(req.args); var keys = req.keys || req.def.getKeys(req.args), i, key; for(i = 0;i < keys.length;i++) { key = '' + keys[i]; //console.error('got chan...
javascript
function onWrite(req) { if(!this.transaction || !this.watched || req.conn.id === this.id) { return false; } //console.dir(req.keys); //console.dir(req.args); var keys = req.keys || req.def.getKeys(req.args), i, key; for(i = 0;i < keys.length;i++) { key = '' + keys[i]; //console.error('got chan...
[ "function", "onWrite", "(", "req", ")", "{", "if", "(", "!", "this", ".", "transaction", "||", "!", "this", ".", "watched", "||", "req", ".", "conn", ".", "id", "===", "this", ".", "id", ")", "{", "return", "false", ";", "}", "//console.dir(req.keys)...
Listener for write events emitted by the database. Inspects the request object and if the request keys match any keys being watched by this connection and the request was from another connection then a conflict if flagged on a transaction if a transaction exists.
[ "Listener", "for", "write", "events", "emitted", "by", "the", "database", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/connection.js#L92-L113
train
redisjs/jsr-server
lib/connection.js
watch
function watch(keys, database) { keys = keys.map(function(k) { if(k instanceof Buffer) return k.toString(); return k; }) //console.dir(keys); // watch can be called multiple times // with the same keys, prevent listener leaks this.unwatch(database); database.on('write', this.onWrite); this.w...
javascript
function watch(keys, database) { keys = keys.map(function(k) { if(k instanceof Buffer) return k.toString(); return k; }) //console.dir(keys); // watch can be called multiple times // with the same keys, prevent listener leaks this.unwatch(database); database.on('write', this.onWrite); this.w...
[ "function", "watch", "(", "keys", ",", "database", ")", "{", "keys", "=", "keys", ".", "map", "(", "function", "(", "k", ")", "{", "if", "(", "k", "instanceof", "Buffer", ")", "return", "k", ".", "toString", "(", ")", ";", "return", "k", ";", "}"...
Watch an array of keys.
[ "Watch", "an", "array", "of", "keys", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/connection.js#L118-L133
train
redisjs/jsr-server
lib/connection.js
data
function data(buf) { if(this._tcp) { if(this._paused) { this.client._qbuf = Buffer.concat( [this.client._qbuf, buf], this.client._qbuf.length + buf.length); return false; } this.emit('input', buf.length); this._process(buf); }else{ // TODO: handle pausing internal connections...
javascript
function data(buf) { if(this._tcp) { if(this._paused) { this.client._qbuf = Buffer.concat( [this.client._qbuf, buf], this.client._qbuf.length + buf.length); return false; } this.emit('input', buf.length); this._process(buf); }else{ // TODO: handle pausing internal connections...
[ "function", "data", "(", "buf", ")", "{", "if", "(", "this", ".", "_tcp", ")", "{", "if", "(", "this", ".", "_paused", ")", "{", "this", ".", "client", ".", "_qbuf", "=", "Buffer", ".", "concat", "(", "[", "this", ".", "client", ".", "_qbuf", "...
Read incoming data on the socket connection. @param buf The incoming buffer or internal request array.
[ "Read", "incoming", "data", "on", "the", "socket", "connection", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/connection.js#L149-L166
train
redisjs/jsr-server
lib/connection.js
monitor
function monitor(server) { // cannot receive data anymore we just send it this.removeAllListeners('data'); var listener = this.request.bind(this); // keep track of the monitor listeners // for clean up server._monitor[this.id] = listener; // flag on the client for client list flags this._client.monit...
javascript
function monitor(server) { // cannot receive data anymore we just send it this.removeAllListeners('data'); var listener = this.request.bind(this); // keep track of the monitor listeners // for clean up server._monitor[this.id] = listener; // flag on the client for client list flags this._client.monit...
[ "function", "monitor", "(", "server", ")", "{", "// cannot receive data anymore we just send it", "this", ".", "removeAllListeners", "(", "'data'", ")", ";", "var", "listener", "=", "this", ".", "request", ".", "bind", "(", "this", ")", ";", "// keep track of the ...
Send this client into a monitor state.
[ "Send", "this", "client", "into", "a", "monitor", "state", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/connection.js#L171-L185
train
redisjs/jsr-server
lib/connection.js
decoded
function decoded(err, reply) { //console.error('got decoder err %s', err ); //console.error('got decoder reply %j',reply ); var res = new Response(this), req, cmd, args; if(err) { // return decoder errors to the client return res.send(err); } // we should only be handling array request types if(!...
javascript
function decoded(err, reply) { //console.error('got decoder err %s', err ); //console.error('got decoder reply %j',reply ); var res = new Response(this), req, cmd, args; if(err) { // return decoder errors to the client return res.send(err); } // we should only be handling array request types if(!...
[ "function", "decoded", "(", "err", ",", "reply", ")", "{", "//console.error('got decoder err %s', err );", "//console.error('got decoder reply %j',reply );", "var", "res", "=", "new", "Response", "(", "this", ")", ",", "req", ",", "cmd", ",", "args", ";", "if", "(...
Handle an incoming decoded RESP message.
[ "Handle", "an", "incoming", "decoded", "RESP", "message", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/connection.js#L198-L233
train
redisjs/jsr-server
lib/connection.js
_process
function _process(buf) { var b = buf[0], cli, cmd, req, res; //console.dir('' + buf); // does it look like a RESP message if(b === STR || b === ERR || b === INT || b === BST || b === ARR // already buffered some data, chunked request || (this.decoder.isBuffered())) { //console.dir(...
javascript
function _process(buf) { var b = buf[0], cli, cmd, req, res; //console.dir('' + buf); // does it look like a RESP message if(b === STR || b === ERR || b === INT || b === BST || b === ARR // already buffered some data, chunked request || (this.decoder.isBuffered())) { //console.dir(...
[ "function", "_process", "(", "buf", ")", "{", "var", "b", "=", "buf", "[", "0", "]", ",", "cli", ",", "cmd", ",", "req", ",", "res", ";", "//console.dir('' + buf);", "// does it look like a RESP message", "if", "(", "b", "===", "STR", "||", "b", "===", ...
Process incoming data and respond accordingly. @param buf The incoming buffer.
[ "Process", "incoming", "data", "and", "respond", "accordingly", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/connection.js#L240-L267
train
redisjs/jsr-server
lib/connection.js
end
function end(cb) { if(typeof cb === 'function') { this.once('disconnect', cb); } if(this.tcp) { // must call destroy to terminate immediately this._socket.destroy(); }else{ this._socket.end(); } }
javascript
function end(cb) { if(typeof cb === 'function') { this.once('disconnect', cb); } if(this.tcp) { // must call destroy to terminate immediately this._socket.destroy(); }else{ this._socket.end(); } }
[ "function", "end", "(", "cb", ")", "{", "if", "(", "typeof", "cb", "===", "'function'", ")", "{", "this", ".", "once", "(", "'disconnect'", ",", "cb", ")", ";", "}", "if", "(", "this", ".", "tcp", ")", "{", "// must call destroy to terminate immediately"...
Proxy end to the underlying socket.
[ "Proxy", "end", "to", "the", "underlying", "socket", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/connection.js#L272-L283
train
redisjs/jsr-server
lib/connection.js
write
function write(data, cb) { if(this._tcp) { //this.emit('output', data); this.encoder.write(data, cb); }else{ this._socket.write.call(this._socket, data, cb); } }
javascript
function write(data, cb) { if(this._tcp) { //this.emit('output', data); this.encoder.write(data, cb); }else{ this._socket.write.call(this._socket, data, cb); } }
[ "function", "write", "(", "data", ",", "cb", ")", "{", "if", "(", "this", ".", "_tcp", ")", "{", "//this.emit('output', data);", "this", ".", "encoder", ".", "write", "(", "data", ",", "cb", ")", ";", "}", "else", "{", "this", ".", "_socket", ".", ...
Proxy write to the underlying socket.
[ "Proxy", "write", "to", "the", "underlying", "socket", "." ]
49413052d3039524fbdd2ade0ef9bae26cb4d647
https://github.com/redisjs/jsr-server/blob/49413052d3039524fbdd2ade0ef9bae26cb4d647/lib/connection.js#L297-L304
train
0of/ver-iterator
lib/npm.js
publishedVers
function publishedVers(name) { var _child$spawnSync = _child_process2['default'].spawnSync(npmCommand, ['view', name, 'versions', '--json']); var stdout = _child$spawnSync.stdout; var error = _child$spawnSync.error; if (error) throw error; return JSON.parse(stdout.toString());...
javascript
function publishedVers(name) { var _child$spawnSync = _child_process2['default'].spawnSync(npmCommand, ['view', name, 'versions', '--json']); var stdout = _child$spawnSync.stdout; var error = _child$spawnSync.error; if (error) throw error; return JSON.parse(stdout.toString());...
[ "function", "publishedVers", "(", "name", ")", "{", "var", "_child$spawnSync", "=", "_child_process2", "[", "'default'", "]", ".", "spawnSync", "(", "npmCommand", ",", "[", "'view'", ",", "name", ",", "'versions'", ",", "'--json'", "]", ")", ";", "var", "s...
get published versions via npm @param {String} [name] published package name @return {Array} versions @public
[ "get", "published", "versions", "via", "npm" ]
a51726c02dfd14488190860f4d90903574ed8e37
https://github.com/0of/ver-iterator/blob/a51726c02dfd14488190860f4d90903574ed8e37/lib/npm.js#L23-L32
train
0of/ver-iterator
lib/npm.js
installVer
function installVer(name, ver, dir) { var _child$spawnSync2 = _child_process2['default'].spawnSync(npmCommand, ['install', name + '@' + ver], { cwd: dir }); var error = _child$spawnSync2.error; if (error) throw error; }
javascript
function installVer(name, ver, dir) { var _child$spawnSync2 = _child_process2['default'].spawnSync(npmCommand, ['install', name + '@' + ver], { cwd: dir }); var error = _child$spawnSync2.error; if (error) throw error; }
[ "function", "installVer", "(", "name", ",", "ver", ",", "dir", ")", "{", "var", "_child$spawnSync2", "=", "_child_process2", "[", "'default'", "]", ".", "spawnSync", "(", "npmCommand", ",", "[", "'install'", ",", "name", "+", "'@'", "+", "ver", "]", ",",...
install package via npm @param {String} [name] published package name @param {String} [ver] install version @param {String} [dir] install directory @public
[ "install", "package", "via", "npm" ]
a51726c02dfd14488190860f4d90903574ed8e37
https://github.com/0of/ver-iterator/blob/a51726c02dfd14488190860f4d90903574ed8e37/lib/npm.js#L42-L48
train
0of/ver-iterator
lib/npm.js
listInstalledVer
function listInstalledVer(name, dir) { var _child$spawnSync3 = _child_process2['default'].spawnSync(npmCommand, ['list', name, '--depth', '0', '--json'], { cwd: dir }); var stdout = _child$spawnSync3.stdout; var error = _child$spawnSync3.error; var status = _child$spawnSync3.status; ...
javascript
function listInstalledVer(name, dir) { var _child$spawnSync3 = _child_process2['default'].spawnSync(npmCommand, ['list', name, '--depth', '0', '--json'], { cwd: dir }); var stdout = _child$spawnSync3.stdout; var error = _child$spawnSync3.error; var status = _child$spawnSync3.status; ...
[ "function", "listInstalledVer", "(", "name", ",", "dir", ")", "{", "var", "_child$spawnSync3", "=", "_child_process2", "[", "'default'", "]", ".", "spawnSync", "(", "npmCommand", ",", "[", "'list'", ",", "name", ",", "'--depth'", ",", "'0'", ",", "'--json'",...
list specific package version via npm @param {String} [name] published package name @param {String} [dir] list directory @public
[ "list", "specific", "package", "version", "via", "npm" ]
a51726c02dfd14488190860f4d90903574ed8e37
https://github.com/0of/ver-iterator/blob/a51726c02dfd14488190860f4d90903574ed8e37/lib/npm.js#L57-L70
train
0of/ver-iterator
lib/npm.js
uninstalledVer
function uninstalledVer(name, ver, dir) { var _child$spawnSync4 = _child_process2['default'].spawnSync(npmCommand, ['uninstall', ver.length === 0 ? name : name + '@' + ver], { cwd: dir }); var error = _child$spawnSync4.error; if (error) throw error; }
javascript
function uninstalledVer(name, ver, dir) { var _child$spawnSync4 = _child_process2['default'].spawnSync(npmCommand, ['uninstall', ver.length === 0 ? name : name + '@' + ver], { cwd: dir }); var error = _child$spawnSync4.error; if (error) throw error; }
[ "function", "uninstalledVer", "(", "name", ",", "ver", ",", "dir", ")", "{", "var", "_child$spawnSync4", "=", "_child_process2", "[", "'default'", "]", ".", "spawnSync", "(", "npmCommand", ",", "[", "'uninstall'", ",", "ver", ".", "length", "===", "0", "?"...
uninstall package via npm @param {String} [name] published package name @param {String} [ver] install version @param {String} [dir] uninstall directory @public
[ "uninstall", "package", "via", "npm" ]
a51726c02dfd14488190860f4d90903574ed8e37
https://github.com/0of/ver-iterator/blob/a51726c02dfd14488190860f4d90903574ed8e37/lib/npm.js#L80-L86
train
gethuman/pancakes-recipe
utils/validation.js
getSchema
function getSchema(path) { var parts = path.split('.'); var collectionName = parts[0]; var fieldName = parts[1]; // if format not user.field or field not in the schemaDefinitions object, then log error without breaking if (parts.length !== 2 || !schemaDefinitions[collectionName]...
javascript
function getSchema(path) { var parts = path.split('.'); var collectionName = parts[0]; var fieldName = parts[1]; // if format not user.field or field not in the schemaDefinitions object, then log error without breaking if (parts.length !== 2 || !schemaDefinitions[collectionName]...
[ "function", "getSchema", "(", "path", ")", "{", "var", "parts", "=", "path", ".", "split", "(", "'.'", ")", ";", "var", "collectionName", "=", "parts", "[", "0", "]", ";", "var", "fieldName", "=", "parts", "[", "1", "]", ";", "// if format not user.fie...
Take a string like user.password and get the schemaDefinitions for it @param path @returns {*}
[ "Take", "a", "string", "like", "user", ".", "password", "and", "get", "the", "schemaDefinitions", "for", "it" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/validation.js#L61-L73
train
gethuman/pancakes-recipe
utils/validation.js
parseValidateAttr
function parseValidateAttr(validateAttr, schema, validateFns) { // if an array, loop through and recurse if (_.isArray(validateAttr)) { _.each(validateAttr, function (validator) { parseValidateAttr(validator, schema, validateFns); }); return; ...
javascript
function parseValidateAttr(validateAttr, schema, validateFns) { // if an array, loop through and recurse if (_.isArray(validateAttr)) { _.each(validateAttr, function (validator) { parseValidateAttr(validator, schema, validateFns); }); return; ...
[ "function", "parseValidateAttr", "(", "validateAttr", ",", "schema", ",", "validateFns", ")", "{", "// if an array, loop through and recurse", "if", "(", "_", ".", "isArray", "(", "validateAttr", ")", ")", "{", "_", ".", "each", "(", "validateAttr", ",", "functi...
Take thing originally from the gh-validate attribute and turn it into an obj and fns array @param validateAttr @param schema @param validateFns
[ "Take", "thing", "originally", "from", "the", "gh", "-", "validate", "attribute", "and", "turn", "it", "into", "an", "obj", "and", "fns", "array" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/validation.js#L92-L113
train
gethuman/pancakes-recipe
utils/validation.js
generateValidationFn
function generateValidationFn(schema) { return function (req) { // if already an error, return without doing any additional validation if (req.error) { return req; } var keys = Object.keys(schema); var len = (req.value && req.value.trim().length) || 0; ...
javascript
function generateValidationFn(schema) { return function (req) { // if already an error, return without doing any additional validation if (req.error) { return req; } var keys = Object.keys(schema); var len = (req.value && req.value.trim().length) || 0; ...
[ "function", "generateValidationFn", "(", "schema", ")", "{", "return", "function", "(", "req", ")", "{", "// if already an error, return without doing any additional validation", "if", "(", "req", ".", "error", ")", "{", "return", "req", ";", "}", "var", "keys", "...
Generate validator function off of the given schema object @param schema @returns {Function}
[ "Generate", "validator", "function", "off", "of", "the", "given", "schema", "object" ]
ea3feb8839e2edaf1b4577c052b8958953db4498
https://github.com/gethuman/pancakes-recipe/blob/ea3feb8839e2edaf1b4577c052b8958953db4498/utils/validation.js#L120-L149
train
tolokoban/ToloFrameWork
lib/module.js
getCandidates
function getCandidates(moduleName, srcPath) { const candidates = [], moduleNames = getSynonyms(moduleName); for( const path of srcPath) { for( const name of moduleNames) { candidates.push( Path.resolve( path, "mod", name) ); } } return candidates; }
javascript
function getCandidates(moduleName, srcPath) { const candidates = [], moduleNames = getSynonyms(moduleName); for( const path of srcPath) { for( const name of moduleNames) { candidates.push( Path.resolve( path, "mod", name) ); } } return candidates; }
[ "function", "getCandidates", "(", "moduleName", ",", "srcPath", ")", "{", "const", "candidates", "=", "[", "]", ",", "moduleNames", "=", "getSynonyms", "(", "moduleName", ")", ";", "for", "(", "const", "path", "of", "srcPath", ")", "{", "for", "(", "cons...
List all possible absolute pathes for the given module. @param {string} moduleName - Name of the module (with dots). @param {array} srcPath - Array of absolute pathes where to look for sources. Module's files lie in the subdirectory `mod/` of a source directory. @returns {array} Array of absolute module pathes in orde...
[ "List", "all", "possible", "absolute", "pathes", "for", "the", "given", "module", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/module.js#L65-L76
train
tolokoban/ToloFrameWork
lib/module.js
getFirstViableCandidate
function getFirstViableCandidate(candidates) { for( const candidate of candidates) { const fileJS = `${candidate}.js`; if( Fs.existsSync(fileJS) ) return candidate; const fileXJS = `${candidate}.xjs`; if( Fs.existsSync(fileXJS) ) return candidate; } return candidates[0]; }
javascript
function getFirstViableCandidate(candidates) { for( const candidate of candidates) { const fileJS = `${candidate}.js`; if( Fs.existsSync(fileJS) ) return candidate; const fileXJS = `${candidate}.xjs`; if( Fs.existsSync(fileXJS) ) return candidate; } return candidates[0]; }
[ "function", "getFirstViableCandidate", "(", "candidates", ")", "{", "for", "(", "const", "candidate", "of", "candidates", ")", "{", "const", "fileJS", "=", "`", "${", "candidate", "}", "`", ";", "if", "(", "Fs", ".", "existsSync", "(", "fileJS", ")", ")"...
A candidate is viable if the `js` or the `xjs` file exists. @param {array} candidates - Pathes of module files (without extension). @returns {string} The first candidate if no module has been found.
[ "A", "candidate", "is", "viable", "if", "the", "js", "or", "the", "xjs", "file", "exists", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/lib/module.js#L103-L112
train
mrcarlberg/objj-transpiler
ObjJAcornCompiler.js
setupOptions
function setupOptions(opts) { var options = Object.create(null); for (var opt in defaultOptions) { if (opts && Object.prototype.hasOwnProperty.call(opts, opt)) { var incomingOpt = opts[opt]; options[opt] = typeof incomingOpt === 'function' ? incomingOpt() : incomingOpt; }...
javascript
function setupOptions(opts) { var options = Object.create(null); for (var opt in defaultOptions) { if (opts && Object.prototype.hasOwnProperty.call(opts, opt)) { var incomingOpt = opts[opt]; options[opt] = typeof incomingOpt === 'function' ? incomingOpt() : incomingOpt; }...
[ "function", "setupOptions", "(", "opts", ")", "{", "var", "options", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "var", "opt", "in", "defaultOptions", ")", "{", "if", "(", "opts", "&&", "Object", ".", "prototype", ".", "hasOwnPrope...
We copy the options to a new object as we don't want to mess up incoming options when we start compiling.
[ "We", "copy", "the", "options", "to", "a", "new", "object", "as", "we", "don", "t", "want", "to", "mess", "up", "incoming", "options", "when", "we", "start", "compiling", "." ]
d9117b580cb829142fdbebf6806e9a78e7c51f46
https://github.com/mrcarlberg/objj-transpiler/blob/d9117b580cb829142fdbebf6806e9a78e7c51f46/ObjJAcornCompiler.js#L685-L697
train
mrcarlberg/objj-transpiler
ObjJAcornCompiler.js
surroundExpression
function surroundExpression(c) { return function(node, st, override, format) { st.compiler.jsBuffer.concat("("); c(node, st, override, format); st.compiler.jsBuffer.concat(")"); } }
javascript
function surroundExpression(c) { return function(node, st, override, format) { st.compiler.jsBuffer.concat("("); c(node, st, override, format); st.compiler.jsBuffer.concat(")"); } }
[ "function", "surroundExpression", "(", "c", ")", "{", "return", "function", "(", "node", ",", "st", ",", "override", ",", "format", ")", "{", "st", ".", "compiler", ".", "jsBuffer", ".", "concat", "(", "\"(\"", ")", ";", "c", "(", "node", ",", "st", ...
Surround expression with parentheses
[ "Surround", "expression", "with", "parentheses" ]
d9117b580cb829142fdbebf6806e9a78e7c51f46
https://github.com/mrcarlberg/objj-transpiler/blob/d9117b580cb829142fdbebf6806e9a78e7c51f46/ObjJAcornCompiler.js#L1183-L1189
train
mrcarlberg/objj-transpiler
ObjJAcornCompiler.js
function(node, st, c) { var compiler = st.compiler; if (compiler.generate) compiler.jsBuffer.concat(node.name, node); }
javascript
function(node, st, c) { var compiler = st.compiler; if (compiler.generate) compiler.jsBuffer.concat(node.name, node); }
[ "function", "(", "node", ",", "st", ",", "c", ")", "{", "var", "compiler", "=", "st", ".", "compiler", ";", "if", "(", "compiler", ".", "generate", ")", "compiler", ".", "jsBuffer", ".", "concat", "(", "node", ".", "name", ",", "node", ")", ";", ...
Use this when there should not be a look up to issue warnings or add 'self.' before ivars
[ "Use", "this", "when", "there", "should", "not", "be", "a", "look", "up", "to", "issue", "warnings", "or", "add", "self", ".", "before", "ivars" ]
d9117b580cb829142fdbebf6806e9a78e7c51f46
https://github.com/mrcarlberg/objj-transpiler/blob/d9117b580cb829142fdbebf6806e9a78e7c51f46/ObjJAcornCompiler.js#L2282-L2286
train
feedhenry/fh-mbaas-middleware
lib/util/common.js
buildErrorObject
function buildErrorObject(params){ params = params || {}; //If the userDetail is already set, not building the error object again. if(params.err && params.err.userDetail){ return params; } var err = params.err || {message: "Unexpected Error"}; var msg = params.msg || params.err.message || "Unexpected ...
javascript
function buildErrorObject(params){ params = params || {}; //If the userDetail is already set, not building the error object again. if(params.err && params.err.userDetail){ return params; } var err = params.err || {message: "Unexpected Error"}; var msg = params.msg || params.err.message || "Unexpected ...
[ "function", "buildErrorObject", "(", "params", ")", "{", "params", "=", "params", "||", "{", "}", ";", "//If the userDetail is already set, not building the error object again.", "if", "(", "params", ".", "err", "&&", "params", ".", "err", ".", "userDetail", ")", ...
First step to creating common error codes. TODO: Make A Module.. @param err @param msg @param code @returns {{error: string}}
[ "First", "step", "to", "creating", "common", "error", "codes", "." ]
f906e98efbb4b0963bf5137b34b5e0589ba24e69
https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/util/common.js#L19-L46
train
feedhenry/fh-mbaas-middleware
lib/util/common.js
setResponseHeaders
function setResponseHeaders(res) { if(res.setHeader) { var contentType = res.getHeader('content-type'); if (!contentType) { res.setHeader('Content-Type', 'application/json'); } } }
javascript
function setResponseHeaders(res) { if(res.setHeader) { var contentType = res.getHeader('content-type'); if (!contentType) { res.setHeader('Content-Type', 'application/json'); } } }
[ "function", "setResponseHeaders", "(", "res", ")", "{", "if", "(", "res", ".", "setHeader", ")", "{", "var", "contentType", "=", "res", ".", "getHeader", "(", "'content-type'", ")", ";", "if", "(", "!", "contentType", ")", "{", "res", ".", "setHeader", ...
set default response headers
[ "set", "default", "response", "headers" ]
f906e98efbb4b0963bf5137b34b5e0589ba24e69
https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/util/common.js#L49-L56
train
feedhenry/fh-mbaas-middleware
lib/util/common.js
handleError
function handleError(err, msg, code, req, res){ logError(err, msg, code, req); var response = buildErrorObject({ err: err, msg: msg, httpCode: code }); res.statusCode = response.httpCode; res.end(JSON.stringify(response.errorFields)); }
javascript
function handleError(err, msg, code, req, res){ logError(err, msg, code, req); var response = buildErrorObject({ err: err, msg: msg, httpCode: code }); res.statusCode = response.httpCode; res.end(JSON.stringify(response.errorFields)); }
[ "function", "handleError", "(", "err", ",", "msg", ",", "code", ",", "req", ",", "res", ")", "{", "logError", "(", "err", ",", "msg", ",", "code", ",", "req", ")", ";", "var", "response", "=", "buildErrorObject", "(", "{", "err", ":", "err", ",", ...
generic error handler
[ "generic", "error", "handler" ]
f906e98efbb4b0963bf5137b34b5e0589ba24e69
https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/util/common.js#L79-L90
train
feedhenry/fh-mbaas-middleware
lib/util/common.js
sortObject
function sortObject(obj) { assert.ok(_.isObject(obj), 'Parameter should be an object! - ' + util.inspect(obj)); assert.ok(!_.isArray(obj), 'Parameter should be an object, got array: ' + util.inspect(obj)); var sortedKeys = _.keys(obj).sort(); var sortedObjs = []; _.each(sortedKeys, function(key) { var v...
javascript
function sortObject(obj) { assert.ok(_.isObject(obj), 'Parameter should be an object! - ' + util.inspect(obj)); assert.ok(!_.isArray(obj), 'Parameter should be an object, got array: ' + util.inspect(obj)); var sortedKeys = _.keys(obj).sort(); var sortedObjs = []; _.each(sortedKeys, function(key) { var v...
[ "function", "sortObject", "(", "obj", ")", "{", "assert", ".", "ok", "(", "_", ".", "isObject", "(", "obj", ")", ",", "'Parameter should be an object! - '", "+", "util", ".", "inspect", "(", "obj", ")", ")", ";", "assert", ".", "ok", "(", "!", "_", "...
converts an object with arbitrary keys into an array sorted by keys
[ "converts", "an", "object", "with", "arbitrary", "keys", "into", "an", "array", "sorted", "by", "keys" ]
f906e98efbb4b0963bf5137b34b5e0589ba24e69
https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/util/common.js#L105-L119
train
Digznav/bilberry
git-tags-info.js
gitTagsInfo
function gitTagsInfo(newTag) { const date = new Date().toISOString(); return Promise.all([ git('git tag -l', stdout => { const allTags = stdout .toString() .trim() .split('\n') .sort((a, b) => { if (Semver.lt(a, b)) return -1; if (Semver.gt(a, b)) retur...
javascript
function gitTagsInfo(newTag) { const date = new Date().toISOString(); return Promise.all([ git('git tag -l', stdout => { const allTags = stdout .toString() .trim() .split('\n') .sort((a, b) => { if (Semver.lt(a, b)) return -1; if (Semver.gt(a, b)) retur...
[ "function", "gitTagsInfo", "(", "newTag", ")", "{", "const", "date", "=", "new", "Date", "(", ")", ".", "toISOString", "(", ")", ";", "return", "Promise", ".", "all", "(", "[", "git", "(", "'git tag -l'", ",", "stdout", "=>", "{", "const", "allTags", ...
Information of existing tags. @param {string} newTag Tag. @return {array} Full info of tags and the first commit.
[ "Information", "of", "existing", "tags", "." ]
ef6db49de6c8b0d2f4f9d3e10e8a8153e39ffcc4
https://github.com/Digznav/bilberry/blob/ef6db49de6c8b0d2f4f9d3e10e8a8153e39ffcc4/git-tags-info.js#L11-L61
train
sendanor/nor-nopg
src/schema/v0026.js
get_property
function get_property(obj, path) { if(!is_object(obj)) { return error('get_property(obj, ...) not object: '+ obj); } if(!is_string(path)) { return error('get_property(..., path) not string: '+ path); } return path.split('.').reduce(get_property_step, obj); }
javascript
function get_property(obj, path) { if(!is_object(obj)) { return error('get_property(obj, ...) not object: '+ obj); } if(!is_string(path)) { return error('get_property(..., path) not string: '+ path); } return path.split('.').reduce(get_property_step, obj); }
[ "function", "get_property", "(", "obj", ",", "path", ")", "{", "if", "(", "!", "is_object", "(", "obj", ")", ")", "{", "return", "error", "(", "'get_property(obj, ...) not object: '", "+", "obj", ")", ";", "}", "if", "(", "!", "is_string", "(", "path", ...
Get value of property from provided object using a path. @param obj {object} The object from where to find the value. @param path {string} The path to the value in object. @returns {mixed} The value from the object at the end of path or `undefined` if any part is missing.
[ "Get", "value", "of", "property", "from", "provided", "object", "using", "a", "path", "." ]
0d99b86c1a1996b5828b56de8de23700df8bbc0c
https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/schema/v0026.js#L104-L108
train
sendanor/nor-nopg
src/schema/v0026.js
get_pg_prop
function get_pg_prop(name) { if(name[0] === '$') { return name.substr(1); } var parts = name.split('.'); if(parts.length === 1) { return "content->>'" + name + "'"; } if(parts.length === 2) { return "content->'" + parts.join("'->>'") + "'"; } return "content->'" + par...
javascript
function get_pg_prop(name) { if(name[0] === '$') { return name.substr(1); } var parts = name.split('.'); if(parts.length === 1) { return "content->>'" + name + "'"; } if(parts.length === 2) { return "content->'" + parts.join("'->>'") + "'"; } return "content->'" + par...
[ "function", "get_pg_prop", "(", "name", ")", "{", "if", "(", "name", "[", "0", "]", "===", "'$'", ")", "{", "return", "name", ".", "substr", "(", "1", ")", ";", "}", "var", "parts", "=", "name", ".", "split", "(", "'.'", ")", ";", "if", "(", ...
Get PostgreSQL style property expression
[ "Get", "PostgreSQL", "style", "property", "expression" ]
0d99b86c1a1996b5828b56de8de23700df8bbc0c
https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/schema/v0026.js#L111-L128
train
sendanor/nor-nopg
src/schema/v0026.js
expression_query
function expression_query(parent, prop, type_name, type_prop, fields) { fields = (fields || [{'query':'*'}]); var map = {}; var query = "SELECT "+fields.map(function(f, i) { var k; if(f.key) { k = 'p__' + i; map[k] = f; return f.query + ' AS ' + k; } else { return f...
javascript
function expression_query(parent, prop, type_name, type_prop, fields) { fields = (fields || [{'query':'*'}]); var map = {}; var query = "SELECT "+fields.map(function(f, i) { var k; if(f.key) { k = 'p__' + i; map[k] = f; return f.query + ' AS ' + k; } else { return f...
[ "function", "expression_query", "(", "parent", ",", "prop", ",", "type_name", ",", "type_prop", ",", "fields", ")", "{", "fields", "=", "(", "fields", "||", "[", "{", "'query'", ":", "'*'", "}", "]", ")", ";", "var", "map", "=", "{", "}", ";", "var...
Execute query for document expressions @param parent {object} The parent document object @param prop {string} The name of the property where results are saved in the parent @param type_name {string} The name of the type of related documents @param type_prop {string} The property name in the related document for the UUI...
[ "Execute", "query", "for", "document", "expressions" ]
0d99b86c1a1996b5828b56de8de23700df8bbc0c
https://github.com/sendanor/nor-nopg/blob/0d99b86c1a1996b5828b56de8de23700df8bbc0c/src/schema/v0026.js#L137-L196
train
sdolard/node-netasqsyslog
lib/syslog.js
function (config) { // ctor var me = this; config = config || {}; this.directory = config.directory; this.output = config.output || process.stdout; this.filesMaxSize = config.filesMaxSize || 1024 * 1024 * 1024 * 4 // 4 Go this.writer = syslogwriter.create({ directory: this.directory, filesMaxSize: t...
javascript
function (config) { // ctor var me = this; config = config || {}; this.directory = config.directory; this.output = config.output || process.stdout; this.filesMaxSize = config.filesMaxSize || 1024 * 1024 * 1024 * 4 // 4 Go this.writer = syslogwriter.create({ directory: this.directory, filesMaxSize: t...
[ "function", "(", "config", ")", "{", "// ctor", "var", "me", "=", "this", ";", "config", "=", "config", "||", "{", "}", ";", "this", ".", "directory", "=", "config", ".", "directory", ";", "this", ".", "output", "=", "config", ".", "output", "||", ...
Read NETASQ syslog and put them in files @public @class @param config.directory: {directory} @param config.output: {Writable Stream} // default to process.stdout @param config.filesMaxSize: {number} as Bytes // default 4GB @param Syslog.config {object} @inherits Syslog
[ "Read", "NETASQ", "syslog", "and", "put", "them", "in", "files" ]
a626249695971f47f0a63d22a2dd496560d66094
https://github.com/sdolard/node-netasqsyslog/blob/a626249695971f47f0a63d22a2dd496560d66094/lib/syslog.js#L195-L214
train
tolokoban/ToloFrameWork
ker/mod/tfw.font-loader.js
fontAPI
function fontAPI( fonts ) { var promises = []; fonts.forEach(function (font) { var pro = document.fonts.load( '64px "' + font + '"' ); promises.push( pro ); }); return Promise.all( promises ); }
javascript
function fontAPI( fonts ) { var promises = []; fonts.forEach(function (font) { var pro = document.fonts.load( '64px "' + font + '"' ); promises.push( pro ); }); return Promise.all( promises ); }
[ "function", "fontAPI", "(", "fonts", ")", "{", "var", "promises", "=", "[", "]", ";", "fonts", ".", "forEach", "(", "function", "(", "font", ")", "{", "var", "pro", "=", "document", ".", "fonts", ".", "load", "(", "'64px \"'", "+", "font", "+", "'\...
Use the modern Font API.
[ "Use", "the", "modern", "Font", "API", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.font-loader.js#L18-L25
train
tolokoban/ToloFrameWork
ker/mod/tfw.font-loader.js
fallback
function fallback( fonts ) { return new Promise(function (resolve, reject) { var divs = []; var body = document.body; fonts.forEach(function (font) { var div = document.createElement( 'div' ); div.className = 'tfw-font-loader'; div.style.fontFamily = font;...
javascript
function fallback( fonts ) { return new Promise(function (resolve, reject) { var divs = []; var body = document.body; fonts.forEach(function (font) { var div = document.createElement( 'div' ); div.className = 'tfw-font-loader'; div.style.fontFamily = font;...
[ "function", "fallback", "(", "fonts", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "var", "divs", "=", "[", "]", ";", "var", "body", "=", "document", ".", "body", ";", "fonts", ".", "forEach", "(", ...
For old browsers, use a not-always-working trick.
[ "For", "old", "browsers", "use", "a", "not", "-", "always", "-", "working", "trick", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/mod/tfw.font-loader.js#L31-L49
train
Crafity/crafity-core
lib/modules/crafity.Exception.js
Exception
function Exception(message, innerException) { if (!message) { throw new Exception("Argument 'message' is required but was '" + (message === null ? "null" : "undefined") + "'"); } if (typeof message !== 'string') { throw new Exception("Argument 'message' must be of type 'string' but was '" + typeof m...
javascript
function Exception(message, innerException) { if (!message) { throw new Exception("Argument 'message' is required but was '" + (message === null ? "null" : "undefined") + "'"); } if (typeof message !== 'string') { throw new Exception("Argument 'message' must be of type 'string' but was '" + typeof m...
[ "function", "Exception", "(", "message", ",", "innerException", ")", "{", "if", "(", "!", "message", ")", "{", "throw", "new", "Exception", "(", "\"Argument 'message' is required but was '\"", "+", "(", "message", "===", "null", "?", "\"null\"", ":", "\"undefine...
A type representing an Exception @param message The message for the exception @param innerException The inner exception @param constructor A constructor of an object to inherit from Exception
[ "A", "type", "representing", "an", "Exception" ]
c0f2271fa6f9c1164450928b2b480f397c9ec20b
https://github.com/Crafity/crafity-core/blob/c0f2271fa6f9c1164450928b2b480f397c9ec20b/lib/modules/crafity.Exception.js#L25-L44
train
LevInteractive/allwrite-middleware-connect
index.js
request
function request(remoteUrl) { return new Promise((resolve, reject) => { const get = adapters[url.parse(remoteUrl).protocol].get; get(remoteUrl, res => { const { statusCode } = res; const contentType = res.headers['content-type']; let rawData = ''; // If it's not a 200 and not a 404 th...
javascript
function request(remoteUrl) { return new Promise((resolve, reject) => { const get = adapters[url.parse(remoteUrl).protocol].get; get(remoteUrl, res => { const { statusCode } = res; const contentType = res.headers['content-type']; let rawData = ''; // If it's not a 200 and not a 404 th...
[ "function", "request", "(", "remoteUrl", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "const", "get", "=", "adapters", "[", "url", ".", "parse", "(", "remoteUrl", ")", ".", "protocol", "]", ".", "get", ";"...
Request Allwrite Server. @param {string} url The url to request. @return {Promise}
[ "Request", "Allwrite", "Server", "." ]
03f85b741a667d81f9954924083499bc060e2a4b
https://github.com/LevInteractive/allwrite-middleware-connect/blob/03f85b741a667d81f9954924083499bc060e2a4b/index.js#L13-L45
train
bdchauvette/nano-blue
lib/nano-blue.js
deepPromisify
function deepPromisify(obj) { return _.transform(obj, function(promisifiedObj, value, key) { if (blacklist.has(key)) { promisifiedObj[key] = value; return; } if (typeof value === 'function') { promisifiedObj[key] = bluebird.promisify(value, obj); } else if (typeof value === 'object'...
javascript
function deepPromisify(obj) { return _.transform(obj, function(promisifiedObj, value, key) { if (blacklist.has(key)) { promisifiedObj[key] = value; return; } if (typeof value === 'function') { promisifiedObj[key] = bluebird.promisify(value, obj); } else if (typeof value === 'object'...
[ "function", "deepPromisify", "(", "obj", ")", "{", "return", "_", ".", "transform", "(", "obj", ",", "function", "(", "promisifiedObj", ",", "value", ",", "key", ")", "{", "if", "(", "blacklist", ".", "has", "(", "key", ")", ")", "{", "promisifiedObj",...
Promisifies the exposed functions on an object Based on a similar function in `qano` @ref https://github.com/jclohmann/qano
[ "Promisifies", "the", "exposed", "functions", "on", "an", "object", "Based", "on", "a", "similar", "function", "in", "qano" ]
9dc0563eeaf40e9cb141c4478afece6d1f81aab5
https://github.com/bdchauvette/nano-blue/blob/9dc0563eeaf40e9cb141c4478afece6d1f81aab5/lib/nano-blue.js#L15-L30
train
nrn/mid
t/mid.js
rep
function rep (num, str) { return function (arr, done) { arr.forEach(function (i, idx) { var s = '' if (typeof i === 'string') s = i if (idx === 0) return else if (idx/num === Math.floor(idx/num)) arr[idx] = s + str }) done() } }
javascript
function rep (num, str) { return function (arr, done) { arr.forEach(function (i, idx) { var s = '' if (typeof i === 'string') s = i if (idx === 0) return else if (idx/num === Math.floor(idx/num)) arr[idx] = s + str }) done() } }
[ "function", "rep", "(", "num", ",", "str", ")", "{", "return", "function", "(", "arr", ",", "done", ")", "{", "arr", ".", "forEach", "(", "function", "(", "i", ",", "idx", ")", "{", "var", "s", "=", "''", "if", "(", "typeof", "i", "===", "'stri...
Work for tests
[ "Work", "for", "tests" ]
d7a5555565292777947a24fe053b690b101b361b
https://github.com/nrn/mid/blob/d7a5555565292777947a24fe053b690b101b361b/t/mid.js#L52-L62
train
ashleydavis/routey
fileMgr.js
function (dirPath) { var dirContents = fs.readdirSync(dirPath); return dirContents.filter(function (subDirName) { // Filter out non-directories. var subDirPath = path.join(dirPath, subDirName); return fs.lstatSync(subDirPath).isDirectory(); }); }
javascript
function (dirPath) { var dirContents = fs.readdirSync(dirPath); return dirContents.filter(function (subDirName) { // Filter out non-directories. var subDirPath = path.join(dirPath, subDirName); return fs.lstatSync(subDirPath).isDirectory(); }); }
[ "function", "(", "dirPath", ")", "{", "var", "dirContents", "=", "fs", ".", "readdirSync", "(", "dirPath", ")", ";", "return", "dirContents", ".", "filter", "(", "function", "(", "subDirName", ")", "{", "// Filter out non-directories.", "var", "subDirPath", "=...
Get a list of directories from the specified path.
[ "Get", "a", "list", "of", "directories", "from", "the", "specified", "path", "." ]
dd5e797603f6f0b584d6712165e9b73c7d8efc78
https://github.com/ashleydavis/routey/blob/dd5e797603f6f0b584d6712165e9b73c7d8efc78/fileMgr.js#L13-L21
train
jmjuanes/utily
lib/task.js
function(name) { //Check if the queue exists if(typeof tasks[name] !== 'object'){ return; } //Check if queue is paused if(tasks[name].paused === true) { //Set task queue running false tasks[name].running = false; } else { //Set queue running tasks[name].running = true; //Check the ...
javascript
function(name) { //Check if the queue exists if(typeof tasks[name] !== 'object'){ return; } //Check if queue is paused if(tasks[name].paused === true) { //Set task queue running false tasks[name].running = false; } else { //Set queue running tasks[name].running = true; //Check the ...
[ "function", "(", "name", ")", "{", "//Check if the queue exists", "if", "(", "typeof", "tasks", "[", "name", "]", "!==", "'object'", ")", "{", "return", ";", "}", "//Check if queue is paused", "if", "(", "tasks", "[", "name", "]", ".", "paused", "===", "tr...
Run a task by name
[ "Run", "a", "task", "by", "name" ]
f620180aa21fc8ece0f7b2c268cda335e9e28831
https://github.com/jmjuanes/utily/blob/f620180aa21fc8ece0f7b2c268cda335e9e28831/lib/task.js#L5-L44
train
copress/copress-component-oauth2
lib/errors/oauth2error.js
OAuth2Error
function OAuth2Error(message, code, uri, status) { Error.call(this); this.message = message; this.code = code || 'server_error'; this.uri = uri; this.status = status || 500; }
javascript
function OAuth2Error(message, code, uri, status) { Error.call(this); this.message = message; this.code = code || 'server_error'; this.uri = uri; this.status = status || 500; }
[ "function", "OAuth2Error", "(", "message", ",", "code", ",", "uri", ",", "status", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "this", ".", "message", "=", "message", ";", "this", ".", "code", "=", "code", "||", "'server_error'", ";", "thi...
`OAuth2Error` error. @api public
[ "OAuth2Error", "error", "." ]
4819f379a0d42753bfd51e237c5c3aaddee37544
https://github.com/copress/copress-component-oauth2/blob/4819f379a0d42753bfd51e237c5c3aaddee37544/lib/errors/oauth2error.js#L6-L12
train
asavoy/grunt-requirejs-auto-bundles
lib/factorise.js
factoriseBundles
function factoriseBundles(modules, duplicates, loaderConfig, maxBundles) { // Remember all dependencies, along with related information. // dependencyId -> { mains: [...], size: 123 } var allDependencies = {}; // Each module that is duplicated, is a module shared by two or more mains. // So we gro...
javascript
function factoriseBundles(modules, duplicates, loaderConfig, maxBundles) { // Remember all dependencies, along with related information. // dependencyId -> { mains: [...], size: 123 } var allDependencies = {}; // Each module that is duplicated, is a module shared by two or more mains. // So we gro...
[ "function", "factoriseBundles", "(", "modules", ",", "duplicates", ",", "loaderConfig", ",", "maxBundles", ")", "{", "// Remember all dependencies, along with related information.", "// dependencyId -> { mains: [...], size: 123 }", "var", "allDependencies", "=", "{", "}", ";", ...
Calculate bundles from list of main modules and duplicates. Modules should be same as modules: used in requirejs config options. Duplicates looks like: { "jquery/jquery.js": ["pages/page1.js", "pages/page2.js"] } The output should be: { "bundles: { "bundle1": ["jquery"], "bundle2": ["lodash"] }, "modules: [{ "name":...
[ "Calculate", "bundles", "from", "list", "of", "main", "modules", "and", "duplicates", "." ]
c0f587c9720943dd32098203d2c71ab1387f1700
https://github.com/asavoy/grunt-requirejs-auto-bundles/blob/c0f587c9720943dd32098203d2c71ab1387f1700/lib/factorise.js#L39-L118
train
MostlyJS/mostly-feathers-mongoose
src/plugins/mongoose-cache.js
function (collectionKey, queryKey) { return new Promise(function (ok) { redisClient.multi().get(collectionKey).get(queryKey).exec(function (err, results) { if (err) { err.message = util.format('mongoose cache error %s', queryKey); debug(err); ok([null, null]); // ignore error, instea...
javascript
function (collectionKey, queryKey) { return new Promise(function (ok) { redisClient.multi().get(collectionKey).get(queryKey).exec(function (err, results) { if (err) { err.message = util.format('mongoose cache error %s', queryKey); debug(err); ok([null, null]); // ignore error, instea...
[ "function", "(", "collectionKey", ",", "queryKey", ")", "{", "return", "new", "Promise", "(", "function", "(", "ok", ")", "{", "redisClient", ".", "multi", "(", ")", ".", "get", "(", "collectionKey", ")", ".", "get", "(", "queryKey", ")", ".", "exec", ...
get query result = require(redis cache and check lastWrite
[ "get", "query", "result", "=", "require", "(", "redis", "cache", "and", "check", "lastWrite" ]
d20e150e054c784cc7db7c2487399e4f4eb730de
https://github.com/MostlyJS/mostly-feathers-mongoose/blob/d20e150e054c784cc7db7c2487399e4f4eb730de/src/plugins/mongoose-cache.js#L21-L43
train
alex-wdmg/jquery-helper
build/helper.js
smoothScroll
function smoothScroll() { if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false); window.onmousewheel = document.onmousewheel = wheel; var hb = { sTop: 0, sDelta: 0 }; function wheel(event) { var distance = jQuery.browser.webkit ? 60 : 120; if (event.wheelDelta) delt...
javascript
function smoothScroll() { if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false); window.onmousewheel = document.onmousewheel = wheel; var hb = { sTop: 0, sDelta: 0 }; function wheel(event) { var distance = jQuery.browser.webkit ? 60 : 120; if (event.wheelDelta) delt...
[ "function", "smoothScroll", "(", ")", "{", "if", "(", "window", ".", "addEventListener", ")", "window", ".", "addEventListener", "(", "'DOMMouseScroll'", ",", "wheel", ",", "false", ")", ";", "window", ".", "onmousewheel", "=", "document", ".", "onmousewheel",...
Smooth scroll plugin
[ "Smooth", "scroll", "plugin" ]
39f8ac6c6b72fbf51f7aa5026d8a0d2c8361be57
https://github.com/alex-wdmg/jquery-helper/blob/39f8ac6c6b72fbf51f7aa5026d8a0d2c8361be57/build/helper.js#L717-L757
train
vimsucks/ezini
dist/ini.js
stringifySync
function stringifySync(obj) { var output = ""; var firstOccur = true; Object.keys(obj).forEach(function (key) { if (typeof obj[key] === "string") { output += key + "=" + obj[key]; output += os.EOL; } else { if (firstOccur) { firstOccur = false; } else { output += os.EOL; } output += "...
javascript
function stringifySync(obj) { var output = ""; var firstOccur = true; Object.keys(obj).forEach(function (key) { if (typeof obj[key] === "string") { output += key + "=" + obj[key]; output += os.EOL; } else { if (firstOccur) { firstOccur = false; } else { output += os.EOL; } output += "...
[ "function", "stringifySync", "(", "obj", ")", "{", "var", "output", "=", "\"\"", ";", "var", "firstOccur", "=", "true", ";", "Object", ".", "keys", "(", "obj", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "if", "(", "typeof", "obj", ...
Stringify an object to an ini-format string @param {Object} obj Object to be stringify @returns {string} INI-format string which is stringified from given object
[ "Stringify", "an", "object", "to", "an", "ini", "-", "format", "string" ]
3bd04b8cd0694213dcfa3075b56536bf725daefe
https://github.com/vimsucks/ezini/blob/3bd04b8cd0694213dcfa3075b56536bf725daefe/dist/ini.js#L72-L107
train
vimsucks/ezini
dist/ini.js
stringify
function stringify(obj, callback) { process.nextTick(function () { var str = stringifySync(obj); callback(str); }); }
javascript
function stringify(obj, callback) { process.nextTick(function () { var str = stringifySync(obj); callback(str); }); }
[ "function", "stringify", "(", "obj", ",", "callback", ")", "{", "process", ".", "nextTick", "(", "function", "(", ")", "{", "var", "str", "=", "stringifySync", "(", "obj", ")", ";", "callback", "(", "str", ")", ";", "}", ")", ";", "}" ]
Async wrapper of function stringifySync @param {Object} obj Object to be stringify @param callback Callback after parsing complete, should have one parameter: str(stringified from given object)
[ "Async", "wrapper", "of", "function", "stringifySync" ]
3bd04b8cd0694213dcfa3075b56536bf725daefe
https://github.com/vimsucks/ezini/blob/3bd04b8cd0694213dcfa3075b56536bf725daefe/dist/ini.js#L115-L120
train
warmsea/WarmseaJS
dist/warmsea.js
function(behavior) { return function(obj, iteratee, context) { var result = {}; iteratee = _.iteratee(iteratee, context); _.each(obj, function(value, index) { var key = iteratee(value, index, obj); behavior(result, value, key); }); return result; }; }
javascript
function(behavior) { return function(obj, iteratee, context) { var result = {}; iteratee = _.iteratee(iteratee, context); _.each(obj, function(value, index) { var key = iteratee(value, index, obj); behavior(result, value, key); }); return result; }; }
[ "function", "(", "behavior", ")", "{", "return", "function", "(", "obj", ",", "iteratee", ",", "context", ")", "{", "var", "result", "=", "{", "}", ";", "iteratee", "=", "_", ".", "iteratee", "(", "iteratee", ",", "context", ")", ";", "_", ".", "ea...
An internal function used for aggregate "group by" operations.
[ "An", "internal", "function", "used", "for", "aggregate", "group", "by", "operations", "." ]
58c32c75b26647bbec39dc401a78b0fdb5896c8d
https://github.com/warmsea/WarmseaJS/blob/58c32c75b26647bbec39dc401a78b0fdb5896c8d/dist/warmsea.js#L370-L380
train
mysticatea/warun
bin/events.js
emitSIGINT
function emitSIGINT() { if (rl) { rl.close() rl = null } if (ipcListener) { process.removeListener("message", ipcListener) ipcListener = null } emitter.emit("SIGINT") }
javascript
function emitSIGINT() { if (rl) { rl.close() rl = null } if (ipcListener) { process.removeListener("message", ipcListener) ipcListener = null } emitter.emit("SIGINT") }
[ "function", "emitSIGINT", "(", ")", "{", "if", "(", "rl", ")", "{", "rl", ".", "close", "(", ")", "rl", "=", "null", "}", "if", "(", "ipcListener", ")", "{", "process", ".", "removeListener", "(", "\"message\"", ",", "ipcListener", ")", "ipcListener", ...
Emit SIGINT event. @returns {void}
[ "Emit", "SIGINT", "event", "." ]
9dc36fa1aeddf6540f0effd6726a056d9a3287f1
https://github.com/mysticatea/warun/blob/9dc36fa1aeddf6540f0effd6726a056d9a3287f1/bin/events.js#L19-L30
train
tolokoban/ToloFrameWork
ker/tfw3.js
function(className) { var cls = _classes[className]; if (!cls) { var k, name, def = window["TFW::" + className]; if (!def) { throw new Error( "[TFW3] This class has not been defined: \"" + className + "\"!\n" ...
javascript
function(className) { var cls = _classes[className]; if (!cls) { var k, name, def = window["TFW::" + className]; if (!def) { throw new Error( "[TFW3] This class has not been defined: \"" + className + "\"!\n" ...
[ "function", "(", "className", ")", "{", "var", "cls", "=", "_classes", "[", "className", "]", ";", "if", "(", "!", "cls", ")", "{", "var", "k", ",", "name", ",", "def", "=", "window", "[", "\"TFW::\"", "+", "className", "]", ";", "if", "(", "!", ...
Load class definition.
[ "Load", "class", "definition", "." ]
730845a833a9660ebfdb60ad027ebaab5ac871b6
https://github.com/tolokoban/ToloFrameWork/blob/730845a833a9660ebfdb60ad027ebaab5ac871b6/ker/tfw3.js#L261-L341
train
hypergroup/hyper-json-immutable-parse
index.js
parse
function parse(base, key, value) { var type = typeof value; // resolve local JSON pointers if (key === 'href' && type === 'string') return formatHref(base, value); // TODO resolve "/" paths if (!value || type !== 'object') return value; var obj = copy(value); if (key === '' || obj.href) seal(base || o...
javascript
function parse(base, key, value) { var type = typeof value; // resolve local JSON pointers if (key === 'href' && type === 'string') return formatHref(base, value); // TODO resolve "/" paths if (!value || type !== 'object') return value; var obj = copy(value); if (key === '' || obj.href) seal(base || o...
[ "function", "parse", "(", "base", ",", "key", ",", "value", ")", "{", "var", "type", "=", "typeof", "value", ";", "// resolve local JSON pointers", "if", "(", "key", "===", "'href'", "&&", "type", "===", "'string'", ")", "return", "formatHref", "(", "base"...
Parse a key value pair @param {String} href @param {String} key @param {Any} value
[ "Parse", "a", "key", "value", "pair" ]
b77467c70bfe1c5b49f749a915fe585d7bac256d
https://github.com/hypergroup/hyper-json-immutable-parse/blob/b77467c70bfe1c5b49f749a915fe585d7bac256d/index.js#L26-L40
train
zipscene/polytoken
lib/geometry.js
getPointLineSegmentState
function getPointLineSegmentState([ x, y ], [ [ beginX, beginY ], [ endX, endY ] ]) { if (!isPointInLine([ x, y ], [ [ beginX, beginY ], [ endX, endY ] ])) { return OUTSIDE; } if (beginX === endX) { if (roundToFiveSignificantDigits((y - beginY) * (y - endY)) < 0) { return INSIDE; } else if (roundToFiveSigni...
javascript
function getPointLineSegmentState([ x, y ], [ [ beginX, beginY ], [ endX, endY ] ]) { if (!isPointInLine([ x, y ], [ [ beginX, beginY ], [ endX, endY ] ])) { return OUTSIDE; } if (beginX === endX) { if (roundToFiveSignificantDigits((y - beginY) * (y - endY)) < 0) { return INSIDE; } else if (roundToFiveSigni...
[ "function", "getPointLineSegmentState", "(", "[", "x", ",", "y", "]", ",", "[", "[", "beginX", ",", "beginY", "]", ",", "[", "endX", ",", "endY", "]", "]", ")", "{", "if", "(", "!", "isPointInLine", "(", "[", "x", ",", "y", "]", ",", "[", "[", ...
Get the state of a point in relationship to a line segment @method getPointLineSegmentState @param {Number[]} [ x, y ] - coordinates of the point @param {Number[][]} [ [ beginX, beginY ], [ endX, endY ] ] - coordinates of begin and end points of the line segment @return {String} - return the state of the point. Can on...
[ "Get", "the", "state", "of", "a", "point", "in", "relationship", "to", "a", "line", "segment" ]
e2cab71d0c3cdec6ff702b7bb434b585ba13efe0
https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L45-L75
train
zipscene/polytoken
lib/geometry.js
getLineIntersect
function getLineIntersect([ line1Begin, line1End ], [ line2Begin, line2End ]) { let [ x1Begin, y1Begin ] = line1Begin; let [ x1End, y1End ] = line1End; let [ x2Begin, y2Begin ] = line2Begin; let [ x2End, y2End ] = line2End; if ((x1Begin === x1End && y1Begin === y1End) || (x2Begin === x2End && y2Begin === y2End)) {...
javascript
function getLineIntersect([ line1Begin, line1End ], [ line2Begin, line2End ]) { let [ x1Begin, y1Begin ] = line1Begin; let [ x1End, y1End ] = line1End; let [ x2Begin, y2Begin ] = line2Begin; let [ x2End, y2End ] = line2End; if ((x1Begin === x1End && y1Begin === y1End) || (x2Begin === x2End && y2Begin === y2End)) {...
[ "function", "getLineIntersect", "(", "[", "line1Begin", ",", "line1End", "]", ",", "[", "line2Begin", ",", "line2End", "]", ")", "{", "let", "[", "x1Begin", ",", "y1Begin", "]", "=", "line1Begin", ";", "let", "[", "x1End", ",", "y1End", "]", "=", "line...
Get the intersect point of two lines @method getLineIntersect @param {Number[]} line1Begin - coordianates of first point in line1 @param {Number[]} line1End - coordianates of second point of line1 @param {Number[]} line2Begin - coordianates of first point in line2 @param {Number[]} line2End - coordianates of second p...
[ "Get", "the", "intersect", "point", "of", "two", "lines" ]
e2cab71d0c3cdec6ff702b7bb434b585ba13efe0
https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L115-L168
train
zipscene/polytoken
lib/geometry.js
getLineSegmentsIntersectState
function getLineSegmentsIntersectState([ line1Begin, line1End ], [ line2Begin, line2End ]) { let [ x1Begin, y1Begin ] = line1Begin; let [ x1End, y1End ] = line1End; let [ x2Begin, y2Begin ] = line2Begin; let [ x2End, y2End ] = line2End; if ((x1Begin === x1End && y1Begin === y1End) || (x2Begin === x2End && y2Begin ...
javascript
function getLineSegmentsIntersectState([ line1Begin, line1End ], [ line2Begin, line2End ]) { let [ x1Begin, y1Begin ] = line1Begin; let [ x1End, y1End ] = line1End; let [ x2Begin, y2Begin ] = line2Begin; let [ x2End, y2End ] = line2End; if ((x1Begin === x1End && y1Begin === y1End) || (x2Begin === x2End && y2Begin ...
[ "function", "getLineSegmentsIntersectState", "(", "[", "line1Begin", ",", "line1End", "]", ",", "[", "line2Begin", ",", "line2End", "]", ")", "{", "let", "[", "x1Begin", ",", "y1Begin", "]", "=", "line1Begin", ";", "let", "[", "x1End", ",", "y1End", "]", ...
Get the state of line segment line2 relative to line segment line1. Available states are INTERSECT, UNINTERSECT, INCLUDED, OVERLAP and TANGENT @getLineSegmentsIntersectState @param {Number[][]} - coordinates of begin and end of line segment line1 @param {Number[][]} - coordinates of begin and end of line segment line2...
[ "Get", "the", "state", "of", "line", "segment", "line2", "relative", "to", "line", "segment", "line1", ".", "Available", "states", "are", "INTERSECT", "UNINTERSECT", "INCLUDED", "OVERLAP", "and", "TANGENT" ]
e2cab71d0c3cdec6ff702b7bb434b585ba13efe0
https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L181-L239
train
zipscene/polytoken
lib/geometry.js
getRandPointInLineSegment
function getRandPointInLineSegment([ [ beginX, beginY ], [ endX, endY ] ]) { let smallX = beginX <= endX ? beginX : endX; let largeX = beginX >= endX ? beginX : endX; let smallY = beginY <= endY ? beginY : endY; let largeY = beginY >= endY ? beginY : endY; if (beginY === endY) return [ roundToFiveSignificantDigits...
javascript
function getRandPointInLineSegment([ [ beginX, beginY ], [ endX, endY ] ]) { let smallX = beginX <= endX ? beginX : endX; let largeX = beginX >= endX ? beginX : endX; let smallY = beginY <= endY ? beginY : endY; let largeY = beginY >= endY ? beginY : endY; if (beginY === endY) return [ roundToFiveSignificantDigits...
[ "function", "getRandPointInLineSegment", "(", "[", "[", "beginX", ",", "beginY", "]", ",", "[", "endX", ",", "endY", "]", "]", ")", "{", "let", "smallX", "=", "beginX", "<=", "endX", "?", "beginX", ":", "endX", ";", "let", "largeX", "=", "beginX", ">...
Get a random point in given line segment @method getRandPointInLineSegment @param {Number[][]} - coordinates of begin and end points of the line segment @return {Number[]} - coordinates of generated random point
[ "Get", "a", "random", "point", "in", "given", "line", "segment" ]
e2cab71d0c3cdec6ff702b7bb434b585ba13efe0
https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L249-L261
train
zipscene/polytoken
lib/geometry.js
getLinearRingsIntersectState
function getLinearRingsIntersectState(linearRing1, linearRing2) { let isLinearRingsTouching = false; for (let i = 0; i < linearRing1.length - 1; i++) { for (let j = 0; j < linearRing2.length - 1; j++) { let state = getLineSegmentsIntersectState( [ linearRing2[j], linearRing2[j + 1] ], [ linearRing1[i], linea...
javascript
function getLinearRingsIntersectState(linearRing1, linearRing2) { let isLinearRingsTouching = false; for (let i = 0; i < linearRing1.length - 1; i++) { for (let j = 0; j < linearRing2.length - 1; j++) { let state = getLineSegmentsIntersectState( [ linearRing2[j], linearRing2[j + 1] ], [ linearRing1[i], linea...
[ "function", "getLinearRingsIntersectState", "(", "linearRing1", ",", "linearRing2", ")", "{", "let", "isLinearRingsTouching", "=", "false", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "linearRing1", ".", "length", "-", "1", ";", "i", "++", ")", ...
Get the state of lienarRing2 in relationship to linearRing1 @method getLinearRingsIntersectState @param {Number[][]} - coordinates of linearRing1 @param {Number\[][]} - coordinates of linearRing2 @return {String} - return the state. It can only be one of: 'intersect', 'outside' and 'inside'
[ "Get", "the", "state", "of", "lienarRing2", "in", "relationship", "to", "linearRing1" ]
e2cab71d0c3cdec6ff702b7bb434b585ba13efe0
https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L273-L327
train
zipscene/polytoken
lib/geometry.js
getRayLineSegmentIntersectState
function getRayLineSegmentIntersectState([ rayOrigin, rayPoint ], [ lineBegin, lineEnd ]) { // Find unit deviations for ray and point let dRay = vectorSubtract(rayPoint, rayOrigin); let dLine = vectorSubtract(lineEnd, lineBegin); if (vectorCross(dRay, dLine) === 0) { if (vectorCross(vectorSubtract(lineBegin, ray...
javascript
function getRayLineSegmentIntersectState([ rayOrigin, rayPoint ], [ lineBegin, lineEnd ]) { // Find unit deviations for ray and point let dRay = vectorSubtract(rayPoint, rayOrigin); let dLine = vectorSubtract(lineEnd, lineBegin); if (vectorCross(dRay, dLine) === 0) { if (vectorCross(vectorSubtract(lineBegin, ray...
[ "function", "getRayLineSegmentIntersectState", "(", "[", "rayOrigin", ",", "rayPoint", "]", ",", "[", "lineBegin", ",", "lineEnd", "]", ")", "{", "// Find unit deviations for ray and point", "let", "dRay", "=", "vectorSubtract", "(", "rayPoint", ",", "rayOrigin", ")...
get the state of ray in relationship to a line segment @method getRayLineSegmentIntersectState @param {Number[][]} [ point, point2 ] - `point` is the begin point of the ray. `point2` is a point in ray @param {Number[][]} [ lineBegin, lineEnd ] - coordinates of begin and end point of line segment @return {String} - ret...
[ "get", "the", "state", "of", "ray", "in", "relationship", "to", "a", "line", "segment" ]
e2cab71d0c3cdec6ff702b7bb434b585ba13efe0
https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L338-L370
train
zipscene/polytoken
lib/geometry.js
pointLinearRingState
function pointLinearRingState(point, linearRing) { let { topLeftVertex, width, height } = getBoundingBox(linearRing); let [ minX, maxY ] = topLeftVertex; let maxX = minX + width; let minY = maxY - height; let [ x, y ] = point; if (x < minX || x > maxX || y < minY || y > maxY) return OUTSIDE; for (let i = 0; i < ...
javascript
function pointLinearRingState(point, linearRing) { let { topLeftVertex, width, height } = getBoundingBox(linearRing); let [ minX, maxY ] = topLeftVertex; let maxX = minX + width; let minY = maxY - height; let [ x, y ] = point; if (x < minX || x > maxX || y < minY || y > maxY) return OUTSIDE; for (let i = 0; i < ...
[ "function", "pointLinearRingState", "(", "point", ",", "linearRing", ")", "{", "let", "{", "topLeftVertex", ",", "width", ",", "height", "}", "=", "getBoundingBox", "(", "linearRing", ")", ";", "let", "[", "minX", ",", "maxY", "]", "=", "topLeftVertex", ";...
Get the state of point in relationship to a linear ring @method pointLinearRingState @param {Number[]} point - coordinates of the point @param {Number[][]} - linearRing - coordinates of vertexes of the linear ring @return {String} - return the state. Can only be one of: 'outside', 'inside' and 'tangent'
[ "Get", "the", "state", "of", "point", "in", "relationship", "to", "a", "linear", "ring" ]
e2cab71d0c3cdec6ff702b7bb434b585ba13efe0
https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L382-L420
train
zipscene/polytoken
lib/geometry.js
getBoundingBox
function getBoundingBox(linearRing) { if (!Array.isArray(linearRing)) { throw new XError(XError.INVALID_ARGUMENT, 'linearRing must be an array'); } let leftX = Infinity; let rightX = -Infinity; let bottomY = Infinity; let topY = -Infinity; for (let point of linearRing) { if (!Array.isArray(point) || point.l...
javascript
function getBoundingBox(linearRing) { if (!Array.isArray(linearRing)) { throw new XError(XError.INVALID_ARGUMENT, 'linearRing must be an array'); } let leftX = Infinity; let rightX = -Infinity; let bottomY = Infinity; let topY = -Infinity; for (let point of linearRing) { if (!Array.isArray(point) || point.l...
[ "function", "getBoundingBox", "(", "linearRing", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "linearRing", ")", ")", "{", "throw", "new", "XError", "(", "XError", ".", "INVALID_ARGUMENT", ",", "'linearRing must be an array'", ")", ";", "}", "let"...
Get the bounding box of given linear ring @method getBoundingBox @param {Number[][]} linearRing - coordinates of vertexes of the linear ring @return {Object} - return an object like this: { topLeftVertex: [ 2, 3 ], width: 1, height: 2 }, where `topLeftVertex` is the top left vertex of the bounding box
[ "Get", "the", "bounding", "box", "of", "given", "linear", "ring" ]
e2cab71d0c3cdec6ff702b7bb434b585ba13efe0
https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L431-L455
train
zipscene/polytoken
lib/geometry.js
squareLinearRingIntersectState
function squareLinearRingIntersectState(linearRing, topLeftVertex, squareSize) { let [ topLeftX, topLeftY ] = topLeftVertex; let topRightVertex = [ topLeftX + squareSize, topLeftY ]; let bottomRightVertex = [ topLeftX + squareSize, topLeftY - squareSize ]; let bottomLeftVertex = [ topLeftX, topLeftY - squareSize ];...
javascript
function squareLinearRingIntersectState(linearRing, topLeftVertex, squareSize) { let [ topLeftX, topLeftY ] = topLeftVertex; let topRightVertex = [ topLeftX + squareSize, topLeftY ]; let bottomRightVertex = [ topLeftX + squareSize, topLeftY - squareSize ]; let bottomLeftVertex = [ topLeftX, topLeftY - squareSize ];...
[ "function", "squareLinearRingIntersectState", "(", "linearRing", ",", "topLeftVertex", ",", "squareSize", ")", "{", "let", "[", "topLeftX", ",", "topLeftY", "]", "=", "topLeftVertex", ";", "let", "topRightVertex", "=", "[", "topLeftX", "+", "squareSize", ",", "t...
Get the state of a square linear ring in relationship to another linear ring @method squareLinearRingIntersectState @param {Numner[][]} linearRing - coordinates of the linear ring @param {Number[]} topLeftVertex - coordinates of the top left vertx of the square @param {Number} squareSize - size of edge of the square @...
[ "Get", "the", "state", "of", "a", "square", "linear", "ring", "in", "relationship", "to", "another", "linear", "ring" ]
e2cab71d0c3cdec6ff702b7bb434b585ba13efe0
https://github.com/zipscene/polytoken/blob/e2cab71d0c3cdec6ff702b7bb434b585ba13efe0/lib/geometry.js#L468-L475
train
defeo/was_framework
demo/static/update_user.js
ajax_return
function ajax_return(data, status, xhr) { // If the update was successfull if (data.ok) { // Forget old value this.removeData('old-value'); // Add a green V to the right this.parent().next() .off('click') .html('V') .css('color', 'LimeGreen') .attr('title', 'Update OK'); // If we modif...
javascript
function ajax_return(data, status, xhr) { // If the update was successfull if (data.ok) { // Forget old value this.removeData('old-value'); // Add a green V to the right this.parent().next() .off('click') .html('V') .css('color', 'LimeGreen') .attr('title', 'Update OK'); // If we modif...
[ "function", "ajax_return", "(", "data", ",", "status", ",", "xhr", ")", "{", "// If the update was successfull", "if", "(", "data", ".", "ok", ")", "{", "// Forget old value", "this", ".", "removeData", "(", "'old-value'", ")", ";", "// Add a green V to the right"...
This function is called when the AJAX request returns
[ "This", "function", "is", "called", "when", "the", "AJAX", "request", "returns" ]
ab52bbbf5943e9062fe6ea82f1fea637a11d727a
https://github.com/defeo/was_framework/blob/ab52bbbf5943e9062fe6ea82f1fea637a11d727a/demo/static/update_user.js#L63-L101
train
feedhenry/fh-mbaas-middleware
lib/models.js
init
function init(config, cb) { connection = mongoose.createConnection(config.mongoUrl); var firstCallback = true; connection.on('error', function(err) { log.logger.error('Mongo error: ' + util.inspect(err)); if (firstCallback) { firstCallback = false; return cb(err); } else ...
javascript
function init(config, cb) { connection = mongoose.createConnection(config.mongoUrl); var firstCallback = true; connection.on('error', function(err) { log.logger.error('Mongo error: ' + util.inspect(err)); if (firstCallback) { firstCallback = false; return cb(err); } else ...
[ "function", "init", "(", "config", ",", "cb", ")", "{", "connection", "=", "mongoose", ".", "createConnection", "(", "config", ".", "mongoUrl", ")", ";", "var", "firstCallback", "=", "true", ";", "connection", ".", "on", "(", "'error'", ",", "function", ...
init our Mongo database
[ "init", "our", "Mongo", "database" ]
f906e98efbb4b0963bf5137b34b5e0589ba24e69
https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/models.js#L9-L47
train
feedhenry/fh-mbaas-middleware
lib/models.js
disconnect
function disconnect(cb) { if (connection) { log.logger.debug('Mongoose disconnected'); connection.close(cb); } else { cb(); } }
javascript
function disconnect(cb) { if (connection) { log.logger.debug('Mongoose disconnected'); connection.close(cb); } else { cb(); } }
[ "function", "disconnect", "(", "cb", ")", "{", "if", "(", "connection", ")", "{", "log", ".", "logger", ".", "debug", "(", "'Mongoose disconnected'", ")", ";", "connection", ".", "close", "(", "cb", ")", ";", "}", "else", "{", "cb", "(", ")", ";", ...
Close all db handles, etc
[ "Close", "all", "db", "handles", "etc" ]
f906e98efbb4b0963bf5137b34b5e0589ba24e69
https://github.com/feedhenry/fh-mbaas-middleware/blob/f906e98efbb4b0963bf5137b34b5e0589ba24e69/lib/models.js#L50-L57
train
andrewscwei/requiem
src/dom/removeFromChildRegistry.js
removeFromChildRegistry
function removeFromChildRegistry(childRegistry, child) { assertType(childRegistry, 'object', false, 'Invalid child registry specified'); assertType(child, [Node, Array, 'string'], false, 'Invalid child(ren) or name specified'); if (typeof child === 'string') { let targets = child.split('.'); let currentT...
javascript
function removeFromChildRegistry(childRegistry, child) { assertType(childRegistry, 'object', false, 'Invalid child registry specified'); assertType(child, [Node, Array, 'string'], false, 'Invalid child(ren) or name specified'); if (typeof child === 'string') { let targets = child.split('.'); let currentT...
[ "function", "removeFromChildRegistry", "(", "childRegistry", ",", "child", ")", "{", "assertType", "(", "childRegistry", ",", "'object'", ",", "false", ",", "'Invalid child registry specified'", ")", ";", "assertType", "(", "child", ",", "[", "Node", ",", "Array",...
Removes a child or an array of children with the same name from the specified child registry. @param {Object} childRegistry - The child registry. @param {Node|Array|string} child - Either one child element or an array of multiple child elements with the same name or the name in dot notation. @alias module:requiem~dom...
[ "Removes", "a", "child", "or", "an", "array", "of", "children", "with", "the", "same", "name", "from", "the", "specified", "child", "registry", "." ]
c4182bfffc9841c6de5718f689ad3c2060511777
https://github.com/andrewscwei/requiem/blob/c4182bfffc9841c6de5718f689ad3c2060511777/src/dom/removeFromChildRegistry.js#L19-L71
train
matter-in-motion/mm-http
http.js
function(path, contract) { if (!contract) { contract = path; path = '/'; } if (contract.handle) { this.root.use(path, (req, res, next) => { contract.handle(req, res, next) }); } else { this.root.use(path, contract); } return this; }
javascript
function(path, contract) { if (!contract) { contract = path; path = '/'; } if (contract.handle) { this.root.use(path, (req, res, next) => { contract.handle(req, res, next) }); } else { this.root.use(path, contract); } return this; }
[ "function", "(", "path", ",", "contract", ")", "{", "if", "(", "!", "contract", ")", "{", "contract", "=", "path", ";", "path", "=", "'/'", ";", "}", "if", "(", "contract", ".", "handle", ")", "{", "this", ".", "root", ".", "use", "(", "path", ...
use function will be added as the app use method
[ "use", "function", "will", "be", "added", "as", "the", "app", "use", "method" ]
0947bf7f6a5fa794a0d13d97d7162feaae895291
https://github.com/matter-in-motion/mm-http/blob/0947bf7f6a5fa794a0d13d97d7162feaae895291/http.js#L19-L33
train
Becklyn/becklyn-gulp
tasks/js_bundle.js
logJsHintWarning
function logJsHintWarning (errors) { totalIssues += errors.length; var sourceFile = pathHelper.makeRelative(this.resourcePath); gulpUtil.log(gulpUtil.colors.yellow("jshint warning") + " in " + sourceFile); for (var i = 0, l = errors.length; i < l; i++) { var error = errors[i]; gul...
javascript
function logJsHintWarning (errors) { totalIssues += errors.length; var sourceFile = pathHelper.makeRelative(this.resourcePath); gulpUtil.log(gulpUtil.colors.yellow("jshint warning") + " in " + sourceFile); for (var i = 0, l = errors.length; i < l; i++) { var error = errors[i]; gul...
[ "function", "logJsHintWarning", "(", "errors", ")", "{", "totalIssues", "+=", "errors", ".", "length", ";", "var", "sourceFile", "=", "pathHelper", ".", "makeRelative", "(", "this", ".", "resourcePath", ")", ";", "gulpUtil", ".", "log", "(", "gulpUtil", ".",...
Logs jsHint warnings to the console @param {Array.<{ raw: string, code: string, evidence: string, line: number, character: number, scope: string, reason: string }>} errors
[ "Logs", "jsHint", "warnings", "to", "the", "console" ]
1c633378d561f07101f9db19ccd153617b8e0252
https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/js_bundle.js#L39-L68
train
Becklyn/becklyn-gulp
tasks/js_bundle.js
reportTotalIssueCount
function reportTotalIssueCount () { var outputColor = gulpUtil.colors.green; if (totalIssues > 0) { outputColor = gulpUtil.colors.red; } gulpUtil.log(gulpUtil.colors.yellow('»»'), 'Total JS issues:', outputColor(totalIssues)); // Reset the issue count so we don't increment it every tim...
javascript
function reportTotalIssueCount () { var outputColor = gulpUtil.colors.green; if (totalIssues > 0) { outputColor = gulpUtil.colors.red; } gulpUtil.log(gulpUtil.colors.yellow('»»'), 'Total JS issues:', outputColor(totalIssues)); // Reset the issue count so we don't increment it every tim...
[ "function", "reportTotalIssueCount", "(", ")", "{", "var", "outputColor", "=", "gulpUtil", ".", "colors", ".", "green", ";", "if", "(", "totalIssues", ">", "0", ")", "{", "outputColor", "=", "gulpUtil", ".", "colors", ".", "red", ";", "}", "gulpUtil", "....
Reports the total amount of JavaScript issues detected by JsHint
[ "Reports", "the", "total", "amount", "of", "JavaScript", "issues", "detected", "by", "JsHint" ]
1c633378d561f07101f9db19ccd153617b8e0252
https://github.com/Becklyn/becklyn-gulp/blob/1c633378d561f07101f9db19ccd153617b8e0252/tasks/js_bundle.js#L74-L86
train
JustZisGuy/wildling
src/token.js
getTokenParameters
function getTokenParameters(index) { let stringLength; let indexWithOffset; indexWithOffset = index; for (stringLength = startLength; stringLength <= endLength; stringLength += 1) { const offsetCount = variants.length ** stringLength; if (indexWithOffset < offsetCount) { break; ...
javascript
function getTokenParameters(index) { let stringLength; let indexWithOffset; indexWithOffset = index; for (stringLength = startLength; stringLength <= endLength; stringLength += 1) { const offsetCount = variants.length ** stringLength; if (indexWithOffset < offsetCount) { break; ...
[ "function", "getTokenParameters", "(", "index", ")", "{", "let", "stringLength", ";", "let", "indexWithOffset", ";", "indexWithOffset", "=", "index", ";", "for", "(", "stringLength", "=", "startLength", ";", "stringLength", "<=", "endLength", ";", "stringLength", ...
calculate length of target combination and index for that particular length
[ "calculate", "length", "of", "target", "combination", "and", "index", "for", "that", "particular", "length" ]
4745a99e523213cb3bfde5759c8390b79fa6ab88
https://github.com/JustZisGuy/wildling/blob/4745a99e523213cb3bfde5759c8390b79fa6ab88/src/token.js#L16-L34
train
byron-dupreez/aws-stream-consumer-core
esm-cache.js
clearCache
function clearCache() { let deletedCount = 0; const iter = eventSourceMappingKeysByFunctionAndStream.entries(); let next = iter.next(); while (!next.done) { const [k, key] = next.value; const deleted = eventSourceMappingPromisesByKey.delete(key); eventSourceMappingKeysByFunctionAndStream.delete(k)...
javascript
function clearCache() { let deletedCount = 0; const iter = eventSourceMappingKeysByFunctionAndStream.entries(); let next = iter.next(); while (!next.done) { const [k, key] = next.value; const deleted = eventSourceMappingPromisesByKey.delete(key); eventSourceMappingKeysByFunctionAndStream.delete(k)...
[ "function", "clearCache", "(", ")", "{", "let", "deletedCount", "=", "0", ";", "const", "iter", "=", "eventSourceMappingKeysByFunctionAndStream", ".", "entries", "(", ")", ";", "let", "next", "=", "iter", ".", "next", "(", ")", ";", "while", "(", "!", "n...
Clears the event source mapping key and promise caches. @return {number} the number of promises removed from the cache
[ "Clears", "the", "event", "source", "mapping", "key", "and", "promise", "caches", "." ]
9b256084297f80d373bcf483aaf68a9da176b3d7
https://github.com/byron-dupreez/aws-stream-consumer-core/blob/9b256084297f80d373bcf483aaf68a9da176b3d7/esm-cache.js#L115-L134
train
jsekamane/Cree
client/cree-client.js
loadPage
function loadPage(url) { $("#container").load(url+" #container > *", function(response, status, xhr){ $('html,body').scrollTop(0); // Scroll to the top when loading new page. if(status == "error"){ $("#container").prepend('<p class="alert alert-danger" role="alert"><strong>'+msgError+'</strong> '+xhr.status...
javascript
function loadPage(url) { $("#container").load(url+" #container > *", function(response, status, xhr){ $('html,body').scrollTop(0); // Scroll to the top when loading new page. if(status == "error"){ $("#container").prepend('<p class="alert alert-danger" role="alert"><strong>'+msgError+'</strong> '+xhr.status...
[ "function", "loadPage", "(", "url", ")", "{", "$", "(", "\"#container\"", ")", ".", "load", "(", "url", "+", "\" #container > *\"", ",", "function", "(", "response", ",", "status", ",", "xhr", ")", "{", "$", "(", "'html,body'", ")", ".", "scrollTop", "...
Using AJAX, load the url that was received from the server through a 'load' message.
[ "Using", "AJAX", "load", "the", "url", "that", "was", "received", "from", "the", "server", "through", "a", "load", "message", "." ]
ccff87d4bb5b95c8d96c44731033f29a82df871e
https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/client/cree-client.js#L51-L61
train
jsekamane/Cree
client/cree-client.js
next
function next() { var data = new Object(); // Submit content of all forms -- except those with class 'ignore-form' -- before going to next page. $('#container form:not(.ignore-form)').each(function(index) { //console.log("Form no. "+index + " with the ID #" + $(this).attr('id') ); //console.log($( this )...
javascript
function next() { var data = new Object(); // Submit content of all forms -- except those with class 'ignore-form' -- before going to next page. $('#container form:not(.ignore-form)').each(function(index) { //console.log("Form no. "+index + " with the ID #" + $(this).attr('id') ); //console.log($( this )...
[ "function", "next", "(", ")", "{", "var", "data", "=", "new", "Object", "(", ")", ";", "// Submit content of all forms -- except those with class 'ignore-form' -- before going to next page.", "$", "(", "'#container form:not(.ignore-form)'", ")", ".", "each", "(", "function"...
Continue to next stage
[ "Continue", "to", "next", "stage" ]
ccff87d4bb5b95c8d96c44731033f29a82df871e
https://github.com/jsekamane/Cree/blob/ccff87d4bb5b95c8d96c44731033f29a82df871e/client/cree-client.js#L70-L84
train
commonform-archive/commonform-serve-projects
index.js
requireAuthorization
function requireAuthorization(handler) { return function(request, response, store, parameters) { var handlerArguments = arguments var publisher = parameters.publisher var authorization = request.headers.authorization if (authorization) { var parsed = parseAuthorization(authorization) if (p...
javascript
function requireAuthorization(handler) { return function(request, response, store, parameters) { var handlerArguments = arguments var publisher = parameters.publisher var authorization = request.headers.authorization if (authorization) { var parsed = parseAuthorization(authorization) if (p...
[ "function", "requireAuthorization", "(", "handler", ")", "{", "return", "function", "(", "request", ",", "response", ",", "store", ",", "parameters", ")", "{", "var", "handlerArguments", "=", "arguments", "var", "publisher", "=", "parameters", ".", "publisher", ...
Wrap a request handler function to check authoriztion.
[ "Wrap", "a", "request", "handler", "function", "to", "check", "authoriztion", "." ]
f4a6b40ba7f19a579b52ffbce88eeeaa11685bd5
https://github.com/commonform-archive/commonform-serve-projects/blob/f4a6b40ba7f19a579b52ffbce88eeeaa11685bd5/index.js#L233-L252
train
gethuman/pancakes-angular
lib/transformers/ng.apiclient.transformer.js
transform
function transform(flapjack, options) { var moduleName = options.moduleName; var filePath = options.filePath; var appName = this.getAppName(filePath, options.appName); var resource = this.pancakes.cook(moduleName, { flapjack: flapjack }); var templateModel = this.getTemplateModel(options.prefix, res...
javascript
function transform(flapjack, options) { var moduleName = options.moduleName; var filePath = options.filePath; var appName = this.getAppName(filePath, options.appName); var resource = this.pancakes.cook(moduleName, { flapjack: flapjack }); var templateModel = this.getTemplateModel(options.prefix, res...
[ "function", "transform", "(", "flapjack", ",", "options", ")", "{", "var", "moduleName", "=", "options", ".", "moduleName", ";", "var", "filePath", "=", "options", ".", "filePath", ";", "var", "appName", "=", "this", ".", "getAppName", "(", "filePath", ","...
Do the transformation @param flapjack @param options @returns {*}
[ "Do", "the", "transformation" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.apiclient.transformer.js#L16-L23
train
gethuman/pancakes-angular
lib/transformers/ng.apiclient.transformer.js
getTemplateModel
function getTemplateModel(prefix, resource, appName) { var methods = {}; // if no api or browser apiclient, then return null since we will skip if (!resource.api || resource.adapters.browser !== 'apiclient') { return null; } // loop through API routes and create method objects for the temp...
javascript
function getTemplateModel(prefix, resource, appName) { var methods = {}; // if no api or browser apiclient, then return null since we will skip if (!resource.api || resource.adapters.browser !== 'apiclient') { return null; } // loop through API routes and create method objects for the temp...
[ "function", "getTemplateModel", "(", "prefix", ",", "resource", ",", "appName", ")", "{", "var", "methods", "=", "{", "}", ";", "// if no api or browser apiclient, then return null since we will skip", "if", "(", "!", "resource", ".", "api", "||", "resource", ".", ...
Get the template model for an API Client @param prefix @param resource @param appName @returns {*}
[ "Get", "the", "template", "model", "for", "an", "API", "Client" ]
9589b7ba09619843e271293088005c62ed23f355
https://github.com/gethuman/pancakes-angular/blob/9589b7ba09619843e271293088005c62ed23f355/lib/transformers/ng.apiclient.transformer.js#L32-L57
train