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
stealjs/steal-tools
lib/process_babel_plugins.js
isBuiltinPlugin
function isBuiltinPlugin(name) { var isNpmPluginName = /^(?:babel-plugin-)/; var availablePlugins = babel.availablePlugins; // if the full npm plugin name was set in `babelOptions.plugins`, use the // shorthand to check whether the plugin is included in babel-standalone; // shorthand plugin names are used interna...
javascript
function isBuiltinPlugin(name) { var isNpmPluginName = /^(?:babel-plugin-)/; var availablePlugins = babel.availablePlugins; // if the full npm plugin name was set in `babelOptions.plugins`, use the // shorthand to check whether the plugin is included in babel-standalone; // shorthand plugin names are used interna...
[ "function", "isBuiltinPlugin", "(", "name", ")", "{", "var", "isNpmPluginName", "=", "/", "^(?:babel-plugin-)", "/", ";", "var", "availablePlugins", "=", "babel", ".", "availablePlugins", ";", "// if the full npm plugin name was set in `babelOptions.plugins`, use the", "// ...
Whether the plugin is built in babel-standalone @param {string} name A plugin path or shorthand name. @return {boolean} `true` if plugin is bundled, `false` otherwise Babel plugins can be set using the following variations: 1) the npm plugin name, which by convention starts with `babel-plugin-` (e.g babel-plugin-tra...
[ "Whether", "the", "plugin", "is", "built", "in", "babel", "-", "standalone" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/process_babel_plugins.js#L136-L148
train
stealjs/steal-tools
lib/build/continuous.js
rebuild
function rebuild(moduleNames){ moduleName = moduleNames[0] || ""; moduleNames.forEach(function(moduleName){ graphStream.write(moduleName); }); }
javascript
function rebuild(moduleNames){ moduleName = moduleNames[0] || ""; moduleNames.forEach(function(moduleName){ graphStream.write(moduleName); }); }
[ "function", "rebuild", "(", "moduleNames", ")", "{", "moduleName", "=", "moduleNames", "[", "0", "]", "||", "\"\"", ";", "moduleNames", ".", "forEach", "(", "function", "(", "moduleName", ")", "{", "graphStream", ".", "write", "(", "moduleName", ")", ";", ...
A function that is called whenever a module is found by the watch stream. Called with the name of the module and used to rebuild.
[ "A", "function", "that", "is", "called", "whenever", "a", "module", "is", "found", "by", "the", "watch", "stream", ".", "Called", "with", "the", "name", "of", "the", "module", "and", "used", "to", "rebuild", "." ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/build/continuous.js#L23-L28
train
stealjs/steal-tools
lib/graph/transpile.js
flagCircularDependencies
function flagCircularDependencies(graph) { var includes = require("lodash/includes"); var nodes = Array.isArray(graph) ? graph : require("lodash/values")(graph); for (var i = 0; i < nodes.length; i += 1) { var curr = nodes[i]; for (var j = i + 1; j < nodes.length; j += 1) { var next = nodes[j]; if ( ...
javascript
function flagCircularDependencies(graph) { var includes = require("lodash/includes"); var nodes = Array.isArray(graph) ? graph : require("lodash/values")(graph); for (var i = 0; i < nodes.length; i += 1) { var curr = nodes[i]; for (var j = i + 1; j < nodes.length; j += 1) { var next = nodes[j]; if ( ...
[ "function", "flagCircularDependencies", "(", "graph", ")", "{", "var", "includes", "=", "require", "(", "\"lodash/includes\"", ")", ";", "var", "nodes", "=", "Array", ".", "isArray", "(", "graph", ")", "?", "graph", ":", "require", "(", "\"lodash/values\"", ...
Adds a circular flag to the load object of cyclic dependencies MUTATES THE GRAPH @param {Object} graph - The graph to check
[ "Adds", "a", "circular", "flag", "to", "the", "load", "object", "of", "cyclic", "dependencies" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/graph/transpile.js#L172-L193
train
stealjs/steal-tools
lib/node/make_slim_config_node.js
getRelativeBundlePath
function getRelativeBundlePath(target, bundle) { var baseUrl = options.baseUrl.replace("file:", ""); return target !== "web" ? getBundleFileName(bundle) : path.join( path.relative(baseUrl, options.bundlesPath), getBundleFileName(bundle) ); }
javascript
function getRelativeBundlePath(target, bundle) { var baseUrl = options.baseUrl.replace("file:", ""); return target !== "web" ? getBundleFileName(bundle) : path.join( path.relative(baseUrl, options.bundlesPath), getBundleFileName(bundle) ); }
[ "function", "getRelativeBundlePath", "(", "target", ",", "bundle", ")", "{", "var", "baseUrl", "=", "options", ".", "baseUrl", ".", "replace", "(", "\"file:\"", ",", "\"\"", ")", ";", "return", "target", "!==", "\"web\"", "?", "getBundleFileName", "(", "bund...
Returns the bundle's path For nodejs, the name of the bundle is returned since `require` will locate the bundle relative to the main module folder. For the web, a relative path to the loader baseUrl is returned, so the loader can use script tags to load the bundles during runtime. @param {string} target - The name o...
[ "Returns", "the", "bundle", "s", "path", "For", "nodejs", "the", "name", "of", "the", "bundle", "is", "returned", "since", "require", "will", "locate", "the", "bundle", "relative", "to", "the", "main", "module", "folder", ".", "For", "the", "web", "a", "...
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/node/make_slim_config_node.js#L52-L61
train
stealjs/steal-tools
lib/build/slim.js
function(results) { var value; if (targets.length) { value = {}; results.forEach(function(result, index) { value[targets[index]] = result; }); } else { value = results[0]; } slimDfd.resolve(value); }
javascript
function(results) { var value; if (targets.length) { value = {}; results.forEach(function(result, index) { value[targets[index]] = result; }); } else { value = results[0]; } slimDfd.resolve(value); }
[ "function", "(", "results", ")", "{", "var", "value", ";", "if", "(", "targets", ".", "length", ")", "{", "value", "=", "{", "}", ";", "results", ".", "forEach", "(", "function", "(", "result", ",", "index", ")", "{", "value", "[", "targets", "[", ...
If no `target` is provided resolves `buildResult`; otherwise resolves an object where the key is the target name and its value the `buildResult` object.
[ "If", "no", "target", "is", "provided", "resolves", "buildResult", ";", "otherwise", "resolves", "an", "object", "where", "the", "key", "is", "the", "target", "name", "and", "its", "value", "the", "buildResult", "object", "." ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/build/slim.js#L126-L139
train
stealjs/steal-tools
lib/bundle/name.js
getUniqueName
function getUniqueName(dirName, shortened, buildTypeSuffix) { if (!usedBundleNames[dirName + shortened + buildTypeSuffix]) { return dirName + shortened + buildTypeSuffix + ""; }else { return dirName + shortened + "-" + (bundleCounter++) + buildTypeSuffix + ""; } }
javascript
function getUniqueName(dirName, shortened, buildTypeSuffix) { if (!usedBundleNames[dirName + shortened + buildTypeSuffix]) { return dirName + shortened + buildTypeSuffix + ""; }else { return dirName + shortened + "-" + (bundleCounter++) + buildTypeSuffix + ""; } }
[ "function", "getUniqueName", "(", "dirName", ",", "shortened", ",", "buildTypeSuffix", ")", "{", "if", "(", "!", "usedBundleNames", "[", "dirName", "+", "shortened", "+", "buildTypeSuffix", "]", ")", "{", "return", "dirName", "+", "shortened", "+", "buildTypeS...
get a unique name, based on bundleCounter @param dirName @param shortened @param buildTypeSuffix @returns {string}
[ "get", "a", "unique", "name", "based", "on", "bundleCounter" ]
48cfb4ff67f421765be53a71b90a70ba857ca583
https://github.com/stealjs/steal-tools/blob/48cfb4ff67f421765be53a71b90a70ba857ca583/lib/bundle/name.js#L101-L107
train
panuhorsmalahti/gulp-tslint
index.js
log
function log(message, level) { var prefix = "[" + colors.cyan("gulp-tslint") + "]"; if (level === "error") { fancyLog(prefix, colors.red("error"), message); } else { fancyLog(prefix, message); } }
javascript
function log(message, level) { var prefix = "[" + colors.cyan("gulp-tslint") + "]"; if (level === "error") { fancyLog(prefix, colors.red("error"), message); } else { fancyLog(prefix, message); } }
[ "function", "log", "(", "message", ",", "level", ")", "{", "var", "prefix", "=", "\"[\"", "+", "colors", ".", "cyan", "(", "\"gulp-tslint\"", ")", "+", "\"]\"", ";", "if", "(", "level", "===", "\"error\"", ")", "{", "fancyLog", "(", "prefix", ",", "c...
Log an event or error using gutil.log. @param {string} message the log message. @param {string} level can be "error". Optional. Leave empty for the default logging type.
[ "Log", "an", "event", "or", "error", "using", "gutil", ".", "log", "." ]
bdea3ff458044129f40df91874efc07866e68b65
https://github.com/panuhorsmalahti/gulp-tslint/blob/bdea3ff458044129f40df91874efc07866e68b65/index.js#L45-L53
train
panuhorsmalahti/gulp-tslint
index.js
function (pluginOptions) { // If user options are undefined, set an empty options object if (!pluginOptions) { pluginOptions = {}; } // Save off pluginOptions so we can get it in `report()` tslintPlugin.pluginOptions = pluginOptions; // TSLint default options var options = { ...
javascript
function (pluginOptions) { // If user options are undefined, set an empty options object if (!pluginOptions) { pluginOptions = {}; } // Save off pluginOptions so we can get it in `report()` tslintPlugin.pluginOptions = pluginOptions; // TSLint default options var options = { ...
[ "function", "(", "pluginOptions", ")", "{", "// If user options are undefined, set an empty options object", "if", "(", "!", "pluginOptions", ")", "{", "pluginOptions", "=", "{", "}", ";", "}", "// Save off pluginOptions so we can get it in `report()`", "tslintPlugin", ".", ...
Main plugin function @param {PluginOptions} [pluginOptions] contains the options for gulp-tslint. Optional. @returns {any}
[ "Main", "plugin", "function" ]
bdea3ff458044129f40df91874efc07866e68b65
https://github.com/panuhorsmalahti/gulp-tslint/blob/bdea3ff458044129f40df91874efc07866e68b65/index.js#L73-L112
train
panuhorsmalahti/gulp-tslint
index.js
function (file) { if (file.tslint) { // Version 5.0.0 of tslint no longer has a failureCount member // It was renamed to errorCount. See tslint issue #2439 var failureCount = file.tslint.errorCount; if (!options.allowWarnings) { failureCount += fil...
javascript
function (file) { if (file.tslint) { // Version 5.0.0 of tslint no longer has a failureCount member // It was renamed to errorCount. See tslint issue #2439 var failureCount = file.tslint.errorCount; if (!options.allowWarnings) { failureCount += fil...
[ "function", "(", "file", ")", "{", "if", "(", "file", ".", "tslint", ")", "{", "// Version 5.0.0 of tslint no longer has a failureCount member", "// It was renamed to errorCount. See tslint issue #2439", "var", "failureCount", "=", "file", ".", "tslint", ".", "errorCount", ...
Log formatted output for each file individually
[ "Log", "formatted", "output", "for", "each", "file", "individually" ]
bdea3ff458044129f40df91874efc07866e68b65
https://github.com/panuhorsmalahti/gulp-tslint/blob/bdea3ff458044129f40df91874efc07866e68b65/index.js#L138-L175
train
panuhorsmalahti/gulp-tslint
index.js
function () { // Throw error if (options && errorFiles.length > 0) { var failuresToOutput = allFailures; var ignoreFailureCount = 0; // If error count is limited, calculate number of errors not shown and slice reportLimit // number of errors to be included...
javascript
function () { // Throw error if (options && errorFiles.length > 0) { var failuresToOutput = allFailures; var ignoreFailureCount = 0; // If error count is limited, calculate number of errors not shown and slice reportLimit // number of errors to be included...
[ "function", "(", ")", "{", "// Throw error", "if", "(", "options", "&&", "errorFiles", ".", "length", ">", "0", ")", "{", "var", "failuresToOutput", "=", "allFailures", ";", "var", "ignoreFailureCount", "=", "0", ";", "// If error count is limited, calculate numbe...
After reporting on all files, throw the error.
[ "After", "reporting", "on", "all", "files", "throw", "the", "error", "." ]
bdea3ff458044129f40df91874efc07866e68b65
https://github.com/panuhorsmalahti/gulp-tslint/blob/bdea3ff458044129f40df91874efc07866e68b65/index.js#L179-L213
train
itemslide/itemslide.github.io
src/navigation.js
touchend
function touchend(e) { if (isDown) { isDown = false; var touch; if (e.type == 'touchend') //Check for touch event or mousemove touch = getTouch(e); else touch = e; $(window).off('mousemove touchmove', mousemove); //...
javascript
function touchend(e) { if (isDown) { isDown = false; var touch; if (e.type == 'touchend') //Check for touch event or mousemove touch = getTouch(e); else touch = e; $(window).off('mousemove touchmove', mousemove); //...
[ "function", "touchend", "(", "e", ")", "{", "if", "(", "isDown", ")", "{", "isDown", "=", "false", ";", "var", "touch", ";", "if", "(", "e", ".", "type", "==", "'touchend'", ")", "//Check for touch event or mousemove", "touch", "=", "getTouch", "(", "e",...
END OF MOUSEMOVE
[ "END", "OF", "MOUSEMOVE" ]
e18300b40722e27ea69bb39e2691122f4b78acdb
https://github.com/itemslide/itemslide.github.io/blob/e18300b40722e27ea69bb39e2691122f4b78acdb/src/navigation.js#L201-L269
train
jieter/Leaflet-semicircle
piechart/Pie.js
function (map) { this._parts = []; var startAngle = 0; var stopAngle = 0; this.addTo(map); for (var i = 0; i < this.count(); i++) { var normalized = this._normalize(this._data[i].num); stopAngle = normalized * 360 + startAngl...
javascript
function (map) { this._parts = []; var startAngle = 0; var stopAngle = 0; this.addTo(map); for (var i = 0; i < this.count(); i++) { var normalized = this._normalize(this._data[i].num); stopAngle = normalized * 360 + startAngl...
[ "function", "(", "map", ")", "{", "this", ".", "_parts", "=", "[", "]", ";", "var", "startAngle", "=", "0", ";", "var", "stopAngle", "=", "0", ";", "this", ".", "addTo", "(", "map", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", ...
layer implementation.
[ "layer", "implementation", "." ]
53b4b6c7b93f49c6e95fece63310b8697e77b365
https://github.com/jieter/Leaflet-semicircle/blob/53b4b6c7b93f49c6e95fece63310b8697e77b365/piechart/Pie.js#L114-L147
train
emberjs/ember-mocha
vendor/ember-mocha/ember-mocha-adapter.js
complete
function complete(e) { clearTimeout(doneTimeout); if (!done) { return; } var d = done; done = null; if (e) { // test failure if (!(e instanceof Error)) { e = new Error(e); } d(e); } else { // test passed d(); } }
javascript
function complete(e) { clearTimeout(doneTimeout); if (!done) { return; } var d = done; done = null; if (e) { // test failure if (!(e instanceof Error)) { e = new Error(e); } d(e); } else { // test passed d(); } }
[ "function", "complete", "(", "e", ")", "{", "clearTimeout", "(", "doneTimeout", ")", ";", "if", "(", "!", "done", ")", "{", "return", ";", "}", "var", "d", "=", "done", ";", "done", "=", "null", ";", "if", "(", "e", ")", "{", "// test failure", "...
Called whenever an async test passes or fails. if `e` is passed, that means the test failed with exception `e`
[ "Called", "whenever", "an", "async", "test", "passes", "or", "fails", ".", "if", "e", "is", "passed", "that", "means", "the", "test", "failed", "with", "exception", "e" ]
196ed7ee0ba98385b01ffdccf5a01da581b02580
https://github.com/emberjs/ember-mocha/blob/196ed7ee0ba98385b01ffdccf5a01da581b02580/vendor/ember-mocha/ember-mocha-adapter.js#L83-L98
train
evothings/phonegap-estimotebeacons
examples/beacon-finder/www/js/screen-live-development.js
parseConnectAddress
function parseConnectAddress(address) { var url = address.trim(); if (!url.match('^https?://[A-Z0-9\.]*.*$')) { // Add protocol. url = 'http://' + url; } if (url.match('^https?://[0-9\.]*$') && !url.match('^https?://[0-9\.]*:[0-9]*$')) { // Add port to numeric ip address. url = url + ':404...
javascript
function parseConnectAddress(address) { var url = address.trim(); if (!url.match('^https?://[A-Z0-9\.]*.*$')) { // Add protocol. url = 'http://' + url; } if (url.match('^https?://[0-9\.]*$') && !url.match('^https?://[0-9\.]*:[0-9]*$')) { // Add port to numeric ip address. url = url + ':404...
[ "function", "parseConnectAddress", "(", "address", ")", "{", "var", "url", "=", "address", ".", "trim", "(", ")", ";", "if", "(", "!", "url", ".", "match", "(", "'^https?://[A-Z0-9\\.]*.*$'", ")", ")", "{", "// Add protocol.", "url", "=", "'http://'", "+",...
Add protocol and port if needed.
[ "Add", "protocol", "and", "port", "if", "needed", "." ]
eed09405b5435a0b9e76e9094f52350991c51b91
https://github.com/evothings/phonegap-estimotebeacons/blob/eed09405b5435a0b9e76e9094f52350991c51b91/examples/beacon-finder/www/js/screen-live-development.js#L13-L31
train
evothings/phonegap-estimotebeacons
plugin/src/js/EstimoteBeacons.js
helper_createTriggerObject
function helper_createTriggerObject(trigger) { var triggerObject = {}; triggerObject.triggerIdentifier = trigger.identifier; triggerObject.rules = []; for (var i = 0; i < trigger.rules.length; ++i) { var rule = trigger.rules[i]; triggerObject.rules.push({ ruleType: rule.ruleType, ruleIdentifier: rule.r...
javascript
function helper_createTriggerObject(trigger) { var triggerObject = {}; triggerObject.triggerIdentifier = trigger.identifier; triggerObject.rules = []; for (var i = 0; i < trigger.rules.length; ++i) { var rule = trigger.rules[i]; triggerObject.rules.push({ ruleType: rule.ruleType, ruleIdentifier: rule.r...
[ "function", "helper_createTriggerObject", "(", "trigger", ")", "{", "var", "triggerObject", "=", "{", "}", ";", "triggerObject", ".", "triggerIdentifier", "=", "trigger", ".", "identifier", ";", "triggerObject", ".", "rules", "=", "[", "]", ";", "for", "(", ...
Helper function that creates an internal 'lightweight' trigger object sent to the native side. @private
[ "Helper", "function", "that", "creates", "an", "internal", "lightweight", "trigger", "object", "sent", "to", "the", "native", "side", "." ]
eed09405b5435a0b9e76e9094f52350991c51b91
https://github.com/evothings/phonegap-estimotebeacons/blob/eed09405b5435a0b9e76e9094f52350991c51b91/plugin/src/js/EstimoteBeacons.js#L1517-L1535
train
evothings/phonegap-estimotebeacons
plugin/src/js/EstimoteBeacons.js
helper_updateTriggerRule
function helper_updateTriggerRule(trigger, event) { var rule = trigger.ruleTable[event.ruleIdentifier]; if (rule && rule.ruleUpdateFunction) { rule.ruleUpdateFunction(rule, event.nearable, event); helper_updateRuleState( event.triggerIdentifier, event.ruleIdentifier, rule.state); } }
javascript
function helper_updateTriggerRule(trigger, event) { var rule = trigger.ruleTable[event.ruleIdentifier]; if (rule && rule.ruleUpdateFunction) { rule.ruleUpdateFunction(rule, event.nearable, event); helper_updateRuleState( event.triggerIdentifier, event.ruleIdentifier, rule.state); } }
[ "function", "helper_updateTriggerRule", "(", "trigger", ",", "event", ")", "{", "var", "rule", "=", "trigger", ".", "ruleTable", "[", "event", ".", "ruleIdentifier", "]", ";", "if", "(", "rule", "&&", "rule", ".", "ruleUpdateFunction", ")", "{", "rule", "....
Helper function that calls the update function of the rule related to the event and then updates the native rule state. @private
[ "Helper", "function", "that", "calls", "the", "update", "function", "of", "the", "rule", "related", "to", "the", "event", "and", "then", "updates", "the", "native", "rule", "state", "." ]
eed09405b5435a0b9e76e9094f52350991c51b91
https://github.com/evothings/phonegap-estimotebeacons/blob/eed09405b5435a0b9e76e9094f52350991c51b91/plugin/src/js/EstimoteBeacons.js#L1542-L1553
train
evothings/phonegap-estimotebeacons
plugin/src/js/EstimoteBeacons.js
helper_updateRuleState
function helper_updateRuleState(triggerIdentifier, ruleIdentifier, state) { exec(null, null, 'EstimoteBeacons', 'triggers_updateRuleState', [triggerIdentifier, ruleIdentifier, state] ); }
javascript
function helper_updateRuleState(triggerIdentifier, ruleIdentifier, state) { exec(null, null, 'EstimoteBeacons', 'triggers_updateRuleState', [triggerIdentifier, ruleIdentifier, state] ); }
[ "function", "helper_updateRuleState", "(", "triggerIdentifier", ",", "ruleIdentifier", ",", "state", ")", "{", "exec", "(", "null", ",", "null", ",", "'EstimoteBeacons'", ",", "'triggers_updateRuleState'", ",", "[", "triggerIdentifier", ",", "ruleIdentifier", ",", "...
Helper function used to update the state of a native rule during an update event. @param event Event object passed to the event update function. @param state true if rule holds, false if rule does not hold. @private
[ "Helper", "function", "used", "to", "update", "the", "state", "of", "a", "native", "rule", "during", "an", "update", "event", "." ]
eed09405b5435a0b9e76e9094f52350991c51b91
https://github.com/evothings/phonegap-estimotebeacons/blob/eed09405b5435a0b9e76e9094f52350991c51b91/plugin/src/js/EstimoteBeacons.js#L1562-L1570
train
thedersen/backbone.validation
dist/backbone-validation.js
function(model, attrs) { attrs = attrs || _.keys(_.result(model, 'validation') || {}); return _.reduce(attrs, function(memo, key) { memo[key] = void 0; return memo; }, {}); }
javascript
function(model, attrs) { attrs = attrs || _.keys(_.result(model, 'validation') || {}); return _.reduce(attrs, function(memo, key) { memo[key] = void 0; return memo; }, {}); }
[ "function", "(", "model", ",", "attrs", ")", "{", "attrs", "=", "attrs", "||", "_", ".", "keys", "(", "_", ".", "result", "(", "model", ",", "'validation'", ")", "||", "{", "}", ")", ";", "return", "_", ".", "reduce", "(", "attrs", ",", "function...
Returns an object with undefined properties for all attributes on the model that has defined one or more validation rules.
[ "Returns", "an", "object", "with", "undefined", "properties", "for", "all", "attributes", "on", "the", "model", "that", "has", "defined", "one", "or", "more", "validation", "rules", "." ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L109-L115
train
thedersen/backbone.validation
dist/backbone-validation.js
function(attr, value) { var self = this, result = {}, error; if(_.isObject(attr)){ _.each(attr, function(value, key) { error = self.preValidate(key, value); if(error){ result[key] = error; } ...
javascript
function(attr, value) { var self = this, result = {}, error; if(_.isObject(attr)){ _.each(attr, function(value, key) { error = self.preValidate(key, value); if(error){ result[key] = error; } ...
[ "function", "(", "attr", ",", "value", ")", "{", "var", "self", "=", "this", ",", "result", "=", "{", "}", ",", "error", ";", "if", "(", "_", ".", "isObject", "(", "attr", ")", ")", "{", "_", ".", "each", "(", "attr", ",", "function", "(", "v...
Check whether or not a value, or a hash of values passes validation without updating the model
[ "Check", "whether", "or", "not", "a", "value", "or", "a", "hash", "of", "values", "passes", "validation", "without", "updating", "the", "model" ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L217-L235
train
thedersen/backbone.validation
dist/backbone-validation.js
function(view, model, options) { if (model.associatedViews) { model.associatedViews.push(view); } else { model.associatedViews = [view]; } _.extend(model, mixin(view, options)); }
javascript
function(view, model, options) { if (model.associatedViews) { model.associatedViews.push(view); } else { model.associatedViews = [view]; } _.extend(model, mixin(view, options)); }
[ "function", "(", "view", ",", "model", ",", "options", ")", "{", "if", "(", "model", ".", "associatedViews", ")", "{", "model", ".", "associatedViews", ".", "push", "(", "view", ")", ";", "}", "else", "{", "model", ".", "associatedViews", "=", "[", "...
Helper to mix in validation on a model. Stores the view in the associated views array.
[ "Helper", "to", "mix", "in", "validation", "on", "a", "model", ".", "Stores", "the", "view", "in", "the", "associated", "views", "array", "." ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L328-L335
train
thedersen/backbone.validation
dist/backbone-validation.js
function(model, view) { if (view && model.associatedViews && model.associatedViews.length > 1){ model.associatedViews = _.without(model.associatedViews, view); } else { delete model.validate; delete model.preValidate; delete model.isValid; delete model.associatedViews...
javascript
function(model, view) { if (view && model.associatedViews && model.associatedViews.length > 1){ model.associatedViews = _.without(model.associatedViews, view); } else { delete model.validate; delete model.preValidate; delete model.isValid; delete model.associatedViews...
[ "function", "(", "model", ",", "view", ")", "{", "if", "(", "view", "&&", "model", ".", "associatedViews", "&&", "model", ".", "associatedViews", ".", "length", ">", "1", ")", "{", "model", ".", "associatedViews", "=", "_", ".", "without", "(", "model"...
Removes view from associated views of the model or the methods added to a model if no view or single view provided
[ "Removes", "view", "from", "associated", "views", "of", "the", "model", "or", "the", "methods", "added", "to", "a", "model", "if", "no", "view", "or", "single", "view", "provided" ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L339-L348
train
thedersen/backbone.validation
dist/backbone-validation.js
function(view, options) { options = _.extend({}, defaultOptions, defaultCallbacks, options); var model = options.model || view.model, collection = options.collection || view.collection; if(typeof model === 'undefined' && typeof collection === 'undefined'){ throw 'Before y...
javascript
function(view, options) { options = _.extend({}, defaultOptions, defaultCallbacks, options); var model = options.model || view.model, collection = options.collection || view.collection; if(typeof model === 'undefined' && typeof collection === 'undefined'){ throw 'Before y...
[ "function", "(", "view", ",", "options", ")", "{", "options", "=", "_", ".", "extend", "(", "{", "}", ",", "defaultOptions", ",", "defaultCallbacks", ",", "options", ")", ";", "var", "model", "=", "options", ".", "model", "||", "view", ".", "model", ...
Hooks up validation on a view with a model or collection
[ "Hooks", "up", "validation", "on", "a", "view", "with", "a", "model", "or", "collection" ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L375-L396
train
thedersen/backbone.validation
dist/backbone-validation.js
function(view, options) { options = _.extend({}, options); var model = options.model || view.model, collection = options.collection || view.collection; if(model) { unbindModel(model, view); } else if(collection) { collection.each(function(model){ ...
javascript
function(view, options) { options = _.extend({}, options); var model = options.model || view.model, collection = options.collection || view.collection; if(model) { unbindModel(model, view); } else if(collection) { collection.each(function(model){ ...
[ "function", "(", "view", ",", "options", ")", "{", "options", "=", "_", ".", "extend", "(", "{", "}", ",", "options", ")", ";", "var", "model", "=", "options", ".", "model", "||", "view", ".", "model", ",", "collection", "=", "options", ".", "colle...
Removes validation from a view with a model or collection
[ "Removes", "validation", "from", "a", "view", "with", "a", "model", "or", "collection" ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L400-L415
train
thedersen/backbone.validation
dist/backbone-validation.js
function(view, attr, error, selector) { view.$('[' + selector + '~="' + attr + '"]') .addClass('invalid') .attr('data-error', error); }
javascript
function(view, attr, error, selector) { view.$('[' + selector + '~="' + attr + '"]') .addClass('invalid') .attr('data-error', error); }
[ "function", "(", "view", ",", "attr", ",", "error", ",", "selector", ")", "{", "view", ".", "$", "(", "'['", "+", "selector", "+", "'~=\"'", "+", "attr", "+", "'\"]'", ")", ".", "addClass", "(", "'invalid'", ")", ".", "attr", "(", "'data-error'", "...
Gets called when a field in the view becomes invalid. Adds a error message. Should be overridden with custom functionality.
[ "Gets", "called", "when", "a", "field", "in", "the", "view", "becomes", "invalid", ".", "Adds", "a", "error", "message", ".", "Should", "be", "overridden", "with", "custom", "functionality", "." ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L441-L445
train
thedersen/backbone.validation
dist/backbone-validation.js
function(attrName) { return attrName.replace(/(?:^\w|[A-Z]|\b\w)/g, function(match, index) { return index === 0 ? match.toUpperCase() : ' ' + match.toLowerCase(); }).replace(/_/g, ' '); }
javascript
function(attrName) { return attrName.replace(/(?:^\w|[A-Z]|\b\w)/g, function(match, index) { return index === 0 ? match.toUpperCase() : ' ' + match.toLowerCase(); }).replace(/_/g, ' '); }
[ "function", "(", "attrName", ")", "{", "return", "attrName", ".", "replace", "(", "/", "(?:^\\w|[A-Z]|\\b\\w)", "/", "g", ",", "function", "(", "match", ",", "index", ")", "{", "return", "index", "===", "0", "?", "match", ".", "toUpperCase", "(", ")", ...
Converts attributeName or attribute_name to Attribute name
[ "Converts", "attributeName", "or", "attribute_name", "to", "Attribute", "name" ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L510-L514
train
thedersen/backbone.validation
dist/backbone-validation.js
function(value){ return _.isNumber(value) || (_.isString(value) && value.match(defaultPatterns.number)); }
javascript
function(value){ return _.isNumber(value) || (_.isString(value) && value.match(defaultPatterns.number)); }
[ "function", "(", "value", ")", "{", "return", "_", ".", "isNumber", "(", "value", ")", "||", "(", "_", ".", "isString", "(", "value", ")", "&&", "value", ".", "match", "(", "defaultPatterns", ".", "number", ")", ")", ";", "}" ]
Determines whether or not a value is a number
[ "Determines", "whether", "or", "not", "a", "value", "is", "a", "number" ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L569-L571
train
thedersen/backbone.validation
dist/backbone-validation.js
function(value, attr, fn, model, computed) { if(_.isString(fn)){ fn = model[fn]; } return fn.call(model, value, attr, computed); }
javascript
function(value, attr, fn, model, computed) { if(_.isString(fn)){ fn = model[fn]; } return fn.call(model, value, attr, computed); }
[ "function", "(", "value", ",", "attr", ",", "fn", ",", "model", ",", "computed", ")", "{", "if", "(", "_", ".", "isString", "(", "fn", ")", ")", "{", "fn", "=", "model", "[", "fn", "]", ";", "}", "return", "fn", ".", "call", "(", "model", ","...
Function validator Lets you implement a custom function used for validation
[ "Function", "validator", "Lets", "you", "implement", "a", "custom", "function", "used", "for", "validation" ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L581-L586
train
thedersen/backbone.validation
dist/backbone-validation.js
function(value, attr, minValue, model) { if (!isNumber(value) || value < minValue) { return this.format(defaultMessages.min, this.formatLabel(attr, model), minValue); } }
javascript
function(value, attr, minValue, model) { if (!isNumber(value) || value < minValue) { return this.format(defaultMessages.min, this.formatLabel(attr, model), minValue); } }
[ "function", "(", "value", ",", "attr", ",", "minValue", ",", "model", ")", "{", "if", "(", "!", "isNumber", "(", "value", ")", "||", "value", "<", "minValue", ")", "{", "return", "this", ".", "format", "(", "defaultMessages", ".", "min", ",", "this",...
Min validator Validates that the value has to be a number and equal to or greater than the min value specified
[ "Min", "validator", "Validates", "that", "the", "value", "has", "to", "be", "a", "number", "and", "equal", "to", "or", "greater", "than", "the", "min", "value", "specified" ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L613-L617
train
thedersen/backbone.validation
dist/backbone-validation.js
function(value, attr, length, model) { if (!_.isString(value) || value.length !== length) { return this.format(defaultMessages.length, this.formatLabel(attr, model), length); } }
javascript
function(value, attr, length, model) { if (!_.isString(value) || value.length !== length) { return this.format(defaultMessages.length, this.formatLabel(attr, model), length); } }
[ "function", "(", "value", ",", "attr", ",", "length", ",", "model", ")", "{", "if", "(", "!", "_", ".", "isString", "(", "value", ")", "||", "value", ".", "length", "!==", "length", ")", "{", "return", "this", ".", "format", "(", "defaultMessages", ...
Length validator Validates that the value has to be a string with length equal to the length value specified
[ "Length", "validator", "Validates", "that", "the", "value", "has", "to", "be", "a", "string", "with", "length", "equal", "to", "the", "length", "value", "specified" ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L640-L644
train
thedersen/backbone.validation
dist/backbone-validation.js
function(value, attr, values, model) { if(!_.include(values, value)){ return this.format(defaultMessages.oneOf, this.formatLabel(attr, model), values.join(', ')); } }
javascript
function(value, attr, values, model) { if(!_.include(values, value)){ return this.format(defaultMessages.oneOf, this.formatLabel(attr, model), values.join(', ')); } }
[ "function", "(", "value", ",", "attr", ",", "values", ",", "model", ")", "{", "if", "(", "!", "_", ".", "include", "(", "values", ",", "value", ")", ")", "{", "return", "this", ".", "format", "(", "defaultMessages", ".", "oneOf", ",", "this", ".", ...
One of validator Validates that the value has to be equal to one of the elements in the specified array. Case sensitive matching
[ "One", "of", "validator", "Validates", "that", "the", "value", "has", "to", "be", "equal", "to", "one", "of", "the", "elements", "in", "the", "specified", "array", ".", "Case", "sensitive", "matching" ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L676-L680
train
thedersen/backbone.validation
dist/backbone-validation.js
function(value, attr, equalTo, model, computed) { if(value !== computed[equalTo]) { return this.format(defaultMessages.equalTo, this.formatLabel(attr, model), this.formatLabel(equalTo, model)); } }
javascript
function(value, attr, equalTo, model, computed) { if(value !== computed[equalTo]) { return this.format(defaultMessages.equalTo, this.formatLabel(attr, model), this.formatLabel(equalTo, model)); } }
[ "function", "(", "value", ",", "attr", ",", "equalTo", ",", "model", ",", "computed", ")", "{", "if", "(", "value", "!==", "computed", "[", "equalTo", "]", ")", "{", "return", "this", ".", "format", "(", "defaultMessages", ".", "equalTo", ",", "this", ...
Equal to validator Validates that the value has to be equal to the value of the attribute with the name specified
[ "Equal", "to", "validator", "Validates", "that", "the", "value", "has", "to", "be", "equal", "to", "the", "value", "of", "the", "attribute", "with", "the", "name", "specified" ]
0ab7e3073841d9ed9dee96d38001cd5830bfe096
https://github.com/thedersen/backbone.validation/blob/0ab7e3073841d9ed9dee96d38001cd5830bfe096/dist/backbone-validation.js#L685-L689
train
balor/connect-memcached
lib/connect-memcached.js
MemcachedStore
function MemcachedStore(options) { options = options || {}; Store.call(this, options); this.prefix = options.prefix || ""; this.ttl = options.ttl; if (!options.client) { if (!options.hosts) { options.hosts = "127.0.0.1:11211"; } if (options.secret) { (this.crypto =...
javascript
function MemcachedStore(options) { options = options || {}; Store.call(this, options); this.prefix = options.prefix || ""; this.ttl = options.ttl; if (!options.client) { if (!options.hosts) { options.hosts = "127.0.0.1:11211"; } if (options.secret) { (this.crypto =...
[ "function", "MemcachedStore", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "Store", ".", "call", "(", "this", ",", "options", ")", ";", "this", ".", "prefix", "=", "options", ".", "prefix", "||", "\"\"", ";", "this", ".",...
Initialize MemcachedStore with the given `options`. @param {Object} options @api public
[ "Initialize", "MemcachedStore", "with", "the", "given", "options", "." ]
5116ea30a6d15e7373de7d47cadc9fb5dd56cdf9
https://github.com/balor/connect-memcached/blob/5116ea30a6d15e7373de7d47cadc9fb5dd56cdf9/lib/connect-memcached.js#L32-L53
train
postcss/postcss-selector-parser
src/tokenize.js
consumeWord
function consumeWord (css, start) { let next = start; let code; do { code = css.charCodeAt(next); if (wordDelimiters[code]) { return next - 1; } else if (code === t.backslash) { next = consumeEscape(css, next) + 1; } else { // All other cha...
javascript
function consumeWord (css, start) { let next = start; let code; do { code = css.charCodeAt(next); if (wordDelimiters[code]) { return next - 1; } else if (code === t.backslash) { next = consumeEscape(css, next) + 1; } else { // All other cha...
[ "function", "consumeWord", "(", "css", ",", "start", ")", "{", "let", "next", "=", "start", ";", "let", "code", ";", "do", "{", "code", "=", "css", ".", "charCodeAt", "(", "next", ")", ";", "if", "(", "wordDelimiters", "[", "code", "]", ")", "{", ...
Returns the last index of the bar css word @param {string} css The string in which the word begins @param {number} start The index into the string where word's first letter occurs
[ "Returns", "the", "last", "index", "of", "the", "bar", "css", "word" ]
190f9bc0bf22ad02102e974b17c5e6989a069b8c
https://github.com/postcss/postcss-selector-parser/blob/190f9bc0bf22ad02102e974b17c5e6989a069b8c/src/tokenize.js#L50-L65
train
postcss/postcss-selector-parser
src/tokenize.js
consumeEscape
function consumeEscape (css, start) { let next = start; let code = css.charCodeAt(next + 1); if (unescapable[code]) { // just consume the escape char } else if (hex[code]) { let hexDigits = 0; // consume up to 6 hex chars do { next++; hexDigits++; ...
javascript
function consumeEscape (css, start) { let next = start; let code = css.charCodeAt(next + 1); if (unescapable[code]) { // just consume the escape char } else if (hex[code]) { let hexDigits = 0; // consume up to 6 hex chars do { next++; hexDigits++; ...
[ "function", "consumeEscape", "(", "css", ",", "start", ")", "{", "let", "next", "=", "start", ";", "let", "code", "=", "css", ".", "charCodeAt", "(", "next", "+", "1", ")", ";", "if", "(", "unescapable", "[", "code", "]", ")", "{", "// just consume t...
Returns the last index of the escape sequence @param {string} css The string in which the sequence begins @param {number} start The index into the string where escape character (`\`) occurs.
[ "Returns", "the", "last", "index", "of", "the", "escape", "sequence" ]
190f9bc0bf22ad02102e974b17c5e6989a069b8c
https://github.com/postcss/postcss-selector-parser/blob/190f9bc0bf22ad02102e974b17c5e6989a069b8c/src/tokenize.js#L72-L94
train
BohdanTkachenko/webpack-split-by-path
index.js
findMatchingBucket
function findMatchingBucket(mod, ignore, bucketsContext) { var match = null; if (!mod.resource) { return match; } var resourcePath = mod.resource; for (var i in ignore) { if (ignore[i].test(resourcePath)) { return match; } } bucketsContext.some(function (bucket) { return bucket.pa...
javascript
function findMatchingBucket(mod, ignore, bucketsContext) { var match = null; if (!mod.resource) { return match; } var resourcePath = mod.resource; for (var i in ignore) { if (ignore[i].test(resourcePath)) { return match; } } bucketsContext.some(function (bucket) { return bucket.pa...
[ "function", "findMatchingBucket", "(", "mod", ",", "ignore", ",", "bucketsContext", ")", "{", "var", "match", "=", "null", ";", "if", "(", "!", "mod", ".", "resource", ")", "{", "return", "match", ";", "}", "var", "resourcePath", "=", "mod", ".", "reso...
test the target module whether it matches one of the user specified bucket paths @param {Module} mod @param {String[]} ignore @param {Bucket[]} bucketsContext @returns {Bucket}
[ "test", "the", "target", "module", "whether", "it", "matches", "one", "of", "the", "user", "specified", "bucket", "paths" ]
a05adb83177e9309f900019019b63f29b7e18a08
https://github.com/BohdanTkachenko/webpack-split-by-path/blob/a05adb83177e9309f900019019b63f29b7e18a08/index.js#L156-L180
train
node-js-libs/node.io
lib/node.io/process_master.js
function () { if (job.pull_requests < worker_count) { return false; } for (var i = 0; i < worker_count; i++) { if (!job.worker_complete[i]) { return false; } } return true; }
javascript
function () { if (job.pull_requests < worker_count) { return false; } for (var i = 0; i < worker_count; i++) { if (!job.worker_complete[i]) { return false; } } return true; }
[ "function", "(", ")", "{", "if", "(", "job", ".", "pull_requests", "<", "worker_count", ")", "{", "return", "false", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "worker_count", ";", "i", "++", ")", "{", "if", "(", "!", "job", "."...
Provide a method to check if workers are complete
[ "Provide", "a", "method", "to", "check", "if", "workers", "are", "complete" ]
000b51b46ff9658754d9f4a566d4b8d65f06b5be
https://github.com/node-js-libs/node.io/blob/000b51b46ff9658754d9f4a566d4b8d65f06b5be/lib/node.io/process_master.js#L64-L74
train
node-js-libs/node.io
lib/node.io/process_master.js
function () { //Check if any input was added dynamically if (job.input.length > 0) { job.is_complete = false; return false; } //Wait for workers or instances that are still working ...
javascript
function () { //Check if any input was added dynamically if (job.input.length > 0) { job.is_complete = false; return false; } //Wait for workers or instances that are still working ...
[ "function", "(", ")", "{", "//Check if any input was added dynamically", "if", "(", "job", ".", "input", ".", "length", ">", "0", ")", "{", "job", ".", "is_complete", "=", "false", ";", "return", "false", ";", "}", "//Wait for workers or instances that are still w...
No input? We might be done..
[ "No", "input?", "We", "might", "be", "done", ".." ]
000b51b46ff9658754d9f4a566d4b8d65f06b5be
https://github.com/node-js-libs/node.io/blob/000b51b46ff9658754d9f4a566d4b8d65f06b5be/lib/node.io/process_master.js#L123-L132
train
node-js-libs/node.io
lib/node.io/processor.js
function (options, start_as_slave) { isSlave = start_as_slave && !process.env._CHILD_ID_; isMaster = !start_as_slave && !process.env._CHILD_ID_; this.options = options || {}; this.jobs = {}; }
javascript
function (options, start_as_slave) { isSlave = start_as_slave && !process.env._CHILD_ID_; isMaster = !start_as_slave && !process.env._CHILD_ID_; this.options = options || {}; this.jobs = {}; }
[ "function", "(", "options", ",", "start_as_slave", ")", "{", "isSlave", "=", "start_as_slave", "&&", "!", "process", ".", "env", ".", "_CHILD_ID_", ";", "isMaster", "=", "!", "start_as_slave", "&&", "!", "process", ".", "env", ".", "_CHILD_ID_", ";", "this...
Create a new Processor with the specified options. @param {Object} options (optional) @param {Bool} start_as_slave (optional) @api public
[ "Create", "a", "new", "Processor", "with", "the", "specified", "options", "." ]
000b51b46ff9658754d9f4a566d4b8d65f06b5be
https://github.com/node-js-libs/node.io/blob/000b51b46ff9658754d9f4a566d4b8d65f06b5be/lib/node.io/processor.js#L25-L31
train
node-js-libs/node.io
lib/node.io/processor.js
function (job_name, job_obj) { //If we're capturing output, we need to explicitly override job.output() if (isMaster && capture_output) { var output = []; job_obj.output = function (out) { if (out instanceof Array && job_obj.options.flatten) { ...
javascript
function (job_name, job_obj) { //If we're capturing output, we need to explicitly override job.output() if (isMaster && capture_output) { var output = []; job_obj.output = function (out) { if (out instanceof Array && job_obj.options.flatten) { ...
[ "function", "(", "job_name", ",", "job_obj", ")", "{", "//If we're capturing output, we need to explicitly override job.output()", "if", "(", "isMaster", "&&", "capture_output", ")", "{", "var", "output", "=", "[", "]", ";", "job_obj", ".", "output", "=", "function"...
Callback for once we've loaded the job
[ "Callback", "for", "once", "we", "ve", "loaded", "the", "job" ]
000b51b46ff9658754d9f4a566d4b8d65f06b5be
https://github.com/node-js-libs/node.io/blob/000b51b46ff9658754d9f4a566d4b8d65f06b5be/lib/node.io/processor.js#L73-L105
train
node-js-libs/node.io
lib/node.io/io.js
function (path) { if (path[path.length - 1] === '/') { path = path.substr(0, path.length - 1); } return path; }
javascript
function (path) { if (path[path.length - 1] === '/') { path = path.substr(0, path.length - 1); } return path; }
[ "function", "(", "path", ")", "{", "if", "(", "path", "[", "path", ".", "length", "-", "1", "]", "===", "'/'", ")", "{", "path", "=", "path", ".", "substr", "(", "0", ",", "path", ".", "length", "-", "1", ")", ";", "}", "return", "path", ";",...
Trim trailing slash
[ "Trim", "trailing", "slash" ]
000b51b46ff9658754d9f4a566d4b8d65f06b5be
https://github.com/node-js-libs/node.io/blob/000b51b46ff9658754d9f4a566d4b8d65f06b5be/lib/node.io/io.js#L96-L101
train
node-js-libs/node.io
lib/node.io/utils.js
function (msg, type) { var cmd = type; switch (type) { case 'info': msg = '\x1B[33mINFO\x1B[0m: ' + msg; break; case 'debug': cmd = 'info'; msg = '\x1B[36mDEBUG\x1B[0m: ' + msg; break; case 'error': case 'fatal': cmd = 'erro...
javascript
function (msg, type) { var cmd = type; switch (type) { case 'info': msg = '\x1B[33mINFO\x1B[0m: ' + msg; break; case 'debug': cmd = 'info'; msg = '\x1B[36mDEBUG\x1B[0m: ' + msg; break; case 'error': case 'fatal': cmd = 'erro...
[ "function", "(", "msg", ",", "type", ")", "{", "var", "cmd", "=", "type", ";", "switch", "(", "type", ")", "{", "case", "'info'", ":", "msg", "=", "'\\x1B[33mINFO\\x1B[0m: '", "+", "msg", ";", "break", ";", "case", "'debug'", ":", "cmd", "=", "'info'...
Outputs a styled message to the console. @param {String} msg @param {String} type (optional) @api public
[ "Outputs", "a", "styled", "message", "to", "the", "console", "." ]
000b51b46ff9658754d9f4a566d4b8d65f06b5be
https://github.com/node-js-libs/node.io/blob/000b51b46ff9658754d9f4a566d4b8d65f06b5be/lib/node.io/utils.js#L18-L52
train
nickjj/manifest-revision-webpack-plugin
index.js
function (output, options) { this.output = output; this.options = options; // Set sane defaults for any options. this.options.rootAssetPath = options.rootAssetPath || './'; this.options.ignorePaths = options.ignorePaths || []; this.options.extensionsRegex = options.extensionsRegex || null; ...
javascript
function (output, options) { this.output = output; this.options = options; // Set sane defaults for any options. this.options.rootAssetPath = options.rootAssetPath || './'; this.options.ignorePaths = options.ignorePaths || []; this.options.extensionsRegex = options.extensionsRegex || null; ...
[ "function", "(", "output", ",", "options", ")", "{", "this", ".", "output", "=", "output", ";", "this", ".", "options", "=", "options", ";", "// Set sane defaults for any options.", "this", ".", "options", ".", "rootAssetPath", "=", "options", ".", "rootAssetP...
Produce a much slimmer version of webpack stats containing only information that you would be interested in when creating an asset manifest. @param {string} output - The output file path. @param {object} options - Options to configure this plugin.
[ "Produce", "a", "much", "slimmer", "version", "of", "webpack", "stats", "containing", "only", "information", "that", "you", "would", "be", "interested", "in", "when", "creating", "an", "asset", "manifest", "." ]
86f0b98fd795cc48c621c3ac32bf217f101703c3
https://github.com/nickjj/manifest-revision-webpack-plugin/blob/86f0b98fd795cc48c621c3ac32bf217f101703c3/index.js#L16-L25
train
fex-team/fis-command-release
lib/deploy.js
createDeployTasks
function createDeployTasks(depolyConfs, files, flaten){ var tasks = flaten ? [] : {}; fis.util.map(files, function(subpath, file) { fis.util.map(depolyConfs, function(name, depolyConf) { var target = flaten? tasks : (tasks[name] = tasks[name] || []); depolyCon...
javascript
function createDeployTasks(depolyConfs, files, flaten){ var tasks = flaten ? [] : {}; fis.util.map(files, function(subpath, file) { fis.util.map(depolyConfs, function(name, depolyConf) { var target = flaten? tasks : (tasks[name] = tasks[name] || []); depolyCon...
[ "function", "createDeployTasks", "(", "depolyConfs", ",", "files", ",", "flaten", ")", "{", "var", "tasks", "=", "flaten", "?", "[", "]", ":", "{", "}", ";", "fis", ".", "util", ".", "map", "(", "files", ",", "function", "(", "subpath", ",", "file", ...
create task for files @param {[type]} deploy config @param {[type]} files @param {[type]} tasks should wrap with deploy name or not @return {[type]}
[ "create", "task", "for", "files" ]
64dc5ad4971d22a950f6b1e61146a21d9d6161eb
https://github.com/fex-team/fis-command-release/blob/64dc5ad4971d22a950f6b1e61146a21d9d6161eb/lib/deploy.js#L200-L220
train
nikhilk/node-tensorflow
src/tensor.js
flattenList
function flattenList(list) { // Make a copy, so the original tensor is not modified. list = [].concat(list); // Note that i must be checked against the length of the list each time through the loop, as the // list is modified within the iterations. for (let i = 0; i < list.length; i++) { if (Array.isArra...
javascript
function flattenList(list) { // Make a copy, so the original tensor is not modified. list = [].concat(list); // Note that i must be checked against the length of the list each time through the loop, as the // list is modified within the iterations. for (let i = 0; i < list.length; i++) { if (Array.isArra...
[ "function", "flattenList", "(", "list", ")", "{", "// Make a copy, so the original tensor is not modified.", "list", "=", "[", "]", ".", "concat", "(", "list", ")", ";", "// Note that i must be checked against the length of the list each time through the loop, as the", "// list i...
Flatten the list. This is only relevant for multi-dimensional tensors.
[ "Flatten", "the", "list", ".", "This", "is", "only", "relevant", "for", "multi", "-", "dimensional", "tensors", "." ]
db0b0db423f0b8354d29819129c13ed3c8475971
https://github.com/nikhilk/node-tensorflow/blob/db0b0db423f0b8354d29819129c13ed3c8475971/src/tensor.js#L135-L154
train
node4good/formage
lib/controllers.js
upsertDocumentController
function upsertDocumentController(req, res) { var modelName = req.params.modelName, id = req.params.documentId, user = req.admin_user, data = _.extend({}, req.body, req.files), modelConfig = registry.mode...
javascript
function upsertDocumentController(req, res) { var modelName = req.params.modelName, id = req.params.documentId, user = req.admin_user, data = _.extend({}, req.body, req.files), modelConfig = registry.mode...
[ "function", "upsertDocumentController", "(", "req", ",", "res", ")", "{", "var", "modelName", "=", "req", ".", "params", ".", "modelName", ",", "id", "=", "req", ".", "params", ".", "documentId", ",", "user", "=", "req", ".", "admin_user", ",", "data", ...
In use by related-model-modal
[ "In", "use", "by", "related", "-", "model", "-", "modal" ]
9a6f4b6478402050940262507034b4545a2b4bbf
https://github.com/node4good/formage/blob/9a6f4b6478402050940262507034b4545a2b4bbf/lib/controllers.js#L122-L184
train
jamesdbloom/mockserver-client-node
mockServerClient.js
function (pathOrRequestMatcher, type) { if (type) { var typeEnum = ['EXPECTATIONS', 'LOG', 'ALL']; if (typeEnum.indexOf(type) === -1) { throw new Error("\"" + (type || "undefined") + "\" is not a supported value for \"type\" parameter only " + typeEnum + "...
javascript
function (pathOrRequestMatcher, type) { if (type) { var typeEnum = ['EXPECTATIONS', 'LOG', 'ALL']; if (typeEnum.indexOf(type) === -1) { throw new Error("\"" + (type || "undefined") + "\" is not a supported value for \"type\" parameter only " + typeEnum + "...
[ "function", "(", "pathOrRequestMatcher", ",", "type", ")", "{", "if", "(", "type", ")", "{", "var", "typeEnum", "=", "[", "'EXPECTATIONS'", ",", "'LOG'", ",", "'ALL'", "]", ";", "if", "(", "typeEnum", ".", "indexOf", "(", "type", ")", "===", "-", "1"...
Clear all recorded requests, expectations and logs that match the specified path @param pathOrRequestMatcher if a string is passed in the value will be treated as the path to decide what to clear, however if an object is passed in the value will be treated as a full request matcher object @param type ...
[ "Clear", "all", "recorded", "requests", "expectations", "and", "logs", "that", "match", "the", "specified", "path" ]
bd135bbbd53c9547599def7559f149752f24a21a
https://github.com/jamesdbloom/mockserver-client-node/blob/bd135bbbd53c9547599def7559f149752f24a21a/mockServerClient.js#L505-L513
train
jamesdbloom/mockserver-client-node
mockServerClient.js
function (ports) { if (!Array.isArray(ports)) { throw new Error("ports parameter must be an array but found: " + JSON.stringify(ports)); } return makeRequest(host, port, "/bind", {ports: ports}); }
javascript
function (ports) { if (!Array.isArray(ports)) { throw new Error("ports parameter must be an array but found: " + JSON.stringify(ports)); } return makeRequest(host, port, "/bind", {ports: ports}); }
[ "function", "(", "ports", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "ports", ")", ")", "{", "throw", "new", "Error", "(", "\"ports parameter must be an array but found: \"", "+", "JSON", ".", "stringify", "(", "ports", ")", ")", ";", "}", "...
Add new ports the server is bound to and listening on @param ports array of ports to bind to, use 0 to bind to any free port
[ "Add", "new", "ports", "the", "server", "is", "bound", "to", "and", "listening", "on" ]
bd135bbbd53c9547599def7559f149752f24a21a
https://github.com/jamesdbloom/mockserver-client-node/blob/bd135bbbd53c9547599def7559f149752f24a21a/mockServerClient.js#L519-L524
train
postmanlabs/postman-collection-transformer
lib/common/v1.js
function (data, legacy) { if (!data) { return; } var head, headers = [], statusValue = !legacy, match = regexes.header.exec(data), property = legacy ? 'enabled' : 'disabled'; data = data.toString().replace(regexes.fold, '$1'); while (mat...
javascript
function (data, legacy) { if (!data) { return; } var head, headers = [], statusValue = !legacy, match = regexes.header.exec(data), property = legacy ? 'enabled' : 'disabled'; data = data.toString().replace(regexes.fold, '$1'); while (mat...
[ "function", "(", "data", ",", "legacy", ")", "{", "if", "(", "!", "data", ")", "{", "return", ";", "}", "var", "head", ",", "headers", "=", "[", "]", ",", "statusValue", "=", "!", "legacy", ",", "match", "=", "regexes", ".", "header", ".", "exec"...
Parses a string of headers to an object. @param {String} data - A string of newline concatenated header key-value pairs. @param {?Boolean} [legacy] - A flag to indicate whether the parsing is being done for v1 normalization or v1 to v2 conversion. @returns {Object[]|*} - The parsed list of header key-value pair object...
[ "Parses", "a", "string", "of", "headers", "to", "an", "object", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/common/v1.js#L33-L60
train
postmanlabs/postman-collection-transformer
lib/index.js
function (collection, options, callback) { if (!options.outputVersion || !semver.valid(options.outputVersion, true)) { return callback(new Error('Output version not specified or invalid: ' + options.outputVersion)); } if (!options.inputVersion || !semver.valid(options.inputVersion, t...
javascript
function (collection, options, callback) { if (!options.outputVersion || !semver.valid(options.outputVersion, true)) { return callback(new Error('Output version not specified or invalid: ' + options.outputVersion)); } if (!options.inputVersion || !semver.valid(options.inputVersion, t...
[ "function", "(", "collection", ",", "options", ",", "callback", ")", "{", "if", "(", "!", "options", ".", "outputVersion", "||", "!", "semver", ".", "valid", "(", "options", ".", "outputVersion", ",", "true", ")", ")", "{", "return", "callback", "(", "...
Converts a Collection between different versions, based on the given input. @param {Object} collection - The collection object to be converted. @param {Object} options - The set of conversion options. @param {String} options.outputVersion - The version to convert to. @param {String} options.inputVersion - The version ...
[ "Converts", "a", "Collection", "between", "different", "versions", "based", "on", "the", "given", "input", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/index.js#L18-L27
train
postmanlabs/postman-collection-transformer
lib/index.js
function (object, options, callback) { if (!options.outputVersion || !semver.valid(options.outputVersion, true)) { return callback(new Error('Output version not specified or invalid: ' + options.outputVersion)); } if (!options.inputVersion || !semver.valid(options.inputVersion, true)...
javascript
function (object, options, callback) { if (!options.outputVersion || !semver.valid(options.outputVersion, true)) { return callback(new Error('Output version not specified or invalid: ' + options.outputVersion)); } if (!options.inputVersion || !semver.valid(options.inputVersion, true)...
[ "function", "(", "object", ",", "options", ",", "callback", ")", "{", "if", "(", "!", "options", ".", "outputVersion", "||", "!", "semver", ".", "valid", "(", "options", ".", "outputVersion", ",", "true", ")", ")", "{", "return", "callback", "(", "new"...
Converts a single V1 request to a V2 Item, or a V2 item to a single V1 request. @param {Object} object - A V1 request or a V2 item. @param {Object} options - The set of options for response conversion. @param {String} options.outputVersion - The version to convert to. @param {String} options.inputVersion - The version...
[ "Converts", "a", "single", "V1", "request", "to", "a", "V2", "Item", "or", "a", "V2", "item", "to", "a", "single", "V1", "request", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/index.js#L67-L76
train
postmanlabs/postman-collection-transformer
lib/normalizers/v1.js
function (entityV1, options) { if (!entityV1) { return; } var auth, params, mapper, currentHelper, helperAttributes, prioritizeV2 = this.options.prioritizeV2; // if prioritize v2 is true, use auth as the source of truth if (ut...
javascript
function (entityV1, options) { if (!entityV1) { return; } var auth, params, mapper, currentHelper, helperAttributes, prioritizeV2 = this.options.prioritizeV2; // if prioritize v2 is true, use auth as the source of truth if (ut...
[ "function", "(", "entityV1", ",", "options", ")", "{", "if", "(", "!", "entityV1", ")", "{", "return", ";", "}", "var", "auth", ",", "params", ",", "mapper", ",", "currentHelper", ",", "helperAttributes", ",", "prioritizeV2", "=", "this", ".", "options",...
Normalizes inherited v1 auth manifests. @param {Object} entityV1 - A v1 compliant wrapped auth manifest. @param {?Object} options - The set of options for the current auth cleansing operation. @param {?Boolean} [options.includeNoauth=false] - When set to true, noauth is set to ''. @returns {Object} - A v1 compliant s...
[ "Normalizes", "inherited", "v1", "auth", "manifests", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/normalizers/v1.js#L63-L95
train
postmanlabs/postman-collection-transformer
lib/normalizers/v1.js
function (requestV1) { if (!requestV1) { return; } var mode = requestV1.dataMode, noDefaults = this.options.noDefaults, retainEmptyValues = this.options.retainEmptyValues; if ((!mode || mode === 'binary') && !noDefaults) { return retainEmptyValues ? [] : und...
javascript
function (requestV1) { if (!requestV1) { return; } var mode = requestV1.dataMode, noDefaults = this.options.noDefaults, retainEmptyValues = this.options.retainEmptyValues; if ((!mode || mode === 'binary') && !noDefaults) { return retainEmptyValues ? [] : und...
[ "function", "(", "requestV1", ")", "{", "if", "(", "!", "requestV1", ")", "{", "return", ";", "}", "var", "mode", "=", "requestV1", ".", "dataMode", ",", "noDefaults", "=", "this", ".", "options", ".", "noDefaults", ",", "retainEmptyValues", "=", "this",...
Sanitizes request v1 data. @param {Object} requestV1 - The wrapper v1 request object around the data list to be sanitized. @returns {Object[]} - The normalized list of request body parameters.
[ "Sanitizes", "request", "v1", "data", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/normalizers/v1.js#L149-L170
train
postmanlabs/postman-collection-transformer
lib/normalizers/v1.js
function (requestV1) { if (!requestV1) { return; } if (requestV1.headers && _.isEmpty(requestV1.headerData)) { // this converts a newline concatenated string of headers to an array, so there are no descriptions return v1Common.parseHeaders(requestV1.headers, true); } ...
javascript
function (requestV1) { if (!requestV1) { return; } if (requestV1.headers && _.isEmpty(requestV1.headerData)) { // this converts a newline concatenated string of headers to an array, so there are no descriptions return v1Common.parseHeaders(requestV1.headers, true); } ...
[ "function", "(", "requestV1", ")", "{", "if", "(", "!", "requestV1", ")", "{", "return", ";", "}", "if", "(", "requestV1", ".", "headers", "&&", "_", ".", "isEmpty", "(", "requestV1", ".", "headerData", ")", ")", "{", "// this converts a newline concatenat...
Normalizes a list of header data from the incoming raw v1 request. @param {Object} requestV1 - The raw v1 request object. @returns {Object[]} - The normalized list of header datum values.
[ "Normalizes", "a", "list", "of", "header", "data", "from", "the", "incoming", "raw", "v1", "request", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/normalizers/v1.js#L178-L187
train
postmanlabs/postman-collection-transformer
lib/normalizers/v1.js
function (responseV1) { var self = this; // if noDefaults is true, do not replace the id // else // if id is falsy, replace the id // if retainIds is false, replace the id !((self.options.retainIds && responseV1.id) || self.options.noDefaults) && (responseV1.id = util.ui...
javascript
function (responseV1) { var self = this; // if noDefaults is true, do not replace the id // else // if id is falsy, replace the id // if retainIds is false, replace the id !((self.options.retainIds && responseV1.id) || self.options.noDefaults) && (responseV1.id = util.ui...
[ "function", "(", "responseV1", ")", "{", "var", "self", "=", "this", ";", "// if noDefaults is true, do not replace the id", "// else", "// if id is falsy, replace the id", "// if retainIds is false, replace the id", "!", "(", "(", "self", ".", "options", ".", "retainIds", ...
Normalizes a potentially raw v1 response object. @param {Object} responseV1 - The potentially raw v1 response object. @returns {Object} - The normalized v1 response object.
[ "Normalizes", "a", "potentially", "raw", "v1", "response", "object", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/normalizers/v1.js#L356-L374
train
postmanlabs/postman-collection-transformer
lib/normalizers/v1.js
function (collectionV1) { if (_.isEmpty(collectionV1 && collectionV1.folders)) { return; } var auth, events, variables, self = this, order, foldersOrder, retainEmpty = self.options.retainEmptyValues, varOpts = { noDefau...
javascript
function (collectionV1) { if (_.isEmpty(collectionV1 && collectionV1.folders)) { return; } var auth, events, variables, self = this, order, foldersOrder, retainEmpty = self.options.retainEmptyValues, varOpts = { noDefau...
[ "function", "(", "collectionV1", ")", "{", "if", "(", "_", ".", "isEmpty", "(", "collectionV1", "&&", "collectionV1", ".", "folders", ")", ")", "{", "return", ";", "}", "var", "auth", ",", "events", ",", "variables", ",", "self", "=", "this", ",", "o...
Normalizes a potentially raw v1 folders list. @param {Object} collectionV1 - The potentially raw v1 collection object. @returns {Object[]} - The normalized v1 collection folders list.
[ "Normalizes", "a", "potentially", "raw", "v1", "folders", "list", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/normalizers/v1.js#L414-L447
train
postmanlabs/postman-collection-transformer
lib/normalizers/v1.js
function (request, options, callback) { var err, normalized, builders = new Builders(options); // At this stage, mutate will not be passed ordinarily. Hence, the falsy nature of options.mutate can be used // to selectively clone the request. options && !options.m...
javascript
function (request, options, callback) { var err, normalized, builders = new Builders(options); // At this stage, mutate will not be passed ordinarily. Hence, the falsy nature of options.mutate can be used // to selectively clone the request. options && !options.m...
[ "function", "(", "request", ",", "options", ",", "callback", ")", "{", "var", "err", ",", "normalized", ",", "builders", "=", "new", "Builders", "(", "options", ")", ";", "// At this stage, mutate will not be passed ordinarily. Hence, the falsy nature of options.mutate ca...
Normalizes a single v1 request. @param {Object} request - The v1 request to be normalized. @param {Object} options - The set of options for the current normalization. @param {?Boolean} [options.mutate=false] - When set to true, normalization is done in place. @param {?Boolean} [options.noDefaults=false] - When set to ...
[ "Normalizes", "a", "single", "v1", "request", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/normalizers/v1.js#L483-L500
train
postmanlabs/postman-collection-transformer
lib/converters/index.js
function (inputVersion, outputVersion) { var converter; inputVersion = semver.clean(inputVersion); outputVersion = semver.clean(outputVersion); for (converter in this.converters) { // eslint-disable-next-line no-prototype-builtins converter = this.converters.has...
javascript
function (inputVersion, outputVersion) { var converter; inputVersion = semver.clean(inputVersion); outputVersion = semver.clean(outputVersion); for (converter in this.converters) { // eslint-disable-next-line no-prototype-builtins converter = this.converters.has...
[ "function", "(", "inputVersion", ",", "outputVersion", ")", "{", "var", "converter", ";", "inputVersion", "=", "semver", ".", "clean", "(", "inputVersion", ")", ";", "outputVersion", "=", "semver", ".", "clean", "(", "outputVersion", ")", ";", "for", "(", ...
Fetches a converter for the given input and output versions @param {String} inputVersion - The version to convert from. @param {String} outputVersion - The version to convert to. @returns {Converter} - A converter for the given set of options.
[ "Fetches", "a", "converter", "for", "the", "given", "input", "and", "output", "versions" ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/index.js#L73-L86
train
postmanlabs/postman-collection-transformer
lib/converters/index.js
function (collection, options, callback) { var chosenConverter = this.getConverter(options.inputVersion, options.outputVersion); if (!chosenConverter) { return callback(new Error('no conversion path found')); } return chosenConverter.convert(collection, options, callback); ...
javascript
function (collection, options, callback) { var chosenConverter = this.getConverter(options.inputVersion, options.outputVersion); if (!chosenConverter) { return callback(new Error('no conversion path found')); } return chosenConverter.convert(collection, options, callback); ...
[ "function", "(", "collection", ",", "options", ",", "callback", ")", "{", "var", "chosenConverter", "=", "this", ".", "getConverter", "(", "options", ".", "inputVersion", ",", "options", ".", "outputVersion", ")", ";", "if", "(", "!", "chosenConverter", ")",...
Picks the appropriate converter and converts the given collection. @param {Object} collection - The collection to be converted. @param {Object} options - The set of options for request conversion. @param {Function} callback - The function to be invoked after the completion of conversion process.
[ "Picks", "the", "appropriate", "converter", "and", "converts", "the", "given", "collection", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/index.js#L95-L103
train
postmanlabs/postman-collection-transformer
lib/converters/index.js
function (object, options, callback) { var chosenConverter = this.getConverter(options.inputVersion, options.outputVersion); if (!chosenConverter) { return callback(new Error('no conversion path found')); } return chosenConverter.convertSingle(object, options, callback); ...
javascript
function (object, options, callback) { var chosenConverter = this.getConverter(options.inputVersion, options.outputVersion); if (!chosenConverter) { return callback(new Error('no conversion path found')); } return chosenConverter.convertSingle(object, options, callback); ...
[ "function", "(", "object", ",", "options", ",", "callback", ")", "{", "var", "chosenConverter", "=", "this", ".", "getConverter", "(", "options", ".", "inputVersion", ",", "options", ".", "outputVersion", ")", ";", "if", "(", "!", "chosenConverter", ")", "...
Picks the appropriate converter and converts the given object. @param {Object} object - A single V1 request or a V2 Item. @param {Object} options - The set of options for request conversion. @param {Function} callback - The function to be invoked after the completion of conversion process.
[ "Picks", "the", "appropriate", "converter", "and", "converts", "the", "given", "object", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/index.js#L112-L120
train
postmanlabs/postman-collection-transformer
lib/converters/index.js
function (options) { var chosenConverter = this.getConverter(options.inputVersion, options.outputVersion); return chosenConverter.create(options); }
javascript
function (options) { var chosenConverter = this.getConverter(options.inputVersion, options.outputVersion); return chosenConverter.create(options); }
[ "function", "(", "options", ")", "{", "var", "chosenConverter", "=", "this", ".", "getConverter", "(", "options", ".", "inputVersion", ",", "options", ".", "outputVersion", ")", ";", "return", "chosenConverter", ".", "create", "(", "options", ")", ";", "}" ]
Returns a builder, which can be used to convert individual requests, etc. @param {Object} options - The set of options for builder creation. @returns {Function} - The builder for the given set of options.
[ "Returns", "a", "builder", "which", "can", "be", "used", "to", "convert", "individual", "requests", "etc", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/index.js#L146-L150
train
postmanlabs/postman-collection-transformer
lib/normalizers/index.js
function (collection, options, callback) { var version; if (!options || !(version = semver.valid(options.normalizeVersion, true)) || !normalizers[version]) { return callback(new Error('Version not specified or invalid: ' + options.normalizeVersion)); } return normalizers[ve...
javascript
function (collection, options, callback) { var version; if (!options || !(version = semver.valid(options.normalizeVersion, true)) || !normalizers[version]) { return callback(new Error('Version not specified or invalid: ' + options.normalizeVersion)); } return normalizers[ve...
[ "function", "(", "collection", ",", "options", ",", "callback", ")", "{", "var", "version", ";", "if", "(", "!", "options", "||", "!", "(", "version", "=", "semver", ".", "valid", "(", "options", ".", "normalizeVersion", ",", "true", ")", ")", "||", ...
Accepts the arguments for normalization and invokes the appropriate normalizer with them. @param {Object} collection - The plain collection JSON to be normalized. @param {Object} options - A set of options for the current normalization. @param {String} options.normalizeVersion - The base collection schema version for ...
[ "Accepts", "the", "arguments", "for", "normalization", "and", "invokes", "the", "appropriate", "normalizer", "with", "them", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/normalizers/index.js#L24-L32
train
postmanlabs/postman-collection-transformer
lib/normalizers/index.js
function (object, options, callback) { var version; if (!options || !(version = semver.valid(options.normalizeVersion, true)) || !normalizers[version]) { return callback(new Error('Version not specified or invalid: ' + options.normalizeVersion)); } return normalizers[versio...
javascript
function (object, options, callback) { var version; if (!options || !(version = semver.valid(options.normalizeVersion, true)) || !normalizers[version]) { return callback(new Error('Version not specified or invalid: ' + options.normalizeVersion)); } return normalizers[versio...
[ "function", "(", "object", ",", "options", ",", "callback", ")", "{", "var", "version", ";", "if", "(", "!", "options", "||", "!", "(", "version", "=", "semver", ".", "valid", "(", "options", ".", "normalizeVersion", ",", "true", ")", ")", "||", "!",...
Normalizes a single request or item as per the provided version. @param {Object} object - The entity to be normalized. @param {Object} options - The set of options to be applied to the current normalization. @param {String} options.normalizeVersion - The base collection schema version for which to normalize. @param {?...
[ "Normalizes", "a", "single", "request", "or", "item", "as", "per", "the", "provided", "version", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/normalizers/index.js#L47-L55
train
postmanlabs/postman-collection-transformer
lib/normalizers/index.js
function (response, options, callback) { var version; if (!options || !(version = semver.valid(options.normalizeVersion, true)) || !normalizers[version]) { return callback(new Error('Version not specified or invalid: ' + options.normalizeVersion)); } return normalizers[vers...
javascript
function (response, options, callback) { var version; if (!options || !(version = semver.valid(options.normalizeVersion, true)) || !normalizers[version]) { return callback(new Error('Version not specified or invalid: ' + options.normalizeVersion)); } return normalizers[vers...
[ "function", "(", "response", ",", "options", ",", "callback", ")", "{", "var", "version", ";", "if", "(", "!", "options", "||", "!", "(", "version", "=", "semver", ".", "valid", "(", "options", ".", "normalizeVersion", ",", "true", ")", ")", "||", "!...
Normalizes a single response as per the provided version. @param {Object} response - The response to be normalized. @param {Object} options - The set of options to be applied to the current normalization. @param {String} options.normalizeVersion - The base collection schema version for which to normalize. @param {?Boo...
[ "Normalizes", "a", "single", "response", "as", "per", "the", "provided", "version", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/normalizers/index.js#L70-L78
train
postmanlabs/postman-collection-transformer
lib/util.js
function () { var n, r, E = '', H = '-'; // r = result , n = numeric variable for positional checks // if "n" is not 9 or 14 or 19 or 24 return a random number or 4 // if "n" is not 15 generate a random number from 0 to 15 // `(n ^ 20 ? 16 : 4)` := un...
javascript
function () { var n, r, E = '', H = '-'; // r = result , n = numeric variable for positional checks // if "n" is not 9 or 14 or 19 or 24 return a random number or 4 // if "n" is not 15 generate a random number from 0 to 15 // `(n ^ 20 ? 16 : 4)` := un...
[ "function", "(", ")", "{", "var", "n", ",", "r", ",", "E", "=", "''", ",", "H", "=", "'-'", ";", "// r = result , n = numeric variable for positional checks", "// if \"n\" is not 9 or 14 or 19 or 24 return a random number or 4", "// if \"n\" is not 15 generate a random number f...
Returns unique GUID on every call as per pseudo-number RFC4122 standards. @type {function} @returns {string}
[ "Returns", "unique", "GUID", "on", "every", "call", "as", "per", "pseudo", "-", "number", "RFC4122", "standards", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/util.js#L20-L35
train
postmanlabs/postman-collection-transformer
lib/util.js
function (entity, options, modifiers) { !options && (options = {}); var self = this, noDefaults = options.noDefaults, isV1 = modifiers && modifiers.isV1, retainEmpty = options.retainEmptyValues, source = entity && (entity.variables || entity.variable || (...
javascript
function (entity, options, modifiers) { !options && (options = {}); var self = this, noDefaults = options.noDefaults, isV1 = modifiers && modifiers.isV1, retainEmpty = options.retainEmptyValues, source = entity && (entity.variables || entity.variable || (...
[ "function", "(", "entity", ",", "options", ",", "modifiers", ")", "{", "!", "options", "&&", "(", "options", "=", "{", "}", ")", ";", "var", "self", "=", "this", ",", "noDefaults", "=", "options", ".", "noDefaults", ",", "isV1", "=", "modifiers", "&&...
A generic utility method to sanitize variable transformations across collection formats. @param {Object} entity - A generic object that could contain variable data. @param {?Object} options - The set of options for variable handling. @param {?Object} options.fallback - The fallback values to be used if no variables ar...
[ "A", "generic", "utility", "method", "to", "sanitize", "variable", "transformations", "across", "collection", "formats", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/util.js#L58-L84
train
postmanlabs/postman-collection-transformer
lib/util.js
function (entity, options) { !options && (options = {}); var auth = entity && entity.auth; if (auth === null) { return null; } // eslint-disable-line security/detect-possible-timing-attacks if (!(auth && auth.type)) { return; } if (auth.type === 'noauth') { return o...
javascript
function (entity, options) { !options && (options = {}); var auth = entity && entity.auth; if (auth === null) { return null; } // eslint-disable-line security/detect-possible-timing-attacks if (!(auth && auth.type)) { return; } if (auth.type === 'noauth') { return o...
[ "function", "(", "entity", ",", "options", ")", "{", "!", "options", "&&", "(", "options", "=", "{", "}", ")", ";", "var", "auth", "=", "entity", "&&", "entity", ".", "auth", ";", "if", "(", "auth", "===", "null", ")", "{", "return", "null", ";",...
Performs auth cleansing common to all sorts of auth transformations. @param {Object} entity - The wrapped auth entity to be cleaned. @param {?Object} options - The set of options for the current auth cleansing operation. @param {?Boolean} [options.excludeNoauth=false] - When set to true, noauth is set to null. @return...
[ "Performs", "auth", "cleansing", "common", "to", "all", "sorts", "of", "auth", "transformations", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/util.js#L94-L106
train
postmanlabs/postman-collection-transformer
lib/util.js
function (entity, options) { var type, result, self = this, auth = self.cleanAuth(entity, options); if (!auth) { return auth; } result = { type: (type = auth.type) }; if (type !== 'noauth') { result[type] = _.transform(auth[type], functi...
javascript
function (entity, options) { var type, result, self = this, auth = self.cleanAuth(entity, options); if (!auth) { return auth; } result = { type: (type = auth.type) }; if (type !== 'noauth') { result[type] = _.transform(auth[type], functi...
[ "function", "(", "entity", ",", "options", ")", "{", "var", "type", ",", "result", ",", "self", "=", "this", ",", "auth", "=", "self", ".", "cleanAuth", "(", "entity", ",", "options", ")", ";", "if", "(", "!", "auth", ")", "{", "return", "auth", ...
Transforms an array of auth params to their object equivalent. @param {Object} entity - The wrapper object for the array of auth params. @param {?Object} options - The set of options for the current auth cleansing operation. @param {?Boolean} [options.excludeNoauth=false] - When set to true, noauth is set to null. @re...
[ "Transforms", "an", "array", "of", "auth", "params", "to", "their", "object", "equivalent", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/util.js#L124-L141
train
postmanlabs/postman-collection-transformer
lib/util.js
function (entity, options) { var type, params, result, self = this, auth = self.cleanAuth(entity, options); if (!auth) { return auth; } result = { type: (type = auth.type) }; if (type !== 'noauth') { // @todo: Handle all non ...
javascript
function (entity, options) { var type, params, result, self = this, auth = self.cleanAuth(entity, options); if (!auth) { return auth; } result = { type: (type = auth.type) }; if (type !== 'noauth') { // @todo: Handle all non ...
[ "function", "(", "entity", ",", "options", ")", "{", "var", "type", ",", "params", ",", "result", ",", "self", "=", "this", ",", "auth", "=", "self", ".", "cleanAuth", "(", "entity", ",", "options", ")", ";", "if", "(", "!", "auth", ")", "{", "re...
Transforms an object of auth params to their array equivalent. @param {Object} entity - The wrapper object for the array of auth params. @param {?Object} options - The set of options for the current auth cleansing operation. @param {?Boolean} [options.excludeNoauth=false] - When set to true, noauth is set to null. @re...
[ "Transforms", "an", "object", "of", "auth", "params", "to", "their", "array", "equivalent", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/util.js#L151-L176
train
postmanlabs/postman-collection-transformer
lib/util.js
function (entity, options) { var type, result, self = this, auth = self.cleanAuth(entity, options); if (!auth) { return auth; } result = { type: (type = auth.type) }; if (type !== 'noauth') { result[type] = _.map(auth[type], function (pa...
javascript
function (entity, options) { var type, result, self = this, auth = self.cleanAuth(entity, options); if (!auth) { return auth; } result = { type: (type = auth.type) }; if (type !== 'noauth') { result[type] = _.map(auth[type], function (pa...
[ "function", "(", "entity", ",", "options", ")", "{", "var", "type", ",", "result", ",", "self", "=", "this", ",", "auth", "=", "self", ".", "cleanAuth", "(", "entity", ",", "options", ")", ";", "if", "(", "!", "auth", ")", "{", "return", "auth", ...
Sanitizes a collection SDK compliant auth list. @param {Object} entity - The wrapper entity for the auth manifest. @param {?Object} options - The set of options for the current auth cleansing operation. @param {?Boolean} [options.excludeNoauth=false] - When set to true, noauth is set to null. @returns {Object[]} - An ...
[ "Sanitizes", "a", "collection", "SDK", "compliant", "auth", "list", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/util.js#L186-L207
train
postmanlabs/postman-collection-transformer
lib/util.js
function (entityV1, type) { if (!entityV1) { return; } switch (type) { case 'event': return !(entityV1.tests || entityV1.preRequestScript); case 'auth': return _.has(entityV1, 'auth') && !(_.has(entityV1, 'currentHelper') || entityV1.helperAttribu...
javascript
function (entityV1, type) { if (!entityV1) { return; } switch (type) { case 'event': return !(entityV1.tests || entityV1.preRequestScript); case 'auth': return _.has(entityV1, 'auth') && !(_.has(entityV1, 'currentHelper') || entityV1.helperAttribu...
[ "function", "(", "entityV1", ",", "type", ")", "{", "if", "(", "!", "entityV1", ")", "{", "return", ";", "}", "switch", "(", "type", ")", "{", "case", "'event'", ":", "return", "!", "(", "entityV1", ".", "tests", "||", "entityV1", ".", "preRequestScr...
A helper function to determine if the provided v1 entity has legacy properties. @private @param {Object} entityV1 - The v1 entity to be checked for the presence of legacy properties. @param {String} type - The type of property to be adjudged against. @returns {Boolean|*} - A flag to indicate the legacy property status...
[ "A", "helper", "function", "to", "determine", "if", "the", "provided", "v1", "entity", "has", "legacy", "properties", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/util.js#L217-L228
train
postmanlabs/postman-collection-transformer
lib/util.js
function (source, destination) { var behavior = source && source.protocolProfileBehavior; if (!(behavior && typeof behavior === 'object')) { return false; } destination && (destination.protocolProfileBehavior = behavior); return true; }
javascript
function (source, destination) { var behavior = source && source.protocolProfileBehavior; if (!(behavior && typeof behavior === 'object')) { return false; } destination && (destination.protocolProfileBehavior = behavior); return true; }
[ "function", "(", "source", ",", "destination", ")", "{", "var", "behavior", "=", "source", "&&", "source", ".", "protocolProfileBehavior", ";", "if", "(", "!", "(", "behavior", "&&", "typeof", "behavior", "===", "'object'", ")", ")", "{", "return", "false"...
Validate protocolProfileBehavior property's value. @param {Object} source - A generic object that could contain the protocolProfileBehavior property. @param {?Object} destination - The destination object that needs the addition of protocolProfileBehavior. @returns {Boolean} - A Boolean value to decide whether to inclu...
[ "Validate", "protocolProfileBehavior", "property", "s", "value", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/util.js#L441-L449
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (collectionV1) { var info = { _postman_id: collectionV1.id || util.uid(), name: collectionV1.name }; if (collectionV1.description) { info.description = collectionV1.description; } else if (this.options.retainEmptyValues) { info.description = null; } ...
javascript
function (collectionV1) { var info = { _postman_id: collectionV1.id || util.uid(), name: collectionV1.name }; if (collectionV1.description) { info.description = collectionV1.description; } else if (this.options.retainEmptyValues) { info.description = null; } ...
[ "function", "(", "collectionV1", ")", "{", "var", "info", "=", "{", "_postman_id", ":", "collectionV1", ".", "id", "||", "util", ".", "uid", "(", ")", ",", "name", ":", "collectionV1", ".", "name", "}", ";", "if", "(", "collectionV1", ".", "description...
Constructs a V2 compatible "info" object from a V1 Postman Collection @param {Object} collectionV1 - A v1 collection to derive collection metadata from. @returns {Object} - The resultant v2 info object.
[ "Constructs", "a", "V2", "compatible", "info", "object", "from", "a", "V1", "Postman", "Collection" ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L79-L91
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (requestV1) { var queryParams = [], pathVariables = [], traversedVars = {}, queryParamAltered, traversedQueryParams = {}, parsed = util.urlparse(requestV1.url), retainEmpty = this.options.retainEmptyValues; // Merge query ...
javascript
function (requestV1) { var queryParams = [], pathVariables = [], traversedVars = {}, queryParamAltered, traversedQueryParams = {}, parsed = util.urlparse(requestV1.url), retainEmpty = this.options.retainEmptyValues; // Merge query ...
[ "function", "(", "requestV1", ")", "{", "var", "queryParams", "=", "[", "]", ",", "pathVariables", "=", "[", "]", ",", "traversedVars", "=", "{", "}", ",", "queryParamAltered", ",", "traversedQueryParams", "=", "{", "}", ",", "parsed", "=", "util", ".", ...
Constructs a V2 compatible URL object from a V1 request @param {Object} requestV1 - The source v1 request to extract the URL from. @returns {String|Object} - The resultant URL.
[ "Constructs", "a", "V2", "compatible", "URL", "object", "from", "a", "V1", "request" ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L112-L174
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (requestV1) { if (_.isArray(requestV1.headers)) { return requestV1.headers; } var headers = [], traversed = {}, headerData = requestV1.headerData || [], retainEmpty = this.options.retainEmptyValues; _.forEach(headerData, function...
javascript
function (requestV1) { if (_.isArray(requestV1.headers)) { return requestV1.headers; } var headers = [], traversed = {}, headerData = requestV1.headerData || [], retainEmpty = this.options.retainEmptyValues; _.forEach(headerData, function...
[ "function", "(", "requestV1", ")", "{", "if", "(", "_", ".", "isArray", "(", "requestV1", ".", "headers", ")", ")", "{", "return", "requestV1", ".", "headers", ";", "}", "var", "headers", "=", "[", "]", ",", "traversed", "=", "{", "}", ",", "header...
Constructs an array of Key-Values from a raw HTTP Header string. @param {Object} requestV1 - The v1 request to extract header information from. @returns {Object[]} - A list of header definition objects.
[ "Constructs", "an", "array", "of", "Key", "-", "Values", "from", "a", "raw", "HTTP", "Header", "string", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L192-L223
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (requestV1) { var modes = { urlencoded: 'urlencoded', params: 'formdata', raw: 'raw', binary: 'file' }, data = {}, rawModeData, dataMode = modes[requestV1.dataMode], retainEmpty =...
javascript
function (requestV1) { var modes = { urlencoded: 'urlencoded', params: 'formdata', raw: 'raw', binary: 'file' }, data = {}, rawModeData, dataMode = modes[requestV1.dataMode], retainEmpty =...
[ "function", "(", "requestV1", ")", "{", "var", "modes", "=", "{", "urlencoded", ":", "'urlencoded'", ",", "params", ":", "'formdata'", ",", "raw", ":", "'raw'", ",", "binary", ":", "'file'", "}", ",", "data", "=", "{", "}", ",", "rawModeData", ",", "...
Constructs a V2 Request compatible "body" object from a V1 Postman request @param {Object} requestV1 - The v1 request to extract the body from. @returns {{mode: *, content: (*|string)}}
[ "Constructs", "a", "V2", "Request", "compatible", "body", "object", "from", "a", "V1", "Postman", "request" ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L231-L302
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (entityV1) { if (!entityV1) { return; } // if prioritizeV2 is true, events is used as the source of truth if ((util.notLegacy(entityV1, 'event') || this.options.prioritizeV2) && !_.isEmpty(entityV1.events)) { // in v1, `events` is regarded as the source of truth if it exist...
javascript
function (entityV1) { if (!entityV1) { return; } // if prioritizeV2 is true, events is used as the source of truth if ((util.notLegacy(entityV1, 'event') || this.options.prioritizeV2) && !_.isEmpty(entityV1.events)) { // in v1, `events` is regarded as the source of truth if it exist...
[ "function", "(", "entityV1", ")", "{", "if", "(", "!", "entityV1", ")", "{", "return", ";", "}", "// if prioritizeV2 is true, events is used as the source of truth", "if", "(", "(", "util", ".", "notLegacy", "(", "entityV1", ",", "'event'", ")", "||", "this", ...
Constructs a V2 "events" object from a V1 Postman Request @param {Object} entityV1 - The v1 entity to extract script information from. @returns {Object[]|*}
[ "Constructs", "a", "V2", "events", "object", "from", "a", "V1", "Postman", "Request" ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L310-L358
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (requestV1) { var self = this, request = {}, retainEmpty = self.options.retainEmptyValues, units = ['auth', 'method', 'header', 'body', 'url']; units.forEach(function (unit) { request[unit] = self[unit](requestV1); }); if (reques...
javascript
function (requestV1) { var self = this, request = {}, retainEmpty = self.options.retainEmptyValues, units = ['auth', 'method', 'header', 'body', 'url']; units.forEach(function (unit) { request[unit] = self[unit](requestV1); }); if (reques...
[ "function", "(", "requestV1", ")", "{", "var", "self", "=", "this", ",", "request", "=", "{", "}", ",", "retainEmpty", "=", "self", ".", "options", ".", "retainEmptyValues", ",", "units", "=", "[", "'auth'", ",", "'method'", ",", "'header'", ",", "'bod...
Creates a V2 format request from a V1 Postman Collection Request @param {Object} requestV1 - The v1 request to be transformed. @returns {Object} - The converted v2 request.
[ "Creates", "a", "V2", "format", "request", "from", "a", "V1", "Postman", "Collection", "Request" ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L409-L423
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (cookieV1) { return { expires: (new Date(cookieV1.expirationDate * 1000)).toString(), hostOnly: cookieV1.hostOnly, httpOnly: cookieV1.httpOnly, domain: cookieV1.domain, path: cookieV1.path, secure: cookieV1.secure, sess...
javascript
function (cookieV1) { return { expires: (new Date(cookieV1.expirationDate * 1000)).toString(), hostOnly: cookieV1.hostOnly, httpOnly: cookieV1.httpOnly, domain: cookieV1.domain, path: cookieV1.path, secure: cookieV1.secure, sess...
[ "function", "(", "cookieV1", ")", "{", "return", "{", "expires", ":", "(", "new", "Date", "(", "cookieV1", ".", "expirationDate", "*", "1000", ")", ")", ".", "toString", "(", ")", ",", "hostOnly", ":", "cookieV1", ".", "hostOnly", ",", "httpOnly", ":",...
Converts a V1 cookie to a V2 cookie. @param {Object} cookieV1 - The v1 cookie object to convert. @returns {{expires: string, hostOnly: *, httpOnly: *, domain: *, path: *, secure: *, session: *, value: *}}
[ "Converts", "a", "V1", "cookie", "to", "a", "V2", "cookie", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L431-L443
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (responseV1) { var self = this, associatedRequestId; if (responseV1.requestObject) { if (_.isString(responseV1.requestObject)) { try { return JSON.parse(responseV1.requestObject); } catch (e) { ...
javascript
function (responseV1) { var self = this, associatedRequestId; if (responseV1.requestObject) { if (_.isString(responseV1.requestObject)) { try { return JSON.parse(responseV1.requestObject); } catch (e) { ...
[ "function", "(", "responseV1", ")", "{", "var", "self", "=", "this", ",", "associatedRequestId", ";", "if", "(", "responseV1", ".", "requestObject", ")", "{", "if", "(", "_", ".", "isString", "(", "responseV1", ".", "requestObject", ")", ")", "{", "try",...
Gets the saved request for the given response, and handles edge cases between Apps & Sync Handles a lot of edge cases, so the code is not very clean. The Flow followed here is: If responseV1.requestObject is present If it is a string Try parsing it as JSON If parsed, return it else It is a request ID If responseV1.r...
[ "Gets", "the", "saved", "request", "for", "the", "given", "response", "and", "handles", "edge", "cases", "between", "Apps", "&", "Sync" ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L471-L507
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (responseV1) { var response = {}, self = this, originalRequest; originalRequest = self.savedRequest(responseV1); // add ids to the v2 result only if both: the id and retainIds are truthy. // this prevents successive exports to v2 from being overwhelmed ...
javascript
function (responseV1) { var response = {}, self = this, originalRequest; originalRequest = self.savedRequest(responseV1); // add ids to the v2 result only if both: the id and retainIds are truthy. // this prevents successive exports to v2 from being overwhelmed ...
[ "function", "(", "responseV1", ")", "{", "var", "response", "=", "{", "}", ",", "self", "=", "this", ",", "originalRequest", ";", "originalRequest", "=", "self", ".", "savedRequest", "(", "responseV1", ")", ";", "// add ids to the v2 result only if both: the id an...
Since a V2 response contains the entire associated request that was sent, creating the response means it also must use the V1 request. @param {Object} responseV1 - The response object to convert from v1 to v2. @returns {Object} - The v2 response object.
[ "Since", "a", "V2", "response", "contains", "the", "entire", "associated", "request", "that", "was", "sent", "creating", "the", "response", "means", "it", "also", "must", "use", "the", "V1", "request", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L516-L541
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (requestV1) { if (!requestV1) { return; } var self = this, units = ['request', 'response'], variable = self.variable(requestV1), item = { name: requestV1.name || '', // Inline building to avoid additional function call event: ...
javascript
function (requestV1) { if (!requestV1) { return; } var self = this, units = ['request', 'response'], variable = self.variable(requestV1), item = { name: requestV1.name || '', // Inline building to avoid additional function call event: ...
[ "function", "(", "requestV1", ")", "{", "if", "(", "!", "requestV1", ")", "{", "return", ";", "}", "var", "self", "=", "this", ",", "units", "=", "[", "'request'", ",", "'response'", "]", ",", "variable", "=", "self", ".", "variable", "(", "requestV1...
Creates a V2 compatible ``item`` from a V1 Postman Collection Request @param {Object} requestV1 - Postman collection V1 request. @returns {Object} - The converted request object, in v2 format.
[ "Creates", "a", "V2", "compatible", "item", "from", "a", "V1", "Postman", "Collection", "Request" ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L564-L586
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (collectionV1) { var self = this, items = [], itemGroupCache = {}, retainEmpty = self.options.retainEmptyValues; // Read all folder data, and prep it so that we can throw subfolders in the right places itemGroupCache = _.reduce(collectionV1.folders, ...
javascript
function (collectionV1) { var self = this, items = [], itemGroupCache = {}, retainEmpty = self.options.retainEmptyValues; // Read all folder data, and prep it so that we can throw subfolders in the right places itemGroupCache = _.reduce(collectionV1.folders, ...
[ "function", "(", "collectionV1", ")", "{", "var", "self", "=", "this", ",", "items", "=", "[", "]", ",", "itemGroupCache", "=", "{", "}", ",", "retainEmpty", "=", "self", ".", "options", ".", "retainEmptyValues", ";", "// Read all folder data, and prep it so t...
Constructs an array of Items & ItemGroups compatible with the V2 format. @param {Object} collectionV1 - The v1 collection to derive folder information from. @returns {Object[]} - The list of item group definitions.
[ "Constructs", "an", "array", "of", "Items", "&", "ItemGroups", "compatible", "with", "the", "V2", "format", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L594-L672
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (collectionV1) { var self = this, requestsCache = _.keyBy(collectionV1.requests, 'id'), allRequests = _.map(collectionV1.requests, 'id'), result; self.cache = requestsCache; result = self.itemGroups(collectionV1); _.forEach(_.intersection(co...
javascript
function (collectionV1) { var self = this, requestsCache = _.keyBy(collectionV1.requests, 'id'), allRequests = _.map(collectionV1.requests, 'id'), result; self.cache = requestsCache; result = self.itemGroups(collectionV1); _.forEach(_.intersection(co...
[ "function", "(", "collectionV1", ")", "{", "var", "self", "=", "this", ",", "requestsCache", "=", "_", ".", "keyBy", "(", "collectionV1", ".", "requests", ",", "'id'", ")", ",", "allRequests", "=", "_", ".", "map", "(", "collectionV1", ".", "requests", ...
Creates a V2 compatible array of items from a V1 Postman Collection @param {Object} collectionV1 - A Postman Collection object in the V1 format. @returns {Object[]} - The list of item groups (folders) in v2 format.
[ "Creates", "a", "V2", "compatible", "array", "of", "items", "from", "a", "V1", "Postman", "Collection" ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L680-L696
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (request, options, callback) { var builders = new Builders(options), converted, err; try { converted = builders.singleItem(_.cloneDeep(request)); } catch (e) { err = e; } if (callback) { return callbac...
javascript
function (request, options, callback) { var builders = new Builders(options), converted, err; try { converted = builders.singleItem(_.cloneDeep(request)); } catch (e) { err = e; } if (callback) { return callbac...
[ "function", "(", "request", ",", "options", ",", "callback", ")", "{", "var", "builders", "=", "new", "Builders", "(", "options", ")", ",", "converted", ",", "err", ";", "try", "{", "converted", "=", "builders", ".", "singleItem", "(", "_", ".", "clone...
Converts a single V1 request to a V2 item. @param {Object} request - The v1 request to convert to v2. @param {Object} options - The set of options for v1 -> v2 conversion. @param {Function} callback - The function to be invoked when the conversion has completed.
[ "Converts", "a", "single", "V1", "request", "to", "a", "V2", "item", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L711-L732
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v2.js
function (response, options, callback) { var builders = new Builders(options), converted, err; try { converted = builders.singleResponse(_.cloneDeep(response)); } catch (e) { err = e; } if (callback) { return c...
javascript
function (response, options, callback) { var builders = new Builders(options), converted, err; try { converted = builders.singleResponse(_.cloneDeep(response)); } catch (e) { err = e; } if (callback) { return c...
[ "function", "(", "response", ",", "options", ",", "callback", ")", "{", "var", "builders", "=", "new", "Builders", "(", "options", ")", ",", "converted", ",", "err", ";", "try", "{", "converted", "=", "builders", ".", "singleResponse", "(", "_", ".", "...
Converts a single V1 Response to a V2 Response. @param {Object} response - The v1 response to convert to v2. @param {Object} options - The set of options for v1 -> v2 conversion. @param {Function} callback - The function to be invoked when the conversion has completed.
[ "Converts", "a", "single", "V1", "Response", "to", "a", "V2", "Response", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v2.js#L741-L762
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v21.js
function (collectionV1) { var info = Builders.super_.prototype.info.call(this, collectionV1); info.schema = constants.SCHEMA_V2_1_0_URL; return info; }
javascript
function (collectionV1) { var info = Builders.super_.prototype.info.call(this, collectionV1); info.schema = constants.SCHEMA_V2_1_0_URL; return info; }
[ "function", "(", "collectionV1", ")", "{", "var", "info", "=", "Builders", ".", "super_", ".", "prototype", ".", "info", ".", "call", "(", "this", ",", "collectionV1", ")", ";", "info", ".", "schema", "=", "constants", ".", "SCHEMA_V2_1_0_URL", ";", "ret...
Derives v2.1.0 collection info from a v1.0.0 collection object. @param {Object} collectionV1 - The v1.0.0 collection object to be converted to v2.1.0. @return {Object} - The compiled v2.x collection info manifest.
[ "Derives", "v2", ".", "1", ".", "0", "collection", "info", "from", "a", "v1", ".", "0", ".", "0", "collection", "object", "." ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v21.js#L25-L31
train
postmanlabs/postman-collection-transformer
lib/converters/v1.0.0/converter-v1-to-v21.js
function (requestV1) { var v21Url = Builders.super_.prototype.url.call(this, requestV1); return _.isString(v21Url) ? url.parse(v21Url) : v21Url; }
javascript
function (requestV1) { var v21Url = Builders.super_.prototype.url.call(this, requestV1); return _.isString(v21Url) ? url.parse(v21Url) : v21Url; }
[ "function", "(", "requestV1", ")", "{", "var", "v21Url", "=", "Builders", ".", "super_", ".", "prototype", ".", "url", ".", "call", "(", "this", ",", "requestV1", ")", ";", "return", "_", ".", "isString", "(", "v21Url", ")", "?", "url", ".", "parse",...
Converts collection request urls from v1.0.0 to v2.1.0 @param {Object} requestV1 - The v1.0.0 request url to be converted to v2.1.0. @return {Object} - The objectified v2.1.0 compliant URL.
[ "Converts", "collection", "request", "urls", "from", "v1", ".", "0", ".", "0", "to", "v2", ".", "1", ".", "0" ]
5aef67c842651e7ad0851882f81f2fe48c0d7802
https://github.com/postmanlabs/postman-collection-transformer/blob/5aef67c842651e7ad0851882f81f2fe48c0d7802/lib/converters/v1.0.0/converter-v1-to-v21.js#L39-L43
train
PingPlusPlus/pingpp-nodejs
lib/PingppResource.js
PingppResource
function PingppResource(pingpp, urlData) { this._pingpp = pingpp; this._urlData = urlData || {}; this.basePath = utils.makeURLInterpolator(pingpp.getApiField('basePath')); this.path = utils.makeURLInterpolator(this.path); if (this.includeBasic) { this.includeBasic.forEach(function(methodName) { th...
javascript
function PingppResource(pingpp, urlData) { this._pingpp = pingpp; this._urlData = urlData || {}; this.basePath = utils.makeURLInterpolator(pingpp.getApiField('basePath')); this.path = utils.makeURLInterpolator(this.path); if (this.includeBasic) { this.includeBasic.forEach(function(methodName) { th...
[ "function", "PingppResource", "(", "pingpp", ",", "urlData", ")", "{", "this", ".", "_pingpp", "=", "pingpp", ";", "this", ".", "_urlData", "=", "urlData", "||", "{", "}", ";", "this", ".", "basePath", "=", "utils", ".", "makeURLInterpolator", "(", "ping...
Encapsulates request logic for a Pingpp Resource
[ "Encapsulates", "request", "logic", "for", "a", "Pingpp", "Resource" ]
f2a44d9e7441f581d2e34cc3f1ab1c4ef557ba7c
https://github.com/PingPlusPlus/pingpp-nodejs/blob/f2a44d9e7441f581d2e34cc3f1ab1c4ef557ba7c/lib/PingppResource.js#L23-L37
train
component/merge-descriptors
index.js
merge
function merge (dest, src, redefine) { if (!dest) { throw new TypeError('argument dest is required') } if (!src) { throw new TypeError('argument src is required') } if (redefine === undefined) { // Default to true redefine = true } Object.getOwnPropertyNames(src).forEach(function forEac...
javascript
function merge (dest, src, redefine) { if (!dest) { throw new TypeError('argument dest is required') } if (!src) { throw new TypeError('argument src is required') } if (redefine === undefined) { // Default to true redefine = true } Object.getOwnPropertyNames(src).forEach(function forEac...
[ "function", "merge", "(", "dest", ",", "src", ",", "redefine", ")", "{", "if", "(", "!", "dest", ")", "{", "throw", "new", "TypeError", "(", "'argument dest is required'", ")", "}", "if", "(", "!", "src", ")", "{", "throw", "new", "TypeError", "(", "...
Merge the property descriptors of `src` into `dest` @param {object} dest Object to add descriptors to @param {object} src Object to clone descriptors from @param {boolean} [redefine=true] Redefine `dest` properties with `src` properties @returns {object} Reference to dest @public
[ "Merge", "the", "property", "descriptors", "of", "src", "into", "dest" ]
dec51af1c9e3c1ee30e2258d7de9f676f5d30771
https://github.com/component/merge-descriptors/blob/dec51af1c9e3c1ee30e2258d7de9f676f5d30771/index.js#L34-L60
train
restify/clients
lib/helpers/timings.js
getTimings
function getTimings (eventTimes) { return { // There is no DNS lookup with IP address, can be null dnsLookup: getHrTimeDurationInMs( eventTimes.startAt, eventTimes.dnsLookupAt ), tcpConnection: getHrTimeDurationInMs( eventTimes.dnsLookupAt || event...
javascript
function getTimings (eventTimes) { return { // There is no DNS lookup with IP address, can be null dnsLookup: getHrTimeDurationInMs( eventTimes.startAt, eventTimes.dnsLookupAt ), tcpConnection: getHrTimeDurationInMs( eventTimes.dnsLookupAt || event...
[ "function", "getTimings", "(", "eventTimes", ")", "{", "return", "{", "// There is no DNS lookup with IP address, can be null", "dnsLookup", ":", "getHrTimeDurationInMs", "(", "eventTimes", ".", "startAt", ",", "eventTimes", ".", "dnsLookupAt", ")", ",", "tcpConnection", ...
Calculates HTTP timings @function getTimings @param {Object} eventTimes - Timings @param {Number} eventTimes.startAt - Request started @param {Number|undefined} eventTimes.dnsLookupAt - DNS resolved @param {Number} eventTimes.tcpConnectionAt - TCP connection estabilished @param {Number|undefined} eventTimes.tlsHandshak...
[ "Calculates", "HTTP", "timings" ]
ccb78a98bb5977db6a108cbdb52a5336ded07638
https://github.com/restify/clients/blob/ccb78a98bb5977db6a108cbdb52a5336ded07638/lib/helpers/timings.js#L38-L66
train
restify/clients
lib/index.js
normalizeOptions
function normalizeOptions(options) { var opts = {}; if (typeof options === 'string') { opts = { url: options }; } else if (_.isPlainObject(options)) { opts = _.clone(options); } return opts; }
javascript
function normalizeOptions(options) { var opts = {}; if (typeof options === 'string') { opts = { url: options }; } else if (_.isPlainObject(options)) { opts = _.clone(options); } return opts; }
[ "function", "normalizeOptions", "(", "options", ")", "{", "var", "opts", "=", "{", "}", ";", "if", "(", "typeof", "options", "===", "'string'", ")", "{", "opts", "=", "{", "url", ":", "options", "}", ";", "}", "else", "if", "(", "_", ".", "isPlainO...
normalize options. if options is a string, treat it as a url. otherwise clone it and return a new copy. @private @function normalizeOptions @param {Object | String} options a url string or options object @returns {Object}
[ "normalize", "options", ".", "if", "options", "is", "a", "string", "treat", "it", "as", "a", "url", ".", "otherwise", "clone", "it", "and", "return", "a", "new", "copy", "." ]
ccb78a98bb5977db6a108cbdb52a5336ded07638
https://github.com/restify/clients/blob/ccb78a98bb5977db6a108cbdb52a5336ded07638/lib/index.js#L104-L117
train
restify/clients
lib/helpers/bunyan.js
clientReq
function clientReq(req) { if (!req) { return (req); } var host; try { host = req.host.split(':')[0]; } catch (e) { host = false; } return ({ method: req ? req.method : false, url: req ? req.path : false, address: host, port: req ? re...
javascript
function clientReq(req) { if (!req) { return (req); } var host; try { host = req.host.split(':')[0]; } catch (e) { host = false; } return ({ method: req ? req.method : false, url: req ? req.path : false, address: host, port: req ? re...
[ "function", "clientReq", "(", "req", ")", "{", "if", "(", "!", "req", ")", "{", "return", "(", "req", ")", ";", "}", "var", "host", ";", "try", "{", "host", "=", "req", ".", "host", ".", "split", "(", "':'", ")", "[", "0", "]", ";", "}", "c...
a request serializer. returns a stripped down object for logging. @private @function clientReq @param {Object} req the request object @returns {Object}
[ "a", "request", "serializer", ".", "returns", "a", "stripped", "down", "object", "for", "logging", "." ]
ccb78a98bb5977db6a108cbdb52a5336ded07638
https://github.com/restify/clients/blob/ccb78a98bb5977db6a108cbdb52a5336ded07638/lib/helpers/bunyan.js#L225-L245
train
restify/clients
lib/helpers/bunyan.js
clientRes
function clientRes(res) { if (!res || !res.statusCode) { return (res); } return ({ statusCode: res.statusCode, headers: res.headers }); }
javascript
function clientRes(res) { if (!res || !res.statusCode) { return (res); } return ({ statusCode: res.statusCode, headers: res.headers }); }
[ "function", "clientRes", "(", "res", ")", "{", "if", "(", "!", "res", "||", "!", "res", ".", "statusCode", ")", "{", "return", "(", "res", ")", ";", "}", "return", "(", "{", "statusCode", ":", "res", ".", "statusCode", ",", "headers", ":", "res", ...
a response serializer. returns a stripped down object for logging. @private @function clientRes @param {Object} res the response object @returns {Object}
[ "a", "response", "serializer", ".", "returns", "a", "stripped", "down", "object", "for", "logging", "." ]
ccb78a98bb5977db6a108cbdb52a5336ded07638
https://github.com/restify/clients/blob/ccb78a98bb5977db6a108cbdb52a5336ded07638/lib/helpers/bunyan.js#L255-L264
train
restify/clients
lib/helpers/bunyan.js
createLogger
function createLogger(name) { return (bunyan.createLogger({ name: name, serializers: SERIALIZERS, streams: [ { level: 'warn', stream: process.stderr }, { level: 'debug', type: 'raw', ...
javascript
function createLogger(name) { return (bunyan.createLogger({ name: name, serializers: SERIALIZERS, streams: [ { level: 'warn', stream: process.stderr }, { level: 'debug', type: 'raw', ...
[ "function", "createLogger", "(", "name", ")", "{", "return", "(", "bunyan", ".", "createLogger", "(", "{", "name", ":", "name", ",", "serializers", ":", "SERIALIZERS", ",", "streams", ":", "[", "{", "level", ":", "'warn'", ",", "stream", ":", "process", ...
create a bunyan logger @public @function createLogger @param {String} name of the logger @returns {Object} bunyan logger
[ "create", "a", "bunyan", "logger" ]
ccb78a98bb5977db6a108cbdb52a5336ded07638
https://github.com/restify/clients/blob/ccb78a98bb5977db6a108cbdb52a5336ded07638/lib/helpers/bunyan.js#L311-L329
train
restify/clients
lib/HttpClient.js
isProxyForURL
function isProxyForURL(noProxy, address) { // wildcard if (noProxy === '*') { return (null); } // otherwise, parse the noProxy value to see if it applies to the URL if (noProxy !== null) { var noProxyItem, hostname, port, noProxyItemParts, noProxyHost, noProxyPort, noPro...
javascript
function isProxyForURL(noProxy, address) { // wildcard if (noProxy === '*') { return (null); } // otherwise, parse the noProxy value to see if it applies to the URL if (noProxy !== null) { var noProxyItem, hostname, port, noProxyItemParts, noProxyHost, noProxyPort, noPro...
[ "function", "isProxyForURL", "(", "noProxy", ",", "address", ")", "{", "// wildcard", "if", "(", "noProxy", "===", "'*'", ")", "{", "return", "(", "null", ")", ";", "}", "// otherwise, parse the noProxy value to see if it applies to the URL", "if", "(", "noProxy", ...
Check if url is excluded by the no_proxy environment variable
[ "Check", "if", "url", "is", "excluded", "by", "the", "no_proxy", "environment", "variable" ]
ccb78a98bb5977db6a108cbdb52a5336ded07638
https://github.com/restify/clients/blob/ccb78a98bb5977db6a108cbdb52a5336ded07638/lib/HttpClient.js#L551-L598
train
restify/clients
lib/helpers/errors.js
createHttpErr
function createHttpErr(statusCode, opts, req) { assert.number(statusCode, 'statusCode'); assert.object(opts, 'opts'); assert.object(req, 'req'); var errInfo = createErrInfo(opts, req); return restifyErrors.makeErrFromCode(statusCode, { info: errInfo }); }
javascript
function createHttpErr(statusCode, opts, req) { assert.number(statusCode, 'statusCode'); assert.object(opts, 'opts'); assert.object(req, 'req'); var errInfo = createErrInfo(opts, req); return restifyErrors.makeErrFromCode(statusCode, { info: errInfo }); }
[ "function", "createHttpErr", "(", "statusCode", ",", "opts", ",", "req", ")", "{", "assert", ".", "number", "(", "statusCode", ",", "'statusCode'", ")", ";", "assert", ".", "object", "(", "opts", ",", "'opts'", ")", ";", "assert", ".", "object", "(", "...
build an http error for a request that has a corresponding http status code on the response. @private @function createHttpErr @param {Object} statusCode response status code @param {Object} opts options object for a request @param {Object} req the request object @returns {verror.VError}
[ "build", "an", "http", "error", "for", "a", "request", "that", "has", "a", "corresponding", "http", "status", "code", "on", "the", "response", "." ]
ccb78a98bb5977db6a108cbdb52a5336ded07638
https://github.com/restify/clients/blob/ccb78a98bb5977db6a108cbdb52a5336ded07638/lib/helpers/errors.js#L84-L94
train
restify/clients
lib/helpers/errors.js
createRequestTimeoutErr
function createRequestTimeoutErr(opts, req) { assert.object(opts, 'opts'); assert.object(req, 'req'); var errInfo = createErrInfo(opts, req); var errMsg = [ opts.method, 'request to', errInfo.fullUrl, 'failed to complete within', opts.requestTimeout + 'ms' ]....
javascript
function createRequestTimeoutErr(opts, req) { assert.object(opts, 'opts'); assert.object(req, 'req'); var errInfo = createErrInfo(opts, req); var errMsg = [ opts.method, 'request to', errInfo.fullUrl, 'failed to complete within', opts.requestTimeout + 'ms' ]....
[ "function", "createRequestTimeoutErr", "(", "opts", ",", "req", ")", "{", "assert", ".", "object", "(", "opts", ",", "'opts'", ")", ";", "assert", ".", "object", "(", "req", ",", "'req'", ")", ";", "var", "errInfo", "=", "createErrInfo", "(", "opts", "...
build a request timeout error for a request that failed to complete within the specified timeout period. @private @function createRequestTimeoutErr @param {Object} opts options object for a request @param {Object} req the request object @returns {verror.VError} RequestTimeoutError
[ "build", "a", "request", "timeout", "error", "for", "a", "request", "that", "failed", "to", "complete", "within", "the", "specified", "timeout", "period", "." ]
ccb78a98bb5977db6a108cbdb52a5336ded07638
https://github.com/restify/clients/blob/ccb78a98bb5977db6a108cbdb52a5336ded07638/lib/helpers/errors.js#L106-L124
train
restify/clients
lib/helpers/errors.js
createTooManyRedirectsErr
function createTooManyRedirectsErr(opts, req) { assert.object(opts, 'opts'); assert.object(req, 'req'); var errInfo = createErrInfo(opts, req); var errMsg = [ 'aborted', opts.method, 'request to', errInfo.fullUrl, 'after', opts.redirects, 'redirec...
javascript
function createTooManyRedirectsErr(opts, req) { assert.object(opts, 'opts'); assert.object(req, 'req'); var errInfo = createErrInfo(opts, req); var errMsg = [ 'aborted', opts.method, 'request to', errInfo.fullUrl, 'after', opts.redirects, 'redirec...
[ "function", "createTooManyRedirectsErr", "(", "opts", ",", "req", ")", "{", "assert", ".", "object", "(", "opts", ",", "'opts'", ")", ";", "assert", ".", "object", "(", "req", ",", "'req'", ")", ";", "var", "errInfo", "=", "createErrInfo", "(", "opts", ...
build a redirect error for a request that encountered too many redirects when attempting to follow redirects. @private @function createRequestTimeoutErr @param {Object} opts options object for a request @param {Object} req the request object @returns {verror.VError} RequestTimeoutError
[ "build", "a", "redirect", "error", "for", "a", "request", "that", "encountered", "too", "many", "redirects", "when", "attempting", "to", "follow", "redirects", "." ]
ccb78a98bb5977db6a108cbdb52a5336ded07638
https://github.com/restify/clients/blob/ccb78a98bb5977db6a108cbdb52a5336ded07638/lib/helpers/errors.js#L136-L158
train
restify/clients
lib/helpers/errors.js
createErrInfo
function createErrInfo(opts, req) { assert.object(opts, 'opts'); assert.object(req, 'req'); return { // port and address can both be unpopulated - fall back on null so // that they can both be null (instead of req.remoteAddress // defaulting to undefined) address: req.remote...
javascript
function createErrInfo(opts, req) { assert.object(opts, 'opts'); assert.object(req, 'req'); return { // port and address can both be unpopulated - fall back on null so // that they can both be null (instead of req.remoteAddress // defaulting to undefined) address: req.remote...
[ "function", "createErrInfo", "(", "opts", ",", "req", ")", "{", "assert", ".", "object", "(", "opts", ",", "'opts'", ")", ";", "assert", ".", "object", "(", "req", ",", "'req'", ")", ";", "return", "{", "// port and address can both be unpopulated - fall back ...
create an info object for use with verror given the opts object used to issue the original request, along with the request object itself. @private @function createErrInfo @param {Object} opts an options object @param {Object} req a request object @returns {Object}
[ "create", "an", "info", "object", "for", "use", "with", "verror", "given", "the", "opts", "object", "used", "to", "issue", "the", "original", "request", "along", "with", "the", "request", "object", "itself", "." ]
ccb78a98bb5977db6a108cbdb52a5336ded07638
https://github.com/restify/clients/blob/ccb78a98bb5977db6a108cbdb52a5336ded07638/lib/helpers/errors.js#L218-L231
train
npm/fstream
lib/writer.js
Writer
function Writer (props, current) { var self = this if (typeof props === 'string') { props = { path: props } } // polymorphism. // call fstream.Writer(dir) to get a DirWriter object, etc. var type = getType(props) var ClassType = Writer switch (type) { case 'Directory': ClassType = DirWr...
javascript
function Writer (props, current) { var self = this if (typeof props === 'string') { props = { path: props } } // polymorphism. // call fstream.Writer(dir) to get a DirWriter object, etc. var type = getType(props) var ClassType = Writer switch (type) { case 'Directory': ClassType = DirWr...
[ "function", "Writer", "(", "props", ",", "current", ")", "{", "var", "self", "=", "this", "if", "(", "typeof", "props", "===", "'string'", ")", "{", "props", "=", "{", "path", ":", "props", "}", "}", "// polymorphism.", "// call fstream.Writer(dir) to get a ...
props is the desired state. current is optionally the current stat, provided here so that subclasses can avoid statting the target more than necessary.
[ "props", "is", "the", "desired", "state", ".", "current", "is", "optionally", "the", "current", "stat", "provided", "here", "so", "that", "subclasses", "can", "avoid", "statting", "the", "target", "more", "than", "necessary", "." ]
1e4527ffe8688d4f5325283d7cf2cf2d61f14c6b
https://github.com/npm/fstream/blob/1e4527ffe8688d4f5325283d7cf2cf2d61f14c6b/lib/writer.js#L26-L107
train