id
int32
0
58k
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
22,700
repetere/modelscript
build/modelscript.cjs.js
cross_validate_score
function cross_validate_score(options = {}) { const config = Object.assign({}, { // classifier, // regression, // dataset, // testingset, dependentFeatures: [['X', ], ], independentFeatures: [['Y', ], ], // random_state, folds: 10, accuracy: 'standardError', use_trai...
javascript
function cross_validate_score(options = {}) { const config = Object.assign({}, { // classifier, // regression, // dataset, // testingset, dependentFeatures: [['X', ], ], independentFeatures: [['Y', ], ], // random_state, folds: 10, accuracy: 'standardError', use_trai...
[ "function", "cross_validate_score", "(", "options", "=", "{", "}", ")", "{", "const", "config", "=", "Object", ".", "assign", "(", "{", "}", ",", "{", "// classifier,\r", "// regression,\r", "// dataset,\r", "// testingset,\r", "dependentFeatures", ":", "[", "["...
Used to test variance and bias of a prediction @memberOf cross_validation @param {object} options @param {function} options.classifier - instance of classification model used for training, or function to train a model. e.g. new DecisionTreeClassifier({ gainFunction: 'gini', }) or ml.KNN @param {function} options.regres...
[ "Used", "to", "test", "variance", "and", "bias", "of", "a", "prediction" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.cjs.js#L2316-L2392
22,701
repetere/modelscript
build/modelscript.cjs.js
grid_search
function grid_search(options = {}) { const config = Object.assign({}, { return_parameters: false, compare_score:'mean', sortAccuracyScore:'desc', parameters: {}, }, options); const regressor = config.regression; const classification = config.classifier; const sortAccuracyScore = (!opt...
javascript
function grid_search(options = {}) { const config = Object.assign({}, { return_parameters: false, compare_score:'mean', sortAccuracyScore:'desc', parameters: {}, }, options); const regressor = config.regression; const classification = config.classifier; const sortAccuracyScore = (!opt...
[ "function", "grid_search", "(", "options", "=", "{", "}", ")", "{", "const", "config", "=", "Object", ".", "assign", "(", "{", "}", ",", "{", "return_parameters", ":", "false", ",", "compare_score", ":", "'mean'", ",", "sortAccuracyScore", ":", "'desc'", ...
Used to test variance and bias of a prediction with parameter tuning @memberOf cross_validation @param {object} options @param {function} options.classifier - instance of classification model used for training, or function to train a model. e.g. new DecisionTreeClassifier({ gainFunction: 'gini', }) or ml.KNN @param {fu...
[ "Used", "to", "test", "variance", "and", "bias", "of", "a", "prediction", "with", "parameter", "tuning" ]
b507fad9b3ecfb4a9ec4d44d41052a8082dac763
https://github.com/repetere/modelscript/blob/b507fad9b3ecfb4a9ec4d44d41052a8082dac763/build/modelscript.cjs.js#L2402-L2439
22,702
jhotmann/node-rename-cli
bin.js
epipeError
function epipeError(err) { if (err.code === 'EPIPE' || err.errno === 32) return process.exit; if (process.stdout.listeners('error').length <= 1) { process.stdout.removeAllListeners(); process.stdout.emit('error', err); process.stdout.on('error', epipeError); } }
javascript
function epipeError(err) { if (err.code === 'EPIPE' || err.errno === 32) return process.exit; if (process.stdout.listeners('error').length <= 1) { process.stdout.removeAllListeners(); process.stdout.emit('error', err); process.stdout.on('error', epipeError); } }
[ "function", "epipeError", "(", "err", ")", "{", "if", "(", "err", ".", "code", "===", "'EPIPE'", "||", "err", ".", "errno", "===", "32", ")", "return", "process", ".", "exit", ";", "if", "(", "process", ".", "stdout", ".", "listeners", "(", "'error'"...
Handle EPIPE errors when user doesn't put quotes around output file name with parameters
[ "Handle", "EPIPE", "errors", "when", "user", "doesn", "t", "put", "quotes", "around", "output", "file", "name", "with", "parameters" ]
5d75fdcfc774796efd6a5f830cad9815f6323f20
https://github.com/jhotmann/node-rename-cli/blob/5d75fdcfc774796efd6a5f830cad9815f6323f20/bin.js#L3-L11
22,703
FormidableLabs/builder-support
lib/dev.js
function (source, target, isExternal) { // Clone source var pkg = JSON.parse(JSON.stringify(source)); // Validation of source package. ["name", "description"].forEach(function (name) { if (!pkg[name]) { throw new Error("Source object missing field: " + name); } }); var nameRe = new RegExp("(...
javascript
function (source, target, isExternal) { // Clone source var pkg = JSON.parse(JSON.stringify(source)); // Validation of source package. ["name", "description"].forEach(function (name) { if (!pkg[name]) { throw new Error("Source object missing field: " + name); } }); var nameRe = new RegExp("(...
[ "function", "(", "source", ",", "target", ",", "isExternal", ")", "{", "// Clone source", "var", "pkg", "=", "JSON", ".", "parse", "(", "JSON", ".", "stringify", "(", "source", ")", ")", ";", "// Validation of source package.", "[", "\"name\"", ",", "\"descr...
Update `target` JSON structure with fields from `source`. @param {Object} source Source JSON object @param {Object} target Target JSON object @param {Boolean} isExternal Is external (`../NAME-dev`) dev package. @returns {Object} Updated JSON object
[ "Update", "target", "JSON", "structure", "with", "fields", "from", "source", "." ]
675ef7c1243f02f1243bfee0c68ecd3c167f548d
https://github.com/FormidableLabs/builder-support/blob/675ef7c1243f02f1243bfee0c68ecd3c167f548d/lib/dev.js#L44-L101
22,704
soundar24/roundSlider
src/roundslider.js
function (value) { var o = this.options, min = o.min, max = o.max; this.bar.children().attr({ "aria-valuenow": value }); if (o.sliderType == "range") { var handles = this._handles(); handles.eq(0).attr({ "aria-valuemin": min }); h...
javascript
function (value) { var o = this.options, min = o.min, max = o.max; this.bar.children().attr({ "aria-valuenow": value }); if (o.sliderType == "range") { var handles = this._handles(); handles.eq(0).attr({ "aria-valuemin": min }); h...
[ "function", "(", "value", ")", "{", "var", "o", "=", "this", ".", "options", ",", "min", "=", "o", ".", "min", ",", "max", "=", "o", ".", "max", ";", "this", ".", "bar", ".", "children", "(", ")", ".", "attr", "(", "{", "\"aria-valuenow\"", ":"...
WAI-ARIA support
[ "WAI", "-", "ARIA", "support" ]
b58cd164a894339a4047b568a2202f99dfaa49b8
https://github.com/soundar24/roundSlider/blob/b58cd164a894339a4047b568a2202f99dfaa49b8/src/roundslider.js#L609-L621
22,705
soundar24/roundSlider
src/roundslider.js
function () { var _data = this._dataElement().data("bind"); if (typeof _data == "string" && typeof ko == "object") { var _vm = ko.dataFor(this._dataElement()[0]); if (typeof _vm == "undefined") return true; var _all = _data.split(","), _handle...
javascript
function () { var _data = this._dataElement().data("bind"); if (typeof _data == "string" && typeof ko == "object") { var _vm = ko.dataFor(this._dataElement()[0]); if (typeof _vm == "undefined") return true; var _all = _data.split(","), _handle...
[ "function", "(", ")", "{", "var", "_data", "=", "this", ".", "_dataElement", "(", ")", ".", "data", "(", "\"bind\"", ")", ";", "if", "(", "typeof", "_data", "==", "\"string\"", "&&", "typeof", "ko", "==", "\"object\"", ")", "{", "var", "_vm", "=", ...
Listener for KO binding
[ "Listener", "for", "KO", "binding" ]
b58cd164a894339a4047b568a2202f99dfaa49b8
https://github.com/soundar24/roundSlider/blob/b58cd164a894339a4047b568a2202f99dfaa49b8/src/roundslider.js#L623-L641
22,706
soundar24/roundSlider
src/roundslider.js
function () { if (typeof angular == "object" && typeof angular.element == "function") { this._ngName = this._dataElement().attr("ng-model"); if (typeof this._ngName == "string") { this._isAngular = true; var that = this; this._scop...
javascript
function () { if (typeof angular == "object" && typeof angular.element == "function") { this._ngName = this._dataElement().attr("ng-model"); if (typeof this._ngName == "string") { this._isAngular = true; var that = this; this._scop...
[ "function", "(", ")", "{", "if", "(", "typeof", "angular", "==", "\"object\"", "&&", "typeof", "angular", ".", "element", "==", "\"function\"", ")", "{", "this", ".", "_ngName", "=", "this", ".", "_dataElement", "(", ")", ".", "attr", "(", "\"ng-model\""...
Listener for Angular binding
[ "Listener", "for", "Angular", "binding" ]
b58cd164a894339a4047b568a2202f99dfaa49b8
https://github.com/soundar24/roundSlider/blob/b58cd164a894339a4047b568a2202f99dfaa49b8/src/roundslider.js#L643-L651
22,707
soundar24/roundSlider
src/roundslider.js
CreateRoundSlider
function CreateRoundSlider(options, args) { for (var i = 0; i < this.length; i++) { var that = this[i], instance = $.data(that, pluginName); if (!instance) { var _this = new RoundSlider(that, options); _this._saveInstanceOnElement(); ...
javascript
function CreateRoundSlider(options, args) { for (var i = 0; i < this.length; i++) { var that = this[i], instance = $.data(that, pluginName); if (!instance) { var _this = new RoundSlider(that, options); _this._saveInstanceOnElement(); ...
[ "function", "CreateRoundSlider", "(", "options", ",", "args", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "this", ".", "length", ";", "i", "++", ")", "{", "var", "that", "=", "this", "[", "i", "]", ",", "instance", "=", "$", ".",...
The plugin wrapper, prevents multiple instantiations
[ "The", "plugin", "wrapper", "prevents", "multiple", "instantiations" ]
b58cd164a894339a4047b568a2202f99dfaa49b8
https://github.com/soundar24/roundSlider/blob/b58cd164a894339a4047b568a2202f99dfaa49b8/src/roundslider.js#L1215-L1246
22,708
sematext/sematable
src/selectors.js
filter
function filter(rows = [], filters = [], filterText, columns) { let filteredRows = rows.slice(0); if (filters.length === 0 && !filterText) { return filteredRows; } const textFilters = [ ...(filterText ? [filterText.toLowerCase()] : []), ...filters.filter(f => f.textFilter).map(f => f.value), ]; ...
javascript
function filter(rows = [], filters = [], filterText, columns) { let filteredRows = rows.slice(0); if (filters.length === 0 && !filterText) { return filteredRows; } const textFilters = [ ...(filterText ? [filterText.toLowerCase()] : []), ...filters.filter(f => f.textFilter).map(f => f.value), ]; ...
[ "function", "filter", "(", "rows", "=", "[", "]", ",", "filters", "=", "[", "]", ",", "filterText", ",", "columns", ")", "{", "let", "filteredRows", "=", "rows", ".", "slice", "(", "0", ")", ";", "if", "(", "filters", ".", "length", "===", "0", "...
rows - original data filters - list of selected filters filterText - currently entered text in filter input columns - column definitions
[ "rows", "-", "original", "data", "filters", "-", "list", "of", "selected", "filters", "filterText", "-", "currently", "entered", "text", "in", "filter", "input", "columns", "-", "column", "definitions" ]
1572a90fb2a29ccb2626a451b951413491379fbe
https://github.com/sematext/sematable/blob/1572a90fb2a29ccb2626a451b951413491379fbe/src/selectors.js#L21-L58
22,709
MazeMap/Leaflet.LayerGroup.Collision
src/Leaflet.LayerGroup.Collision.js
function (el) { if (isMSIE8) { // Fallback for MSIE8, will most probably fail on edge cases return [ 0, 0, el.offsetWidth, el.offsetHeight]; } var styles = window.getComputedStyle(el); // getComputedStyle() should return values already in pixels, so using parseInt() // is not as much as a hack as i...
javascript
function (el) { if (isMSIE8) { // Fallback for MSIE8, will most probably fail on edge cases return [ 0, 0, el.offsetWidth, el.offsetHeight]; } var styles = window.getComputedStyle(el); // getComputedStyle() should return values already in pixels, so using parseInt() // is not as much as a hack as i...
[ "function", "(", "el", ")", "{", "if", "(", "isMSIE8", ")", "{", "// Fallback for MSIE8, will most probably fail on edge cases", "return", "[", "0", ",", "0", ",", "el", ".", "offsetWidth", ",", "el", ".", "offsetHeight", "]", ";", "}", "var", "styles", "=",...
Returns a plain array with the relative dimensions of a L.Icon, based on the computed values from iconSize and iconAnchor.
[ "Returns", "a", "plain", "array", "with", "the", "relative", "dimensions", "of", "a", "L", ".", "Icon", "based", "on", "the", "computed", "values", "from", "iconSize", "and", "iconAnchor", "." ]
9543cab71dd2494f930d4ddce464e7742404cc28
https://github.com/MazeMap/Leaflet.LayerGroup.Collision/blob/9543cab71dd2494f930d4ddce464e7742404cc28/src/Leaflet.LayerGroup.Collision.js#L122-L140
22,710
npm/npmconf
lib/load-uid.js
loadUid
function loadUid (cb) { // if we're not in unsafe-perm mode, then figure out who // to run stuff as. Do this first, to support `npm update npm -g` if (!this.get("unsafe-perm")) { getUid(this.get("user"), this.get("group"), cb) } else { process.nextTick(cb) } }
javascript
function loadUid (cb) { // if we're not in unsafe-perm mode, then figure out who // to run stuff as. Do this first, to support `npm update npm -g` if (!this.get("unsafe-perm")) { getUid(this.get("user"), this.get("group"), cb) } else { process.nextTick(cb) } }
[ "function", "loadUid", "(", "cb", ")", "{", "// if we're not in unsafe-perm mode, then figure out who", "// to run stuff as. Do this first, to support `npm update npm -g`", "if", "(", "!", "this", ".", "get", "(", "\"unsafe-perm\"", ")", ")", "{", "getUid", "(", "this", ...
Call in the context of a npmconf object
[ "Call", "in", "the", "context", "of", "a", "npmconf", "object" ]
22827e4038d6eebaafeb5c13ed2b92cf97b8fb82
https://github.com/npm/npmconf/blob/22827e4038d6eebaafeb5c13ed2b92cf97b8fb82/lib/load-uid.js#L7-L15
22,711
Alex1990/tiny-cookie
src/util.js
computeExpires
function computeExpires(str) { const lastCh = str.charAt(str.length - 1); const value = parseInt(str, 10); let expires = new Date(); switch (lastCh) { case 'Y': expires.setFullYear(expires.getFullYear() + value); break; case 'M': expires.setMonth(expires.getMonth() + value); break; case 'D': expire...
javascript
function computeExpires(str) { const lastCh = str.charAt(str.length - 1); const value = parseInt(str, 10); let expires = new Date(); switch (lastCh) { case 'Y': expires.setFullYear(expires.getFullYear() + value); break; case 'M': expires.setMonth(expires.getMonth() + value); break; case 'D': expire...
[ "function", "computeExpires", "(", "str", ")", "{", "const", "lastCh", "=", "str", ".", "charAt", "(", "str", ".", "length", "-", "1", ")", ";", "const", "value", "=", "parseInt", "(", "str", ",", "10", ")", ";", "let", "expires", "=", "new", "Date...
Return a future date by the given string.
[ "Return", "a", "future", "date", "by", "the", "given", "string", "." ]
6fcecdb044465cf35fe0653b7ab6a495c697c3cc
https://github.com/Alex1990/tiny-cookie/blob/6fcecdb044465cf35fe0653b7ab6a495c697c3cc/src/util.js#L11-L27
22,712
Alex1990/tiny-cookie
src/util.js
convert
function convert(opts) { let res = ''; // eslint-disable-next-line for (const key in opts) { if (hasOwn(opts, key)) { if (/^expires$/i.test(key)) { let expires = opts[key]; if (typeof expires !== 'object') { expires += typeof expires === 'number' ? 'D' : ''; expires...
javascript
function convert(opts) { let res = ''; // eslint-disable-next-line for (const key in opts) { if (hasOwn(opts, key)) { if (/^expires$/i.test(key)) { let expires = opts[key]; if (typeof expires !== 'object') { expires += typeof expires === 'number' ? 'D' : ''; expires...
[ "function", "convert", "(", "opts", ")", "{", "let", "res", "=", "''", ";", "// eslint-disable-next-line", "for", "(", "const", "key", "in", "opts", ")", "{", "if", "(", "hasOwn", "(", "opts", ",", "key", ")", ")", "{", "if", "(", "/", "^expires$", ...
Convert an object to a cookie option string.
[ "Convert", "an", "object", "to", "a", "cookie", "option", "string", "." ]
6fcecdb044465cf35fe0653b7ab6a495c697c3cc
https://github.com/Alex1990/tiny-cookie/blob/6fcecdb044465cf35fe0653b7ab6a495c697c3cc/src/util.js#L30-L59
22,713
Alex1990/tiny-cookie
src/index.js
isEnabled
function isEnabled() { const key = '@key@'; const value = '1'; const re = new RegExp(`(?:^|; )${key}=${value}(?:;|$)`); document.cookie = `${key}=${value}`; const enabled = re.test(document.cookie); if (enabled) { // eslint-disable-next-line remove(key); } return enabled; }
javascript
function isEnabled() { const key = '@key@'; const value = '1'; const re = new RegExp(`(?:^|; )${key}=${value}(?:;|$)`); document.cookie = `${key}=${value}`; const enabled = re.test(document.cookie); if (enabled) { // eslint-disable-next-line remove(key); } return enabled; }
[ "function", "isEnabled", "(", ")", "{", "const", "key", "=", "'@key@'", ";", "const", "value", "=", "'1'", ";", "const", "re", "=", "new", "RegExp", "(", "`", "${", "key", "}", "${", "value", "}", "`", ")", ";", "document", ".", "cookie", "=", "`...
Check if the browser cookie is enabled.
[ "Check", "if", "the", "browser", "cookie", "is", "enabled", "." ]
6fcecdb044465cf35fe0653b7ab6a495c697c3cc
https://github.com/Alex1990/tiny-cookie/blob/6fcecdb044465cf35fe0653b7ab6a495c697c3cc/src/index.js#L4-L19
22,714
Alex1990/tiny-cookie
src/index.js
get
function get(key, decoder = decodeURIComponent) { if ((typeof key !== 'string') || !key) { return null; } const reKey = new RegExp(`(?:^|; )${escapeRe(key)}(?:=([^;]*))?(?:;|$)`); const match = reKey.exec(document.cookie); if (match === null) { return null; } return typeof decoder === 'function...
javascript
function get(key, decoder = decodeURIComponent) { if ((typeof key !== 'string') || !key) { return null; } const reKey = new RegExp(`(?:^|; )${escapeRe(key)}(?:=([^;]*))?(?:;|$)`); const match = reKey.exec(document.cookie); if (match === null) { return null; } return typeof decoder === 'function...
[ "function", "get", "(", "key", ",", "decoder", "=", "decodeURIComponent", ")", "{", "if", "(", "(", "typeof", "key", "!==", "'string'", ")", "||", "!", "key", ")", "{", "return", "null", ";", "}", "const", "reKey", "=", "new", "RegExp", "(", "`", "...
Get the cookie value by key.
[ "Get", "the", "cookie", "value", "by", "key", "." ]
6fcecdb044465cf35fe0653b7ab6a495c697c3cc
https://github.com/Alex1990/tiny-cookie/blob/6fcecdb044465cf35fe0653b7ab6a495c697c3cc/src/index.js#L22-L35
22,715
Alex1990/tiny-cookie
src/index.js
getAll
function getAll(decoder = decodeURIComponent) { const reKey = /(?:^|; )([^=]+?)(?:=([^;]*))?(?:;|$)/g; const cookies = {}; let match; /* eslint-disable no-cond-assign */ while ((match = reKey.exec(document.cookie))) { reKey.lastIndex = (match.index + match.length) - 1; cookies[match[1]] = typeof deco...
javascript
function getAll(decoder = decodeURIComponent) { const reKey = /(?:^|; )([^=]+?)(?:=([^;]*))?(?:;|$)/g; const cookies = {}; let match; /* eslint-disable no-cond-assign */ while ((match = reKey.exec(document.cookie))) { reKey.lastIndex = (match.index + match.length) - 1; cookies[match[1]] = typeof deco...
[ "function", "getAll", "(", "decoder", "=", "decodeURIComponent", ")", "{", "const", "reKey", "=", "/", "(?:^|; )([^=]+?)(?:=([^;]*))?(?:;|$)", "/", "g", ";", "const", "cookies", "=", "{", "}", ";", "let", "match", ";", "/* eslint-disable no-cond-assign */", "while...
The all cookies
[ "The", "all", "cookies" ]
6fcecdb044465cf35fe0653b7ab6a495c697c3cc
https://github.com/Alex1990/tiny-cookie/blob/6fcecdb044465cf35fe0653b7ab6a495c697c3cc/src/index.js#L38-L50
22,716
Alex1990/tiny-cookie
src/index.js
remove
function remove(key, options) { let opts = { expires: -1 }; if (options) { opts = { ...options, ...opts }; } return set(key, 'a', opts); }
javascript
function remove(key, options) { let opts = { expires: -1 }; if (options) { opts = { ...options, ...opts }; } return set(key, 'a', opts); }
[ "function", "remove", "(", "key", ",", "options", ")", "{", "let", "opts", "=", "{", "expires", ":", "-", "1", "}", ";", "if", "(", "options", ")", "{", "opts", "=", "{", "...", "options", ",", "...", "opts", "}", ";", "}", "return", "set", "("...
Remove a cookie by the specified key.
[ "Remove", "a", "cookie", "by", "the", "specified", "key", "." ]
6fcecdb044465cf35fe0653b7ab6a495c697c3cc
https://github.com/Alex1990/tiny-cookie/blob/6fcecdb044465cf35fe0653b7ab6a495c697c3cc/src/index.js#L67-L75
22,717
helior/react-highlighter
lib/highlighter.js
function(subject) { if (this.isScalar() && this.hasSearch()) { var search = this.getSearch(); return this.highlightChildren(subject, search); } return this.props.children; }
javascript
function(subject) { if (this.isScalar() && this.hasSearch()) { var search = this.getSearch(); return this.highlightChildren(subject, search); } return this.props.children; }
[ "function", "(", "subject", ")", "{", "if", "(", "this", ".", "isScalar", "(", ")", "&&", "this", ".", "hasSearch", "(", ")", ")", "{", "var", "search", "=", "this", ".", "getSearch", "(", ")", ";", "return", "this", ".", "highlightChildren", "(", ...
A wrapper to the highlight method to determine when the highlighting process should occur. @param {string} subject The body of text that will be searched for highlighted words. @return {Array} An array of ReactElements
[ "A", "wrapper", "to", "the", "highlight", "method", "to", "determine", "when", "the", "highlighting", "process", "should", "occur", "." ]
9c59bfe8a19bc8df1fa02cb2298a94a6bbb13b3f
https://github.com/helior/react-highlighter/blob/9c59bfe8a19bc8df1fa02cb2298a94a6bbb13b3f/lib/highlighter.js#L72-L79
22,718
helior/react-highlighter
lib/highlighter.js
function() { if (this.props.search instanceof RegExp) { return this.props.search; } var flags = ''; if (!this.props.caseSensitive) { flags +='i'; } var search = this.props.search; if (typeof this.props.search === 'string') { search = escapeStringRegexp(search); } ...
javascript
function() { if (this.props.search instanceof RegExp) { return this.props.search; } var flags = ''; if (!this.props.caseSensitive) { flags +='i'; } var search = this.props.search; if (typeof this.props.search === 'string') { search = escapeStringRegexp(search); } ...
[ "function", "(", ")", "{", "if", "(", "this", ".", "props", ".", "search", "instanceof", "RegExp", ")", "{", "return", "this", ".", "props", ".", "search", ";", "}", "var", "flags", "=", "''", ";", "if", "(", "!", "this", ".", "props", ".", "case...
Get the search prop, but always in the form of a regular expression. Use this as a proxy to this.props.search for consistency. @return {RegExp}
[ "Get", "the", "search", "prop", "but", "always", "in", "the", "form", "of", "a", "regular", "expression", ".", "Use", "this", "as", "a", "proxy", "to", "this", ".", "props", ".", "search", "for", "consistency", "." ]
9c59bfe8a19bc8df1fa02cb2298a94a6bbb13b3f
https://github.com/helior/react-highlighter/blob/9c59bfe8a19bc8df1fa02cb2298a94a6bbb13b3f/lib/highlighter.js#L105-L125
22,719
helior/react-highlighter
lib/highlighter.js
function(subject, search) { var matches = search.exec(subject); if (matches) { return { first: matches.index, last: matches.index + matches[0].length }; } }
javascript
function(subject, search) { var matches = search.exec(subject); if (matches) { return { first: matches.index, last: matches.index + matches[0].length }; } }
[ "function", "(", "subject", ",", "search", ")", "{", "var", "matches", "=", "search", ".", "exec", "(", "subject", ")", ";", "if", "(", "matches", ")", "{", "return", "{", "first", ":", "matches", ".", "index", ",", "last", ":", "matches", ".", "in...
Get the indexes of the first and last characters of the matched string. @param {string} subject The string to search against. @param {RegExp} search The regex search query. @return {Object} An object consisting of "first" and "last" properties representing the indexes of the first and last characters of a matching...
[ "Get", "the", "indexes", "of", "the", "first", "and", "last", "characters", "of", "the", "matched", "string", "." ]
9c59bfe8a19bc8df1fa02cb2298a94a6bbb13b3f
https://github.com/helior/react-highlighter/blob/9c59bfe8a19bc8df1fa02cb2298a94a6bbb13b3f/lib/highlighter.js#L140-L148
22,720
helior/react-highlighter
lib/highlighter.js
function(subject, search) { var children = []; var remaining = subject; while (remaining) { var remainingCleaned = (this.props.ignoreDiacritics ? removeDiacritics(remaining, this.props.diacriticsBlacklist) : remaining ); if (!search.test(remainingCleaned)) { child...
javascript
function(subject, search) { var children = []; var remaining = subject; while (remaining) { var remainingCleaned = (this.props.ignoreDiacritics ? removeDiacritics(remaining, this.props.diacriticsBlacklist) : remaining ); if (!search.test(remainingCleaned)) { child...
[ "function", "(", "subject", ",", "search", ")", "{", "var", "children", "=", "[", "]", ";", "var", "remaining", "=", "subject", ";", "while", "(", "remaining", ")", "{", "var", "remainingCleaned", "=", "(", "this", ".", "props", ".", "ignoreDiacritics", ...
Determines which strings of text should be highlighted or not. @param {string} subject The body of text that will be searched for highlighted words. @param {string} search The search used to search for highlighted words. @return {Array} An array of ReactElements
[ "Determines", "which", "strings", "of", "text", "should", "be", "highlighted", "or", "not", "." ]
9c59bfe8a19bc8df1fa02cb2298a94a6bbb13b3f
https://github.com/helior/react-highlighter/blob/9c59bfe8a19bc8df1fa02cb2298a94a6bbb13b3f/lib/highlighter.js#L161-L201
22,721
helior/react-highlighter
lib/highlighter.js
function(string) { this.count++; return React.createElement(this.props.matchElement, { key: this.count, className: this.props.matchClass, style: this.props.matchStyle, children: string }); }
javascript
function(string) { this.count++; return React.createElement(this.props.matchElement, { key: this.count, className: this.props.matchClass, style: this.props.matchStyle, children: string }); }
[ "function", "(", "string", ")", "{", "this", ".", "count", "++", ";", "return", "React", ".", "createElement", "(", "this", ".", "props", ".", "matchElement", ",", "{", "key", ":", "this", ".", "count", ",", "className", ":", "this", ".", "props", "....
Responsible for rending a highlighted element. @param {string} string A string value to wrap an element around. @return {ReactElement}
[ "Responsible", "for", "rending", "a", "highlighted", "element", "." ]
9c59bfe8a19bc8df1fa02cb2298a94a6bbb13b3f
https://github.com/helior/react-highlighter/blob/9c59bfe8a19bc8df1fa02cb2298a94a6bbb13b3f/lib/highlighter.js#L224-L232
22,722
iVis-at-Bilkent/cytoscape.js-expand-collapse
src/cueUtilities.js
function(node, e){ if (node){ var currMousePos = e.position || e.cyPosition; var topLeft = { x: (node.position("x") - node.width() / 2 - parseFloat(node.css('padding-left'))), y: (node.position("y") - node.height() / 2 - parseFloat(node.css('padding-top')))}; var bottomRight = { x: (node.p...
javascript
function(node, e){ if (node){ var currMousePos = e.position || e.cyPosition; var topLeft = { x: (node.position("x") - node.width() / 2 - parseFloat(node.css('padding-left'))), y: (node.position("y") - node.height() / 2 - parseFloat(node.css('padding-top')))}; var bottomRight = { x: (node.p...
[ "function", "(", "node", ",", "e", ")", "{", "if", "(", "node", ")", "{", "var", "currMousePos", "=", "e", ".", "position", "||", "e", ".", "cyPosition", ";", "var", "topLeft", "=", "{", "x", ":", "(", "node", ".", "position", "(", "\"x\"", ")", ...
check if mouse is inside given node
[ "check", "if", "mouse", "is", "inside", "given", "node" ]
8a2e4157def5613e0e477e393dc2c0720e41c032
https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse/blob/8a2e4157def5613e0e477e393dc2c0720e41c032/src/cueUtilities.js#L208-L224
22,723
iVis-at-Bilkent/cytoscape.js-expand-collapse
src/index.js
evalOptions
function evalOptions(options) { var animate = typeof options.animate === 'function' ? options.animate.call() : options.animate; var fisheye = typeof options.fisheye === 'function' ? options.fisheye.call() : options.fisheye; options.animate = animate; options.fisheye = fisheye; }
javascript
function evalOptions(options) { var animate = typeof options.animate === 'function' ? options.animate.call() : options.animate; var fisheye = typeof options.fisheye === 'function' ? options.fisheye.call() : options.fisheye; options.animate = animate; options.fisheye = fisheye; }
[ "function", "evalOptions", "(", "options", ")", "{", "var", "animate", "=", "typeof", "options", ".", "animate", "===", "'function'", "?", "options", ".", "animate", ".", "call", "(", ")", ":", "options", ".", "animate", ";", "var", "fisheye", "=", "type...
evaluate some specific options in case of they are specified as functions to be dynamically changed
[ "evaluate", "some", "specific", "options", "in", "case", "of", "they", "are", "specified", "as", "functions", "to", "be", "dynamically", "changed" ]
8a2e4157def5613e0e477e393dc2c0720e41c032
https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse/blob/8a2e4157def5613e0e477e393dc2c0720e41c032/src/index.js#L27-L33
22,724
iVis-at-Bilkent/cytoscape.js-expand-collapse
src/expandCollapseUtilities.js
function (nodes, options) { // If there is just one node to expand we need to animate for fisheye view, but if there are more then one node we do not if (nodes.length === 1) { var node = nodes[0]; if (node._private.data.collapsedChildren != null) { // Expand the given node the third p...
javascript
function (nodes, options) { // If there is just one node to expand we need to animate for fisheye view, but if there are more then one node we do not if (nodes.length === 1) { var node = nodes[0]; if (node._private.data.collapsedChildren != null) { // Expand the given node the third p...
[ "function", "(", "nodes", ",", "options", ")", "{", "// If there is just one node to expand we need to animate for fisheye view, but if there are more then one node we do not", "if", "(", "nodes", ".", "length", "===", "1", ")", "{", "var", "node", "=", "nodes", "[", "0",...
Expand the given nodes perform end operation after expandation
[ "Expand", "the", "given", "nodes", "perform", "end", "operation", "after", "expandation" ]
8a2e4157def5613e0e477e393dc2c0720e41c032
https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse/blob/8a2e4157def5613e0e477e393dc2c0720e41c032/src/expandCollapseUtilities.js#L129-L149
22,725
iVis-at-Bilkent/cytoscape.js-expand-collapse
src/expandCollapseUtilities.js
function (nodes, options) { /* * In collapse operation there is no fisheye view to be applied so there is no animation to be destroyed here. We can do this * in a batch. */ cy.startBatch(); this.simpleCollapseGivenNodes(nodes, options); cy.endBatch(); nodes.trigger("position"); // ...
javascript
function (nodes, options) { /* * In collapse operation there is no fisheye view to be applied so there is no animation to be destroyed here. We can do this * in a batch. */ cy.startBatch(); this.simpleCollapseGivenNodes(nodes, options); cy.endBatch(); nodes.trigger("position"); // ...
[ "function", "(", "nodes", ",", "options", ")", "{", "/*\n * In collapse operation there is no fisheye view to be applied so there is no animation to be destroyed here. We can do this \n * in a batch.\n */", "cy", ".", "startBatch", "(", ")", ";", "this", ".", "simpleColla...
collapse the given nodes then perform end operation
[ "collapse", "the", "given", "nodes", "then", "perform", "end", "operation" ]
8a2e4157def5613e0e477e393dc2c0720e41c032
https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse/blob/8a2e4157def5613e0e477e393dc2c0720e41c032/src/expandCollapseUtilities.js#L151-L170
22,726
iVis-at-Bilkent/cytoscape.js-expand-collapse
src/expandCollapseUtilities.js
function (root) { var children = root.children(); for (var i = 0; i < children.length; i++) { var node = children[i]; this.collapseBottomUp(node); } //If the root is a compound node to be collapsed then collapse it if (root.data("collapse") && root.children().length > 0) { this.col...
javascript
function (root) { var children = root.children(); for (var i = 0; i < children.length; i++) { var node = children[i]; this.collapseBottomUp(node); } //If the root is a compound node to be collapsed then collapse it if (root.data("collapse") && root.children().length > 0) { this.col...
[ "function", "(", "root", ")", "{", "var", "children", "=", "root", ".", "children", "(", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")", "{", "var", "node", "=", "children", "[", "i", ...
collapse the nodes in bottom up order starting from the root
[ "collapse", "the", "nodes", "in", "bottom", "up", "order", "starting", "from", "the", "root" ]
8a2e4157def5613e0e477e393dc2c0720e41c032
https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse/blob/8a2e4157def5613e0e477e393dc2c0720e41c032/src/expandCollapseUtilities.js#L172-L183
22,727
iVis-at-Bilkent/cytoscape.js-expand-collapse
src/expandCollapseUtilities.js
function (root, applyFishEyeViewToEachNode) { if (root.data("expand") && root._private.data.collapsedChildren != null) { // Expand the root and unmark its expand data to specify that it is no more to be expanded this.expandNode(root, applyFishEyeViewToEachNode); root.removeData("expand"); } ...
javascript
function (root, applyFishEyeViewToEachNode) { if (root.data("expand") && root._private.data.collapsedChildren != null) { // Expand the root and unmark its expand data to specify that it is no more to be expanded this.expandNode(root, applyFishEyeViewToEachNode); root.removeData("expand"); } ...
[ "function", "(", "root", ",", "applyFishEyeViewToEachNode", ")", "{", "if", "(", "root", ".", "data", "(", "\"expand\"", ")", "&&", "root", ".", "_private", ".", "data", ".", "collapsedChildren", "!=", "null", ")", "{", "// Expand the root and unmark its expand ...
expand the nodes in top down order starting from the root
[ "expand", "the", "nodes", "in", "top", "down", "order", "starting", "from", "the", "root" ]
8a2e4157def5613e0e477e393dc2c0720e41c032
https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse/blob/8a2e4157def5613e0e477e393dc2c0720e41c032/src/expandCollapseUtilities.js#L185-L197
22,728
iVis-at-Bilkent/cytoscape.js-expand-collapse
src/expandCollapseUtilities.js
function (renderedPosition) { var pan = cy.pan(); var zoom = cy.zoom(); var x = (renderedPosition.x - pan.x) / zoom; var y = (renderedPosition.y - pan.y) / zoom; return { x: x, y: y }; }
javascript
function (renderedPosition) { var pan = cy.pan(); var zoom = cy.zoom(); var x = (renderedPosition.x - pan.x) / zoom; var y = (renderedPosition.y - pan.y) / zoom; return { x: x, y: y }; }
[ "function", "(", "renderedPosition", ")", "{", "var", "pan", "=", "cy", ".", "pan", "(", ")", ";", "var", "zoom", "=", "cy", ".", "zoom", "(", ")", ";", "var", "x", "=", "(", "renderedPosition", ".", "x", "-", "pan", ".", "x", ")", "/", "zoom",...
Converst the rendered position to model position according to global pan and zoom values
[ "Converst", "the", "rendered", "position", "to", "model", "position", "according", "to", "global", "pan", "and", "zoom", "values" ]
8a2e4157def5613e0e477e393dc2c0720e41c032
https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse/blob/8a2e4157def5613e0e477e393dc2c0720e41c032/src/expandCollapseUtilities.js#L199-L210
22,729
iVis-at-Bilkent/cytoscape.js-expand-collapse
src/expandCollapseUtilities.js
function (node) { if (node._private.data.collapsedChildren == null) { node.data('position-before-collapse', { x: node.position().x, y: node.position().y }); node.data('size-before-collapse', { w: node.outerWidth(), h: node.outerHeight() }); var childre...
javascript
function (node) { if (node._private.data.collapsedChildren == null) { node.data('position-before-collapse', { x: node.position().x, y: node.position().y }); node.data('size-before-collapse', { w: node.outerWidth(), h: node.outerHeight() }); var childre...
[ "function", "(", "node", ")", "{", "if", "(", "node", ".", "_private", ".", "data", ".", "collapsedChildren", "==", "null", ")", "{", "node", ".", "data", "(", "'position-before-collapse'", ",", "{", "x", ":", "node", ".", "position", "(", ")", ".", ...
collapse the given node without performing end operation
[ "collapse", "the", "given", "node", "without", "performing", "end", "operation" ]
8a2e4157def5613e0e477e393dc2c0720e41c032
https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse/blob/8a2e4157def5613e0e477e393dc2c0720e41c032/src/expandCollapseUtilities.js#L299-L329
22,730
iVis-at-Bilkent/cytoscape.js-expand-collapse
src/expandCollapseUtilities.js
function(node, collapsedChildren){ var children = node.data('collapsedChildren'); var i; for (i=0; i < children.length; i++){ if (children[i].data('collapsedChildren')){ collapsedChildren = collapsedChildren.union(this.getCollapsedChildrenRecursively(children[i], collapsedChildren)); } ...
javascript
function(node, collapsedChildren){ var children = node.data('collapsedChildren'); var i; for (i=0; i < children.length; i++){ if (children[i].data('collapsedChildren')){ collapsedChildren = collapsedChildren.union(this.getCollapsedChildrenRecursively(children[i], collapsedChildren)); } ...
[ "function", "(", "node", ",", "collapsedChildren", ")", "{", "var", "children", "=", "node", ".", "data", "(", "'collapsedChildren'", ")", ";", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", "i", "++", ")...
Get all collapsed children - including nested ones @param node : a collapsed node @param collapsedChildren : a collection to store the result @return : collapsed children
[ "Get", "all", "collapsed", "children", "-", "including", "nested", "ones" ]
8a2e4157def5613e0e477e393dc2c0720e41c032
https://github.com/iVis-at-Bilkent/cytoscape.js-expand-collapse/blob/8a2e4157def5613e0e477e393dc2c0720e41c032/src/expandCollapseUtilities.js#L656-L666
22,731
uupaa/UserAgent.js
docs/lib/WebModule.js
function(moduleName, moduleClosure) { var wm = this; // GLOBAL.WebModule // https://github.com/uupaa/WebModule/wiki/SwitchModulePattern var alias = wm[moduleName] ? (moduleName + "_") : moduleName; if (!wm[alias]) { // secondary module already exported -> skip wm[alias] = m...
javascript
function(moduleName, moduleClosure) { var wm = this; // GLOBAL.WebModule // https://github.com/uupaa/WebModule/wiki/SwitchModulePattern var alias = wm[moduleName] ? (moduleName + "_") : moduleName; if (!wm[alias]) { // secondary module already exported -> skip wm[alias] = m...
[ "function", "(", "moduleName", ",", "moduleClosure", ")", "{", "var", "wm", "=", "this", ";", "// GLOBAL.WebModule", "// https://github.com/uupaa/WebModule/wiki/SwitchModulePattern", "var", "alias", "=", "wm", "[", "moduleName", "]", "?", "(", "moduleName", "+", "\"...
module script stocker
[ "module", "script", "stocker" ]
5d90111f44c1a90a68c804f30f949b3feac436dd
https://github.com/uupaa/UserAgent.js/blob/5d90111f44c1a90a68c804f30f949b3feac436dd/docs/lib/WebModule.js#L39-L54
22,732
uupaa/UserAgent.js
lib/WebModule.js
function(moduleName, // @arg ModuleNameString moduleClosure) { // @arg JavaScriptCodeString // @ret ModuleObject var wm = this; // GLOBAL.WebModule // https://github.com/uupaa/WebModule/wiki/SwitchModulePattern var alias = wm[mod...
javascript
function(moduleName, // @arg ModuleNameString moduleClosure) { // @arg JavaScriptCodeString // @ret ModuleObject var wm = this; // GLOBAL.WebModule // https://github.com/uupaa/WebModule/wiki/SwitchModulePattern var alias = wm[mod...
[ "function", "(", "moduleName", ",", "// @arg ModuleNameString", "moduleClosure", ")", "{", "// @arg JavaScriptCodeString", "// @ret ModuleObject", "var", "wm", "=", "this", ";", "// GLOBAL.WebModule", "// https://github.com/uupaa/WebModule/wiki/SwitchModulePattern", "var", "alias...
publish flag, module publish to global namespace.
[ "publish", "flag", "module", "publish", "to", "global", "namespace", "." ]
5d90111f44c1a90a68c804f30f949b3feac436dd
https://github.com/uupaa/UserAgent.js/blob/5d90111f44c1a90a68c804f30f949b3feac436dd/lib/WebModule.js#L39-L56
22,733
garrows/browser-serialport
index.js
buffer2ArrayBuffer
function buffer2ArrayBuffer(buffer) { var buf = new ArrayBuffer(buffer.length); var bufView = new Uint8Array(buf); for (var i = 0; i < buffer.length; i++) { bufView[i] = buffer[i]; } return buf; }
javascript
function buffer2ArrayBuffer(buffer) { var buf = new ArrayBuffer(buffer.length); var bufView = new Uint8Array(buf); for (var i = 0; i < buffer.length; i++) { bufView[i] = buffer[i]; } return buf; }
[ "function", "buffer2ArrayBuffer", "(", "buffer", ")", "{", "var", "buf", "=", "new", "ArrayBuffer", "(", "buffer", ".", "length", ")", ";", "var", "bufView", "=", "new", "Uint8Array", "(", "buf", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", ...
Convert buffer to ArrayBuffer
[ "Convert", "buffer", "to", "ArrayBuffer" ]
3238bfa89a3f9d098a5263e1f63c3a7dbbeda759
https://github.com/garrows/browser-serialport/blob/3238bfa89a3f9d098a5263e1f63c3a7dbbeda759/index.js#L400-L407
22,734
feathers-plus/graphql
lib/run-time/feathers/feathers-batch-loader.js
batchLoaderFunc
function batchLoaderFunc(graphqlType, serializeRecordKey, getRecords) { return keys => getRecords(keys) .then(resultArray => getResultsByKey( keys, extractAllItems(resultArray), serializeRecordKey, graphqlType, { onError: logger } ) ); }
javascript
function batchLoaderFunc(graphqlType, serializeRecordKey, getRecords) { return keys => getRecords(keys) .then(resultArray => getResultsByKey( keys, extractAllItems(resultArray), serializeRecordKey, graphqlType, { onError: logger } ) ); }
[ "function", "batchLoaderFunc", "(", "graphqlType", ",", "serializeRecordKey", ",", "getRecords", ")", "{", "return", "keys", "=>", "getRecords", "(", "keys", ")", ".", "then", "(", "resultArray", "=>", "getResultsByKey", "(", "keys", ",", "extractAllItems", "(",...
Key loader function for BatchLoader. Note that serializeBatchLoaderKey has already been passed to BatchLoader as cacheKeyFn
[ "Key", "loader", "function", "for", "BatchLoader", ".", "Note", "that", "serializeBatchLoaderKey", "has", "already", "been", "passed", "to", "BatchLoader", "as", "cacheKeyFn" ]
259c0e6375d7054476d3ae24b2b27e194e375852
https://github.com/feathers-plus/graphql/blob/259c0e6375d7054476d3ae24b2b27e194e375852/lib/run-time/feathers/feathers-batch-loader.js#L74-L81
22,735
fshost/node-dir
lib/readfiles.js
extend
function extend(target, source, modify) { var result = target ? modify ? target : extend({}, target, true) : {}; if (!source) return result; for (var key in source) { if (source.hasOwnProperty(key) && source[key] !== undefined) { result[key] = source[key]; } } return resu...
javascript
function extend(target, source, modify) { var result = target ? modify ? target : extend({}, target, true) : {}; if (!source) return result; for (var key in source) { if (source.hasOwnProperty(key) && source[key] !== undefined) { result[key] = source[key]; } } return resu...
[ "function", "extend", "(", "target", ",", "source", ",", "modify", ")", "{", "var", "result", "=", "target", "?", "modify", "?", "target", ":", "extend", "(", "{", "}", ",", "target", ",", "true", ")", ":", "{", "}", ";", "if", "(", "!", "source"...
merge two objects by extending target object with source object @param target object to merge @param source object to merge @param {Boolean} [modify] whether to modify the target @returns {Object} extended object
[ "merge", "two", "objects", "by", "extending", "target", "object", "with", "source", "object" ]
a57c3b1b571dd91f464ae398090ba40f64ba38a2
https://github.com/fshost/node-dir/blob/a57c3b1b571dd91f464ae398090ba40f64ba38a2/lib/readfiles.js#L11-L20
22,736
feathers-plus/graphql
lib/run-time/feathers/extract-items.js
extractAllItems
function extractAllItems (result) { if (!result) return null; if (!Array.isArray(result)) result = ('data' in result) ? result.data : result; if (!result) return null; if (!Array.isArray(result)) result = [result]; return result; }
javascript
function extractAllItems (result) { if (!result) return null; if (!Array.isArray(result)) result = ('data' in result) ? result.data : result; if (!result) return null; if (!Array.isArray(result)) result = [result]; return result; }
[ "function", "extractAllItems", "(", "result", ")", "{", "if", "(", "!", "result", ")", "return", "null", ";", "if", "(", "!", "Array", ".", "isArray", "(", "result", ")", ")", "result", "=", "(", "'data'", "in", "result", ")", "?", "result", ".", "...
Return an array of objects from a Feathers service call.
[ "Return", "an", "array", "of", "objects", "from", "a", "Feathers", "service", "call", "." ]
259c0e6375d7054476d3ae24b2b27e194e375852
https://github.com/feathers-plus/graphql/blob/259c0e6375d7054476d3ae24b2b27e194e375852/lib/run-time/feathers/extract-items.js#L8-L17
22,737
feathers-plus/graphql
lib/run-time/feathers/extract-items.js
extractFirstItem
function extractFirstItem (result) { const data = extractAllItems(result); if (!data) return null; if (data.length > 1) throw new Error(`service.find expected 0 or 1 objects, not ${data.length}. (extractFirstItem)`); return data.length ? data[0] : null; }
javascript
function extractFirstItem (result) { const data = extractAllItems(result); if (!data) return null; if (data.length > 1) throw new Error(`service.find expected 0 or 1 objects, not ${data.length}. (extractFirstItem)`); return data.length ? data[0] : null; }
[ "function", "extractFirstItem", "(", "result", ")", "{", "const", "data", "=", "extractAllItems", "(", "result", ")", ";", "if", "(", "!", "data", ")", "return", "null", ";", "if", "(", "data", ".", "length", ">", "1", ")", "throw", "new", "Error", "...
Return the first and only object from a Feathers service call, or null if none.
[ "Return", "the", "first", "and", "only", "object", "from", "a", "Feathers", "service", "call", "or", "null", "if", "none", "." ]
259c0e6375d7054476d3ae24b2b27e194e375852
https://github.com/feathers-plus/graphql/blob/259c0e6375d7054476d3ae24b2b27e194e375852/lib/run-time/feathers/extract-items.js#L20-L27
22,738
reinerBa/Vue-Responsive
src/index.js
checkDisplay
function checkDisplay () { var myPermissions = self.allProperties[resizeListenerId] // JSON.parse(el.dataset.responsives) var curWidth = window.innerWidth var initial = el.dataset.initialDisplay ? el.dataset.initialDisplay : '' var parameters = self._rPermissions[binding.arg] for (let i in...
javascript
function checkDisplay () { var myPermissions = self.allProperties[resizeListenerId] // JSON.parse(el.dataset.responsives) var curWidth = window.innerWidth var initial = el.dataset.initialDisplay ? el.dataset.initialDisplay : '' var parameters = self._rPermissions[binding.arg] for (let i in...
[ "function", "checkDisplay", "(", ")", "{", "var", "myPermissions", "=", "self", ".", "allProperties", "[", "resizeListenerId", "]", "// JSON.parse(el.dataset.responsives)", "var", "curWidth", "=", "window", ".", "innerWidth", "var", "initial", "=", "el", ".", "dat...
This function checks the current breakpoint constraints for this element
[ "This", "function", "checks", "the", "current", "breakpoint", "constraints", "for", "this", "element" ]
9edf8298fc6e922d856bb74db5c38c5cd3d9c39c
https://github.com/reinerBa/Vue-Responsive/blob/9edf8298fc6e922d856bb74db5c38c5cd3d9c39c/src/index.js#L176-L196
22,739
reinerBa/Vue-Responsive
src/index.js
function (el, binding, vnode) { let resizeListenerId = el.dataset.responsives delete self.resizeListeners[resizeListenerId] }
javascript
function (el, binding, vnode) { let resizeListenerId = el.dataset.responsives delete self.resizeListeners[resizeListenerId] }
[ "function", "(", "el", ",", "binding", ",", "vnode", ")", "{", "let", "resizeListenerId", "=", "el", ".", "dataset", ".", "responsives", "delete", "self", ".", "resizeListeners", "[", "resizeListenerId", "]", "}" ]
Is called when the html element is removed from DOM @param {object} el html element @param {object} binding the parameters of the mixin @param {object} vnode the virtual html elment
[ "Is", "called", "when", "the", "html", "element", "is", "removed", "from", "DOM" ]
9edf8298fc6e922d856bb74db5c38c5cd3d9c39c
https://github.com/reinerBa/Vue-Responsive/blob/9edf8298fc6e922d856bb74db5c38c5cd3d9c39c/src/index.js#L208-L211
22,740
d3plus/d3plus-text
src/textWidth.js
htmlDecode
function htmlDecode(input) { if (input === " ") return input; const doc = new DOMParser().parseFromString(input.replace(/<[^>]+>/g, ""), "text/html"); return doc.documentElement.textContent; }
javascript
function htmlDecode(input) { if (input === " ") return input; const doc = new DOMParser().parseFromString(input.replace(/<[^>]+>/g, ""), "text/html"); return doc.documentElement.textContent; }
[ "function", "htmlDecode", "(", "input", ")", "{", "if", "(", "input", "===", "\" \"", ")", "return", "input", ";", "const", "doc", "=", "new", "DOMParser", "(", ")", ".", "parseFromString", "(", "input", ".", "replace", "(", "/", "<[^>]+>", "/", "g", ...
Strips HTML and "un-escapes" escape characters. @param {String} input
[ "Strips", "HTML", "and", "un", "-", "escapes", "escape", "characters", "." ]
00af6bb99ff048e132c287dd7f43fcc3143264d5
https://github.com/d3plus/d3plus-text/blob/00af6bb99ff048e132c287dd7f43fcc3143264d5/src/textWidth.js#L5-L9
22,741
bencentra/jq-signature
jq-signature.js
function() { this.id = 'jq-signature-canvas-' + (++idCounter); // Set up the canvas this.$canvas = $(canvasFixture).appendTo(this.$element); this.$canvas.attr({ width: this.settings.width, height: this.settings.height }); this.$canvas.css({ boxSizing: 'border-bo...
javascript
function() { this.id = 'jq-signature-canvas-' + (++idCounter); // Set up the canvas this.$canvas = $(canvasFixture).appendTo(this.$element); this.$canvas.attr({ width: this.settings.width, height: this.settings.height }); this.$canvas.css({ boxSizing: 'border-bo...
[ "function", "(", ")", "{", "this", ".", "id", "=", "'jq-signature-canvas-'", "+", "(", "++", "idCounter", ")", ";", "// Set up the canvas", "this", ".", "$canvas", "=", "$", "(", "canvasFixture", ")", ".", "appendTo", "(", "this", ".", "$element", ")", "...
Initialize the signature canvas
[ "Initialize", "the", "signature", "canvas" ]
0316358410c41319977d076ece050fedd11411c4
https://github.com/bencentra/jq-signature/blob/0316358410c41319977d076ece050fedd11411c4/jq-signature.js#L56-L112
22,742
bencentra/jq-signature
jq-signature.js
function (e) { this.drawing = true; this.lastPos = this.currentPos = this._getPosition(e); // Prevent scrolling, etc $('body').css('overflow', 'hidden'); e.preventDefault(); }
javascript
function (e) { this.drawing = true; this.lastPos = this.currentPos = this._getPosition(e); // Prevent scrolling, etc $('body').css('overflow', 'hidden'); e.preventDefault(); }
[ "function", "(", "e", ")", "{", "this", ".", "drawing", "=", "true", ";", "this", ".", "lastPos", "=", "this", ".", "currentPos", "=", "this", ".", "_getPosition", "(", "e", ")", ";", "// Prevent scrolling, etc", "$", "(", "'body'", ")", ".", "css", ...
Handle the start of a signature
[ "Handle", "the", "start", "of", "a", "signature" ]
0316358410c41319977d076ece050fedd11411c4
https://github.com/bencentra/jq-signature/blob/0316358410c41319977d076ece050fedd11411c4/jq-signature.js#L126-L132
22,743
bencentra/jq-signature
jq-signature.js
function (e) { this.drawing = false; // Trigger a change event var changedEvent = $.Event('jq.signature.changed'); this.$element.trigger(changedEvent); // Allow scrolling again $('body').css('overflow', 'auto'); e.preventDefault(); }
javascript
function (e) { this.drawing = false; // Trigger a change event var changedEvent = $.Event('jq.signature.changed'); this.$element.trigger(changedEvent); // Allow scrolling again $('body').css('overflow', 'auto'); e.preventDefault(); }
[ "function", "(", "e", ")", "{", "this", ".", "drawing", "=", "false", ";", "// Trigger a change event", "var", "changedEvent", "=", "$", ".", "Event", "(", "'jq.signature.changed'", ")", ";", "this", ".", "$element", ".", "trigger", "(", "changedEvent", ")",...
Handle the end of a signature
[ "Handle", "the", "end", "of", "a", "signature" ]
0316358410c41319977d076ece050fedd11411c4
https://github.com/bencentra/jq-signature/blob/0316358410c41319977d076ece050fedd11411c4/jq-signature.js#L141-L149
22,744
bencentra/jq-signature
jq-signature.js
function() { if (this.drawing) { this.ctx.beginPath(); this.ctx.moveTo(this.lastPos.x, this.lastPos.y); this.ctx.lineTo(this.currentPos.x, this.currentPos.y); this.ctx.stroke(); this.lastPos = this.currentPos; } }
javascript
function() { if (this.drawing) { this.ctx.beginPath(); this.ctx.moveTo(this.lastPos.x, this.lastPos.y); this.ctx.lineTo(this.currentPos.x, this.currentPos.y); this.ctx.stroke(); this.lastPos = this.currentPos; } }
[ "function", "(", ")", "{", "if", "(", "this", ".", "drawing", ")", "{", "this", ".", "ctx", ".", "beginPath", "(", ")", ";", "this", ".", "ctx", ".", "moveTo", "(", "this", ".", "lastPos", ".", "x", ",", "this", ".", "lastPos", ".", "y", ")", ...
Render the signature to the canvas
[ "Render", "the", "signature", "to", "the", "canvas" ]
0316358410c41319977d076ece050fedd11411c4
https://github.com/bencentra/jq-signature/blob/0316358410c41319977d076ece050fedd11411c4/jq-signature.js#L175-L183
22,745
bencentra/jq-signature
jq-signature.js
function() { this.ctx = this.canvas.getContext("2d"); this.ctx.strokeStyle = this.settings.lineColor; this.ctx.lineWidth = this.settings.lineWidth; }
javascript
function() { this.ctx = this.canvas.getContext("2d"); this.ctx.strokeStyle = this.settings.lineColor; this.ctx.lineWidth = this.settings.lineWidth; }
[ "function", "(", ")", "{", "this", ".", "ctx", "=", "this", ".", "canvas", ".", "getContext", "(", "\"2d\"", ")", ";", "this", ".", "ctx", ".", "strokeStyle", "=", "this", ".", "settings", ".", "lineColor", ";", "this", ".", "ctx", ".", "lineWidth", ...
Reset the canvas context
[ "Reset", "the", "canvas", "context" ]
0316358410c41319977d076ece050fedd11411c4
https://github.com/bencentra/jq-signature/blob/0316358410c41319977d076ece050fedd11411c4/jq-signature.js#L186-L190
22,746
philbooth/bfj
src/read.js
read
function read (path, options) { return parse(fs.createReadStream(path, options), Object.assign({}, options, { ndjson: false })) }
javascript
function read (path, options) { return parse(fs.createReadStream(path, options), Object.assign({}, options, { ndjson: false })) }
[ "function", "read", "(", "path", ",", "options", ")", "{", "return", "parse", "(", "fs", ".", "createReadStream", "(", "path", ",", "options", ")", ",", "Object", ".", "assign", "(", "{", "}", ",", "options", ",", "{", "ndjson", ":", "false", "}", ...
Public function `read`. Returns a promise and asynchronously parses a JSON file read from disk. If there are no errors, the promise is resolved with the parsed data. If errors occur, the promise is rejected with the first error. @param path: Path to the JSON file. @option reviver: Transformation function, in...
[ "Public", "function", "read", "." ]
61087c194d5675c75569a2e08617a98609b16ead
https://github.com/philbooth/bfj/blob/61087c194d5675c75569a2e08617a98609b16ead/src/read.js#L24-L26
22,747
philbooth/bfj
src/write.js
write
function write (path, data, options) { const Promise = promise(options) return new Promise((resolve, reject) => { streamify(data, options) .pipe(fs.createWriteStream(path, options)) .on('finish', () => { resolve() }) .on('error', reject) .on('dataError', reject) }) }
javascript
function write (path, data, options) { const Promise = promise(options) return new Promise((resolve, reject) => { streamify(data, options) .pipe(fs.createWriteStream(path, options)) .on('finish', () => { resolve() }) .on('error', reject) .on('dataError', reject) }) }
[ "function", "write", "(", "path", ",", "data", ",", "options", ")", "{", "const", "Promise", "=", "promise", "(", "options", ")", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "streamify", "(", "data", ",", "options", ...
Public function `write`. Returns a promise and asynchronously serialises a data structure to a JSON file on disk. Sanely handles promises, buffers, maps and other iterables. @param path: Path to the JSON file. @param data: The data to transform. @option space: Indentation string, or the ...
[ "Public", "function", "write", "." ]
61087c194d5675c75569a2e08617a98609b16ead
https://github.com/philbooth/bfj/blob/61087c194d5675c75569a2e08617a98609b16ead/src/write.js#L43-L55
22,748
philbooth/bfj
src/stringify.js
stringify
function stringify (data, options) { const json = [] const Promise = promise(options) const stream = streamify(data, options) let resolve, reject stream.on('data', read) stream.on('end', end) stream.on('error', error) stream.on('dataError', error) return new Promise((res, rej) => { resolve = re...
javascript
function stringify (data, options) { const json = [] const Promise = promise(options) const stream = streamify(data, options) let resolve, reject stream.on('data', read) stream.on('end', end) stream.on('error', error) stream.on('dataError', error) return new Promise((res, rej) => { resolve = re...
[ "function", "stringify", "(", "data", ",", "options", ")", "{", "const", "json", "=", "[", "]", "const", "Promise", "=", "promise", "(", "options", ")", "const", "stream", "=", "streamify", "(", "data", ",", "options", ")", "let", "resolve", ",", "reje...
Public function `stringify`. Returns a promise and asynchronously serialises a data structure to a JSON string. Sanely handles promises, buffers, maps and other iterables. @param data: The data to transform @option space: Indentation string, or the number of spaces to indent each nested level by. @o...
[ "Public", "function", "stringify", "." ]
61087c194d5675c75569a2e08617a98609b16ead
https://github.com/philbooth/bfj/blob/61087c194d5675c75569a2e08617a98609b16ead/src/stringify.js#L39-L67
22,749
philbooth/bfj
src/unpipe.js
unpipe
function unpipe (callback, options) { check.assert.function(callback, 'Invalid callback argument') const jsonstream = new stream.PassThrough() parse(jsonstream, Object.assign({}, options, { ndjson: false })) .then(data => callback(null, data)) .catch(error => callback(error)) return jsonstream }
javascript
function unpipe (callback, options) { check.assert.function(callback, 'Invalid callback argument') const jsonstream = new stream.PassThrough() parse(jsonstream, Object.assign({}, options, { ndjson: false })) .then(data => callback(null, data)) .catch(error => callback(error)) return jsonstream }
[ "function", "unpipe", "(", "callback", ",", "options", ")", "{", "check", ".", "assert", ".", "function", "(", "callback", ",", "'Invalid callback argument'", ")", "const", "jsonstream", "=", "new", "stream", ".", "PassThrough", "(", ")", "parse", "(", "json...
Public function `unpipe`. Returns a writeable stream that can be passed to stream.pipe, then parses JSON data read from the stream. If there are no errors, the callback is invoked with the result as the second argument. If errors occur, the first error is passed to the callback as the first argument. @param callback:...
[ "Public", "function", "unpipe", "." ]
61087c194d5675c75569a2e08617a98609b16ead
https://github.com/philbooth/bfj/blob/61087c194d5675c75569a2e08617a98609b16ead/src/unpipe.js#L27-L37
22,750
kevinbeaty/any-promise
register.js
loadImplementation
function loadImplementation(implementation){ var impl = null if(shouldPreferGlobalPromise(implementation)){ // if no implementation or env specified use global.Promise impl = { Promise: global.Promise, implementation: 'global.Promise' } } else if(implementation){ // if implementation ...
javascript
function loadImplementation(implementation){ var impl = null if(shouldPreferGlobalPromise(implementation)){ // if no implementation or env specified use global.Promise impl = { Promise: global.Promise, implementation: 'global.Promise' } } else if(implementation){ // if implementation ...
[ "function", "loadImplementation", "(", "implementation", ")", "{", "var", "impl", "=", "null", "if", "(", "shouldPreferGlobalPromise", "(", "implementation", ")", ")", "{", "// if no implementation or env specified use global.Promise", "impl", "=", "{", "Promise", ":", ...
Node.js version of loadImplementation. Requires the given implementation and returns the registration containing {Promise, implementation} If implementation is undefined or global.Promise, loads it Otherwise uses require
[ "Node", ".", "js", "version", "of", "loadImplementation", "." ]
c2029f9e37a15b04c303bd0ec19cf16d00ec8f3d
https://github.com/kevinbeaty/any-promise/blob/c2029f9e37a15b04c303bd0ec19cf16d00ec8f3d/register.js#L13-L45
22,751
kevinbeaty/any-promise
register.js
shouldPreferGlobalPromise
function shouldPreferGlobalPromise(implementation){ if(implementation){ return implementation === 'global.Promise' } else if(typeof global.Promise !== 'undefined'){ // Load global promise if implementation not specified // Versions < 0.11 did not have global Promise // Do not use for version < 0.12 ...
javascript
function shouldPreferGlobalPromise(implementation){ if(implementation){ return implementation === 'global.Promise' } else if(typeof global.Promise !== 'undefined'){ // Load global promise if implementation not specified // Versions < 0.11 did not have global Promise // Do not use for version < 0.12 ...
[ "function", "shouldPreferGlobalPromise", "(", "implementation", ")", "{", "if", "(", "implementation", ")", "{", "return", "implementation", "===", "'global.Promise'", "}", "else", "if", "(", "typeof", "global", ".", "Promise", "!==", "'undefined'", ")", "{", "/...
Determines if the global.Promise should be preferred if an implementation has not been registered.
[ "Determines", "if", "the", "global", ".", "Promise", "should", "be", "preferred", "if", "an", "implementation", "has", "not", "been", "registered", "." ]
c2029f9e37a15b04c303bd0ec19cf16d00ec8f3d
https://github.com/kevinbeaty/any-promise/blob/c2029f9e37a15b04c303bd0ec19cf16d00ec8f3d/register.js#L51-L64
22,752
kevinbeaty/any-promise
register.js
tryAutoDetect
function tryAutoDetect(){ var libs = [ "es6-promise", "promise", "native-promise-only", "bluebird", "rsvp", "when", "q", "pinkie", "lie", "vow"] var i = 0, len = libs.length for(; i < len; i++){ try { return loadImplementation(libs[i]) } ca...
javascript
function tryAutoDetect(){ var libs = [ "es6-promise", "promise", "native-promise-only", "bluebird", "rsvp", "when", "q", "pinkie", "lie", "vow"] var i = 0, len = libs.length for(; i < len; i++){ try { return loadImplementation(libs[i]) } ca...
[ "function", "tryAutoDetect", "(", ")", "{", "var", "libs", "=", "[", "\"es6-promise\"", ",", "\"promise\"", ",", "\"native-promise-only\"", ",", "\"bluebird\"", ",", "\"rsvp\"", ",", "\"when\"", ",", "\"q\"", ",", "\"pinkie\"", ",", "\"lie\"", ",", "\"vow\"", ...
Look for common libs as last resort there is no guarantee that this will return a desired implementation or even be deterministic. The priority is also nearly arbitrary. We are only doing this for older versions of Node.js <0.12 that do not have a reasonable global.Promise implementation and we the user has not registe...
[ "Look", "for", "common", "libs", "as", "last", "resort", "there", "is", "no", "guarantee", "that", "this", "will", "return", "a", "desired", "implementation", "or", "even", "be", "deterministic", ".", "The", "priority", "is", "also", "nearly", "arbitrary", "...
c2029f9e37a15b04c303bd0ec19cf16d00ec8f3d
https://github.com/kevinbeaty/any-promise/blob/c2029f9e37a15b04c303bd0ec19cf16d00ec8f3d/register.js#L75-L94
22,753
ranm8/requestify
lib/request.js
Request
function Request(url, options) { if (!url) { throw new Error('URL must in mandatory to initialize Request object'); } if (!options.method) { throw new Error('Cannot execute HTTP request without specifying method'); } this.url = url; this.method = options.method; this.body =...
javascript
function Request(url, options) { if (!url) { throw new Error('URL must in mandatory to initialize Request object'); } if (!options.method) { throw new Error('Cannot execute HTTP request without specifying method'); } this.url = url; this.method = options.method; this.body =...
[ "function", "Request", "(", "url", ",", "options", ")", "{", "if", "(", "!", "url", ")", "{", "throw", "new", "Error", "(", "'URL must in mandatory to initialize Request object'", ")", ";", "}", "if", "(", "!", "options", ".", "method", ")", "{", "throw", ...
Constructor for the Request object @param {string} url - Full endpoint URL (e.g. [protocol]://[host]/[uri] @param {{ method: string, body: string|object, params: object, headers: object, dataType: string, auth: object, timeout: number, cookies: object }} options @constructor
[ "Constructor", "for", "the", "Request", "object" ]
c7ca8b716ad04f94a12d94d69b2fe3a838c3d6e6
https://github.com/ranm8/requestify/blob/c7ca8b716ad04f94a12d94d69b2fe3a838c3d6e6/lib/request.js#L13-L34
22,754
ranm8/requestify
lib/response.js
Response
function Response(code, headers, body) { this.code = code; this.headers = headers; this.body = body || ''; }
javascript
function Response(code, headers, body) { this.code = code; this.headers = headers; this.body = body || ''; }
[ "function", "Response", "(", "code", ",", "headers", ",", "body", ")", "{", "this", ".", "code", "=", "code", ";", "this", ".", "headers", "=", "headers", ";", "this", ".", "body", "=", "body", "||", "''", ";", "}" ]
Constructor to the Response object @param {number} code - HTTP response code @param {object} headers - Key value pairs of response headers @param {string} body @constructor
[ "Constructor", "to", "the", "Response", "object" ]
c7ca8b716ad04f94a12d94d69b2fe3a838c3d6e6
https://github.com/ranm8/requestify/blob/c7ca8b716ad04f94a12d94d69b2fe3a838c3d6e6/lib/response.js#L15-L19
22,755
fractal-code/meteor-azure
distribution/lib/bundle.js
compileBundle
function compileBundle(_ref) { var customWebConfig = _ref.customWebConfig, architecture = _ref.architecture; var workingDir = _tmp.default.dirSync().name; _winston.default.info('Compiling application bundle'); // Generate Meteor build _winston.default.debug('generate meteor build'); _shelljs.defaul...
javascript
function compileBundle(_ref) { var customWebConfig = _ref.customWebConfig, architecture = _ref.architecture; var workingDir = _tmp.default.dirSync().name; _winston.default.info('Compiling application bundle'); // Generate Meteor build _winston.default.debug('generate meteor build'); _shelljs.defaul...
[ "function", "compileBundle", "(", "_ref", ")", "{", "var", "customWebConfig", "=", "_ref", ".", "customWebConfig", ",", "architecture", "=", "_ref", ".", "architecture", ";", "var", "workingDir", "=", "_tmp", ".", "default", ".", "dirSync", "(", ")", ".", ...
Bundle compilation method
[ "Bundle", "compilation", "method" ]
87aaf8582be5734c78445c40569444101c02bc3f
https://github.com/fractal-code/meteor-azure/blob/87aaf8582be5734c78445c40569444101c02bc3f/distribution/lib/bundle.js#L21-L74
22,756
bryanburgers/node-mustache-express
mustache-express.js
loadFile
function loadFile(fullFilePath, callback) { fs.readFile(fullFilePath, "utf-8", function(err, data) { if (err) { return callback(err); } return callback(null, data); }); }
javascript
function loadFile(fullFilePath, callback) { fs.readFile(fullFilePath, "utf-8", function(err, data) { if (err) { return callback(err); } return callback(null, data); }); }
[ "function", "loadFile", "(", "fullFilePath", ",", "callback", ")", "{", "fs", ".", "readFile", "(", "fullFilePath", ",", "\"utf-8\"", ",", "function", "(", "err", ",", "data", ")", "{", "if", "(", "err", ")", "{", "return", "callback", "(", "err", ")",...
Load a single file, and return the data.
[ "Load", "a", "single", "file", "and", "return", "the", "data", "." ]
1700934e0ac510ee69225de226ccf4b4db41b65d
https://github.com/bryanburgers/node-mustache-express/blob/1700934e0ac510ee69225de226ccf4b4db41b65d/mustache-express.js#L17-L25
22,757
bryanburgers/node-mustache-express
mustache-express.js
handleFile
function handleFile(name, file, options, cache, callback) { var cachedData; if(!options || !options.settings || options.settings['view cache'] !== false) { cachedData = cache && cache.get(file); } if (!cachedData) { loadFile(file, function(err, fileData) { if (err) { return callback(err); } var pa...
javascript
function handleFile(name, file, options, cache, callback) { var cachedData; if(!options || !options.settings || options.settings['view cache'] !== false) { cachedData = cache && cache.get(file); } if (!cachedData) { loadFile(file, function(err, fileData) { if (err) { return callback(err); } var pa...
[ "function", "handleFile", "(", "name", ",", "file", ",", "options", ",", "cache", ",", "callback", ")", "{", "var", "cachedData", ";", "if", "(", "!", "options", "||", "!", "options", ".", "settings", "||", "options", ".", "settings", "[", "'view cache'"...
Load a file, find it's partials, and return the relevant data.
[ "Load", "a", "file", "find", "it", "s", "partials", "and", "return", "the", "relevant", "data", "." ]
1700934e0ac510ee69225de226ccf4b4db41b65d
https://github.com/bryanburgers/node-mustache-express/blob/1700934e0ac510ee69225de226ccf4b4db41b65d/mustache-express.js#L28-L60
22,758
bryanburgers/node-mustache-express
mustache-express.js
consolidatePartials
function consolidatePartials(arr) { var partialsSet = {}; arr.forEach(function(item) { item.partials.forEach(function(partial) { partialsSet[partial] = true; }); }); return Object.keys(partialsSet); }
javascript
function consolidatePartials(arr) { var partialsSet = {}; arr.forEach(function(item) { item.partials.forEach(function(partial) { partialsSet[partial] = true; }); }); return Object.keys(partialsSet); }
[ "function", "consolidatePartials", "(", "arr", ")", "{", "var", "partialsSet", "=", "{", "}", ";", "arr", ".", "forEach", "(", "function", "(", "item", ")", "{", "item", ".", "partials", ".", "forEach", "(", "function", "(", "partial", ")", "{", "parti...
Using the return data from all of the files, consolidate the partials into a single list
[ "Using", "the", "return", "data", "from", "all", "of", "the", "files", "consolidate", "the", "partials", "into", "a", "single", "list" ]
1700934e0ac510ee69225de226ccf4b4db41b65d
https://github.com/bryanburgers/node-mustache-express/blob/1700934e0ac510ee69225de226ccf4b4db41b65d/mustache-express.js#L64-L72
22,759
bryanburgers/node-mustache-express
mustache-express.js
loadAllPartials
function loadAllPartials(unparsedPartials, partialsDirectory, partialsExtension, options, cache, partials, callback) { if (!partials) { partials = {}; } // This function is called recursively. This is our base case: the point where we // don't call recursively anymore. // That point is when there are no partial...
javascript
function loadAllPartials(unparsedPartials, partialsDirectory, partialsExtension, options, cache, partials, callback) { if (!partials) { partials = {}; } // This function is called recursively. This is our base case: the point where we // don't call recursively anymore. // That point is when there are no partial...
[ "function", "loadAllPartials", "(", "unparsedPartials", ",", "partialsDirectory", ",", "partialsExtension", ",", "options", ",", "cache", ",", "partials", ",", "callback", ")", "{", "if", "(", "!", "partials", ")", "{", "partials", "=", "{", "}", ";", "}", ...
Load all of the partials recursively
[ "Load", "all", "of", "the", "partials", "recursively" ]
1700934e0ac510ee69225de226ccf4b4db41b65d
https://github.com/bryanburgers/node-mustache-express/blob/1700934e0ac510ee69225de226ccf4b4db41b65d/mustache-express.js#L82-L121
22,760
bryanburgers/node-mustache-express
mustache-express.js
loadTemplateAndPartials
function loadTemplateAndPartials(templateFile, partialsDirectory, partialsExtension, options, cache, callback) { handleFile(null, templateFile, options, cache, function(err, partialData) { if (err) { return callback(err); } return loadAllPartials(partialData.partials, partialsDirectory, partialsExtension, op...
javascript
function loadTemplateAndPartials(templateFile, partialsDirectory, partialsExtension, options, cache, callback) { handleFile(null, templateFile, options, cache, function(err, partialData) { if (err) { return callback(err); } return loadAllPartials(partialData.partials, partialsDirectory, partialsExtension, op...
[ "function", "loadTemplateAndPartials", "(", "templateFile", ",", "partialsDirectory", ",", "partialsExtension", ",", "options", ",", "cache", ",", "callback", ")", "{", "handleFile", "(", "null", ",", "templateFile", ",", "options", ",", "cache", ",", "function", ...
Load the root template, and all of the partials that go with it
[ "Load", "the", "root", "template", "and", "all", "of", "the", "partials", "that", "go", "with", "it" ]
1700934e0ac510ee69225de226ccf4b4db41b65d
https://github.com/bryanburgers/node-mustache-express/blob/1700934e0ac510ee69225de226ccf4b4db41b65d/mustache-express.js#L124-L138
22,761
jaredhanson/oauthorize
examples/express2/auth.js
function(consumerKey, done) { db.clients.findByConsumerKey(consumerKey, function(err, client) { if (err) { return done(err); } if (!client) { return done(null, false); } return done(null, client, client.consumerSecret); }); }
javascript
function(consumerKey, done) { db.clients.findByConsumerKey(consumerKey, function(err, client) { if (err) { return done(err); } if (!client) { return done(null, false); } return done(null, client, client.consumerSecret); }); }
[ "function", "(", "consumerKey", ",", "done", ")", "{", "db", ".", "clients", ".", "findByConsumerKey", "(", "consumerKey", ",", "function", "(", "err", ",", "client", ")", "{", "if", "(", "err", ")", "{", "return", "done", "(", "err", ")", ";", "}", ...
consumer callback This callback finds the registered client associated with `consumerKey`. The client should be supplied to the `done` callback as the second argument, and the consumer secret known by the server should be supplied as the third argument. The `ConsumerStrategy` will use this secret to validate the requ...
[ "consumer", "callback", "This", "callback", "finds", "the", "registered", "client", "associated", "with", "consumerKey", ".", "The", "client", "should", "be", "supplied", "to", "the", "done", "callback", "as", "the", "second", "argument", "and", "the", "consumer...
3d9438c871f810fdec269596ccd40148dab31420
https://github.com/jaredhanson/oauthorize/blob/3d9438c871f810fdec269596ccd40148dab31420/examples/express2/auth.js#L57-L63
22,762
jaredhanson/oauthorize
examples/express2/auth.js
function(requestToken, done) { db.requestTokens.find(requestToken, function(err, token) { if (err) { return done(err); } var info = { verifier: token.verifier, clientID: token.clientID, userID: token.userID, approved: token.approved } done(null, token.secret, i...
javascript
function(requestToken, done) { db.requestTokens.find(requestToken, function(err, token) { if (err) { return done(err); } var info = { verifier: token.verifier, clientID: token.clientID, userID: token.userID, approved: token.approved } done(null, token.secret, i...
[ "function", "(", "requestToken", ",", "done", ")", "{", "db", ".", "requestTokens", ".", "find", "(", "requestToken", ",", "function", "(", "err", ",", "token", ")", "{", "if", "(", "err", ")", "{", "return", "done", "(", "err", ")", ";", "}", "var...
token callback This callback finds the request token identified by `requestToken`. This is typically only invoked when a client is exchanging a request token for an access token. The `done` callback accepts the corresponding token secret as the second argument. The `ConsumerStrategy` will use this secret to validat...
[ "token", "callback", "This", "callback", "finds", "the", "request", "token", "identified", "by", "requestToken", ".", "This", "is", "typically", "only", "invoked", "when", "a", "client", "is", "exchanging", "a", "request", "token", "for", "an", "access", "toke...
3d9438c871f810fdec269596ccd40148dab31420
https://github.com/jaredhanson/oauthorize/blob/3d9438c871f810fdec269596ccd40148dab31420/examples/express2/auth.js#L80-L91
22,763
patrickkettner/grunt-compile-handlebars
tasks/compile-handlebars.js
function(config) { if (!config) { return []; } var files = grunt.file.expand(config); if (files.length) { return files; } return [config]; }
javascript
function(config) { if (!config) { return []; } var files = grunt.file.expand(config); if (files.length) { return files; } return [config]; }
[ "function", "(", "config", ")", "{", "if", "(", "!", "config", ")", "{", "return", "[", "]", ";", "}", "var", "files", "=", "grunt", ".", "file", ".", "expand", "(", "config", ")", ";", "if", "(", "files", ".", "length", ")", "{", "return", "fi...
Normalizes the input so that it is always an array for the forEach loop
[ "Normalizes", "the", "input", "so", "that", "it", "is", "always", "an", "array", "for", "the", "forEach", "loop" ]
92d7fb401340892a8f04d497d4e1508c9ed1f8bb
https://github.com/patrickkettner/grunt-compile-handlebars/blob/92d7fb401340892a8f04d497d4e1508c9ed1f8bb/tasks/compile-handlebars.js#L22-L34
22,764
patrickkettner/grunt-compile-handlebars
tasks/compile-handlebars.js
function(data, dontParse) { // grunt.file chokes on objects, so we check for it immiedietly if (typeof data === 'object') { return data; } // `data` isn't an object, so its probably a file try { // alce allows us to parse single-quote JSON (which is tehcnically invalid, and thereby chok...
javascript
function(data, dontParse) { // grunt.file chokes on objects, so we check for it immiedietly if (typeof data === 'object') { return data; } // `data` isn't an object, so its probably a file try { // alce allows us to parse single-quote JSON (which is tehcnically invalid, and thereby chok...
[ "function", "(", "data", ",", "dontParse", ")", "{", "// grunt.file chokes on objects, so we check for it immiedietly", "if", "(", "typeof", "data", "===", "'object'", ")", "{", "return", "data", ";", "}", "// `data` isn't an object, so its probably a file", "try", "{", ...
Gets the final representation of the input, whether it be object, or string
[ "Gets", "the", "final", "representation", "of", "the", "input", "whether", "it", "be", "object", "or", "string" ]
92d7fb401340892a8f04d497d4e1508c9ed1f8bb
https://github.com/patrickkettner/grunt-compile-handlebars/blob/92d7fb401340892a8f04d497d4e1508c9ed1f8bb/tasks/compile-handlebars.js#L37-L54
22,765
patrickkettner/grunt-compile-handlebars
tasks/compile-handlebars.js
function(filename) { if (!filename || typeof filename === 'object') { return; } var match = filename.match(/[^\*]*/); if (match[0] !== filename) { return match.pop(); } }
javascript
function(filename) { if (!filename || typeof filename === 'object') { return; } var match = filename.match(/[^\*]*/); if (match[0] !== filename) { return match.pop(); } }
[ "function", "(", "filename", ")", "{", "if", "(", "!", "filename", "||", "typeof", "filename", "===", "'object'", ")", "{", "return", ";", "}", "var", "match", "=", "filename", ".", "match", "(", "/", "[^\\*]*", "/", ")", ";", "if", "(", "match", "...
Checks if the input is a glob and if so, returns the unglobbed version of the filename
[ "Checks", "if", "the", "input", "is", "a", "glob", "and", "if", "so", "returns", "the", "unglobbed", "version", "of", "the", "filename" ]
92d7fb401340892a8f04d497d4e1508c9ed1f8bb
https://github.com/patrickkettner/grunt-compile-handlebars/blob/92d7fb401340892a8f04d497d4e1508c9ed1f8bb/tasks/compile-handlebars.js#L57-L67
22,766
patrickkettner/grunt-compile-handlebars
tasks/compile-handlebars.js
function(filename, template, outputInInput) { var basename; var glob; template = Array.isArray(template) ? filename : template; glob = isGlob(template); if (outputInInput) { basename = _toArray(filename.split('.').pop()) ; } else if (glob) { basename = filename.slice(glob.length, fi...
javascript
function(filename, template, outputInInput) { var basename; var glob; template = Array.isArray(template) ? filename : template; glob = isGlob(template); if (outputInInput) { basename = _toArray(filename.split('.').pop()) ; } else if (glob) { basename = filename.slice(glob.length, fi...
[ "function", "(", "filename", ",", "template", ",", "outputInInput", ")", "{", "var", "basename", ";", "var", "glob", ";", "template", "=", "Array", ".", "isArray", "(", "template", ")", "?", "filename", ":", "template", ";", "glob", "=", "isGlob", "(", ...
Figures out the name of the file before any globs are used, so the globbed outputs can be generated
[ "Figures", "out", "the", "name", "of", "the", "file", "before", "any", "globs", "are", "used", "so", "the", "globbed", "outputs", "can", "be", "generated" ]
92d7fb401340892a8f04d497d4e1508c9ed1f8bb
https://github.com/patrickkettner/grunt-compile-handlebars/blob/92d7fb401340892a8f04d497d4e1508c9ed1f8bb/tasks/compile-handlebars.js#L70-L86
22,767
hacdias/electron-menubar
positioner.js
calculateXAlign
function calculateXAlign (windowBounds, trayBounds, align) { const display = getDisplay() let x switch (align) { case 'right': x = trayBounds.x break case 'left': x = trayBounds.x + trayBounds.width - windowBounds.width break case 'center': default: x = Math.round(tr...
javascript
function calculateXAlign (windowBounds, trayBounds, align) { const display = getDisplay() let x switch (align) { case 'right': x = trayBounds.x break case 'left': x = trayBounds.x + trayBounds.width - windowBounds.width break case 'center': default: x = Math.round(tr...
[ "function", "calculateXAlign", "(", "windowBounds", ",", "trayBounds", ",", "align", ")", "{", "const", "display", "=", "getDisplay", "(", ")", "let", "x", "switch", "(", "align", ")", "{", "case", "'right'", ":", "x", "=", "trayBounds", ".", "x", "break...
Calculates the x position of the tray window @param {Rectangle} windowBounds - electron BrowserWindow bounds of tray window to position @param {Rectangle} trayBounds - tray bounds from electron Tray.getBounds() @param {string} [align] - align left|center|right, default: center @return {integer} - calculated x positio...
[ "Calculates", "the", "x", "position", "of", "the", "tray", "window" ]
57d850f2f53c4227df4413855907cbd48e28bc16
https://github.com/hacdias/electron-menubar/blob/57d850f2f53c4227df4413855907cbd48e28bc16/positioner.js#L31-L56
22,768
hacdias/electron-menubar
positioner.js
calculateYAlign
function calculateYAlign (windowBounds, trayBounds, align) { const display = getDisplay() let y switch (align) { case 'up': y = trayBounds.y + trayBounds.height - windowBounds.height break case 'down': y = trayBounds.y break case 'center': default: y = Math.round((tr...
javascript
function calculateYAlign (windowBounds, trayBounds, align) { const display = getDisplay() let y switch (align) { case 'up': y = trayBounds.y + trayBounds.height - windowBounds.height break case 'down': y = trayBounds.y break case 'center': default: y = Math.round((tr...
[ "function", "calculateYAlign", "(", "windowBounds", ",", "trayBounds", ",", "align", ")", "{", "const", "display", "=", "getDisplay", "(", ")", "let", "y", "switch", "(", "align", ")", "{", "case", "'up'", ":", "y", "=", "trayBounds", ".", "y", "+", "t...
Calculates the y position of the tray window @param {Rectangle} windowBounds - electron BrowserWindow bounds @param {Rectangle} trayBounds - tray bounds from electron Tray.getBounds() @param {string} [align] - align up|middle|down, default: down @return {integer} - calculated y position
[ "Calculates", "the", "y", "position", "of", "the", "tray", "window" ]
57d850f2f53c4227df4413855907cbd48e28bc16
https://github.com/hacdias/electron-menubar/blob/57d850f2f53c4227df4413855907cbd48e28bc16/positioner.js#L67-L91
22,769
hacdias/electron-menubar
positioner.js
calculateByCursorPosition
function calculateByCursorPosition (windowBounds, display, cursor) { let x = cursor.x let y = cursor.y if (x + windowBounds.width > display.bounds.width) { // if window would overlap on right side of screen, align it to the left of the cursor x -= windowBounds.width } if (y + windowBounds.height > d...
javascript
function calculateByCursorPosition (windowBounds, display, cursor) { let x = cursor.x let y = cursor.y if (x + windowBounds.width > display.bounds.width) { // if window would overlap on right side of screen, align it to the left of the cursor x -= windowBounds.width } if (y + windowBounds.height > d...
[ "function", "calculateByCursorPosition", "(", "windowBounds", ",", "display", ",", "cursor", ")", "{", "let", "x", "=", "cursor", ".", "x", "let", "y", "=", "cursor", ".", "y", "if", "(", "x", "+", "windowBounds", ".", "width", ">", "display", ".", "bo...
Calculates the position of the tray window based on current cursor position This method is used on linux where trayBounds are not available @param {Rectangle} windowBounds - electron BrowserWindow bounds of tray window to position @param {Eelectron.Display} display - display on which the cursor is currently @param {Po...
[ "Calculates", "the", "position", "of", "the", "tray", "window", "based", "on", "current", "cursor", "position", "This", "method", "is", "used", "on", "linux", "where", "trayBounds", "are", "not", "available" ]
57d850f2f53c4227df4413855907cbd48e28bc16
https://github.com/hacdias/electron-menubar/blob/57d850f2f53c4227df4413855907cbd48e28bc16/positioner.js#L103-L121
22,770
robwierzbowski/node-pixrem
lib/pixrem.js
detectBrowser
function detectBrowser (browsers, browserQuery) { var b = false; browserQuery = browserslist(browserQuery); for (var i = 0; i < browsers.length; i++) { for (var j = 0; j < browserQuery.length; j++) { if (browsers[i] === browserQuery[j]) { b = true; break; } } if (b) { break...
javascript
function detectBrowser (browsers, browserQuery) { var b = false; browserQuery = browserslist(browserQuery); for (var i = 0; i < browsers.length; i++) { for (var j = 0; j < browserQuery.length; j++) { if (browsers[i] === browserQuery[j]) { b = true; break; } } if (b) { break...
[ "function", "detectBrowser", "(", "browsers", ",", "browserQuery", ")", "{", "var", "b", "=", "false", ";", "browserQuery", "=", "browserslist", "(", "browserQuery", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "browsers", ".", "length", ...
Detect if one browser from the browserQuery is in browsers
[ "Detect", "if", "one", "browser", "from", "the", "browserQuery", "is", "in", "browsers" ]
80581f4416fd2d0962ee24d3203a310b7d520c1d
https://github.com/robwierzbowski/node-pixrem/blob/80581f4416fd2d0962ee24d3203a310b7d520c1d/lib/pixrem.js#L108-L121
22,771
robwierzbowski/node-pixrem
lib/pixrem.js
toPx
function toPx (value, decl, result) { value = (typeof value === 'string' && value.indexOf('calc(') !== -1) ? calc(value) : value; var parts = /^(\d*\.?\d+)([a-zA-Z%]*)$/.exec(value); if (parts !== null) { var number = parts[1]; var unit = parts[2]; if (unit === 'px' || unit === '') { return p...
javascript
function toPx (value, decl, result) { value = (typeof value === 'string' && value.indexOf('calc(') !== -1) ? calc(value) : value; var parts = /^(\d*\.?\d+)([a-zA-Z%]*)$/.exec(value); if (parts !== null) { var number = parts[1]; var unit = parts[2]; if (unit === 'px' || unit === '') { return p...
[ "function", "toPx", "(", "value", ",", "decl", ",", "result", ")", "{", "value", "=", "(", "typeof", "value", "===", "'string'", "&&", "value", ".", "indexOf", "(", "'calc('", ")", "!==", "-", "1", ")", "?", "calc", "(", "value", ")", ":", "value",...
Return a unitless pixel value from any root font-size value.
[ "Return", "a", "unitless", "pixel", "value", "from", "any", "root", "font", "-", "size", "value", "." ]
80581f4416fd2d0962ee24d3203a310b7d520c1d
https://github.com/robwierzbowski/node-pixrem/blob/80581f4416fd2d0962ee24d3203a310b7d520c1d/lib/pixrem.js#L124-L147
22,772
mikolalysenko/box-intersect
lib/intersect.js
iterInit
function iterInit(d, count) { var levels = (8 * bits.log2(count+1) * (d+1))|0 var maxInts = bits.nextPow2(IFRAME_SIZE*levels) if(BOX_ISTACK.length < maxInts) { pool.free(BOX_ISTACK) BOX_ISTACK = pool.mallocInt32(maxInts) } var maxDoubles = bits.nextPow2(DFRAME_SIZE*levels) if(BOX_DSTACK.length < max...
javascript
function iterInit(d, count) { var levels = (8 * bits.log2(count+1) * (d+1))|0 var maxInts = bits.nextPow2(IFRAME_SIZE*levels) if(BOX_ISTACK.length < maxInts) { pool.free(BOX_ISTACK) BOX_ISTACK = pool.mallocInt32(maxInts) } var maxDoubles = bits.nextPow2(DFRAME_SIZE*levels) if(BOX_DSTACK.length < max...
[ "function", "iterInit", "(", "d", ",", "count", ")", "{", "var", "levels", "=", "(", "8", "*", "bits", ".", "log2", "(", "count", "+", "1", ")", "*", "(", "d", "+", "1", ")", ")", "|", "0", "var", "maxInts", "=", "bits", ".", "nextPow2", "(",...
Initialize iterative loop queue
[ "Initialize", "iterative", "loop", "queue" ]
7e6770bab1fb90217a92eec4b8e0f4c293a71801
https://github.com/mikolalysenko/box-intersect/blob/7e6770bab1fb90217a92eec4b8e0f4c293a71801/lib/intersect.js#L54-L66
22,773
mikolalysenko/box-intersect
lib/intersect.js
iterPush
function iterPush(ptr, axis, redStart, redEnd, blueStart, blueEnd, state, lo, hi) { var iptr = IFRAME_SIZE * ptr BOX_ISTACK[iptr] = axis BOX_ISTACK[iptr+1] = redStart BOX_ISTACK[iptr+2] = redEnd BOX_ISTACK[iptr+3] = blueStart BOX_ISTACK[iptr+4] = blueEnd BOX_ISTACK[iptr+5] = state var ...
javascript
function iterPush(ptr, axis, redStart, redEnd, blueStart, blueEnd, state, lo, hi) { var iptr = IFRAME_SIZE * ptr BOX_ISTACK[iptr] = axis BOX_ISTACK[iptr+1] = redStart BOX_ISTACK[iptr+2] = redEnd BOX_ISTACK[iptr+3] = blueStart BOX_ISTACK[iptr+4] = blueEnd BOX_ISTACK[iptr+5] = state var ...
[ "function", "iterPush", "(", "ptr", ",", "axis", ",", "redStart", ",", "redEnd", ",", "blueStart", ",", "blueEnd", ",", "state", ",", "lo", ",", "hi", ")", "{", "var", "iptr", "=", "IFRAME_SIZE", "*", "ptr", "BOX_ISTACK", "[", "iptr", "]", "=", "axis...
Append item to queue
[ "Append", "item", "to", "queue" ]
7e6770bab1fb90217a92eec4b8e0f4c293a71801
https://github.com/mikolalysenko/box-intersect/blob/7e6770bab1fb90217a92eec4b8e0f4c293a71801/lib/intersect.js#L69-L87
22,774
mikolalysenko/box-intersect
index.js
convertBoxes
function convertBoxes(boxes, d, data, ids) { var ptr = 0 var count = 0 for(var i=0, n=boxes.length; i<n; ++i) { var b = boxes[i] if(boxEmpty(d, b)) { continue } for(var j=0; j<2*d; ++j) { data[ptr++] = b[j] } ids[count++] = i } return count }
javascript
function convertBoxes(boxes, d, data, ids) { var ptr = 0 var count = 0 for(var i=0, n=boxes.length; i<n; ++i) { var b = boxes[i] if(boxEmpty(d, b)) { continue } for(var j=0; j<2*d; ++j) { data[ptr++] = b[j] } ids[count++] = i } return count }
[ "function", "convertBoxes", "(", "boxes", ",", "d", ",", "data", ",", "ids", ")", "{", "var", "ptr", "=", "0", "var", "count", "=", "0", "for", "(", "var", "i", "=", "0", ",", "n", "=", "boxes", ".", "length", ";", "i", "<", "n", ";", "++", ...
Unpack boxes into a flat typed array, remove empty boxes
[ "Unpack", "boxes", "into", "a", "flat", "typed", "array", "remove", "empty", "boxes" ]
7e6770bab1fb90217a92eec4b8e0f4c293a71801
https://github.com/mikolalysenko/box-intersect/blob/7e6770bab1fb90217a92eec4b8e0f4c293a71801/index.js#L19-L33
22,775
mikolalysenko/box-intersect
index.js
boxIntersect
function boxIntersect(red, blue, visit, full) { var n = red.length var m = blue.length //If either array is empty, then we can skip this whole thing if(n <= 0 || m <= 0) { return } //Compute dimension, if it is 0 then we skip var d = (red[0].length)>>>1 if(d <= 0) { return } var retval ...
javascript
function boxIntersect(red, blue, visit, full) { var n = red.length var m = blue.length //If either array is empty, then we can skip this whole thing if(n <= 0 || m <= 0) { return } //Compute dimension, if it is 0 then we skip var d = (red[0].length)>>>1 if(d <= 0) { return } var retval ...
[ "function", "boxIntersect", "(", "red", ",", "blue", ",", "visit", ",", "full", ")", "{", "var", "n", "=", "red", ".", "length", "var", "m", "=", "blue", ".", "length", "//If either array is empty, then we can skip this whole thing", "if", "(", "n", "<=", "0...
Perform type conversions, check bounds
[ "Perform", "type", "conversions", "check", "bounds" ]
7e6770bab1fb90217a92eec4b8e0f4c293a71801
https://github.com/mikolalysenko/box-intersect/blob/7e6770bab1fb90217a92eec4b8e0f4c293a71801/index.js#L36-L100
22,776
mikolalysenko/box-intersect
index.js
boxIntersectWrapper
function boxIntersectWrapper(arg0, arg1, arg2) { var result switch(arguments.length) { case 1: return intersectFullArray(arg0) case 2: if(typeof arg1 === 'function') { return boxIntersect(arg0, arg0, arg1, true) } else { return intersectBipartiteArray(arg0, arg1) } ...
javascript
function boxIntersectWrapper(arg0, arg1, arg2) { var result switch(arguments.length) { case 1: return intersectFullArray(arg0) case 2: if(typeof arg1 === 'function') { return boxIntersect(arg0, arg0, arg1, true) } else { return intersectBipartiteArray(arg0, arg1) } ...
[ "function", "boxIntersectWrapper", "(", "arg0", ",", "arg1", ",", "arg2", ")", "{", "var", "result", "switch", "(", "arguments", ".", "length", ")", "{", "case", "1", ":", "return", "intersectFullArray", "(", "arg0", ")", "case", "2", ":", "if", "(", "...
User-friendly wrapper, handle full input and no-visitor cases
[ "User", "-", "friendly", "wrapper", "handle", "full", "input", "and", "no", "-", "visitor", "cases" ]
7e6770bab1fb90217a92eec4b8e0f4c293a71801
https://github.com/mikolalysenko/box-intersect/blob/7e6770bab1fb90217a92eec4b8e0f4c293a71801/index.js#L122-L138
22,777
mikolalysenko/box-intersect
lib/sweep.js
sqInit
function sqInit(count) { var rcount = bits.nextPow2(count) if(RED_SWEEP_QUEUE.length < rcount) { pool.free(RED_SWEEP_QUEUE) RED_SWEEP_QUEUE = pool.mallocInt32(rcount) } if(RED_SWEEP_INDEX.length < rcount) { pool.free(RED_SWEEP_INDEX) RED_SWEEP_INDEX = pool.mallocInt32(rcount) } if(BLUE_SWEEP...
javascript
function sqInit(count) { var rcount = bits.nextPow2(count) if(RED_SWEEP_QUEUE.length < rcount) { pool.free(RED_SWEEP_QUEUE) RED_SWEEP_QUEUE = pool.mallocInt32(rcount) } if(RED_SWEEP_INDEX.length < rcount) { pool.free(RED_SWEEP_INDEX) RED_SWEEP_INDEX = pool.mallocInt32(rcount) } if(BLUE_SWEEP...
[ "function", "sqInit", "(", "count", ")", "{", "var", "rcount", "=", "bits", ".", "nextPow2", "(", "count", ")", "if", "(", "RED_SWEEP_QUEUE", ".", "length", "<", "rcount", ")", "{", "pool", ".", "free", "(", "RED_SWEEP_QUEUE", ")", "RED_SWEEP_QUEUE", "="...
Reserves memory for the 1D sweep data structures
[ "Reserves", "memory", "for", "the", "1D", "sweep", "data", "structures" ]
7e6770bab1fb90217a92eec4b8e0f4c293a71801
https://github.com/mikolalysenko/box-intersect/blob/7e6770bab1fb90217a92eec4b8e0f4c293a71801/lib/sweep.js#L29-L60
22,778
dmarcos/aframe-motion-capture-components
src/components/motion-capture-replayer.js
function (delta) { var currentPose; var currentEvent var playingPoses = this.playingPoses; var playingEvents = this.playingEvents; currentPose = playingPoses && playingPoses[this.currentPoseIndex] currentEvent = playingEvents && playingEvents[this.currentEventIndex]; this.currentPoseTime += ...
javascript
function (delta) { var currentPose; var currentEvent var playingPoses = this.playingPoses; var playingEvents = this.playingEvents; currentPose = playingPoses && playingPoses[this.currentPoseIndex] currentEvent = playingEvents && playingEvents[this.currentEventIndex]; this.currentPoseTime += ...
[ "function", "(", "delta", ")", "{", "var", "currentPose", ";", "var", "currentEvent", "var", "playingPoses", "=", "this", ".", "playingPoses", ";", "var", "playingEvents", "=", "this", ".", "playingEvents", ";", "currentPose", "=", "playingPoses", "&&", "playi...
Called on tick.
[ "Called", "on", "tick", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/motion-capture-replayer.js#L164-L202
22,779
dmarcos/aframe-motion-capture-components
src/components/avatar-replayer.js
function () { var data = this.data; var sceneEl = this.el; if (data.cameraOverride) { // Specify which camera is the original camera (e.g., used by Inspector). this.cameraEl = data.cameraOverride; } else { // Default camera. this.cameraEl = sceneEl.camera.el; // Make sure ...
javascript
function () { var data = this.data; var sceneEl = this.el; if (data.cameraOverride) { // Specify which camera is the original camera (e.g., used by Inspector). this.cameraEl = data.cameraOverride; } else { // Default camera. this.cameraEl = sceneEl.camera.el; // Make sure ...
[ "function", "(", ")", "{", "var", "data", "=", "this", ".", "data", ";", "var", "sceneEl", "=", "this", ".", "el", ";", "if", "(", "data", ".", "cameraOverride", ")", "{", "// Specify which camera is the original camera (e.g., used by Inspector).", "this", ".", ...
Grab a handle to the "original" camera. Initialize spectator camera and dummy geometry for original camera.
[ "Grab", "a", "handle", "to", "the", "original", "camera", ".", "Initialize", "spectator", "camera", "and", "dummy", "geometry", "for", "original", "camera", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-replayer.js#L83-L104
22,780
dmarcos/aframe-motion-capture-components
src/components/avatar-replayer.js
function () { var spectatorCameraEl = this.spectatorCameraEl; if (!spectatorCameraEl) { this.el.addEventListener('spectatorcameracreated', bind(this.activateSpectatorCamera, this)); return; } if (!spectatorCameraEl.hasLoaded) { spectatorCameraEl.addEven...
javascript
function () { var spectatorCameraEl = this.spectatorCameraEl; if (!spectatorCameraEl) { this.el.addEventListener('spectatorcameracreated', bind(this.activateSpectatorCamera, this)); return; } if (!spectatorCameraEl.hasLoaded) { spectatorCameraEl.addEven...
[ "function", "(", ")", "{", "var", "spectatorCameraEl", "=", "this", ".", "spectatorCameraEl", ";", "if", "(", "!", "spectatorCameraEl", ")", "{", "this", ".", "el", ".", "addEventListener", "(", "'spectatorcameracreated'", ",", "bind", "(", "this", ".", "act...
Activate spectator camera, show replayer mesh.
[ "Activate", "spectator", "camera", "show", "replayer", "mesh", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-replayer.js#L122-L139
22,781
dmarcos/aframe-motion-capture-components
src/components/avatar-replayer.js
function () { var data = this.data; var sceneEl = this.el; var spectatorCameraEl; var spectatorCameraRigEl; // Developer-defined spectator rig. if (this.el.querySelector('#spectatorCameraRig')) { this.spectatorCameraEl = sceneEl.querySelector('#spectatorCameraRig'); return; } ...
javascript
function () { var data = this.data; var sceneEl = this.el; var spectatorCameraEl; var spectatorCameraRigEl; // Developer-defined spectator rig. if (this.el.querySelector('#spectatorCameraRig')) { this.spectatorCameraEl = sceneEl.querySelector('#spectatorCameraRig'); return; } ...
[ "function", "(", ")", "{", "var", "data", "=", "this", ".", "data", ";", "var", "sceneEl", "=", "this", ".", "el", ";", "var", "spectatorCameraEl", ";", "var", "spectatorCameraRigEl", ";", "// Developer-defined spectator rig.", "if", "(", "this", ".", "el", ...
Create and activate spectator camera if in spectator mode.
[ "Create", "and", "activate", "spectator", "camera", "if", "in", "spectator", "mode", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-replayer.js#L153-L185
22,782
dmarcos/aframe-motion-capture-components
src/components/avatar-replayer.js
function () { var data = this.data; var recordingdb = this.el.systems.recordingdb;; var recordingNames; var src; var self = this; // Allow override to display replayer from query param. if (new URLSearchParams(window.location.search).get('avatar-replayer-disabled') !== null) { return;...
javascript
function () { var data = this.data; var recordingdb = this.el.systems.recordingdb;; var recordingNames; var src; var self = this; // Allow override to display replayer from query param. if (new URLSearchParams(window.location.search).get('avatar-replayer-disabled') !== null) { return;...
[ "function", "(", ")", "{", "var", "data", "=", "this", ".", "data", ";", "var", "recordingdb", "=", "this", ".", "el", ".", "systems", ".", "recordingdb", ";", ";", "var", "recordingNames", ";", "var", "src", ";", "var", "self", "=", "this", ";", "...
Check for recording sources and play.
[ "Check", "for", "recording", "sources", "and", "play", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-replayer.js#L190-L231
22,783
dmarcos/aframe-motion-capture-components
src/components/avatar-replayer.js
function () { var cameraEl = this.cameraEl; var headMesh; var leftEyeMesh; var rightEyeMesh; var leftEyeBallMesh; var rightEyeBallMesh; if (cameraEl.getObject3D('mesh') || cameraEl.getObject3D('replayerMesh')) { return; } // Head. headMesh = new THREE.Mesh(); headMesh.geometry ...
javascript
function () { var cameraEl = this.cameraEl; var headMesh; var leftEyeMesh; var rightEyeMesh; var leftEyeBallMesh; var rightEyeBallMesh; if (cameraEl.getObject3D('mesh') || cameraEl.getObject3D('replayerMesh')) { return; } // Head. headMesh = new THREE.Mesh(); headMesh.geometry ...
[ "function", "(", ")", "{", "var", "cameraEl", "=", "this", ".", "cameraEl", ";", "var", "headMesh", ";", "var", "leftEyeMesh", ";", "var", "rightEyeMesh", ";", "var", "leftEyeBallMesh", ";", "var", "rightEyeBallMesh", ";", "if", "(", "cameraEl", ".", "getO...
Create head geometry for spectator mode. Always created in case we want to toggle, but only visible during spectator mode.
[ "Create", "head", "geometry", "for", "spectator", "mode", ".", "Always", "created", "in", "case", "we", "want", "to", "toggle", "but", "only", "visible", "during", "spectator", "mode", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-replayer.js#L296-L341
22,784
dmarcos/aframe-motion-capture-components
src/components/avatar-replayer.js
function () { var self = this; if (!this.isReplaying || !this.replayData) { return; } this.isReplaying = false; Object.keys(this.replayData).forEach(function removeReplayer (key) { if (key === 'camera') { self.cameraEl.removeComponent('motion-capture-replayer'); } else { el...
javascript
function () { var self = this; if (!this.isReplaying || !this.replayData) { return; } this.isReplaying = false; Object.keys(this.replayData).forEach(function removeReplayer (key) { if (key === 'camera') { self.cameraEl.removeComponent('motion-capture-replayer'); } else { el...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "if", "(", "!", "this", ".", "isReplaying", "||", "!", "this", ".", "replayData", ")", "{", "return", ";", "}", "this", ".", "isReplaying", "=", "false", ";", "Object", ".", "keys", "(", ...
Remove motion-capture-replayer components.
[ "Remove", "motion", "-", "capture", "-", "replayer", "components", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-replayer.js#L346-L364
22,785
dmarcos/aframe-motion-capture-components
src/components/avatar-replayer.js
function (url, binary, callback) { var data; var self = this; fileLoader.crossOrigin = 'anonymous'; if (binary === true) { fileLoader.setResponseType('arraybuffer'); } fileLoader.load(url, function (buffer) { if (binary === true) { data = self.loadStrokeBinary(buffer); ...
javascript
function (url, binary, callback) { var data; var self = this; fileLoader.crossOrigin = 'anonymous'; if (binary === true) { fileLoader.setResponseType('arraybuffer'); } fileLoader.load(url, function (buffer) { if (binary === true) { data = self.loadStrokeBinary(buffer); ...
[ "function", "(", "url", ",", "binary", ",", "callback", ")", "{", "var", "data", ";", "var", "self", "=", "this", ";", "fileLoader", ".", "crossOrigin", "=", "'anonymous'", ";", "if", "(", "binary", "===", "true", ")", "{", "fileLoader", ".", "setRespo...
XHR for data.
[ "XHR", "for", "data", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-replayer.js#L369-L384
22,786
dmarcos/aframe-motion-capture-components
src/components/avatar-recorder.js
function () { var self = this; var trackedControllerEls = this.el.querySelectorAll('[tracked-controls]'); this.trackedControllerEls = {}; trackedControllerEls.forEach(function setupController (trackedControllerEl) { if (!trackedControllerEl.id) { warn('Found a tracked controller entity wit...
javascript
function () { var self = this; var trackedControllerEls = this.el.querySelectorAll('[tracked-controls]'); this.trackedControllerEls = {}; trackedControllerEls.forEach(function setupController (trackedControllerEl) { if (!trackedControllerEl.id) { warn('Found a tracked controller entity wit...
[ "function", "(", ")", "{", "var", "self", "=", "this", ";", "var", "trackedControllerEls", "=", "this", ".", "el", ".", "querySelectorAll", "(", "'[tracked-controls]'", ")", ";", "this", ".", "trackedControllerEls", "=", "{", "}", ";", "trackedControllerEls", ...
Poll for tracked controllers.
[ "Poll", "for", "tracked", "controllers", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-recorder.js#L33-L52
22,787
dmarcos/aframe-motion-capture-components
src/components/avatar-recorder.js
function (evt) { var key = evt.keyCode; var KEYS = {space: 32}; switch (key) { // <space>: Toggle recording. case KEYS.space: { this.toggleRecording(); break; } } }
javascript
function (evt) { var key = evt.keyCode; var KEYS = {space: 32}; switch (key) { // <space>: Toggle recording. case KEYS.space: { this.toggleRecording(); break; } } }
[ "function", "(", "evt", ")", "{", "var", "key", "=", "evt", ".", "keyCode", ";", "var", "KEYS", "=", "{", "space", ":", "32", "}", ";", "switch", "(", "key", ")", "{", "// <space>: Toggle recording.", "case", "KEYS", ".", "space", ":", "{", "this", ...
Keyboard shortcuts.
[ "Keyboard", "shortcuts", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-recorder.js#L65-L75
22,788
dmarcos/aframe-motion-capture-components
src/components/avatar-recorder.js
function (doneCb) { var el = this.el; var self = this; if (this.data.cameraOverride) { prepareCamera(this.data.cameraOverride); return; } // Grab camera. if (el.camera && el.camera.el) { prepareCamera(el.camera.el); return; } el.addEventListener('camera-set-act...
javascript
function (doneCb) { var el = this.el; var self = this; if (this.data.cameraOverride) { prepareCamera(this.data.cameraOverride); return; } // Grab camera. if (el.camera && el.camera.el) { prepareCamera(el.camera.el); return; } el.addEventListener('camera-set-act...
[ "function", "(", "doneCb", ")", "{", "var", "el", "=", "this", ".", "el", ";", "var", "self", "=", "this", ";", "if", "(", "this", ".", "data", ".", "cameraOverride", ")", "{", "prepareCamera", "(", "this", ".", "data", ".", "cameraOverride", ")", ...
Set motion capture recorder on the camera once the camera is ready.
[ "Set", "motion", "capture", "recorder", "on", "the", "camera", "once", "the", "camera", "is", "ready", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-recorder.js#L91-L122
22,789
dmarcos/aframe-motion-capture-components
src/components/avatar-recorder.js
function () { var trackedControllerEls = this.trackedControllerEls; var self = this; if (this.isRecording) { return; } log('Starting recording!'); if (this.el.components['avatar-replayer']) { this.el.components['avatar-replayer'].stopReplaying(); } // Get camera. this.setupCame...
javascript
function () { var trackedControllerEls = this.trackedControllerEls; var self = this; if (this.isRecording) { return; } log('Starting recording!'); if (this.el.components['avatar-replayer']) { this.el.components['avatar-replayer'].stopReplaying(); } // Get camera. this.setupCame...
[ "function", "(", ")", "{", "var", "trackedControllerEls", "=", "this", ".", "trackedControllerEls", ";", "var", "self", "=", "this", ";", "if", "(", "this", ".", "isRecording", ")", "{", "return", ";", "}", "log", "(", "'Starting recording!'", ")", ";", ...
Start recording camera and tracked controls.
[ "Start", "recording", "camera", "and", "tracked", "controls", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-recorder.js#L127-L149
22,790
dmarcos/aframe-motion-capture-components
src/components/avatar-recorder.js
function () { var trackedControllerEls = this.trackedControllerEls; if (!this.isRecording) { return; } log('Stopped recording.'); this.isRecording = false; this.cameraEl.components['motion-capture-recorder'].stopRecording(); Object.keys(trackedControllerEls).forEach(function (id) { track...
javascript
function () { var trackedControllerEls = this.trackedControllerEls; if (!this.isRecording) { return; } log('Stopped recording.'); this.isRecording = false; this.cameraEl.components['motion-capture-recorder'].stopRecording(); Object.keys(trackedControllerEls).forEach(function (id) { track...
[ "function", "(", ")", "{", "var", "trackedControllerEls", "=", "this", ".", "trackedControllerEls", ";", "if", "(", "!", "this", ".", "isRecording", ")", "{", "return", ";", "}", "log", "(", "'Stopped recording.'", ")", ";", "this", ".", "isRecording", "="...
Tell camera and tracked controls motion-capture-recorder components to stop recording. Store recording and replay if autoPlay is on.
[ "Tell", "camera", "and", "tracked", "controls", "motion", "-", "capture", "-", "recorder", "components", "to", "stop", "recording", ".", "Store", "recording", "and", "replay", "if", "autoPlay", "is", "on", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-recorder.js#L155-L172
22,791
dmarcos/aframe-motion-capture-components
src/components/avatar-recorder.js
function (recordingData) { var data = this.data; if (!data.localStorage) { return; } log('Recording stored in localStorage.'); this.el.systems.recordingdb.addRecording(data.recordingName, recordingData); }
javascript
function (recordingData) { var data = this.data; if (!data.localStorage) { return; } log('Recording stored in localStorage.'); this.el.systems.recordingdb.addRecording(data.recordingName, recordingData); }
[ "function", "(", "recordingData", ")", "{", "var", "data", "=", "this", ".", "data", ";", "if", "(", "!", "data", ".", "localStorage", ")", "{", "return", ";", "}", "log", "(", "'Recording stored in localStorage.'", ")", ";", "this", ".", "el", ".", "s...
Store recording in IndexedDB using recordingdb system.
[ "Store", "recording", "in", "IndexedDB", "using", "recordingdb", "system", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/components/avatar-recorder.js#L199-L204
22,792
dmarcos/aframe-motion-capture-components
src/systems/motion-capture-replayer.js
function (gamepads) { var i; var sceneEl = this.sceneEl; var trackedControlsSystem = sceneEl.systems['tracked-controls']; gamepads = gamepads || [] // convert from read-only GamepadList gamepads = Array.from(gamepads) this.gamepads.forEach(function (gamepad) { if (gamepads[gamepad.ind...
javascript
function (gamepads) { var i; var sceneEl = this.sceneEl; var trackedControlsSystem = sceneEl.systems['tracked-controls']; gamepads = gamepads || [] // convert from read-only GamepadList gamepads = Array.from(gamepads) this.gamepads.forEach(function (gamepad) { if (gamepads[gamepad.ind...
[ "function", "(", "gamepads", ")", "{", "var", "i", ";", "var", "sceneEl", "=", "this", ".", "sceneEl", ";", "var", "trackedControlsSystem", "=", "sceneEl", ".", "systems", "[", "'tracked-controls'", "]", ";", "gamepads", "=", "gamepads", "||", "[", "]", ...
Wrap `updateControllerList` to stub in the gamepads and emit `controllersupdated`.
[ "Wrap", "updateControllerList", "to", "stub", "in", "the", "gamepads", "and", "emit", "controllersupdated", "." ]
3a3cbd73ffc751285be95e9729a09121ff03c440
https://github.com/dmarcos/aframe-motion-capture-components/blob/3a3cbd73ffc751285be95e9729a09121ff03c440/src/systems/motion-capture-replayer.js#L43-L59
22,793
Alhadis/Accordion
src/accordion.js
setToken
function setToken(list, token, enabled){ enabled ? list.add(token) : list.remove(token); }
javascript
function setToken(list, token, enabled){ enabled ? list.add(token) : list.remove(token); }
[ "function", "setToken", "(", "list", ",", "token", ",", "enabled", ")", "{", "enabled", "?", "list", ".", "add", "(", "token", ")", ":", "list", ".", "remove", "(", "token", ")", ";", "}" ]
Conditionally add or remove a token from a token-list. @param {DOMTokenList} list @param {String} token @param {Boolean} enabled
[ "Conditionally", "add", "or", "remove", "a", "token", "from", "a", "token", "-", "list", "." ]
057b2fdf9f875519120991df59e68e4ec0c06a6d
https://github.com/Alhadis/Accordion/blob/057b2fdf9f875519120991df59e68e4ec0c06a6d/src/accordion.js#L25-L27
22,794
Alhadis/Accordion
src/accordion.js
debounce
function debounce(fn, limit, soon){ var limit = limit < 0 ? 0 : limit, started, context, args, timer, delayed = function(){ // Get the time between now and when the function was first fired var timeSince = Date.now() - started; if(timeSince >= limit){ if(!soon) fn.apply(context, args); ...
javascript
function debounce(fn, limit, soon){ var limit = limit < 0 ? 0 : limit, started, context, args, timer, delayed = function(){ // Get the time between now and when the function was first fired var timeSince = Date.now() - started; if(timeSince >= limit){ if(!soon) fn.apply(context, args); ...
[ "function", "debounce", "(", "fn", ",", "limit", ",", "soon", ")", "{", "var", "limit", "=", "limit", "<", "0", "?", "0", ":", "limit", ",", "started", ",", "context", ",", "args", ",", "timer", ",", "delayed", "=", "function", "(", ")", "{", "//...
Stop a function from firing too quickly. Returns a copy of the original function that runs only after the designated number of milliseconds have elapsed. Useful for throttling onResize handlers. @param {Number} limit - Threshold to stall execution by, in milliseconds. @param {Boolean} soon - If TRUE, will call the fu...
[ "Stop", "a", "function", "from", "firing", "too", "quickly", "." ]
057b2fdf9f875519120991df59e68e4ec0c06a6d
https://github.com/Alhadis/Accordion/blob/057b2fdf9f875519120991df59e68e4ec0c06a6d/src/accordion.js#L41-L74
22,795
Alhadis/Accordion
src/accordion.js
fit
function fit(){ var height = THIS.headingHeight; if(THIS.open) height += content.scrollHeight; if(useBorders) height += THIS.elBorder; THIS.height = height; }
javascript
function fit(){ var height = THIS.headingHeight; if(THIS.open) height += content.scrollHeight; if(useBorders) height += THIS.elBorder; THIS.height = height; }
[ "function", "fit", "(", ")", "{", "var", "height", "=", "THIS", ".", "headingHeight", ";", "if", "(", "THIS", ".", "open", ")", "height", "+=", "content", ".", "scrollHeight", ";", "if", "(", "useBorders", ")", "height", "+=", "THIS", ".", "elBorder", ...
Adjust a fold's container to fit its content.
[ "Adjust", "a", "fold", "s", "container", "to", "fit", "its", "content", "." ]
057b2fdf9f875519120991df59e68e4ec0c06a6d
https://github.com/Alhadis/Accordion/blob/057b2fdf9f875519120991df59e68e4ec0c06a6d/src/accordion.js#L623-L628
22,796
Alhadis/Accordion
src/accordion.js
updateFold
function updateFold(fold, offset){ var next = fold; var parentFold = THIS.parentFold; while(next = next.nextFold) next.y += offset; parentFold || edgeCheck(offset); fold.height += offset; THIS.height += offset; parentFold && parentFold.open && THIS.parent.updateFold(parentFold, offset)...
javascript
function updateFold(fold, offset){ var next = fold; var parentFold = THIS.parentFold; while(next = next.nextFold) next.y += offset; parentFold || edgeCheck(offset); fold.height += offset; THIS.height += offset; parentFold && parentFold.open && THIS.parent.updateFold(parentFold, offset)...
[ "function", "updateFold", "(", "fold", ",", "offset", ")", "{", "var", "next", "=", "fold", ";", "var", "parentFold", "=", "THIS", ".", "parentFold", ";", "while", "(", "next", "=", "next", ".", "nextFold", ")", "next", ".", "y", "+=", "offset", ";",...
Update the vertical ordinate of each sibling for a particular fold. @param {Fold} fold @param {Number} offset - Pixel distance to adjust by
[ "Update", "the", "vertical", "ordinate", "of", "each", "sibling", "for", "a", "particular", "fold", "." ]
057b2fdf9f875519120991df59e68e4ec0c06a6d
https://github.com/Alhadis/Accordion/blob/057b2fdf9f875519120991df59e68e4ec0c06a6d/src/accordion.js#L906-L917
22,797
Alhadis/Accordion
src/accordion.js
update
function update(){ var y = 0; var height = 0; var i = 0; var l = folds.length; var parentFold = THIS.parentFold; var fold, diff; for(; i < l; ++i){ fold = folds[i]; fold.y = y; fold.fit(); y += fold.height; height += fold.height; } diff = heig...
javascript
function update(){ var y = 0; var height = 0; var i = 0; var l = folds.length; var parentFold = THIS.parentFold; var fold, diff; for(; i < l; ++i){ fold = folds[i]; fold.y = y; fold.fit(); y += fold.height; height += fold.height; } diff = heig...
[ "function", "update", "(", ")", "{", "var", "y", "=", "0", ";", "var", "height", "=", "0", ";", "var", "i", "=", "0", ";", "var", "l", "=", "folds", ".", "length", ";", "var", "parentFold", "=", "THIS", ".", "parentFold", ";", "var", "fold", ",...
Update the height of each fold to fit its content.
[ "Update", "the", "height", "of", "each", "fold", "to", "fit", "its", "content", "." ]
057b2fdf9f875519120991df59e68e4ec0c06a6d
https://github.com/Alhadis/Accordion/blob/057b2fdf9f875519120991df59e68e4ec0c06a6d/src/accordion.js#L923-L945
22,798
Alhadis/Accordion
src/accordion.js
refresh
function refresh(allowSnap){ var snap = allowSnap ? snapClass : false; snap && elClasses.add(snap); THIS.update(); THIS.childAccordions && THIS.childAccordions.forEach(function(a){ a.parentFold.open ? a.refresh(allowSnap) : (a.parentFold.needsRefresh = true); }); snap && setTimeo...
javascript
function refresh(allowSnap){ var snap = allowSnap ? snapClass : false; snap && elClasses.add(snap); THIS.update(); THIS.childAccordions && THIS.childAccordions.forEach(function(a){ a.parentFold.open ? a.refresh(allowSnap) : (a.parentFold.needsRefresh = true); }); snap && setTimeo...
[ "function", "refresh", "(", "allowSnap", ")", "{", "var", "snap", "=", "allowSnap", "?", "snapClass", ":", "false", ";", "snap", "&&", "elClasses", ".", "add", "(", "snap", ")", ";", "THIS", ".", "update", "(", ")", ";", "THIS", ".", "childAccordions",...
Recalculate the boundaries of an Accordion and its descendants. This method should only be called if the width of a container changes, or a fold's contents have resized unexpectedly (such as when images load). @param {Boolean} allowSnap - Snap folds instantly into place without transitioning
[ "Recalculate", "the", "boundaries", "of", "an", "Accordion", "and", "its", "descendants", "." ]
057b2fdf9f875519120991df59e68e4ec0c06a6d
https://github.com/Alhadis/Accordion/blob/057b2fdf9f875519120991df59e68e4ec0c06a6d/src/accordion.js#L957-L969
22,799
decaffeinate/bulk-decaffeinate
src/config/resolveConfig.js
getCLIParamsConfig
function getCLIParamsConfig(config, commander) { let { file, pathFile, dir, useJsModules, landBase, numWorkers, skipVerify, decaffeinatePath, jscodeshiftPath, eslintPath, } = commander; // As a special case, specifying files to process from the CLI should cause // any equ...
javascript
function getCLIParamsConfig(config, commander) { let { file, pathFile, dir, useJsModules, landBase, numWorkers, skipVerify, decaffeinatePath, jscodeshiftPath, eslintPath, } = commander; // As a special case, specifying files to process from the CLI should cause // any equ...
[ "function", "getCLIParamsConfig", "(", "config", ",", "commander", ")", "{", "let", "{", "file", ",", "pathFile", ",", "dir", ",", "useJsModules", ",", "landBase", ",", "numWorkers", ",", "skipVerify", ",", "decaffeinatePath", ",", "jscodeshiftPath", ",", "esl...
Fill in a configuration from the CLI arguments.
[ "Fill", "in", "a", "configuration", "from", "the", "CLI", "arguments", "." ]
78a75de4eb3d7a3bd5a4d8e882a6b5d4ca8cd7f1
https://github.com/decaffeinate/bulk-decaffeinate/blob/78a75de4eb3d7a3bd5a4d8e882a6b5d4ca8cd7f1/src/config/resolveConfig.js#L97-L149