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
cheminfo-js/netcdfjs
src/data.js
nonRecord
function nonRecord(buffer, variable) { // variable type const type = types.str2num(variable.type); // size of the data var size = variable.size / types.num2bytes(type); // iterates over the data var data = new Array(size); for (var i = 0; i < size; i++) { data[i] = types.readType(buffer, type, 1); ...
javascript
function nonRecord(buffer, variable) { // variable type const type = types.str2num(variable.type); // size of the data var size = variable.size / types.num2bytes(type); // iterates over the data var data = new Array(size); for (var i = 0; i < size; i++) { data[i] = types.readType(buffer, type, 1); ...
[ "function", "nonRecord", "(", "buffer", ",", "variable", ")", "{", "// variable type", "const", "type", "=", "types", ".", "str2num", "(", "variable", ".", "type", ")", ";", "// size of the data", "var", "size", "=", "variable", ".", "size", "/", "types", ...
const STREAMING = 4294967295; Read data for the given non-record variable @ignore @param {IOBuffer} buffer - Buffer for the file data @param {object} variable - Variable metadata @return {Array} - Data of the element
[ "const", "STREAMING", "=", "4294967295", ";", "Read", "data", "for", "the", "given", "non", "-", "record", "variable" ]
ac528ad0fa6b78de001c3fe86eebb2728d1d27e4
https://github.com/cheminfo-js/netcdfjs/blob/ac528ad0fa6b78de001c3fe86eebb2728d1d27e4/src/data.js#L14-L28
train
cheminfo-js/netcdfjs
src/data.js
record
function record(buffer, variable, recordDimension) { // variable type const type = types.str2num(variable.type); const width = variable.size ? variable.size / types.num2bytes(type) : 1; // size of the data // TODO streaming data var size = recordDimension.length; // iterates over the data var data = n...
javascript
function record(buffer, variable, recordDimension) { // variable type const type = types.str2num(variable.type); const width = variable.size ? variable.size / types.num2bytes(type) : 1; // size of the data // TODO streaming data var size = recordDimension.length; // iterates over the data var data = n...
[ "function", "record", "(", "buffer", ",", "variable", ",", "recordDimension", ")", "{", "// variable type", "const", "type", "=", "types", ".", "str2num", "(", "variable", ".", "type", ")", ";", "const", "width", "=", "variable", ".", "size", "?", "variabl...
Read data for the given record variable @ignore @param {IOBuffer} buffer - Buffer for the file data @param {object} variable - Variable metadata @param {object} recordDimension - Record dimension metadata @return {Array} - Data of the element
[ "Read", "data", "for", "the", "given", "record", "variable" ]
ac528ad0fa6b78de001c3fe86eebb2728d1d27e4
https://github.com/cheminfo-js/netcdfjs/blob/ac528ad0fa6b78de001c3fe86eebb2728d1d27e4/src/data.js#L38-L58
train
cheminfo-js/netcdfjs
src/header.js
header
function header(buffer, version) { // Length of record dimension // sum of the varSize's of all the record variables. var header = { recordDimension: { length: buffer.readUint32() } }; // Version header.version = version; // List of dimensions var dimList = dimensionsList(buffer); header.recordDimensi...
javascript
function header(buffer, version) { // Length of record dimension // sum of the varSize's of all the record variables. var header = { recordDimension: { length: buffer.readUint32() } }; // Version header.version = version; // List of dimensions var dimList = dimensionsList(buffer); header.recordDimensi...
[ "function", "header", "(", "buffer", ",", "version", ")", "{", "// Length of record dimension", "// sum of the varSize's of all the record variables.", "var", "header", "=", "{", "recordDimension", ":", "{", "length", ":", "buffer", ".", "readUint32", "(", ")", "}", ...
Read the header of the file @ignore @param {IOBuffer} buffer - Buffer for the file data @param {number} version - Version of the file @return {object} - Object with the fields: * `recordDimension`: Number with the length of record dimension * `dimensions`: List of dimensions * `globalAttributes`: List of global attribu...
[ "Read", "the", "header", "of", "the", "file" ]
ac528ad0fa6b78de001c3fe86eebb2728d1d27e4
https://github.com/cheminfo-js/netcdfjs/blob/ac528ad0fa6b78de001c3fe86eebb2728d1d27e4/src/header.js#L23-L46
train
cheminfo-js/netcdfjs
src/header.js
dimensionsList
function dimensionsList(buffer) { var recordId, recordName; const dimList = buffer.readUint32(); if (dimList === ZERO) { utils.notNetcdf((buffer.readUint32() !== ZERO), 'wrong empty tag for list of dimensions'); return []; } else { utils.notNetcdf((dimList !== NC_DIMENSION), 'wrong tag for list of d...
javascript
function dimensionsList(buffer) { var recordId, recordName; const dimList = buffer.readUint32(); if (dimList === ZERO) { utils.notNetcdf((buffer.readUint32() !== ZERO), 'wrong empty tag for list of dimensions'); return []; } else { utils.notNetcdf((dimList !== NC_DIMENSION), 'wrong tag for list of d...
[ "function", "dimensionsList", "(", "buffer", ")", "{", "var", "recordId", ",", "recordName", ";", "const", "dimList", "=", "buffer", ".", "readUint32", "(", ")", ";", "if", "(", "dimList", "===", "ZERO", ")", "{", "utils", ".", "notNetcdf", "(", "(", "...
List of dimensions @ignore @param {IOBuffer} buffer - Buffer for the file data @return {object} - Ojbect containing the following properties: * `dimensions` that is an array of dimension object: * `name`: String with the name of the dimension * `size`: Number with the size of the dimension dimensions: dimensions * `rec...
[ "List", "of", "dimensions" ]
ac528ad0fa6b78de001c3fe86eebb2728d1d27e4
https://github.com/cheminfo-js/netcdfjs/blob/ac528ad0fa6b78de001c3fe86eebb2728d1d27e4/src/header.js#L61-L95
train
cheminfo-js/netcdfjs
src/header.js
attributesList
function attributesList(buffer) { const gAttList = buffer.readUint32(); if (gAttList === ZERO) { utils.notNetcdf((buffer.readUint32() !== ZERO), 'wrong empty tag for list of attributes'); return []; } else { utils.notNetcdf((gAttList !== NC_ATTRIBUTE), 'wrong tag for list of attributes'); // Leng...
javascript
function attributesList(buffer) { const gAttList = buffer.readUint32(); if (gAttList === ZERO) { utils.notNetcdf((buffer.readUint32() !== ZERO), 'wrong empty tag for list of attributes'); return []; } else { utils.notNetcdf((gAttList !== NC_ATTRIBUTE), 'wrong tag for list of attributes'); // Leng...
[ "function", "attributesList", "(", "buffer", ")", "{", "const", "gAttList", "=", "buffer", ".", "readUint32", "(", ")", ";", "if", "(", "gAttList", "===", "ZERO", ")", "{", "utils", ".", "notNetcdf", "(", "(", "buffer", ".", "readUint32", "(", ")", "!=...
List of attributes @ignore @param {IOBuffer} buffer - Buffer for the file data @return {Array<object>} - List of attributes with: * `name`: String with the name of the attribute * `type`: String with the type of the attribute * `value`: A number or string with the value of the attribute
[ "List", "of", "attributes" ]
ac528ad0fa6b78de001c3fe86eebb2728d1d27e4
https://github.com/cheminfo-js/netcdfjs/blob/ac528ad0fa6b78de001c3fe86eebb2728d1d27e4/src/header.js#L106-L140
train
cheminfo-js/netcdfjs
src/header.js
variablesList
function variablesList(buffer, recordId, version) { const varList = buffer.readUint32(); var recordStep = 0; if (varList === ZERO) { utils.notNetcdf((buffer.readUint32() !== ZERO), 'wrong empty tag for list of variables'); return []; } else { utils.notNetcdf((varList !== NC_VARIABLE), 'wrong tag for...
javascript
function variablesList(buffer, recordId, version) { const varList = buffer.readUint32(); var recordStep = 0; if (varList === ZERO) { utils.notNetcdf((buffer.readUint32() !== ZERO), 'wrong empty tag for list of variables'); return []; } else { utils.notNetcdf((varList !== NC_VARIABLE), 'wrong tag for...
[ "function", "variablesList", "(", "buffer", ",", "recordId", ",", "version", ")", "{", "const", "varList", "=", "buffer", ".", "readUint32", "(", ")", ";", "var", "recordStep", "=", "0", ";", "if", "(", "varList", "===", "ZERO", ")", "{", "utils", ".",...
List of variables @ignore @param {IOBuffer} buffer - Buffer for the file data @param {number} recordId - Id of the unlimited dimension (also called record dimension) This value may be undefined if there is no unlimited dimension @param {number} version - Version of the file @return {object} - Number of recordStep and l...
[ "List", "of", "variables" ]
ac528ad0fa6b78de001c3fe86eebb2728d1d27e4
https://github.com/cheminfo-js/netcdfjs/blob/ac528ad0fa6b78de001c3fe86eebb2728d1d27e4/src/header.js#L159-L225
train
cheminfo-js/netcdfjs
src/types.js
num2str
function num2str(type) { switch (Number(type)) { case types.BYTE: return 'byte'; case types.CHAR: return 'char'; case types.SHORT: return 'short'; case types.INT: return 'int'; case types.FLOAT: return 'float'; case types.DOUBLE: return 'double'; /* is...
javascript
function num2str(type) { switch (Number(type)) { case types.BYTE: return 'byte'; case types.CHAR: return 'char'; case types.SHORT: return 'short'; case types.INT: return 'int'; case types.FLOAT: return 'float'; case types.DOUBLE: return 'double'; /* is...
[ "function", "num2str", "(", "type", ")", "{", "switch", "(", "Number", "(", "type", ")", ")", "{", "case", "types", ".", "BYTE", ":", "return", "'byte'", ";", "case", "types", ".", "CHAR", ":", "return", "'char'", ";", "case", "types", ".", "SHORT", ...
Parse a number into their respective type @ignore @param {number} type - integer that represents the type @return {string} - parsed value of the type
[ "Parse", "a", "number", "into", "their", "respective", "type" ]
ac528ad0fa6b78de001c3fe86eebb2728d1d27e4
https://github.com/cheminfo-js/netcdfjs/blob/ac528ad0fa6b78de001c3fe86eebb2728d1d27e4/src/types.js#L20-L38
train
cheminfo-js/netcdfjs
src/types.js
str2num
function str2num(type) { switch (String(type)) { case 'byte': return types.BYTE; case 'char': return types.CHAR; case 'short': return types.SHORT; case 'int': return types.INT; case 'float': return types.FLOAT; case 'double': return types.DOUBLE; /* is...
javascript
function str2num(type) { switch (String(type)) { case 'byte': return types.BYTE; case 'char': return types.CHAR; case 'short': return types.SHORT; case 'int': return types.INT; case 'float': return types.FLOAT; case 'double': return types.DOUBLE; /* is...
[ "function", "str2num", "(", "type", ")", "{", "switch", "(", "String", "(", "type", ")", ")", "{", "case", "'byte'", ":", "return", "types", ".", "BYTE", ";", "case", "'char'", ":", "return", "types", ".", "CHAR", ";", "case", "'short'", ":", "return...
Reverse search of num2str @ignore @param {string} type - string that represents the type @return {number} - parsed value of the type
[ "Reverse", "search", "of", "num2str" ]
ac528ad0fa6b78de001c3fe86eebb2728d1d27e4
https://github.com/cheminfo-js/netcdfjs/blob/ac528ad0fa6b78de001c3fe86eebb2728d1d27e4/src/types.js#L72-L90
train
cheminfo-js/netcdfjs
src/types.js
readNumber
function readNumber(size, bufferReader) { if (size !== 1) { var numbers = new Array(size); for (var i = 0; i < size; i++) { numbers[i] = bufferReader(); } return numbers; } else { return bufferReader(); } }
javascript
function readNumber(size, bufferReader) { if (size !== 1) { var numbers = new Array(size); for (var i = 0; i < size; i++) { numbers[i] = bufferReader(); } return numbers; } else { return bufferReader(); } }
[ "function", "readNumber", "(", "size", ",", "bufferReader", ")", "{", "if", "(", "size", "!==", "1", ")", "{", "var", "numbers", "=", "new", "Array", "(", "size", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++"...
Auxiliary function to read numeric data @ignore @param {number} size - Size of the element to read @param {function} bufferReader - Function to read next value @return {Array<number>|number}
[ "Auxiliary", "function", "to", "read", "numeric", "data" ]
ac528ad0fa6b78de001c3fe86eebb2728d1d27e4
https://github.com/cheminfo-js/netcdfjs/blob/ac528ad0fa6b78de001c3fe86eebb2728d1d27e4/src/types.js#L99-L109
train
cheminfo-js/netcdfjs
src/types.js
readType
function readType(buffer, type, size) { switch (type) { case types.BYTE: return buffer.readBytes(size); case types.CHAR: return trimNull(buffer.readChars(size)); case types.SHORT: return readNumber(size, buffer.readInt16.bind(buffer)); case types.INT: return readNumber(size, bu...
javascript
function readType(buffer, type, size) { switch (type) { case types.BYTE: return buffer.readBytes(size); case types.CHAR: return trimNull(buffer.readChars(size)); case types.SHORT: return readNumber(size, buffer.readInt16.bind(buffer)); case types.INT: return readNumber(size, bu...
[ "function", "readType", "(", "buffer", ",", "type", ",", "size", ")", "{", "switch", "(", "type", ")", "{", "case", "types", ".", "BYTE", ":", "return", "buffer", ".", "readBytes", "(", "size", ")", ";", "case", "types", ".", "CHAR", ":", "return", ...
Given a type and a size reads the next element @ignore @param {IOBuffer} buffer - Buffer for the file data @param {number} type - Type of the data to read @param {number} size - Size of the element to read @return {string|Array<number>|number}
[ "Given", "a", "type", "and", "a", "size", "reads", "the", "next", "element" ]
ac528ad0fa6b78de001c3fe86eebb2728d1d27e4
https://github.com/cheminfo-js/netcdfjs/blob/ac528ad0fa6b78de001c3fe86eebb2728d1d27e4/src/types.js#L119-L138
train
cheminfo-js/netcdfjs
src/types.js
trimNull
function trimNull(value) { if (value.charCodeAt(value.length - 1) === 0) { return value.substring(0, value.length - 1); } return value; }
javascript
function trimNull(value) { if (value.charCodeAt(value.length - 1) === 0) { return value.substring(0, value.length - 1); } return value; }
[ "function", "trimNull", "(", "value", ")", "{", "if", "(", "value", ".", "charCodeAt", "(", "value", ".", "length", "-", "1", ")", "===", "0", ")", "{", "return", "value", ".", "substring", "(", "0", ",", "value", ".", "length", "-", "1", ")", ";...
Removes null terminate value @ignore @param {string} value - String to trim @return {string} - Trimmed string
[ "Removes", "null", "terminate", "value" ]
ac528ad0fa6b78de001c3fe86eebb2728d1d27e4
https://github.com/cheminfo-js/netcdfjs/blob/ac528ad0fa6b78de001c3fe86eebb2728d1d27e4/src/types.js#L146-L151
train
cheminfo-js/netcdfjs
src/utils.js
readName
function readName(buffer) { // Read name var nameLength = buffer.readUint32(); var name = buffer.readChars(nameLength); // validate name // TODO // Apply padding padding(buffer); return name; }
javascript
function readName(buffer) { // Read name var nameLength = buffer.readUint32(); var name = buffer.readChars(nameLength); // validate name // TODO // Apply padding padding(buffer); return name; }
[ "function", "readName", "(", "buffer", ")", "{", "// Read name", "var", "nameLength", "=", "buffer", ".", "readUint32", "(", ")", ";", "var", "name", "=", "buffer", ".", "readChars", "(", "nameLength", ")", ";", "// validate name", "// TODO", "// Apply padding...
Reads the name @ignore @param {IOBuffer} buffer - Buffer for the file data @return {string} - Name
[ "Reads", "the", "name" ]
ac528ad0fa6b78de001c3fe86eebb2728d1d27e4
https://github.com/cheminfo-js/netcdfjs/blob/ac528ad0fa6b78de001c3fe86eebb2728d1d27e4/src/utils.js#L33-L44
train
demimonde/exif2css
build/index.js
exif2css
function exif2css(orientation) { const s = `${orientation}` const transforms = transformsMap[s] const transform = expandTransform(transforms) const transformOrigin = transformOriginMap[s] const allTransforms = expandTransforms(transforms) const allTransformStrings = expandTransformStrings(transforms) co...
javascript
function exif2css(orientation) { const s = `${orientation}` const transforms = transformsMap[s] const transform = expandTransform(transforms) const transformOrigin = transformOriginMap[s] const allTransforms = expandTransforms(transforms) const allTransformStrings = expandTransformStrings(transforms) co...
[ "function", "exif2css", "(", "orientation", ")", "{", "const", "s", "=", "`", "${", "orientation", "}", "`", "const", "transforms", "=", "transformsMap", "[", "s", "]", "const", "transform", "=", "expandTransform", "(", "transforms", ")", "const", "transform...
Takes the input EXIF orientation and returns the CSS rules needed to display the image correctly in the browser. @param {(number|string)} orientation The EXIF orientation. @returns {Exif2CssReturn} An object with `transform`, `transform-origin` (not shown in JSDoc because of hyphen), `transforms` and `transformStrings`...
[ "Takes", "the", "input", "EXIF", "orientation", "and", "returns", "the", "CSS", "rules", "needed", "to", "display", "the", "image", "correctly", "in", "the", "browser", "." ]
917f33f4a6853d48c62aceb8da0691c9db480d94
https://github.com/demimonde/exif2css/blob/917f33f4a6853d48c62aceb8da0691c9db480d94/build/index.js#L91-L114
train
seglo/connect-prism
lib/services/mock-filename-generator.js
defaultMockFilename
function defaultMockFilename(config, req) { var reqData = prismUtils.filterUrl(config, req.url); // include request body in hash if (config.hashFullRequest(config, req)) { reqData = req.body + reqData; } var shasum = crypto.createHash('sha1'); shasum.update(reqData); return shasum.dig...
javascript
function defaultMockFilename(config, req) { var reqData = prismUtils.filterUrl(config, req.url); // include request body in hash if (config.hashFullRequest(config, req)) { reqData = req.body + reqData; } var shasum = crypto.createHash('sha1'); shasum.update(reqData); return shasum.dig...
[ "function", "defaultMockFilename", "(", "config", ",", "req", ")", "{", "var", "reqData", "=", "prismUtils", ".", "filterUrl", "(", "config", ",", "req", ".", "url", ")", ";", "// include request body in hash", "if", "(", "config", ".", "hashFullRequest", "(",...
This is the default implementation to generate a filename for the recorded responses. It will create a sha1 hash of the request URL and optionally, the body of the request if the `hashFullRequest` config is set to true. This function can be overidden in config with the responseFilenameCallback setting.
[ "This", "is", "the", "default", "implementation", "to", "generate", "a", "filename", "for", "the", "recorded", "responses", ".", "It", "will", "create", "a", "sha1", "hash", "of", "the", "request", "URL", "and", "optionally", "the", "body", "of", "the", "r...
bfe2e3fae556fc6ab64bdde401e27a550a628217
https://github.com/seglo/connect-prism/blob/bfe2e3fae556fc6ab64bdde401e27a550a628217/lib/services/mock-filename-generator.js#L17-L27
train
brisket/brisket
lib/controlling/isExternalLinkTarget.js
isExternalLinkTarget
function isExternalLinkTarget(target) { return target === "_blank" || (target === "_parent" && window.parent !== window.self) || (target === "_top" && window.top !== window.self) || (typeof target === "string" && target !== "_self"); }
javascript
function isExternalLinkTarget(target) { return target === "_blank" || (target === "_parent" && window.parent !== window.self) || (target === "_top" && window.top !== window.self) || (typeof target === "string" && target !== "_self"); }
[ "function", "isExternalLinkTarget", "(", "target", ")", "{", "return", "target", "===", "\"_blank\"", "||", "(", "target", "===", "\"_parent\"", "&&", "window", ".", "parent", "!==", "window", ".", "self", ")", "||", "(", "target", "===", "\"_top\"", "&&", ...
Determines whether the target points to a different window, and thus outside of the current instance of the application. @param {String} target The value of the link's target attribute. @returns {Boolean} true when the target is: - "_blank", - "_parent", and the parent window isn't the current window, - "_top", and the...
[ "Determines", "whether", "the", "target", "points", "to", "a", "different", "window", "and", "thus", "outside", "of", "the", "current", "instance", "of", "the", "application", "." ]
8504d6d3957fa67bcdf60cf387b92fa1ffb45fd3
https://github.com/brisket/brisket/blob/8504d6d3957fa67bcdf60cf387b92fa1ffb45fd3/lib/controlling/isExternalLinkTarget.js#L13-L18
train
brisket/brisket
lib/metatags/Metatags.js
function(escape) { var pairs = this.pairs; var type = this.type; var names = Object.keys(pairs); var html = ""; var escapeHtml = escape || IDENTITY; var name; var computedType; for (var i = 0, len = names.length; i < len; i++) { name = names[i...
javascript
function(escape) { var pairs = this.pairs; var type = this.type; var names = Object.keys(pairs); var html = ""; var escapeHtml = escape || IDENTITY; var name; var computedType; for (var i = 0, len = names.length; i < len; i++) { name = names[i...
[ "function", "(", "escape", ")", "{", "var", "pairs", "=", "this", ".", "pairs", ";", "var", "type", "=", "this", ".", "type", ";", "var", "names", "=", "Object", ".", "keys", "(", "pairs", ")", ";", "var", "html", "=", "\"\"", ";", "var", "escape...
wawjr3d pass in escape strategy so client doesn't need to bundle escape-html
[ "wawjr3d", "pass", "in", "escape", "strategy", "so", "client", "doesn", "t", "need", "to", "bundle", "escape", "-", "html" ]
8504d6d3957fa67bcdf60cf387b92fa1ffb45fd3
https://github.com/brisket/brisket/blob/8504d6d3957fa67bcdf60cf387b92fa1ffb45fd3/lib/metatags/Metatags.js#L58-L75
train
componitable/format-number
index.js
addIntegerSeparators
function addIntegerSeparators(x, separator) { x += ''; if (!separator) return x; var rgx = /(\d+)(\d{3})/; while (rgx.test(x)) { x = x.replace(rgx, '$1' + separator + '$2'); } return x; }
javascript
function addIntegerSeparators(x, separator) { x += ''; if (!separator) return x; var rgx = /(\d+)(\d{3})/; while (rgx.test(x)) { x = x.replace(rgx, '$1' + separator + '$2'); } return x; }
[ "function", "addIntegerSeparators", "(", "x", ",", "separator", ")", "{", "x", "+=", "''", ";", "if", "(", "!", "separator", ")", "return", "x", ";", "var", "rgx", "=", "/", "(\\d+)(\\d{3})", "/", ";", "while", "(", "rgx", ".", "test", "(", "x", ")...
where x is already the integer part of the number
[ "where", "x", "is", "already", "the", "integer", "part", "of", "the", "number" ]
5a2a755359f1926a79bd1b4014fe8d43a85adb12
https://github.com/componitable/format-number/blob/5a2a755359f1926a79bd1b4014fe8d43a85adb12/index.js#L176-L184
train
componitable/format-number
index.js
addDecimalSeparators
function addDecimalSeparators(x, separator) { x += ''; if (!separator) return x; var rgx = /(\d{3})(\d+)/; while (rgx.test(x)) { x = x.replace(rgx, '$1' + separator + '$2'); } return x; }
javascript
function addDecimalSeparators(x, separator) { x += ''; if (!separator) return x; var rgx = /(\d{3})(\d+)/; while (rgx.test(x)) { x = x.replace(rgx, '$1' + separator + '$2'); } return x; }
[ "function", "addDecimalSeparators", "(", "x", ",", "separator", ")", "{", "x", "+=", "''", ";", "if", "(", "!", "separator", ")", "return", "x", ";", "var", "rgx", "=", "/", "(\\d{3})(\\d+)", "/", ";", "while", "(", "rgx", ".", "test", "(", "x", ")...
where x is already the decimal part of the number
[ "where", "x", "is", "already", "the", "decimal", "part", "of", "the", "number" ]
5a2a755359f1926a79bd1b4014fe8d43a85adb12
https://github.com/componitable/format-number/blob/5a2a755359f1926a79bd1b4014fe8d43a85adb12/index.js#L187-L195
train
componitable/format-number
index.js
padLeft
function padLeft(x, padding) { x = x + ''; var buf = []; while (buf.length + x.length < padding) { buf.push('0'); } return buf.join('') + x; }
javascript
function padLeft(x, padding) { x = x + ''; var buf = []; while (buf.length + x.length < padding) { buf.push('0'); } return buf.join('') + x; }
[ "function", "padLeft", "(", "x", ",", "padding", ")", "{", "x", "=", "x", "+", "''", ";", "var", "buf", "=", "[", "]", ";", "while", "(", "buf", ".", "length", "+", "x", ".", "length", "<", "padding", ")", "{", "buf", ".", "push", "(", "'0'",...
where x is the integer part of the number
[ "where", "x", "is", "the", "integer", "part", "of", "the", "number" ]
5a2a755359f1926a79bd1b4014fe8d43a85adb12
https://github.com/componitable/format-number/blob/5a2a755359f1926a79bd1b4014fe8d43a85adb12/index.js#L198-L205
train
componitable/format-number
index.js
padRight
function padRight(x, padding) { if (x) { x += ''; } else { x = ''; } var buf = []; while (buf.length + x.length < padding) { buf.push('0'); } return x + buf.join(''); }
javascript
function padRight(x, padding) { if (x) { x += ''; } else { x = ''; } var buf = []; while (buf.length + x.length < padding) { buf.push('0'); } return x + buf.join(''); }
[ "function", "padRight", "(", "x", ",", "padding", ")", "{", "if", "(", "x", ")", "{", "x", "+=", "''", ";", "}", "else", "{", "x", "=", "''", ";", "}", "var", "buf", "=", "[", "]", ";", "while", "(", "buf", ".", "length", "+", "x", ".", "...
where x is the decimals part of the number
[ "where", "x", "is", "the", "decimals", "part", "of", "the", "number" ]
5a2a755359f1926a79bd1b4014fe8d43a85adb12
https://github.com/componitable/format-number/blob/5a2a755359f1926a79bd1b4014fe8d43a85adb12/index.js#L208-L219
train
ngx-kit/ngx-kit
packages/cli/lib/schematize/process-module.js
schematize
function schematize(content, name) { return content .replace(new RegExp(`${name}`, 'g'), '<%= dasherize(name) %>', 'g') .replace(new RegExp(`${classify(name)}`, 'g'), '<%= classify(name) %>', 'g') .replace(new RegExp(`${camelize(name)}`, 'g'), '<%= camelize(name) %>', 'g') .replace(new RegExp(...
javascript
function schematize(content, name) { return content .replace(new RegExp(`${name}`, 'g'), '<%= dasherize(name) %>', 'g') .replace(new RegExp(`${classify(name)}`, 'g'), '<%= classify(name) %>', 'g') .replace(new RegExp(`${camelize(name)}`, 'g'), '<%= camelize(name) %>', 'g') .replace(new RegExp(...
[ "function", "schematize", "(", "content", ",", "name", ")", "{", "return", "content", ".", "replace", "(", "new", "RegExp", "(", "`", "${", "name", "}", "`", ",", "'g'", ")", ",", "'<%= dasherize(name) %>'", ",", "'g'", ")", ".", "replace", "(", "new",...
Templates-var replacement
[ "Templates", "-", "var", "replacement" ]
20478b952841828e55cb5bc8f6fb912aae1502da
https://github.com/ngx-kit/ngx-kit/blob/20478b952841828e55cb5bc8f6fb912aae1502da/packages/cli/lib/schematize/process-module.js#L42-L48
train
TeselaGen/teselagen-react-components
src/DataTable/utils/queryParams.js
setSearchTerm
function setSearchTerm(searchTerm, currentParams) { let newParams = { ...currentParams, page: undefined, //set page undefined to return the table to page 1 searchTerm: searchTerm === defaults.searchTerm ? undefined : searchTerm }; setNewParams(newParams); updateSearch(searchTerm); ...
javascript
function setSearchTerm(searchTerm, currentParams) { let newParams = { ...currentParams, page: undefined, //set page undefined to return the table to page 1 searchTerm: searchTerm === defaults.searchTerm ? undefined : searchTerm }; setNewParams(newParams); updateSearch(searchTerm); ...
[ "function", "setSearchTerm", "(", "searchTerm", ",", "currentParams", ")", "{", "let", "newParams", "=", "{", "...", "currentParams", ",", "page", ":", "undefined", ",", "//set page undefined to return the table to page 1", "searchTerm", ":", "searchTerm", "===", "def...
all of these actions have currentParams bound to them as their last arg in withTableParams
[ "all", "of", "these", "actions", "have", "currentParams", "bound", "to", "them", "as", "their", "last", "arg", "in", "withTableParams" ]
320ab3fe77fb5749d7ca74f6b0fb444310cb8ee8
https://github.com/TeselaGen/teselagen-react-components/blob/320ab3fe77fb5749d7ca74f6b0fb444310cb8ee8/src/DataTable/utils/queryParams.js#L436-L445
train
TeselaGen/teselagen-react-components
src/DataTable/utils/queryParams.js
cleanupFilter
function cleanupFilter(filter) { let filterToUse = filter; if ( filterToUse.selectedFilter === "inList" && typeof filterToUse.filterValue === "number" ) { filterToUse = { ...filterToUse, filterValue: filterToUse.filterValue.toString() }; } if (filterToUse.selectedFilter === "inList...
javascript
function cleanupFilter(filter) { let filterToUse = filter; if ( filterToUse.selectedFilter === "inList" && typeof filterToUse.filterValue === "number" ) { filterToUse = { ...filterToUse, filterValue: filterToUse.filterValue.toString() }; } if (filterToUse.selectedFilter === "inList...
[ "function", "cleanupFilter", "(", "filter", ")", "{", "let", "filterToUse", "=", "filter", ";", "if", "(", "filterToUse", ".", "selectedFilter", "===", "\"inList\"", "&&", "typeof", "filterToUse", ".", "filterValue", "===", "\"number\"", ")", "{", "filterToUse",...
if an inList value only has two items like 2.3 then it will get parsed to a number and break, convert it back to a string here
[ "if", "an", "inList", "value", "only", "has", "two", "items", "like", "2", ".", "3", "then", "it", "will", "get", "parsed", "to", "a", "number", "and", "break", "convert", "it", "back", "to", "a", "string", "here" ]
320ab3fe77fb5749d7ca74f6b0fb444310cb8ee8
https://github.com/TeselaGen/teselagen-react-components/blob/320ab3fe77fb5749d7ca74f6b0fb444310cb8ee8/src/DataTable/utils/queryParams.js#L541-L559
train
sutoiku/jsdox
lib/generateMD.js
processTag
function processTag(tag, targets) { if (tag.description) { tag.description = replaceLink(tag.description, targets); } if (tag.params) { tag.params.forEach(function (param) { if (param.description) { param.description = replaceLink(param.description, targets); } }); } if (tag.me...
javascript
function processTag(tag, targets) { if (tag.description) { tag.description = replaceLink(tag.description, targets); } if (tag.params) { tag.params.forEach(function (param) { if (param.description) { param.description = replaceLink(param.description, targets); } }); } if (tag.me...
[ "function", "processTag", "(", "tag", ",", "targets", ")", "{", "if", "(", "tag", ".", "description", ")", "{", "tag", ".", "description", "=", "replaceLink", "(", "tag", ".", "description", ",", "targets", ")", ";", "}", "if", "(", "tag", ".", "para...
Processes a tag for Markdown replacements. @param {Object} tag - tag to process @param {Object} targets - map of targets to use for links (optional)
[ "Processes", "a", "tag", "for", "Markdown", "replacements", "." ]
fd43230c1aeae74962ca07a22d97525a81624516
https://github.com/sutoiku/jsdox/blob/fd43230c1aeae74962ca07a22d97525a81624516/lib/generateMD.js#L35-L56
train
sutoiku/jsdox
lib/analyze.js
setPipedTypesString
function setPipedTypesString(node) { if (!node.type) { return ''; } node.typesString = node.type.names.join(' | '); }
javascript
function setPipedTypesString(node) { if (!node.type) { return ''; } node.typesString = node.type.names.join(' | '); }
[ "function", "setPipedTypesString", "(", "node", ")", "{", "if", "(", "!", "node", ".", "type", ")", "{", "return", "''", ";", "}", "node", ".", "typesString", "=", "node", ".", "type", ".", "names", ".", "join", "(", "' | '", ")", ";", "}" ]
Attaches a 'typesString' pipe-separated attribute containing the node's types @param {AST} node - May or may not contain a type attribute
[ "Attaches", "a", "typesString", "pipe", "-", "separated", "attribute", "containing", "the", "node", "s", "types" ]
fd43230c1aeae74962ca07a22d97525a81624516
https://github.com/sutoiku/jsdox/blob/fd43230c1aeae74962ca07a22d97525a81624516/lib/analyze.js#L217-L221
train
tsmith/node-control
lib/controller.js
addListenersToStream
function addListenersToStream(listeners, stream) { var evt, callback; if (listeners) { for (evt in listeners) { if (listeners.hasOwnProperty(evt)) { callback = listeners[evt]; stream.on(evt, callback); } } } }
javascript
function addListenersToStream(listeners, stream) { var evt, callback; if (listeners) { for (evt in listeners) { if (listeners.hasOwnProperty(evt)) { callback = listeners[evt]; stream.on(evt, callback); } } } }
[ "function", "addListenersToStream", "(", "listeners", ",", "stream", ")", "{", "var", "evt", ",", "callback", ";", "if", "(", "listeners", ")", "{", "for", "(", "evt", "in", "listeners", ")", "{", "if", "(", "listeners", ".", "hasOwnProperty", "(", "evt"...
Controller support for adding listeners to subprocess stream upon call
[ "Controller", "support", "for", "adding", "listeners", "to", "subprocess", "stream", "upon", "call" ]
6bd8a39a6bb1faaa9efccc300ca2ec48ebcaffa0
https://github.com/tsmith/node-control/blob/6bd8a39a6bb1faaa9efccc300ca2ec48ebcaffa0/lib/controller.js#L58-L68
train
tsmith/node-control
lib/configurator.js
chain
function chain(a, b) { var prop, descriptor = {}; for (prop in a) { if (a.hasOwnProperty(prop)) { descriptor[prop] = Object.getOwnPropertyDescriptor(a, prop); } } return Object.create(b, descriptor); }
javascript
function chain(a, b) { var prop, descriptor = {}; for (prop in a) { if (a.hasOwnProperty(prop)) { descriptor[prop] = Object.getOwnPropertyDescriptor(a, prop); } } return Object.create(b, descriptor); }
[ "function", "chain", "(", "a", ",", "b", ")", "{", "var", "prop", ",", "descriptor", "=", "{", "}", ";", "for", "(", "prop", "in", "a", ")", "{", "if", "(", "a", ".", "hasOwnProperty", "(", "prop", ")", ")", "{", "descriptor", "[", "prop", "]",...
Return a copy of a with prototype of b
[ "Return", "a", "copy", "of", "a", "with", "prototype", "of", "b" ]
6bd8a39a6bb1faaa9efccc300ca2ec48ebcaffa0
https://github.com/tsmith/node-control/blob/6bd8a39a6bb1faaa9efccc300ca2ec48ebcaffa0/lib/configurator.js#L7-L15
train
bitpay/bitcore-payment-protocol
update-rootcerts.js
getRootCerts
function getRootCerts(callback) { return request(certUrl, function(err, res, body) { if (err) return callback(err); // Delete preprocesor macros body = body.replace(/#[^\n]+/g, ''); // Delete the trailing comma body = body.replace(/,\s*$/, ''); // Make sure each C string is concatenated ...
javascript
function getRootCerts(callback) { return request(certUrl, function(err, res, body) { if (err) return callback(err); // Delete preprocesor macros body = body.replace(/#[^\n]+/g, ''); // Delete the trailing comma body = body.replace(/,\s*$/, ''); // Make sure each C string is concatenated ...
[ "function", "getRootCerts", "(", "callback", ")", "{", "return", "request", "(", "certUrl", ",", "function", "(", "err", ",", "res", ",", "body", ")", "{", "if", "(", "err", ")", "return", "callback", "(", "err", ")", ";", "// Delete preprocesor macros", ...
Get Root Certs
[ "Get", "Root", "Certs" ]
aee23c347f15476616144a9c258d5d28f2338a94
https://github.com/bitpay/bitcore-payment-protocol/blob/aee23c347f15476616144a9c258d5d28f2338a94/update-rootcerts.js#L15-L60
train
square/field-kit
src/expiry_date_formatter.js
interpretTwoDigitYear
function interpretTwoDigitYear(year) { const thisYear = new Date().getFullYear(); const thisCentury = thisYear - (thisYear % 100); const centuries = [thisCentury, thisCentury - 100, thisCentury + 100].sort(function(a, b) { return Math.abs(thisYear - (year + a)) - Math.abs(thisYear - (year + b)); }); retur...
javascript
function interpretTwoDigitYear(year) { const thisYear = new Date().getFullYear(); const thisCentury = thisYear - (thisYear % 100); const centuries = [thisCentury, thisCentury - 100, thisCentury + 100].sort(function(a, b) { return Math.abs(thisYear - (year + a)) - Math.abs(thisYear - (year + b)); }); retur...
[ "function", "interpretTwoDigitYear", "(", "year", ")", "{", "const", "thisYear", "=", "new", "Date", "(", ")", ".", "getFullYear", "(", ")", ";", "const", "thisCentury", "=", "thisYear", "-", "(", "thisYear", "%", "100", ")", ";", "const", "centuries", "...
Give this function a 2 digit year it'll return with 4. @example interpretTwoDigitYear(15); // => 2015 interpretTwoDigitYear(97); // => 1997 @param {number} year @returns {number} @private
[ "Give", "this", "function", "a", "2", "digit", "year", "it", "ll", "return", "with", "4", "." ]
86e5f45598b8c943d2b37ca244ab93084cb00c73
https://github.com/square/field-kit/blob/86e5f45598b8c943d2b37ca244ab93084cb00c73/src/expiry_date_formatter.js#L16-L23
train
square/field-kit
src/number_formatter.js
get
function get(object, key, ...args) { if (object) { const value = object[key]; if (typeof value === 'function') { return value(...args); } else { return value; } } }
javascript
function get(object, key, ...args) { if (object) { const value = object[key]; if (typeof value === 'function') { return value(...args); } else { return value; } } }
[ "function", "get", "(", "object", ",", "key", ",", "...", "args", ")", "{", "if", "(", "object", ")", "{", "const", "value", "=", "object", "[", "key", "]", ";", "if", "(", "typeof", "value", "===", "'function'", ")", "{", "return", "value", "(", ...
This simple property getter assumes that properties will never be functions and so attempts to run those functions using the given args. @private
[ "This", "simple", "property", "getter", "assumes", "that", "properties", "will", "never", "be", "functions", "and", "so", "attempts", "to", "run", "those", "functions", "using", "the", "given", "args", "." ]
86e5f45598b8c943d2b37ca244ab93084cb00c73
https://github.com/square/field-kit/blob/86e5f45598b8c943d2b37ca244ab93084cb00c73/src/number_formatter.js#L34-L43
train
punkave/uploadfs
lib/storage/azure.js
setContainerProperties
function setContainerProperties(blobSvc, options, result, callback) { blobSvc.getServiceProperties(function(error, result, response) { if (error) { return callback(error); } var serviceProperties = result; var allowedOrigins = options.allowedOrigins || ['*']; var allowedMethods = options.all...
javascript
function setContainerProperties(blobSvc, options, result, callback) { blobSvc.getServiceProperties(function(error, result, response) { if (error) { return callback(error); } var serviceProperties = result; var allowedOrigins = options.allowedOrigins || ['*']; var allowedMethods = options.all...
[ "function", "setContainerProperties", "(", "blobSvc", ",", "options", ",", "result", ",", "callback", ")", "{", "blobSvc", ".", "getServiceProperties", "(", "function", "(", "error", ",", "result", ",", "response", ")", "{", "if", "(", "error", ")", "{", "...
Set the main properties of the selected container. @param {AzureService} blobSvc Azure service object @param {Object} options Options passed to UploadFS library @param {Object} result Service Properties @param {Function} callback Callback to be called when operation is terminated @return {any} Return the service which ...
[ "Set", "the", "main", "properties", "of", "the", "selected", "container", "." ]
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/lib/storage/azure.js#L32-L63
train
punkave/uploadfs
lib/storage/azure.js
initializeContainer
function initializeContainer(blobSvc, container, options, callback) { blobSvc.setContainerAcl(container, null, { publicAccessLevel: 'container' }, function(error, result, response) { if (error) { return callback(error); } return setContainerProperties(blobSvc, options, result, callback); }); }
javascript
function initializeContainer(blobSvc, container, options, callback) { blobSvc.setContainerAcl(container, null, { publicAccessLevel: 'container' }, function(error, result, response) { if (error) { return callback(error); } return setContainerProperties(blobSvc, options, result, callback); }); }
[ "function", "initializeContainer", "(", "blobSvc", ",", "container", ",", "options", ",", "callback", ")", "{", "blobSvc", ".", "setContainerAcl", "(", "container", ",", "null", ",", "{", "publicAccessLevel", ":", "'container'", "}", ",", "function", "(", "err...
Initialize the container ACLs @param {AzureService} blobSvc Azure Service object @param {String} container Container name @param {Object} options Options passed to UploadFS library @param {Function} callback Callback to be called when operation is terminated @return {any} Returns the result of `setContainerProperties`
[ "Initialize", "the", "container", "ACLs" ]
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/lib/storage/azure.js#L73-L80
train
punkave/uploadfs
lib/storage/azure.js
createContainer
function createContainer(cluster, options, callback) { var blobSvc = azure.createBlobService(cluster.account, cluster.key); var container = cluster.container || options.container; blobSvc.createContainerIfNotExists(container, function(error, result, response) { if (error) { return callback(error); }...
javascript
function createContainer(cluster, options, callback) { var blobSvc = azure.createBlobService(cluster.account, cluster.key); var container = cluster.container || options.container; blobSvc.createContainerIfNotExists(container, function(error, result, response) { if (error) { return callback(error); }...
[ "function", "createContainer", "(", "cluster", ",", "options", ",", "callback", ")", "{", "var", "blobSvc", "=", "azure", ".", "createBlobService", "(", "cluster", ".", "account", ",", "cluster", ".", "key", ")", ";", "var", "container", "=", "cluster", "....
Create an Azure Container @param {Object} cluster Azure Cluster Info @param {Object} options Options passed to UploadFS library @param {Function} callback Callback to be called when operation is terminated @return {any} Returns the initialized service
[ "Create", "an", "Azure", "Container" ]
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/lib/storage/azure.js#L89-L98
train
punkave/uploadfs
lib/storage/azure.js
createContainerBlob
function createContainerBlob(blob, path, localPath, _gzip, callback) { // Draw the extension from uploadfs, where we know they will be using // reasonable extensions, not from what could be a temporary file // that came from the gzip code. -Tom var extension = extname(path).substring(1); var contentSettings =...
javascript
function createContainerBlob(blob, path, localPath, _gzip, callback) { // Draw the extension from uploadfs, where we know they will be using // reasonable extensions, not from what could be a temporary file // that came from the gzip code. -Tom var extension = extname(path).substring(1); var contentSettings =...
[ "function", "createContainerBlob", "(", "blob", ",", "path", ",", "localPath", ",", "_gzip", ",", "callback", ")", "{", "// Draw the extension from uploadfs, where we know they will be using", "// reasonable extensions, not from what could be a temporary file", "// that came from the...
Send a binary file to a specified container and a specified service @param {Object} blob Azure Service info and container @param {String} path Remote path @param {String} localPath Local file path @param {Function} callback Callback to be called when operation is terminated @return {any} Result of the callback
[ "Send", "a", "binary", "file", "to", "a", "specified", "container", "and", "a", "specified", "service" ]
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/lib/storage/azure.js#L120-L144
train
punkave/uploadfs
lib/storage/azure.js
removeContainerBlob
function removeContainerBlob(blob, path, callback) { blob.svc.deleteBlobIfExists(blob.container, path, function(error, result, response) { if (error) { __log('Cannot delete ' + path + 'on container ' + blob.container); } return callback(error); }); }
javascript
function removeContainerBlob(blob, path, callback) { blob.svc.deleteBlobIfExists(blob.container, path, function(error, result, response) { if (error) { __log('Cannot delete ' + path + 'on container ' + blob.container); } return callback(error); }); }
[ "function", "removeContainerBlob", "(", "blob", ",", "path", ",", "callback", ")", "{", "blob", ".", "svc", ".", "deleteBlobIfExists", "(", "blob", ".", "container", ",", "path", ",", "function", "(", "error", ",", "result", ",", "response", ")", "{", "i...
Remove remote container binary file @param {Object} param0 Azure Service info and container @param {String} path Remote file path @param {Function} callback Callback to be called when operation is terminated @return {any} Result of the callback
[ "Remove", "remote", "container", "binary", "file" ]
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/lib/storage/azure.js#L153-L161
train
punkave/uploadfs
lib/storage/azure.js
function(gzipEncoding) { var gzipSettings = gzipEncoding || {}; var { whitelist, blacklist } = Object.keys(gzipSettings).reduce((prev, key) => { if (gzipSettings[key]) { prev['whitelist'].push(key); } else { prev['blacklist'].push(key); } return prev; ...
javascript
function(gzipEncoding) { var gzipSettings = gzipEncoding || {}; var { whitelist, blacklist } = Object.keys(gzipSettings).reduce((prev, key) => { if (gzipSettings[key]) { prev['whitelist'].push(key); } else { prev['blacklist'].push(key); } return prev; ...
[ "function", "(", "gzipEncoding", ")", "{", "var", "gzipSettings", "=", "gzipEncoding", "||", "{", "}", ";", "var", "{", "whitelist", ",", "blacklist", "}", "=", "Object", ".", "keys", "(", "gzipSettings", ")", ".", "reduce", "(", "(", "prev", ",", "key...
Use sane defaults and user config to get array of file extensions to avoid gzipping @param gzipEncoding {Object} ex: {jpg: true, rando: false} @retyrb {Array} An array of file extensions to ignore
[ "Use", "sane", "defaults", "and", "user", "config", "to", "get", "array", "of", "file", "extensions", "to", "avoid", "gzipping" ]
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/lib/storage/azure.js#L409-L424
train
uber-web/mjolnir.js
src/utils/hammer-overrides.js
some
function some(array, predict) { for (let i = 0; i < array.length; i++) { if (predict(array[i])) { return true; } } return false; }
javascript
function some(array, predict) { for (let i = 0; i < array.length; i++) { if (predict(array[i])) { return true; } } return false; }
[ "function", "some", "(", "array", ",", "predict", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "if", "(", "predict", "(", "array", "[", "i", "]", ")", ")", "{", "return", "true",...
Helper function that returns true if any element in an array meets given criteria. Because older browsers do not support `Array.prototype.some` @params array {Array} @params predict {Function}
[ "Helper", "function", "that", "returns", "true", "if", "any", "element", "in", "an", "array", "meets", "given", "criteria", ".", "Because", "older", "browsers", "do", "not", "support", "Array", ".", "prototype", ".", "some" ]
d4a09d9761b51c671addc271f8317ccfec77a5fe
https://github.com/uber-web/mjolnir.js/blob/d4a09d9761b51c671addc271f8317ccfec77a5fe/src/utils/hammer-overrides.js#L22-L29
train
punkave/uploadfs
lib/utils.js
function(path, disabledFileKey) { var hmac = crypto.createHmac('sha256', disabledFileKey); hmac.update(path); var disabledPath = path + '-disabled-' + hmac.digest('hex'); return disabledPath; }
javascript
function(path, disabledFileKey) { var hmac = crypto.createHmac('sha256', disabledFileKey); hmac.update(path); var disabledPath = path + '-disabled-' + hmac.digest('hex'); return disabledPath; }
[ "function", "(", "path", ",", "disabledFileKey", ")", "{", "var", "hmac", "=", "crypto", ".", "createHmac", "(", "'sha256'", ",", "disabledFileKey", ")", ";", "hmac", ".", "update", "(", "path", ")", ";", "var", "disabledPath", "=", "path", "+", "'-disab...
Use an unguessable filename suffix to disable files. This is secure at the web level if the webserver is not configured to serve indexes of files, and it does not impede the use of rsync etc. Used when options.disabledFileKey is set. Use of an HMAC to do this for each filename ensures that even if one such filename is ...
[ "Use", "an", "unguessable", "filename", "suffix", "to", "disable", "files", ".", "This", "is", "secure", "at", "the", "web", "level", "if", "the", "webserver", "is", "not", "configured", "to", "serve", "indexes", "of", "files", "and", "it", "does", "not", ...
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/lib/utils.js#L13-L18
train
punkave/uploadfs
uploadfs.js
function (callback) { if (!imageSizes.length) { return callback(); } tempPath = options.tempPath; if (!fs.existsSync(options.tempPath)) { fs.mkdirSync(options.tempPath); } return callback(null); }
javascript
function (callback) { if (!imageSizes.length) { return callback(); } tempPath = options.tempPath; if (!fs.existsSync(options.tempPath)) { fs.mkdirSync(options.tempPath); } return callback(null); }
[ "function", "(", "callback", ")", "{", "if", "(", "!", "imageSizes", ".", "length", ")", "{", "return", "callback", "(", ")", ";", "}", "tempPath", "=", "options", ".", "tempPath", ";", "if", "(", "!", "fs", ".", "existsSync", "(", "options", ".", ...
create temp folder if needed
[ "create", "temp", "folder", "if", "needed" ]
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/uploadfs.js#L77-L88
train
punkave/uploadfs
uploadfs.js
function (callback) { if (!self._image) { var paths = (process.env.PATH || '').split(delimiter); if (!_.find(paths, function(p) { if (fs.existsSync(p + '/imagecrunch')) { self._image = require('./lib/image/imagecrunch.js')(); return true; }...
javascript
function (callback) { if (!self._image) { var paths = (process.env.PATH || '').split(delimiter); if (!_.find(paths, function(p) { if (fs.existsSync(p + '/imagecrunch')) { self._image = require('./lib/image/imagecrunch.js')(); return true; }...
[ "function", "(", "callback", ")", "{", "if", "(", "!", "self", ".", "_image", ")", "{", "var", "paths", "=", "(", "process", ".", "env", ".", "PATH", "||", "''", ")", ".", "split", "(", "delimiter", ")", ";", "if", "(", "!", "_", ".", "find", ...
Autodetect image backend if necessary
[ "Autodetect", "image", "backend", "if", "necessary" ]
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/uploadfs.js#L96-L116
train
punkave/uploadfs
uploadfs.js
identify
function identify(path, callback) { return self.identifyLocalImage(path, function(err, info) { if (err) { return callback(err); } context.info = info; context.extension = info.extension; return callback(null); }); }
javascript
function identify(path, callback) { return self.identifyLocalImage(path, function(err, info) { if (err) { return callback(err); } context.info = info; context.extension = info.extension; return callback(null); }); }
[ "function", "identify", "(", "path", ",", "callback", ")", "{", "return", "self", ".", "identifyLocalImage", "(", "path", ",", "function", "(", "err", ",", "info", ")", "{", "if", "(", "err", ")", "{", "return", "callback", "(", "err", ")", ";", "}",...
Identify the file type, size, etc. Stuff them into context.info and context.extension
[ "Identify", "the", "file", "type", "size", "etc", ".", "Stuff", "them", "into", "context", ".", "info", "and", "context", ".", "extension" ]
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/uploadfs.js#L241-L250
train
punkave/uploadfs
uploadfs.js
function (callback) { // Name the destination folder context.tempName = generateId(); // Create destination folder if (imageSizes.length) { context.tempFolder = tempPath + '/' + context.tempName; return fs.mkdir(context.tempFolder, callback); } else { ...
javascript
function (callback) { // Name the destination folder context.tempName = generateId(); // Create destination folder if (imageSizes.length) { context.tempFolder = tempPath + '/' + context.tempName; return fs.mkdir(context.tempFolder, callback); } else { ...
[ "function", "(", "callback", ")", "{", "// Name the destination folder", "context", ".", "tempName", "=", "generateId", "(", ")", ";", "// Create destination folder", "if", "(", "imageSizes", ".", "length", ")", "{", "context", ".", "tempFolder", "=", "tempPath", ...
make a temporary folder for our work
[ "make", "a", "temporary", "folder", "for", "our", "work" ]
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/uploadfs.js#L267-L277
train
punkave/uploadfs
uploadfs.js
function (callback) { context.basePath = path.replace(/\.\w+$/, ''); context.workingPath = localPath; // Indulge their wild claims about the extension the original // should have if any, otherwise provide the truth from identify if (path.match(/\.\w+$/)) { originalPath...
javascript
function (callback) { context.basePath = path.replace(/\.\w+$/, ''); context.workingPath = localPath; // Indulge their wild claims about the extension the original // should have if any, otherwise provide the truth from identify if (path.match(/\.\w+$/)) { originalPath...
[ "function", "(", "callback", ")", "{", "context", ".", "basePath", "=", "path", ".", "replace", "(", "/", "\\.\\w+$", "/", ",", "''", ")", ";", "context", ".", "workingPath", "=", "localPath", ";", "// Indulge their wild claims about the extension the original", ...
Determine base path in uploadfs, working path for temporary files, and final uploadfs path of the original
[ "Determine", "base", "path", "in", "uploadfs", "working", "path", "for", "temporary", "files", "and", "final", "uploadfs", "path", "of", "the", "original" ]
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/uploadfs.js#L280-L292
train
punkave/uploadfs
lib/image/imagecrunch.js
function(callback) { if (!context.copyOriginal) { return callback(null); } var suffix = 'original.' + context.extension; var tempFile = context.tempFolder + '/' + suffix; if (context.extension !== 'jpg') { // Don't forget to tell the caller that ...
javascript
function(callback) { if (!context.copyOriginal) { return callback(null); } var suffix = 'original.' + context.extension; var tempFile = context.tempFolder + '/' + suffix; if (context.extension !== 'jpg') { // Don't forget to tell the caller that ...
[ "function", "(", "callback", ")", "{", "if", "(", "!", "context", ".", "copyOriginal", ")", "{", "return", "callback", "(", "null", ")", ";", "}", "var", "suffix", "=", "'original.'", "+", "context", ".", "extension", ";", "var", "tempFile", "=", "cont...
Autorotated "original" copied in if desired
[ "Autorotated", "original", "copied", "in", "if", "desired" ]
e4e252bc93eaecea9cf2e721f8e6031519d14257
https://github.com/punkave/uploadfs/blob/e4e252bc93eaecea9cf2e721f8e6031519d14257/lib/image/imagecrunch.js#L140-L172
train
fortunejs/fortune-postgres
lib/index.js
mapValueCast
function mapValueCast (value) { index++ parameters.push(inputValue(value)) let cast = '' if (Buffer.isBuffer(value)) cast = '::bytea' else if (typeof value === 'number' && value % 1 === 0) cast = '::int' return `$${index}${cast}` }
javascript
function mapValueCast (value) { index++ parameters.push(inputValue(value)) let cast = '' if (Buffer.isBuffer(value)) cast = '::bytea' else if (typeof value === 'number' && value % 1 === 0) cast = '::int' return `$${index}${cast}` }
[ "function", "mapValueCast", "(", "value", ")", "{", "index", "++", "parameters", ".", "push", "(", "inputValue", "(", "value", ")", ")", "let", "cast", "=", "''", "if", "(", "Buffer", ".", "isBuffer", "(", "value", ")", ")", "cast", "=", "'::bytea'", ...
These functions modify the variables in this closure.
[ "These", "functions", "modify", "the", "variables", "in", "this", "closure", "." ]
7d158ec79334584049fc2f8de404527eb24ae598
https://github.com/fortunejs/fortune-postgres/blob/7d158ec79334584049fc2f8de404527eb24ae598/lib/index.js#L350-L362
train
Mogztter/antora-lunr
lib/generate-index.js
generateIndex
function generateIndex (playbook, pages) { let siteUrl = playbook.site.url if (!siteUrl) { // Uses relative links when site URL is not set siteUrl = ''; } if (siteUrl.charAt(siteUrl.length - 1) === '/') siteUrl = siteUrl.substr(0, siteUrl.length - 1) if (!pages.length) return {} // Map of Lunr ref t...
javascript
function generateIndex (playbook, pages) { let siteUrl = playbook.site.url if (!siteUrl) { // Uses relative links when site URL is not set siteUrl = ''; } if (siteUrl.charAt(siteUrl.length - 1) === '/') siteUrl = siteUrl.substr(0, siteUrl.length - 1) if (!pages.length) return {} // Map of Lunr ref t...
[ "function", "generateIndex", "(", "playbook", ",", "pages", ")", "{", "let", "siteUrl", "=", "playbook", ".", "site", ".", "url", "if", "(", "!", "siteUrl", ")", "{", "// Uses relative links when site URL is not set", "siteUrl", "=", "''", ";", "}", "if", "(...
Generate a Lunr index. Iterates over the specified pages and creates a Lunr index. @memberof generate-index @param {Object} playbook - The configuration object for Antora. @param {Object} playbook.site - Site-related configuration data. @param {String} playbook.site.url - The base URL of the site. @param {Array<File...
[ "Generate", "a", "Lunr", "index", "." ]
4126ac53cfead104e8742f2d00e797afdec7c252
https://github.com/Mogztter/antora-lunr/blob/4126ac53cfead104e8742f2d00e797afdec7c252/lib/generate-index.js#L21-L96
train
midudev/react-slidy
src/slidy.js
_translate
function _translate(duration, ease = '', x = false) { slidesDOMEl.style.cssText = getTranslationCSS(duration, ease, index, x) }
javascript
function _translate(duration, ease = '', x = false) { slidesDOMEl.style.cssText = getTranslationCSS(duration, ease, index, x) }
[ "function", "_translate", "(", "duration", ",", "ease", "=", "''", ",", "x", "=", "false", ")", "{", "slidesDOMEl", ".", "style", ".", "cssText", "=", "getTranslationCSS", "(", "duration", ",", "ease", ",", "index", ",", "x", ")", "}" ]
translates to a given position in a given time in milliseconds @duration {number} time in milliseconds for the transistion @ease {string} easing css property @x {number} Number of pixels to fine tuning translation
[ "translates", "to", "a", "given", "position", "in", "a", "given", "time", "in", "milliseconds" ]
81fbc58d7984af3ef3fb8000e0795f8435c0df7d
https://github.com/midudev/react-slidy/blob/81fbc58d7984af3ef3fb8000e0795f8435c0df7d/src/slidy.js#L72-L74
train
midudev/react-slidy
src/slidy.js
slide
function slide(direction) { const movement = direction === true ? 1 : -1 let duration = slideSpeed // calculate the nextIndex according to the movement let nextIndex = index + 1 * movement // nextIndex should be between 0 and items minus 1 nextIndex = clampNumber(nextIndex, 0, items - 1) ...
javascript
function slide(direction) { const movement = direction === true ? 1 : -1 let duration = slideSpeed // calculate the nextIndex according to the movement let nextIndex = index + 1 * movement // nextIndex should be between 0 and items minus 1 nextIndex = clampNumber(nextIndex, 0, items - 1) ...
[ "function", "slide", "(", "direction", ")", "{", "const", "movement", "=", "direction", "===", "true", "?", "1", ":", "-", "1", "let", "duration", "=", "slideSpeed", "// calculate the nextIndex according to the movement", "let", "nextIndex", "=", "index", "+", "...
slide function called by prev, next & touchend determine nextIndex and slide to next postion under restrictions of the defined options @direction {boolean} 'true' for right, 'false' for left
[ "slide", "function", "called", "by", "prev", "next", "&", "touchend" ]
81fbc58d7984af3ef3fb8000e0795f8435c0df7d
https://github.com/midudev/react-slidy/blob/81fbc58d7984af3ef3fb8000e0795f8435c0df7d/src/slidy.js#L84-L114
train
midudev/react-slidy
src/slidy.js
_setup
function _setup() { slidesDOMEl.addEventListener(TRANSITION_END, onTransitionEnd) containerDOMEl.addEventListener('touchstart', onTouchstart, EVENT_OPTIONS) containerDOMEl.addEventListener('touchmove', onTouchmove, EVENT_OPTIONS) containerDOMEl.addEventListener('touchend', onTouchend, EVENT_OPTIONS) ...
javascript
function _setup() { slidesDOMEl.addEventListener(TRANSITION_END, onTransitionEnd) containerDOMEl.addEventListener('touchstart', onTouchstart, EVENT_OPTIONS) containerDOMEl.addEventListener('touchmove', onTouchmove, EVENT_OPTIONS) containerDOMEl.addEventListener('touchend', onTouchend, EVENT_OPTIONS) ...
[ "function", "_setup", "(", ")", "{", "slidesDOMEl", ".", "addEventListener", "(", "TRANSITION_END", ",", "onTransitionEnd", ")", "containerDOMEl", ".", "addEventListener", "(", "'touchstart'", ",", "onTouchstart", ",", "EVENT_OPTIONS", ")", "containerDOMEl", ".", "a...
public setup function
[ "public", "setup", "function" ]
81fbc58d7984af3ef3fb8000e0795f8435c0df7d
https://github.com/midudev/react-slidy/blob/81fbc58d7984af3ef3fb8000e0795f8435c0df7d/src/slidy.js#L202-L211
train
globant-ui/arialinter
lib/rules/element.js
function(options) { return { element: options.element, name: 'Do not use ' + options.element + ' element', message: 'Please remove the ' + options.element + ' element', ruleUrl: options.ruleUrl, level: options.level, template: true, callback: createGenericCallback(op...
javascript
function(options) { return { element: options.element, name: 'Do not use ' + options.element + ' element', message: 'Please remove the ' + options.element + ' element', ruleUrl: options.ruleUrl, level: options.level, template: true, callback: createGenericCallback(op...
[ "function", "(", "options", ")", "{", "return", "{", "element", ":", "options", ".", "element", ",", "name", ":", "'Do not use '", "+", "options", ".", "element", "+", "' element'", ",", "message", ":", "'Please remove the '", "+", "options", ".", "element",...
Creates an options json that stores the options for a generic rule.
[ "Creates", "an", "options", "json", "that", "stores", "the", "options", "for", "a", "generic", "rule", "." ]
edc9ef953a142df398fa6c2cb118239055acc623
https://github.com/globant-ui/arialinter/blob/edc9ef953a142df398fa6c2cb118239055acc623/lib/rules/element.js#L23-L33
train
globant-ui/arialinter
build/lib/rulefactory.js
function(element) { 'use strict'; return function(dom, reporter) { var that = this; dom.$(element).each(function(index, item){ reporter.error(that.message, 0, that.name); throw dom.$(item).parent().html(); }); }; }
javascript
function(element) { 'use strict'; return function(dom, reporter) { var that = this; dom.$(element).each(function(index, item){ reporter.error(that.message, 0, that.name); throw dom.$(item).parent().html(); }); }; }
[ "function", "(", "element", ")", "{", "'use strict'", ";", "return", "function", "(", "dom", ",", "reporter", ")", "{", "var", "that", "=", "this", ";", "dom", ".", "$", "(", "element", ")", ".", "each", "(", "function", "(", "index", ",", "item", ...
RuleFactory object. Decouples rule creation from AriaLinter Given an element, generates a function that checks that that element is not in the dom.
[ "RuleFactory", "object", ".", "Decouples", "rule", "creation", "from", "AriaLinter", "Given", "an", "element", "generates", "a", "function", "that", "checks", "that", "that", "element", "is", "not", "in", "the", "dom", "." ]
edc9ef953a142df398fa6c2cb118239055acc623
https://github.com/globant-ui/arialinter/blob/edc9ef953a142df398fa6c2cb118239055acc623/build/lib/rulefactory.js#L11-L23
train
retrohacker/getos
index.js
customLogic
function customLogic (os, name, file, cb) { var logic = './logic/' + name + '.js' try { require(logic)(os, file, cb) } catch (e) { cb(null, os) } }
javascript
function customLogic (os, name, file, cb) { var logic = './logic/' + name + '.js' try { require(logic)(os, file, cb) } catch (e) { cb(null, os) } }
[ "function", "customLogic", "(", "os", ",", "name", ",", "file", ",", "cb", ")", "{", "var", "logic", "=", "'./logic/'", "+", "name", "+", "'.js'", "try", "{", "require", "(", "logic", ")", "(", "os", ",", "file", ",", "cb", ")", "}", "catch", "("...
Loads a custom logic module to populate additional distribution information
[ "Loads", "a", "custom", "logic", "module", "to", "populate", "additional", "distribution", "information" ]
c58eef6b097f105de0957897f8c134df07437b67
https://github.com/retrohacker/getos/blob/c58eef6b097f105de0957897f8c134df07437b67/index.js#L122-L125
train
braintree/restricted-input
lib/restricted-input.js
RestrictedInput
function RestrictedInput(options) { options = options || {}; if (!isValidElement(options.element)) { throw new Error(constants.errors.INVALID_ELEMENT); } if (!options.pattern) { throw new Error(constants.errors.PATTERN_MISSING); } if (!RestrictedInput.supportsFormatting()) { this.strategy = n...
javascript
function RestrictedInput(options) { options = options || {}; if (!isValidElement(options.element)) { throw new Error(constants.errors.INVALID_ELEMENT); } if (!options.pattern) { throw new Error(constants.errors.PATTERN_MISSING); } if (!RestrictedInput.supportsFormatting()) { this.strategy = n...
[ "function", "RestrictedInput", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "if", "(", "!", "isValidElement", "(", "options", ".", "element", ")", ")", "{", "throw", "new", "Error", "(", "constants", ".", "errors", ".", "IN...
Instances of this class can be used to modify the formatter for an input @class @param {object} options The initialization paramaters for this class @param {object} options.element - A Input DOM object that RestrictedInput operates on @param {string} options.pattern - The pattern to enforce on this element
[ "Instances", "of", "this", "class", "can", "be", "used", "to", "modify", "the", "formatter", "for", "an", "input" ]
62dffd19c890f0c7008707f869eb9526e80f6748
https://github.com/braintree/restricted-input/blob/62dffd19c890f0c7008707f869eb9526e80f6748/lib/restricted-input.js#L21-L45
train
ds300/derivablejs
resources/js/sticky.js
Sticky
function Sticky(head, title, toc, page, gradientBit) { page.style.paddingTop = maxHeadHeight; head.style.height = maxHeadHeight + "px"; var padding = minHeadPadding + ((maxHeadPadding - minHeadPadding) * ((maxHeadHeight - minHeadHeight) / (maxHeadHeight - minHeadHeight))); head.style.padding = padding +...
javascript
function Sticky(head, title, toc, page, gradientBit) { page.style.paddingTop = maxHeadHeight; head.style.height = maxHeadHeight + "px"; var padding = minHeadPadding + ((maxHeadPadding - minHeadPadding) * ((maxHeadHeight - minHeadHeight) / (maxHeadHeight - minHeadHeight))); head.style.padding = padding +...
[ "function", "Sticky", "(", "head", ",", "title", ",", "toc", ",", "page", ",", "gradientBit", ")", "{", "page", ".", "style", ".", "paddingTop", "=", "maxHeadHeight", ";", "head", ".", "style", ".", "height", "=", "maxHeadHeight", "+", "\"px\"", ";", "...
assumes offset parent is at top for the sake of simplicity
[ "assumes", "offset", "parent", "is", "at", "top", "for", "the", "sake", "of", "simplicity" ]
f334daa1950940d09751f86630ce9af2041f9b69
https://github.com/ds300/derivablejs/blob/f334daa1950940d09751f86630ce9af2041f9b69/resources/js/sticky.js#L10-L41
train
ds300/derivablejs
examples/bmi-calculator-advanced/react/main.js
cm2feetInches
function cm2feetInches (cm) { const totalInches = (cm * 0.393701); let feet = Math.floor(totalInches / 12); let inches = Math.round(totalInches - (feet * 12)); if (inches === 12) { feet += 1; inches = 0; } return { feet, inches }; }
javascript
function cm2feetInches (cm) { const totalInches = (cm * 0.393701); let feet = Math.floor(totalInches / 12); let inches = Math.round(totalInches - (feet * 12)); if (inches === 12) { feet += 1; inches = 0; } return { feet, inches }; }
[ "function", "cm2feetInches", "(", "cm", ")", "{", "const", "totalInches", "=", "(", "cm", "*", "0.393701", ")", ";", "let", "feet", "=", "Math", ".", "floor", "(", "totalInches", "/", "12", ")", ";", "let", "inches", "=", "Math", ".", "round", "(", ...
convert a length in centimters to feet and inches components, rounding to the nearest inch
[ "convert", "a", "length", "in", "centimters", "to", "feet", "and", "inches", "components", "rounding", "to", "the", "nearest", "inch" ]
f334daa1950940d09751f86630ce9af2041f9b69
https://github.com/ds300/derivablejs/blob/f334daa1950940d09751f86630ce9af2041f9b69/examples/bmi-calculator-advanced/react/main.js#L18-L27
train
TooTallNate/pcre-to-regexp
index.js
PCRE
function PCRE (pattern, namedCaptures) { pattern = String(pattern || '').trim(); var originalPattern = pattern; var delim; var flags = ''; // A delimiter can be any non-alphanumeric, non-backslash, // non-whitespace character. var hasDelim = /^[^a-zA-Z\\\s]/.test(pattern); if (hasDelim) { delim = p...
javascript
function PCRE (pattern, namedCaptures) { pattern = String(pattern || '').trim(); var originalPattern = pattern; var delim; var flags = ''; // A delimiter can be any non-alphanumeric, non-backslash, // non-whitespace character. var hasDelim = /^[^a-zA-Z\\\s]/.test(pattern); if (hasDelim) { delim = p...
[ "function", "PCRE", "(", "pattern", ",", "namedCaptures", ")", "{", "pattern", "=", "String", "(", "pattern", "||", "''", ")", ".", "trim", "(", ")", ";", "var", "originalPattern", "=", "pattern", ";", "var", "delim", ";", "var", "flags", "=", "''", ...
Returns a JavaScript RegExp instance from the given PCRE-compatible string. Flags may be passed in after the final delimiter in the `format` string. An empty array may be passsed in as the second argument, which will be populated with the "named capture group" names as Strings in the Array, once the RegExp has been re...
[ "Returns", "a", "JavaScript", "RegExp", "instance", "from", "the", "given", "PCRE", "-", "compatible", "string", ".", "Flags", "may", "be", "passed", "in", "after", "the", "final", "delimiter", "in", "the", "format", "string", "." ]
e8446efcce02d606bdded76a8359c196fda9e93c
https://github.com/TooTallNate/pcre-to-regexp/blob/e8446efcce02d606bdded76a8359c196fda9e93c/index.js#L45-L107
train
TooTallNate/pcre-to-regexp
index.js
replaceCaptureGroups
function replaceCaptureGroups (pattern, fn) { var start; var depth = 0; var escaped = false; for (var i = 0; i < pattern.length; i++) { var cur = pattern[i]; if (escaped) { // skip this letter, it's been escaped escaped = false; continue; } switch (cur) { case '(': ...
javascript
function replaceCaptureGroups (pattern, fn) { var start; var depth = 0; var escaped = false; for (var i = 0; i < pattern.length; i++) { var cur = pattern[i]; if (escaped) { // skip this letter, it's been escaped escaped = false; continue; } switch (cur) { case '(': ...
[ "function", "replaceCaptureGroups", "(", "pattern", ",", "fn", ")", "{", "var", "start", ";", "var", "depth", "=", "0", ";", "var", "escaped", "=", "false", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "pattern", ".", "length", ";", "i", ...
Invokes `fn` for each "capture group" encountered in the PCRE `pattern`, and inserts the returned value into the pattern instead of the capture group itself. @private
[ "Invokes", "fn", "for", "each", "capture", "group", "encountered", "in", "the", "PCRE", "pattern", "and", "inserts", "the", "returned", "value", "into", "the", "pattern", "instead", "of", "the", "capture", "group", "itself", "." ]
e8446efcce02d606bdded76a8359c196fda9e93c
https://github.com/TooTallNate/pcre-to-regexp/blob/e8446efcce02d606bdded76a8359c196fda9e93c/index.js#L117-L158
train
gl-vis/gl-plot3d
scene.js
renderPick
function renderPick() { if(checkContextLoss()) { return } gl.colorMask(true, true, true, true) gl.depthMask(true) gl.disable(gl.BLEND) gl.enable(gl.DEPTH_TEST) var numObjs = objects.length var numPick = pickBuffers.length for(var j=0; j<numPick; ++j) { var buf = pickBuf...
javascript
function renderPick() { if(checkContextLoss()) { return } gl.colorMask(true, true, true, true) gl.depthMask(true) gl.disable(gl.BLEND) gl.enable(gl.DEPTH_TEST) var numObjs = objects.length var numPick = pickBuffers.length for(var j=0; j<numPick; ++j) { var buf = pickBuf...
[ "function", "renderPick", "(", ")", "{", "if", "(", "checkContextLoss", "(", ")", ")", "{", "return", "}", "gl", ".", "colorMask", "(", "true", ",", "true", ",", "true", ",", "true", ")", "gl", ".", "depthMask", "(", "true", ")", "gl", ".", "disabl...
Render the scene for mouse picking
[ "Render", "the", "scene", "for", "mouse", "picking" ]
43b2412ed8107dea33a0c8886e506be3e1d82613
https://github.com/gl-vis/gl-plot3d/blob/43b2412ed8107dea33a0c8886e506be3e1d82613/scene.js#L459-L487
train
ipfs-shipyard/peer-crdt
src/types/treedoc.js
walkDepthFirst
function walkDepthFirst (tree, visitor) { const val = walkDepthFirstRecursive(tree, visitor) if (val !== undefined) { return val } else { return visitor(null) } }
javascript
function walkDepthFirst (tree, visitor) { const val = walkDepthFirstRecursive(tree, visitor) if (val !== undefined) { return val } else { return visitor(null) } }
[ "function", "walkDepthFirst", "(", "tree", ",", "visitor", ")", "{", "const", "val", "=", "walkDepthFirstRecursive", "(", "tree", ",", "visitor", ")", "if", "(", "val", "!==", "undefined", ")", "{", "return", "val", "}", "else", "{", "return", "visitor", ...
Walk the tree
[ "Walk", "the", "tree" ]
ba6b30a65d4bf932dfdb5a0f68e1c03495cb594e
https://github.com/ipfs-shipyard/peer-crdt/blob/ba6b30a65d4bf932dfdb5a0f68e1c03495cb594e/src/types/treedoc.js#L341-L348
train
ipfs-shipyard/peer-crdt
src/types/treedoc.js
newPosId
function newPosId (p, f) { const pPath = p && p[0] const fPath = f && f[0] let path let uid if (pPath && fPath && isSibling(pPath, fPath)) { path = [pPath[0], pPath[1]] if (f[1].length > p[1].length) { const difference = f[1].substring(p[1].length) uid = p[1] + halfOf(difference) + cuid() ...
javascript
function newPosId (p, f) { const pPath = p && p[0] const fPath = f && f[0] let path let uid if (pPath && fPath && isSibling(pPath, fPath)) { path = [pPath[0], pPath[1]] if (f[1].length > p[1].length) { const difference = f[1].substring(p[1].length) uid = p[1] + halfOf(difference) + cuid() ...
[ "function", "newPosId", "(", "p", ",", "f", ")", "{", "const", "pPath", "=", "p", "&&", "p", "[", "0", "]", "const", "fPath", "=", "f", "&&", "f", "[", "0", "]", "let", "path", "let", "uid", "if", "(", "pPath", "&&", "fPath", "&&", "isSibling",...
PosIds and Paths
[ "PosIds", "and", "Paths" ]
ba6b30a65d4bf932dfdb5a0f68e1c03495cb594e
https://github.com/ipfs-shipyard/peer-crdt/blob/ba6b30a65d4bf932dfdb5a0f68e1c03495cb594e/src/types/treedoc.js#L402-L421
train
gl-vis/regl-scatter2d
bundle.js
color
function color(c, group) { if (c == null) c = Scatter.defaults.color; c = _this3.updateColor(c); hasColor++; return c; }
javascript
function color(c, group) { if (c == null) c = Scatter.defaults.color; c = _this3.updateColor(c); hasColor++; return c; }
[ "function", "color", "(", "c", ",", "group", ")", "{", "if", "(", "c", "==", "null", ")", "c", "=", "Scatter", ".", "defaults", ".", "color", ";", "c", "=", "_this3", ".", "updateColor", "(", "c", ")", ";", "hasColor", "++", ";", "return", "c", ...
add colors to palette, save references
[ "add", "colors", "to", "palette", "save", "references" ]
cda45ae30e5e1f841d65ced2404c9e36a618415f
https://github.com/gl-vis/regl-scatter2d/blob/cda45ae30e5e1f841d65ced2404c9e36a618415f/bundle.js#L556-L561
train
gl-vis/regl-scatter2d
bundle.js
marker
function marker(markers, group, options) { var activation = group.activation; // reset marker elements activation.forEach(function (buffer) { return buffer && buffer.destroy && buffer.destroy(); }); activation.length = 0; // single sdf marker if (!markers || typeof ma...
javascript
function marker(markers, group, options) { var activation = group.activation; // reset marker elements activation.forEach(function (buffer) { return buffer && buffer.destroy && buffer.destroy(); }); activation.length = 0; // single sdf marker if (!markers || typeof ma...
[ "function", "marker", "(", "markers", ",", "group", ",", "options", ")", "{", "var", "activation", "=", "group", ".", "activation", ";", "// reset marker elements", "activation", ".", "forEach", "(", "function", "(", "buffer", ")", "{", "return", "buffer", "...
create marker ids corresponding to known marker textures
[ "create", "marker", "ids", "corresponding", "to", "known", "marker", "textures" ]
cda45ae30e5e1f841d65ced2404c9e36a618415f
https://github.com/gl-vis/regl-scatter2d/blob/cda45ae30e5e1f841d65ced2404c9e36a618415f/bundle.js#L669-L712
train
iyobo/jollofjs
packages/jollof/lib/data/jollofql/index.js
jql
function jql(queryChunks, ...injects) { try { let res = ''; for (let i = 0; i < injects.length; i++) { let value = injects[i]; let q = queryChunks[i]; if (typeof value === 'string') { //make string value safe value = cleanStrin...
javascript
function jql(queryChunks, ...injects) { try { let res = ''; for (let i = 0; i < injects.length; i++) { let value = injects[i]; let q = queryChunks[i]; if (typeof value === 'string') { //make string value safe value = cleanStrin...
[ "function", "jql", "(", "queryChunks", ",", "...", "injects", ")", "{", "try", "{", "let", "res", "=", "''", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "injects", ".", "length", ";", "i", "++", ")", "{", "let", "value", "=", "injects...
A tag to be used with ES6 string literals to prevent JQL injection. Helps to build JQL queries. @param queryChunks @param injects @returns {string}
[ "A", "tag", "to", "be", "used", "with", "ES6", "string", "literals", "to", "prevent", "JQL", "injection", ".", "Helps", "to", "build", "JQL", "queries", "." ]
faae48701d9476189c39a29552a4dcacd550d6aa
https://github.com/iyobo/jollofjs/blob/faae48701d9476189c39a29552a4dcacd550d6aa/packages/jollof/lib/data/jollofql/index.js#L19-L65
train
commenthol/astronomia
src/planetary.js
Ca
function Ca (A, B, M0, M1) { this.A = A this.B = B this.M0 = M0 this.M1 = M1 }
javascript
function Ca (A, B, M0, M1) { this.A = A this.B = B this.M0 = M0 this.M1 = M1 }
[ "function", "Ca", "(", "A", ",", "B", ",", "M0", ",", "M1", ")", "{", "this", ".", "A", "=", "A", "this", ".", "B", "=", "B", "this", ".", "M0", "=", "M0", "this", ".", "M1", "=", "M1", "}" ]
ca holds coefficients from one line of table 36.A, p. 250
[ "ca", "holds", "coefficients", "from", "one", "line", "of", "table", "36", ".", "A", "p", ".", "250" ]
3882325be11589186b84dd023c559ed06c4e1145
https://github.com/commenthol/astronomia/blob/3882325be11589186b84dd023c559ed06c4e1145/src/planetary.js#L202-L207
train
iyobo/jollofjs
packages/jollof/lib/data/modelizer.js
identifyRefsInSchemaFields
function identifyRefsInSchemaFields(structure, prefix) { _.each(structure.schema, (fieldStructure, fieldName) => { const name = prefix ? prefix + '.' + fieldName : fieldName; //If field has a schema, then it is a collection if (fieldStructure.schema) { // ...
javascript
function identifyRefsInSchemaFields(structure, prefix) { _.each(structure.schema, (fieldStructure, fieldName) => { const name = prefix ? prefix + '.' + fieldName : fieldName; //If field has a schema, then it is a collection if (fieldStructure.schema) { // ...
[ "function", "identifyRefsInSchemaFields", "(", "structure", ",", "prefix", ")", "{", "_", ".", "each", "(", "structure", ".", "schema", ",", "(", "fieldStructure", ",", "fieldName", ")", "=>", "{", "const", "name", "=", "prefix", "?", "prefix", "+", "'.'",...
Identify all refs in the structure and store path names of ref fields @param criteria
[ "Identify", "all", "refs", "in", "the", "structure", "and", "store", "path", "names", "of", "ref", "fields" ]
faae48701d9476189c39a29552a4dcacd550d6aa
https://github.com/iyobo/jollofjs/blob/faae48701d9476189c39a29552a4dcacd550d6aa/packages/jollof/lib/data/modelizer.js#L126-L151
train
iyobo/jollofjs
packages/jollof/lib/util/fileUtil.js
function (str) { return str.replace (/(^[a-z]+)|[0-9]+|[A-Z][a-z]+|[A-Z]+(?=[A-Z][a-z]|[0-9])/g , function (match, first) { if (first) match = match[0].toUpperCase() + match.substr(1); return match + ' '; } ) }
javascript
function (str) { return str.replace (/(^[a-z]+)|[0-9]+|[A-Z][a-z]+|[A-Z]+(?=[A-Z][a-z]|[0-9])/g , function (match, first) { if (first) match = match[0].toUpperCase() + match.substr(1); return match + ' '; } ) }
[ "function", "(", "str", ")", "{", "return", "str", ".", "replace", "(", "/", "(^[a-z]+)|[0-9]+|[A-Z][a-z]+|[A-Z]+(?=[A-Z][a-z]|[0-9])", "/", "g", ",", "function", "(", "match", ",", "first", ")", "{", "if", "(", "first", ")", "match", "=", "match", "[", "0...
Stores a file depending on app-specified file storage engine @param str @returns {*}
[ "Stores", "a", "file", "depending", "on", "app", "-", "specified", "file", "storage", "engine" ]
faae48701d9476189c39a29552a4dcacd550d6aa
https://github.com/iyobo/jollofjs/blob/faae48701d9476189c39a29552a4dcacd550d6aa/packages/jollof/lib/util/fileUtil.js#L11-L19
train
commenthol/astronomia
src/sexagesimal.js
modf
function modf (float) { const i = Math.trunc(float) const f = Math.abs(float - i) return [i, f] }
javascript
function modf (float) { const i = Math.trunc(float) const f = Math.abs(float - i) return [i, f] }
[ "function", "modf", "(", "float", ")", "{", "const", "i", "=", "Math", ".", "trunc", "(", "float", ")", "const", "f", "=", "Math", ".", "abs", "(", "float", "-", "i", ")", "return", "[", "i", ",", "f", "]", "}" ]
separate fix `i` from fraction `f` @private @param {Number} float @returns {Array} [i, f] {Number} i - (int) fix value {Number} f - (float) fractional portion; always > 1
[ "separate", "fix", "i", "from", "fraction", "f" ]
3882325be11589186b84dd023c559ed06c4e1145
https://github.com/commenthol/astronomia/blob/3882325be11589186b84dd023c559ed06c4e1145/src/sexagesimal.js#L357-L361
train
commenthol/astronomia
src/sexagesimal.js
round
function round (float, precision) { precision = (precision === undefined ? 10 : precision) return parseFloat(float.toFixed(precision), 10) }
javascript
function round (float, precision) { precision = (precision === undefined ? 10 : precision) return parseFloat(float.toFixed(precision), 10) }
[ "function", "round", "(", "float", ",", "precision", ")", "{", "precision", "=", "(", "precision", "===", "undefined", "?", "10", ":", "precision", ")", "return", "parseFloat", "(", "float", ".", "toFixed", "(", "precision", ")", ",", "10", ")", "}" ]
Rounds `float` value by precision @private @param {Number} float - value to round @param {Number} precision - (int) number of post decimal positions @return {Number} rounded `float`
[ "Rounds", "float", "value", "by", "precision" ]
3882325be11589186b84dd023c559ed06c4e1145
https://github.com/commenthol/astronomia/blob/3882325be11589186b84dd023c559ed06c4e1145/src/sexagesimal.js#L370-L373
train
commenthol/astronomia
src/rise.js
_compatibility
function _compatibility (rs) { const _rs = [rs.rise, rs.transit, rs.set] _rs.rise = rs.rise _rs.transit = rs.transit _rs.set = rs.set return _rs }
javascript
function _compatibility (rs) { const _rs = [rs.rise, rs.transit, rs.set] _rs.rise = rs.rise _rs.transit = rs.transit _rs.set = rs.set return _rs }
[ "function", "_compatibility", "(", "rs", ")", "{", "const", "_rs", "=", "[", "rs", ".", "rise", ",", "rs", ".", "transit", ",", "rs", ".", "set", "]", "_rs", ".", "rise", "=", "rs", ".", "rise", "_rs", ".", "transit", "=", "rs", ".", "transit", ...
maintain backward compatibility - will be removed in v2 return value in future will be an object not an array
[ "maintain", "backward", "compatibility", "-", "will", "be", "removed", "in", "v2", "return", "value", "in", "future", "will", "be", "an", "object", "not", "an", "array" ]
3882325be11589186b84dd023c559ed06c4e1145
https://github.com/commenthol/astronomia/blob/3882325be11589186b84dd023c559ed06c4e1145/src/rise.js#L135-L141
train
commenthol/astronomia
src/deltat.js
interpolate
function interpolate (dyear, data) { const d3 = interp.len3ForInterpolateX(dyear, data.first, data.last, data.table ) return d3.interpolateX(dyear) }
javascript
function interpolate (dyear, data) { const d3 = interp.len3ForInterpolateX(dyear, data.first, data.last, data.table ) return d3.interpolateX(dyear) }
[ "function", "interpolate", "(", "dyear", ",", "data", ")", "{", "const", "d3", "=", "interp", ".", "len3ForInterpolateX", "(", "dyear", ",", "data", ".", "first", ",", "data", ".", "last", ",", "data", ".", "table", ")", "return", "d3", ".", "interpola...
interpolation of dataset @private @param {Number} dyear - julian year @returns {Number} ΔT in seconds.
[ "interpolation", "of", "dataset" ]
3882325be11589186b84dd023c559ed06c4e1145
https://github.com/commenthol/astronomia/blob/3882325be11589186b84dd023c559ed06c4e1145/src/deltat.js#L86-L91
train
commenthol/astronomia
src/deltat.js
interpolateData
function interpolateData (dyear, data) { const [fyear, fmonth] = data.firstYM const {year, month, first, last} = monthOfYear(dyear) const pos = 12 * (year - fyear) + (month - fmonth) const table = data.table.slice(pos, pos + 3) const d3 = new interp.Len3(first, last, table) return d3.interpolateX(dyear) }
javascript
function interpolateData (dyear, data) { const [fyear, fmonth] = data.firstYM const {year, month, first, last} = monthOfYear(dyear) const pos = 12 * (year - fyear) + (month - fmonth) const table = data.table.slice(pos, pos + 3) const d3 = new interp.Len3(first, last, table) return d3.interpolateX(dyear) }
[ "function", "interpolateData", "(", "dyear", ",", "data", ")", "{", "const", "[", "fyear", ",", "fmonth", "]", "=", "data", ".", "firstYM", "const", "{", "year", ",", "month", ",", "first", ",", "last", "}", "=", "monthOfYear", "(", "dyear", ")", "co...
interpolation of dataset from finals2000A with is one entry per month linear interpolation over whole dataset is inaccurate as points per month are not equidistant. Therefore points are approximated using 2nd diff. interpolation from current month using the following two points @private @param {Number} dyear - julian ...
[ "interpolation", "of", "dataset", "from", "finals2000A", "with", "is", "one", "entry", "per", "month", "linear", "interpolation", "over", "whole", "dataset", "is", "inaccurate", "as", "points", "per", "month", "are", "not", "equidistant", ".", "Therefore", "poin...
3882325be11589186b84dd023c559ed06c4e1145
https://github.com/commenthol/astronomia/blob/3882325be11589186b84dd023c559ed06c4e1145/src/deltat.js#L103-L110
train
commenthol/astronomia
src/deltat.js
monthOfYear
function monthOfYear (dyear) { if (!monthOfYear.data) { // memoize yearly fractions per month monthOfYear.data = {0: [], 1: []} for (let m = 0; m <= 12; m++) { monthOfYear.data[0][m] = new Calendar(1999, m, 1).toYear() - 1999 // non leap year monthOfYear.data[1][m] = new Calendar(2000, m, 1).toYea...
javascript
function monthOfYear (dyear) { if (!monthOfYear.data) { // memoize yearly fractions per month monthOfYear.data = {0: [], 1: []} for (let m = 0; m <= 12; m++) { monthOfYear.data[0][m] = new Calendar(1999, m, 1).toYear() - 1999 // non leap year monthOfYear.data[1][m] = new Calendar(2000, m, 1).toYea...
[ "function", "monthOfYear", "(", "dyear", ")", "{", "if", "(", "!", "monthOfYear", ".", "data", ")", "{", "// memoize yearly fractions per month", "monthOfYear", ".", "data", "=", "{", "0", ":", "[", "]", ",", "1", ":", "[", "]", "}", "for", "(", "let",...
Get month of Year from fraction. Fraction differs at leap years. @private @param {Number} dyear - decimal year @return {Object} `{year: Number, month: Number, first: Number, last}`
[ "Get", "month", "of", "Year", "from", "fraction", ".", "Fraction", "differs", "at", "leap", "years", "." ]
3882325be11589186b84dd023c559ed06c4e1145
https://github.com/commenthol/astronomia/blob/3882325be11589186b84dd023c559ed06c4e1145/src/deltat.js#L118-L138
train
iyobo/jollofjs
packages/jollof/lib/admin/rClient/util/convertToFormData.js
appendRecursively
function appendRecursively(formData, collection, parentkey, parentIsArray) { //console.log(...arguments) for (let k in collection) { const val = collection[k]; if (val === undefined) continue; if (val instanceof File) { let mkey = (parentkey ? parentkey + '.' : '') + k; ...
javascript
function appendRecursively(formData, collection, parentkey, parentIsArray) { //console.log(...arguments) for (let k in collection) { const val = collection[k]; if (val === undefined) continue; if (val instanceof File) { let mkey = (parentkey ? parentkey + '.' : '') + k; ...
[ "function", "appendRecursively", "(", "formData", ",", "collection", ",", "parentkey", ",", "parentIsArray", ")", "{", "//console.log(...arguments)", "for", "(", "let", "k", "in", "collection", ")", "{", "const", "val", "=", "collection", "[", "k", "]", ";", ...
Created by iyobo on 2017-04-25.
[ "Created", "by", "iyobo", "on", "2017", "-", "04", "-", "25", "." ]
faae48701d9476189c39a29552a4dcacd550d6aa
https://github.com/iyobo/jollofjs/blob/faae48701d9476189c39a29552a4dcacd550d6aa/packages/jollof/lib/admin/rClient/util/convertToFormData.js#L4-L46
train
commenthol/astronomia
src/moonphase.js
snap
function snap (y, q) { const k = (y - 2000) * 12.3685 // (49.2) p. 350 return Math.floor(k - q + 0.5) + q }
javascript
function snap (y, q) { const k = (y - 2000) * 12.3685 // (49.2) p. 350 return Math.floor(k - q + 0.5) + q }
[ "function", "snap", "(", "y", ",", "q", ")", "{", "const", "k", "=", "(", "y", "-", "2000", ")", "*", "12.3685", "// (49.2) p. 350", "return", "Math", ".", "floor", "(", "k", "-", "q", "+", "0.5", ")", "+", "q", "}" ]
snap returns k at specified quarter q nearest year y.
[ "snap", "returns", "k", "at", "specified", "quarter", "q", "nearest", "year", "y", "." ]
3882325be11589186b84dd023c559ed06c4e1145
https://github.com/commenthol/astronomia/blob/3882325be11589186b84dd023c559ed06c4e1145/src/moonphase.js#L29-L32
train
jslicense/spdx-expression-parse.js
scan.js
read
function read (value) { if (value instanceof RegExp) { var chars = source.slice(index) var match = chars.match(value) if (match) { index += match[0].length return match[0] } } else { if (source.indexOf(value, index) === index) { index += value.length ...
javascript
function read (value) { if (value instanceof RegExp) { var chars = source.slice(index) var match = chars.match(value) if (match) { index += match[0].length return match[0] } } else { if (source.indexOf(value, index) === index) { index += value.length ...
[ "function", "read", "(", "value", ")", "{", "if", "(", "value", "instanceof", "RegExp", ")", "{", "var", "chars", "=", "source", ".", "slice", "(", "index", ")", "var", "match", "=", "chars", ".", "match", "(", "value", ")", "if", "(", "match", ")"...
`value` can be a regexp or a string. If it is recognized, the matching source string is returned and the index is incremented. Otherwise `undefined` is returned.
[ "value", "can", "be", "a", "regexp", "or", "a", "string", ".", "If", "it", "is", "recognized", "the", "matching", "source", "string", "is", "returned", "and", "the", "index", "is", "incremented", ".", "Otherwise", "undefined", "is", "returned", "." ]
2cece31d85e721cf522436a17ccb4e990f4cd413
https://github.com/jslicense/spdx-expression-parse.js/blob/2cece31d85e721cf522436a17ccb4e990f4cd413/scan.js#L18-L32
train
kensho/ng-describe
dist/ng-describe.js
parse
function parse(string) { var match = isoDateExpression.exec(string); if (match) { // parse months, days, hours, minutes, seconds, and milliseconds // provide default values if necessary // parse the UTC offset component var year = $...
javascript
function parse(string) { var match = isoDateExpression.exec(string); if (match) { // parse months, days, hours, minutes, seconds, and milliseconds // provide default values if necessary // parse the UTC offset component var year = $...
[ "function", "parse", "(", "string", ")", "{", "var", "match", "=", "isoDateExpression", ".", "exec", "(", "string", ")", ";", "if", "(", "match", ")", "{", "// parse months, days, hours, minutes, seconds, and milliseconds", "// provide default values if necessary", "// ...
Upgrade Date.parse to handle simplified ISO 8601 strings
[ "Upgrade", "Date", ".", "parse", "to", "handle", "simplified", "ISO", "8601", "strings" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L1501-L1550
train
kensho/ng-describe
dist/ng-describe.js
sameLength
function sameLength(a, b) { return typeof a === typeof b && a && b && a.length === b.length; }
javascript
function sameLength(a, b) { return typeof a === typeof b && a && b && a.length === b.length; }
[ "function", "sameLength", "(", "a", ",", "b", ")", "{", "return", "typeof", "a", "===", "typeof", "b", "&&", "a", "&&", "b", "&&", "a", ".", "length", "===", "b", ".", "length", ";", "}" ]
Returns true if both objects are the same type and have same length property @method sameLength
[ "Returns", "true", "if", "both", "objects", "are", "the", "same", "type", "and", "have", "same", "length", "property" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2283-L2287
train
kensho/ng-describe
dist/ng-describe.js
allSame
function allSame(arr) { if (!check.array(arr)) { return false; } if (!arr.length) { return true; } var first = arr[0]; return arr.every(function (item) { return item === first; }); }
javascript
function allSame(arr) { if (!check.array(arr)) { return false; } if (!arr.length) { return true; } var first = arr[0]; return arr.every(function (item) { return item === first; }); }
[ "function", "allSame", "(", "arr", ")", "{", "if", "(", "!", "check", ".", "array", "(", "arr", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "arr", ".", "length", ")", "{", "return", "true", ";", "}", "var", "first", "=", "arr", ...
Returns true if all items in an array are the same reference @method allSame
[ "Returns", "true", "if", "all", "items", "in", "an", "array", "are", "the", "same", "reference" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2294-L2305
train
kensho/ng-describe
dist/ng-describe.js
oneOf
function oneOf(arr, x) { check.verify.array(arr, 'expected an array'); return arr.indexOf(x) !== -1; }
javascript
function oneOf(arr, x) { check.verify.array(arr, 'expected an array'); return arr.indexOf(x) !== -1; }
[ "function", "oneOf", "(", "arr", ",", "x", ")", "{", "check", ".", "verify", ".", "array", "(", "arr", ",", "'expected an array'", ")", ";", "return", "arr", ".", "indexOf", "(", "x", ")", "!==", "-", "1", ";", "}" ]
Returns true if given item is in the array @method oneOf
[ "Returns", "true", "if", "given", "item", "is", "in", "the", "array" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2312-L2315
train
kensho/ng-describe
dist/ng-describe.js
has
function has(o, property) { if (arguments.length !== 2) { throw new Error('Expected two arguments to check.has, got only ' + arguments.length); } return Boolean(o && property && typeof property === 'string' && typeof o[property] !== 'undefined'); }
javascript
function has(o, property) { if (arguments.length !== 2) { throw new Error('Expected two arguments to check.has, got only ' + arguments.length); } return Boolean(o && property && typeof property === 'string' && typeof o[property] !== 'undefined'); }
[ "function", "has", "(", "o", ",", "property", ")", "{", "if", "(", "arguments", ".", "length", "!==", "2", ")", "{", "throw", "new", "Error", "(", "'Expected two arguments to check.has, got only '", "+", "arguments", ".", "length", ")", ";", "}", "return", ...
Checks if given object has a property @method has
[ "Checks", "if", "given", "object", "has", "a", "property" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2349-L2356
train
kensho/ng-describe
dist/ng-describe.js
badItems
function badItems(rule, a) { check.verify.array(a, 'expected array to find bad items'); return a.filter(notModifier(rule)); }
javascript
function badItems(rule, a) { check.verify.array(a, 'expected array to find bad items'); return a.filter(notModifier(rule)); }
[ "function", "badItems", "(", "rule", ",", "a", ")", "{", "check", ".", "verify", ".", "array", "(", "a", ",", "'expected array to find bad items'", ")", ";", "return", "a", ".", "filter", "(", "notModifier", "(", "rule", ")", ")", ";", "}" ]
Returns items from array that do not passes the predicate @method badItems @param rule Predicate function @param a Array with items
[ "Returns", "items", "from", "array", "that", "do", "not", "passes", "the", "predicate" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2391-L2394
train
kensho/ng-describe
dist/ng-describe.js
arrayOfStrings
function arrayOfStrings(a, checkLowerCase) { var v = check.array(a) && a.every(check.string); if (v && check.bool(checkLowerCase) && checkLowerCase) { return a.every(check.lowerCase); } return v; }
javascript
function arrayOfStrings(a, checkLowerCase) { var v = check.array(a) && a.every(check.string); if (v && check.bool(checkLowerCase) && checkLowerCase) { return a.every(check.lowerCase); } return v; }
[ "function", "arrayOfStrings", "(", "a", ",", "checkLowerCase", ")", "{", "var", "v", "=", "check", ".", "array", "(", "a", ")", "&&", "a", ".", "every", "(", "check", ".", "string", ")", ";", "if", "(", "v", "&&", "check", ".", "bool", "(", "chec...
Returns true if given array only has strings @method arrayOfStrings @param a Array to check @param checkLowerCase Checks if all strings are lowercase
[ "Returns", "true", "if", "given", "array", "only", "has", "strings" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2402-L2408
train
kensho/ng-describe
dist/ng-describe.js
arrayOfArraysOfStrings
function arrayOfArraysOfStrings(a, checkLowerCase) { return check.array(a) && a.every(function (arr) { return check.arrayOfStrings(arr, checkLowerCase); }); }
javascript
function arrayOfArraysOfStrings(a, checkLowerCase) { return check.array(a) && a.every(function (arr) { return check.arrayOfStrings(arr, checkLowerCase); }); }
[ "function", "arrayOfArraysOfStrings", "(", "a", ",", "checkLowerCase", ")", "{", "return", "check", ".", "array", "(", "a", ")", "&&", "a", ".", "every", "(", "function", "(", "arr", ")", "{", "return", "check", ".", "arrayOfStrings", "(", "arr", ",", ...
Returns true if given argument is array of arrays of strings @method arrayOfArraysOfStrings @param a Array to check @param checkLowerCase Checks if all strings are lowercase
[ "Returns", "true", "if", "given", "argument", "is", "array", "of", "arrays", "of", "strings" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2416-L2420
train
kensho/ng-describe
dist/ng-describe.js
all
function all(obj, predicates) { check.verify.fn(check.every, 'missing check.every method'); check.verify.fn(check.map, 'missing check.map method'); check.verify.object(obj, 'missing object to check'); check.verify.object(predicates, 'missing predicates object'); Object.keys(predicates).forEach(func...
javascript
function all(obj, predicates) { check.verify.fn(check.every, 'missing check.every method'); check.verify.fn(check.map, 'missing check.map method'); check.verify.object(obj, 'missing object to check'); check.verify.object(predicates, 'missing predicates object'); Object.keys(predicates).forEach(func...
[ "function", "all", "(", "obj", ",", "predicates", ")", "{", "check", ".", "verify", ".", "fn", "(", "check", ".", "every", ",", "'missing check.every method'", ")", ";", "check", ".", "verify", ".", "fn", "(", "check", ".", "map", ",", "'missing check.ma...
Checks if object passes all rules in predicates. check.all({ foo: 'foo' }, { foo: check.string }, 'wrong object'); This is a composition of check.every(check.map ...) calls https://github.com/philbooth/check-types.js#batch-operations @method all @param {object} object object to check @param {object} predicates rules...
[ "Checks", "if", "object", "passes", "all", "rules", "in", "predicates", "." ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2436-L2448
train
kensho/ng-describe
dist/ng-describe.js
raises
function raises(fn, errorValidator) { check.verify.fn(fn, 'expected function that raises'); try { fn(); } catch (err) { if (typeof errorValidator === 'undefined') { return true; } if (typeof errorValidator === 'function') { return errorValidator(err); } re...
javascript
function raises(fn, errorValidator) { check.verify.fn(fn, 'expected function that raises'); try { fn(); } catch (err) { if (typeof errorValidator === 'undefined') { return true; } if (typeof errorValidator === 'function') { return errorValidator(err); } re...
[ "function", "raises", "(", "fn", ",", "errorValidator", ")", "{", "check", ".", "verify", ".", "fn", "(", "fn", ",", "'expected function that raises'", ")", ";", "try", "{", "fn", "(", ")", ";", "}", "catch", "(", "err", ")", "{", "if", "(", "typeof"...
Checks if given function raises an error @method raises
[ "Checks", "if", "given", "function", "raises", "an", "error" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2462-L2477
train
kensho/ng-describe
dist/ng-describe.js
unempty
function unempty(a) { var hasLength = typeof a === 'string' || Array.isArray(a); if (hasLength) { return a.length; } if (a instanceof Object) { return Object.keys(a).length; } return true; }
javascript
function unempty(a) { var hasLength = typeof a === 'string' || Array.isArray(a); if (hasLength) { return a.length; } if (a instanceof Object) { return Object.keys(a).length; } return true; }
[ "function", "unempty", "(", "a", ")", "{", "var", "hasLength", "=", "typeof", "a", "===", "'string'", "||", "Array", ".", "isArray", "(", "a", ")", ";", "if", "(", "hasLength", ")", "{", "return", "a", ".", "length", ";", "}", "if", "(", "a", "in...
Returns true if given value has .length and it is not zero, or has properties @method unempty
[ "Returns", "true", "if", "given", "value", "has", ".", "length", "and", "it", "is", "not", "zero", "or", "has", "properties" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2507-L2517
train
kensho/ng-describe
dist/ng-describe.js
commitId
function commitId(id) { return check.string(id) && id.length === 40 && shaReg.test(id); }
javascript
function commitId(id) { return check.string(id) && id.length === 40 && shaReg.test(id); }
[ "function", "commitId", "(", "id", ")", "{", "return", "check", ".", "string", "(", "id", ")", "&&", "id", ".", "length", "===", "40", "&&", "shaReg", ".", "test", "(", "id", ")", ";", "}" ]
Returns true if the given string is 40 digit SHA commit id @method commitId
[ "Returns", "true", "if", "the", "given", "string", "is", "40", "digit", "SHA", "commit", "id" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2546-L2550
train
kensho/ng-describe
dist/ng-describe.js
shortCommitId
function shortCommitId(id) { return check.string(id) && id.length === 7 && shortShaReg.test(id); }
javascript
function shortCommitId(id) { return check.string(id) && id.length === 7 && shortShaReg.test(id); }
[ "function", "shortCommitId", "(", "id", ")", "{", "return", "check", ".", "string", "(", "id", ")", "&&", "id", ".", "length", "===", "7", "&&", "shortShaReg", ".", "test", "(", "id", ")", ";", "}" ]
Returns true if the given string is short 7 character SHA id part @method shortCommitId
[ "Returns", "true", "if", "the", "given", "string", "is", "short", "7", "character", "SHA", "id", "part" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2559-L2563
train
kensho/ng-describe
dist/ng-describe.js
or
function or() { var predicates = Array.prototype.slice.call(arguments, 0); if (!predicates.length) { throw new Error('empty list of arguments to or'); } return function orCheck() { var values = Array.prototype.slice.call(arguments, 0); return predicates.some(function (predicate) { ...
javascript
function or() { var predicates = Array.prototype.slice.call(arguments, 0); if (!predicates.length) { throw new Error('empty list of arguments to or'); } return function orCheck() { var values = Array.prototype.slice.call(arguments, 0); return predicates.some(function (predicate) { ...
[ "function", "or", "(", ")", "{", "var", "predicates", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "0", ")", ";", "if", "(", "!", "predicates", ".", "length", ")", "{", "throw", "new", "Error", "(", "'empty list o...
Combines multiple predicate functions to produce new OR predicate @method or
[ "Combines", "multiple", "predicate", "functions", "to", "produce", "new", "OR", "predicate" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2610-L2628
train
kensho/ng-describe
dist/ng-describe.js
and
function and() { var predicates = Array.prototype.slice.call(arguments, 0); if (!predicates.length) { throw new Error('empty list of arguments to or'); } return function orCheck() { var values = Array.prototype.slice.call(arguments, 0); return predicates.every(function (predicate) { ...
javascript
function and() { var predicates = Array.prototype.slice.call(arguments, 0); if (!predicates.length) { throw new Error('empty list of arguments to or'); } return function orCheck() { var values = Array.prototype.slice.call(arguments, 0); return predicates.every(function (predicate) { ...
[ "function", "and", "(", ")", "{", "var", "predicates", "=", "Array", ".", "prototype", ".", "slice", ".", "call", "(", "arguments", ",", "0", ")", ";", "if", "(", "!", "predicates", ".", "length", ")", "{", "throw", "new", "Error", "(", "'empty list ...
Combines multiple predicate functions to produce new AND predicate @method or
[ "Combines", "multiple", "predicate", "functions", "to", "produce", "new", "AND", "predicate" ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2634-L2647
train
kensho/ng-describe
dist/ng-describe.js
verifyModifier
function verifyModifier(predicate, defaultMessage) { return function () { var message; if (predicate.apply(null, arguments) === false) { message = arguments[arguments.length - 1]; throw new Error(check.unemptyString(message) ? message : defaultMessage); } ...
javascript
function verifyModifier(predicate, defaultMessage) { return function () { var message; if (predicate.apply(null, arguments) === false) { message = arguments[arguments.length - 1]; throw new Error(check.unemptyString(message) ? message : defaultMessage); } ...
[ "function", "verifyModifier", "(", "predicate", ",", "defaultMessage", ")", "{", "return", "function", "(", ")", "{", "var", "message", ";", "if", "(", "predicate", ".", "apply", "(", "null", ",", "arguments", ")", "===", "false", ")", "{", "message", "=...
Public modifier `verify`. Throws if `predicate` returns `false`. copied from check-types.js
[ "Public", "modifier", "verify", "." ]
884c4ac0cfdba88d248053c36fa4b672f735734b
https://github.com/kensho/ng-describe/blob/884c4ac0cfdba88d248053c36fa4b672f735734b/dist/ng-describe.js#L2719-L2727
train
siddharthkp/ci-env
utils/drone.js
getLegacyRepo
function getLegacyRepo(env) { // default to process.env if no argument provided if (!env) { env = process.env } // bail if neither variable exists let remote = env.DRONE_REMOTE || env.CI_REMOTE if (!remote) { return '' } // parse out the org and repo name from the git URL let parts = remote.split('/').s...
javascript
function getLegacyRepo(env) { // default to process.env if no argument provided if (!env) { env = process.env } // bail if neither variable exists let remote = env.DRONE_REMOTE || env.CI_REMOTE if (!remote) { return '' } // parse out the org and repo name from the git URL let parts = remote.split('/').s...
[ "function", "getLegacyRepo", "(", "env", ")", "{", "// default to process.env if no argument provided", "if", "(", "!", "env", ")", "{", "env", "=", "process", ".", "env", "}", "// bail if neither variable exists", "let", "remote", "=", "env", ".", "DRONE_REMOTE", ...
Parses a git URL, extracting the org and repo name. Older versions of drone (< v4.0) do not export `DRONE_REPO` or `CI_REPO`. They do export `DRONE_REMOTE` and / or `CI_REMOTE` with the git URL. e.g., `DRONE_REMOTE=git://github.com/siddharthkp/ci-env.git` @param {Object} env object in shape of `process.env` @param {...
[ "Parses", "a", "git", "URL", "extracting", "the", "org", "and", "repo", "name", "." ]
73a46437295b3cc2372a8e90f289eab1d7e82f32
https://github.com/siddharthkp/ci-env/blob/73a46437295b3cc2372a8e90f289eab1d7e82f32/utils/drone.js#L14-L28
train
wework/we-js-logger
src/client.js
getStreams
function getStreams(config) { // Any passed in streams const streams = Array.isArray(config.streams) ? [...config.streams] : []; // Nice console output if (config.stdout) { streams.push({ name: 'stdout', level: config.level, stream: new ClientConsoleLogger(), type: 'raw', ...
javascript
function getStreams(config) { // Any passed in streams const streams = Array.isArray(config.streams) ? [...config.streams] : []; // Nice console output if (config.stdout) { streams.push({ name: 'stdout', level: config.level, stream: new ClientConsoleLogger(), type: 'raw', ...
[ "function", "getStreams", "(", "config", ")", "{", "// Any passed in streams", "const", "streams", "=", "Array", ".", "isArray", "(", "config", ".", "streams", ")", "?", "[", "...", "config", ".", "streams", "]", ":", "[", "]", ";", "// Nice console output",...
Add standard Client logger streams to `config.streams` @private @param {Object} config @param {Array?} config.streams @returns {Array}
[ "Add", "standard", "Client", "logger", "streams", "to", "config", ".", "streams" ]
57b66dd40ffe5f44d2cf553d1d1ecfd47973c567
https://github.com/wework/we-js-logger/blob/57b66dd40ffe5f44d2cf553d1d1ecfd47973c567/src/client.js#L20-L72
train
wework/we-js-logger
src/node.js
getStreams
function getStreams(config) { const streams = Array.isArray(config.streams) ? [...config.streams] : []; // Nice output to stdout if (config.stdout) { streams.push({ name: 'stdout', level: config.level, stream: bunyanFormat({ outputMode: 'short' }), type: 'stream', }); } ...
javascript
function getStreams(config) { const streams = Array.isArray(config.streams) ? [...config.streams] : []; // Nice output to stdout if (config.stdout) { streams.push({ name: 'stdout', level: config.level, stream: bunyanFormat({ outputMode: 'short' }), type: 'stream', }); } ...
[ "function", "getStreams", "(", "config", ")", "{", "const", "streams", "=", "Array", ".", "isArray", "(", "config", ".", "streams", ")", "?", "[", "...", "config", ".", "streams", "]", ":", "[", "]", ";", "// Nice output to stdout", "if", "(", "config", ...
Add standard Node logger streams to `config.streams` @private @param {Object} config @param {Array?} config.streams @returns {Array}
[ "Add", "standard", "Node", "logger", "streams", "to", "config", ".", "streams" ]
57b66dd40ffe5f44d2cf553d1d1ecfd47973c567
https://github.com/wework/we-js-logger/blob/57b66dd40ffe5f44d2cf553d1d1ecfd47973c567/src/node.js#L19-L60
train
netifi-proteus/proteus-js
resources/bumpVersion.js
getDependents
function getDependents(dependencyName) { return Object.values(allPackages).filter(({info: pkg}) => { return ( pkg.dependencies && Object.keys(pkg.dependencies).indexOf(dependencyName) !== -1 ); }); }
javascript
function getDependents(dependencyName) { return Object.values(allPackages).filter(({info: pkg}) => { return ( pkg.dependencies && Object.keys(pkg.dependencies).indexOf(dependencyName) !== -1 ); }); }
[ "function", "getDependents", "(", "dependencyName", ")", "{", "return", "Object", ".", "values", "(", "allPackages", ")", ".", "filter", "(", "(", "{", "info", ":", "pkg", "}", ")", "=>", "{", "return", "(", "pkg", ".", "dependencies", "&&", "Object", ...
Get the direct dependents of `dependency`.
[ "Get", "the", "direct", "dependents", "of", "dependency", "." ]
dc29a797efa82bd8aef5c9d8512d7c72d7c9bc4f
https://github.com/netifi-proteus/proteus-js/blob/dc29a797efa82bd8aef5c9d8512d7c72d7c9bc4f/resources/bumpVersion.js#L144-L151
train
zyra/cordova-plugin-stripe
www/CordovaStripe.js
function(key, success, error) { success = success || noop; error = error || noop; exec(success, error, "CordovaStripe", "setPublishableKey", [key]); }
javascript
function(key, success, error) { success = success || noop; error = error || noop; exec(success, error, "CordovaStripe", "setPublishableKey", [key]); }
[ "function", "(", "key", ",", "success", ",", "error", ")", "{", "success", "=", "success", "||", "noop", ";", "error", "=", "error", "||", "noop", ";", "exec", "(", "success", ",", "error", ",", "\"CordovaStripe\"", ",", "\"setPublishableKey\"", ",", "["...
Set publishable key @param key {string} Publishable key @param [success] {Function} Success callback @param [error] {Function} Error callback
[ "Set", "publishable", "key" ]
df50d5631d9cf1accd0e593ae74de74ce206e2dc
https://github.com/zyra/cordova-plugin-stripe/blob/df50d5631d9cf1accd0e593ae74de74ce206e2dc/www/CordovaStripe.js#L49-L53
train
zyra/cordova-plugin-stripe
www/CordovaStripe.js
function(creditCard, success, error) { success = success || noop; error = error || noop; exec(success, error, "CordovaStripe", "createCardToken", [creditCard]); }
javascript
function(creditCard, success, error) { success = success || noop; error = error || noop; exec(success, error, "CordovaStripe", "createCardToken", [creditCard]); }
[ "function", "(", "creditCard", ",", "success", ",", "error", ")", "{", "success", "=", "success", "||", "noop", ";", "error", "=", "error", "||", "noop", ";", "exec", "(", "success", ",", "error", ",", "\"CordovaStripe\"", ",", "\"createCardToken\"", ",", ...
Create a credit card token @param creditCard {module:stripe.CreditCardTokenParams} Credit card information @param success {Function} Success callback @param error {Function} Error callback
[ "Create", "a", "credit", "card", "token" ]
df50d5631d9cf1accd0e593ae74de74ce206e2dc
https://github.com/zyra/cordova-plugin-stripe/blob/df50d5631d9cf1accd0e593ae74de74ce206e2dc/www/CordovaStripe.js#L61-L65
train
zyra/cordova-plugin-stripe
www/CordovaStripe.js
function(bankAccount, success, error) { success = success || noop; error = error || noop; exec(success, error, "CordovaStripe", "createBankAccountToken", [bankAccount]); }
javascript
function(bankAccount, success, error) { success = success || noop; error = error || noop; exec(success, error, "CordovaStripe", "createBankAccountToken", [bankAccount]); }
[ "function", "(", "bankAccount", ",", "success", ",", "error", ")", "{", "success", "=", "success", "||", "noop", ";", "error", "=", "error", "||", "noop", ";", "exec", "(", "success", ",", "error", ",", "\"CordovaStripe\"", ",", "\"createBankAccountToken\"",...
Create a bank account token @param bankAccount {module:stripe.BankAccountTokenParams} Bank account information @param {Function} success Success callback @param {Function} error Error callback
[ "Create", "a", "bank", "account", "token" ]
df50d5631d9cf1accd0e593ae74de74ce206e2dc
https://github.com/zyra/cordova-plugin-stripe/blob/df50d5631d9cf1accd0e593ae74de74ce206e2dc/www/CordovaStripe.js#L73-L77
train
zyra/cordova-plugin-stripe
www/CordovaStripe.js
function(cardNumber, success, error) { success = success || noop; error = error || noop; exec(success, error, "CordovaStripe", "validateCardNumber", [cardNumber]); }
javascript
function(cardNumber, success, error) { success = success || noop; error = error || noop; exec(success, error, "CordovaStripe", "validateCardNumber", [cardNumber]); }
[ "function", "(", "cardNumber", ",", "success", ",", "error", ")", "{", "success", "=", "success", "||", "noop", ";", "error", "=", "error", "||", "noop", ";", "exec", "(", "success", ",", "error", ",", "\"CordovaStripe\"", ",", "\"validateCardNumber\"", ",...
Validates card number @param cardNumber {String} Credit card number @param {Function} success Success callback that will be called if card number is valid @param {Function} error Error callback that will be called if card number is invalid
[ "Validates", "card", "number" ]
df50d5631d9cf1accd0e593ae74de74ce206e2dc
https://github.com/zyra/cordova-plugin-stripe/blob/df50d5631d9cf1accd0e593ae74de74ce206e2dc/www/CordovaStripe.js#L85-L89
train
zyra/cordova-plugin-stripe
www/CordovaStripe.js
function(expMonth, expYear, success, error) { success = success || noop; error = error || noop; exec(success, error, "CordovaStripe", "validateExpiryDate", [expMonth, expYear]); }
javascript
function(expMonth, expYear, success, error) { success = success || noop; error = error || noop; exec(success, error, "CordovaStripe", "validateExpiryDate", [expMonth, expYear]); }
[ "function", "(", "expMonth", ",", "expYear", ",", "success", ",", "error", ")", "{", "success", "=", "success", "||", "noop", ";", "error", "=", "error", "||", "noop", ";", "exec", "(", "success", ",", "error", ",", "\"CordovaStripe\"", ",", "\"validateE...
Validates the expiry date of a card @param {number} expMonth Expiry month @param {number} expYear Expiry year @param {Function} success @param {Function} error
[ "Validates", "the", "expiry", "date", "of", "a", "card" ]
df50d5631d9cf1accd0e593ae74de74ce206e2dc
https://github.com/zyra/cordova-plugin-stripe/blob/df50d5631d9cf1accd0e593ae74de74ce206e2dc/www/CordovaStripe.js#L98-L102
train