repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
wecodemore/grunt-githooks
lib/githooks.js
function() { var hookPath = path.resolve(this.options.dest, this.hookName); var existingCode = this.getHookContent(hookPath); if (existingCode) { this.validateScriptLanguage(existingCode); } var hookContent; if(this.hasMarkers(existingCode)) { hookContent = this.insertBindingCode...
javascript
function() { var hookPath = path.resolve(this.options.dest, this.hookName); var existingCode = this.getHookContent(hookPath); if (existingCode) { this.validateScriptLanguage(existingCode); } var hookContent; if(this.hasMarkers(existingCode)) { hookContent = this.insertBindingCode...
[ "function", "(", ")", "{", "var", "hookPath", "=", "path", ".", "resolve", "(", "this", ".", "options", ".", "dest", ",", "this", ".", "hookName", ")", ";", "var", "existingCode", "=", "this", ".", "getHookContent", "(", "hookPath", ")", ";", "if", "...
Creates the hook @method create
[ "Creates", "the", "hook" ]
8a026d6b9529c7923e734960813d1f54315a8e47
https://github.com/wecodemore/grunt-githooks/blob/8a026d6b9529c7923e734960813d1f54315a8e47/lib/githooks.js#L48-L68
train
wecodemore/grunt-githooks
lib/githooks.js
function () { var template = this.loadTemplate(this.options.template); var bindingCode = template({ hook: this.hookName, command: this.options.command, task: this.taskNames, preventExit: this.options.preventExit, args: this.options.args, gruntfileDirectory: process.cwd(), ...
javascript
function () { var template = this.loadTemplate(this.options.template); var bindingCode = template({ hook: this.hookName, command: this.options.command, task: this.taskNames, preventExit: this.options.preventExit, args: this.options.args, gruntfileDirectory: process.cwd(), ...
[ "function", "(", ")", "{", "var", "template", "=", "this", ".", "loadTemplate", "(", "this", ".", "options", ".", "template", ")", ";", "var", "bindingCode", "=", "template", "(", "{", "hook", ":", "this", ".", "hookName", ",", "command", ":", "this", ...
Creates the code that will run the grunt task from the hook @method createBindingCode @param task {String} @param templatePath {Object}
[ "Creates", "the", "code", "that", "will", "run", "the", "grunt", "task", "from", "the", "hook" ]
8a026d6b9529c7923e734960813d1f54315a8e47
https://github.com/wecodemore/grunt-githooks/blob/8a026d6b9529c7923e734960813d1f54315a8e47/lib/githooks.js#L128-L142
train
jonschlinkert/utils
lib/object/merge.js
merge
function merge(o) { if (!isPlainObject(o)) { return {}; } var args = arguments; var len = args.length - 1; for (var i = 0; i < len; i++) { var obj = args[i + 1]; if (isPlainObject(obj)) { for (var key in obj) { if (hasOwn(obj, key)) { if (isPlainObject(obj[key])) { ...
javascript
function merge(o) { if (!isPlainObject(o)) { return {}; } var args = arguments; var len = args.length - 1; for (var i = 0; i < len; i++) { var obj = args[i + 1]; if (isPlainObject(obj)) { for (var key in obj) { if (hasOwn(obj, key)) { if (isPlainObject(obj[key])) { ...
[ "function", "merge", "(", "o", ")", "{", "if", "(", "!", "isPlainObject", "(", "o", ")", ")", "{", "return", "{", "}", ";", "}", "var", "args", "=", "arguments", ";", "var", "len", "=", "args", ".", "length", "-", "1", ";", "for", "(", "var", ...
Recursively combine the properties of `o` with the properties of other `objects`. @name .merge @param {Object} `o` The target object. Pass an empty object to shallow clone. @param {Object} `objects` @return {Object} @api public
[ "Recursively", "combine", "the", "properties", "of", "o", "with", "the", "properties", "of", "other", "objects", "." ]
1eae0cbeef81123e4dc29d0ac1db04f7a2a09a4b
https://github.com/jonschlinkert/utils/blob/1eae0cbeef81123e4dc29d0ac1db04f7a2a09a4b/lib/object/merge.js#L23-L44
train
feonit/olap-cube-js
examples/product-table/component/tree-table.js
function(obj) { const keys = Object.keys(obj).sort(function(key1, key2) { return key1 === 'id' ? false : key1 > key2; }); return keys; }
javascript
function(obj) { const keys = Object.keys(obj).sort(function(key1, key2) { return key1 === 'id' ? false : key1 > key2; }); return keys; }
[ "function", "(", "obj", ")", "{", "const", "keys", "=", "Object", ".", "keys", "(", "obj", ")", ".", "sort", "(", "function", "(", "key1", ",", "key2", ")", "{", "return", "key1", "===", "'id'", "?", "false", ":", "key1", ">", "key2", ";", "}", ...
Sort where param id placed in first column
[ "Sort", "where", "param", "id", "placed", "in", "first", "column" ]
13f32aac2ff9f472b0f1cd237f24eece53eaf2e3
https://github.com/feonit/olap-cube-js/blob/13f32aac2ff9f472b0f1cd237f24eece53eaf2e3/examples/product-table/component/tree-table.js#L50-L55
train
feonit/olap-cube-js
src/Cube.js
unfilled
function unfilled(cube) { const tuples = Cube.cartesian(cube); const unfilled = []; tuples.forEach(tuple => { const members = this.dice(tuple).getFacts(tuple); if (members.length === 0) { unfilled.push(tuple) } }); return unfilled; }
javascript
function unfilled(cube) { const tuples = Cube.cartesian(cube); const unfilled = []; tuples.forEach(tuple => { const members = this.dice(tuple).getFacts(tuple); if (members.length === 0) { unfilled.push(tuple) } }); return unfilled; }
[ "function", "unfilled", "(", "cube", ")", "{", "const", "tuples", "=", "Cube", ".", "cartesian", "(", "cube", ")", ";", "const", "unfilled", "=", "[", "]", ";", "tuples", ".", "forEach", "(", "tuple", "=>", "{", "const", "members", "=", "this", ".", ...
Unfilled - list of tuples, in accordance with which there is not a single member @@param {Cube} cube
[ "Unfilled", "-", "list", "of", "tuples", "in", "accordance", "with", "which", "there", "is", "not", "a", "single", "member" ]
13f32aac2ff9f472b0f1cd237f24eece53eaf2e3
https://github.com/feonit/olap-cube-js/blob/13f32aac2ff9f472b0f1cd237f24eece53eaf2e3/src/Cube.js#L704-L714
train
Beh01der/node-grok
lib/index.js
resolveFieldNames
function resolveFieldNames (pattern) { if(!pattern) { return; } var nestLevel = 0; var inRangeDef = 0; var matched; while ((matched = nestedFieldNamesRegex.exec(pattern.resolved)) !== null) { switch(matched[0]) { case '(': { if(!inRangeDef) { ++nes...
javascript
function resolveFieldNames (pattern) { if(!pattern) { return; } var nestLevel = 0; var inRangeDef = 0; var matched; while ((matched = nestedFieldNamesRegex.exec(pattern.resolved)) !== null) { switch(matched[0]) { case '(': { if(!inRangeDef) { ++nes...
[ "function", "resolveFieldNames", "(", "pattern", ")", "{", "if", "(", "!", "pattern", ")", "{", "return", ";", "}", "var", "nestLevel", "=", "0", ";", "var", "inRangeDef", "=", "0", ";", "var", "matched", ";", "while", "(", "(", "matched", "=", "nest...
create mapping table for the fieldNames to capture
[ "create", "mapping", "table", "for", "the", "fieldNames", "to", "capture" ]
f427727fb4d9ebb56b56f5c795837dc943c545ae
https://github.com/Beh01der/node-grok/blob/f427727fb4d9ebb56b56f5c795837dc943c545ae/lib/index.js#L111-L136
train
rasmusbe/wp-pot
index.js
setDefaultOptions
function setDefaultOptions (options) { const defaultOptions = { src: '**/*.php', globOpts: {}, destFile: 'translations.pot', commentKeyword: 'translators:', headers: { 'X-Poedit-Basepath': '..', 'X-Poedit-SourceCharset': 'UTF-8', 'X-Poedit-SearchPath-0': '.', 'X-Poedit-Sear...
javascript
function setDefaultOptions (options) { const defaultOptions = { src: '**/*.php', globOpts: {}, destFile: 'translations.pot', commentKeyword: 'translators:', headers: { 'X-Poedit-Basepath': '..', 'X-Poedit-SourceCharset': 'UTF-8', 'X-Poedit-SearchPath-0': '.', 'X-Poedit-Sear...
[ "function", "setDefaultOptions", "(", "options", ")", "{", "const", "defaultOptions", "=", "{", "src", ":", "'**/*.php'", ",", "globOpts", ":", "{", "}", ",", "destFile", ":", "'translations.pot'", ",", "commentKeyword", ":", "'translators:'", ",", "headers", ...
Set default options @param {object} options @return {object}
[ "Set", "default", "options" ]
84d7779978196be08628ce716a8b189bc31b6469
https://github.com/rasmusbe/wp-pot/blob/84d7779978196be08628ce716a8b189bc31b6469/index.js#L18-L81
train
rasmusbe/wp-pot
index.js
keywordsListStrings
function keywordsListStrings (gettextFunctions) { const methodStrings = []; for (const getTextFunction of gettextFunctions) { let methodString = getTextFunction.name; if (getTextFunction.plural || getTextFunction.context) { methodString += ':1'; } if (getTextFunction.plural) { methodSt...
javascript
function keywordsListStrings (gettextFunctions) { const methodStrings = []; for (const getTextFunction of gettextFunctions) { let methodString = getTextFunction.name; if (getTextFunction.plural || getTextFunction.context) { methodString += ':1'; } if (getTextFunction.plural) { methodSt...
[ "function", "keywordsListStrings", "(", "gettextFunctions", ")", "{", "const", "methodStrings", "=", "[", "]", ";", "for", "(", "const", "getTextFunction", "of", "gettextFunctions", ")", "{", "let", "methodString", "=", "getTextFunction", ".", "name", ";", "if",...
Generate string for header from gettext function @param {object} gettextFunctions @return {Array}
[ "Generate", "string", "for", "header", "from", "gettext", "function" ]
84d7779978196be08628ce716a8b189bc31b6469
https://github.com/rasmusbe/wp-pot/blob/84d7779978196be08628ce716a8b189bc31b6469/index.js#L90-L110
train
sethwebster/ember-cli-new-version
index.js
function(app/*, parentAddon*/) { this._super.included.apply(this, arguments); this._options = app.options.newVersion || {}; if (this._options.enabled === true) { this._options.fileName = this._options.fileName || 'VERSION.txt'; this._options.prepend = this._options.prepend || ''; this._...
javascript
function(app/*, parentAddon*/) { this._super.included.apply(this, arguments); this._options = app.options.newVersion || {}; if (this._options.enabled === true) { this._options.fileName = this._options.fileName || 'VERSION.txt'; this._options.prepend = this._options.prepend || ''; this._...
[ "function", "(", "app", "/*, parentAddon*/", ")", "{", "this", ".", "_super", ".", "included", ".", "apply", "(", "this", ",", "arguments", ")", ";", "this", ".", "_options", "=", "app", ".", "options", ".", "newVersion", "||", "{", "}", ";", "if", "...
Store `ember-cli-build.js` options
[ "Store", "ember", "-", "cli", "-", "build", ".", "js", "options" ]
c1ce9cfda5757f8d198356bc8a9166b639df1696
https://github.com/sethwebster/ember-cli-new-version/blob/c1ce9cfda5757f8d198356bc8a9166b639df1696/index.js#L12-L21
train
sethwebster/ember-cli-new-version
index.js
function() { let detectedVersion; if (this._options.useAppVersion && this._appVersion) { detectedVersion = this._appVersion; } if (!detectedVersion) { detectedVersion = this.parent.pkg.version; } if (detectedVersion && this._options.enabled) { const fileName = this._options....
javascript
function() { let detectedVersion; if (this._options.useAppVersion && this._appVersion) { detectedVersion = this._appVersion; } if (!detectedVersion) { detectedVersion = this.parent.pkg.version; } if (detectedVersion && this._options.enabled) { const fileName = this._options....
[ "function", "(", ")", "{", "let", "detectedVersion", ";", "if", "(", "this", ".", "_options", ".", "useAppVersion", "&&", "this", ".", "_appVersion", ")", "{", "detectedVersion", "=", "this", ".", "_appVersion", ";", "}", "if", "(", "!", "detectedVersion",...
Write version file based on - ember-cli-app-version if installed - package.json of consuming application or
[ "Write", "version", "file" ]
c1ce9cfda5757f8d198356bc8a9166b639df1696
https://github.com/sethwebster/ember-cli-new-version/blob/c1ce9cfda5757f8d198356bc8a9166b639df1696/index.js#L37-L54
train
ynab/ynab-sdk-js
dist/esm/api.js
function (budget_id, data, options) { var localVarFetchArgs = TransactionsApiFetchParamCreator(configuration).createTransaction(budget_id, data, options); return function (fetchFunction) { if (fetchFunction === void 0) { fetchFunction = fetch; } return fetchFuncti...
javascript
function (budget_id, data, options) { var localVarFetchArgs = TransactionsApiFetchParamCreator(configuration).createTransaction(budget_id, data, options); return function (fetchFunction) { if (fetchFunction === void 0) { fetchFunction = fetch; } return fetchFuncti...
[ "function", "(", "budget_id", ",", "data", ",", "options", ")", "{", "var", "localVarFetchArgs", "=", "TransactionsApiFetchParamCreator", "(", "configuration", ")", ".", "createTransaction", "(", "budget_id", ",", "data", ",", "options", ")", ";", "return", "fun...
Creates a single transaction or multiple transactions. If you provide a body containing a 'transaction' object, a single transaction will be created and if you provide a body containing a 'transactions' array, multiple transactions will be created. @summary Create a single transaction or multiple transactions @param {...
[ "Creates", "a", "single", "transaction", "or", "multiple", "transactions", ".", "If", "you", "provide", "a", "body", "containing", "a", "transaction", "object", "a", "single", "transaction", "will", "be", "created", "and", "if", "you", "provide", "a", "body", ...
2f1d9ec766e526ffd14c543ca2b3b3244782a878
https://github.com/ynab/ynab-sdk-js/blob/2f1d9ec766e526ffd14c543ca2b3b3244782a878/dist/esm/api.js#L2683-L2698
train
ynab/ynab-sdk-js
dist/esm/api.js
function (budget_id, account_id, since_date, type, last_knowledge_of_server, options) { return TransactionsApiFp(configuration).getTransactionsByAccount(budget_id, account_id, since_date, type, last_knowledge_of_server, options)(); }
javascript
function (budget_id, account_id, since_date, type, last_knowledge_of_server, options) { return TransactionsApiFp(configuration).getTransactionsByAccount(budget_id, account_id, since_date, type, last_knowledge_of_server, options)(); }
[ "function", "(", "budget_id", ",", "account_id", ",", "since_date", ",", "type", ",", "last_knowledge_of_server", ",", "options", ")", "{", "return", "TransactionsApiFp", "(", "configuration", ")", ".", "getTransactionsByAccount", "(", "budget_id", ",", "account_id"...
Returns all transactions for a specified account @summary List account transactions @param {string} budget_id - The id of the budget (\"last-used\" can also be used to specify the last used budget) @param {string} account_id - The id of the account @param {Date} [since_date] - If specified, only transactions on or afte...
[ "Returns", "all", "transactions", "for", "a", "specified", "account" ]
2f1d9ec766e526ffd14c543ca2b3b3244782a878
https://github.com/ynab/ynab-sdk-js/blob/2f1d9ec766e526ffd14c543ca2b3b3244782a878/dist/esm/api.js#L2933-L2935
train
ynab/ynab-sdk-js
dist/esm/api.js
function (budget_id, category_id, since_date, type, last_knowledge_of_server, options) { return TransactionsApiFp(configuration).getTransactionsByCategory(budget_id, category_id, since_date, type, last_knowledge_of_server, options)(); }
javascript
function (budget_id, category_id, since_date, type, last_knowledge_of_server, options) { return TransactionsApiFp(configuration).getTransactionsByCategory(budget_id, category_id, since_date, type, last_knowledge_of_server, options)(); }
[ "function", "(", "budget_id", ",", "category_id", ",", "since_date", ",", "type", ",", "last_knowledge_of_server", ",", "options", ")", "{", "return", "TransactionsApiFp", "(", "configuration", ")", ".", "getTransactionsByCategory", "(", "budget_id", ",", "category_...
Returns all transactions for a specified category @summary List category transactions @param {string} budget_id - The id of the budget (\"last-used\" can also be used to specify the last used budget) @param {string} category_id - The id of the category @param {Date} [since_date] - If specified, only transactions on or ...
[ "Returns", "all", "transactions", "for", "a", "specified", "category" ]
2f1d9ec766e526ffd14c543ca2b3b3244782a878
https://github.com/ynab/ynab-sdk-js/blob/2f1d9ec766e526ffd14c543ca2b3b3244782a878/dist/esm/api.js#L2947-L2949
train
ARMmbed/mbed-cloud-sdk-javascript
gulpfile.js
bundle
function bundle(srcFiles, destDir, optionsFn) { return gulp.src(srcFiles, { read: false }) .pipe(tap(function(file) { var options = {}; if (optionsFn) options = optionsFn(file); var fileName = options.fileName || path.basename(file.path); if (options.standalone) ...
javascript
function bundle(srcFiles, destDir, optionsFn) { return gulp.src(srcFiles, { read: false }) .pipe(tap(function(file) { var options = {}; if (optionsFn) options = optionsFn(file); var fileName = options.fileName || path.basename(file.path); if (options.standalone) ...
[ "function", "bundle", "(", "srcFiles", ",", "destDir", ",", "optionsFn", ")", "{", "return", "gulp", ".", "src", "(", "srcFiles", ",", "{", "read", ":", "false", "}", ")", ".", "pipe", "(", "tap", "(", "function", "(", "file", ")", "{", "var", "opt...
Browserify helper function
[ "Browserify", "helper", "function" ]
4db65166edca0b768c89cc6fb22be0582e5aeee1
https://github.com/ARMmbed/mbed-cloud-sdk-javascript/blob/4db65166edca0b768c89cc6fb22be0582e5aeee1/gulpfile.js#L22-L58
train
ARMmbed/mbed-cloud-sdk-javascript
examples/node/webhook-subscriptions.js
subscribe
function subscribe() { // starts to receive values after device regsiters connect.subscribe.resourceValues({ resourcePaths: ["/3200/0/5501"] }) .addListener((res) => logData(res, "OnRegistration")) .addLocalFilter(res => res.payload >= 20); // starts to reveive values immediatley connec...
javascript
function subscribe() { // starts to receive values after device regsiters connect.subscribe.resourceValues({ resourcePaths: ["/3200/0/5501"] }) .addListener((res) => logData(res, "OnRegistration")) .addLocalFilter(res => res.payload >= 20); // starts to reveive values immediatley connec...
[ "function", "subscribe", "(", ")", "{", "// starts to receive values after device regsiters", "connect", ".", "subscribe", ".", "resourceValues", "(", "{", "resourcePaths", ":", "[", "\"/3200/0/5501\"", "]", "}", ")", ".", "addListener", "(", "(", "res", ")", "=>"...
subscribe to the button resource
[ "subscribe", "to", "the", "button", "resource" ]
4db65166edca0b768c89cc6fb22be0582e5aeee1
https://github.com/ARMmbed/mbed-cloud-sdk-javascript/blob/4db65166edca0b768c89cc6fb22be0582e5aeee1/examples/node/webhook-subscriptions.js#L43-L52
train
ARMmbed/mbed-cloud-sdk-javascript
examples/node/config.js
parseCommandLine
function parseCommandLine() { var commands = process.argv.slice(2); var args = {}; for (var i = 0; i < commands.length; i++) { var match = commands[i].match(/^--(.+)=(.+)$/); if (match) args[match[1]] = match[2]; else if (i < commands.length - 1 && commands[i].substr(0, 1) === "-") { args[commands[i].su...
javascript
function parseCommandLine() { var commands = process.argv.slice(2); var args = {}; for (var i = 0; i < commands.length; i++) { var match = commands[i].match(/^--(.+)=(.+)$/); if (match) args[match[1]] = match[2]; else if (i < commands.length - 1 && commands[i].substr(0, 1) === "-") { args[commands[i].su...
[ "function", "parseCommandLine", "(", ")", "{", "var", "commands", "=", "process", ".", "argv", ".", "slice", "(", "2", ")", ";", "var", "args", "=", "{", "}", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "commands", ".", "length", ";", ...
Parse command line arguments
[ "Parse", "command", "line", "arguments" ]
4db65166edca0b768c89cc6fb22be0582e5aeee1
https://github.com/ARMmbed/mbed-cloud-sdk-javascript/blob/4db65166edca0b768c89cc6fb22be0582e5aeee1/examples/node/config.js#L24-L41
train
ARMmbed/mbed-cloud-sdk-javascript
examples/node/certificate-header.js
checkCertificate
function checkCertificate() { return certificates.listCertificates({ filter: { type: "developer" } }) .then(certs => { var certificate = certs.data.find(cert => { return cert.name === certificateName; }); if (certificate) { return ...
javascript
function checkCertificate() { return certificates.listCertificates({ filter: { type: "developer" } }) .then(certs => { var certificate = certs.data.find(cert => { return cert.name === certificateName; }); if (certificate) { return ...
[ "function", "checkCertificate", "(", ")", "{", "return", "certificates", ".", "listCertificates", "(", "{", "filter", ":", "{", "type", ":", "\"developer\"", "}", "}", ")", ".", "then", "(", "certs", "=>", "{", "var", "certificate", "=", "certs", ".", "d...
Check for existing certificate with the same name
[ "Check", "for", "existing", "certificate", "with", "the", "same", "name" ]
4db65166edca0b768c89cc6fb22be0582e5aeee1
https://github.com/ARMmbed/mbed-cloud-sdk-javascript/blob/4db65166edca0b768c89cc6fb22be0582e5aeee1/examples/node/certificate-header.js#L31-L63
train
blueberryapps/react-svg-icon-generator
src/helpers/svgoBrowser.js
extendConfig
function extendConfig(defaults, config) { var key; // plugins if (config.plugins) { config.plugins.forEach(function(item) { // {} if (typeof item === 'object') { key = Object.keys(item)[0]; // custom ...
javascript
function extendConfig(defaults, config) { var key; // plugins if (config.plugins) { config.plugins.forEach(function(item) { // {} if (typeof item === 'object') { key = Object.keys(item)[0]; // custom ...
[ "function", "extendConfig", "(", "defaults", ",", "config", ")", "{", "var", "key", ";", "// plugins", "if", "(", "config", ".", "plugins", ")", "{", "config", ".", "plugins", ".", "forEach", "(", "function", "(", "item", ")", "{", "// {}", "if", "(", ...
Extend plugins with the custom config object. @param {Array} plugins input plugins @param {Object} config config @return {Array} output plugins
[ "Extend", "plugins", "with", "the", "custom", "config", "object", "." ]
f2fc99241027fa19fe3153f5f66eb9c5d9ad8fb2
https://github.com/blueberryapps/react-svg-icon-generator/blob/f2fc99241027fa19fe3153f5f66eb9c5d9ad8fb2/src/helpers/svgoBrowser.js#L171-L230
train
blueberryapps/react-svg-icon-generator
src/helpers/svgoBrowser.js
setupCustomPlugin
function setupCustomPlugin(name, plugin) { plugin.active = true; plugin.params = EXTEND({}, plugin.params || {}); plugin.name = name; return plugin; }
javascript
function setupCustomPlugin(name, plugin) { plugin.active = true; plugin.params = EXTEND({}, plugin.params || {}); plugin.name = name; return plugin; }
[ "function", "setupCustomPlugin", "(", "name", ",", "plugin", ")", "{", "plugin", ".", "active", "=", "true", ";", "plugin", ".", "params", "=", "EXTEND", "(", "{", "}", ",", "plugin", ".", "params", "||", "{", "}", ")", ";", "plugin", ".", "name", ...
Setup and enable a custom plugin @param {String} plugin name @param {Object} custom plugin @return {Array} enabled plugin
[ "Setup", "and", "enable", "a", "custom", "plugin" ]
f2fc99241027fa19fe3153f5f66eb9c5d9ad8fb2
https://github.com/blueberryapps/react-svg-icon-generator/blob/f2fc99241027fa19fe3153f5f66eb9c5d9ad8fb2/src/helpers/svgoBrowser.js#L239-L245
train
blueberryapps/react-svg-icon-generator
src/helpers/svgoBrowser.js
optimizePluginsArray
function optimizePluginsArray(plugins) { var prev; return plugins.reduce(function(plugins, item) { if (prev && item.type == prev[0].type) { prev.push(item); } else { plugins.push(prev = [item]); } return plugins; }...
javascript
function optimizePluginsArray(plugins) { var prev; return plugins.reduce(function(plugins, item) { if (prev && item.type == prev[0].type) { prev.push(item); } else { plugins.push(prev = [item]); } return plugins; }...
[ "function", "optimizePluginsArray", "(", "plugins", ")", "{", "var", "prev", ";", "return", "plugins", ".", "reduce", "(", "function", "(", "plugins", ",", "item", ")", "{", "if", "(", "prev", "&&", "item", ".", "type", "==", "prev", "[", "0", "]", "...
Try to group sequential elements of plugins array. @param {Object} plugins input plugins @return {Array} output plugins
[ "Try", "to", "group", "sequential", "elements", "of", "plugins", "array", "." ]
f2fc99241027fa19fe3153f5f66eb9c5d9ad8fb2
https://github.com/blueberryapps/react-svg-icon-generator/blob/f2fc99241027fa19fe3153f5f66eb9c5d9ad8fb2/src/helpers/svgoBrowser.js#L253-L266
train
gentics/gentics-ui-core
gulpfile.js
buildDocsTasks
function buildDocsTasks() { if(npmArgs.remain.indexOf('gentics-ui-core') === -1) { return new Promise(gulp.series( cleanDocsFolder, copyDocsFiles, copyJekyllConfig )); } return resolvePromiseDummy(); }
javascript
function buildDocsTasks() { if(npmArgs.remain.indexOf('gentics-ui-core') === -1) { return new Promise(gulp.series( cleanDocsFolder, copyDocsFiles, copyJekyllConfig )); } return resolvePromiseDummy(); }
[ "function", "buildDocsTasks", "(", ")", "{", "if", "(", "npmArgs", ".", "remain", ".", "indexOf", "(", "'gentics-ui-core'", ")", "===", "-", "1", ")", "{", "return", "new", "Promise", "(", "gulp", ".", "series", "(", "cleanDocsFolder", ",", "copyDocsFiles"...
Run only when gentics-ui-core is building
[ "Run", "only", "when", "gentics", "-", "ui", "-", "core", "is", "building" ]
42872a304f828ca2dd85d4fbf698b35762261e19
https://github.com/gentics/gentics-ui-core/blob/42872a304f828ca2dd85d4fbf698b35762261e19/gulpfile.js#L45-L54
train
gentics/gentics-ui-core
gulpfile.js
buildUiCoreTasks
function buildUiCoreTasks() { if(npmArgs.remain.indexOf('gentics-ui-core') !== -1) { return new Promise(gulp.series(compileDistStyles, copyDistReadme)); } return resolvePromiseDummy(); }
javascript
function buildUiCoreTasks() { if(npmArgs.remain.indexOf('gentics-ui-core') !== -1) { return new Promise(gulp.series(compileDistStyles, copyDistReadme)); } return resolvePromiseDummy(); }
[ "function", "buildUiCoreTasks", "(", ")", "{", "if", "(", "npmArgs", ".", "remain", ".", "indexOf", "(", "'gentics-ui-core'", ")", "!==", "-", "1", ")", "{", "return", "new", "Promise", "(", "gulp", ".", "series", "(", "compileDistStyles", ",", "copyDistRe...
Run only when gentics-ui-core is not building
[ "Run", "only", "when", "gentics", "-", "ui", "-", "core", "is", "not", "building" ]
42872a304f828ca2dd85d4fbf698b35762261e19
https://github.com/gentics/gentics-ui-core/blob/42872a304f828ca2dd85d4fbf698b35762261e19/gulpfile.js#L57-L62
train
gentics/gentics-ui-core
gulpfile.js
copyJekyllConfig
function copyJekyllConfig() { return streamToPromise( gulp.src(paths.src.jekyll) .pipe(rename('_config.yaml')) .pipe(gulp.dest(paths.out.docs.base)) ); }
javascript
function copyJekyllConfig() { return streamToPromise( gulp.src(paths.src.jekyll) .pipe(rename('_config.yaml')) .pipe(gulp.dest(paths.out.docs.base)) ); }
[ "function", "copyJekyllConfig", "(", ")", "{", "return", "streamToPromise", "(", "gulp", ".", "src", "(", "paths", ".", "src", ".", "jekyll", ")", ".", "pipe", "(", "rename", "(", "'_config.yaml'", ")", ")", ".", "pipe", "(", "gulp", ".", "dest", "(", ...
Copy GH Pages publish configuration
[ "Copy", "GH", "Pages", "publish", "configuration" ]
42872a304f828ca2dd85d4fbf698b35762261e19
https://github.com/gentics/gentics-ui-core/blob/42872a304f828ca2dd85d4fbf698b35762261e19/gulpfile.js#L76-L82
train
feross/cross-zip
index.js
copyToTemp
function copyToTemp () { fs.readFile(inPath, function (err, inFile) { if (err) return cb(err) var tmpPath = path.join(os.tmpdir(), 'cross-zip-' + Date.now()) fs.mkdir(tmpPath, function (err) { if (err) return cb(err) fs.writeFile(path.join(tmpPath, path.basename(inPath)), inFile, f...
javascript
function copyToTemp () { fs.readFile(inPath, function (err, inFile) { if (err) return cb(err) var tmpPath = path.join(os.tmpdir(), 'cross-zip-' + Date.now()) fs.mkdir(tmpPath, function (err) { if (err) return cb(err) fs.writeFile(path.join(tmpPath, path.basename(inPath)), inFile, f...
[ "function", "copyToTemp", "(", ")", "{", "fs", ".", "readFile", "(", "inPath", ",", "function", "(", "err", ",", "inFile", ")", "{", "if", "(", "err", ")", "return", "cb", "(", "err", ")", "var", "tmpPath", "=", "path", ".", "join", "(", "os", "....
Windows zip command cannot zip files, only directories. So move the file into a temporary directory before zipping.
[ "Windows", "zip", "command", "cannot", "zip", "files", "only", "directories", ".", "So", "move", "the", "file", "into", "a", "temporary", "directory", "before", "zipping", "." ]
854c4088102572273fa836035f22b710b078f226
https://github.com/feross/cross-zip/blob/854c4088102572273fa836035f22b710b078f226/index.js#L31-L44
train
Kitware/wslink
js/src/WebsocketConnection/session.js
getAttachment
function getAttachment(binaryKey) { // console.log('Adding binary attachment', binaryKey); const index = attachments.findIndex((att) => (att.key === binaryKey)); if (index !== -1) { const result = attachments[index].data; // TODO if attachment is sent mulitple times, we shouldn't remove it yet. ...
javascript
function getAttachment(binaryKey) { // console.log('Adding binary attachment', binaryKey); const index = attachments.findIndex((att) => (att.key === binaryKey)); if (index !== -1) { const result = attachments[index].data; // TODO if attachment is sent mulitple times, we shouldn't remove it yet. ...
[ "function", "getAttachment", "(", "binaryKey", ")", "{", "// console.log('Adding binary attachment', binaryKey);", "const", "index", "=", "attachments", ".", "findIndex", "(", "(", "att", ")", "=>", "(", "att", ".", "key", "===", "binaryKey", ")", ")", ";", "if"...
split out to support a message with a bare binary attachment.
[ "split", "out", "to", "support", "a", "message", "with", "a", "bare", "binary", "attachment", "." ]
a98f732bcdcdb536288cd54d43d8697ff8d5d842
https://github.com/Kitware/wslink/blob/a98f732bcdcdb536288cd54d43d8697ff8d5d842/js/src/WebsocketConnection/session.js#L133-L144
train
Rantanen/node-mumble
lib/MumbleSocket.js
function( socket ) { var self = this; this.buffers = []; this.readers = []; this.length = 0; this.socket = socket; // Register the data callback to receive data from Mumble server. socket.on( 'data', function( data ) { self.receiveData( data ); } ); }
javascript
function( socket ) { var self = this; this.buffers = []; this.readers = []; this.length = 0; this.socket = socket; // Register the data callback to receive data from Mumble server. socket.on( 'data', function( data ) { self.receiveData( data ); } ); }
[ "function", "(", "socket", ")", "{", "var", "self", "=", "this", ";", "this", ".", "buffers", "=", "[", "]", ";", "this", ".", "readers", "=", "[", "]", ";", "this", ".", "length", "=", "0", ";", "this", ".", "socket", "=", "socket", ";", "// R...
Mumble network protocol wrapper for an SSL socket @private @constructor @this {MumbleSocket} @param {Socket} socket SSL socket to be wrapped. The socket must be connected to the Mumble server.
[ "Mumble", "network", "protocol", "wrapper", "for", "an", "SSL", "socket" ]
c36e50339f2a8bad466816fdf6df967039a6312c
https://github.com/Rantanen/node-mumble/blob/c36e50339f2a8bad466816fdf6df967039a6312c/lib/MumbleSocket.js#L15-L26
train
Rantanen/node-mumble
lib/Channel.js
function( data, client ) { this.client = client; /** * @summary Linked channels * * @name Channel#links * @type Channel[] */ this.links = []; /** * @summary Child channels * * @name Channel#children * @type Channel[] */ this.children = []; /*...
javascript
function( data, client ) { this.client = client; /** * @summary Linked channels * * @name Channel#links * @type Channel[] */ this.links = []; /** * @summary Child channels * * @name Channel#children * @type Channel[] */ this.children = []; /*...
[ "function", "(", "data", ",", "client", ")", "{", "this", ".", "client", "=", "client", ";", "/**\n * @summary Linked channels\n *\n * @name Channel#links\n * @type Channel[]\n */", "this", ".", "links", "=", "[", "]", ";", "/**\n * @summary Child ch...
Single channel on the server. @param {Object} data - Channel data. @param {MumbleClient} client - Mumble client that owns the channel.
[ "Single", "channel", "on", "the", "server", "." ]
c36e50339f2a8bad466816fdf6df967039a6312c
https://github.com/Rantanen/node-mumble/blob/c36e50339f2a8bad466816fdf6df967039a6312c/lib/Channel.js#L13-L45
train
percy/ember-percy
index.js
parseMissingResources
function parseMissingResources(response) { return response.body.data && response.body.data.relationships && response.body.data.relationships['missing-resources'] && response.body.data.relationships['missing-resources'].data || []; }
javascript
function parseMissingResources(response) { return response.body.data && response.body.data.relationships && response.body.data.relationships['missing-resources'] && response.body.data.relationships['missing-resources'].data || []; }
[ "function", "parseMissingResources", "(", "response", ")", "{", "return", "response", ".", "body", ".", "data", "&&", "response", ".", "body", ".", "data", ".", "relationships", "&&", "response", ".", "body", ".", "data", ".", "relationships", "[", "'missing...
Helper method to parse missing-resources from an API response.
[ "Helper", "method", "to", "parse", "missing", "-", "resources", "from", "an", "API", "response", "." ]
0bb3ec9febbc406e0e03f0db84236d811d09fdb6
https://github.com/percy/ember-percy/blob/0bb3ec9febbc406e0e03f0db84236d811d09fdb6/index.js#L28-L33
train
percy/ember-percy
index.js
function(buildOutputDirectory) { createPercyBuildInvoked = true; var token = process.env.PERCY_TOKEN; var apiUrl = process.env.PERCY_API; // Optional. // Disable if Percy is explicitly disabled or if this is not an 'ember test' run. if (process.env.PERCY_ENABLE == '0' || process.env.EMBER_ENV !== ...
javascript
function(buildOutputDirectory) { createPercyBuildInvoked = true; var token = process.env.PERCY_TOKEN; var apiUrl = process.env.PERCY_API; // Optional. // Disable if Percy is explicitly disabled or if this is not an 'ember test' run. if (process.env.PERCY_ENABLE == '0' || process.env.EMBER_ENV !== ...
[ "function", "(", "buildOutputDirectory", ")", "{", "createPercyBuildInvoked", "=", "true", ";", "var", "token", "=", "process", ".", "env", ".", "PERCY_TOKEN", ";", "var", "apiUrl", "=", "process", ".", "env", ".", "PERCY_API", ";", "// Optional.", "// Disable...
Create a Percy build and upload missing build resources.
[ "Create", "a", "Percy", "build", "and", "upload", "missing", "build", "resources", "." ]
0bb3ec9febbc406e0e03f0db84236d811d09fdb6
https://github.com/percy/ember-percy/blob/0bb3ec9febbc406e0e03f0db84236d811d09fdb6/index.js#L147-L252
train
percy/ember-percy
addon/snapshot.js
setAttributeValues
function setAttributeValues(dom) { // List of input types here https://www.w3.org/TR/html5/forms.html#the-input-element // Limit scope to inputs only as textareas do not retain their value when cloned let elems = dom.find( `input[type=text], input[type=search], input[type=tel], input[type=url], input[type=em...
javascript
function setAttributeValues(dom) { // List of input types here https://www.w3.org/TR/html5/forms.html#the-input-element // Limit scope to inputs only as textareas do not retain their value when cloned let elems = dom.find( `input[type=text], input[type=search], input[type=tel], input[type=url], input[type=em...
[ "function", "setAttributeValues", "(", "dom", ")", "{", "// List of input types here https://www.w3.org/TR/html5/forms.html#the-input-element", "// Limit scope to inputs only as textareas do not retain their value when cloned", "let", "elems", "=", "dom", ".", "find", "(", "`", "`", ...
Set the property value into the attribute value for snapshotting inputs
[ "Set", "the", "property", "value", "into", "the", "attribute", "value", "for", "snapshotting", "inputs" ]
0bb3ec9febbc406e0e03f0db84236d811d09fdb6
https://github.com/percy/ember-percy/blob/0bb3ec9febbc406e0e03f0db84236d811d09fdb6/addon/snapshot.js#L24-L48
train
stealjs/transpile
lib/global/slim.js
makeNormalizer
function makeNormalizer(load, options) { if (options && (options.normalizeMap || options.normalize)) { return function(name) { return optionsNormalize(options, name, load.name, load.address); }; } else { return function(name) { return name; }; } }
javascript
function makeNormalizer(load, options) { if (options && (options.normalizeMap || options.normalize)) { return function(name) { return optionsNormalize(options, name, load.name, load.address); }; } else { return function(name) { return name; }; } }
[ "function", "makeNormalizer", "(", "load", ",", "options", ")", "{", "if", "(", "options", "&&", "(", "options", ".", "normalizeMap", "||", "options", ".", "normalize", ")", ")", "{", "return", "function", "(", "name", ")", "{", "return", "optionsNormalize...
Returns a `normalize` function given the `load` and `options`
[ "Returns", "a", "normalize", "function", "given", "the", "load", "and", "options" ]
307c7566976d08e0f637a600115cd7e7b67cc9d7
https://github.com/stealjs/transpile/blob/307c7566976d08e0f637a600115cd7e7b67cc9d7/lib/global/slim.js#L48-L58
train
stealjs/transpile
lib/get_ast.js
getAst
function getAst(load, sourceMapFileName){ if(load.ast) { return load.ast; } var fileName = sourceMapFileName || load.map && load.map.file; load.ast = esprima.parse(load.source.toString(), { loc: true, source: fileName || load.address }); if(load.map) { sourceMapToAst(load.ast, load.map); } return lo...
javascript
function getAst(load, sourceMapFileName){ if(load.ast) { return load.ast; } var fileName = sourceMapFileName || load.map && load.map.file; load.ast = esprima.parse(load.source.toString(), { loc: true, source: fileName || load.address }); if(load.map) { sourceMapToAst(load.ast, load.map); } return lo...
[ "function", "getAst", "(", "load", ",", "sourceMapFileName", ")", "{", "if", "(", "load", ".", "ast", ")", "{", "return", "load", ".", "ast", ";", "}", "var", "fileName", "=", "sourceMapFileName", "||", "load", ".", "map", "&&", "load", ".", "map", "...
Get the ast for a load or create one if it doesn't exist.
[ "Get", "the", "ast", "for", "a", "load", "or", "create", "one", "if", "it", "doesn", "t", "exist", "." ]
307c7566976d08e0f637a600115cd7e7b67cc9d7
https://github.com/stealjs/transpile/blob/307c7566976d08e0f637a600115cd7e7b67cc9d7/lib/get_ast.js#L9-L26
train
stealjs/transpile
lib/cjs_amd.js
visitRequireArgument
function visitRequireArgument(ast, cb) { types.visit(ast, { visitCallExpression: function(path) { if (this.isRequireExpression(path.node)) { var arg = path.getValueProperty("arguments")[0]; if (n.Literal.check(arg)) { cb(arg); } } this.traverse(path); }, isRequireExpression(node) { ...
javascript
function visitRequireArgument(ast, cb) { types.visit(ast, { visitCallExpression: function(path) { if (this.isRequireExpression(path.node)) { var arg = path.getValueProperty("arguments")[0]; if (n.Literal.check(arg)) { cb(arg); } } this.traverse(path); }, isRequireExpression(node) { ...
[ "function", "visitRequireArgument", "(", "ast", ",", "cb", ")", "{", "types", ".", "visit", "(", "ast", ",", "{", "visitCallExpression", ":", "function", "(", "path", ")", "{", "if", "(", "this", ".", "isRequireExpression", "(", "path", ".", "node", ")",...
Given an ast, calls the visitor with the first argument of each `require` call @param {Object} ast - The ast to walk @param {Function} cb - The visitor function called on each match
[ "Given", "an", "ast", "calls", "the", "visitor", "with", "the", "first", "argument", "of", "each", "require", "call" ]
307c7566976d08e0f637a600115cd7e7b67cc9d7
https://github.com/stealjs/transpile/blob/307c7566976d08e0f637a600115cd7e7b67cc9d7/lib/cjs_amd.js#L46-L64
train
stealjs/transpile
lib/cjs_amd.js
collectDependenciesIds
function collectDependenciesIds(ast) { var ids = []; visitRequireArgument(ast, function(argument) { ids.push(argument.value); }); return ids; }
javascript
function collectDependenciesIds(ast) { var ids = []; visitRequireArgument(ast, function(argument) { ids.push(argument.value); }); return ids; }
[ "function", "collectDependenciesIds", "(", "ast", ")", "{", "var", "ids", "=", "[", "]", ";", "visitRequireArgument", "(", "ast", ",", "function", "(", "argument", ")", "{", "ids", ".", "push", "(", "argument", ".", "value", ")", ";", "}", ")", ";", ...
Given an AST, returns the module identifiers passed to `require` calls @param {Object} ast - The ast to walk @return {Array.<String>} The module identifiers
[ "Given", "an", "AST", "returns", "the", "module", "identifiers", "passed", "to", "require", "calls" ]
307c7566976d08e0f637a600115cd7e7b67cc9d7
https://github.com/stealjs/transpile/blob/307c7566976d08e0f637a600115cd7e7b67cc9d7/lib/cjs_amd.js#L88-L96
train
stealjs/transpile
main.js
endsWith
function endsWith(source, dest, path) { return ( path[path.length - 2] === source && path[path.length - 1] === dest ); }
javascript
function endsWith(source, dest, path) { return ( path[path.length - 2] === source && path[path.length - 1] === dest ); }
[ "function", "endsWith", "(", "source", ",", "dest", ",", "path", ")", "{", "return", "(", "path", "[", "path", ".", "length", "-", "2", "]", "===", "source", "&&", "path", "[", "path", ".", "length", "-", "1", "]", "===", "dest", ")", ";", "}" ]
Whether the last step of the transform is from "source" to "dest" @param {string} source - The source code format @param {string} dest - The destination format @param {Array.<string>} path - Path of format transformations @return {Boolean} true if "source" -> "dest" is the last step
[ "Whether", "the", "last", "step", "of", "the", "transform", "is", "from", "source", "to", "dest" ]
307c7566976d08e0f637a600115cd7e7b67cc9d7
https://github.com/stealjs/transpile/blob/307c7566976d08e0f637a600115cd7e7b67cc9d7/main.js#L43-L48
train
stealjs/transpile
main.js
function(from, to) { var path; bfs(from || "es6", formatsTransformsGraph, function(cur) { if (cur.node === to) { path = cur.path; return false; } }); return path; }
javascript
function(from, to) { var path; bfs(from || "es6", formatsTransformsGraph, function(cur) { if (cur.node === to) { path = cur.path; return false; } }); return path; }
[ "function", "(", "from", ",", "to", ")", "{", "var", "path", ";", "bfs", "(", "from", "||", "\"es6\"", ",", "formatsTransformsGraph", ",", "function", "(", "cur", ")", "{", "if", "(", "cur", ".", "node", "===", "to", ")", "{", "path", "=", "cur", ...
Whether it's possible to transform the source format to the dest format @param {string} from The format of the source, e.g: "es6" @parem {string} to the format of the output code, e.g: "amd" @return {?Array} The "path" of formats needed to transform from the source code to the dest format
[ "Whether", "it", "s", "possible", "to", "transform", "the", "source", "format", "to", "the", "dest", "format" ]
307c7566976d08e0f637a600115cd7e7b67cc9d7
https://github.com/stealjs/transpile/blob/307c7566976d08e0f637a600115cd7e7b67cc9d7/main.js#L105-L114
train
stealjs/transpile
lib/amd/slim.js
hasNestedDefine
function hasNestedDefine(ast) { var result = false; types.visit(ast, { visitCallExpression: function(path) { if (this.isDefineExpression(path)) { result = true; this.abort(); } this.traverse(path); }, // whether a non top level `define(` is call in the AST isDefineExpression: function(path...
javascript
function hasNestedDefine(ast) { var result = false; types.visit(ast, { visitCallExpression: function(path) { if (this.isDefineExpression(path)) { result = true; this.abort(); } this.traverse(path); }, // whether a non top level `define(` is call in the AST isDefineExpression: function(path...
[ "function", "hasNestedDefine", "(", "ast", ")", "{", "var", "result", "=", "false", ";", "types", ".", "visit", "(", "ast", ",", "{", "visitCallExpression", ":", "function", "(", "path", ")", "{", "if", "(", "this", ".", "isDefineExpression", "(", "path"...
Whether there is a non top level `define` function call in the AST @param {Object} ast - The AST to be checked @return {boolean}
[ "Whether", "there", "is", "a", "non", "top", "level", "define", "function", "call", "in", "the", "AST" ]
307c7566976d08e0f637a600115cd7e7b67cc9d7
https://github.com/stealjs/transpile/blob/307c7566976d08e0f637a600115cd7e7b67cc9d7/lib/amd/slim.js#L45-L69
train
stealjs/transpile
lib/amd/slim.js
function(path) { return ( n.Identifier.check(path.node.callee) && path.node.callee.name === "define" && !n.Program.check(path.parent.parent.node) ); }
javascript
function(path) { return ( n.Identifier.check(path.node.callee) && path.node.callee.name === "define" && !n.Program.check(path.parent.parent.node) ); }
[ "function", "(", "path", ")", "{", "return", "(", "n", ".", "Identifier", ".", "check", "(", "path", ".", "node", ".", "callee", ")", "&&", "path", ".", "node", ".", "callee", ".", "name", "===", "\"define\"", "&&", "!", "n", ".", "Program", ".", ...
whether a non top level `define(` is call in the AST
[ "whether", "a", "non", "top", "level", "define", "(", "is", "call", "in", "the", "AST" ]
307c7566976d08e0f637a600115cd7e7b67cc9d7
https://github.com/stealjs/transpile/blob/307c7566976d08e0f637a600115cd7e7b67cc9d7/lib/amd/slim.js#L59-L65
train
stealjs/transpile
lib/amd/slim.js
hasDefineAmdReference
function hasDefineAmdReference(ast) { var result = false; types.visit(ast, { visitMemberExpression: function(path) { if (this.isDefineAmd(path.node)) { result = true; this.abort(); } this.traverse(path); }, isDefineAmd: function(node) { return ( n.Identifier.check(node.object) && ...
javascript
function hasDefineAmdReference(ast) { var result = false; types.visit(ast, { visitMemberExpression: function(path) { if (this.isDefineAmd(path.node)) { result = true; this.abort(); } this.traverse(path); }, isDefineAmd: function(node) { return ( n.Identifier.check(node.object) && ...
[ "function", "hasDefineAmdReference", "(", "ast", ")", "{", "var", "result", "=", "false", ";", "types", ".", "visit", "(", "ast", ",", "{", "visitMemberExpression", ":", "function", "(", "path", ")", "{", "if", "(", "this", ".", "isDefineAmd", "(", "path...
Whether there is a `define.amd` member expression on the AST @param {Object} ast - The AST to be checked @return {boolean}
[ "Whether", "there", "is", "a", "define", ".", "amd", "member", "expression", "on", "the", "AST" ]
307c7566976d08e0f637a600115cd7e7b67cc9d7
https://github.com/stealjs/transpile/blob/307c7566976d08e0f637a600115cd7e7b67cc9d7/lib/amd/slim.js#L76-L100
train
stealjs/transpile
lib/amd/slim.js
function(path) { return ( this.isDefineExpression(path.node) && n.Program.check(path.parent.parent.node) && n.ExpressionStatement.check(path.parent.node) ); }
javascript
function(path) { return ( this.isDefineExpression(path.node) && n.Program.check(path.parent.parent.node) && n.ExpressionStatement.check(path.parent.node) ); }
[ "function", "(", "path", ")", "{", "return", "(", "this", ".", "isDefineExpression", "(", "path", ".", "node", ")", "&&", "n", ".", "Program", ".", "check", "(", "path", ".", "parent", ".", "parent", ".", "node", ")", "&&", "n", ".", "ExpressionState...
checks if `define` is invoked at the top-level.
[ "checks", "if", "define", "is", "invoked", "at", "the", "top", "-", "level", "." ]
307c7566976d08e0f637a600115cd7e7b67cc9d7
https://github.com/stealjs/transpile/blob/307c7566976d08e0f637a600115cd7e7b67cc9d7/lib/amd/slim.js#L137-L143
train
stealjs/transpile
lib/amd/slim.js
function(args) { var result = { id: null, factory: null, dependencies: [] }; switch (args.length) { // define(factory); case 1: result.factory = getFactory(args[0]); break; // define(id || dependencies, factory); case 2: if (this.isNamed(args)) { assign(result, { id: ...
javascript
function(args) { var result = { id: null, factory: null, dependencies: [] }; switch (args.length) { // define(factory); case 1: result.factory = getFactory(args[0]); break; // define(id || dependencies, factory); case 2: if (this.isNamed(args)) { assign(result, { id: ...
[ "function", "(", "args", ")", "{", "var", "result", "=", "{", "id", ":", "null", ",", "factory", ":", "null", ",", "dependencies", ":", "[", "]", "}", ";", "switch", "(", "args", ".", "length", ")", "{", "// define(factory);", "case", "1", ":", "re...
The AMD define arguments AST nodes as an object @typedef {Object} DefineArguments @property {?string} id - The module if of the module being defined @property {Array.<string>} dependencies - Array of modules ids dependencies @property {!Function} factory - Module's factory function @property {boolean} isCjsWrapper - Wh...
[ "The", "AMD", "define", "arguments", "AST", "nodes", "as", "an", "object" ]
307c7566976d08e0f637a600115cd7e7b67cc9d7
https://github.com/stealjs/transpile/blob/307c7566976d08e0f637a600115cd7e7b67cc9d7/lib/amd/slim.js#L203-L248
train
stealjs/transpile
lib/amd/slim.js
getFactory
function getFactory(arg) { return n.ObjectExpression.check(arg) ? slimBuilder.makeFactoryFromObject(arg) : arg; }
javascript
function getFactory(arg) { return n.ObjectExpression.check(arg) ? slimBuilder.makeFactoryFromObject(arg) : arg; }
[ "function", "getFactory", "(", "arg", ")", "{", "return", "n", ".", "ObjectExpression", ".", "check", "(", "arg", ")", "?", "slimBuilder", ".", "makeFactoryFromObject", "(", "arg", ")", ":", "arg", ";", "}" ]
Normalizes the factory function if the object shorthand was used @param {Object} arg - The AST node of the argument where the "factory" function should be found. @return {Object} The AST node of the factory function.
[ "Normalizes", "the", "factory", "function", "if", "the", "object", "shorthand", "was", "used" ]
307c7566976d08e0f637a600115cd7e7b67cc9d7
https://github.com/stealjs/transpile/blob/307c7566976d08e0f637a600115cd7e7b67cc9d7/lib/amd/slim.js#L260-L264
train
chaijs/chai-json-schema
index.js
valueStrim
function valueStrim(value, cutoff) { var strimLimit = typeof cutoff === 'undefined' ? 60 : cutoff; var t = typeof value; if (t === 'function') { return '[function]'; } if (t === 'object') { value = JSON.stringify(value); if (value.length > strimLimi...
javascript
function valueStrim(value, cutoff) { var strimLimit = typeof cutoff === 'undefined' ? 60 : cutoff; var t = typeof value; if (t === 'function') { return '[function]'; } if (t === 'object') { value = JSON.stringify(value); if (value.length > strimLimi...
[ "function", "valueStrim", "(", "value", ",", "cutoff", ")", "{", "var", "strimLimit", "=", "typeof", "cutoff", "===", "'undefined'", "?", "60", ":", "cutoff", ";", "var", "t", "=", "typeof", "value", ";", "if", "(", "t", "===", "'function'", ")", "{", ...
make a compact debug string from any object
[ "make", "a", "compact", "debug", "string", "from", "any", "object" ]
82939b7663f0e741813ffb85479a1e1c2923a57c
https://github.com/chaijs/chai-json-schema/blob/82939b7663f0e741813ffb85479a1e1c2923a57c/index.js#L50-L71
train
chaijs/chai-json-schema
index.js
function (error, data, schema, indent) { var schemaValue; var dataValue; var schemaLabel; // assemble error string var ret = ''; ret += '\n' + indent + error.message; schemaLabel = extractSchemaLabel(schema, 60); if (schemaLabel) { ret += '\n' ...
javascript
function (error, data, schema, indent) { var schemaValue; var dataValue; var schemaLabel; // assemble error string var ret = ''; ret += '\n' + indent + error.message; schemaLabel = extractSchemaLabel(schema, 60); if (schemaLabel) { ret += '\n' ...
[ "function", "(", "error", ",", "data", ",", "schema", ",", "indent", ")", "{", "var", "schemaValue", ";", "var", "dataValue", ";", "var", "schemaLabel", ";", "// assemble error string", "var", "ret", "=", "''", ";", "ret", "+=", "'\\n'", "+", "indent", "...
print validation errors
[ "print", "validation", "errors" ]
82939b7663f0e741813ffb85479a1e1c2923a57c
https://github.com/chaijs/chai-json-schema/blob/82939b7663f0e741813ffb85479a1e1c2923a57c/index.js#L92-L122
train
yusinto/ld-redux
lib/init.js
initFlags
function initFlags(flags, dispatch) { var flagValues = { isLDReady: false }; for (var flag in flags) { var camelCasedKey = (0, _lodash2.default)(flag); flagValues[camelCasedKey] = flags[flag]; } dispatch((0, _actions.setFlags)(flagValues)); }
javascript
function initFlags(flags, dispatch) { var flagValues = { isLDReady: false }; for (var flag in flags) { var camelCasedKey = (0, _lodash2.default)(flag); flagValues[camelCasedKey] = flags[flag]; } dispatch((0, _actions.setFlags)(flagValues)); }
[ "function", "initFlags", "(", "flags", ",", "dispatch", ")", "{", "var", "flagValues", "=", "{", "isLDReady", ":", "false", "}", ";", "for", "(", "var", "flag", "in", "flags", ")", "{", "var", "camelCasedKey", "=", "(", "0", ",", "_lodash2", ".", "de...
initialise flags with default values in ld redux store
[ "initialise", "flags", "with", "default", "values", "in", "ld", "redux", "store" ]
5097b18812fb1cf10268de5d5d58ca4828b187d2
https://github.com/yusinto/ld-redux/blob/5097b18812fb1cf10268de5d5d58ca4828b187d2/lib/init.js#L34-L41
train
yusinto/ld-redux
lib/init.js
setFlags
function setFlags(flags, dispatch) { var flagValues = { isLDReady: true }; for (var flag in flags) { var camelCasedKey = (0, _lodash2.default)(flag); flagValues[camelCasedKey] = ldClient.variation(flag, flags[flag]); } dispatch((0, _actions.setFlags)(flagValues)); }
javascript
function setFlags(flags, dispatch) { var flagValues = { isLDReady: true }; for (var flag in flags) { var camelCasedKey = (0, _lodash2.default)(flag); flagValues[camelCasedKey] = ldClient.variation(flag, flags[flag]); } dispatch((0, _actions.setFlags)(flagValues)); }
[ "function", "setFlags", "(", "flags", ",", "dispatch", ")", "{", "var", "flagValues", "=", "{", "isLDReady", ":", "true", "}", ";", "for", "(", "var", "flag", "in", "flags", ")", "{", "var", "camelCasedKey", "=", "(", "0", ",", "_lodash2", ".", "defa...
set flags with real values from ld server
[ "set", "flags", "with", "real", "values", "from", "ld", "server" ]
5097b18812fb1cf10268de5d5d58ca4828b187d2
https://github.com/yusinto/ld-redux/blob/5097b18812fb1cf10268de5d5d58ca4828b187d2/lib/init.js#L44-L51
train
fresheneesz/mongo-parse
mapValues.js
obj
function obj(/*key,value, key,value ...*/) { var result = {} for(var n=0; n<arguments.length; n+=2) { result[arguments[n]] = arguments[n+1] } return result }
javascript
function obj(/*key,value, key,value ...*/) { var result = {} for(var n=0; n<arguments.length; n+=2) { result[arguments[n]] = arguments[n+1] } return result }
[ "function", "obj", "(", "/*key,value, key,value ...*/", ")", "{", "var", "result", "=", "{", "}", "for", "(", "var", "n", "=", "0", ";", "n", "<", "arguments", ".", "length", ";", "n", "+=", "2", ")", "{", "result", "[", "arguments", "[", "n", "]",...
builds an object immediate where keys can be expressions
[ "builds", "an", "object", "immediate", "where", "keys", "can", "be", "expressions" ]
c11bb6ac860ad1b9b30ccd1936ab0ca28d4e5d6b
https://github.com/fresheneesz/mongo-parse/blob/c11bb6ac860ad1b9b30ccd1936ab0ca28d4e5d6b/mapValues.js#L79-L85
train
fresheneesz/mongo-parse
mapValues.js
addOperator
function addOperator(obj, field, operator, operand) { if(obj[field] === undefined) { obj[field] = {} } obj[field][operator] = operand }
javascript
function addOperator(obj, field, operator, operand) { if(obj[field] === undefined) { obj[field] = {} } obj[field][operator] = operand }
[ "function", "addOperator", "(", "obj", ",", "field", ",", "operator", ",", "operand", ")", "{", "if", "(", "obj", "[", "field", "]", "===", "undefined", ")", "{", "obj", "[", "field", "]", "=", "{", "}", "}", "obj", "[", "field", "]", "[", "opera...
adds an operator to a field, handling the case where there is already another operator there
[ "adds", "an", "operator", "to", "a", "field", "handling", "the", "case", "where", "there", "is", "already", "another", "operator", "there" ]
c11bb6ac860ad1b9b30ccd1936ab0ca28d4e5d6b
https://github.com/fresheneesz/mongo-parse/blob/c11bb6ac860ad1b9b30ccd1936ab0ca28d4e5d6b/mapValues.js#L88-L94
train
fresheneesz/mongo-parse
matches.js
mongoEqual
function mongoEqual(documentValue,queryOperand) { if(documentValue instanceof Array) { if(!(queryOperand instanceof Array)) return false if(documentValue.length !== queryOperand.length) { return false } else { return documentValue.reduce(function(previousV...
javascript
function mongoEqual(documentValue,queryOperand) { if(documentValue instanceof Array) { if(!(queryOperand instanceof Array)) return false if(documentValue.length !== queryOperand.length) { return false } else { return documentValue.reduce(function(previousV...
[ "function", "mongoEqual", "(", "documentValue", ",", "queryOperand", ")", "{", "if", "(", "documentValue", "instanceof", "Array", ")", "{", "if", "(", "!", "(", "queryOperand", "instanceof", "Array", ")", ")", "return", "false", "if", "(", "documentValue", "...
matches any value, with mongo's special brand of very strict object equality and weird null matching
[ "matches", "any", "value", "with", "mongo", "s", "special", "brand", "of", "very", "strict", "object", "equality", "and", "weird", "null", "matching" ]
c11bb6ac860ad1b9b30ccd1936ab0ca28d4e5d6b
https://github.com/fresheneesz/mongo-parse/blob/c11bb6ac860ad1b9b30ccd1936ab0ca28d4e5d6b/matches.js#L208-L250
train
fresheneesz/mongo-parse
mongoParse.js
sortCompare
function sortCompare(a,b,sortProperty) { var aVal = DotNotationPointers(a, sortProperty)[0].val // todo: figure out what mongo does with multiple matching sort properties var bVal = DotNotationPointers(b, sortProperty)[0].val if(aVal > bVal) { return 1 } else if(aVal < bVal) { return -1...
javascript
function sortCompare(a,b,sortProperty) { var aVal = DotNotationPointers(a, sortProperty)[0].val // todo: figure out what mongo does with multiple matching sort properties var bVal = DotNotationPointers(b, sortProperty)[0].val if(aVal > bVal) { return 1 } else if(aVal < bVal) { return -1...
[ "function", "sortCompare", "(", "a", ",", "b", ",", "sortProperty", ")", "{", "var", "aVal", "=", "DotNotationPointers", "(", "a", ",", "sortProperty", ")", "[", "0", "]", ".", "val", "// todo: figure out what mongo does with multiple matching sort properties", "var...
compares two documents by a single sort property
[ "compares", "two", "documents", "by", "a", "single", "sort", "property" ]
c11bb6ac860ad1b9b30ccd1936ab0ca28d4e5d6b
https://github.com/fresheneesz/mongo-parse/blob/c11bb6ac860ad1b9b30ccd1936ab0ca28d4e5d6b/mongoParse.js#L56-L67
train
fresheneesz/mongo-parse
mongoParse.js
parseFieldOperator
function parseFieldOperator(field, operator, operand) { if(operator === '$elemMatch') { var elemMatchInfo = parseElemMatch(operand) var innerParts = elemMatchInfo.parts var implicitField = elemMatchInfo.implicitField } else if(operator === '$not') { var innerParts = parseNot(fiel...
javascript
function parseFieldOperator(field, operator, operand) { if(operator === '$elemMatch') { var elemMatchInfo = parseElemMatch(operand) var innerParts = elemMatchInfo.parts var implicitField = elemMatchInfo.implicitField } else if(operator === '$not') { var innerParts = parseNot(fiel...
[ "function", "parseFieldOperator", "(", "field", ",", "operator", ",", "operand", ")", "{", "if", "(", "operator", "===", "'$elemMatch'", ")", "{", "var", "elemMatchInfo", "=", "parseElemMatch", "(", "operand", ")", "var", "innerParts", "=", "elemMatchInfo", "....
returns a Part object
[ "returns", "a", "Part", "object" ]
c11bb6ac860ad1b9b30ccd1936ab0ca28d4e5d6b
https://github.com/fresheneesz/mongo-parse/blob/c11bb6ac860ad1b9b30ccd1936ab0ca28d4e5d6b/mongoParse.js#L256-L267
train
PSeitz/yamaha-nodejs
simpleCommands.js
addBasicInfoWrapper
function addBasicInfoWrapper(basicInfo) { Yamaha.prototype[basicInfo] = function(zone) { return this.getBasicInfo(zone).then(function(result) { return result[basicInfo](); }); }; }
javascript
function addBasicInfoWrapper(basicInfo) { Yamaha.prototype[basicInfo] = function(zone) { return this.getBasicInfo(zone).then(function(result) { return result[basicInfo](); }); }; }
[ "function", "addBasicInfoWrapper", "(", "basicInfo", ")", "{", "Yamaha", ".", "prototype", "[", "basicInfo", "]", "=", "function", "(", "zone", ")", "{", "return", "this", ".", "getBasicInfo", "(", "zone", ")", ".", "then", "(", "function", "(", "result", ...
Add direct functions for basic info
[ "Add", "direct", "functions", "for", "basic", "info" ]
1937285ce937d6f351ccf019c97ee7910dcc6be3
https://github.com/PSeitz/yamaha-nodejs/blob/1937285ce937d6f351ccf019c97ee7910dcc6be3/simpleCommands.js#L450-L456
train
madhums/node-view-helpers
index.js
formatDate
function formatDate(date) { date = new Date(date); var monthNames = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]; return ( monthNames[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear(...
javascript
function formatDate(date) { date = new Date(date); var monthNames = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]; return ( monthNames[date.getMonth()] + ' ' + date.getDate() + ', ' + date.getFullYear(...
[ "function", "formatDate", "(", "date", ")", "{", "date", "=", "new", "Date", "(", "date", ")", ";", "var", "monthNames", "=", "[", "'Jan'", ",", "'Feb'", ",", "'Mar'", ",", "'Apr'", ",", "'May'", ",", "'June'", ",", "'July'", ",", "'Aug'", ",", "'S...
Format date helper @param {Date} date @return {String} @api private
[ "Format", "date", "helper" ]
de13d6a3ed7326104a38307eae658153e0628ecf
https://github.com/madhums/node-view-helpers/blob/de13d6a3ed7326104a38307eae658153e0628ecf/index.js#L112-L135
train
madhums/node-view-helpers
index.js
formatDatetime
function formatDatetime(date) { date = new Date(date); var hour = date.getHours(); var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes().toString() : date.getMinutes(); return formatDate(date) + ' ' + hour + ':' + minutes; }
javascript
function formatDatetime(date) { date = new Date(date); var hour = date.getHours(); var minutes = date.getMinutes() < 10 ? '0' + date.getMinutes().toString() : date.getMinutes(); return formatDate(date) + ' ' + hour + ':' + minutes; }
[ "function", "formatDatetime", "(", "date", ")", "{", "date", "=", "new", "Date", "(", "date", ")", ";", "var", "hour", "=", "date", ".", "getHours", "(", ")", ";", "var", "minutes", "=", "date", ".", "getMinutes", "(", ")", "<", "10", "?", "'0'", ...
Format date time helper @param {Date} date @return {String} @api private
[ "Format", "date", "time", "helper" ]
de13d6a3ed7326104a38307eae658153e0628ecf
https://github.com/madhums/node-view-helpers/blob/de13d6a3ed7326104a38307eae658153e0628ecf/index.js#L145-L154
train
primus/forwarded-for
index.js
Forwarded
function Forwarded(ip, port, secured) { this.ip = ip || '127.0.0.1'; this.secure = !!secured; this.port = +port || 0; }
javascript
function Forwarded(ip, port, secured) { this.ip = ip || '127.0.0.1'; this.secure = !!secured; this.port = +port || 0; }
[ "function", "Forwarded", "(", "ip", ",", "port", ",", "secured", ")", "{", "this", ".", "ip", "=", "ip", "||", "'127.0.0.1'", ";", "this", ".", "secure", "=", "!", "!", "secured", ";", "this", ".", "port", "=", "+", "port", "||", "0", ";", "}" ]
Forwarded instance. @constructor @param {String} ip The IP address. @param {Number} port The port number. @param {Boolean} secured The connection was secured. @api private
[ "Forwarded", "instance", "." ]
108afd0458c65b304907f6398bcff48ce83e7761
https://github.com/primus/forwarded-for/blob/108afd0458c65b304907f6398bcff48ce83e7761/index.js#L14-L18
train
primus/forwarded-for
index.js
forwarded
function forwarded(headers, whitelist) { var ports, port, proto, ips, ip, length = proxies.length, i = 0; for (; i < length; i++) { if (!(proxies[i].ip in headers)) continue; ports = (headers[proxies[i].port] || '').split(','); ips = (headers[proxies[i].ip] || '').match(pattern); proto = (headers[...
javascript
function forwarded(headers, whitelist) { var ports, port, proto, ips, ip, length = proxies.length, i = 0; for (; i < length; i++) { if (!(proxies[i].ip in headers)) continue; ports = (headers[proxies[i].port] || '').split(','); ips = (headers[proxies[i].ip] || '').match(pattern); proto = (headers[...
[ "function", "forwarded", "(", "headers", ",", "whitelist", ")", "{", "var", "ports", ",", "port", ",", "proto", ",", "ips", ",", "ip", ",", "length", "=", "proxies", ".", "length", ",", "i", "=", "0", ";", "for", "(", ";", "i", "<", "length", ";"...
Search the headers for a possible match against a known proxy header. @param {Object} headers The received HTTP headers. @param {Array} whitelist White list of proxies that should be checked. @returns {Forwarded|Undefined} A Forwarded address object or nothing. @api private
[ "Search", "the", "headers", "for", "a", "possible", "match", "against", "a", "known", "proxy", "header", "." ]
108afd0458c65b304907f6398bcff48ce83e7761
https://github.com/primus/forwarded-for/blob/108afd0458c65b304907f6398bcff48ce83e7761/index.js#L67-L118
train
primus/forwarded-for
index.js
parse
function parse(obj, headers, whitelist) { var proxied = forwarded(headers || {}, whitelist) , connection = obj.connection , socket = connection ? connection.socket : obj.socket; // // We should always be testing for HTTP headers as remoteAddress would point // to proxies. // if (proxied...
javascript
function parse(obj, headers, whitelist) { var proxied = forwarded(headers || {}, whitelist) , connection = obj.connection , socket = connection ? connection.socket : obj.socket; // // We should always be testing for HTTP headers as remoteAddress would point // to proxies. // if (proxied...
[ "function", "parse", "(", "obj", ",", "headers", ",", "whitelist", ")", "{", "var", "proxied", "=", "forwarded", "(", "headers", "||", "{", "}", ",", "whitelist", ")", ",", "connection", "=", "obj", ".", "connection", ",", "socket", "=", "connection", ...
Parse out the address information.. @param {Object} obj A socket like object that could contain a `remoteAddress`. @param {Object} headers The received HTTP headers. @param {Array} whitelist White list @returns {Forwarded} A Forwarded address object. @api private
[ "Parse", "out", "the", "address", "information", ".." ]
108afd0458c65b304907f6398bcff48ce83e7761
https://github.com/primus/forwarded-for/blob/108afd0458c65b304907f6398bcff48ce83e7761/index.js#L129-L179
train
Pearson-Higher-Ed/elements-sdk
src/components/PhoneNumber/components/Input.js
parse_partial_number
function parse_partial_number(value, country_code, metadata) { // "As you type" formatter const formatter = new as_you_type(country_code, metadata) // Input partially entered phone number formatter.input('+' + getPhoneCode(country_code) + value) // Return the parsed partial phone number // (has `.national_numbe...
javascript
function parse_partial_number(value, country_code, metadata) { // "As you type" formatter const formatter = new as_you_type(country_code, metadata) // Input partially entered phone number formatter.input('+' + getPhoneCode(country_code) + value) // Return the parsed partial phone number // (has `.national_numbe...
[ "function", "parse_partial_number", "(", "value", ",", "country_code", ",", "metadata", ")", "{", "// \"As you type\" formatter", "const", "formatter", "=", "new", "as_you_type", "(", "country_code", ",", "metadata", ")", "// Input partially entered phone number", "format...
Parses a partially entered phone number and returns the national number so far. Not using `libphonenumber-js`'s `parse` function here because `parse` only works when the number is fully entered, and this one is for partially entered number.
[ "Parses", "a", "partially", "entered", "phone", "number", "and", "returns", "the", "national", "number", "so", "far", ".", "Not", "using", "libphonenumber", "-", "js", "s", "parse", "function", "here", "because", "parse", "only", "works", "when", "the", "num...
3d2fbda6dc110ff244b141c37a5171ec2fb222c3
https://github.com/Pearson-Higher-Ed/elements-sdk/blob/3d2fbda6dc110ff244b141c37a5171ec2fb222c3/src/components/PhoneNumber/components/Input.js#L1136-L1147
train
Pearson-Higher-Ed/elements-sdk
src/components/PhoneNumber/components/Input.js
e164
function e164(value, country_code, metadata) { if (!value) { return undefined } // If the phone number is being input in an international format if (value[0] === '+') { // If it's just the `+` sign if (value.length === 1) { return undefined } // If there are some digits, the `value` is returned a...
javascript
function e164(value, country_code, metadata) { if (!value) { return undefined } // If the phone number is being input in an international format if (value[0] === '+') { // If it's just the `+` sign if (value.length === 1) { return undefined } // If there are some digits, the `value` is returned a...
[ "function", "e164", "(", "value", ",", "country_code", ",", "metadata", ")", "{", "if", "(", "!", "value", ")", "{", "return", "undefined", "}", "// If the phone number is being input in an international format", "if", "(", "value", "[", "0", "]", "===", "'+'", ...
Converts `value` to E.164 phone number format
[ "Converts", "value", "to", "E", ".", "164", "phone", "number", "format" ]
3d2fbda6dc110ff244b141c37a5171ec2fb222c3
https://github.com/Pearson-Higher-Ed/elements-sdk/blob/3d2fbda6dc110ff244b141c37a5171ec2fb222c3/src/components/PhoneNumber/components/Input.js#L1150-L1187
train
Pearson-Higher-Ed/elements-sdk
src/components/PhoneNumber/components/Input.js
get_country_option_icon
function get_country_option_icon(countryCode, { flags, flagsPath, flagComponent }) { if (flags === false) { return undefined } if (flags && flags[countryCode]) { return flags[countryCode] } return React.createElement(flagComponent, { countryCode, flagsPath }) }
javascript
function get_country_option_icon(countryCode, { flags, flagsPath, flagComponent }) { if (flags === false) { return undefined } if (flags && flags[countryCode]) { return flags[countryCode] } return React.createElement(flagComponent, { countryCode, flagsPath }) }
[ "function", "get_country_option_icon", "(", "countryCode", ",", "{", "flags", ",", "flagsPath", ",", "flagComponent", "}", ")", "{", "if", "(", "flags", "===", "false", ")", "{", "return", "undefined", "}", "if", "(", "flags", "&&", "flags", "[", "countryC...
Gets country flag element by country code
[ "Gets", "country", "flag", "element", "by", "country", "code" ]
3d2fbda6dc110ff244b141c37a5171ec2fb222c3
https://github.com/Pearson-Higher-Ed/elements-sdk/blob/3d2fbda6dc110ff244b141c37a5171ec2fb222c3/src/components/PhoneNumber/components/Input.js#L1190-L1203
train
Pearson-Higher-Ed/elements-sdk
src/components/PhoneNumber/components/Input.js
should_add_international_option
function should_add_international_option(properties) { const { countries, international } = properties // If this behaviour is explicitly set, then do as it says. if (international !== undefined) { return international } // If `countries` is empty, // then only "International" option is available, so add it....
javascript
function should_add_international_option(properties) { const { countries, international } = properties // If this behaviour is explicitly set, then do as it says. if (international !== undefined) { return international } // If `countries` is empty, // then only "International" option is available, so add it....
[ "function", "should_add_international_option", "(", "properties", ")", "{", "const", "{", "countries", ",", "international", "}", "=", "properties", "// If this behaviour is explicitly set, then do as it says.", "if", "(", "international", "!==", "undefined", ")", "{", "r...
Whether to add the "International" option to the list of countries
[ "Whether", "to", "add", "the", "International", "option", "to", "the", "list", "of", "countries" ]
3d2fbda6dc110ff244b141c37a5171ec2fb222c3
https://github.com/Pearson-Higher-Ed/elements-sdk/blob/3d2fbda6dc110ff244b141c37a5171ec2fb222c3/src/components/PhoneNumber/components/Input.js#L1206-L1233
train
Pearson-Higher-Ed/elements-sdk
src/components/PhoneNumber/components/Input.js
could_phone_number_belong_to_country
function could_phone_number_belong_to_country(phone_number, country_code, metadata) { // Strip the leading `+` const phone_number_digits = phone_number.slice('+'.length) for (const country_phone_code of Object.keys(metadata.country_phone_code_to_countries)) { const possible_country_phone_code = phone_number_digi...
javascript
function could_phone_number_belong_to_country(phone_number, country_code, metadata) { // Strip the leading `+` const phone_number_digits = phone_number.slice('+'.length) for (const country_phone_code of Object.keys(metadata.country_phone_code_to_countries)) { const possible_country_phone_code = phone_number_digi...
[ "function", "could_phone_number_belong_to_country", "(", "phone_number", ",", "country_code", ",", "metadata", ")", "{", "// Strip the leading `+`", "const", "phone_number_digits", "=", "phone_number", ".", "slice", "(", "'+'", ".", "length", ")", "for", "(", "const",...
Is it possible that the partially entered phone number belongs to the given country
[ "Is", "it", "possible", "that", "the", "partially", "entered", "phone", "number", "belongs", "to", "the", "given", "country" ]
3d2fbda6dc110ff244b141c37a5171ec2fb222c3
https://github.com/Pearson-Higher-Ed/elements-sdk/blob/3d2fbda6dc110ff244b141c37a5171ec2fb222c3/src/components/PhoneNumber/components/Input.js#L1236-L1254
train
Pearson-Higher-Ed/elements-sdk
src/components/PhoneNumber/components/Input.js
normalize_country_code
function normalize_country_code(country, dictionary) { // Normalize `country` if it's an empty string if (country === '') { country = undefined } // No country is selected ("International") if (country === undefined || country === null) { return country } // Check that `country` code exists if (dictiona...
javascript
function normalize_country_code(country, dictionary) { // Normalize `country` if it's an empty string if (country === '') { country = undefined } // No country is selected ("International") if (country === undefined || country === null) { return country } // Check that `country` code exists if (dictiona...
[ "function", "normalize_country_code", "(", "country", ",", "dictionary", ")", "{", "// Normalize `country` if it's an empty string", "if", "(", "country", "===", "''", ")", "{", "country", "=", "undefined", "}", "// No country is selected (\"International\")", "if", "(", ...
Validates country code
[ "Validates", "country", "code" ]
3d2fbda6dc110ff244b141c37a5171ec2fb222c3
https://github.com/Pearson-Higher-Ed/elements-sdk/blob/3d2fbda6dc110ff244b141c37a5171ec2fb222c3/src/components/PhoneNumber/components/Input.js#L1277-L1298
train
jarrodconnolly/sequelize-slugify
lib/sequelize-slugify.js
function (instance, sourceFields) { var slugParts = sourceFields.map(function (slugSourceField) { return instance[slugSourceField]; }); var options = (slugOptions && slugOptions.slugOptions) || { lower: true}; return slug(slugParts.join(' '), options); }
javascript
function (instance, sourceFields) { var slugParts = sourceFields.map(function (slugSourceField) { return instance[slugSourceField]; }); var options = (slugOptions && slugOptions.slugOptions) || { lower: true}; return slug(slugParts.join(' '), options); }
[ "function", "(", "instance", ",", "sourceFields", ")", "{", "var", "slugParts", "=", "sourceFields", ".", "map", "(", "function", "(", "slugSourceField", ")", "{", "return", "instance", "[", "slugSourceField", "]", ";", "}", ")", ";", "var", "options", "="...
takes the array of source fields from the model instance and builds the slug
[ "takes", "the", "array", "of", "source", "fields", "from", "the", "model", "instance", "and", "builds", "the", "slug" ]
1138e1bbca04cd7a9e7f7caca4ef18dfc512b041
https://github.com/jarrodconnolly/sequelize-slugify/blob/1138e1bbca04cd7a9e7f7caca4ef18dfc512b041/lib/sequelize-slugify.js#L17-L24
train
jarrodconnolly/sequelize-slugify
lib/sequelize-slugify.js
function (slug) { var query = { where: {} }; query.where[slugColumn] = slug; return Model.findOne(query).then(function (model) { return model === null; }); }
javascript
function (slug) { var query = { where: {} }; query.where[slugColumn] = slug; return Model.findOne(query).then(function (model) { return model === null; }); }
[ "function", "(", "slug", ")", "{", "var", "query", "=", "{", "where", ":", "{", "}", "}", ";", "query", ".", "where", "[", "slugColumn", "]", "=", "slug", ";", "return", "Model", ".", "findOne", "(", "query", ")", ".", "then", "(", "function", "(...
Checks whether or not the slug is already in use. @param slug The slug to check for uniqueness. @return True if the slug is unique, false otherwise.
[ "Checks", "whether", "or", "not", "the", "slug", "is", "already", "in", "use", "." ]
1138e1bbca04cd7a9e7f7caca4ef18dfc512b041
https://github.com/jarrodconnolly/sequelize-slugify/blob/1138e1bbca04cd7a9e7f7caca4ef18dfc512b041/lib/sequelize-slugify.js#L32-L39
train
jarrodconnolly/sequelize-slugify
lib/sequelize-slugify.js
function (instance, sourceFields, suffixFields) { return (function suffixHelper(instance, sourceFields, suffixFields, suffixCount) { if (!suffixFields || !Array.isArray(suffixFields)) { return Promise.resolve(null); } if (suffixCount > suffixFields.length) { ...
javascript
function (instance, sourceFields, suffixFields) { return (function suffixHelper(instance, sourceFields, suffixFields, suffixCount) { if (!suffixFields || !Array.isArray(suffixFields)) { return Promise.resolve(null); } if (suffixCount > suffixFields.length) { ...
[ "function", "(", "instance", ",", "sourceFields", ",", "suffixFields", ")", "{", "return", "(", "function", "suffixHelper", "(", "instance", ",", "sourceFields", ",", "suffixFields", ",", "suffixCount", ")", "{", "if", "(", "!", "suffixFields", "||", "!", "A...
Adds on additional suffixes based on the specified suffix fields. @param instance The model instance to use. @param sourceFields An array of source fields to use to generate the base slug. @param suffixFields An array of suffix fields to use to generate the additional slug suffixes. @return A promise that resolves to ...
[ "Adds", "on", "additional", "suffixes", "based", "on", "the", "specified", "suffix", "fields", "." ]
1138e1bbca04cd7a9e7f7caca4ef18dfc512b041
https://github.com/jarrodconnolly/sequelize-slugify/blob/1138e1bbca04cd7a9e7f7caca4ef18dfc512b041/lib/sequelize-slugify.js#L49-L69
train
cdmbase/fullstack-pro
tools/cli/helpers/util.js
renameFiles
function renameFiles(destinationPath, moduleName) { const Module = pascalize(moduleName); // change to destination directory shell.cd(destinationPath); // rename files shell.ls('-Rl', '.').forEach(entry => { if (entry.isFile()) { shell.mv(entry.name, entry.name.replace('Module'...
javascript
function renameFiles(destinationPath, moduleName) { const Module = pascalize(moduleName); // change to destination directory shell.cd(destinationPath); // rename files shell.ls('-Rl', '.').forEach(entry => { if (entry.isFile()) { shell.mv(entry.name, entry.name.replace('Module'...
[ "function", "renameFiles", "(", "destinationPath", ",", "moduleName", ")", "{", "const", "Module", "=", "pascalize", "(", "moduleName", ")", ";", "// change to destination directory", "shell", ".", "cd", "(", "destinationPath", ")", ";", "// rename files", "shell", ...
Renames the templates in the destination directory. @param destinationPath - The destination path of a new module. @param moduleName - The name of a new module.
[ "Renames", "the", "templates", "in", "the", "destination", "directory", "." ]
6068d060443f2ab7a26e72f95f5f3b66194892eb
https://github.com/cdmbase/fullstack-pro/blob/6068d060443f2ab7a26e72f95f5f3b66194892eb/tools/cli/helpers/util.js#L24-L47
train
moreartyjs/moreartyjs
src/Util.js
function (f, cont) { var result = f(); if (result && typeof result.always === 'function') { result.always(cont); } else { cont(); } }
javascript
function (f, cont) { var result = f(); if (result && typeof result.always === 'function') { result.always(cont); } else { cont(); } }
[ "function", "(", "f", ",", "cont", ")", "{", "var", "result", "=", "f", "(", ")", ";", "if", "(", "result", "&&", "typeof", "result", ".", "always", "===", "'function'", ")", "{", "result", ".", "always", "(", "cont", ")", ";", "}", "else", "{", ...
Execute function f, then function cont. If f returns a promise, cont is executed when the promise resolves. @param {Function} f function to execute first @param {Function} cont function to execute after f @memberOf Util
[ "Execute", "function", "f", "then", "function", "cont", ".", "If", "f", "returns", "a", "promise", "cont", "is", "executed", "when", "the", "promise", "resolves", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Util.js#L67-L74
train
moreartyjs/moreartyjs
src/Util.js
function (arr, pred) { for (var i = 0; i < arr.length; i++) { var value = arr[i]; if (pred(value, i, arr)) { return value; } } return null; }
javascript
function (arr, pred) { for (var i = 0; i < arr.length; i++) { var value = arr[i]; if (pred(value, i, arr)) { return value; } } return null; }
[ "function", "(", "arr", ",", "pred", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "arr", ".", "length", ";", "i", "++", ")", "{", "var", "value", "=", "arr", "[", "i", "]", ";", "if", "(", "pred", "(", "value", ",", "i", ","...
Find array element satisfying the predicate. @param {Array} arr array @param {Function} pred predicate accepting current value, index, original array @return {*} found value or null @memberOf Util
[ "Find", "array", "element", "satisfying", "the", "predicate", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Util.js#L97-L105
train
moreartyjs/moreartyjs
src/Util.js
function (path1, path2) { return path1.length === 0 ? path2 : (path2.length === 0 ? path1 : path1.concat(path2)); }
javascript
function (path1, path2) { return path1.length === 0 ? path2 : (path2.length === 0 ? path1 : path1.concat(path2)); }
[ "function", "(", "path1", ",", "path2", ")", "{", "return", "path1", ".", "length", "===", "0", "?", "path2", ":", "(", "path2", ".", "length", "===", "0", "?", "path1", ":", "path1", ".", "concat", "(", "path2", ")", ")", ";", "}" ]
Join two array paths. @param {Array} path1 array of string and numbers @param {Array} path2 array of string and numbers @returns {Array} joined path @memberOf Util
[ "Join", "two", "array", "paths", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Util.js#L176-L179
train
moreartyjs/moreartyjs
src/Util.js
function (target, firstSource) { if (target === undefined || target === null) { throw new TypeError('Cannot convert first argument to object'); } var to = Object(target); var hasPendingException = false; var pendingException; for (var i = 1; i < arguments.length; i++) { var nextSo...
javascript
function (target, firstSource) { if (target === undefined || target === null) { throw new TypeError('Cannot convert first argument to object'); } var to = Object(target); var hasPendingException = false; var pendingException; for (var i = 1; i < arguments.length; i++) { var nextSo...
[ "function", "(", "target", ",", "firstSource", ")", "{", "if", "(", "target", "===", "undefined", "||", "target", "===", "null", ")", "{", "throw", "new", "TypeError", "(", "'Cannot convert first argument to object'", ")", ";", "}", "var", "to", "=", "Object...
ES6 Object.assign. @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
[ "ES6", "Object", ".", "assign", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Util.js#L183-L217
train
moreartyjs/moreartyjs
src/util/Callback.js
function (binding, subpath, f) { var args = Util.resolveArgs( arguments, 'binding', function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, '?f' ); return function (event) { var value = event.target.value; binding.set(args.subpath, args.f ? args.f(value) : value); ...
javascript
function (binding, subpath, f) { var args = Util.resolveArgs( arguments, 'binding', function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, '?f' ); return function (event) { var value = event.target.value; binding.set(args.subpath, args.f ? args.f(value) : value); ...
[ "function", "(", "binding", ",", "subpath", ",", "f", ")", "{", "var", "args", "=", "Util", ".", "resolveArgs", "(", "arguments", ",", "'binding'", ",", "function", "(", "x", ")", "{", "return", "Util", ".", "canRepresentSubpath", "(", "x", ")", "?", ...
Create callback used to set binding value on an event. @param {Binding} binding binding @param {String|Array} [subpath] subpath as a dot-separated string or an array of strings and numbers @param {Function} [f] value transformer @returns {Function} callback @memberOf Callback
[ "Create", "callback", "used", "to", "set", "binding", "value", "on", "an", "event", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/util/Callback.js#L16-L26
train
moreartyjs/moreartyjs
src/util/Callback.js
function (binding, subpath, pred) { var args = Util.resolveArgs( arguments, 'binding', function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, '?pred' ); return function (event) { var value = event.target.value; if (!args.pred || args.pred(value)) { binding....
javascript
function (binding, subpath, pred) { var args = Util.resolveArgs( arguments, 'binding', function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, '?pred' ); return function (event) { var value = event.target.value; if (!args.pred || args.pred(value)) { binding....
[ "function", "(", "binding", ",", "subpath", ",", "pred", ")", "{", "var", "args", "=", "Util", ".", "resolveArgs", "(", "arguments", ",", "'binding'", ",", "function", "(", "x", ")", "{", "return", "Util", ".", "canRepresentSubpath", "(", "x", ")", "?"...
Create callback used to delete binding value on an event. @param {Binding} binding binding @param {String|String[]} [subpath] subpath as a dot-separated string or an array of strings and numbers @param {Function} [pred] predicate @returns {Function} callback @memberOf Callback
[ "Create", "callback", "used", "to", "delete", "binding", "value", "on", "an", "event", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/util/Callback.js#L34-L46
train
moreartyjs/moreartyjs
src/util/Callback.js
function (cb, key, shiftKey, ctrlKey) { var effectiveShiftKey = shiftKey || false; var effectiveCtrlKey = ctrlKey || false; return function (event) { var keyMatched = typeof key === 'string' ? event.key === key : Util.find(key, function (k) { return k === event.key; }); if (keyM...
javascript
function (cb, key, shiftKey, ctrlKey) { var effectiveShiftKey = shiftKey || false; var effectiveCtrlKey = ctrlKey || false; return function (event) { var keyMatched = typeof key === 'string' ? event.key === key : Util.find(key, function (k) { return k === event.key; }); if (keyM...
[ "function", "(", "cb", ",", "key", ",", "shiftKey", ",", "ctrlKey", ")", "{", "var", "effectiveShiftKey", "=", "shiftKey", "||", "false", ";", "var", "effectiveCtrlKey", "=", "ctrlKey", "||", "false", ";", "return", "function", "(", "event", ")", "{", "v...
Create callback invoked when specified key combination is pressed. @param {Function} cb callback @param {String|Array} key key @param {Boolean} [shiftKey] shift key flag @param {Boolean} [ctrlKey] ctrl key flag @returns {Function} callback @memberOf Callback
[ "Create", "callback", "invoked", "when", "specified", "key", "combination", "is", "pressed", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/util/Callback.js#L55-L67
train
moreartyjs/moreartyjs
src/History.js
function (binding) { var historyBinding = getHistoryBinding(binding); var undo = historyBinding.get('undo'); return !!undo && !undo.isEmpty(); }
javascript
function (binding) { var historyBinding = getHistoryBinding(binding); var undo = historyBinding.get('undo'); return !!undo && !undo.isEmpty(); }
[ "function", "(", "binding", ")", "{", "var", "historyBinding", "=", "getHistoryBinding", "(", "binding", ")", ";", "var", "undo", "=", "historyBinding", ".", "get", "(", "'undo'", ")", ";", "return", "!", "!", "undo", "&&", "!", "undo", ".", "isEmpty", ...
Check if history has undo information. @param {Binding} binding binding @returns {Boolean} @memberOf History
[ "Check", "if", "history", "has", "undo", "information", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/History.js#L118-L122
train
moreartyjs/moreartyjs
src/History.js
function (binding) { var historyBinding = getHistoryBinding(binding); var redo = historyBinding.get('redo'); return !!redo && !redo.isEmpty(); }
javascript
function (binding) { var historyBinding = getHistoryBinding(binding); var redo = historyBinding.get('redo'); return !!redo && !redo.isEmpty(); }
[ "function", "(", "binding", ")", "{", "var", "historyBinding", "=", "getHistoryBinding", "(", "binding", ")", ";", "var", "redo", "=", "historyBinding", ".", "get", "(", "'redo'", ")", ";", "return", "!", "!", "redo", "&&", "!", "redo", ".", "isEmpty", ...
Check if history has redo information. @param {Binding} binding binding @returns {Boolean} @memberOf History
[ "Check", "if", "history", "has", "redo", "information", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/History.js#L128-L132
train
moreartyjs/moreartyjs
src/History.js
function (binding) { var historyBinding = getHistoryBinding(binding); var listenerId = historyBinding.get('listenerId'); var undoBinding = historyBinding.sub('undo'); var redoBinding = historyBinding.sub('redo'); return revert(binding, undoBinding, redoBinding, listenerId, 'oldValue'); }
javascript
function (binding) { var historyBinding = getHistoryBinding(binding); var listenerId = historyBinding.get('listenerId'); var undoBinding = historyBinding.sub('undo'); var redoBinding = historyBinding.sub('redo'); return revert(binding, undoBinding, redoBinding, listenerId, 'oldValue'); }
[ "function", "(", "binding", ")", "{", "var", "historyBinding", "=", "getHistoryBinding", "(", "binding", ")", ";", "var", "listenerId", "=", "historyBinding", ".", "get", "(", "'listenerId'", ")", ";", "var", "undoBinding", "=", "historyBinding", ".", "sub", ...
Revert to previous state. @param {Binding} binding binding @returns {Boolean} true, if binding has undo information @memberOf History
[ "Revert", "to", "previous", "state", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/History.js#L138-L144
train
ChristianMurphy/postcss-combine-duplicated-selectors
src/index.js
normalizeAttributes
function normalizeAttributes(selector) { selector.walkAttributes((node) => { if (node.value) { // remove quotes node.value = node.value.replace(/'|\\'|"|\\"/g, ''); } }); }
javascript
function normalizeAttributes(selector) { selector.walkAttributes((node) => { if (node.value) { // remove quotes node.value = node.value.replace(/'|\\'|"|\\"/g, ''); } }); }
[ "function", "normalizeAttributes", "(", "selector", ")", "{", "selector", ".", "walkAttributes", "(", "(", "node", ")", "=>", "{", "if", "(", "node", ".", "value", ")", "{", "// remove quotes", "node", ".", "value", "=", "node", ".", "value", ".", "repla...
Ensure that attributes with different quotes match. @param {Object} selector - postcss selector node
[ "Ensure", "that", "attributes", "with", "different", "quotes", "match", "." ]
9a36f2fd55f8bb3ea6429ae871be4e1251608ea6
https://github.com/ChristianMurphy/postcss-combine-duplicated-selectors/blob/9a36f2fd55f8bb3ea6429ae871be4e1251608ea6/src/index.js#L9-L16
train
ChristianMurphy/postcss-combine-duplicated-selectors
src/index.js
sortGroups
function sortGroups(selector) { selector.each((subSelector) => { subSelector.nodes.sort((a, b) => { // different types cannot be sorted if (a.type !== b.type) { return 0; } // sort alphabetically return a.value < b.value ? -1 : 1; }); }); selector.sort((a, b) => (a....
javascript
function sortGroups(selector) { selector.each((subSelector) => { subSelector.nodes.sort((a, b) => { // different types cannot be sorted if (a.type !== b.type) { return 0; } // sort alphabetically return a.value < b.value ? -1 : 1; }); }); selector.sort((a, b) => (a....
[ "function", "sortGroups", "(", "selector", ")", "{", "selector", ".", "each", "(", "(", "subSelector", ")", "=>", "{", "subSelector", ".", "nodes", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "{", "// different types cannot be sorted", "if", "(", "a...
Sort class and id groups alphabetically @param {Object} selector - postcss selector node
[ "Sort", "class", "and", "id", "groups", "alphabetically" ]
9a36f2fd55f8bb3ea6429ae871be4e1251608ea6
https://github.com/ChristianMurphy/postcss-combine-duplicated-selectors/blob/9a36f2fd55f8bb3ea6429ae871be4e1251608ea6/src/index.js#L22-L36
train
ChristianMurphy/postcss-combine-duplicated-selectors
src/index.js
removeDupProperties
function removeDupProperties(selector) { // Remove duplicated properties from bottom to top () for (let actIndex = selector.nodes.length - 1; actIndex >= 1; actIndex--) { for (let befIndex = actIndex - 1; befIndex >= 0; befIndex--) { if (selector.nodes[actIndex].prop === selector.nodes[befIndex].prop) { ...
javascript
function removeDupProperties(selector) { // Remove duplicated properties from bottom to top () for (let actIndex = selector.nodes.length - 1; actIndex >= 1; actIndex--) { for (let befIndex = actIndex - 1; befIndex >= 0; befIndex--) { if (selector.nodes[actIndex].prop === selector.nodes[befIndex].prop) { ...
[ "function", "removeDupProperties", "(", "selector", ")", "{", "// Remove duplicated properties from bottom to top ()", "for", "(", "let", "actIndex", "=", "selector", ".", "nodes", ".", "length", "-", "1", ";", "actIndex", ">=", "1", ";", "actIndex", "--", ")", ...
Remove duplicated properties @param {Object} selector - postcss selector node
[ "Remove", "duplicated", "properties" ]
9a36f2fd55f8bb3ea6429ae871be4e1251608ea6
https://github.com/ChristianMurphy/postcss-combine-duplicated-selectors/blob/9a36f2fd55f8bb3ea6429ae871be4e1251608ea6/src/index.js#L42-L52
train
moreartyjs/moreartyjs
src/Binding.js
function (path, sharedInternals) { /** @private */ this._path = path || EMPTY_PATH; /** @protected * @ignore */ this._sharedInternals = sharedInternals || {}; if (!this._sharedInternals.listeners) { this._sharedInternals.listeners = {}; } if (!this._sharedInternals.cache) { this._sharedInter...
javascript
function (path, sharedInternals) { /** @private */ this._path = path || EMPTY_PATH; /** @protected * @ignore */ this._sharedInternals = sharedInternals || {}; if (!this._sharedInternals.listeners) { this._sharedInternals.listeners = {}; } if (!this._sharedInternals.cache) { this._sharedInter...
[ "function", "(", "path", ",", "sharedInternals", ")", "{", "/** @private */", "this", ".", "_path", "=", "path", "||", "EMPTY_PATH", ";", "/** @protected\n * @ignore */", "this", ".", "_sharedInternals", "=", "sharedInternals", "||", "{", "}", ";", "if", "(", ...
Binding constructor. @param {String[]} [path] binding path, empty array if omitted @param {Object} [sharedInternals] shared relative bindings internals: <ul> <li>backingValue - backing value;</li> <li>metaBinding - meta binding;</li> <li>metaBindingListenerId - meta binding listener id;</li> <li>listeners - change list...
[ "Binding", "constructor", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Binding.js#L290-L305
train
moreartyjs/moreartyjs
src/Binding.js
function (newBackingValue) { var newSharedInternals = {}; Util.assign(newSharedInternals, this._sharedInternals); newSharedInternals.backingValue = newBackingValue; return new Binding(this._path, newSharedInternals); }
javascript
function (newBackingValue) { var newSharedInternals = {}; Util.assign(newSharedInternals, this._sharedInternals); newSharedInternals.backingValue = newBackingValue; return new Binding(this._path, newSharedInternals); }
[ "function", "(", "newBackingValue", ")", "{", "var", "newSharedInternals", "=", "{", "}", ";", "Util", ".", "assign", "(", "newSharedInternals", ",", "this", ".", "_sharedInternals", ")", ";", "newSharedInternals", ".", "backingValue", "=", "newBackingValue", ";...
Update backing value. @param {Immutable.Map} newBackingValue new backing value @return {Binding} new binding instance, original is unaffected
[ "Update", "backing", "value", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Binding.js#L359-L364
train
moreartyjs/moreartyjs
src/Binding.js
function (alternativeBackingValue, compare) { var value = this.get(); var alternativeValue = alternativeBackingValue ? alternativeBackingValue.getIn(this._path) : undefined; return compare ? !compare(value, alternativeValue) : !(value === alternativeValue || (Util.undefinedOrNull(value) && U...
javascript
function (alternativeBackingValue, compare) { var value = this.get(); var alternativeValue = alternativeBackingValue ? alternativeBackingValue.getIn(this._path) : undefined; return compare ? !compare(value, alternativeValue) : !(value === alternativeValue || (Util.undefinedOrNull(value) && U...
[ "function", "(", "alternativeBackingValue", ",", "compare", ")", "{", "var", "value", "=", "this", ".", "get", "(", ")", ";", "var", "alternativeValue", "=", "alternativeBackingValue", "?", "alternativeBackingValue", ".", "getIn", "(", "this", ".", "_path", ")...
Check if binding value is changed in alternative backing value. @param {Immutable.Map} alternativeBackingValue alternative backing value @param {Function} [compare] alternative compare function, does reference equality check if omitted
[ "Check", "if", "binding", "value", "is", "changed", "in", "alternative", "backing", "value", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Binding.js#L369-L375
train
moreartyjs/moreartyjs
src/Binding.js
function (subpath) { if (!this._sharedInternals.metaBinding) { var metaBinding = Binding.init(Imm.Map()); linkMeta(this, metaBinding); this._sharedInternals.metaBinding = metaBinding; } var effectiveSubpath = subpath ? Util.joinPaths([Util.META_NODE], asArrayPath(subpath)) : [Util.META_NO...
javascript
function (subpath) { if (!this._sharedInternals.metaBinding) { var metaBinding = Binding.init(Imm.Map()); linkMeta(this, metaBinding); this._sharedInternals.metaBinding = metaBinding; } var effectiveSubpath = subpath ? Util.joinPaths([Util.META_NODE], asArrayPath(subpath)) : [Util.META_NO...
[ "function", "(", "subpath", ")", "{", "if", "(", "!", "this", ".", "_sharedInternals", ".", "metaBinding", ")", "{", "var", "metaBinding", "=", "Binding", ".", "init", "(", "Imm", ".", "Map", "(", ")", ")", ";", "linkMeta", "(", "this", ",", "metaBin...
Get binding's meta binding. @param {String|Array} [subpath] subpath as a dot-separated string or an array of strings and numbers; b.meta('path') is equivalent to b.meta().sub('path') @returns {Binding} meta binding or undefined
[ "Get", "binding", "s", "meta", "binding", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Binding.js#L389-L400
train
moreartyjs/moreartyjs
src/Binding.js
function (subpath) { var value = this.sub(subpath).get(); return Imm.Iterable.isIterable(value) ? value.toJS() : value; }
javascript
function (subpath) { var value = this.sub(subpath).get(); return Imm.Iterable.isIterable(value) ? value.toJS() : value; }
[ "function", "(", "subpath", ")", "{", "var", "value", "=", "this", ".", "sub", "(", "subpath", ")", ".", "get", "(", ")", ";", "return", "Imm", ".", "Iterable", ".", "isIterable", "(", "value", ")", "?", "value", ".", "toJS", "(", ")", ":", "valu...
Convert to JS representation. @param {String|Array} [subpath] subpath as a dot-separated string or an array of strings and numbers @return {*} JS representation of data at subpath
[ "Convert", "to", "JS", "representation", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Binding.js#L420-L423
train
moreartyjs/moreartyjs
src/Binding.js
function (subpath) { var pathAsArray = asArrayPath(subpath); var absolutePath = Util.joinPaths(this._path, pathAsArray); if (absolutePath.length > 0) { var absolutePathAsString = asStringPath(absolutePath); var cached = this._sharedInternals.cache[absolutePathAsString]; if (cached) { ...
javascript
function (subpath) { var pathAsArray = asArrayPath(subpath); var absolutePath = Util.joinPaths(this._path, pathAsArray); if (absolutePath.length > 0) { var absolutePathAsString = asStringPath(absolutePath); var cached = this._sharedInternals.cache[absolutePathAsString]; if (cached) { ...
[ "function", "(", "subpath", ")", "{", "var", "pathAsArray", "=", "asArrayPath", "(", "subpath", ")", ";", "var", "absolutePath", "=", "Util", ".", "joinPaths", "(", "this", ".", "_path", ",", "pathAsArray", ")", ";", "if", "(", "absolutePath", ".", "leng...
Bind to subpath. Both bindings share the same backing value. Changes are mutually visible. @param {String|Array} [subpath] subpath as a dot-separated string or an array of strings and numbers @return {Binding} new binding instance, original is unaffected
[ "Bind", "to", "subpath", ".", "Both", "bindings", "share", "the", "same", "backing", "value", ".", "Changes", "are", "mutually", "visible", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Binding.js#L428-L445
train
moreartyjs/moreartyjs
src/Binding.js
function (subpath, cb) { var args = Util.resolveArgs( arguments, function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, 'cb' ); var listenerId = generateListenerId(); var pathAsString = asStringPath(Util.joinPaths(this._path, asArrayPath(args.subpath || ''))); var samePathLi...
javascript
function (subpath, cb) { var args = Util.resolveArgs( arguments, function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, 'cb' ); var listenerId = generateListenerId(); var pathAsString = asStringPath(Util.joinPaths(this._path, asArrayPath(args.subpath || ''))); var samePathLi...
[ "function", "(", "subpath", ",", "cb", ")", "{", "var", "args", "=", "Util", ".", "resolveArgs", "(", "arguments", ",", "function", "(", "x", ")", "{", "return", "Util", ".", "canRepresentSubpath", "(", "x", ")", "?", "'subpath'", ":", "null", ";", "...
Add change listener. @param {String|Array} [subpath] subpath as a dot-separated string or an array of strings and numbers @param {Function} cb function receiving changes descriptor @return {String} unique id which should be used to un-register the listener @see ChangesDescriptor
[ "Add", "change", "listener", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Binding.js#L507-L524
train
moreartyjs/moreartyjs
src/Binding.js
function (subpath, cb) { var args = Util.resolveArgs( arguments, function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, 'cb' ); var self = this; var listenerId = self.addListener(args.subpath, function () { self.removeListener(listenerId); args.cb(); }); retu...
javascript
function (subpath, cb) { var args = Util.resolveArgs( arguments, function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, 'cb' ); var self = this; var listenerId = self.addListener(args.subpath, function () { self.removeListener(listenerId); args.cb(); }); retu...
[ "function", "(", "subpath", ",", "cb", ")", "{", "var", "args", "=", "Util", ".", "resolveArgs", "(", "arguments", ",", "function", "(", "x", ")", "{", "return", "Util", ".", "canRepresentSubpath", "(", "x", ")", "?", "'subpath'", ":", "null", ";", "...
Add change listener triggered only once. @param {String|Array} [subpath] subpath as a dot-separated string or an array of strings and numbers @param {Function} cb function receiving changes descriptor @return {String} unique id which should be used to un-register the listener @see ChangesDescriptor
[ "Add", "change", "listener", "triggered", "only", "once", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Binding.js#L531-L542
train
moreartyjs/moreartyjs
src/Binding.js
function (listenerId, f) { var samePathListeners = findSamePathListeners(this, listenerId); if (samePathListeners) { var descriptor = samePathListeners[listenerId]; descriptor.disabled = true; Util.afterComplete(f, function () { descriptor.disabled = false; }); } else { f(); } ...
javascript
function (listenerId, f) { var samePathListeners = findSamePathListeners(this, listenerId); if (samePathListeners) { var descriptor = samePathListeners[listenerId]; descriptor.disabled = true; Util.afterComplete(f, function () { descriptor.disabled = false; }); } else { f(); } ...
[ "function", "(", "listenerId", ",", "f", ")", "{", "var", "samePathListeners", "=", "findSamePathListeners", "(", "this", ",", "listenerId", ")", ";", "if", "(", "samePathListeners", ")", "{", "var", "descriptor", "=", "samePathListeners", "[", "listenerId", "...
Execute function with listener temporarily disabled. Correctly handles functions returning promises. @param {String} listenerId listener id @param {Function} f function to execute @return {Binding} this binding
[ "Execute", "function", "with", "listener", "temporarily", "disabled", ".", "Correctly", "handles", "functions", "returning", "promises", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Binding.js#L564-L574
train
moreartyjs/moreartyjs
src/Binding.js
function (binding, promise) { /** @private */ this._binding = binding; /** @private */ this._queuedUpdates = []; /** @private */ this._finishedUpdates = []; /** @private */ this._committed = false; /** @private */ this._cancelled = false; /** @private */ this._hasChanges = false; /** @priva...
javascript
function (binding, promise) { /** @private */ this._binding = binding; /** @private */ this._queuedUpdates = []; /** @private */ this._finishedUpdates = []; /** @private */ this._committed = false; /** @private */ this._cancelled = false; /** @private */ this._hasChanges = false; /** @priva...
[ "function", "(", "binding", ",", "promise", ")", "{", "/** @private */", "this", ".", "_binding", "=", "binding", ";", "/** @private */", "this", ".", "_queuedUpdates", "=", "[", "]", ";", "/** @private */", "this", ".", "_finishedUpdates", "=", "[", "]", ";...
Transaction context constructor. @param {Binding} binding binding @param {Promise} [promise] ES6 promise @public @class TransactionContext @classdesc Transaction context.
[ "Transaction", "context", "constructor", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Binding.js#L605-L632
train
moreartyjs/moreartyjs
src/Binding.js
function (binding, subpath) { var args = Util.resolveArgs( arguments, function (x) { return x instanceof Binding ? 'binding' : null; }, '?subpath' ); addDeletion(this, args.binding || this._binding, asArrayPath(args.subpath)); return this; }
javascript
function (binding, subpath) { var args = Util.resolveArgs( arguments, function (x) { return x instanceof Binding ? 'binding' : null; }, '?subpath' ); addDeletion(this, args.binding || this._binding, asArrayPath(args.subpath)); return this; }
[ "function", "(", "binding", ",", "subpath", ")", "{", "var", "args", "=", "Util", ".", "resolveArgs", "(", "arguments", ",", "function", "(", "x", ")", "{", "return", "x", "instanceof", "Binding", "?", "'binding'", ":", "null", ";", "}", ",", "'?subpat...
Remove value. @param {Binding} [binding] binding to apply update to @param {String|Array} [subpath] subpath as a dot-separated string or an array of strings and numbers @return {TransactionContext} updated transaction context
[ "Remove", "value", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Binding.js#L786-L793
train
moreartyjs/moreartyjs
src/Morearty.js
function (binding, metaBinding, options) { /** @private */ this._initialMetaState = metaBinding.get(); /** @private */ this._previousMetaState = null; /** @private */ this._metaBinding = metaBinding; /** @protected * @ignore */ this._metaChanged = false; /** @private */ thi...
javascript
function (binding, metaBinding, options) { /** @private */ this._initialMetaState = metaBinding.get(); /** @private */ this._previousMetaState = null; /** @private */ this._metaBinding = metaBinding; /** @protected * @ignore */ this._metaChanged = false; /** @private */ thi...
[ "function", "(", "binding", ",", "metaBinding", ",", "options", ")", "{", "/** @private */", "this", ".", "_initialMetaState", "=", "metaBinding", ".", "get", "(", ")", ";", "/** @private */", "this", ".", "_previousMetaState", "=", "null", ";", "/** @private */...
Morearty context constructor. @param {Binding} binding state binding @param {Binding} metaBinding meta state binding @param {Object} options options @public @class Context @classdesc Represents Morearty context. <p>Exposed modules: <ul> <li>[Util]{@link Util};</li> <li>[Binding]{@link Binding};</li> <li>[History]{@link...
[ "Morearty", "context", "constructor", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Morearty.js#L240-L277
train
moreartyjs/moreartyjs
src/Morearty.js
function (subpath, options) { var args = Util.resolveArgs( arguments, function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, '?options' ); var pathAsArray = args.subpath ? Binding.asArrayPath(args.subpath) : []; var tx = this.getBinding().atomically(); t...
javascript
function (subpath, options) { var args = Util.resolveArgs( arguments, function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, '?options' ); var pathAsArray = args.subpath ? Binding.asArrayPath(args.subpath) : []; var tx = this.getBinding().atomically(); t...
[ "function", "(", "subpath", ",", "options", ")", "{", "var", "args", "=", "Util", ".", "resolveArgs", "(", "arguments", ",", "function", "(", "x", ")", "{", "return", "Util", ".", "canRepresentSubpath", "(", "x", ")", "?", "'subpath'", ":", "null", ";"...
Revert to initial state. @param {String|Array} [subpath] subpath as a dot-separated string or an array of strings and numbers @param {Object} [options] options object @param {Boolean} [options.notify=true] should listeners be notified @param {Boolean} [options.resetMeta=true] should meta state be reverted
[ "Revert", "to", "initial", "state", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Morearty.js#L332-L349
train
moreartyjs/moreartyjs
src/Morearty.js
function (newState, newMetaState, options) { var args = Util.resolveArgs( arguments, 'newState', function (x) { return Imm.Map.isMap(x) ? 'newMetaState' : null; }, '?options' ); var effectiveOptions = args.options || {}; var tx = this.getBinding().atomically(); tx.set(new...
javascript
function (newState, newMetaState, options) { var args = Util.resolveArgs( arguments, 'newState', function (x) { return Imm.Map.isMap(x) ? 'newMetaState' : null; }, '?options' ); var effectiveOptions = args.options || {}; var tx = this.getBinding().atomically(); tx.set(new...
[ "function", "(", "newState", ",", "newMetaState", ",", "options", ")", "{", "var", "args", "=", "Util", ".", "resolveArgs", "(", "arguments", ",", "'newState'", ",", "function", "(", "x", ")", "{", "return", "Imm", ".", "Map", ".", "isMap", "(", "x", ...
Replace whole state with new value. @param {Immutable.Map} newState new state @param {Immutable.Map} [newMetaState] new meta state @param {Object} [options] options object @param {Boolean} [options.notify=true] should listeners be notified
[ "Replace", "whole", "state", "with", "new", "value", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Morearty.js#L356-L370
train
moreartyjs/moreartyjs
src/Morearty.js
function (binding, subpath, compare) { var args = Util.resolveArgs( arguments, 'binding', function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, '?compare' ); return args.binding.sub(args.subpath).isChanged(this._previousState, args.compare || Imm.is); }
javascript
function (binding, subpath, compare) { var args = Util.resolveArgs( arguments, 'binding', function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, '?compare' ); return args.binding.sub(args.subpath).isChanged(this._previousState, args.compare || Imm.is); }
[ "function", "(", "binding", ",", "subpath", ",", "compare", ")", "{", "var", "args", "=", "Util", ".", "resolveArgs", "(", "arguments", ",", "'binding'", ",", "function", "(", "x", ")", "{", "return", "Util", ".", "canRepresentSubpath", "(", "x", ")", ...
Check if binding value was changed on last re-render. @param {Binding} binding binding @param {String|Array} [subpath] subpath as a dot-separated string or an array of strings and numbers @param {Function} [compare] compare function, '===' for primitives / Immutable.is for collections by default
[ "Check", "if", "binding", "value", "was", "changed", "on", "last", "re", "-", "render", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Morearty.js#L376-L383
train
moreartyjs/moreartyjs
src/Morearty.js
function (rootComp, reactContext) { var ctx = this; var effectiveReactContext = reactContext || {}; effectiveReactContext.morearty = ctx; return React.createClass({ displayName: 'Bootstrap', childContextTypes: { morearty: React.PropTypes.instanceOf(Context).isRequire...
javascript
function (rootComp, reactContext) { var ctx = this; var effectiveReactContext = reactContext || {}; effectiveReactContext.morearty = ctx; return React.createClass({ displayName: 'Bootstrap', childContextTypes: { morearty: React.PropTypes.instanceOf(Context).isRequire...
[ "function", "(", "rootComp", ",", "reactContext", ")", "{", "var", "ctx", "=", "this", ";", "var", "effectiveReactContext", "=", "reactContext", "||", "{", "}", ";", "effectiveReactContext", ".", "morearty", "=", "ctx", ";", "return", "React", ".", "createCl...
Create Morearty bootstrap component ready for rendering. @param {*} rootComp root application component @param {Object} [reactContext] custom React context (will be enriched with Morearty-specific data) @return {*} Morearty bootstrap component
[ "Create", "Morearty", "bootstrap", "component", "ready", "for", "rendering", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Morearty.js#L512-L539
train
moreartyjs/moreartyjs
src/Morearty.js
function (name) { var ctx = this.getMoreartyContext(); return getBinding(this.props, name).withBackingValue(ctx._previousState).get(); }
javascript
function (name) { var ctx = this.getMoreartyContext(); return getBinding(this.props, name).withBackingValue(ctx._previousState).get(); }
[ "function", "(", "name", ")", "{", "var", "ctx", "=", "this", ".", "getMoreartyContext", "(", ")", ";", "return", "getBinding", "(", "this", ".", "props", ",", "name", ")", ".", "withBackingValue", "(", "ctx", ".", "_previousState", ")", ".", "get", "(...
Get component previous state value. @param {String} [name] binding name (can only be used with multi-binding state) @return {*} previous component state value
[ "Get", "component", "previous", "state", "value", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Morearty.js#L636-L639
train
moreartyjs/moreartyjs
src/Morearty.js
function (binding, cb) { if (!this.observedBindings) { this.observedBindings = []; } var bindingPath = binding.getPath(); if (!Util.find(this.observedBindings, function (b) { return b.getPath() === bindingPath; })) { this.observedBindings.push(binding); set...
javascript
function (binding, cb) { if (!this.observedBindings) { this.observedBindings = []; } var bindingPath = binding.getPath(); if (!Util.find(this.observedBindings, function (b) { return b.getPath() === bindingPath; })) { this.observedBindings.push(binding); set...
[ "function", "(", "binding", ",", "cb", ")", "{", "if", "(", "!", "this", ".", "observedBindings", ")", "{", "this", ".", "observedBindings", "=", "[", "]", ";", "}", "var", "bindingPath", "=", "binding", ".", "getPath", "(", ")", ";", "if", "(", "!...
Consider specified binding for changes when rendering. Registering same binding twice has no effect. @param {Binding} binding @param {Function} [cb] optional callback receiving binding value @return {*} undefined if cb argument is ommitted, cb invocation result otherwise
[ "Consider", "specified", "binding", "for", "changes", "when", "rendering", ".", "Registering", "same", "binding", "twice", "has", "no", "effect", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Morearty.js#L645-L657
train
moreartyjs/moreartyjs
src/Morearty.js
function (binding, subpath, cb) { var args = Util.resolveArgs( arguments, function (x) { return x instanceof Binding ? 'binding' : null; }, function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, 'cb' ); if (!this._bindingListenerRemovers...
javascript
function (binding, subpath, cb) { var args = Util.resolveArgs( arguments, function (x) { return x instanceof Binding ? 'binding' : null; }, function (x) { return Util.canRepresentSubpath(x) ? 'subpath' : null; }, 'cb' ); if (!this._bindingListenerRemovers...
[ "function", "(", "binding", ",", "subpath", ",", "cb", ")", "{", "var", "args", "=", "Util", ".", "resolveArgs", "(", "arguments", ",", "function", "(", "x", ")", "{", "return", "x", "instanceof", "Binding", "?", "'binding'", ":", "null", ";", "}", "...
Add binding listener. Listener will be automatically removed on unmount. @param {Binding} [binding] binding to attach listener to, default binding if omitted @param {String|Array} [subpath] subpath as a dot-separated string or an array of strings and numbers @param {Function} cb function receiving changes descriptor @r...
[ "Add", "binding", "listener", ".", "Listener", "will", "be", "automatically", "removed", "on", "unmount", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Morearty.js#L696-L718
train
moreartyjs/moreartyjs
src/Morearty.js
function (spec) { var initialState, initialMetaState, options; if (arguments.length <= 1) { var effectiveSpec = spec || {}; initialState = effectiveSpec.initialState; initialMetaState = effectiveSpec.initialMetaState; options = effectiveSpec.options; } else { co...
javascript
function (spec) { var initialState, initialMetaState, options; if (arguments.length <= 1) { var effectiveSpec = spec || {}; initialState = effectiveSpec.initialState; initialMetaState = effectiveSpec.initialMetaState; options = effectiveSpec.options; } else { co...
[ "function", "(", "spec", ")", "{", "var", "initialState", ",", "initialMetaState", ",", "options", ";", "if", "(", "arguments", ".", "length", "<=", "1", ")", "{", "var", "effectiveSpec", "=", "spec", "||", "{", "}", ";", "initialState", "=", "effectiveS...
Create Morearty context. @param {Object} [spec] spec object @param {Immutable.Map|Object} [spec.initialState={}] initial state @param {Immutable.Map|Object} [spec.initialMetaState={}] initial meta-state @param {Object} [spec.options={}] options object @param {Boolean} [spec.options.requestAnimationFrameEnabled=true] en...
[ "Create", "Morearty", "context", "." ]
297dfd7c4562b4668da1dfb33a9a607cec8a8fe3
https://github.com/moreartyjs/moreartyjs/blob/297dfd7c4562b4668da1dfb33a9a607cec8a8fe3/src/Morearty.js#L752-L786
train