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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
recharts/recharts-scale | src/getNiceTickValues.js | getTickOfSingleValue | function getTickOfSingleValue(value, tickCount, allowDecimals) {
let step = 1;
// calculate the middle value of ticks
let middle = new Decimal(value);
if (!middle.isint() && allowDecimals) {
const absVal = Math.abs(value);
if (absVal < 1) {
// The step should be a float number when the differenc... | javascript | function getTickOfSingleValue(value, tickCount, allowDecimals) {
let step = 1;
// calculate the middle value of ticks
let middle = new Decimal(value);
if (!middle.isint() && allowDecimals) {
const absVal = Math.abs(value);
if (absVal < 1) {
// The step should be a float number when the differenc... | [
"function",
"getTickOfSingleValue",
"(",
"value",
",",
"tickCount",
",",
"allowDecimals",
")",
"{",
"let",
"step",
"=",
"1",
";",
"// calculate the middle value of ticks",
"let",
"middle",
"=",
"new",
"Decimal",
"(",
"value",
")",
";",
"if",
"(",
"!",
"middle"... | calculate the ticks when the minimum value equals to the maximum value
@param {Number} value The minimum valuue which is also the maximum value
@param {Integer} tickCount The count of ticks
@param {Boolean} allowDecimals Allow the ticks to be decimals or not
@return {Array} ticks | [
"calculate",
"the",
"ticks",
"when",
"the",
"minimum",
"value",
"equals",
"to",
"the",
"maximum",
"value"
] | 8fdf6d32d24cdabf6da75f1cd9d0a3e33336dc2a | https://github.com/recharts/recharts-scale/blob/8fdf6d32d24cdabf6da75f1cd9d0a3e33336dc2a/src/getNiceTickValues.js#L66-L97 | train |
recharts/recharts-scale | src/getNiceTickValues.js | calculateStep | function calculateStep(min, max, tickCount, allowDecimals, correctionFactor = 0) {
// dirty hack (for recharts' test)
if (!Number.isFinite((max - min) / (tickCount - 1))) {
return {
step: new Decimal(0),
tickMin: new Decimal(0),
tickMax: new Decimal(0),
};
}
// The step which is easy ... | javascript | function calculateStep(min, max, tickCount, allowDecimals, correctionFactor = 0) {
// dirty hack (for recharts' test)
if (!Number.isFinite((max - min) / (tickCount - 1))) {
return {
step: new Decimal(0),
tickMin: new Decimal(0),
tickMax: new Decimal(0),
};
}
// The step which is easy ... | [
"function",
"calculateStep",
"(",
"min",
",",
"max",
",",
"tickCount",
",",
"allowDecimals",
",",
"correctionFactor",
"=",
"0",
")",
"{",
"// dirty hack (for recharts' test)",
"if",
"(",
"!",
"Number",
".",
"isFinite",
"(",
"(",
"max",
"-",
"min",
")",
"/",
... | Calculate the step
@param {Number} min The minimum value of an interval
@param {Number} max The maximum value of an interval
@param {Integer} tickCount The count of ticks
@param {Boolean} allowDecimals Allow the ticks to be decimals or not
@param {Number} correctionFactor A ... | [
"Calculate",
"the",
"step"
] | 8fdf6d32d24cdabf6da75f1cd9d0a3e33336dc2a | https://github.com/recharts/recharts-scale/blob/8fdf6d32d24cdabf6da75f1cd9d0a3e33336dc2a/src/getNiceTickValues.js#L109-L158 | train |
recharts/recharts-scale | src/getNiceTickValues.js | getNiceTickValuesFn | function getNiceTickValuesFn([min, max], tickCount = 6, allowDecimals = true) {
// More than two ticks should be return
const count = Math.max(tickCount, 2);
const [cormin, cormax] = getValidInterval([min, max]);
if (cormin === -Infinity || cormax === Infinity) {
const values = cormax === Infinity
? ... | javascript | function getNiceTickValuesFn([min, max], tickCount = 6, allowDecimals = true) {
// More than two ticks should be return
const count = Math.max(tickCount, 2);
const [cormin, cormax] = getValidInterval([min, max]);
if (cormin === -Infinity || cormax === Infinity) {
const values = cormax === Infinity
? ... | [
"function",
"getNiceTickValuesFn",
"(",
"[",
"min",
",",
"max",
"]",
",",
"tickCount",
"=",
"6",
",",
"allowDecimals",
"=",
"true",
")",
"{",
"// More than two ticks should be return",
"const",
"count",
"=",
"Math",
".",
"max",
"(",
"tickCount",
",",
"2",
")... | Calculate the ticks of an interval, the count of ticks will be guraranteed
@param {Number} min, max min: The minimum value, max: The maximum value
@param {Integer} tickCount The count of ticks
@param {Boolean} allowDecimals Allow the ticks to be decimals or not
@return {Array} ticks | [
"Calculate",
"the",
"ticks",
"of",
"an",
"interval",
"the",
"count",
"of",
"ticks",
"will",
"be",
"guraranteed"
] | 8fdf6d32d24cdabf6da75f1cd9d0a3e33336dc2a | https://github.com/recharts/recharts-scale/blob/8fdf6d32d24cdabf6da75f1cd9d0a3e33336dc2a/src/getNiceTickValues.js#L167-L190 | train |
recharts/recharts-scale | src/getNiceTickValues.js | getTickValuesFn | function getTickValuesFn([min, max], tickCount = 6, allowDecimals = true) {
// More than two ticks should be return
const count = Math.max(tickCount, 2);
const [cormin, cormax] = getValidInterval([min, max]);
if (cormin === -Infinity || cormax === Infinity) {
return [min, max];
}
if (cormin === cormax... | javascript | function getTickValuesFn([min, max], tickCount = 6, allowDecimals = true) {
// More than two ticks should be return
const count = Math.max(tickCount, 2);
const [cormin, cormax] = getValidInterval([min, max]);
if (cormin === -Infinity || cormax === Infinity) {
return [min, max];
}
if (cormin === cormax... | [
"function",
"getTickValuesFn",
"(",
"[",
"min",
",",
"max",
"]",
",",
"tickCount",
"=",
"6",
",",
"allowDecimals",
"=",
"true",
")",
"{",
"// More than two ticks should be return",
"const",
"count",
"=",
"Math",
".",
"max",
"(",
"tickCount",
",",
"2",
")",
... | Calculate the ticks of an interval, the count of ticks won't be guraranteed
@param {Number} min, max min: The minimum value, max: The maximum value
@param {Integer} tickCount The count of ticks
@param {Boolean} allowDecimals Allow the ticks to be decimals or not
@return {Array} ticks | [
"Calculate",
"the",
"ticks",
"of",
"an",
"interval",
"the",
"count",
"of",
"ticks",
"won",
"t",
"be",
"guraranteed"
] | 8fdf6d32d24cdabf6da75f1cd9d0a3e33336dc2a | https://github.com/recharts/recharts-scale/blob/8fdf6d32d24cdabf6da75f1cd9d0a3e33336dc2a/src/getNiceTickValues.js#L200-L223 | train |
recharts/recharts-scale | src/getNiceTickValues.js | getTickValuesFixedDomainFn | function getTickValuesFixedDomainFn([min, max], tickCount, allowDecimals = true) {
// More than two ticks should be return
const [cormin, cormax] = getValidInterval([min, max]);
if (cormin === -Infinity || cormax === Infinity) {
return [min, max];
}
if (cormin === cormax) { return [cormin]; }
const c... | javascript | function getTickValuesFixedDomainFn([min, max], tickCount, allowDecimals = true) {
// More than two ticks should be return
const [cormin, cormax] = getValidInterval([min, max]);
if (cormin === -Infinity || cormax === Infinity) {
return [min, max];
}
if (cormin === cormax) { return [cormin]; }
const c... | [
"function",
"getTickValuesFixedDomainFn",
"(",
"[",
"min",
",",
"max",
"]",
",",
"tickCount",
",",
"allowDecimals",
"=",
"true",
")",
"{",
"// More than two ticks should be return",
"const",
"[",
"cormin",
",",
"cormax",
"]",
"=",
"getValidInterval",
"(",
"[",
"... | Calculate the ticks of an interval, the count of ticks won't be guraranteed,
but the domain will be guaranteed
@param {Number} min, max min: The minimum value, max: The maximum value
@param {Integer} tickCount The count of ticks
@param {Boolean} allowDecimals Allow the ticks to be decimals or not
@return ... | [
"Calculate",
"the",
"ticks",
"of",
"an",
"interval",
"the",
"count",
"of",
"ticks",
"won",
"t",
"be",
"guraranteed",
"but",
"the",
"domain",
"will",
"be",
"guaranteed"
] | 8fdf6d32d24cdabf6da75f1cd9d0a3e33336dc2a | https://github.com/recharts/recharts-scale/blob/8fdf6d32d24cdabf6da75f1cd9d0a3e33336dc2a/src/getNiceTickValues.js#L234-L256 | train |
rexxars/commonmark-react-renderer | src/commonmark-react-renderer.js | List | function List(props) {
var tag = props.type.toLowerCase() === 'bullet' ? 'ul' : 'ol';
var attrs = getCoreProps(props);
if (props.start !== null && props.start !== 1) {
attrs.start = props.start.toString();
}
return createElement(tag, attrs, props.children);
} | javascript | function List(props) {
var tag = props.type.toLowerCase() === 'bullet' ? 'ul' : 'ol';
var attrs = getCoreProps(props);
if (props.start !== null && props.start !== 1) {
attrs.start = props.start.toString();
}
return createElement(tag, attrs, props.children);
} | [
"function",
"List",
"(",
"props",
")",
"{",
"var",
"tag",
"=",
"props",
".",
"type",
".",
"toLowerCase",
"(",
")",
"===",
"'bullet'",
"?",
"'ul'",
":",
"'ol'",
";",
"var",
"attrs",
"=",
"getCoreProps",
"(",
"props",
")",
";",
"if",
"(",
"props",
".... | eslint-disable-line camelcase | [
"eslint",
"-",
"disable",
"-",
"line",
"camelcase"
] | 6774beb39b462a377dda7ef7bba45991b4212e67 | https://github.com/rexxars/commonmark-react-renderer/blob/6774beb39b462a377dda7ef7bba45991b4212e67/src/commonmark-react-renderer.js#L32-L41 | train |
rexxars/commonmark-react-renderer | src/commonmark-react-renderer.js | getNodeProps | function getNodeProps(node, key, opts, renderer) {
var props = { key: key }, undef;
// `sourcePos` is true if the user wants source information (line/column info from markdown source)
if (opts.sourcePos && node.sourcepos) {
props['data-sourcepos'] = flattenPosition(node.sourcepos);
}
var t... | javascript | function getNodeProps(node, key, opts, renderer) {
var props = { key: key }, undef;
// `sourcePos` is true if the user wants source information (line/column info from markdown source)
if (opts.sourcePos && node.sourcepos) {
props['data-sourcepos'] = flattenPosition(node.sourcepos);
}
var t... | [
"function",
"getNodeProps",
"(",
"node",
",",
"key",
",",
"opts",
",",
"renderer",
")",
"{",
"var",
"props",
"=",
"{",
"key",
":",
"key",
"}",
",",
"undef",
";",
"// `sourcePos` is true if the user wants source information (line/column info from markdown source)",
"if... | For some nodes, we want to include more props than for others | [
"For",
"some",
"nodes",
"we",
"want",
"to",
"include",
"more",
"props",
"than",
"for",
"others"
] | 6774beb39b462a377dda7ef7bba45991b4212e67 | https://github.com/rexxars/commonmark-react-renderer/blob/6774beb39b462a377dda7ef7bba45991b4212e67/src/commonmark-react-renderer.js#L136-L203 | train |
mweibel/lcov-result-merger | index.js | BRDA | function BRDA (lineNumber, blockNumber, branchNumber, hits) {
this.lineNumber = lineNumber
this.blockNumber = blockNumber
this.branchNumber = branchNumber
this.hits = hits
} | javascript | function BRDA (lineNumber, blockNumber, branchNumber, hits) {
this.lineNumber = lineNumber
this.blockNumber = blockNumber
this.branchNumber = branchNumber
this.hits = hits
} | [
"function",
"BRDA",
"(",
"lineNumber",
",",
"blockNumber",
",",
"branchNumber",
",",
"hits",
")",
"{",
"this",
".",
"lineNumber",
"=",
"lineNumber",
"this",
".",
"blockNumber",
"=",
"blockNumber",
"this",
".",
"branchNumber",
"=",
"branchNumber",
"this",
".",
... | Represents a BRDA record
@param {number} lineNumber
@param {number} blockNumber
@param {number} branchNumber
@param {number} hits
@constructor | [
"Represents",
"a",
"BRDA",
"record"
] | 41576894b3d52326ccf0f0e4c2c9e871e2c37028 | https://github.com/mweibel/lcov-result-merger/blob/41576894b3d52326ccf0f0e4c2c9e871e2c37028/index.js#L44-L49 | train |
mweibel/lcov-result-merger | index.js | findDA | function findDA (source, lineNumber) {
for (var i = 0; i < source.length; i++) {
var da = source[i]
if (da.lineNumber === lineNumber) {
return da
}
}
return null
} | javascript | function findDA (source, lineNumber) {
for (var i = 0; i < source.length; i++) {
var da = source[i]
if (da.lineNumber === lineNumber) {
return da
}
}
return null
} | [
"function",
"findDA",
"(",
"source",
",",
"lineNumber",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"source",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"da",
"=",
"source",
"[",
"i",
"]",
"if",
"(",
"da",
".",
"lineNumber",... | Find an existing DA record
@param {DA[]} source
@param {number} lineNumber
@returns {DA|null} | [
"Find",
"an",
"existing",
"DA",
"record"
] | 41576894b3d52326ccf0f0e4c2c9e871e2c37028 | https://github.com/mweibel/lcov-result-merger/blob/41576894b3d52326ccf0f0e4c2c9e871e2c37028/index.js#L105-L113 | train |
mweibel/lcov-result-merger | index.js | findBRDA | function findBRDA (source, blockNumber, branchNumber, lineNumber) {
for (var i = 0; i < source.length; i++) {
var brda = source[i]
if (brda.blockNumber === blockNumber &&
brda.branchNumber === branchNumber &&
brda.lineNumber === lineNumber) {
return brda
}
}
return null
} | javascript | function findBRDA (source, blockNumber, branchNumber, lineNumber) {
for (var i = 0; i < source.length; i++) {
var brda = source[i]
if (brda.blockNumber === blockNumber &&
brda.branchNumber === branchNumber &&
brda.lineNumber === lineNumber) {
return brda
}
}
return null
} | [
"function",
"findBRDA",
"(",
"source",
",",
"blockNumber",
",",
"branchNumber",
",",
"lineNumber",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"source",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"brda",
"=",
"source",
"[",
"i",... | Find an existing BRDA record
@param {BRDA[]} source
@param {number} blockNumber
@param {number} branchNumber
@param {number} lineNumber
@returns {BRDA|null} | [
"Find",
"an",
"existing",
"BRDA",
"record"
] | 41576894b3d52326ccf0f0e4c2c9e871e2c37028 | https://github.com/mweibel/lcov-result-merger/blob/41576894b3d52326ccf0f0e4c2c9e871e2c37028/index.js#L125-L135 | train |
mweibel/lcov-result-merger | index.js | findCoverageFile | function findCoverageFile (source, filename) {
for (var i = 0; i < source.length; i++) {
var file = source[i]
if (file.filename === filename) {
return file
}
}
return null
} | javascript | function findCoverageFile (source, filename) {
for (var i = 0; i < source.length; i++) {
var file = source[i]
if (file.filename === filename) {
return file
}
}
return null
} | [
"function",
"findCoverageFile",
"(",
"source",
",",
"filename",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"source",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"file",
"=",
"source",
"[",
"i",
"]",
"if",
"(",
"file",
".",
"... | Find an existing coverage file
@param {CoverageFile[]} source
@param {string} filename
@returns {CoverageFile|null} | [
"Find",
"an",
"existing",
"coverage",
"file"
] | 41576894b3d52326ccf0f0e4c2c9e871e2c37028 | https://github.com/mweibel/lcov-result-merger/blob/41576894b3d52326ccf0f0e4c2c9e871e2c37028/index.js#L145-L153 | train |
mweibel/lcov-result-merger | index.js | parseSF | function parseSF (lcov, prefixSplit) {
// If the filepath contains a ':', we want to preserve it.
prefixSplit.shift()
var currentFileName = prefixSplit.join(':')
var currentCoverageFile = findCoverageFile(lcov, currentFileName)
if (currentCoverageFile) {
return currentCoverageFile
}
currentCoverageFil... | javascript | function parseSF (lcov, prefixSplit) {
// If the filepath contains a ':', we want to preserve it.
prefixSplit.shift()
var currentFileName = prefixSplit.join(':')
var currentCoverageFile = findCoverageFile(lcov, currentFileName)
if (currentCoverageFile) {
return currentCoverageFile
}
currentCoverageFil... | [
"function",
"parseSF",
"(",
"lcov",
",",
"prefixSplit",
")",
"{",
"// If the filepath contains a ':', we want to preserve it.",
"prefixSplit",
".",
"shift",
"(",
")",
"var",
"currentFileName",
"=",
"prefixSplit",
".",
"join",
"(",
"':'",
")",
"var",
"currentCoverageFi... | Parses a SF section
@param {CoverageFile[]} lcov
@param {string[]} prefixSplit
@returns {CoverageFile|null} | [
"Parses",
"a",
"SF",
"section"
] | 41576894b3d52326ccf0f0e4c2c9e871e2c37028 | https://github.com/mweibel/lcov-result-merger/blob/41576894b3d52326ccf0f0e4c2c9e871e2c37028/index.js#L209-L221 | train |
mweibel/lcov-result-merger | index.js | parseDA | function parseDA (currentCoverageFile, prefixSplit) {
var numberSplit = splitNumbers(prefixSplit)
var lineNumber = parseInt(numberSplit[0], 10)
var hits = parseInt(numberSplit[1], 10)
var existingDA = findDA(currentCoverageFile.DARecords, lineNumber)
if (existingDA) {
existingDA.hits += hits
return
... | javascript | function parseDA (currentCoverageFile, prefixSplit) {
var numberSplit = splitNumbers(prefixSplit)
var lineNumber = parseInt(numberSplit[0], 10)
var hits = parseInt(numberSplit[1], 10)
var existingDA = findDA(currentCoverageFile.DARecords, lineNumber)
if (existingDA) {
existingDA.hits += hits
return
... | [
"function",
"parseDA",
"(",
"currentCoverageFile",
",",
"prefixSplit",
")",
"{",
"var",
"numberSplit",
"=",
"splitNumbers",
"(",
"prefixSplit",
")",
"var",
"lineNumber",
"=",
"parseInt",
"(",
"numberSplit",
"[",
"0",
"]",
",",
"10",
")",
"var",
"hits",
"=",
... | Parses a DA section
@param {CoverageFile} currentCoverageFile
@param {string[]} prefixSplit | [
"Parses",
"a",
"DA",
"section"
] | 41576894b3d52326ccf0f0e4c2c9e871e2c37028 | https://github.com/mweibel/lcov-result-merger/blob/41576894b3d52326ccf0f0e4c2c9e871e2c37028/index.js#L229-L241 | train |
mweibel/lcov-result-merger | index.js | parseBRDA | function parseBRDA (currentCoverageFile, prefixSplit) {
var numberSplit = splitNumbers(prefixSplit)
var lineNumber = parseInt(numberSplit[0], 10)
var blockNumber = parseInt(numberSplit[1], 10)
var branchNumber = parseInt(numberSplit[2], 10)
var existingBRDA = findBRDA(currentCoverageFile.BRDARecords,
blo... | javascript | function parseBRDA (currentCoverageFile, prefixSplit) {
var numberSplit = splitNumbers(prefixSplit)
var lineNumber = parseInt(numberSplit[0], 10)
var blockNumber = parseInt(numberSplit[1], 10)
var branchNumber = parseInt(numberSplit[2], 10)
var existingBRDA = findBRDA(currentCoverageFile.BRDARecords,
blo... | [
"function",
"parseBRDA",
"(",
"currentCoverageFile",
",",
"prefixSplit",
")",
"{",
"var",
"numberSplit",
"=",
"splitNumbers",
"(",
"prefixSplit",
")",
"var",
"lineNumber",
"=",
"parseInt",
"(",
"numberSplit",
"[",
"0",
"]",
",",
"10",
")",
"var",
"blockNumber"... | Parses a BRDA section
@param {CoverageFile} currentCoverageFile
@param {string[]} prefixSplit | [
"Parses",
"a",
"BRDA",
"section"
] | 41576894b3d52326ccf0f0e4c2c9e871e2c37028 | https://github.com/mweibel/lcov-result-merger/blob/41576894b3d52326ccf0f0e4c2c9e871e2c37028/index.js#L249-L270 | train |
mweibel/lcov-result-merger | index.js | processFile | function processFile (data, lcov) {
var lines = data.split(/\r?\n/)
var currentCoverageFile = null
for (var i = 0, l = lines.length; i < l; i++) {
var line = lines[i]
if (line === 'end_of_record' || line === '') {
currentCoverageFile = null
continue
}
var prefixSplit = line.split(':'... | javascript | function processFile (data, lcov) {
var lines = data.split(/\r?\n/)
var currentCoverageFile = null
for (var i = 0, l = lines.length; i < l; i++) {
var line = lines[i]
if (line === 'end_of_record' || line === '') {
currentCoverageFile = null
continue
}
var prefixSplit = line.split(':'... | [
"function",
"processFile",
"(",
"data",
",",
"lcov",
")",
"{",
"var",
"lines",
"=",
"data",
".",
"split",
"(",
"/",
"\\r?\\n",
"/",
")",
"var",
"currentCoverageFile",
"=",
"null",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"l",
"=",
"lines",
".",
"leng... | Process a lcov input file into the representing Objects
@param {string} data
@param {CoverageFile[]} lcov
@returns {CoverageFile[]} | [
"Process",
"a",
"lcov",
"input",
"file",
"into",
"the",
"representing",
"Objects"
] | 41576894b3d52326ccf0f0e4c2c9e871e2c37028 | https://github.com/mweibel/lcov-result-merger/blob/41576894b3d52326ccf0f0e4c2c9e871e2c37028/index.js#L280-L309 | train |
jasmine-contrib/grunt-jasmine-runner | tasks/jasmine/reporters/JUnitReporter.js | JUnitXmlReporter | function JUnitXmlReporter(savePath, consolidate, useDotNotation) {
this.savePath = savePath || '';
this.consolidate = typeof consolidate === 'undefined' ? true : consolidate;
this.useDotNotation = typeof useDotNotation === 'undefined' ? true : useDotNotation;
} | javascript | function JUnitXmlReporter(savePath, consolidate, useDotNotation) {
this.savePath = savePath || '';
this.consolidate = typeof consolidate === 'undefined' ? true : consolidate;
this.useDotNotation = typeof useDotNotation === 'undefined' ? true : useDotNotation;
} | [
"function",
"JUnitXmlReporter",
"(",
"savePath",
",",
"consolidate",
",",
"useDotNotation",
")",
"{",
"this",
".",
"savePath",
"=",
"savePath",
"||",
"''",
";",
"this",
".",
"consolidate",
"=",
"typeof",
"consolidate",
"===",
"'undefined'",
"?",
"true",
":",
... | Generates JUnit XML for the given spec run.
Allows the test results to be used in java based CI
systems like CruiseControl and Hudson.
@param {string} savePath where to save the files
@param {boolean} consolidate whether to save nested describes within the
same file as their parent; default: true
@param {boolean} useD... | [
"Generates",
"JUnit",
"XML",
"for",
"the",
"given",
"spec",
"run",
".",
"Allows",
"the",
"test",
"results",
"to",
"be",
"used",
"in",
"java",
"based",
"CI",
"systems",
"like",
"CruiseControl",
"and",
"Hudson",
"."
] | 62c7ba51deeab8879680ba1ba68f0ed88ec69200 | https://github.com/jasmine-contrib/grunt-jasmine-runner/blob/62c7ba51deeab8879680ba1ba68f0ed88ec69200/tasks/jasmine/reporters/JUnitReporter.js#L46-L50 | train |
jasmine-contrib/grunt-jasmine-runner | tasks/lib/phantomjs.js | function(version) {
var current = [version.major, version.minor, version.patch].join('.');
var required = '>= 1.6.0';
if (!semver.satisfies(current, required)) {
exports.halt();
grunt.log.writeln();
grunt.log.errorlns(
'In order for this task to work pro... | javascript | function(version) {
var current = [version.major, version.minor, version.patch].join('.');
var required = '>= 1.6.0';
if (!semver.satisfies(current, required)) {
exports.halt();
grunt.log.writeln();
grunt.log.errorlns(
'In order for this task to work pro... | [
"function",
"(",
"version",
")",
"{",
"var",
"current",
"=",
"[",
"version",
".",
"major",
",",
"version",
".",
"minor",
",",
"version",
".",
"patch",
"]",
".",
"join",
"(",
"'.'",
")",
";",
"var",
"required",
"=",
"'>= 1.6.0'",
";",
"if",
"(",
"!"... | Abort if PhantomJS version isn't adequate. | [
"Abort",
"if",
"PhantomJS",
"version",
"isn",
"t",
"adequate",
"."
] | 62c7ba51deeab8879680ba1ba68f0ed88ec69200 | https://github.com/jasmine-contrib/grunt-jasmine-runner/blob/62c7ba51deeab8879680ba1ba68f0ed88ec69200/tasks/lib/phantomjs.js#L47-L60 | train | |
pascalopitz/nodestalker | lib/beanstalk_client.js | function() {
if(!_self.waitingForResponse && _self.queue.length) {
_self.waitingForResponse = true;
var cmd = _self.queue.shift();
if(_self.conn) {
_self.conn.removeAllListeners('data');
_self.conn.addListener('data', function(data) {
Debug.log('response:');
Debug.log(data);
cmd.respo... | javascript | function() {
if(!_self.waitingForResponse && _self.queue.length) {
_self.waitingForResponse = true;
var cmd = _self.queue.shift();
if(_self.conn) {
_self.conn.removeAllListeners('data');
_self.conn.addListener('data', function(data) {
Debug.log('response:');
Debug.log(data);
cmd.respo... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"_self",
".",
"waitingForResponse",
"&&",
"_self",
".",
"queue",
".",
"length",
")",
"{",
"_self",
".",
"waitingForResponse",
"=",
"true",
";",
"var",
"cmd",
"=",
"_self",
".",
"queue",
".",
"shift",
"(",
")... | pushes commands to the server | [
"pushes",
"commands",
"to",
"the",
"server"
] | 4ace7d5d9f2bb913023d2c70df5adf945743a628 | https://github.com/pascalopitz/nodestalker/blob/4ace7d5d9f2bb913023d2c70df5adf945743a628/lib/beanstalk_client.js#L276-L295 | train | |
ethjs/ethjs-provider-signer | src/index.js | SignerProvider | function SignerProvider(path, options) {
if (!(this instanceof SignerProvider)) { throw new Error('[ethjs-provider-signer] the SignerProvider instance requires the "new" flag in order to function normally (e.g. `const eth = new Eth(new SignerProvider(...));`).'); }
if (typeof options !== 'object') { throw new Error... | javascript | function SignerProvider(path, options) {
if (!(this instanceof SignerProvider)) { throw new Error('[ethjs-provider-signer] the SignerProvider instance requires the "new" flag in order to function normally (e.g. `const eth = new Eth(new SignerProvider(...));`).'); }
if (typeof options !== 'object') { throw new Error... | [
"function",
"SignerProvider",
"(",
"path",
",",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"SignerProvider",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'[ethjs-provider-signer] the SignerProvider instance requires the \"new\" flag in order to funct... | Signer provider constructor
@method SignerProvider
@param {String} path the input data payload
@param {Object} options the send async callback
@returns {Object} provider instance | [
"Signer",
"provider",
"constructor"
] | 0bdb4f41e11f445c793f3a24d26b8a76dc67b1c8 | https://github.com/ethjs/ethjs-provider-signer/blob/0bdb4f41e11f445c793f3a24d26b8a76dc67b1c8/src/index.js#L14-L26 | train |
whitfin/it.each | lib/util.js | generateArgs | function generateArgs(test, title, fields, index){
var formatting = fields.concat(),
args = (formatting.unshift(title), formatting);
for (var i = 1; i <= args.length - 1; i++) {
if (args[i] === 'x') {
args[i] = index;
} else if (args[i] === 'element') {
args[i] = ... | javascript | function generateArgs(test, title, fields, index){
var formatting = fields.concat(),
args = (formatting.unshift(title), formatting);
for (var i = 1; i <= args.length - 1; i++) {
if (args[i] === 'x') {
args[i] = index;
} else if (args[i] === 'element') {
args[i] = ... | [
"function",
"generateArgs",
"(",
"test",
",",
"title",
",",
"fields",
",",
"index",
")",
"{",
"var",
"formatting",
"=",
"fields",
".",
"concat",
"(",
")",
",",
"args",
"=",
"(",
"formatting",
".",
"unshift",
"(",
"title",
")",
",",
"formatting",
")",
... | Generic replacement of the test name to a dynamic name
with a set of fields. Replaces any format sequences with
the given values, and replaces 'x' with the current iteration.
@param test the test we're running
@param title the test title to replace
@param fields the fields to replace with
@param index the index of ... | [
"Generic",
"replacement",
"of",
"the",
"test",
"name",
"to",
"a",
"dynamic",
"name",
"with",
"a",
"set",
"of",
"fields",
".",
"Replaces",
"any",
"format",
"sequences",
"with",
"the",
"given",
"values",
"and",
"replaces",
"x",
"with",
"the",
"current",
"ite... | ae7f31afa7556fa237e9c67494398ab8fd6488cc | https://github.com/whitfin/it.each/blob/ae7f31afa7556fa237e9c67494398ab8fd6488cc/lib/util.js#L13-L26 | train |
node-eval/node-eval | index.js | wrap | function wrap(body, extKeys) {
const wrapper = [
'(function (exports, require, module, __filename, __dirname',
') { ',
'\n});'
];
extKeys = extKeys ? `, ${extKeys}` : '';
return wrapper[0] + extKeys + wrapper[1] + body + wrapper[2];
} | javascript | function wrap(body, extKeys) {
const wrapper = [
'(function (exports, require, module, __filename, __dirname',
') { ',
'\n});'
];
extKeys = extKeys ? `, ${extKeys}` : '';
return wrapper[0] + extKeys + wrapper[1] + body + wrapper[2];
} | [
"function",
"wrap",
"(",
"body",
",",
"extKeys",
")",
"{",
"const",
"wrapper",
"=",
"[",
"'(function (exports, require, module, __filename, __dirname'",
",",
"') { '",
",",
"'\\n});'",
"]",
";",
"extKeys",
"=",
"extKeys",
"?",
"`",
"${",
"extKeys",
"}",
"`",
"... | Wrap code with function expression
Use nodejs style default wrapper
@param {String} body
@param {String[]} [extKeys] keys to extend function args
@returns {String} | [
"Wrap",
"code",
"with",
"function",
"expression",
"Use",
"nodejs",
"style",
"default",
"wrapper"
] | a40a069933879f7cb085b52870a3fee90bd6dc8d | https://github.com/node-eval/node-eval/blob/a40a069933879f7cb085b52870a3fee90bd6dc8d/index.js#L96-L106 | train |
node-eval/node-eval | index.js | _getCalleeFilename | function _getCalleeFilename(calls) {
calls = (calls|0) + 3; // 3 is a number of inner calls
const e = {};
Error.captureStackTrace(e);
return parseStackLine(e.stack.split(/\n/)[calls]).filename;
} | javascript | function _getCalleeFilename(calls) {
calls = (calls|0) + 3; // 3 is a number of inner calls
const e = {};
Error.captureStackTrace(e);
return parseStackLine(e.stack.split(/\n/)[calls]).filename;
} | [
"function",
"_getCalleeFilename",
"(",
"calls",
")",
"{",
"calls",
"=",
"(",
"calls",
"|",
"0",
")",
"+",
"3",
";",
"// 3 is a number of inner calls",
"const",
"e",
"=",
"{",
"}",
";",
"Error",
".",
"captureStackTrace",
"(",
"e",
")",
";",
"return",
"par... | Get callee filename
@param {Number} [calls] - number of additional inner calls
@returns {String} - filename of a file that call | [
"Get",
"callee",
"filename"
] | a40a069933879f7cb085b52870a3fee90bd6dc8d | https://github.com/node-eval/node-eval/blob/a40a069933879f7cb085b52870a3fee90bd6dc8d/index.js#L142-L147 | train |
osdat/jsdataframe | spec/dataframe-spec.js | function(subset, key) {
return [
key.nRow(),
key.nCol(),
key.at(0, 'D'),
key.at(0, 'C'),
];
} | javascript | function(subset, key) {
return [
key.nRow(),
key.nCol(),
key.at(0, 'D'),
key.at(0, 'C'),
];
} | [
"function",
"(",
"subset",
",",
"key",
")",
"{",
"return",
"[",
"key",
".",
"nRow",
"(",
")",
",",
"key",
".",
"nCol",
"(",
")",
",",
"key",
".",
"at",
"(",
"0",
",",
"'D'",
")",
",",
"key",
".",
"at",
"(",
"0",
",",
"'C'",
")",
",",
"]",... | Check groupKey dimensions and content | [
"Check",
"groupKey",
"dimensions",
"and",
"content"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/spec/dataframe-spec.js#L1744-L1751 | train | |
osdat/jsdataframe | spec/dataframe-spec.js | function(joinDf, indicatorValues) {
var boolInd = joinDf.c('_join').isIn(indicatorValues);
return joinDf.s(boolInd);
} | javascript | function(joinDf, indicatorValues) {
var boolInd = joinDf.c('_join').isIn(indicatorValues);
return joinDf.s(boolInd);
} | [
"function",
"(",
"joinDf",
",",
"indicatorValues",
")",
"{",
"var",
"boolInd",
"=",
"joinDf",
".",
"c",
"(",
"'_join'",
")",
".",
"isIn",
"(",
"indicatorValues",
")",
";",
"return",
"joinDf",
".",
"s",
"(",
"boolInd",
")",
";",
"}"
] | Helper for subsetting joinDf by only selecting rows with "_join" column containing values in "indicatorValues" | [
"Helper",
"for",
"subsetting",
"joinDf",
"by",
"only",
"selecting",
"rows",
"with",
"_join",
"column",
"containing",
"values",
"in",
"indicatorValues"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/spec/dataframe-spec.js#L2477-L2480 | train | |
osdat/jsdataframe | jsdataframe.js | dfFromMatrixHelper | function dfFromMatrixHelper(matrix, startRow, colNames) {
var nCol = colNames.size();
var nRow = matrix.length - startRow;
var columns = allocArray(nCol);
var j;
for (j = 0; j < nCol; j++) {
columns[j] = allocArray(nRow);
}
for (var i = 0; i < nRow; i++) {
var rowArray = matrix[i + startRow];
... | javascript | function dfFromMatrixHelper(matrix, startRow, colNames) {
var nCol = colNames.size();
var nRow = matrix.length - startRow;
var columns = allocArray(nCol);
var j;
for (j = 0; j < nCol; j++) {
columns[j] = allocArray(nRow);
}
for (var i = 0; i < nRow; i++) {
var rowArray = matrix[i + startRow];
... | [
"function",
"dfFromMatrixHelper",
"(",
"matrix",
",",
"startRow",
",",
"colNames",
")",
"{",
"var",
"nCol",
"=",
"colNames",
".",
"size",
"(",
")",
";",
"var",
"nRow",
"=",
"matrix",
".",
"length",
"-",
"startRow",
";",
"var",
"columns",
"=",
"allocArray... | Forms a data frame using 'matrix' starting with 'startRow' and setting column names to the 'colNames' string vector | [
"Forms",
"a",
"data",
"frame",
"using",
"matrix",
"starting",
"with",
"startRow",
"and",
"setting",
"column",
"names",
"to",
"the",
"colNames",
"string",
"vector"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L498-L516 | train |
osdat/jsdataframe | jsdataframe.js | rightAlign | function rightAlign(strVec) {
var maxWidth = strVec.nChar().max();
var padding = jd.rep(' ', maxWidth).strJoin('');
return strVec.map(function(str) {
return (padding + str).slice(-padding.length);
});
} | javascript | function rightAlign(strVec) {
var maxWidth = strVec.nChar().max();
var padding = jd.rep(' ', maxWidth).strJoin('');
return strVec.map(function(str) {
return (padding + str).slice(-padding.length);
});
} | [
"function",
"rightAlign",
"(",
"strVec",
")",
"{",
"var",
"maxWidth",
"=",
"strVec",
".",
"nChar",
"(",
")",
".",
"max",
"(",
")",
";",
"var",
"padding",
"=",
"jd",
".",
"rep",
"(",
"' '",
",",
"maxWidth",
")",
".",
"strJoin",
"(",
"''",
")",
";"... | Helper for right-aligning every element in a string vector, padding with spaces so all elements are the same width | [
"Helper",
"for",
"right",
"-",
"aligning",
"every",
"element",
"in",
"a",
"string",
"vector",
"padding",
"with",
"spaces",
"so",
"all",
"elements",
"are",
"the",
"same",
"width"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L952-L958 | train |
osdat/jsdataframe | jsdataframe.js | makeRowIds | function makeRowIds(numRows, maxLines) {
var printVec = jd.seq(numRows)._toTruncatedPrintVector(maxLines);
return printVec.map(function(str) {
return str === _SKIP_MARKER ? str : str + _ROW_ID_SUFFIX;
});
} | javascript | function makeRowIds(numRows, maxLines) {
var printVec = jd.seq(numRows)._toTruncatedPrintVector(maxLines);
return printVec.map(function(str) {
return str === _SKIP_MARKER ? str : str + _ROW_ID_SUFFIX;
});
} | [
"function",
"makeRowIds",
"(",
"numRows",
",",
"maxLines",
")",
"{",
"var",
"printVec",
"=",
"jd",
".",
"seq",
"(",
"numRows",
")",
".",
"_toTruncatedPrintVector",
"(",
"maxLines",
")",
";",
"return",
"printVec",
".",
"map",
"(",
"function",
"(",
"str",
... | Helper to create column of row ids for printing | [
"Helper",
"to",
"create",
"column",
"of",
"row",
"ids",
"for",
"printing"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L961-L966 | train |
osdat/jsdataframe | jsdataframe.js | toPrintString | function toPrintString(value) {
if (isUndefined(value)) {
return 'undefined';
} else if (value === null) {
return 'null';
} else if (Number.isNaN(value)) {
return 'NaN';
} else {
var str = coerceToStr(value);
var lines = str.split('\n', 2);
if (lines.length > 1) {
str = lines[0] + ... | javascript | function toPrintString(value) {
if (isUndefined(value)) {
return 'undefined';
} else if (value === null) {
return 'null';
} else if (Number.isNaN(value)) {
return 'NaN';
} else {
var str = coerceToStr(value);
var lines = str.split('\n', 2);
if (lines.length > 1) {
str = lines[0] + ... | [
"function",
"toPrintString",
"(",
"value",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"value",
")",
")",
"{",
"return",
"'undefined'",
";",
"}",
"else",
"if",
"(",
"value",
"===",
"null",
")",
"{",
"return",
"'null'",
";",
"}",
"else",
"if",
"(",
"Numb... | Helper for converting a value to a printable string | [
"Helper",
"for",
"converting",
"a",
"value",
"to",
"a",
"printable",
"string"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L969-L987 | train |
osdat/jsdataframe | jsdataframe.js | validatePrintMax | function validatePrintMax(candidate, lowerBound, label) {
if (typeof candidate !== 'number' || Number.isNaN(candidate)) {
throw new Error('"' + label + '" must be a number');
} else if (candidate < lowerBound) {
throw new Error('"' + label + '" too small');
}
} | javascript | function validatePrintMax(candidate, lowerBound, label) {
if (typeof candidate !== 'number' || Number.isNaN(candidate)) {
throw new Error('"' + label + '" must be a number');
} else if (candidate < lowerBound) {
throw new Error('"' + label + '" too small');
}
} | [
"function",
"validatePrintMax",
"(",
"candidate",
",",
"lowerBound",
",",
"label",
")",
"{",
"if",
"(",
"typeof",
"candidate",
"!==",
"'number'",
"||",
"Number",
".",
"isNaN",
"(",
"candidate",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'\"'",
"+",
"l... | Helper to validate a candidate print maximum | [
"Helper",
"to",
"validate",
"a",
"candidate",
"print",
"maximum"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L991-L997 | train |
osdat/jsdataframe | jsdataframe.js | fractionDigits | function fractionDigits(number) {
var splitArr = number.toString().split('.');
return (splitArr.length > 1) ?
splitArr[1].length :
0;
} | javascript | function fractionDigits(number) {
var splitArr = number.toString().split('.');
return (splitArr.length > 1) ?
splitArr[1].length :
0;
} | [
"function",
"fractionDigits",
"(",
"number",
")",
"{",
"var",
"splitArr",
"=",
"number",
".",
"toString",
"(",
")",
".",
"split",
"(",
"'.'",
")",
";",
"return",
"(",
"splitArr",
".",
"length",
">",
"1",
")",
"?",
"splitArr",
"[",
"1",
"]",
".",
"l... | Helper for retrieving the number of digits after the decimal point for the given number. This function doesn't work for numbers represented in scientific notation, but such numbers will trigger different printing logic anyway. | [
"Helper",
"for",
"retrieving",
"the",
"number",
"of",
"digits",
"after",
"the",
"decimal",
"point",
"for",
"the",
"given",
"number",
".",
"This",
"function",
"doesn",
"t",
"work",
"for",
"numbers",
"represented",
"in",
"scientific",
"notation",
"but",
"such",
... | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L1003-L1008 | train |
osdat/jsdataframe | jsdataframe.js | packVector | function packVector(vector, includeMetadata) {
includeMetadata = isUndefined(includeMetadata) ? true : includeMetadata;
var dtype = vector.dtype;
if (vector.dtype === 'date') {
vector = vector.toDtype('number');
}
var values = (vector.dtype !== 'number') ?
vector.values.slice() :
vector.values.map... | javascript | function packVector(vector, includeMetadata) {
includeMetadata = isUndefined(includeMetadata) ? true : includeMetadata;
var dtype = vector.dtype;
if (vector.dtype === 'date') {
vector = vector.toDtype('number');
}
var values = (vector.dtype !== 'number') ?
vector.values.slice() :
vector.values.map... | [
"function",
"packVector",
"(",
"vector",
",",
"includeMetadata",
")",
"{",
"includeMetadata",
"=",
"isUndefined",
"(",
"includeMetadata",
")",
"?",
"true",
":",
"includeMetadata",
";",
"var",
"dtype",
"=",
"vector",
".",
"dtype",
";",
"if",
"(",
"vector",
".... | Helper for packing the given vector, including metadata by default | [
"Helper",
"for",
"packing",
"the",
"given",
"vector",
"including",
"metadata",
"by",
"default"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L1070-L1088 | train |
osdat/jsdataframe | jsdataframe.js | numClose | function numClose(x, y) {
return (Number.isNaN(x) && Number.isNaN(y)) ||
Math.abs(x - y) <= 1e-7;
} | javascript | function numClose(x, y) {
return (Number.isNaN(x) && Number.isNaN(y)) ||
Math.abs(x - y) <= 1e-7;
} | [
"function",
"numClose",
"(",
"x",
",",
"y",
")",
"{",
"return",
"(",
"Number",
".",
"isNaN",
"(",
"x",
")",
"&&",
"Number",
".",
"isNaN",
"(",
"y",
")",
")",
"||",
"Math",
".",
"abs",
"(",
"x",
"-",
"y",
")",
"<=",
"1e-7",
";",
"}"
] | Returns true if x and y are within 1e-7 tolerance or are both NaN | [
"Returns",
"true",
"if",
"x",
"and",
"y",
"are",
"within",
"1e",
"-",
"7",
"tolerance",
"or",
"are",
"both",
"NaN"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L1407-L1410 | train |
osdat/jsdataframe | jsdataframe.js | appendJoinRow | function appendJoinRow(arrayCols, keyDf, leftNonKeyDf, rightNonKeyDf,
leftInd, rightInd, indicatorValue, rightIndForKey) {
var keyInd = rightIndForKey ? rightInd : leftInd;
var i, nCol;
var colInd = 0;
nCol = keyDf.nCol();
for (i = 0; i < nCol; i++) {
arrayCols[colInd].push(keyDf._cols[i].values[keyInd... | javascript | function appendJoinRow(arrayCols, keyDf, leftNonKeyDf, rightNonKeyDf,
leftInd, rightInd, indicatorValue, rightIndForKey) {
var keyInd = rightIndForKey ? rightInd : leftInd;
var i, nCol;
var colInd = 0;
nCol = keyDf.nCol();
for (i = 0; i < nCol; i++) {
arrayCols[colInd].push(keyDf._cols[i].values[keyInd... | [
"function",
"appendJoinRow",
"(",
"arrayCols",
",",
"keyDf",
",",
"leftNonKeyDf",
",",
"rightNonKeyDf",
",",
"leftInd",
",",
"rightInd",
",",
"indicatorValue",
",",
"rightIndForKey",
")",
"{",
"var",
"keyInd",
"=",
"rightIndForKey",
"?",
"rightInd",
":",
"leftIn... | Helper for appending values to "arrayCols" from "leftInd" and "rightInd" | [
"Helper",
"for",
"appending",
"values",
"to",
"arrayCols",
"from",
"leftInd",
"and",
"rightInd"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3122-L3151 | train |
osdat/jsdataframe | jsdataframe.js | keyIndexing | function keyIndexing(selector, maxLen, index) {
var opts = resolverOpts(RESOLVE_MODE.KEY, maxLen, index);
return resolveSelector(selector, opts);
} | javascript | function keyIndexing(selector, maxLen, index) {
var opts = resolverOpts(RESOLVE_MODE.KEY, maxLen, index);
return resolveSelector(selector, opts);
} | [
"function",
"keyIndexing",
"(",
"selector",
",",
"maxLen",
",",
"index",
")",
"{",
"var",
"opts",
"=",
"resolverOpts",
"(",
"RESOLVE_MODE",
".",
"KEY",
",",
"maxLen",
",",
"index",
")",
";",
"return",
"resolveSelector",
"(",
"selector",
",",
"opts",
")",
... | Perform key lookup indexing 'index' should be an AbstractIndex implementation | [
"Perform",
"key",
"lookup",
"indexing",
"index",
"should",
"be",
"an",
"AbstractIndex",
"implementation"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3367-L3370 | train |
osdat/jsdataframe | jsdataframe.js | attemptBoolIndexing | function attemptBoolIndexing(selector, maxLen) {
if (selector.type === exclusionProto.type) {
var intIdxVector = attemptBoolIndexing(selector._selector, maxLen);
return isUndefined(intIdxVector) ?
undefined :
excludeIntIndices(intIdxVector, maxLen);
}
if (Array.isArray(selector)) {
selecto... | javascript | function attemptBoolIndexing(selector, maxLen) {
if (selector.type === exclusionProto.type) {
var intIdxVector = attemptBoolIndexing(selector._selector, maxLen);
return isUndefined(intIdxVector) ?
undefined :
excludeIntIndices(intIdxVector, maxLen);
}
if (Array.isArray(selector)) {
selecto... | [
"function",
"attemptBoolIndexing",
"(",
"selector",
",",
"maxLen",
")",
"{",
"if",
"(",
"selector",
".",
"type",
"===",
"exclusionProto",
".",
"type",
")",
"{",
"var",
"intIdxVector",
"=",
"attemptBoolIndexing",
"(",
"selector",
".",
"_selector",
",",
"maxLen"... | Performs boolean indexing if 'selector' is a boolean vector or array of the same length as maxLen or an exclusion wrapping such a vector or array. Returns undefined if 'selector' is inappropriate for boolean indexing; returns a vector of integer indices if boolean indexing resolves appropriately. | [
"Performs",
"boolean",
"indexing",
"if",
"selector",
"is",
"a",
"boolean",
"vector",
"or",
"array",
"of",
"the",
"same",
"length",
"as",
"maxLen",
"or",
"an",
"exclusion",
"wrapping",
"such",
"a",
"vector",
"or",
"array",
".",
"Returns",
"undefined",
"if",
... | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3379-L3396 | train |
osdat/jsdataframe | jsdataframe.js | excludeIntIndices | function excludeIntIndices(intIdxVector, maxLen) {
return jd.seq(maxLen).isIn(intIdxVector).not().which();
} | javascript | function excludeIntIndices(intIdxVector, maxLen) {
return jd.seq(maxLen).isIn(intIdxVector).not().which();
} | [
"function",
"excludeIntIndices",
"(",
"intIdxVector",
",",
"maxLen",
")",
"{",
"return",
"jd",
".",
"seq",
"(",
"maxLen",
")",
".",
"isIn",
"(",
"intIdxVector",
")",
".",
"not",
"(",
")",
".",
"which",
"(",
")",
";",
"}"
] | Returns the integer indices resulting from excluding the intIdxVector based on the given maxLen | [
"Returns",
"the",
"integer",
"indices",
"resulting",
"from",
"excluding",
"the",
"intIdxVector",
"based",
"on",
"the",
"given",
"maxLen"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3401-L3403 | train |
osdat/jsdataframe | jsdataframe.js | resolveSelector | function resolveSelector(selector, opts) {
var resultArr = [];
resolveSelectorHelper(selector, opts, resultArr);
return newVector(resultArr, 'number');
} | javascript | function resolveSelector(selector, opts) {
var resultArr = [];
resolveSelectorHelper(selector, opts, resultArr);
return newVector(resultArr, 'number');
} | [
"function",
"resolveSelector",
"(",
"selector",
",",
"opts",
")",
"{",
"var",
"resultArr",
"=",
"[",
"]",
";",
"resolveSelectorHelper",
"(",
"selector",
",",
"opts",
",",
"resultArr",
")",
";",
"return",
"newVector",
"(",
"resultArr",
",",
"'number'",
")",
... | Resolve a selector to a vector of integer indices using the 'opts' object | [
"Resolve",
"a",
"selector",
"to",
"a",
"vector",
"of",
"integer",
"indices",
"using",
"the",
"opts",
"object"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3424-L3428 | train |
osdat/jsdataframe | jsdataframe.js | resolveSelectorHelper | function resolveSelectorHelper(selector, opts, resultArr) {
if (selector !== null && typeof selector === 'object') {
if (typeof selector._resolveSelectorHelper === 'function') {
selector._resolveSelectorHelper(opts, resultArr);
return;
}
if (Array.isArray(selector)) {
for (var i = 0; i <... | javascript | function resolveSelectorHelper(selector, opts, resultArr) {
if (selector !== null && typeof selector === 'object') {
if (typeof selector._resolveSelectorHelper === 'function') {
selector._resolveSelectorHelper(opts, resultArr);
return;
}
if (Array.isArray(selector)) {
for (var i = 0; i <... | [
"function",
"resolveSelectorHelper",
"(",
"selector",
",",
"opts",
",",
"resultArr",
")",
"{",
"if",
"(",
"selector",
"!==",
"null",
"&&",
"typeof",
"selector",
"===",
"'object'",
")",
"{",
"if",
"(",
"typeof",
"selector",
".",
"_resolveSelectorHelper",
"===",... | Recursive helper that updates running results in 'resultArr' | [
"Recursive",
"helper",
"that",
"updates",
"running",
"results",
"in",
"resultArr"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3430-L3475 | train |
osdat/jsdataframe | jsdataframe.js | resolveRangeBound | function resolveRangeBound(bound, opts, isStop, includeStop) {
var result;
if (isUndefined(bound)) {
return isStop ? opts.maxLen : 0;
}
var useIntIndexing = (
opts.resolveMode === RESOLVE_MODE.INT ||
(opts.resolveMode === RESOLVE_MODE.COL && typeof bound === 'number')
);
if (includeStop === null... | javascript | function resolveRangeBound(bound, opts, isStop, includeStop) {
var result;
if (isUndefined(bound)) {
return isStop ? opts.maxLen : 0;
}
var useIntIndexing = (
opts.resolveMode === RESOLVE_MODE.INT ||
(opts.resolveMode === RESOLVE_MODE.COL && typeof bound === 'number')
);
if (includeStop === null... | [
"function",
"resolveRangeBound",
"(",
"bound",
",",
"opts",
",",
"isStop",
",",
"includeStop",
")",
"{",
"var",
"result",
";",
"if",
"(",
"isUndefined",
"(",
"bound",
")",
")",
"{",
"return",
"isStop",
"?",
"opts",
".",
"maxLen",
":",
"0",
";",
"}",
... | Returns the resolved integer index for the bound | [
"Returns",
"the",
"resolved",
"integer",
"index",
"for",
"the",
"bound"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3553-L3585 | train |
osdat/jsdataframe | jsdataframe.js | resolveIntIdx | function resolveIntIdx(inputInt, maxLen, checkBounds) {
if (isUndefined(checkBounds)) {
checkBounds = true;
}
if (!Number.isInteger(inputInt)) {
throw new Error('expected integer selector for integer indexing ' +
'but got non-integer: ' + inputInt);
}
var result = inputInt < 0 ? maxLen + inputIn... | javascript | function resolveIntIdx(inputInt, maxLen, checkBounds) {
if (isUndefined(checkBounds)) {
checkBounds = true;
}
if (!Number.isInteger(inputInt)) {
throw new Error('expected integer selector for integer indexing ' +
'but got non-integer: ' + inputInt);
}
var result = inputInt < 0 ? maxLen + inputIn... | [
"function",
"resolveIntIdx",
"(",
"inputInt",
",",
"maxLen",
",",
"checkBounds",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"checkBounds",
")",
")",
"{",
"checkBounds",
"=",
"true",
";",
"}",
"if",
"(",
"!",
"Number",
".",
"isInteger",
"(",
"inputInt",
")"... | Uses 'maxLen' to compute the integer index for 'inputInt' or throws an error if invalid. 'checkBounds' is true by default but if false, the resulting integer index won't be checked. | [
"Uses",
"maxLen",
"to",
"compute",
"the",
"integer",
"index",
"for",
"inputInt",
"or",
"throws",
"an",
"error",
"if",
"invalid",
".",
"checkBounds",
"is",
"true",
"by",
"default",
"but",
"if",
"false",
"the",
"resulting",
"integer",
"index",
"won",
"t",
"b... | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3615-L3628 | train |
osdat/jsdataframe | jsdataframe.js | processLookupResults | function processLookupResults(intInds, key, opts, resultArr) {
if (intInds === null) {
if (opts.resolveMode === RESOLVE_MODE.COL) {
throw new Error('could not find column named "' + key + '"');
} else {
throw new Error('could find entry for key: ' + key);
}
} else if (typeof intInds === 'num... | javascript | function processLookupResults(intInds, key, opts, resultArr) {
if (intInds === null) {
if (opts.resolveMode === RESOLVE_MODE.COL) {
throw new Error('could not find column named "' + key + '"');
} else {
throw new Error('could find entry for key: ' + key);
}
} else if (typeof intInds === 'num... | [
"function",
"processLookupResults",
"(",
"intInds",
",",
"key",
",",
"opts",
",",
"resultArr",
")",
"{",
"if",
"(",
"intInds",
"===",
"null",
")",
"{",
"if",
"(",
"opts",
".",
"resolveMode",
"===",
"RESOLVE_MODE",
".",
"COL",
")",
"{",
"throw",
"new",
... | Processes 'intInds', the result returned from lookup via an AbstractIndex. Results are placed in 'resultArr' if present, or an error is thrown. | [
"Processes",
"intInds",
"the",
"result",
"returned",
"from",
"lookup",
"via",
"an",
"AbstractIndex",
".",
"Results",
"are",
"placed",
"in",
"resultArr",
"if",
"present",
"or",
"an",
"error",
"is",
"thrown",
"."
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3633-L3647 | train |
osdat/jsdataframe | jsdataframe.js | singleColNameLookup | function singleColNameLookup(selector, colNames) {
if (isUndefined(selector)) {
throw new Error('selector must not be undefined');
}
selector = ensureScalar(selector);
if (isNumber(selector)) {
return resolveIntIdx(selector, colNames.values.length);
} else if (isString(selector) || selector === null) ... | javascript | function singleColNameLookup(selector, colNames) {
if (isUndefined(selector)) {
throw new Error('selector must not be undefined');
}
selector = ensureScalar(selector);
if (isNumber(selector)) {
return resolveIntIdx(selector, colNames.values.length);
} else if (isString(selector) || selector === null) ... | [
"function",
"singleColNameLookup",
"(",
"selector",
",",
"colNames",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"selector",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'selector must not be undefined'",
")",
";",
"}",
"selector",
"=",
"ensureScalar",
"(",
"sel... | Returns the integer index of the first occurrence of a single column name or throws an error if 'selector' is invalid or no occurrence is found. 'selector' can be a single integer or string expressed as a scalar, array, or vector. 'colNames' must be a string vector | [
"Returns",
"the",
"integer",
"index",
"of",
"the",
"first",
"occurrence",
"of",
"a",
"single",
"column",
"name",
"or",
"throws",
"an",
"error",
"if",
"selector",
"is",
"invalid",
"or",
"no",
"occurrence",
"is",
"found",
".",
"selector",
"can",
"be",
"a",
... | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3654-L3673 | train |
osdat/jsdataframe | jsdataframe.js | cleanKey | function cleanKey(key, dtype) {
return (
key === null ? ESCAPED_KEYS.null :
isUndefined(key) ? ESCAPED_KEYS.undefined :
dtype === 'date' ? key.valueOf() :
key
);
} | javascript | function cleanKey(key, dtype) {
return (
key === null ? ESCAPED_KEYS.null :
isUndefined(key) ? ESCAPED_KEYS.undefined :
dtype === 'date' ? key.valueOf() :
key
);
} | [
"function",
"cleanKey",
"(",
"key",
",",
"dtype",
")",
"{",
"return",
"(",
"key",
"===",
"null",
"?",
"ESCAPED_KEYS",
".",
"null",
":",
"isUndefined",
"(",
"key",
")",
"?",
"ESCAPED_KEYS",
".",
"undefined",
":",
"dtype",
"===",
"'date'",
"?",
"key",
".... | Returns a clean version of the given 'key', transforming if the dtype doesn't hash well directly and escaping if necessary to avoid collisions for missing values | [
"Returns",
"a",
"clean",
"version",
"of",
"the",
"given",
"key",
"transforming",
"if",
"the",
"dtype",
"doesn",
"t",
"hash",
"well",
"directly",
"and",
"escaping",
"if",
"necessary",
"to",
"avoid",
"collisions",
"for",
"missing",
"values"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3845-L3852 | train |
osdat/jsdataframe | jsdataframe.js | newVector | function newVector(array, dtype) {
validateDtype(dtype);
var proto = PROTO_MAP[dtype];
var vector = Object.create(proto);
vector._init(array);
return vector;
} | javascript | function newVector(array, dtype) {
validateDtype(dtype);
var proto = PROTO_MAP[dtype];
var vector = Object.create(proto);
vector._init(array);
return vector;
} | [
"function",
"newVector",
"(",
"array",
",",
"dtype",
")",
"{",
"validateDtype",
"(",
"dtype",
")",
";",
"var",
"proto",
"=",
"PROTO_MAP",
"[",
"dtype",
"]",
";",
"var",
"vector",
"=",
"Object",
".",
"create",
"(",
"proto",
")",
";",
"vector",
".",
"_... | Constructs a vector of the given dtype backed by the given array without checking or modifying any of the array elements | [
"Constructs",
"a",
"vector",
"of",
"the",
"given",
"dtype",
"backed",
"by",
"the",
"given",
"array",
"without",
"checking",
"or",
"modifying",
"any",
"of",
"the",
"array",
"elements"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3977-L3983 | train |
osdat/jsdataframe | jsdataframe.js | mapNonNa | function mapNonNa(array, naValue, func) {
var len = array.length;
var result = allocArray(len);
for (var i = 0; i < len; i++) {
var value = array[i];
result[i] = isMissing(value) ? naValue : func(value);
}
return result;
} | javascript | function mapNonNa(array, naValue, func) {
var len = array.length;
var result = allocArray(len);
for (var i = 0; i < len; i++) {
var value = array[i];
result[i] = isMissing(value) ? naValue : func(value);
}
return result;
} | [
"function",
"mapNonNa",
"(",
"array",
",",
"naValue",
",",
"func",
")",
"{",
"var",
"len",
"=",
"array",
".",
"length",
";",
"var",
"result",
"=",
"allocArray",
"(",
"len",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
... | Maps the 'func' on all non-missing elements of array while immediately yielding 'naValue' instead of applying 'func' for any missing elements. The returned result will be a new array of the same length as 'array'. | [
"Maps",
"the",
"func",
"on",
"all",
"non",
"-",
"missing",
"elements",
"of",
"array",
"while",
"immediately",
"yielding",
"naValue",
"instead",
"of",
"applying",
"func",
"for",
"any",
"missing",
"elements",
".",
"The",
"returned",
"result",
"will",
"be",
"a"... | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L3989-L3997 | train |
osdat/jsdataframe | jsdataframe.js | reduceNonNa | function reduceNonNa(array, initValue, func) {
var result = initValue;
for (var i = 0; i < array.length; i++) {
var value = array[i];
if (!isMissing(value)) {
result = func(result, value);
}
}
return result;
} | javascript | function reduceNonNa(array, initValue, func) {
var result = initValue;
for (var i = 0; i < array.length; i++) {
var value = array[i];
if (!isMissing(value)) {
result = func(result, value);
}
}
return result;
} | [
"function",
"reduceNonNa",
"(",
"array",
",",
"initValue",
",",
"func",
")",
"{",
"var",
"result",
"=",
"initValue",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"value",
"=",
"arr... | Performs a left-to-right reduce on 'array' using 'func' starting with 'initValue' while skipping over any missing values. If there are no non-missing values then the result is simply 'initValue'. | [
"Performs",
"a",
"left",
"-",
"to",
"-",
"right",
"reduce",
"on",
"array",
"using",
"func",
"starting",
"with",
"initValue",
"while",
"skipping",
"over",
"any",
"missing",
"values",
".",
"If",
"there",
"are",
"no",
"non",
"-",
"missing",
"values",
"then",
... | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L4004-L4013 | train |
osdat/jsdataframe | jsdataframe.js | reduceUnless | function reduceUnless(array, initValue, condFunc, func) {
var result = initValue;
for (var i = 0; i < array.length; i++) {
var value = array[i];
if (condFunc(value)) {
return value;
}
result = func(result, value);
}
return result;
} | javascript | function reduceUnless(array, initValue, condFunc, func) {
var result = initValue;
for (var i = 0; i < array.length; i++) {
var value = array[i];
if (condFunc(value)) {
return value;
}
result = func(result, value);
}
return result;
} | [
"function",
"reduceUnless",
"(",
"array",
",",
"initValue",
",",
"condFunc",
",",
"func",
")",
"{",
"var",
"result",
"=",
"initValue",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
... | Performs a left-to-right reduce on 'array' using 'func' starting with 'initValue' unless there's an element for which 'condFunc' returns truthy, in which case this element is immediately returned, halting the rest of the reduction. For an empty array 'initValue' is immediaately returned. | [
"Performs",
"a",
"left",
"-",
"to",
"-",
"right",
"reduce",
"on",
"array",
"using",
"func",
"starting",
"with",
"initValue",
"unless",
"there",
"s",
"an",
"element",
"for",
"which",
"condFunc",
"returns",
"truthy",
"in",
"which",
"case",
"this",
"element",
... | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L4021-L4031 | train |
osdat/jsdataframe | jsdataframe.js | combineArrays | function combineArrays(array1, array2, naValue, func) {
var skipMissing = true;
if (isUndefined(func)) {
func = naValue;
skipMissing = false;
}
var arr1Len = array1.length;
var arr2Len = array2.length;
var outputLen = validateArrayLengths(arr1Len, arr2Len);
var isSingleton1 = (arr1Len === 1);
v... | javascript | function combineArrays(array1, array2, naValue, func) {
var skipMissing = true;
if (isUndefined(func)) {
func = naValue;
skipMissing = false;
}
var arr1Len = array1.length;
var arr2Len = array2.length;
var outputLen = validateArrayLengths(arr1Len, arr2Len);
var isSingleton1 = (arr1Len === 1);
v... | [
"function",
"combineArrays",
"(",
"array1",
",",
"array2",
",",
"naValue",
",",
"func",
")",
"{",
"var",
"skipMissing",
"=",
"true",
";",
"if",
"(",
"isUndefined",
"(",
"func",
")",
")",
"{",
"func",
"=",
"naValue",
";",
"skipMissing",
"=",
"false",
";... | Applies the given 'func' to each pair of elements from the 2 given arrays and yields a new array with the results. The lengths of the input arrays must either be identical or one of the arrays must have length 1, in which case that single value will be repeated for the length of the other array. The 'naValue' argument... | [
"Applies",
"the",
"given",
"func",
"to",
"each",
"pair",
"of",
"elements",
"from",
"the",
"2",
"given",
"arrays",
"and",
"yields",
"a",
"new",
"array",
"with",
"the",
"results",
".",
"The",
"lengths",
"of",
"the",
"input",
"arrays",
"must",
"either",
"be... | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L4043-L4067 | train |
osdat/jsdataframe | jsdataframe.js | cumulativeReduce | function cumulativeReduce(array, naValue, func) {
var skipMissing = false;
if (isUndefined(func)) {
func = naValue;
skipMissing = true;
}
var outputLen = array.length;
var result = allocArray(outputLen);
var accumulatedVal = null;
var foundNonMissing = false;
for (var i = 0; i < outputLen; i++... | javascript | function cumulativeReduce(array, naValue, func) {
var skipMissing = false;
if (isUndefined(func)) {
func = naValue;
skipMissing = true;
}
var outputLen = array.length;
var result = allocArray(outputLen);
var accumulatedVal = null;
var foundNonMissing = false;
for (var i = 0; i < outputLen; i++... | [
"function",
"cumulativeReduce",
"(",
"array",
",",
"naValue",
",",
"func",
")",
"{",
"var",
"skipMissing",
"=",
"false",
";",
"if",
"(",
"isUndefined",
"(",
"func",
")",
")",
"{",
"func",
"=",
"naValue",
";",
"skipMissing",
"=",
"true",
";",
"}",
"var"... | Applies the given 'func' to reduce each element in 'array', returning the cumulative results in a new array. The 'naValue' argument is optional. Any missing value will result in a corresponding missing element in the output, but if 'naValue' isn't specified, the 'func' reduction will still be carried out on subsequen... | [
"Applies",
"the",
"given",
"func",
"to",
"reduce",
"each",
"element",
"in",
"array",
"returning",
"the",
"cumulative",
"results",
"in",
"a",
"new",
"array",
".",
"The",
"naValue",
"argument",
"is",
"optional",
".",
"Any",
"missing",
"value",
"will",
"result"... | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L4122-L4154 | train |
osdat/jsdataframe | jsdataframe.js | subsetArray | function subsetArray(array, intIdx) {
var result = allocArray(intIdx.length);
for (var i = 0; i < intIdx.length; i++) {
result[i] = array[intIdx[i]];
}
return result;
} | javascript | function subsetArray(array, intIdx) {
var result = allocArray(intIdx.length);
for (var i = 0; i < intIdx.length; i++) {
result[i] = array[intIdx[i]];
}
return result;
} | [
"function",
"subsetArray",
"(",
"array",
",",
"intIdx",
")",
"{",
"var",
"result",
"=",
"allocArray",
"(",
"intIdx",
".",
"length",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"intIdx",
".",
"length",
";",
"i",
"++",
")",
"{",
"res... | Uses the integer indexes in 'intIdx' to subset 'array', returning the results. All indices in 'intIdx' are assumed to be in bounds. | [
"Uses",
"the",
"integer",
"indexes",
"in",
"intIdx",
"to",
"subset",
"array",
"returning",
"the",
"results",
".",
"All",
"indices",
"in",
"intIdx",
"are",
"assumed",
"to",
"be",
"in",
"bounds",
"."
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L4159-L4165 | train |
osdat/jsdataframe | jsdataframe.js | enforceVectorDtype | function enforceVectorDtype(array, dtype) {
validateDtype(dtype);
var coerceFunc = COERCE_FUNC[dtype];
// Coerce all elements to dtype
for (var i = 0; i < array.length; i++) {
array[i] = coerceFunc(array[i]);
}
// Construct vector
return newVector(array, dtype);
} | javascript | function enforceVectorDtype(array, dtype) {
validateDtype(dtype);
var coerceFunc = COERCE_FUNC[dtype];
// Coerce all elements to dtype
for (var i = 0; i < array.length; i++) {
array[i] = coerceFunc(array[i]);
}
// Construct vector
return newVector(array, dtype);
} | [
"function",
"enforceVectorDtype",
"(",
"array",
",",
"dtype",
")",
"{",
"validateDtype",
"(",
"dtype",
")",
";",
"var",
"coerceFunc",
"=",
"COERCE_FUNC",
"[",
"dtype",
"]",
";",
"// Coerce all elements to dtype",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
... | Creates a new vector backed by the given array after coercing each element to the given dtype. | [
"Creates",
"a",
"new",
"vector",
"backed",
"by",
"the",
"given",
"array",
"after",
"coercing",
"each",
"element",
"to",
"the",
"given",
"dtype",
"."
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L4268-L4279 | train |
osdat/jsdataframe | jsdataframe.js | argSort | function argSort(vectors, ascending) {
if (vectors.length !== ascending.length) {
throw new Error('length of "ascending" must match the number of ' +
'sort columns');
}
if (vectors.length === 0) {
return null;
}
var nRow = vectors[0].size();
var result = allocArray(nRow);
for (var i = 0; i <... | javascript | function argSort(vectors, ascending) {
if (vectors.length !== ascending.length) {
throw new Error('length of "ascending" must match the number of ' +
'sort columns');
}
if (vectors.length === 0) {
return null;
}
var nRow = vectors[0].size();
var result = allocArray(nRow);
for (var i = 0; i <... | [
"function",
"argSort",
"(",
"vectors",
",",
"ascending",
")",
"{",
"if",
"(",
"vectors",
".",
"length",
"!==",
"ascending",
".",
"length",
")",
"{",
"throw",
"new",
"Error",
"(",
"'length of \"ascending\" must match the number of '",
"+",
"'sort columns'",
")",
... | Returns an array of integer indices that would sort the given array of vectors, starting with the first vector, then the second, etc. "ascending" must be an array of booleans with the same length as "vectors". Returns null if "vectors" is empty. | [
"Returns",
"an",
"array",
"of",
"integer",
"indices",
"that",
"would",
"sort",
"the",
"given",
"array",
"of",
"vectors",
"starting",
"with",
"the",
"first",
"vector",
"then",
"the",
"second",
"etc",
".",
"ascending",
"must",
"be",
"an",
"array",
"of",
"boo... | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L4443-L4477 | train |
osdat/jsdataframe | jsdataframe.js | validateArrayLengths | function validateArrayLengths(len1, len2) {
var outputLen = len1;
if (len1 !== len2) {
if (len1 === 1) {
outputLen = len2;
} else if (len2 !== 1) {
throw new Error('incompatible array lengths: ' + len1 + ' and ' +
len2);
}
}
return outputLen;
} | javascript | function validateArrayLengths(len1, len2) {
var outputLen = len1;
if (len1 !== len2) {
if (len1 === 1) {
outputLen = len2;
} else if (len2 !== 1) {
throw new Error('incompatible array lengths: ' + len1 + ' and ' +
len2);
}
}
return outputLen;
} | [
"function",
"validateArrayLengths",
"(",
"len1",
",",
"len2",
")",
"{",
"var",
"outputLen",
"=",
"len1",
";",
"if",
"(",
"len1",
"!==",
"len2",
")",
"{",
"if",
"(",
"len1",
"===",
"1",
")",
"{",
"outputLen",
"=",
"len2",
";",
"}",
"else",
"if",
"("... | Returns the compatible output vector length for element-wise operation on vectors of length 'len1' and 'len2' or throws an error if incompatible | [
"Returns",
"the",
"compatible",
"output",
"vector",
"length",
"for",
"element",
"-",
"wise",
"operation",
"on",
"vectors",
"of",
"length",
"len1",
"and",
"len2",
"or",
"throws",
"an",
"error",
"if",
"incompatible"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L4559-L4570 | train |
osdat/jsdataframe | jsdataframe.js | ensureScalar | function ensureScalar(value) {
if (isUndefined(value) || value === null) {
return value;
}
var length = 1;
var description = 'a scalar';
if (value.type === vectorProto.type) {
length = value.size();
value = value.values[0];
description = 'a vector';
} else if (Array.isArray(value)) {
len... | javascript | function ensureScalar(value) {
if (isUndefined(value) || value === null) {
return value;
}
var length = 1;
var description = 'a scalar';
if (value.type === vectorProto.type) {
length = value.size();
value = value.values[0];
description = 'a vector';
} else if (Array.isArray(value)) {
len... | [
"function",
"ensureScalar",
"(",
"value",
")",
"{",
"if",
"(",
"isUndefined",
"(",
"value",
")",
"||",
"value",
"===",
"null",
")",
"{",
"return",
"value",
";",
"}",
"var",
"length",
"=",
"1",
";",
"var",
"description",
"=",
"'a scalar'",
";",
"if",
... | If value is a vector or array, this function will return the single scalar value contained or throw an error if the length is not 1. If value isn't a vector or array, it is simply returned. | [
"If",
"value",
"is",
"a",
"vector",
"or",
"array",
"this",
"function",
"will",
"return",
"the",
"single",
"scalar",
"value",
"contained",
"or",
"throw",
"an",
"error",
"if",
"the",
"length",
"is",
"not",
"1",
".",
"If",
"value",
"isn",
"t",
"a",
"vecto... | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L4575-L4595 | train |
osdat/jsdataframe | jsdataframe.js | ensureVector | function ensureVector(values, defaultDtype) {
if (isMissing(values) || values.type !== vectorProto.type) {
values = Array.isArray(values) ?
inferVectorDtype(values.slice(), defaultDtype) :
inferVectorDtype([values], defaultDtype);
}
return values;
} | javascript | function ensureVector(values, defaultDtype) {
if (isMissing(values) || values.type !== vectorProto.type) {
values = Array.isArray(values) ?
inferVectorDtype(values.slice(), defaultDtype) :
inferVectorDtype([values], defaultDtype);
}
return values;
} | [
"function",
"ensureVector",
"(",
"values",
",",
"defaultDtype",
")",
"{",
"if",
"(",
"isMissing",
"(",
"values",
")",
"||",
"values",
".",
"type",
"!==",
"vectorProto",
".",
"type",
")",
"{",
"values",
"=",
"Array",
".",
"isArray",
"(",
"values",
")",
... | Returns a vector representing the given values, which can be either a vector, array, or scalar. If already a vector, this vector is simply returned. If an array, it's converted to a vector with inferred dtype. If a scalar, it's wrapped in an array and converted to a vector also. The defaultDtype is used only if all val... | [
"Returns",
"a",
"vector",
"representing",
"the",
"given",
"values",
"which",
"can",
"be",
"either",
"a",
"vector",
"array",
"or",
"scalar",
".",
"If",
"already",
"a",
"vector",
"this",
"vector",
"is",
"simply",
"returned",
".",
"If",
"an",
"array",
"it",
... | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L4604-L4611 | train |
osdat/jsdataframe | jsdataframe.js | ensureStringVector | function ensureStringVector(values) {
values = ensureVector(values, 'string');
return (values.dtype !== 'string') ?
values.toDtype('string') :
values;
} | javascript | function ensureStringVector(values) {
values = ensureVector(values, 'string');
return (values.dtype !== 'string') ?
values.toDtype('string') :
values;
} | [
"function",
"ensureStringVector",
"(",
"values",
")",
"{",
"values",
"=",
"ensureVector",
"(",
"values",
",",
"'string'",
")",
";",
"return",
"(",
"values",
".",
"dtype",
"!==",
"'string'",
")",
"?",
"values",
".",
"toDtype",
"(",
"'string'",
")",
":",
"... | Like 'ensureVector', but converts the result to 'string' dtype if necessary | [
"Like",
"ensureVector",
"but",
"converts",
"the",
"result",
"to",
"string",
"dtype",
"if",
"necessary"
] | d9f2028b33f9565c92329ccbca8c0fc1e865d97e | https://github.com/osdat/jsdataframe/blob/d9f2028b33f9565c92329ccbca8c0fc1e865d97e/jsdataframe.js#L4615-L4620 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | extractMessages | function extractMessages(nodes, interpolationConfig, implicitTags, implicitAttrs) {
var visitor = new _Visitor(implicitTags, implicitAttrs);
return visitor.extract(nodes, interpolationConfig);
} | javascript | function extractMessages(nodes, interpolationConfig, implicitTags, implicitAttrs) {
var visitor = new _Visitor(implicitTags, implicitAttrs);
return visitor.extract(nodes, interpolationConfig);
} | [
"function",
"extractMessages",
"(",
"nodes",
",",
"interpolationConfig",
",",
"implicitTags",
",",
"implicitAttrs",
")",
"{",
"var",
"visitor",
"=",
"new",
"_Visitor",
"(",
"implicitTags",
",",
"implicitAttrs",
")",
";",
"return",
"visitor",
".",
"extract",
"(",... | Extract translatable messages from an html AST | [
"Extract",
"translatable",
"messages",
"from",
"an",
"html",
"AST"
] | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L6249-L6252 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | extractPlaceholderToIds | function extractPlaceholderToIds(messageBundle) {
var messageMap = messageBundle.getMessageMap();
var placeholderToIds = {};
Object.keys(messageMap).forEach(function (msgId) {
placeholderToIds[msgId] = messageMap[msgId].placeholderToMsgIds;
});
return placeholderToIds;
} | javascript | function extractPlaceholderToIds(messageBundle) {
var messageMap = messageBundle.getMessageMap();
var placeholderToIds = {};
Object.keys(messageMap).forEach(function (msgId) {
placeholderToIds[msgId] = messageMap[msgId].placeholderToMsgIds;
});
return placeholderToIds;
} | [
"function",
"extractPlaceholderToIds",
"(",
"messageBundle",
")",
"{",
"var",
"messageMap",
"=",
"messageBundle",
".",
"getMessageMap",
"(",
")",
";",
"var",
"placeholderToIds",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"messageMap",
")",
".",
"forEach",... | Generate a map of placeholder to message ids indexed by message ids | [
"Generate",
"a",
"map",
"of",
"placeholder",
"to",
"message",
"ids",
"indexed",
"by",
"message",
"ids"
] | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L6728-L6735 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | extractStyleUrls | function extractStyleUrls(resolver, baseUrl, cssText) {
var foundUrls = [];
var modifiedCssText = cssText.replace(_cssImportRe, function () {
var m = [];
for (var _i = 0; _i < arguments.length; _i++) {
m[_i - 0] = arguments[_i];
}
var url = m[1] |... | javascript | function extractStyleUrls(resolver, baseUrl, cssText) {
var foundUrls = [];
var modifiedCssText = cssText.replace(_cssImportRe, function () {
var m = [];
for (var _i = 0; _i < arguments.length; _i++) {
m[_i - 0] = arguments[_i];
}
var url = m[1] |... | [
"function",
"extractStyleUrls",
"(",
"resolver",
",",
"baseUrl",
",",
"cssText",
")",
"{",
"var",
"foundUrls",
"=",
"[",
"]",
";",
"var",
"modifiedCssText",
"=",
"cssText",
".",
"replace",
"(",
"_cssImportRe",
",",
"function",
"(",
")",
"{",
"var",
"m",
... | Rewrites stylesheets by resolving and removing the @import urls that
are either relative or don't have a `package:` scheme | [
"Rewrites",
"stylesheets",
"by",
"resolving",
"and",
"removing",
"the"
] | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L8328-L8344 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | createPlatform | function createPlatform(injector) {
if (_platform && !_platform.destroyed) {
throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
}
_platform = injector.get(PlatformRef);
var inits = injector.get(PLATFORM_INITIALIZER, null);
... | javascript | function createPlatform(injector) {
if (_platform && !_platform.destroyed) {
throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
}
_platform = injector.get(PlatformRef);
var inits = injector.get(PLATFORM_INITIALIZER, null);
... | [
"function",
"createPlatform",
"(",
"injector",
")",
"{",
"if",
"(",
"_platform",
"&&",
"!",
"_platform",
".",
"destroyed",
")",
"{",
"throw",
"new",
"Error",
"(",
"'There can be only one platform. Destroy the previous one to create a new one.'",
")",
";",
"}",
"_platf... | Creates a platform.
Platforms have to be eagerly created via this function.
@experimental APIs related to application bootstrap are currently under review. | [
"Creates",
"a",
"platform",
".",
"Platforms",
"have",
"to",
"be",
"eagerly",
"created",
"via",
"this",
"function",
"."
] | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L24310-L24319 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | concat | function concat() {
var observables = [];
for (var _i = 0; _i < arguments.length; _i++) {
observables[_i - 0] = arguments[_i];
}
return concatStatic.apply(void 0, [this].concat(observables));
} | javascript | function concat() {
var observables = [];
for (var _i = 0; _i < arguments.length; _i++) {
observables[_i - 0] = arguments[_i];
}
return concatStatic.apply(void 0, [this].concat(observables));
} | [
"function",
"concat",
"(",
")",
"{",
"var",
"observables",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"0",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"observables",
"[",
"_i",
"-",
"0",
"]",
"=",
"arguments",
... | Creates an output Observable which sequentially emits all values from every
given input Observable after the current Observable.
<span class="informal">Concatenates multiple Observables together by
sequentially emitting their values, one Observable after the other.</span>
<img src="./img/concat.png" width="100%">
Jo... | [
"Creates",
"an",
"output",
"Observable",
"which",
"sequentially",
"emits",
"all",
"values",
"from",
"every",
"given",
"input",
"Observable",
"after",
"the",
"current",
"Observable",
"."
] | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L38141-L38147 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | merge | function merge() {
var observables = [];
for (var _i = 0; _i < arguments.length; _i++) {
observables[_i - 0] = arguments[_i];
}
observables.unshift(this);
return mergeStatic.apply(this, observables);
} | javascript | function merge() {
var observables = [];
for (var _i = 0; _i < arguments.length; _i++) {
observables[_i - 0] = arguments[_i];
}
observables.unshift(this);
return mergeStatic.apply(this, observables);
} | [
"function",
"merge",
"(",
")",
"{",
"var",
"observables",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"0",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"observables",
"[",
"_i",
"-",
"0",
"]",
"=",
"arguments",
"... | Creates an output Observable which concurrently emits all values from every
given input Observable.
<span class="informal">Flattens multiple Observables together by blending
their values into one Observable.</span>
<img src="./img/merge.png" width="100%">
`merge` subscribes to each given input Observable (either the... | [
"Creates",
"an",
"output",
"Observable",
"which",
"concurrently",
"emits",
"all",
"values",
"from",
"every",
"given",
"input",
"Observable",
"."
] | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L40234-L40241 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | race | function race() {
var observables = [];
for (var _i = 0; _i < arguments.length; _i++) {
observables[_i - 0] = arguments[_i];
}
// if the only argument is an array, it was most likely called with
// `pair([obs1, obs2, ...])`
if (observables.length === 1 && isArray_1.isArray(observa... | javascript | function race() {
var observables = [];
for (var _i = 0; _i < arguments.length; _i++) {
observables[_i - 0] = arguments[_i];
}
// if the only argument is an array, it was most likely called with
// `pair([obs1, obs2, ...])`
if (observables.length === 1 && isArray_1.isArray(observa... | [
"function",
"race",
"(",
")",
"{",
"var",
"observables",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"0",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"observables",
"[",
"_i",
"-",
"0",
"]",
"=",
"arguments",
"[... | Returns an Observable that mirrors the first source Observable to emit an item
from the combination of this Observable and supplied Observables
@param {...Observables} ...observables sources used to race for which Observable emits first.
@return {Observable} an Observable that mirrors the output of the first Observable... | [
"Returns",
"an",
"Observable",
"that",
"mirrors",
"the",
"first",
"source",
"Observable",
"to",
"emit",
"an",
"item",
"from",
"the",
"combination",
"of",
"this",
"Observable",
"and",
"supplied",
"Observables"
] | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L40347-L40359 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | mergeMapTo | function mergeMapTo(innerObservable, resultSelector, concurrent) {
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
if (typeof resultSelector === 'number') {
concurrent = resultSelector;
resultSelector = null;
}
return this.lift(new MergeMapToOperator(innerObse... | javascript | function mergeMapTo(innerObservable, resultSelector, concurrent) {
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
if (typeof resultSelector === 'number') {
concurrent = resultSelector;
resultSelector = null;
}
return this.lift(new MergeMapToOperator(innerObse... | [
"function",
"mergeMapTo",
"(",
"innerObservable",
",",
"resultSelector",
",",
"concurrent",
")",
"{",
"if",
"(",
"concurrent",
"===",
"void",
"0",
")",
"{",
"concurrent",
"=",
"Number",
".",
"POSITIVE_INFINITY",
";",
"}",
"if",
"(",
"typeof",
"resultSelector",... | Projects each source value to the same Observable which is merged multiple
times in the output Observable.
<span class="informal">It's like {@link mergeMap}, but maps each value always
to the same inner Observable.</span>
<img src="./img/mergeMapTo.png" width="100%">
Maps each source value to the given Observable `i... | [
"Projects",
"each",
"source",
"value",
"to",
"the",
"same",
"Observable",
"which",
"is",
"merged",
"multiple",
"times",
"in",
"the",
"output",
"Observable",
"."
] | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L43823-L43830 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | delay | function delay(delay, scheduler) {
if (scheduler === void 0) { scheduler = async_1.async; }
var absoluteDelay = isDate_1.isDate(delay);
var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay);
return this.lift(new DelayOperator(delayFor, scheduler));
} | javascript | function delay(delay, scheduler) {
if (scheduler === void 0) { scheduler = async_1.async; }
var absoluteDelay = isDate_1.isDate(delay);
var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay);
return this.lift(new DelayOperator(delayFor, scheduler));
} | [
"function",
"delay",
"(",
"delay",
",",
"scheduler",
")",
"{",
"if",
"(",
"scheduler",
"===",
"void",
"0",
")",
"{",
"scheduler",
"=",
"async_1",
".",
"async",
";",
"}",
"var",
"absoluteDelay",
"=",
"isDate_1",
".",
"isDate",
"(",
"delay",
")",
";",
... | Delays the emission of items from the source Observable by a given timeout or
until a given Date.
<span class="informal">Time shifts each item by some specified amount of
milliseconds.</span>
<img src="./img/delay.png" width="100%">
If the delay argument is a Number, this operator time shifts the source
Observable b... | [
"Delays",
"the",
"emission",
"of",
"items",
"from",
"the",
"source",
"Observable",
"by",
"a",
"given",
"timeout",
"or",
"until",
"a",
"given",
"Date",
"."
] | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L44562-L44567 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | distinctKey | function distinctKey(key, compare, flushes) {
return distinct_1.distinct.call(this, function (x, y) {
if (compare) {
return compare(x[key], y[key]);
}
return x[key] === y[key];
}, flushes);
} | javascript | function distinctKey(key, compare, flushes) {
return distinct_1.distinct.call(this, function (x, y) {
if (compare) {
return compare(x[key], y[key]);
}
return x[key] === y[key];
}, flushes);
} | [
"function",
"distinctKey",
"(",
"key",
",",
"compare",
",",
"flushes",
")",
"{",
"return",
"distinct_1",
".",
"distinct",
".",
"call",
"(",
"this",
",",
"function",
"(",
"x",
",",
"y",
")",
"{",
"if",
"(",
"compare",
")",
"{",
"return",
"compare",
"(... | Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from previous items,
using a property accessed by using the key provided to check if the two items are distinct.
If a comparator function is provided, then it will be called for each item to test for whether or n... | [
"Returns",
"an",
"Observable",
"that",
"emits",
"all",
"items",
"emitted",
"by",
"the",
"source",
"Observable",
"that",
"are",
"distinct",
"by",
"comparison",
"from",
"previous",
"items",
"using",
"a",
"property",
"accessed",
"by",
"using",
"the",
"key",
"prov... | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L44982-L44989 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | distinctUntilKeyChanged | function distinctUntilKeyChanged(key, compare) {
return distinctUntilChanged_1.distinctUntilChanged.call(this, function (x, y) {
if (compare) {
return compare(x[key], y[key]);
}
return x[key] === y[key];
});
} | javascript | function distinctUntilKeyChanged(key, compare) {
return distinctUntilChanged_1.distinctUntilChanged.call(this, function (x, y) {
if (compare) {
return compare(x[key], y[key]);
}
return x[key] === y[key];
});
} | [
"function",
"distinctUntilKeyChanged",
"(",
"key",
",",
"compare",
")",
"{",
"return",
"distinctUntilChanged_1",
".",
"distinctUntilChanged",
".",
"call",
"(",
"this",
",",
"function",
"(",
"x",
",",
"y",
")",
"{",
"if",
"(",
"compare",
")",
"{",
"return",
... | Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item,
using a property accessed by using the key provided to check if the two items are distinct.
If a comparator function is provided, then it will be called for each item to test for whether o... | [
"Returns",
"an",
"Observable",
"that",
"emits",
"all",
"items",
"emitted",
"by",
"the",
"source",
"Observable",
"that",
"are",
"distinct",
"by",
"comparison",
"from",
"the",
"previous",
"item",
"using",
"a",
"property",
"accessed",
"by",
"using",
"the",
"key",... | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L45112-L45119 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | find | function find(predicate, thisArg) {
if (typeof predicate !== 'function') {
throw new TypeError('predicate is not a function');
}
return this.lift(new FindValueOperator(predicate, this, false, thisArg));
} | javascript | function find(predicate, thisArg) {
if (typeof predicate !== 'function') {
throw new TypeError('predicate is not a function');
}
return this.lift(new FindValueOperator(predicate, this, false, thisArg));
} | [
"function",
"find",
"(",
"predicate",
",",
"thisArg",
")",
"{",
"if",
"(",
"typeof",
"predicate",
"!==",
"'function'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'predicate is not a function'",
")",
";",
"}",
"return",
"this",
".",
"lift",
"(",
"new",
"F... | Emits only the first value emitted by the source Observable that meets some
condition.
<span class="informal">Finds the first value that passes some test and emits
that.</span>
<img src="./img/find.png" width="100%">
`find` searches for the first item in the source Observable that matches the
specified condition emb... | [
"Emits",
"only",
"the",
"first",
"value",
"emitted",
"by",
"the",
"source",
"Observable",
"that",
"meets",
"some",
"condition",
"."
] | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L46037-L46042 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | multicast | function multicast(subjectOrSubjectFactory, selector) {
var subjectFactory;
if (typeof subjectOrSubjectFactory === 'function') {
subjectFactory = subjectOrSubjectFactory;
}
else {
subjectFactory = function subjectFactory() {
return subjectOrSubjectFactory;
};
... | javascript | function multicast(subjectOrSubjectFactory, selector) {
var subjectFactory;
if (typeof subjectOrSubjectFactory === 'function') {
subjectFactory = subjectOrSubjectFactory;
}
else {
subjectFactory = function subjectFactory() {
return subjectOrSubjectFactory;
};
... | [
"function",
"multicast",
"(",
"subjectOrSubjectFactory",
",",
"selector",
")",
"{",
"var",
"subjectFactory",
";",
"if",
"(",
"typeof",
"subjectOrSubjectFactory",
"===",
"'function'",
")",
"{",
"subjectFactory",
"=",
"subjectOrSubjectFactory",
";",
"}",
"else",
"{",
... | Returns an Observable that emits the results of invoking a specified selector on items
emitted by a ConnectableObservable that shares a single subscription to the underlying stream.
<img src="./img/multicast.png" width="100%">
@param {Function|Subject} Factory function to create an intermediate subject through
which ... | [
"Returns",
"an",
"Observable",
"that",
"emits",
"the",
"results",
"of",
"invoking",
"a",
"specified",
"selector",
"on",
"items",
"emitted",
"by",
"a",
"ConnectableObservable",
"that",
"shares",
"a",
"single",
"subscription",
"to",
"the",
"underlying",
"stream",
... | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L47887-L47900 | train |
bharatraj88/angular2-timepicker | dist/vendor.js | publish | function publish(selector) {
return selector ? multicast_1.multicast.call(this, function () { return new Subject_1.Subject(); }, selector) :
multicast_1.multicast.call(this, new Subject_1.Subject());
} | javascript | function publish(selector) {
return selector ? multicast_1.multicast.call(this, function () { return new Subject_1.Subject(); }, selector) :
multicast_1.multicast.call(this, new Subject_1.Subject());
} | [
"function",
"publish",
"(",
"selector",
")",
"{",
"return",
"selector",
"?",
"multicast_1",
".",
"multicast",
".",
"call",
"(",
"this",
",",
"function",
"(",
")",
"{",
"return",
"new",
"Subject_1",
".",
"Subject",
"(",
")",
";",
"}",
",",
"selector",
"... | Returns a ConnectableObservable, which is a variety of Observable that waits until its connect method is called
before it begins emitting items to those Observers that have subscribed to it.
<img src="./img/publish.png" width="100%">
@param {Function} Optional selector function which can use the multicasted source se... | [
"Returns",
"a",
"ConnectableObservable",
"which",
"is",
"a",
"variety",
"of",
"Observable",
"that",
"waits",
"until",
"its",
"connect",
"method",
"is",
"called",
"before",
"it",
"begins",
"emitting",
"items",
"to",
"those",
"Observers",
"that",
"have",
"subscrib... | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/vendor.js#L48393-L48396 | train |
bharatraj88/angular2-timepicker | dist/app.js | done | function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTime... | javascript | function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTime... | [
"function",
"done",
"(",
"status",
",",
"nativeStatusText",
",",
"responses",
",",
"headers",
")",
"{",
"var",
"isSuccess",
",",
"success",
",",
"error",
",",
"response",
",",
"modified",
",",
"statusText",
"=",
"nativeStatusText",
";",
"// Called once",
"if",... | Callback for when everything is done | [
"Callback",
"for",
"when",
"everything",
"is",
"done"
] | 748330a2a5e7f89a02cd99477b480237aacdb295 | https://github.com/bharatraj88/angular2-timepicker/blob/748330a2a5e7f89a02cd99477b480237aacdb295/dist/app.js#L13436-L13547 | train |
milindalvares/ember-cli-accounting | addon/utils.js | defaults | function defaults(object, defs) {
var key;
object = assign({}, object);
defs = defs || {};
// Iterate over object non-prototype properties:
for (key in defs) {
if (defs.hasOwnProperty(key)) {
// Replace values with defaults only if undefined (allow empty/zero values):
if (object[key] == null) ... | javascript | function defaults(object, defs) {
var key;
object = assign({}, object);
defs = defs || {};
// Iterate over object non-prototype properties:
for (key in defs) {
if (defs.hasOwnProperty(key)) {
// Replace values with defaults only if undefined (allow empty/zero values):
if (object[key] == null) ... | [
"function",
"defaults",
"(",
"object",
",",
"defs",
")",
"{",
"var",
"key",
";",
"object",
"=",
"assign",
"(",
"{",
"}",
",",
"object",
")",
";",
"defs",
"=",
"defs",
"||",
"{",
"}",
";",
"// Iterate over object non-prototype properties:",
"for",
"(",
"k... | Extends an object with a defaults object, similar to underscore's _.defaults
Used for abstracting parameter handling from API methods | [
"Extends",
"an",
"object",
"with",
"a",
"defaults",
"object",
"similar",
"to",
"underscore",
"s",
"_",
".",
"defaults"
] | ae19823ed9373a31d328f2f74520fcd450add4f0 | https://github.com/milindalvares/ember-cli-accounting/blob/ae19823ed9373a31d328f2f74520fcd450add4f0/addon/utils.js#L11-L25 | train |
waynebloss/react-mvvm | cjs/ViewModel.js | function (VMType, ViewType) {
var vm = new VMType();
var vmFunctionProps = getFunctionalPropertiesMap(vm);
var VConnect = /** @class */ (function (_super) {
__extends(VConnect, _super);
function VConnect() {
return _super !== null && _super.apply(thi... | javascript | function (VMType, ViewType) {
var vm = new VMType();
var vmFunctionProps = getFunctionalPropertiesMap(vm);
var VConnect = /** @class */ (function (_super) {
__extends(VConnect, _super);
function VConnect() {
return _super !== null && _super.apply(thi... | [
"function",
"(",
"VMType",
",",
"ViewType",
")",
"{",
"var",
"vm",
"=",
"new",
"VMType",
"(",
")",
";",
"var",
"vmFunctionProps",
"=",
"getFunctionalPropertiesMap",
"(",
"vm",
")",
";",
"var",
"VConnect",
"=",
"/** @class */",
"(",
"function",
"(",
"_super... | Connects a view model to a view.
@param VMType The view model constructor.
@param ViewType The view constructor. | [
"Connects",
"a",
"view",
"model",
"to",
"a",
"view",
"."
] | cabf60ca31c39da27b71a31b767252c86cbeaf75 | https://github.com/waynebloss/react-mvvm/blob/cabf60ca31c39da27b71a31b767252c86cbeaf75/cjs/ViewModel.js#L45-L60 | train | |
austinhallock/html5-virtual-game-controller | src/gamecontroller.js | function() {
var _this = this;
this.canvas = document.createElement('canvas');
// Scale to same size as original canvas
this.resize(true);
document.body.appendChild(this.canvas);
this.ctx = this.canvas.getContext( '2d');
window.addEventListener( 'resize', function() {
setTimeout(function(){ Gam... | javascript | function() {
var _this = this;
this.canvas = document.createElement('canvas');
// Scale to same size as original canvas
this.resize(true);
document.body.appendChild(this.canvas);
this.ctx = this.canvas.getContext( '2d');
window.addEventListener( 'resize', function() {
setTimeout(function(){ Gam... | [
"function",
"(",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"this",
".",
"canvas",
"=",
"document",
".",
"createElement",
"(",
"'canvas'",
")",
";",
"// Scale to same size as original canvas",
"this",
".",
"resize",
"(",
"true",
")",
";",
"document",
".",
... | Creates the canvas that sits on top of the game's canvas and
holds game controls | [
"Creates",
"the",
"canvas",
"that",
"sits",
"on",
"top",
"of",
"the",
"game",
"s",
"canvas",
"and",
"holds",
"game",
"controls"
] | a850fdf4dc0284110102afe7a884db6e14246822 | https://github.com/austinhallock/html5-virtual-game-controller/blob/a850fdf4dc0284110102afe7a884db6e14246822/src/gamecontroller.js#L299-L322 | train | |
austinhallock/html5-virtual-game-controller | src/gamecontroller.js | function( value, axis ){
if( !value ) return 0;
if( typeof value === 'number' ) return value;
// a percentage
return parseInt(value, 10) / 100 *
(axis === 'x' ? this.canvas.width : this.canvas.height);
} | javascript | function( value, axis ){
if( !value ) return 0;
if( typeof value === 'number' ) return value;
// a percentage
return parseInt(value, 10) / 100 *
(axis === 'x' ? this.canvas.width : this.canvas.height);
} | [
"function",
"(",
"value",
",",
"axis",
")",
"{",
"if",
"(",
"!",
"value",
")",
"return",
"0",
";",
"if",
"(",
"typeof",
"value",
"===",
"'number'",
")",
"return",
"value",
";",
"// a percentage",
"return",
"parseInt",
"(",
"value",
",",
"10",
")",
"/... | Returns the scaled pixels. Given the value passed
@param {int/string} value - either an integer for # of pixels,
or 'x%' for relative
@param {char} axis - x, y | [
"Returns",
"the",
"scaled",
"pixels",
".",
"Given",
"the",
"value",
"passed"
] | a850fdf4dc0284110102afe7a884db6e14246822 | https://github.com/austinhallock/html5-virtual-game-controller/blob/a850fdf4dc0284110102afe7a884db6e14246822/src/gamecontroller.js#L368-L374 | train | |
austinhallock/html5-virtual-game-controller | src/gamecontroller.js | function( eventName, keyCode ) {
// No keyboard, can't simulate...
if( typeof window.onkeydown === 'undefined' ) return false;
var oEvent = document.createEvent('KeyboardEvent');
// Chromium Hack
if( navigator.userAgent.toLowerCase().indexOf( 'chrome' ) !== -1 ) {
Object.defineProperty( oEvent, 'key... | javascript | function( eventName, keyCode ) {
// No keyboard, can't simulate...
if( typeof window.onkeydown === 'undefined' ) return false;
var oEvent = document.createEvent('KeyboardEvent');
// Chromium Hack
if( navigator.userAgent.toLowerCase().indexOf( 'chrome' ) !== -1 ) {
Object.defineProperty( oEvent, 'key... | [
"function",
"(",
"eventName",
",",
"keyCode",
")",
"{",
"// No keyboard, can't simulate...",
"if",
"(",
"typeof",
"window",
".",
"onkeydown",
"===",
"'undefined'",
")",
"return",
"false",
";",
"var",
"oEvent",
"=",
"document",
".",
"createEvent",
"(",
"'Keyboard... | Simulates a key press
@param {string} eventName - 'down', 'up'
@param {char} character | [
"Simulates",
"a",
"key",
"press"
] | a850fdf4dc0284110102afe7a884db6e14246822 | https://github.com/austinhallock/html5-virtual-game-controller/blob/a850fdf4dc0284110102afe7a884db6e14246822/src/gamecontroller.js#L381-L411 | train | |
austinhallock/html5-virtual-game-controller | src/gamecontroller.js | function( options ) {
var direction = new TouchableDirection( options);
direction.id = this.touchableAreas.push( direction);
this.touchableAreasCount++;
this.boundingSet(options);
} | javascript | function( options ) {
var direction = new TouchableDirection( options);
direction.id = this.touchableAreas.push( direction);
this.touchableAreasCount++;
this.boundingSet(options);
} | [
"function",
"(",
"options",
")",
"{",
"var",
"direction",
"=",
"new",
"TouchableDirection",
"(",
"options",
")",
";",
"direction",
".",
"id",
"=",
"this",
".",
"touchableAreas",
".",
"push",
"(",
"direction",
")",
";",
"this",
".",
"touchableAreasCount",
"... | Adds the area to a list of touchable areas, draws
@param {object} options with properties:
x, y, width, height, touchStart, touchEnd, touchMove | [
"Adds",
"the",
"area",
"to",
"a",
"list",
"of",
"touchable",
"areas",
"draws"
] | a850fdf4dc0284110102afe7a884db6e14246822 | https://github.com/austinhallock/html5-virtual-game-controller/blob/a850fdf4dc0284110102afe7a884db6e14246822/src/gamecontroller.js#L471-L476 | train | |
austinhallock/html5-virtual-game-controller | src/gamecontroller.js | function() {
for( var i = 0, j = this.touchableAreasCount; i < j; i++ ) {
var area = this.touchableAreas[ i ];
if( typeof area === 'undefined' ) continue;
area.draw();
// Go through all touches to see if any hit this area
var touched = false;
for( var k = 0, l = this.touches.length; k < l; k+... | javascript | function() {
for( var i = 0, j = this.touchableAreasCount; i < j; i++ ) {
var area = this.touchableAreas[ i ];
if( typeof area === 'undefined' ) continue;
area.draw();
// Go through all touches to see if any hit this area
var touched = false;
for( var k = 0, l = this.touches.length; k < l; k+... | [
"function",
"(",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"j",
"=",
"this",
".",
"touchableAreasCount",
";",
"i",
"<",
"j",
";",
"i",
"++",
")",
"{",
"var",
"area",
"=",
"this",
".",
"touchableAreas",
"[",
"i",
"]",
";",
"if",
"(",
"t... | Processes the info for each touchableArea | [
"Processes",
"the",
"info",
"for",
"each",
"touchableArea"
] | a850fdf4dc0284110102afe7a884db6e14246822 | https://github.com/austinhallock/html5-virtual-game-controller/blob/a850fdf4dc0284110102afe7a884db6e14246822/src/gamecontroller.js#L642-L663 | train | |
austinhallock/html5-virtual-game-controller | src/gamecontroller.js | TouchableButton | function TouchableButton( options ) {
for( var i in options ) {
if( i === 'x' ) this[i] = GameController.getPixels( options[i], 'x');
else if( i === 'y' || i === 'radius' ){
this[i] = GameController.getPixels(options[i], 'y');
} else this[i] = options[i];
}
this.draw();
} | javascript | function TouchableButton( options ) {
for( var i in options ) {
if( i === 'x' ) this[i] = GameController.getPixels( options[i], 'x');
else if( i === 'y' || i === 'radius' ){
this[i] = GameController.getPixels(options[i], 'y');
} else this[i] = options[i];
}
this.draw();
} | [
"function",
"TouchableButton",
"(",
"options",
")",
"{",
"for",
"(",
"var",
"i",
"in",
"options",
")",
"{",
"if",
"(",
"i",
"===",
"'x'",
")",
"this",
"[",
"i",
"]",
"=",
"GameController",
".",
"getPixels",
"(",
"options",
"[",
"i",
"]",
",",
"'x'"... | x, y, radius, backgroundColor ) | [
"x",
"y",
"radius",
"backgroundColor",
")"
] | a850fdf4dc0284110102afe7a884db6e14246822 | https://github.com/austinhallock/html5-virtual-game-controller/blob/a850fdf4dc0284110102afe7a884db6e14246822/src/gamecontroller.js#L906-L914 | train |
ninjablocks/node-zigbee | lib/zcl/ZCLClient.js | ZCLClient | function ZCLClient(config) {
ZNPClient.call(this, config);
// handle zcl messages
this.on('incoming-message', this._handleIncomingMessage.bind(this));
// handle attribute reports
this.on('zcl-command:ReportAttributes', this._handleReportAttributes.bind(this));
// XXX: This really should be pulled out and... | javascript | function ZCLClient(config) {
ZNPClient.call(this, config);
// handle zcl messages
this.on('incoming-message', this._handleIncomingMessage.bind(this));
// handle attribute reports
this.on('zcl-command:ReportAttributes', this._handleReportAttributes.bind(this));
// XXX: This really should be pulled out and... | [
"function",
"ZCLClient",
"(",
"config",
")",
"{",
"ZNPClient",
".",
"call",
"(",
"this",
",",
"config",
")",
";",
"// handle zcl messages",
"this",
".",
"on",
"(",
"'incoming-message'",
",",
"this",
".",
"_handleIncomingMessage",
".",
"bind",
"(",
"this",
")... | Extends ZNPClient to provice the ZCL layer, without understanding any of the underlying hardware. | [
"Extends",
"ZNPClient",
"to",
"provice",
"the",
"ZCL",
"layer",
"without",
"understanding",
"any",
"of",
"the",
"underlying",
"hardware",
"."
] | fccfb47b6c8a2ae9192bcbed622522d7b2d296e7 | https://github.com/ninjablocks/node-zigbee/blob/fccfb47b6c8a2ae9192bcbed622522d7b2d296e7/lib/zcl/ZCLClient.js#L17-L28 | train |
ninjablocks/node-zigbee | lib/znp/ZNPClient.js | ZNPClient | function ZNPClient(config) {
this._devices = {};
this.config = config;
if (!config || !config.panId) {
throw new Error('You must set "panId" on ZNPClient config');
}
this.comms = new ZNPSerial();
// Device state notifications
this.comms.on('command:ZDO_STATE_CHANGE_IND', this._handleStateChange.bi... | javascript | function ZNPClient(config) {
this._devices = {};
this.config = config;
if (!config || !config.panId) {
throw new Error('You must set "panId" on ZNPClient config');
}
this.comms = new ZNPSerial();
// Device state notifications
this.comms.on('command:ZDO_STATE_CHANGE_IND', this._handleStateChange.bi... | [
"function",
"ZNPClient",
"(",
"config",
")",
"{",
"this",
".",
"_devices",
"=",
"{",
"}",
";",
"this",
".",
"config",
"=",
"config",
";",
"if",
"(",
"!",
"config",
"||",
"!",
"config",
".",
"panId",
")",
"{",
"throw",
"new",
"Error",
"(",
"'You mus... | A ZigBee client, handling higher level functions relating to the ZigBee
network.
interface responsible for communicating with the ZigBee SOC. | [
"A",
"ZigBee",
"client",
"handling",
"higher",
"level",
"functions",
"relating",
"to",
"the",
"ZigBee",
"network",
".",
"interface",
"responsible",
"for",
"communicating",
"with",
"the",
"ZigBee",
"SOC",
"."
] | fccfb47b6c8a2ae9192bcbed622522d7b2d296e7 | https://github.com/ninjablocks/node-zigbee/blob/fccfb47b6c8a2ae9192bcbed622522d7b2d296e7/lib/znp/ZNPClient.js#L22-L48 | train |
ninjablocks/node-zigbee | lib/znp/ZNPSerial.js | calculateFCS | function calculateFCS(buffer) {
var fcs = 0;
for (var i = 0; i < buffer.length; i++) {
fcs ^= buffer[i];
}
return fcs;
} | javascript | function calculateFCS(buffer) {
var fcs = 0;
for (var i = 0; i < buffer.length; i++) {
fcs ^= buffer[i];
}
return fcs;
} | [
"function",
"calculateFCS",
"(",
"buffer",
")",
"{",
"var",
"fcs",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"buffer",
".",
"length",
";",
"i",
"++",
")",
"{",
"fcs",
"^=",
"buffer",
"[",
"i",
"]",
";",
"}",
"return",
"f... | Calculates the FCS for a given buffer.
@param {Buffer} buffer
@return {Integer} FCS | [
"Calculates",
"the",
"FCS",
"for",
"a",
"given",
"buffer",
"."
] | fccfb47b6c8a2ae9192bcbed622522d7b2d296e7 | https://github.com/ninjablocks/node-zigbee/blob/fccfb47b6c8a2ae9192bcbed622522d7b2d296e7/lib/znp/ZNPSerial.js#L271-L279 | train |
ninjablocks/node-zigbee | lib/profile/Cluster.js | ZCLCluster | function ZCLCluster(endpoint, clusterId) {
this.endpoint = endpoint;
this.device = this.endpoint.device;
this.client = this.device.client;
this.comms = this.client.comms;
// XXX: Horrible hack, fix me.
this.client.on('command.' + this.device.shortAddress + '.' + endpoint.endpointId + '.' + clusterId, funct... | javascript | function ZCLCluster(endpoint, clusterId) {
this.endpoint = endpoint;
this.device = this.endpoint.device;
this.client = this.device.client;
this.comms = this.client.comms;
// XXX: Horrible hack, fix me.
this.client.on('command.' + this.device.shortAddress + '.' + endpoint.endpointId + '.' + clusterId, funct... | [
"function",
"ZCLCluster",
"(",
"endpoint",
",",
"clusterId",
")",
"{",
"this",
".",
"endpoint",
"=",
"endpoint",
";",
"this",
".",
"device",
"=",
"this",
".",
"endpoint",
".",
"device",
";",
"this",
".",
"client",
"=",
"this",
".",
"device",
".",
"clie... | Represents a ZCL cluster on a specific endpoint on a device.
@param {Endpoint} endpoint
@param {Number} clusterId | [
"Represents",
"a",
"ZCL",
"cluster",
"on",
"a",
"specific",
"endpoint",
"on",
"a",
"device",
"."
] | fccfb47b6c8a2ae9192bcbed622522d7b2d296e7 | https://github.com/ninjablocks/node-zigbee/blob/fccfb47b6c8a2ae9192bcbed622522d7b2d296e7/lib/profile/Cluster.js#L24-L91 | train |
building5/sails-db-migrate | lib/sailsDbMigrate.js | buildURL | function buildURL(connection) {
var scheme;
var url;
switch (connection.adapter) {
case 'sails-mysql':
scheme = 'mysql';
break;
case 'sails-postgresql':
scheme = 'postgres';
break;
case 'sails-mongo':
scheme = 'mongodb'
break;
default:
throw new Error('mi... | javascript | function buildURL(connection) {
var scheme;
var url;
switch (connection.adapter) {
case 'sails-mysql':
scheme = 'mysql';
break;
case 'sails-postgresql':
scheme = 'postgres';
break;
case 'sails-mongo':
scheme = 'mongodb'
break;
default:
throw new Error('mi... | [
"function",
"buildURL",
"(",
"connection",
")",
"{",
"var",
"scheme",
";",
"var",
"url",
";",
"switch",
"(",
"connection",
".",
"adapter",
")",
"{",
"case",
"'sails-mysql'",
":",
"scheme",
"=",
"'mysql'",
";",
"break",
";",
"case",
"'sails-postgresql'",
":... | Build a URL from the Sails connection config.
@param {object} connection Sails connection config.
@returns {string} URL for connecting to the specified database.
@throws Error if adapter is not supported. | [
"Build",
"a",
"URL",
"from",
"the",
"Sails",
"connection",
"config",
"."
] | 41ffc849446f433298fe23dbccee771c1a55137f | https://github.com/building5/sails-db-migrate/blob/41ffc849446f433298fe23dbccee771c1a55137f/lib/sailsDbMigrate.js#L14-L63 | train |
building5/sails-db-migrate | lib/sailsDbMigrate.js | parseSailsConfig | function parseSailsConfig(sailsConfig) {
var res = {};
var connection;
if (!sailsConfig.migrations) {
throw new Error('Migrations not configured. Please setup ./config/migrations.js');
}
var connectionName = sailsConfig.migrations.connection;
if (!connectionName) {
throw new Error('connection miss... | javascript | function parseSailsConfig(sailsConfig) {
var res = {};
var connection;
if (!sailsConfig.migrations) {
throw new Error('Migrations not configured. Please setup ./config/migrations.js');
}
var connectionName = sailsConfig.migrations.connection;
if (!connectionName) {
throw new Error('connection miss... | [
"function",
"parseSailsConfig",
"(",
"sailsConfig",
")",
"{",
"var",
"res",
"=",
"{",
"}",
";",
"var",
"connection",
";",
"if",
"(",
"!",
"sailsConfig",
".",
"migrations",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Migrations not configured. Please setup ./config... | Parse out the database URL from the sails config.
@param sailsConfig Sails config object.
@returns {object} .url and .cleanURL for the database connection.
@throws Error if adapter is not supported. | [
"Parse",
"out",
"the",
"database",
"URL",
"from",
"the",
"sails",
"config",
"."
] | 41ffc849446f433298fe23dbccee771c1a55137f | https://github.com/building5/sails-db-migrate/blob/41ffc849446f433298fe23dbccee771c1a55137f/lib/sailsDbMigrate.js#L72-L105 | train |
building5/sails-db-migrate | lib/gruntTasks.js | buildDbMigrateArgs | function buildDbMigrateArgs(grunt, config, command) {
var args = [];
var name = grunt.option('name');
args.push(command);
if (command === 'create') {
if (!name) {
throw new Error('--name required to create migration');
}
args.push(name);
}
if (grunt.option('count') !== undefined) {
... | javascript | function buildDbMigrateArgs(grunt, config, command) {
var args = [];
var name = grunt.option('name');
args.push(command);
if (command === 'create') {
if (!name) {
throw new Error('--name required to create migration');
}
args.push(name);
}
if (grunt.option('count') !== undefined) {
... | [
"function",
"buildDbMigrateArgs",
"(",
"grunt",
",",
"config",
",",
"command",
")",
"{",
"var",
"args",
"=",
"[",
"]",
";",
"var",
"name",
"=",
"grunt",
".",
"option",
"(",
"'name'",
")",
";",
"args",
".",
"push",
"(",
"command",
")",
";",
"if",
"(... | Builds the command line arguments to pass to db-migrate.
@param grunt Grunt object.
@param command The db-migrate command to run.
@returns Arguments array for the db-migrate command. | [
"Builds",
"the",
"command",
"line",
"arguments",
"to",
"pass",
"to",
"db",
"-",
"migrate",
"."
] | 41ffc849446f433298fe23dbccee771c1a55137f | https://github.com/building5/sails-db-migrate/blob/41ffc849446f433298fe23dbccee771c1a55137f/lib/gruntTasks.js#L13-L66 | train |
building5/sails-db-migrate | lib/gruntTasks.js | usage | function usage(grunt) {
grunt.log.writeln('usage: grunt db:migrate[:up|:down|:create] [options]');
grunt.log.writeln(' See ./migrations/README.md for more details');
grunt.log.writeln();
grunt.log.writeln('db:migrate:create Options:');
grunt.log.writeln(' --name=NAME Name of the migration to create');
gr... | javascript | function usage(grunt) {
grunt.log.writeln('usage: grunt db:migrate[:up|:down|:create] [options]');
grunt.log.writeln(' See ./migrations/README.md for more details');
grunt.log.writeln();
grunt.log.writeln('db:migrate:create Options:');
grunt.log.writeln(' --name=NAME Name of the migration to create');
gr... | [
"function",
"usage",
"(",
"grunt",
")",
"{",
"grunt",
".",
"log",
".",
"writeln",
"(",
"'usage: grunt db:migrate[:up|:down|:create] [options]'",
")",
";",
"grunt",
".",
"log",
".",
"writeln",
"(",
"' See ./migrations/README.md for more details'",
")",
";",
"grunt",
... | Display command usage information.
@param grunt Grunt object. | [
"Display",
"command",
"usage",
"information",
"."
] | 41ffc849446f433298fe23dbccee771c1a55137f | https://github.com/building5/sails-db-migrate/blob/41ffc849446f433298fe23dbccee771c1a55137f/lib/gruntTasks.js#L73-L90 | train |
anvaka/ngraph.asyncforce | lib/layoutWorker.js | handleMessageFromMainThread | function handleMessageFromMainThread(message) {
var kind = message.data.kind;
var payload = message.data.payload;
if (kind === messageKind.init) {
graph = fromjson(payload.graph);
var options = JSON.parse(payload.options);
init(graph, options);
} else if (kind === messageKind.step) {... | javascript | function handleMessageFromMainThread(message) {
var kind = message.data.kind;
var payload = message.data.payload;
if (kind === messageKind.init) {
graph = fromjson(payload.graph);
var options = JSON.parse(payload.options);
init(graph, options);
} else if (kind === messageKind.step) {... | [
"function",
"handleMessageFromMainThread",
"(",
"message",
")",
"{",
"var",
"kind",
"=",
"message",
".",
"data",
".",
"kind",
";",
"var",
"payload",
"=",
"message",
".",
"data",
".",
"payload",
";",
"if",
"(",
"kind",
"===",
"messageKind",
".",
"init",
"... | public API is over. Below are private methods only. | [
"public",
"API",
"is",
"over",
".",
"Below",
"are",
"private",
"methods",
"only",
"."
] | 98cc8f87074f61d36215b672f0b31855b4deca4a | https://github.com/anvaka/ngraph.asyncforce/blob/98cc8f87074f61d36215b672f0b31855b4deca4a/lib/layoutWorker.js#L26-L43 | train |
rintoj/statex | dist/core/decorators.js | bindData | function bindData(target, key, selector) {
return state_1.State.select(selector).subscribe(function (args) {
if (typeof target.setState === 'function') {
var state = {};
state[key] = args;
target.setState(state);
}
if (typeof target[key] === 'function')
... | javascript | function bindData(target, key, selector) {
return state_1.State.select(selector).subscribe(function (args) {
if (typeof target.setState === 'function') {
var state = {};
state[key] = args;
target.setState(state);
}
if (typeof target[key] === 'function')
... | [
"function",
"bindData",
"(",
"target",
",",
"key",
",",
"selector",
")",
"{",
"return",
"state_1",
".",
"State",
".",
"select",
"(",
"selector",
")",
".",
"subscribe",
"(",
"function",
"(",
"args",
")",
"{",
"if",
"(",
"typeof",
"target",
".",
"setStat... | Bind data for give key and target using a selector function
@param {any} target
@param {any} key
@param {any} selectorFunc | [
"Bind",
"data",
"for",
"give",
"key",
"and",
"target",
"using",
"a",
"selector",
"function"
] | 19d2a321587c67ee6ff406251ea3d6b3eeaa3418 | https://github.com/rintoj/statex/blob/19d2a321587c67ee6ff406251ea3d6b3eeaa3418/dist/core/decorators.js#L13-L24 | train |
rintoj/statex | dist/core/decorators.js | action | function action(targetAction) {
return function (target, propertyKey, descriptor) {
if (targetAction == undefined) {
var metadata = Reflect.getMetadata('design:paramtypes', target, propertyKey);
if (metadata == undefined || metadata.length < 2)
throw new Error('@actio... | javascript | function action(targetAction) {
return function (target, propertyKey, descriptor) {
if (targetAction == undefined) {
var metadata = Reflect.getMetadata('design:paramtypes', target, propertyKey);
if (metadata == undefined || metadata.length < 2)
throw new Error('@actio... | [
"function",
"action",
"(",
"targetAction",
")",
"{",
"return",
"function",
"(",
"target",
",",
"propertyKey",
",",
"descriptor",
")",
"{",
"if",
"(",
"targetAction",
"==",
"undefined",
")",
"{",
"var",
"metadata",
"=",
"Reflect",
".",
"getMetadata",
"(",
"... | Binds action to a function
@example
class TodoStore {
@action
addTodo(state: State, action: AddTodoAction): State {
// return modified state
}
}
@export
@param {*} target
@param {string} propertyKey
@param {PropertyDescriptor} descriptor
@returns | [
"Binds",
"action",
"to",
"a",
"function"
] | 19d2a321587c67ee6ff406251ea3d6b3eeaa3418 | https://github.com/rintoj/statex/blob/19d2a321587c67ee6ff406251ea3d6b3eeaa3418/dist/core/decorators.js#L44-L65 | train |
rintoj/statex | dist/core/decorators.js | subscribe | function subscribe(propsClass) {
var _this = this;
var dataBindings = Reflect.getMetadata(constance_1.STATEX_DATA_BINDINGS_KEY, propsClass || this);
if (dataBindings != undefined) {
var selectors_1 = dataBindings.selectors || {};
dataBindings.subscriptions = (dataBindings.subscriptions || []... | javascript | function subscribe(propsClass) {
var _this = this;
var dataBindings = Reflect.getMetadata(constance_1.STATEX_DATA_BINDINGS_KEY, propsClass || this);
if (dataBindings != undefined) {
var selectors_1 = dataBindings.selectors || {};
dataBindings.subscriptions = (dataBindings.subscriptions || []... | [
"function",
"subscribe",
"(",
"propsClass",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"var",
"dataBindings",
"=",
"Reflect",
".",
"getMetadata",
"(",
"constance_1",
".",
"STATEX_DATA_BINDINGS_KEY",
",",
"propsClass",
"||",
"this",
")",
";",
"if",
"(",
"dat... | Subscribe to the state events and map it to properties
@export | [
"Subscribe",
"to",
"the",
"state",
"events",
"and",
"map",
"it",
"to",
"properties"
] | 19d2a321587c67ee6ff406251ea3d6b3eeaa3418 | https://github.com/rintoj/statex/blob/19d2a321587c67ee6ff406251ea3d6b3eeaa3418/dist/core/decorators.js#L99-L110 | train |
rintoj/statex | dist/core/decorators.js | unsubscribe | function unsubscribe() {
var _this = this;
var dataBindings = Reflect.getMetadata(constance_1.STATEX_DATA_BINDINGS_KEY, this);
if (dataBindings != undefined) {
var subscriptions = dataBindings.subscriptions || [];
subscriptions.forEach(function (item) { return item.target === _this && item.s... | javascript | function unsubscribe() {
var _this = this;
var dataBindings = Reflect.getMetadata(constance_1.STATEX_DATA_BINDINGS_KEY, this);
if (dataBindings != undefined) {
var subscriptions = dataBindings.subscriptions || [];
subscriptions.forEach(function (item) { return item.target === _this && item.s... | [
"function",
"unsubscribe",
"(",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"var",
"dataBindings",
"=",
"Reflect",
".",
"getMetadata",
"(",
"constance_1",
".",
"STATEX_DATA_BINDINGS_KEY",
",",
"this",
")",
";",
"if",
"(",
"dataBindings",
"!=",
"undefined",
"... | Unsubscribe from the state changes
@export | [
"Unsubscribe",
"from",
"the",
"state",
"changes"
] | 19d2a321587c67ee6ff406251ea3d6b3eeaa3418 | https://github.com/rintoj/statex/blob/19d2a321587c67ee6ff406251ea3d6b3eeaa3418/dist/core/decorators.js#L117-L126 | train |
leifoolsen/mdl-ext | demo/scripts/dialog-polyfill.js | function() {
if (!this.openAsModal_) { return; }
this.openAsModal_ = false;
this.dialog_.style.zIndex = '';
// This won't match the native <dialog> exactly because if the user set top on a centered
// polyfill dialog, that top gets thrown away when the dialog is closed. Not sure it's
... | javascript | function() {
if (!this.openAsModal_) { return; }
this.openAsModal_ = false;
this.dialog_.style.zIndex = '';
// This won't match the native <dialog> exactly because if the user set top on a centered
// polyfill dialog, that top gets thrown away when the dialog is closed. Not sure it's
... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"openAsModal_",
")",
"{",
"return",
";",
"}",
"this",
".",
"openAsModal_",
"=",
"false",
";",
"this",
".",
"dialog_",
".",
"style",
".",
"zIndex",
"=",
"''",
";",
"// This won't match the native <di... | Remove this dialog from the modal top layer, leaving it as a non-modal. | [
"Remove",
"this",
"dialog",
"from",
"the",
"modal",
"top",
"layer",
"leaving",
"it",
"as",
"a",
"non",
"-",
"modal",
"."
] | a22a7be564ff81a41e94eb14bda6cd36401dc962 | https://github.com/leifoolsen/mdl-ext/blob/a22a7be564ff81a41e94eb14bda6cd36401dc962/demo/scripts/dialog-polyfill.js#L161-L177 | train | |
leifoolsen/mdl-ext | demo/scripts/dialog-polyfill.js | function() {
// Find element with `autofocus` attribute, or fall back to the first form/tabindex control.
var target = this.dialog_.querySelector('[autofocus]:not([disabled])');
if (!target && this.dialog_.tabIndex >= 0) {
target = this.dialog_;
}
if (!target) {
// Note tha... | javascript | function() {
// Find element with `autofocus` attribute, or fall back to the first form/tabindex control.
var target = this.dialog_.querySelector('[autofocus]:not([disabled])');
if (!target && this.dialog_.tabIndex >= 0) {
target = this.dialog_;
}
if (!target) {
// Note tha... | [
"function",
"(",
")",
"{",
"// Find element with `autofocus` attribute, or fall back to the first form/tabindex control.",
"var",
"target",
"=",
"this",
".",
"dialog_",
".",
"querySelector",
"(",
"'[autofocus]:not([disabled])'",
")",
";",
"if",
"(",
"!",
"target",
"&&",
"... | Focuses on the first focusable element within the dialog. This will always blur the current
focus, even if nothing within the dialog is found. | [
"Focuses",
"on",
"the",
"first",
"focusable",
"element",
"within",
"the",
"dialog",
".",
"This",
"will",
"always",
"blur",
"the",
"current",
"focus",
"even",
"if",
"nothing",
"within",
"the",
"dialog",
"is",
"found",
"."
] | a22a7be564ff81a41e94eb14bda6cd36401dc962 | https://github.com/leifoolsen/mdl-ext/blob/a22a7be564ff81a41e94eb14bda6cd36401dc962/demo/scripts/dialog-polyfill.js#L223-L242 | train | |
leifoolsen/mdl-ext | demo/scripts/dialog-polyfill.js | function(opt_returnValue) {
if (!this.dialog_.hasAttribute('open')) {
throw new Error('Failed to execute \'close\' on dialog: The element does not have an \'open\' attribute, and therefore cannot be closed.');
}
this.setOpen(false);
// Leave returnValue untouched in case it was set dire... | javascript | function(opt_returnValue) {
if (!this.dialog_.hasAttribute('open')) {
throw new Error('Failed to execute \'close\' on dialog: The element does not have an \'open\' attribute, and therefore cannot be closed.');
}
this.setOpen(false);
// Leave returnValue untouched in case it was set dire... | [
"function",
"(",
"opt_returnValue",
")",
"{",
"if",
"(",
"!",
"this",
".",
"dialog_",
".",
"hasAttribute",
"(",
"'open'",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Failed to execute \\'close\\' on dialog: The element does not have an \\'open\\' attribute, and therefo... | Closes this HTMLDialogElement. This is optional vs clearing the open
attribute, however this fires a 'close' event.
@param {string=} opt_returnValue to use as the returnValue | [
"Closes",
"this",
"HTMLDialogElement",
".",
"This",
"is",
"optional",
"vs",
"clearing",
"the",
"open",
"attribute",
"however",
"this",
"fires",
"a",
"close",
"event",
"."
] | a22a7be564ff81a41e94eb14bda6cd36401dc962 | https://github.com/leifoolsen/mdl-ext/blob/a22a7be564ff81a41e94eb14bda6cd36401dc962/demo/scripts/dialog-polyfill.js#L312-L329 | train | |
rintoj/statex | dist/core/store.js | store | function store() {
return function (storeClass) {
// save a reference to the original constructor
var original = storeClass;
// a utility function to generate instances of a class
function construct(constructor, args) {
var dynamicClass = function () {
ret... | javascript | function store() {
return function (storeClass) {
// save a reference to the original constructor
var original = storeClass;
// a utility function to generate instances of a class
function construct(constructor, args) {
var dynamicClass = function () {
ret... | [
"function",
"store",
"(",
")",
"{",
"return",
"function",
"(",
"storeClass",
")",
"{",
"// save a reference to the original constructor",
"var",
"original",
"=",
"storeClass",
";",
"// a utility function to generate instances of a class",
"function",
"construct",
"(",
"cons... | This decorator configure instance of a store
@export
@param {*} storeClass
@returns | [
"This",
"decorator",
"configure",
"instance",
"of",
"a",
"store"
] | 19d2a321587c67ee6ff406251ea3d6b3eeaa3418 | https://github.com/rintoj/statex/blob/19d2a321587c67ee6ff406251ea3d6b3eeaa3418/dist/core/store.js#L11-L43 | train |
rintoj/statex | dist/core/store.js | Store | function Store() {
var _this = this;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (!Reflect.hasMetadata(constance_1.STATEX_ACTION_KEY, this))
return;
var statexActions... | javascript | function Store() {
var _this = this;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (!Reflect.hasMetadata(constance_1.STATEX_ACTION_KEY, this))
return;
var statexActions... | [
"function",
"Store",
"(",
")",
"{",
"var",
"_this",
"=",
"this",
";",
"var",
"args",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"0",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"args",
"[",
"_i",
"]",
"=",
... | the new constructor behavior | [
"the",
"new",
"constructor",
"behavior"
] | 19d2a321587c67ee6ff406251ea3d6b3eeaa3418 | https://github.com/rintoj/statex/blob/19d2a321587c67ee6ff406251ea3d6b3eeaa3418/dist/core/store.js#L24-L35 | train |
rintoj/statex | dist/core/state.js | select | function select(state, selector) {
if (state == undefined)
return;
if (selector == undefined)
return state;
try {
return selector(state);
}
catch (error) {
return undefined;
}
} | javascript | function select(state, selector) {
if (state == undefined)
return;
if (selector == undefined)
return state;
try {
return selector(state);
}
catch (error) {
return undefined;
}
} | [
"function",
"select",
"(",
"state",
",",
"selector",
")",
"{",
"if",
"(",
"state",
"==",
"undefined",
")",
"return",
";",
"if",
"(",
"selector",
"==",
"undefined",
")",
"return",
"state",
";",
"try",
"{",
"return",
"selector",
"(",
"state",
")",
";",
... | Run selector function on the given state and return it's result. Return undefined if an error occurred
@param {*} state
@param {StateSelector} selector
@returns The value return by the selector, undefined if an error occurred. | [
"Run",
"selector",
"function",
"on",
"the",
"given",
"state",
"and",
"return",
"it",
"s",
"result",
".",
"Return",
"undefined",
"if",
"an",
"error",
"occurred"
] | 19d2a321587c67ee6ff406251ea3d6b3eeaa3418 | https://github.com/rintoj/statex/blob/19d2a321587c67ee6ff406251ea3d6b3eeaa3418/dist/core/state.js#L93-L104 | train |
bholloway/nginject-loader | index.js | loader | function loader(content, sourceMap) {
/* jshint validthis:true */
// loader result is cacheable
this.cacheable();
// path of the file being processed
var filename = path.relative(this.options.context || process.cwd(), this.resourcePath).replace(/\\/g, '/'),
options = loaderUtils.parseQuery(this.query... | javascript | function loader(content, sourceMap) {
/* jshint validthis:true */
// loader result is cacheable
this.cacheable();
// path of the file being processed
var filename = path.relative(this.options.context || process.cwd(), this.resourcePath).replace(/\\/g, '/'),
options = loaderUtils.parseQuery(this.query... | [
"function",
"loader",
"(",
"content",
",",
"sourceMap",
")",
"{",
"/* jshint validthis:true */",
"// loader result is cacheable",
"this",
".",
"cacheable",
"(",
")",
";",
"// path of the file being processed",
"var",
"filename",
"=",
"path",
".",
"relative",
"(",
"thi... | Webpack loader where explicit @ngInject comment creates pre-minification $inject property.
@param {string} content JS content
@param {object} sourceMap The source-map
@returns {string|String} | [
"Webpack",
"loader",
"where",
"explicit"
] | 2ca938d453fb487c05fcca87f3b9c4ad8ae1ec7d | https://github.com/bholloway/nginject-loader/blob/2ca938d453fb487c05fcca87f3b9c4ad8ae1ec7d/index.js#L16-L52 | train |
aurbano/smart-area | dist/smart-area.js | highlightText | function highlightText(){
var text = $scope.areaData,
html = htmlEncode(text);
if(typeof($scope.areaConfig.autocomplete) === 'undefined' || $scope.areaConfig.autocomplete.length === 0){
return;
}
$scope.areaConfig.... | javascript | function highlightText(){
var text = $scope.areaData,
html = htmlEncode(text);
if(typeof($scope.areaConfig.autocomplete) === 'undefined' || $scope.areaConfig.autocomplete.length === 0){
return;
}
$scope.areaConfig.... | [
"function",
"highlightText",
"(",
")",
"{",
"var",
"text",
"=",
"$scope",
".",
"areaData",
",",
"html",
"=",
"htmlEncode",
"(",
"text",
")",
";",
"if",
"(",
"typeof",
"(",
"$scope",
".",
"areaConfig",
".",
"autocomplete",
")",
"===",
"'undefined'",
"||",... | Perform the "syntax" highlighting of autocomplete words that have
a cssClass specified. | [
"Perform",
"the",
"syntax",
"highlighting",
"of",
"autocomplete",
"words",
"that",
"have",
"a",
"cssClass",
"specified",
"."
] | 372b17f9c4c5541591f181ddde4d0e4475c85f3f | https://github.com/aurbano/smart-area/blob/372b17f9c4c5541591f181ddde4d0e4475c85f3f/dist/smart-area.js#L301-L322 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.