id
int32
0
58k
repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
26,300
basho/riak-nodejs-client
lib/commands/crdt/updatemap.js
function(key, state) { this._removeRemove(this.flags.remove, key); var op = this._getOp(this.flags.set, key); if (op) { op.state = state; } else { this.flags.set.push({key: key, state: state}); } return this; }
javascript
function(key, state) { this._removeRemove(this.flags.remove, key); var op = this._getOp(this.flags.set, key); if (op) { op.state = state; } else { this.flags.set.push({key: key, state: state}); } return this; }
[ "function", "(", "key", ",", "state", ")", "{", "this", ".", "_removeRemove", "(", "this", ".", "flags", ".", "remove", ",", "key", ")", ";", "var", "op", "=", "this", ".", "_getOp", "(", "this", ".", "flags", ".", "set", ",", "key", ")", ";", ...
Set a flag in a map. @method setFlag @param {String} key the key for the set in the map. @param {Boolean} value the value for the flag. @chainable}
[ "Set", "a", "flag", "in", "a", "map", "." ]
4823460b56b4defee69837995bde98e789b635bd
https://github.com/basho/riak-nodejs-client/blob/4823460b56b4defee69837995bde98e789b635bd/lib/commands/crdt/updatemap.js#L601-L610
26,301
basho/riak-nodejs-client
lib/commands/crdt/updatemap.js
function(key) { this._removeAddsOrRemoves(this.flags.set, key); if (this.flags.remove.indexOf(key) === -1) { this.flags.remove.push(key); } return this; }
javascript
function(key) { this._removeAddsOrRemoves(this.flags.set, key); if (this.flags.remove.indexOf(key) === -1) { this.flags.remove.push(key); } return this; }
[ "function", "(", "key", ")", "{", "this", ".", "_removeAddsOrRemoves", "(", "this", ".", "flags", ".", "set", ",", "key", ")", ";", "if", "(", "this", ".", "flags", ".", "remove", ".", "indexOf", "(", "key", ")", "===", "-", "1", ")", "{", "this"...
Remove a flag from a map. @method removeFlag @param {String} key the key for the flag in the map. @chainable
[ "Remove", "a", "flag", "from", "a", "map", "." ]
4823460b56b4defee69837995bde98e789b635bd
https://github.com/basho/riak-nodejs-client/blob/4823460b56b4defee69837995bde98e789b635bd/lib/commands/crdt/updatemap.js#L617-L623
26,302
basho/riak-nodejs-client
lib/commands/crdt/updatemap.js
function(key) { this._removeAddsOrRemoves(this.maps.modify, key); if (this.maps.remove.indexOf(key) === -1) { this.maps.remove.push(key); } return this; }
javascript
function(key) { this._removeAddsOrRemoves(this.maps.modify, key); if (this.maps.remove.indexOf(key) === -1) { this.maps.remove.push(key); } return this; }
[ "function", "(", "key", ")", "{", "this", ".", "_removeAddsOrRemoves", "(", "this", ".", "maps", ".", "modify", ",", "key", ")", ";", "if", "(", "this", ".", "maps", ".", "remove", ".", "indexOf", "(", "key", ")", "===", "-", "1", ")", "{", "this...
Remove a map from a map. @method removeMap @param {String} key the key for the map in the map. @chainable
[ "Remove", "a", "map", "from", "a", "map", "." ]
4823460b56b4defee69837995bde98e789b635bd
https://github.com/basho/riak-nodejs-client/blob/4823460b56b4defee69837995bde98e789b635bd/lib/commands/crdt/updatemap.js#L654-L660
26,303
basho/riak-nodejs-client
lib/core/riakcluster.js
function(nodes) { for (var i = 0; i < nodes.length; i++) { if (nodes[i] instanceof RiakNode) { this.nodes.push(nodes[i]); } } return this; }
javascript
function(nodes) { for (var i = 0; i < nodes.length; i++) { if (nodes[i] instanceof RiakNode) { this.nodes.push(nodes[i]); } } return this; }
[ "function", "(", "nodes", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "nodes", ".", "length", ";", "i", "++", ")", "{", "if", "(", "nodes", "[", "i", "]", "instanceof", "RiakNode", ")", "{", "this", ".", "nodes", ".", "push", "...
The RiakNodes to use. @method withRiakNodes @param {RiakNode[]} nodes array of (unstarted) {{#crossLink "RiakNode"}}{{/crossLink}} instances. @return {RiakCluster.Builder}
[ "The", "RiakNodes", "to", "use", "." ]
4823460b56b4defee69837995bde98e789b635bd
https://github.com/basho/riak-nodejs-client/blob/4823460b56b4defee69837995bde98e789b635bd/lib/core/riakcluster.js#L485-L492
26,304
d3plus/d3plus-react
bin/release.js
finishRelease
function finishRelease() { log.done(); execSync("npm run examples", {stdio: "inherit"}); execSync("npm run docs", {stdio: "inherit"}); let commits = "", releaseUrl = "", zipSize = 0; log.timer("compiling release notes"); execAsync("git log --pretty=format:'* %s (%h)' `git describe --tags --abbrev=0`...HEA...
javascript
function finishRelease() { log.done(); execSync("npm run examples", {stdio: "inherit"}); execSync("npm run docs", {stdio: "inherit"}); let commits = "", releaseUrl = "", zipSize = 0; log.timer("compiling release notes"); execAsync("git log --pretty=format:'* %s (%h)' `git describe --tags --abbrev=0`...HEA...
[ "function", "finishRelease", "(", ")", "{", "log", ".", "done", "(", ")", ";", "execSync", "(", "\"npm run examples\"", ",", "{", "stdio", ":", "\"inherit\"", "}", ")", ";", "execSync", "(", "\"npm run docs\"", ",", "{", "stdio", ":", "\"inherit\"", "}", ...
Final steps for release. @private
[ "Final", "steps", "for", "release", "." ]
5f1edc97c3156ca7b24d70bd655898cc0708d879
https://github.com/d3plus/d3plus-react/blob/5f1edc97c3156ca7b24d70bd655898cc0708d879/bin/release.js#L25-L98
26,305
basho/riak-nodejs-client
lib/core/riakconnection.js
initBuffer
function initBuffer(data) { // Create a new buffer to receive data if needed if (buffer === null) { buffer = new ByteBuffer(initBufferSize); } buffer.append(data); buffer.flip(); }
javascript
function initBuffer(data) { // Create a new buffer to receive data if needed if (buffer === null) { buffer = new ByteBuffer(initBufferSize); } buffer.append(data); buffer.flip(); }
[ "function", "initBuffer", "(", "data", ")", "{", "// Create a new buffer to receive data if needed", "if", "(", "buffer", "===", "null", ")", "{", "buffer", "=", "new", "ByteBuffer", "(", "initBufferSize", ")", ";", "}", "buffer", ".", "append", "(", "data", "...
private buffer functions
[ "private", "buffer", "functions" ]
4823460b56b4defee69837995bde98e789b635bd
https://github.com/basho/riak-nodejs-client/blob/4823460b56b4defee69837995bde98e789b635bd/lib/core/riakconnection.js#L159-L166
26,306
basho/riak-nodejs-client
lib/core/riaknode.js
function (addresses, options) { var riakNodes = []; if (options === undefined) { options = {}; } for (var i = 0; i < addresses.length; i++) { var split = addresses[i].split(':'); options.remoteAddress = split[0]; if (split.length === 2) { options.remotePort ...
javascript
function (addresses, options) { var riakNodes = []; if (options === undefined) { options = {}; } for (var i = 0; i < addresses.length; i++) { var split = addresses[i].split(':'); options.remoteAddress = split[0]; if (split.length === 2) { options.remotePort ...
[ "function", "(", "addresses", ",", "options", ")", "{", "var", "riakNodes", "=", "[", "]", ";", "if", "(", "options", "===", "undefined", ")", "{", "options", "=", "{", "}", ";", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "addresses", ...
Static factory for constructing a set of RiakNodes. To create a set of RiakNodes with the same options: var options = new RiakNode.Builder().withMinConnections(10); var nodes = RiakNode.buildNodes(['192.168.1.1', '192.168.1.2'], options); __options__ can be manually constructed or an instance of the Builder. @stati...
[ "Static", "factory", "for", "constructing", "a", "set", "of", "RiakNodes", "." ]
4823460b56b4defee69837995bde98e789b635bd
https://github.com/basho/riak-nodejs-client/blob/4823460b56b4defee69837995bde98e789b635bd/lib/core/riaknode.js#L875-L892
26,307
d3plus/d3plus-react
bin/execAsync.js
execAsync
function execAsync(cmd, opts = {}) { return new Promise((resolve, reject) => { shell.exec(cmd, opts, (code, stdout, stderr) => { if (code !== 0) return reject(new Error(stderr)); return resolve(stdout); }); }); }
javascript
function execAsync(cmd, opts = {}) { return new Promise((resolve, reject) => { shell.exec(cmd, opts, (code, stdout, stderr) => { if (code !== 0) return reject(new Error(stderr)); return resolve(stdout); }); }); }
[ "function", "execAsync", "(", "cmd", ",", "opts", "=", "{", "}", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "shell", ".", "exec", "(", "cmd", ",", "opts", ",", "(", "code", ",", "stdout", ",", "stder...
Asynchronously executes a shell command and returns a promise that resolves with the result. The `opts` object will be passed to shelljs's `exec()` and then to Node's native `child_process.exec()`. The most commonly used opts properties are: - {String} cwd - A full path to the working directory to execute the `cmd` i...
[ "Asynchronously", "executes", "a", "shell", "command", "and", "returns", "a", "promise", "that", "resolves", "with", "the", "result", "." ]
5f1edc97c3156ca7b24d70bd655898cc0708d879
https://github.com/d3plus/d3plus-react/blob/5f1edc97c3156ca7b24d70bd655898cc0708d879/bin/execAsync.js#L27-L34
26,308
basho/riak-nodejs-client
lib/commands/commandbase.js
CommandBase
function CommandBase(pbRequestName, pbResponseName, callback) { var requestCode = ProtoBufFactory.getCodeFor(pbRequestName); this.expectedCode = ProtoBufFactory.getCodeFor(pbResponseName); this.pbBuilder = ProtoBufFactory.getProtoFor(pbRequestName); var schema = Joi.func().required(); var self = th...
javascript
function CommandBase(pbRequestName, pbResponseName, callback) { var requestCode = ProtoBufFactory.getCodeFor(pbRequestName); this.expectedCode = ProtoBufFactory.getCodeFor(pbResponseName); this.pbBuilder = ProtoBufFactory.getProtoFor(pbRequestName); var schema = Joi.func().required(); var self = th...
[ "function", "CommandBase", "(", "pbRequestName", ",", "pbResponseName", ",", "callback", ")", "{", "var", "requestCode", "=", "ProtoBufFactory", ".", "getCodeFor", "(", "pbRequestName", ")", ";", "this", ".", "expectedCode", "=", "ProtoBufFactory", ".", "getCodeFo...
Provides a base class for all commands. @module Core Base class for all commands. Classes extending this need to override: constructPbRequest onSuccess onRiakError onError @class CommandBase @constructor @param {String} pbRequestName name of the Riak protocol buffer this command will send @param {String} pbRespon...
[ "Provides", "a", "base", "class", "for", "all", "commands", "." ]
4823460b56b4defee69837995bde98e789b635bd
https://github.com/basho/riak-nodejs-client/blob/4823460b56b4defee69837995bde98e789b635bd/lib/commands/commandbase.js#L51-L83
26,309
basho/riak-nodejs-client
lib/commands/ts/bykeybase.js
ByKeyBase
function ByKeyBase(options, pbRequestName, pbResponseName, callback) { CommandBase.call(this, pbRequestName, pbResponseName, callback); this.validateOptions(options, schema); }
javascript
function ByKeyBase(options, pbRequestName, pbResponseName, callback) { CommandBase.call(this, pbRequestName, pbResponseName, callback); this.validateOptions(options, schema); }
[ "function", "ByKeyBase", "(", "options", ",", "pbRequestName", ",", "pbResponseName", ",", "callback", ")", "{", "CommandBase", ".", "call", "(", "this", ",", "pbRequestName", ",", "pbResponseName", ",", "callback", ")", ";", "this", ".", "validateOptions", "(...
Base class for Get and Delete classes. @module TS @class ByKeyBase @constructor @param {Object} options The options for this command. @param {String} options.table The timeseries table from which retrieve a key from Riak. @param {Object[]} options.key The timeseries composite key to retrieve from Riak. @param {Functi...
[ "Base", "class", "for", "Get", "and", "Delete", "classes", "." ]
4823460b56b4defee69837995bde98e789b635bd
https://github.com/basho/riak-nodejs-client/blob/4823460b56b4defee69837995bde98e789b635bd/lib/commands/ts/bykeybase.js#L47-L50
26,310
basho/riak-nodejs-client
lib/commands/kv/riakobject.js
function(indexName, key) { if (this.indexes === undefined) { this.indexes = {}; } if (!this.indexes.hasOwnProperty(indexName)) { this.indexes[indexName] = []; } for (var i = 1; i < arguments.length; i++) { this.indexes[indexName].push(arguments...
javascript
function(indexName, key) { if (this.indexes === undefined) { this.indexes = {}; } if (!this.indexes.hasOwnProperty(indexName)) { this.indexes[indexName] = []; } for (var i = 1; i < arguments.length; i++) { this.indexes[indexName].push(arguments...
[ "function", "(", "indexName", ",", "key", ")", "{", "if", "(", "this", ".", "indexes", "===", "undefined", ")", "{", "this", ".", "indexes", "=", "{", "}", ";", "}", "if", "(", "!", "this", ".", "indexes", ".", "hasOwnProperty", "(", "indexName", "...
Add one or more keys to an index. If the index does not exist it will be created. @method addToIndex @param {String} indexName the index name @param {String|Number} ...key 1 or more keys to add @chainable
[ "Add", "one", "or", "more", "keys", "to", "an", "index", "." ]
4823460b56b4defee69837995bde98e789b635bd
https://github.com/basho/riak-nodejs-client/blob/4823460b56b4defee69837995bde98e789b635bd/lib/commands/kv/riakobject.js#L254-L265
26,311
dperini/nwmatcher
build/packer/packer.js
encodeBlocks
function encodeBlocks($, prefix, blockType, args, block) { if (!prefix) prefix = ""; if (blockType == "function") { // decode the function block (THIS IS THE IMPORTANT BIT) // We are retrieving all sub-blocks and will re-parse them in light // of newly shrunk variables block ...
javascript
function encodeBlocks($, prefix, blockType, args, block) { if (!prefix) prefix = ""; if (blockType == "function") { // decode the function block (THIS IS THE IMPORTANT BIT) // We are retrieving all sub-blocks and will re-parse them in light // of newly shrunk variables block ...
[ "function", "encodeBlocks", "(", "$", ",", "prefix", ",", "blockType", ",", "args", ",", "block", ")", "{", "if", "(", "!", "prefix", ")", "prefix", "=", "\"\"", ";", "if", "(", "blockType", "==", "\"function\"", ")", "{", "// decode the function block (TH...
encoder for program blocks
[ "encoder", "for", "program", "blocks" ]
3edb471e12ce7f7d46dc1606c7f659ff45675a29
https://github.com/dperini/nwmatcher/blob/3edb471e12ce7f7d46dc1606c7f659ff45675a29/build/packer/packer.js#L471-L522
26,312
dperini/nwmatcher
build/packer/packer.js
decodeBlocks
function decodeBlocks(script, encoded) { while (encoded.test(script)) { script = script.replace(global(encoded), function(match, index) { return blocks[index]; }); } return script; }
javascript
function decodeBlocks(script, encoded) { while (encoded.test(script)) { script = script.replace(global(encoded), function(match, index) { return blocks[index]; }); } return script; }
[ "function", "decodeBlocks", "(", "script", ",", "encoded", ")", "{", "while", "(", "encoded", ".", "test", "(", "script", ")", ")", "{", "script", "=", "script", ".", "replace", "(", "global", "(", "encoded", ")", ",", "function", "(", "match", ",", ...
decoder for program blocks
[ "decoder", "for", "program", "blocks" ]
3edb471e12ce7f7d46dc1606c7f659ff45675a29
https://github.com/dperini/nwmatcher/blob/3edb471e12ce7f7d46dc1606c7f659ff45675a29/build/packer/packer.js#L525-L532
26,313
djm/remark-shortcodes
index.js
parseShortcode
function parseShortcode(innerShortcode) { var trimmedInnerShortcode = innerShortcode.trim(); // If no shortcode, it was blank between the blocks - return nothing. if (!trimmedInnerShortcode) return; // If no whitespace, then shortcode is just name with no attributes. if (!hasWhiteSpace(trimmedInnerShortcode...
javascript
function parseShortcode(innerShortcode) { var trimmedInnerShortcode = innerShortcode.trim(); // If no shortcode, it was blank between the blocks - return nothing. if (!trimmedInnerShortcode) return; // If no whitespace, then shortcode is just name with no attributes. if (!hasWhiteSpace(trimmedInnerShortcode...
[ "function", "parseShortcode", "(", "innerShortcode", ")", "{", "var", "trimmedInnerShortcode", "=", "innerShortcode", ".", "trim", "(", ")", ";", "// If no shortcode, it was blank between the blocks - return nothing.", "if", "(", "!", "trimmedInnerShortcode", ")", "return",...
Parses the inner shortcode to extract shortcode name & key-value attributes. @param {string} innerShortcode - Extracted shortcode from between the start & end blocks.
[ "Parses", "the", "inner", "shortcode", "to", "extract", "shortcode", "name", "&", "key", "-", "value", "attributes", "." ]
490a56b8e491faeb6899a267e42395462e0f9254
https://github.com/djm/remark-shortcodes/blob/490a56b8e491faeb6899a267e42395462e0f9254/index.js#L120-L143
26,314
dperini/nwmatcher
build/packer/base2.js
_Array_forEach
function _Array_forEach(array, block, context) { if (array == null) array = global; var length = array.length || 0, i; // preserve length if (typeof array == "string") { for (i = 0; i < length; i++) { block.call(context, array.charAt(i), i, array); } } else { // Cater for sparse arrays. for (i...
javascript
function _Array_forEach(array, block, context) { if (array == null) array = global; var length = array.length || 0, i; // preserve length if (typeof array == "string") { for (i = 0; i < length; i++) { block.call(context, array.charAt(i), i, array); } } else { // Cater for sparse arrays. for (i...
[ "function", "_Array_forEach", "(", "array", ",", "block", ",", "context", ")", "{", "if", "(", "array", "==", "null", ")", "array", "=", "global", ";", "var", "length", "=", "array", ".", "length", "||", "0", ",", "i", ";", "// preserve length", "if", ...
These are the two core enumeration methods. All other forEach methods eventually call one of these two.
[ "These", "are", "the", "two", "core", "enumeration", "methods", ".", "All", "other", "forEach", "methods", "eventually", "call", "one", "of", "these", "two", "." ]
3edb471e12ce7f7d46dc1606c7f659ff45675a29
https://github.com/dperini/nwmatcher/blob/3edb471e12ce7f7d46dc1606c7f659ff45675a29/build/packer/base2.js#L993-L1011
26,315
nib-health-funds/gulp-rev-delete-original
index.js
function() { if(file.revOrigPath) { rimraf(file.revOrigPath, function(err) { if (err) return cb(err); cb(null, file); }); } else { cb(null); } }
javascript
function() { if(file.revOrigPath) { rimraf(file.revOrigPath, function(err) { if (err) return cb(err); cb(null, file); }); } else { cb(null); } }
[ "function", "(", ")", "{", "if", "(", "file", ".", "revOrigPath", ")", "{", "rimraf", "(", "file", ".", "revOrigPath", ",", "function", "(", "err", ")", "{", "if", "(", "err", ")", "return", "cb", "(", "err", ")", ";", "cb", "(", "null", ",", "...
delete the original file
[ "delete", "the", "original", "file" ]
85adbb9007b328d940df10854fcfaf81c84ef657
https://github.com/nib-health-funds/gulp-rev-delete-original/blob/85adbb9007b328d940df10854fcfaf81c84ef657/index.js#L20-L29
26,316
Janis-ai/Janis-for-npm
examples/microsoft/nodejs/index.js
function(message) { // Send notification as a proactive message var activity = message.activity var reference = TurnContext.getConversationReference(activity); MicrosoftAppCredentials.trustServiceUrl(activity.serviceUrl); adapter.continueConversation(reference, async (context) => { //...
javascript
function(message) { // Send notification as a proactive message var activity = message.activity var reference = TurnContext.getConversationReference(activity); MicrosoftAppCredentials.trustServiceUrl(activity.serviceUrl); adapter.continueConversation(reference, async (context) => { //...
[ "function", "(", "message", ")", "{", "// Send notification as a proactive message ", "var", "activity", "=", "message", ".", "activity", "var", "reference", "=", "TurnContext", ".", "getConversationReference", "(", "activity", ")", ";", "MicrosoftAppCredentials", ".", ...
Handle forwarding the messages sent by a human through your bot
[ "Handle", "forwarding", "the", "messages", "sent", "by", "a", "human", "through", "your", "bot" ]
4d4c7e4072d8c8b9300e0dd47bbce43c51f685bd
https://github.com/Janis-ai/Janis-for-npm/blob/4d4c7e4072d8c8b9300e0dd47bbce43c51f685bd/examples/microsoft/nodejs/index.js#L43-L53
26,317
kmiyashiro/grunt-mocha
phantomjs/bridge.js
sendMessage
function sendMessage() { var cache = []; var args = [].slice.call(arguments); // Safe stringifying of cyclical JSON function decycle(key, val) { if (typeof val === 'object' && val !== null) { if (cache.indexOf(val) >= 0) return; cache.push(val); } return val; } ...
javascript
function sendMessage() { var cache = []; var args = [].slice.call(arguments); // Safe stringifying of cyclical JSON function decycle(key, val) { if (typeof val === 'object' && val !== null) { if (cache.indexOf(val) >= 0) return; cache.push(val); } return val; } ...
[ "function", "sendMessage", "(", ")", "{", "var", "cache", "=", "[", "]", ";", "var", "args", "=", "[", "]", ".", "slice", ".", "call", "(", "arguments", ")", ";", "// Safe stringifying of cyclical JSON", "function", "decycle", "(", "key", ",", "val", ")"...
Send messages to the parent phantom.js process via alert! Good times!!
[ "Send", "messages", "to", "the", "parent", "phantom", ".", "js", "process", "via", "alert!", "Good", "times!!" ]
88a4fe36bdf223c9aa3eac5a88dc765c7c60e3b9
https://github.com/kmiyashiro/grunt-mocha/blob/88a4fe36bdf223c9aa3eac5a88dc765c7c60e3b9/phantomjs/bridge.js#L26-L40
26,318
kmiyashiro/grunt-mocha
phantomjs/bridge.js
decycle
function decycle(key, val) { if (typeof val === 'object' && val !== null) { if (cache.indexOf(val) >= 0) return; cache.push(val); } return val; }
javascript
function decycle(key, val) { if (typeof val === 'object' && val !== null) { if (cache.indexOf(val) >= 0) return; cache.push(val); } return val; }
[ "function", "decycle", "(", "key", ",", "val", ")", "{", "if", "(", "typeof", "val", "===", "'object'", "&&", "val", "!==", "null", ")", "{", "if", "(", "cache", ".", "indexOf", "(", "val", ")", ">=", "0", ")", "return", ";", "cache", ".", "push"...
Safe stringifying of cyclical JSON
[ "Safe", "stringifying", "of", "cyclical", "JSON" ]
88a4fe36bdf223c9aa3eac5a88dc765c7c60e3b9
https://github.com/kmiyashiro/grunt-mocha/blob/88a4fe36bdf223c9aa3eac5a88dc765c7c60e3b9/phantomjs/bridge.js#L31-L37
26,319
kmiyashiro/grunt-mocha
phantomjs/bridge.js
createGruntListener
function createGruntListener(ev, runner) { runner.on(ev, function(test, err) { var data = { err: err }; if (test) { data.title = test.title; data.fullTitle = test.fullTitle(); data.state = test.state; data.duration = test.duration; data.slow = test....
javascript
function createGruntListener(ev, runner) { runner.on(ev, function(test, err) { var data = { err: err }; if (test) { data.title = test.title; data.fullTitle = test.fullTitle(); data.state = test.state; data.duration = test.duration; data.slow = test....
[ "function", "createGruntListener", "(", "ev", ",", "runner", ")", "{", "runner", ".", "on", "(", "ev", ",", "function", "(", "test", ",", "err", ")", "{", "var", "data", "=", "{", "err", ":", "err", "}", ";", "if", "(", "test", ")", "{", "data", ...
Create a listener who'll bubble events from PhantomJS to Grunt
[ "Create", "a", "listener", "who", "ll", "bubble", "events", "from", "PhantomJS", "to", "Grunt" ]
88a4fe36bdf223c9aa3eac5a88dc765c7c60e3b9
https://github.com/kmiyashiro/grunt-mocha/blob/88a4fe36bdf223c9aa3eac5a88dc765c7c60e3b9/phantomjs/bridge.js#L43-L60
26,320
kmiyashiro/grunt-mocha
tasks/mocha.js
function(err) { var stats = runner.stats; testStats.push(stats); if (err) { // Show Growl notice // @TODO: Get an example of this // growl('PhantomJS Error!'); // If there was a PhantomJS error, abort the series. grunt.fatal(err...
javascript
function(err) { var stats = runner.stats; testStats.push(stats); if (err) { // Show Growl notice // @TODO: Get an example of this // growl('PhantomJS Error!'); // If there was a PhantomJS error, abort the series. grunt.fatal(err...
[ "function", "(", "err", ")", "{", "var", "stats", "=", "runner", ".", "stats", ";", "testStats", ".", "push", "(", "stats", ")", ";", "if", "(", "err", ")", "{", "// Show Growl notice", "// @TODO: Get an example of this", "// growl('PhantomJS Error!');", "// If ...
Do stuff when done.
[ "Do", "stuff", "when", "done", "." ]
88a4fe36bdf223c9aa3eac5a88dc765c7c60e3b9
https://github.com/kmiyashiro/grunt-mocha/blob/88a4fe36bdf223c9aa3eac5a88dc765c7c60e3b9/tasks/mocha.js#L248-L281
26,321
kmiyashiro/grunt-mocha
phantomjs/main.js
function(arg) { var args = Array.isArray(arg) ? arg : [].slice.call(arguments); last = new Date(); fs.write(tmpfile, JSON.stringify(args) + '\n', 'a'); }
javascript
function(arg) { var args = Array.isArray(arg) ? arg : [].slice.call(arguments); last = new Date(); fs.write(tmpfile, JSON.stringify(args) + '\n', 'a'); }
[ "function", "(", "arg", ")", "{", "var", "args", "=", "Array", ".", "isArray", "(", "arg", ")", "?", "arg", ":", "[", "]", ".", "slice", ".", "call", "(", "arguments", ")", ";", "last", "=", "new", "Date", "(", ")", ";", "fs", ".", "write", "...
Messages are sent to the parent by appending them to the tempfile.
[ "Messages", "are", "sent", "to", "the", "parent", "by", "appending", "them", "to", "the", "tempfile", "." ]
88a4fe36bdf223c9aa3eac5a88dc765c7c60e3b9
https://github.com/kmiyashiro/grunt-mocha/blob/88a4fe36bdf223c9aa3eac5a88dc765c7c60e3b9/phantomjs/main.js#L30-L34
26,322
mqlight/nodejs-mqlight
samples/uiworkout.js
bluemixServiceLookup
function bluemixServiceLookup(options, verbose) { var result = false; if (process.env.VCAP_SERVICES) { if (verbose) console.log('VCAP_SERVICES variable present in environment'); var services = JSON.parse(process.env.VCAP_SERVICES); for (var key in services) { if (key.lastIndexOf(mqlightServiceName...
javascript
function bluemixServiceLookup(options, verbose) { var result = false; if (process.env.VCAP_SERVICES) { if (verbose) console.log('VCAP_SERVICES variable present in environment'); var services = JSON.parse(process.env.VCAP_SERVICES); for (var key in services) { if (key.lastIndexOf(mqlightServiceName...
[ "function", "bluemixServiceLookup", "(", "options", ",", "verbose", ")", "{", "var", "result", "=", "false", ";", "if", "(", "process", ".", "env", ".", "VCAP_SERVICES", ")", "{", "if", "(", "verbose", ")", "console", ".", "log", "(", "'VCAP_SERVICES varia...
Checks to see if the application is running in IBM Bluemix. If it is, tries to retrieve connection details from the environent and populates the options object passed as an argument.
[ "Checks", "to", "see", "if", "the", "application", "is", "running", "in", "IBM", "Bluemix", ".", "If", "it", "is", "tries", "to", "retrieve", "connection", "details", "from", "the", "environent", "and", "populates", "the", "options", "object", "passed", "as"...
cf20a62d003fe6052569124bb85957d02ddb93ab
https://github.com/mqlight/nodejs-mqlight/blob/cf20a62d003fe6052569124bb85957d02ddb93ab/samples/uiworkout.js#L184-L212
26,323
mqlight/nodejs-mqlight
mqlight.js
setupError
function setupError(obj, name, message) { if (obj) { Error.call(obj); Object.defineProperty(obj, 'name', { value: name, enumerable: false }); Object.defineProperty(obj, 'message', { value: message, enumerable: false }); } else { logger.ffdc('setupError', 'ffdc001', nu...
javascript
function setupError(obj, name, message) { if (obj) { Error.call(obj); Object.defineProperty(obj, 'name', { value: name, enumerable: false }); Object.defineProperty(obj, 'message', { value: message, enumerable: false }); } else { logger.ffdc('setupError', 'ffdc001', nu...
[ "function", "setupError", "(", "obj", ",", "name", ",", "message", ")", "{", "if", "(", "obj", ")", "{", "Error", ".", "call", "(", "obj", ")", ";", "Object", ".", "defineProperty", "(", "obj", ",", "'name'", ",", "{", "value", ":", "name", ",", ...
Generic helper method to use for Error sub-typing @param {Object} obj - the object upon which to define Error properties @param {String} name - the sub-type Error object name @param {String} message - Human-readable description of the error
[ "Generic", "helper", "method", "to", "use", "for", "Error", "sub", "-", "typing" ]
cf20a62d003fe6052569124bb85957d02ddb93ab
https://github.com/mqlight/nodejs-mqlight/blob/cf20a62d003fe6052569124bb85957d02ddb93ab/mqlight.js#L125-L139
26,324
mqlight/nodejs-mqlight
mqlight.js
getNamedError
function getNamedError(obj) { if (obj && obj instanceof Error && 'name' in obj) { var Constructor = exports[obj.name]; if (typeof Constructor === 'function') { var res = new Constructor(obj.message); if (res) { res.stack = obj.stack; return res; } } } return obj; }
javascript
function getNamedError(obj) { if (obj && obj instanceof Error && 'name' in obj) { var Constructor = exports[obj.name]; if (typeof Constructor === 'function') { var res = new Constructor(obj.message); if (res) { res.stack = obj.stack; return res; } } } return obj; }
[ "function", "getNamedError", "(", "obj", ")", "{", "if", "(", "obj", "&&", "obj", "instanceof", "Error", "&&", "'name'", "in", "obj", ")", "{", "var", "Constructor", "=", "exports", "[", "obj", ".", "name", "]", ";", "if", "(", "typeof", "Constructor",...
Generic helper method to map a named Error object into the correct sub-type so that instanceof checking works as expected. @param {Object} obj - the Error object to remap. @return {Object} a sub-typed Error object.
[ "Generic", "helper", "method", "to", "map", "a", "named", "Error", "object", "into", "the", "correct", "sub", "-", "type", "so", "that", "instanceof", "checking", "works", "as", "expected", "." ]
cf20a62d003fe6052569124bb85957d02ddb93ab
https://github.com/mqlight/nodejs-mqlight/blob/cf20a62d003fe6052569124bb85957d02ddb93ab/mqlight.js#L149-L161
26,325
mqlight/nodejs-mqlight
mqlight.js
shouldReconnect
function shouldReconnect(err) { // exclude all programming errors return (!(err instanceof TypeError) && !(err instanceof InvalidArgumentError) && !(err instanceof NotPermittedError) && !(err instanceof ReplacedError) && !(err instanceof StoppedError) && !(err insta...
javascript
function shouldReconnect(err) { // exclude all programming errors return (!(err instanceof TypeError) && !(err instanceof InvalidArgumentError) && !(err instanceof NotPermittedError) && !(err instanceof ReplacedError) && !(err instanceof StoppedError) && !(err insta...
[ "function", "shouldReconnect", "(", "err", ")", "{", "// exclude all programming errors", "return", "(", "!", "(", "err", "instanceof", "TypeError", ")", "&&", "!", "(", "err", "instanceof", "InvalidArgumentError", ")", "&&", "!", "(", "err", "instanceof", "NotP...
Generic helper method to determine if we should automatically reconnect for the given type of error. @param {Object} err - the Error object to check. @return {Object} true if we should reconnect, false otherwise.
[ "Generic", "helper", "method", "to", "determine", "if", "we", "should", "automatically", "reconnect", "for", "the", "given", "type", "of", "error", "." ]
cf20a62d003fe6052569124bb85957d02ddb93ab
https://github.com/mqlight/nodejs-mqlight/blob/cf20a62d003fe6052569124bb85957d02ddb93ab/mqlight.js#L332-L342
26,326
mqlight/nodejs-mqlight
mqlight.js
function(fileUrl) { logger.entry('getFileServiceFunction', logger.NO_CLIENT_ID); logger.log('parms', logger.NO_CLIENT_ID, 'fileUrl:', fileUrl); if (typeof fileUrl !== 'string') { var err = new TypeError('fileUrl must be a string type'); logger.ffdc('getFileServiceFunction', 'ffdc001', null, err); log...
javascript
function(fileUrl) { logger.entry('getFileServiceFunction', logger.NO_CLIENT_ID); logger.log('parms', logger.NO_CLIENT_ID, 'fileUrl:', fileUrl); if (typeof fileUrl !== 'string') { var err = new TypeError('fileUrl must be a string type'); logger.ffdc('getFileServiceFunction', 'ffdc001', null, err); log...
[ "function", "(", "fileUrl", ")", "{", "logger", ".", "entry", "(", "'getFileServiceFunction'", ",", "logger", ".", "NO_CLIENT_ID", ")", ";", "logger", ".", "log", "(", "'parms'", ",", "logger", ".", "NO_CLIENT_ID", ",", "'fileUrl:'", ",", "fileUrl", ")", "...
Function to take a single FILE URL and using the JSON retrieved from it to return an array of service URLs. @param {String} fileUrl - Required; a FILE address to retrieve service info from (e.g., file:///tmp/config.json). @return {function(callback)} a function which will call the given callback with a list of AMQP se...
[ "Function", "to", "take", "a", "single", "FILE", "URL", "and", "using", "the", "JSON", "retrieved", "from", "it", "to", "return", "an", "array", "of", "service", "URLs", "." ]
cf20a62d003fe6052569124bb85957d02ddb93ab
https://github.com/mqlight/nodejs-mqlight/blob/cf20a62d003fe6052569124bb85957d02ddb93ab/mqlight.js#L358-L426
26,327
mqlight/nodejs-mqlight
mqlight.js
function(client) { if (typeof client === 'undefined'/* || client.constructor !== Client*/) { logger.entry('Client.reconnect', logger.NO_CLIENT_ID); logger.log('parms', logger.NO_CLIENT_ID, 'client:', client); logger.exit('Client.reconnect', logger.NO_CLIENT_ID, undefined); return; } logger.entry('...
javascript
function(client) { if (typeof client === 'undefined'/* || client.constructor !== Client*/) { logger.entry('Client.reconnect', logger.NO_CLIENT_ID); logger.log('parms', logger.NO_CLIENT_ID, 'client:', client); logger.exit('Client.reconnect', logger.NO_CLIENT_ID, undefined); return; } logger.entry('...
[ "function", "(", "client", ")", "{", "if", "(", "typeof", "client", "===", "'undefined'", "/* || client.constructor !== Client*/", ")", "{", "logger", ".", "entry", "(", "'Client.reconnect'", ",", "logger", ".", "NO_CLIENT_ID", ")", ";", "logger", ".", "log", ...
Reconnects the client to the MQ Light service, implicitly closing any subscriptions that the client has open. The 'restarted' event will be emitted once the client has reconnected. @param {client} client - the client object to reconnect @return {Object} The instance of client that it is invoked on - allowing for chain...
[ "Reconnects", "the", "client", "to", "the", "MQ", "Light", "service", "implicitly", "closing", "any", "subscriptions", "that", "the", "client", "has", "open", ".", "The", "restarted", "event", "will", "be", "emitted", "once", "the", "client", "has", "reconnect...
cf20a62d003fe6052569124bb85957d02ddb93ab
https://github.com/mqlight/nodejs-mqlight/blob/cf20a62d003fe6052569124bb85957d02ddb93ab/mqlight.js#L743-L793
26,328
mqlight/nodejs-mqlight
mqlight.js
function(error) { logger.entry('Client._tryService.tryNextService', _id); if (serviceList.length === 1) { // We've tried all services without success. Pause for a while // before trying again logger.log('data', _id, 'End of service list'); client._se...
javascript
function(error) { logger.entry('Client._tryService.tryNextService', _id); if (serviceList.length === 1) { // We've tried all services without success. Pause for a while // before trying again logger.log('data', _id, 'End of service list'); client._se...
[ "function", "(", "error", ")", "{", "logger", ".", "entry", "(", "'Client._tryService.tryNextService'", ",", "_id", ")", ";", "if", "(", "serviceList", ".", "length", "===", "1", ")", "{", "// We've tried all services without success. Pause for a while", "// before tr...
Try and connect to the next service in the list, or retry from the beginning if we've run out of services.
[ "Try", "and", "connect", "to", "the", "next", "service", "in", "the", "list", "or", "retry", "from", "the", "beginning", "if", "we", "ve", "run", "out", "of", "services", "." ]
cf20a62d003fe6052569124bb85957d02ddb93ab
https://github.com/mqlight/nodejs-mqlight/blob/cf20a62d003fe6052569124bb85957d02ddb93ab/mqlight.js#L1548-L1595
26,329
mqlight/nodejs-mqlight
mqlight.js
function(err) { logger.entry('Client._tryService.connError', _id); err = lookupError(err); logger.log('data', _id, 'failed to connect to: ' + logUrl + ' due to error: ' + util.inspect(err)); // This service failed to connect. Try the next one. // ...
javascript
function(err) { logger.entry('Client._tryService.connError', _id); err = lookupError(err); logger.log('data', _id, 'failed to connect to: ' + logUrl + ' due to error: ' + util.inspect(err)); // This service failed to connect. Try the next one. // ...
[ "function", "(", "err", ")", "{", "logger", ".", "entry", "(", "'Client._tryService.connError'", ",", "_id", ")", ";", "err", "=", "lookupError", "(", "err", ")", ";", "logger", ".", "log", "(", "'data'", ",", "_id", ",", "'failed to connect to: '", "+", ...
Define an error handler for connection errors. Log the failure and then try the next service.
[ "Define", "an", "error", "handler", "for", "connection", "errors", ".", "Log", "the", "failure", "and", "then", "try", "the", "next", "service", "." ]
cf20a62d003fe6052569124bb85957d02ddb93ab
https://github.com/mqlight/nodejs-mqlight/blob/cf20a62d003fe6052569124bb85957d02ddb93ab/mqlight.js#L1599-L1611
26,330
berlinonline/converjon
lib/cache.js
meta_data_still_fresh
function meta_data_still_fresh(item) { var promise = read_meta_data(item). then(function(item) { return new Promise(function(resolve, reject) { if (headers_still_fresh(item.meta_data.headers)) { resolve(item); } else { reject(item); } ...
javascript
function meta_data_still_fresh(item) { var promise = read_meta_data(item). then(function(item) { return new Promise(function(resolve, reject) { if (headers_still_fresh(item.meta_data.headers)) { resolve(item); } else { reject(item); } ...
[ "function", "meta_data_still_fresh", "(", "item", ")", "{", "var", "promise", "=", "read_meta_data", "(", "item", ")", ".", "then", "(", "function", "(", "item", ")", "{", "return", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "...
returns a promise that resolves into the meta data or rejects in case of an error
[ "returns", "a", "promise", "that", "resolves", "into", "the", "meta", "data", "or", "rejects", "in", "case", "of", "an", "error" ]
ace8c1b8ff0c3077919b73d3d7604c60a60f37f3
https://github.com/berlinonline/converjon/blob/ace8c1b8ff0c3077919b73d3d7604c60a60f37f3/lib/cache.js#L86-L99
26,331
strongloop/microgateway-datastore
apim-pull.js
ModelType
function ModelType(name, prefix, endp) { this.name = name; this.prefix = prefix; this.endp = endp; }
javascript
function ModelType(name, prefix, endp) { this.name = name; this.prefix = prefix; this.endp = endp; }
[ "function", "ModelType", "(", "name", ",", "prefix", ",", "endp", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "prefix", "=", "prefix", ";", "this", ".", "endp", "=", "endp", ";", "}" ]
Creates a model type @class @param {string} name - name of the model @param {string} prefix - file name prefix associated with the model
[ "Creates", "a", "model", "type" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/apim-pull.js#L59-L63
26,332
strongloop/microgateway-datastore
apim-pull.js
getDataBasedOnCatalog
function getDataBasedOnCatalog(options, catalogs, models, cb) { async.each(catalogs, function(catalog, catcallback) { /* Next, go to APIs for each catalog */ async.each(models, function(model, modelcallback) { pullDataFromEndp(options, catalog, model, function(err) { if ...
javascript
function getDataBasedOnCatalog(options, catalogs, models, cb) { async.each(catalogs, function(catalog, catcallback) { /* Next, go to APIs for each catalog */ async.each(models, function(model, modelcallback) { pullDataFromEndp(options, catalog, model, function(err) { if ...
[ "function", "getDataBasedOnCatalog", "(", "options", ",", "catalogs", ",", "models", ",", "cb", ")", "{", "async", ".", "each", "(", "catalogs", ",", "function", "(", "catalog", ",", "catcallback", ")", "{", "/* Next, go to APIs for each catalog */", "async", "....
Fetches data from APIm for each catalog such as APIs, products and subscriptions
[ "Fetches", "data", "from", "APIm", "for", "each", "catalog", "such", "as", "APIs", "products", "and", "subscriptions" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/apim-pull.js#L111-L133
26,333
strongloop/microgateway-datastore
apim-pull.js
fetchFromCache
function fetchFromCache(options, opts, cb) { // look for existing cached resource if (indirFiles.length > 0) { var etag; var regexp = '^' + opts.prefix + '([A-Za-z0-9]+={0,2})' + // base64 encoded opts.suffix + '$'; var regex = new RegExp(regexp); var i; for (i ...
javascript
function fetchFromCache(options, opts, cb) { // look for existing cached resource if (indirFiles.length > 0) { var etag; var regexp = '^' + opts.prefix + '([A-Za-z0-9]+={0,2})' + // base64 encoded opts.suffix + '$'; var regex = new RegExp(regexp); var i; for (i ...
[ "function", "fetchFromCache", "(", "options", ",", "opts", ",", "cb", ")", "{", "// look for existing cached resource", "if", "(", "indirFiles", ".", "length", ">", "0", ")", "{", "var", "etag", ";", "var", "regexp", "=", "'^'", "+", "opts", ".", "prefix",...
Uses cached configuration if still fresh
[ "Uses", "cached", "configuration", "if", "still", "fresh" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/apim-pull.js#L237-L294
26,334
strongloop/microgateway-datastore
server/boot/load-model.js
function(callback) { stageModels(app, models, function(err) { models.pop(); // remove snapshot model models.pop(); // remove optimizedData model callback(err); }); }
javascript
function(callback) { stageModels(app, models, function(err) { models.pop(); // remove snapshot model models.pop(); // remove optimizedData model callback(err); }); }
[ "function", "(", "callback", ")", "{", "stageModels", "(", "app", ",", "models", ",", "function", "(", "err", ")", "{", "models", ".", "pop", "(", ")", ";", "// remove snapshot model", "models", ".", "pop", "(", ")", ";", "// remove optimizedData model", "...
stage the models
[ "stage", "the", "models" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L128-L134
26,335
strongloop/microgateway-datastore
server/boot/load-model.js
function(err) { if (!err) { loadData(app, apimanager, models, true, uid); } if (!apimanager.host) { //monitor the file changes, load data again if any changes fs.watch(definitionsDir, function(event, filename) { if (filename !== '.datastore') { logger.debu...
javascript
function(err) { if (!err) { loadData(app, apimanager, models, true, uid); } if (!apimanager.host) { //monitor the file changes, load data again if any changes fs.watch(definitionsDir, function(event, filename) { if (filename !== '.datastore') { logger.debu...
[ "function", "(", "err", ")", "{", "if", "(", "!", "err", ")", "{", "loadData", "(", "app", ",", "apimanager", ",", "models", ",", "true", ",", "uid", ")", ";", "}", "if", "(", "!", "apimanager", ".", "host", ")", "{", "//monitor the file changes, loa...
load the data into the models
[ "load", "the", "data", "into", "the", "models" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L184-L197
26,336
strongloop/microgateway-datastore
server/boot/load-model.js
loadData
function loadData(app, apimanager, models, reload, uid) { var currdir = getPreviousSnapshotDir(); var snapdir; var snapshotID = getSnapshotID(); var populatedSnapshot = false; async.series([ function(callback) { logger.debug('apimanager before pullFromAPIm: %j', apimanager); if (apimanager.ho...
javascript
function loadData(app, apimanager, models, reload, uid) { var currdir = getPreviousSnapshotDir(); var snapdir; var snapshotID = getSnapshotID(); var populatedSnapshot = false; async.series([ function(callback) { logger.debug('apimanager before pullFromAPIm: %j', apimanager); if (apimanager.ho...
[ "function", "loadData", "(", "app", ",", "apimanager", ",", "models", ",", "reload", ",", "uid", ")", "{", "var", "currdir", "=", "getPreviousSnapshotDir", "(", ")", ";", "var", "snapdir", ";", "var", "snapshotID", "=", "getSnapshotID", "(", ")", ";", "v...
Loads the data into models, and periodically refreshes the data @param {???} app - loopback application @param {Object} config - configuration pointing to APIm server @param {Array} models - instances of ModelType to populate with data @param {bool} reload - set a timer to trigger a future reload
[ "Loads", "the", "data", "into", "models", "and", "periodically", "refreshes", "the", "data" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L207-L292
26,337
strongloop/microgateway-datastore
server/boot/load-model.js
function(callback) { populatedSnapshot = true; loadConfig(app, apimanager, models, currdir, snapdir, snapshotID, callback); }
javascript
function(callback) { populatedSnapshot = true; loadConfig(app, apimanager, models, currdir, snapdir, snapshotID, callback); }
[ "function", "(", "callback", ")", "{", "populatedSnapshot", "=", "true", ";", "loadConfig", "(", "app", ",", "apimanager", ",", "models", ",", "currdir", ",", "snapdir", ",", "snapshotID", ",", "callback", ")", ";", "}" ]
load current config
[ "load", "current", "config" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L240-L249
26,338
strongloop/microgateway-datastore
server/boot/load-model.js
stageModels
function stageModels(app, models, cb) { logger.debug('stageModels entry'); async.forEach(models, function(model, callback) { app.dataSources.db.automigrate( model.name, function(err) { callback(err); } ); }, function(err) { logger.debug('stageModels ex...
javascript
function stageModels(app, models, cb) { logger.debug('stageModels entry'); async.forEach(models, function(model, callback) { app.dataSources.db.automigrate( model.name, function(err) { callback(err); } ); }, function(err) { logger.debug('stageModels ex...
[ "function", "stageModels", "(", "app", ",", "models", ",", "cb", ")", "{", "logger", ".", "debug", "(", "'stageModels entry'", ")", ";", "async", ".", "forEach", "(", "models", ",", "function", "(", "model", ",", "callback", ")", "{", "app", ".", "data...
Stages the models for use by subsequent functions @param {???} app - loopback application @param {Array} models - instances of ModelType to populate with data @param {callback} cb - callback that handles the error or successful completion
[ "Stages", "the", "models", "for", "use", "by", "subsequent", "functions" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L308-L324
26,339
strongloop/microgateway-datastore
server/boot/load-model.js
addSignatureHeaders
function addSignatureHeaders(body, headers, keyId, private_key) { var sign = function(str, private_key) { var sign = Crypto.createSign('RSA-SHA256'); sign.update(str); return sign.sign(private_key, 'base64'); }; var sha256 = function(str, encoding) { var bodyStr = JSON.stringify(str); var has...
javascript
function addSignatureHeaders(body, headers, keyId, private_key) { var sign = function(str, private_key) { var sign = Crypto.createSign('RSA-SHA256'); sign.update(str); return sign.sign(private_key, 'base64'); }; var sha256 = function(str, encoding) { var bodyStr = JSON.stringify(str); var has...
[ "function", "addSignatureHeaders", "(", "body", ",", "headers", ",", "keyId", ",", "private_key", ")", "{", "var", "sign", "=", "function", "(", "str", ",", "private_key", ")", "{", "var", "sign", "=", "Crypto", ".", "createSign", "(", "'RSA-SHA256'", ")",...
Compute the signature headers "date", "digest", and "authorization" headers according to IETF I-D draft-cavage-http-signatures-05 using rsa-sha256 algorithm If the `date` header already exists in the input, it's used as-is If the `digest` header already exists in the input, it's used as-is (which means that body is ig...
[ "Compute", "the", "signature", "headers", "date", "digest", "and", "authorization", "headers", "according", "to", "IETF", "I", "-", "D", "draft", "-", "cavage", "-", "http", "-", "signatures", "-", "05", "using", "rsa", "-", "sha256", "algorithm" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L341-L383
26,340
strongloop/microgateway-datastore
server/boot/load-model.js
handshakeWithAPIm
function handshakeWithAPIm(app, apimanager, private_key, cb) { logger.debug('handshakeWithAPIm entry'); async.series([ function(callback) { var body = JSON.stringify({ gatewayVersion: version }); var headers = { 'content-type': 'application/json' }; addSignatureHeaders(body, headers, 'micro-...
javascript
function handshakeWithAPIm(app, apimanager, private_key, cb) { logger.debug('handshakeWithAPIm entry'); async.series([ function(callback) { var body = JSON.stringify({ gatewayVersion: version }); var headers = { 'content-type': 'application/json' }; addSignatureHeaders(body, headers, 'micro-...
[ "function", "handshakeWithAPIm", "(", "app", ",", "apimanager", ",", "private_key", ",", "cb", ")", "{", "logger", ".", "debug", "(", "'handshakeWithAPIm entry'", ")", ";", "async", ".", "series", "(", "[", "function", "(", "callback", ")", "{", "var", "bo...
Attempt to handshake from APIm server @param {???} app - loopback application @param {Object} apimanager - configuration pointing to APIm server @param {string} privatekey - private key to be used for handshake @param {callback} cb - callback that handles error
[ "Attempt", "to", "handshake", "from", "APIm", "server" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L541-L615
26,341
strongloop/microgateway-datastore
server/boot/load-model.js
pullFromAPIm
function pullFromAPIm(apimanager, currdir, uid, cb) { logger.debug('pullFromAPIm entry'); // Have an APIm, grab latest if we can.. var snapdir = path.join(process.env.ROOTCONFIGDIR, uid); fs.mkdirs(snapdir, function(err) { if (err) { logger.warn('Failed to create snapshot directory'); logger.de...
javascript
function pullFromAPIm(apimanager, currdir, uid, cb) { logger.debug('pullFromAPIm entry'); // Have an APIm, grab latest if we can.. var snapdir = path.join(process.env.ROOTCONFIGDIR, uid); fs.mkdirs(snapdir, function(err) { if (err) { logger.warn('Failed to create snapshot directory'); logger.de...
[ "function", "pullFromAPIm", "(", "apimanager", ",", "currdir", ",", "uid", ",", "cb", ")", "{", "logger", ".", "debug", "(", "'pullFromAPIm entry'", ")", ";", "// Have an APIm, grab latest if we can..", "var", "snapdir", "=", "path", ".", "join", "(", "process",...
Attempt to request data from APIm server and persist to disk @param {Object} config - configuration pointing to APIm server @param {string} currdir - current snapshot symbolic link path @param {string} uid - snapshot identifier @param {callback} cb - callback that handles error or path to snapshot directory
[ "Attempt", "to", "request", "data", "from", "APIm", "server", "and", "persist", "to", "disk" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L625-L678
26,342
strongloop/microgateway-datastore
server/boot/load-model.js
loadConfig
function loadConfig(app, apimanager, models, currdir, snapdir, uid, cb) { logger.debug('loadConfig entry'); var dirToLoad = (snapdir === '') ? currdir : snapdir; loadConfigFromFS(app, apimanager, models, dirToLoad, uid, function(err) { if (err) { logger.error(err); logger.debug('loadConfig error(...
javascript
function loadConfig(app, apimanager, models, currdir, snapdir, uid, cb) { logger.debug('loadConfig entry'); var dirToLoad = (snapdir === '') ? currdir : snapdir; loadConfigFromFS(app, apimanager, models, dirToLoad, uid, function(err) { if (err) { logger.error(err); logger.debug('loadConfig error(...
[ "function", "loadConfig", "(", "app", ",", "apimanager", ",", "models", ",", "currdir", ",", "snapdir", ",", "uid", ",", "cb", ")", "{", "logger", ".", "debug", "(", "'loadConfig entry'", ")", ";", "var", "dirToLoad", "=", "(", "snapdir", "===", "''", ...
Loads persisted data from disk and populates models and updates 'current snapshot' @param {???} app - loopback application @param {Array} models - instances of ModelType to populate with data @param {string} currdir - current snapshot symbolic link path @param {string} snapdir - path to directory containing persisted d...
[ "Loads", "persisted", "data", "from", "disk", "and", "populates", "models", "and", "updates", "current", "snapshot" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L690-L725
26,343
strongloop/microgateway-datastore
server/boot/load-model.js
loadConfigFromFS
function loadConfigFromFS(app, apimanager, models, dir, uid, cb) { // clear out existing files from model structure models.forEach( function(model) { model.files = []; } ); if (apimanager.host) { var files = []; logger.debug('loadConfigFromFS entry'); try { if (dir !== '') { ...
javascript
function loadConfigFromFS(app, apimanager, models, dir, uid, cb) { // clear out existing files from model structure models.forEach( function(model) { model.files = []; } ); if (apimanager.host) { var files = []; logger.debug('loadConfigFromFS entry'); try { if (dir !== '') { ...
[ "function", "loadConfigFromFS", "(", "app", ",", "apimanager", ",", "models", ",", "dir", ",", "uid", ",", "cb", ")", "{", "// clear out existing files from model structure", "models", ".", "forEach", "(", "function", "(", "model", ")", "{", "model", ".", "fil...
Loads persisted data from disk and populates models @param {???} app - loopback application @param {Array} models - instances of ModelType to populate with data @param {string} dir - path to directory containing persisted data to load @param {string} uid - snapshot identifier @param {callback} cb - callback that handle...
[ "Loads", "persisted", "data", "from", "disk", "and", "populates", "models" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L735-L796
26,344
strongloop/microgateway-datastore
server/boot/load-model.js
function(seriesCallback) { async.forEach(YAMLfiles, function(file, fileCallback) { logger.debug('Loading data from %s', file); var readfile; try { // read the content of the files into memory and parse as JSON readfile = YAML.load(fs.readFileSync(file,...
javascript
function(seriesCallback) { async.forEach(YAMLfiles, function(file, fileCallback) { logger.debug('Loading data from %s', file); var readfile; try { // read the content of the files into memory and parse as JSON readfile = YAML.load(fs.readFileSync(file,...
[ "function", "(", "seriesCallback", ")", "{", "async", ".", "forEach", "(", "YAMLfiles", ",", "function", "(", "file", ",", "fileCallback", ")", "{", "logger", ".", "debug", "(", "'Loading data from %s'", ",", "file", ")", ";", "var", "readfile", ";", "try"...
1. create the "api" instances
[ "1", ".", "create", "the", "api", "instances" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L837-L894
26,345
strongloop/microgateway-datastore
server/boot/load-model.js
function(seriesCallback) { defaultCatalog['snapshot-id'] = uid; app.models['catalog'].create( defaultCatalog, function(err, mymodel) { if (err) { logger.error(err); seriesCallback(err); return; } logger.debug('%s created: %j',...
javascript
function(seriesCallback) { defaultCatalog['snapshot-id'] = uid; app.models['catalog'].create( defaultCatalog, function(err, mymodel) { if (err) { logger.error(err); seriesCallback(err); return; } logger.debug('%s created: %j',...
[ "function", "(", "seriesCallback", ")", "{", "defaultCatalog", "[", "'snapshot-id'", "]", "=", "uid", ";", "app", ".", "models", "[", "'catalog'", "]", ".", "create", "(", "defaultCatalog", ",", "function", "(", "err", ",", "mymodel", ")", "{", "if", "("...
2. create the "catalog" instances
[ "2", ".", "create", "the", "catalog", "instances" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L896-L909
26,346
strongloop/microgateway-datastore
server/boot/load-model.js
function(seriesCallback) { var entry = {}; // add catalog entry.catalog = defaultCatalog; entry['snapshot-id'] = uid; entry.document = { product: '1.0.0', info: { name: 'static-product', version: '1.0.0', title: 'static-product' }, vis...
javascript
function(seriesCallback) { var entry = {}; // add catalog entry.catalog = defaultCatalog; entry['snapshot-id'] = uid; entry.document = { product: '1.0.0', info: { name: 'static-product', version: '1.0.0', title: 'static-product' }, vis...
[ "function", "(", "seriesCallback", ")", "{", "var", "entry", "=", "{", "}", ";", "// add catalog", "entry", ".", "catalog", "=", "defaultCatalog", ";", "entry", "[", "'snapshot-id'", "]", "=", "uid", ";", "entry", ".", "document", "=", "{", "product", ":...
3. create one "product" with all the apis defined
[ "3", ".", "create", "one", "product", "with", "all", "the", "apis", "defined" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L911-L986
26,347
strongloop/microgateway-datastore
server/boot/load-model.js
function(seriesCallback) { var subscriptions = []; if (apicCfg && apicCfg.plans && apicCfg.applications) { //add the configured plans var idx = 0; for (var k in apicCfg.applications) { var theApp = apicCfg.applications[k]; //An application can subscribe only one p...
javascript
function(seriesCallback) { var subscriptions = []; if (apicCfg && apicCfg.plans && apicCfg.applications) { //add the configured plans var idx = 0; for (var k in apicCfg.applications) { var theApp = apicCfg.applications[k]; //An application can subscribe only one p...
[ "function", "(", "seriesCallback", ")", "{", "var", "subscriptions", "=", "[", "]", ";", "if", "(", "apicCfg", "&&", "apicCfg", ".", "plans", "&&", "apicCfg", ".", "applications", ")", "{", "//add the configured plans", "var", "idx", "=", "0", ";", "for", ...
4. create the "subscriptions" instances
[ "4", ".", "create", "the", "subscriptions", "instances" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L988-L1055
26,348
strongloop/microgateway-datastore
server/boot/load-model.js
function(seriesCallback) { var modelname = 'tlsprofile'; async.forEachOf( apicCfg['tls-profiles'], function(profile, name, asyncCB) { var instance = { 'snapshot-id': uid, 'org-id': defaultOrg.id, id: 'defaultTlsProfile-' + name, name:...
javascript
function(seriesCallback) { var modelname = 'tlsprofile'; async.forEachOf( apicCfg['tls-profiles'], function(profile, name, asyncCB) { var instance = { 'snapshot-id': uid, 'org-id': defaultOrg.id, id: 'defaultTlsProfile-' + name, name:...
[ "function", "(", "seriesCallback", ")", "{", "var", "modelname", "=", "'tlsprofile'", ";", "async", ".", "forEachOf", "(", "apicCfg", "[", "'tls-profiles'", "]", ",", "function", "(", "profile", ",", "name", ",", "asyncCB", ")", "{", "var", "instance", "="...
5. create the "tls-profile" instances
[ "5", ".", "create", "the", "tls", "-", "profile", "instances" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L1058-L1137
26,349
strongloop/microgateway-datastore
server/boot/load-model.js
populateSnapshot
function populateSnapshot(app, uid, cb) { logger.debug('populateSnapshot entry'); app.models.snapshot.create( { id: uid, refcount: '1', current: 'false' }, function(err, mymodel) { if (err) { logger.error('populateSnapshot error'); cb(err); return; } lo...
javascript
function populateSnapshot(app, uid, cb) { logger.debug('populateSnapshot entry'); app.models.snapshot.create( { id: uid, refcount: '1', current: 'false' }, function(err, mymodel) { if (err) { logger.error('populateSnapshot error'); cb(err); return; } lo...
[ "function", "populateSnapshot", "(", "app", ",", "uid", ",", "cb", ")", "{", "logger", ".", "debug", "(", "'populateSnapshot entry'", ")", ";", "app", ".", "models", ".", "snapshot", ".", "create", "(", "{", "id", ":", "uid", ",", "refcount", ":", "'1'...
Initializes new snapshot instance in snapshot model @param {???} app - loopback application @param {string} uid - snapshot identifier @param {callback} cb - callback that handles error or successful completion
[ "Initializes", "new", "snapshot", "instance", "in", "snapshot", "model" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L1418-L1434
26,350
strongloop/microgateway-datastore
server/boot/load-model.js
releaseSnapshot
function releaseSnapshot(app, uid, cb) { logger.debug('releaseSnapshot entry'); app.models.snapshot.release(uid, function(err) { if (err) { logger.error(err); } logger.debug('releaseSnapshot exit'); if (cb) { cb(err); } }); }
javascript
function releaseSnapshot(app, uid, cb) { logger.debug('releaseSnapshot entry'); app.models.snapshot.release(uid, function(err) { if (err) { logger.error(err); } logger.debug('releaseSnapshot exit'); if (cb) { cb(err); } }); }
[ "function", "releaseSnapshot", "(", "app", ",", "uid", ",", "cb", ")", "{", "logger", ".", "debug", "(", "'releaseSnapshot entry'", ")", ";", "app", ".", "models", ".", "snapshot", ".", "release", "(", "uid", ",", "function", "(", "err", ")", "{", "if"...
Releases reference on snapshot instance in snapshot model @param {???} app - loopback application @param {string} uid - snapshot identifier
[ "Releases", "reference", "on", "snapshot", "instance", "in", "snapshot", "model" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L1441-L1454
26,351
strongloop/microgateway-datastore
server/boot/load-model.js
updateSnapshot
function updateSnapshot(app, uid, cb) { logger.debug('updateSnapshot entry'); app.models.snapshot.findOne( { where: { current: 'true' } }, function(err, instance) { if (err) { // fall through assuming there was no current } else if (instance) { instance.updateAttributes( ...
javascript
function updateSnapshot(app, uid, cb) { logger.debug('updateSnapshot entry'); app.models.snapshot.findOne( { where: { current: 'true' } }, function(err, instance) { if (err) { // fall through assuming there was no current } else if (instance) { instance.updateAttributes( ...
[ "function", "updateSnapshot", "(", "app", ",", "uid", ",", "cb", ")", "{", "logger", ".", "debug", "(", "'updateSnapshot entry'", ")", ";", "app", ".", "models", ".", "snapshot", ".", "findOne", "(", "{", "where", ":", "{", "current", ":", "'true'", "}...
Updates snapshot instance in snapshot model to reflect 'current' @param {???} app - loopback application @param {string} uid - snapshot identifier @param {callback} cb - callback that handles error or successful completion
[ "Updates", "snapshot", "instance", "in", "snapshot", "model", "to", "reflect", "current" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/server/boot/load-model.js#L1462-L1501
26,352
strongloop/microgateway-datastore
common/models/optimizedData.js
getOpParams
function getOpParams(pathParams, opParams) { var unionParams = _.unionWith(opParams, pathParams, opParamComparator); return unionParams; }
javascript
function getOpParams(pathParams, opParams) { var unionParams = _.unionWith(opParams, pathParams, opParamComparator); return unionParams; }
[ "function", "getOpParams", "(", "pathParams", ",", "opParams", ")", "{", "var", "unionParams", "=", "_", ".", "unionWith", "(", "opParams", ",", "pathParams", ",", "opParamComparator", ")", ";", "return", "unionParams", ";", "}" ]
Returns a Object that denotes the parameters associated with the operation @param {Array} pathParams path-level parameters in the swagger @param {Array} opParams op-level perameters in the swagger
[ "Returns", "a", "Object", "that", "denotes", "the", "parameters", "associated", "with", "the", "operation" ]
cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7
https://github.com/strongloop/microgateway-datastore/blob/cd41b8b43fd6128e2e9eeab831c84c35c9cc64d7/common/models/optimizedData.js#L811-L814
26,353
berlinonline/converjon
lib/lock.js
free
function free(key) { if (locks[key]) { delete locks[key]; stats.lock_remove(); } tick(key); }
javascript
function free(key) { if (locks[key]) { delete locks[key]; stats.lock_remove(); } tick(key); }
[ "function", "free", "(", "key", ")", "{", "if", "(", "locks", "[", "key", "]", ")", "{", "delete", "locks", "[", "key", "]", ";", "stats", ".", "lock_remove", "(", ")", ";", "}", "tick", "(", "key", ")", ";", "}" ]
release a lock on a resource
[ "release", "a", "lock", "on", "a", "resource" ]
ace8c1b8ff0c3077919b73d3d7604c60a60f37f3
https://github.com/berlinonline/converjon/blob/ace8c1b8ff0c3077919b73d3d7604c60a60f37f3/lib/lock.js#L16-L22
26,354
berlinonline/converjon
lib/lock.js
tick
function tick(key) { var next; if (waiting[key]) { //there's somone waiting for this resource if (!locks[key]) { locks[key] = true; stats.lock_add(); next = waiting[key].shift(); if (waiting[key].length === 0) { //nobody is waiting ...
javascript
function tick(key) { var next; if (waiting[key]) { //there's somone waiting for this resource if (!locks[key]) { locks[key] = true; stats.lock_add(); next = waiting[key].shift(); if (waiting[key].length === 0) { //nobody is waiting ...
[ "function", "tick", "(", "key", ")", "{", "var", "next", ";", "if", "(", "waiting", "[", "key", "]", ")", "{", "//there's somone waiting for this resource", "if", "(", "!", "locks", "[", "key", "]", ")", "{", "locks", "[", "key", "]", "=", "true", ";...
cycle the waiting list for one resource
[ "cycle", "the", "waiting", "list", "for", "one", "resource" ]
ace8c1b8ff0c3077919b73d3d7604c60a60f37f3
https://github.com/berlinonline/converjon/blob/ace8c1b8ff0c3077919b73d3d7604c60a60f37f3/lib/lock.js#L27-L42
26,355
berlinonline/converjon
lib/lock.js
wait
function wait(key, cb) { if (!waiting[key]) { waiting[key] = []; } waiting[key].push(cb); }
javascript
function wait(key, cb) { if (!waiting[key]) { waiting[key] = []; } waiting[key].push(cb); }
[ "function", "wait", "(", "key", ",", "cb", ")", "{", "if", "(", "!", "waiting", "[", "key", "]", ")", "{", "waiting", "[", "key", "]", "=", "[", "]", ";", "}", "waiting", "[", "key", "]", ".", "push", "(", "cb", ")", ";", "}" ]
register a handler for a resource the handler will be called when nobody before it is waiting for that resoruce
[ "register", "a", "handler", "for", "a", "resource", "the", "handler", "will", "be", "called", "when", "nobody", "before", "it", "is", "waiting", "for", "that", "resoruce" ]
ace8c1b8ff0c3077919b73d3d7604c60a60f37f3
https://github.com/berlinonline/converjon/blob/ace8c1b8ff0c3077919b73d3d7604c60a60f37f3/lib/lock.js#L49-L55
26,356
berlinonline/converjon
lib/lock.js
lock
function lock(key) { var promise = new Promise(function(resolve, reject) { wait(key, function(key) { var released = false; var lock = function() { if (!released) { free(key); released = true; } }; ...
javascript
function lock(key) { var promise = new Promise(function(resolve, reject) { wait(key, function(key) { var released = false; var lock = function() { if (!released) { free(key); released = true; } }; ...
[ "function", "lock", "(", "key", ")", "{", "var", "promise", "=", "new", "Promise", "(", "function", "(", "resolve", ",", "reject", ")", "{", "wait", "(", "key", ",", "function", "(", "key", ")", "{", "var", "released", "=", "false", ";", "var", "lo...
Returns a promise for a resource lock that resolves into a function to release that lock again. Usage: var l1 = lock("foo"); l1.then(function(l) { // do your work // l.key contains the key of the locked_item l(); /release the lock }); @param {string} identifier for a resource to be locked @returns {Promise} A Promise...
[ "Returns", "a", "promise", "for", "a", "resource", "lock", "that", "resolves", "into", "a", "function", "to", "release", "that", "lock", "again", "." ]
ace8c1b8ff0c3077919b73d3d7604c60a60f37f3
https://github.com/berlinonline/converjon/blob/ace8c1b8ff0c3077919b73d3d7604c60a60f37f3/lib/lock.js#L72-L92
26,357
al66/imicros-flow
dev/flow.middleware.kafka.js
check
async function check(){ if (broker.emitter.open <= 0) return true; else { this.logger.warn("Event queue not empty... waiting", {queue: broker.emitter.open}); throw "Retry"; } }
javascript
async function check(){ if (broker.emitter.open <= 0) return true; else { this.logger.warn("Event queue not empty... waiting", {queue: broker.emitter.open}); throw "Retry"; } }
[ "async", "function", "check", "(", ")", "{", "if", "(", "broker", ".", "emitter", ".", "open", "<=", "0", ")", "return", "true", ";", "else", "{", "this", ".", "logger", ".", "warn", "(", "\"Event queue not empty... waiting\"", ",", "{", "queue", ":", ...
Wait for empty queue
[ "Wait", "for", "empty", "queue" ]
5998e3b88fb7d6a892c791162ad8b49aeefcfb31
https://github.com/al66/imicros-flow/blob/5998e3b88fb7d6a892c791162ad8b49aeefcfb31/dev/flow.middleware.kafka.js#L402-L408
26,358
tomarad/JSON-Schema-Instantiator
dist/scripts/scripts.js
isPropertyRequired
function isPropertyRequired(property, requiredArray) { var found = false; requiredArray = requiredArray || []; requiredArray.forEach(function(requiredProperty) { if (requiredProperty === property) { found = true; } }); return found; }
javascript
function isPropertyRequired(property, requiredArray) { var found = false; requiredArray = requiredArray || []; requiredArray.forEach(function(requiredProperty) { if (requiredProperty === property) { found = true; } }); return found; }
[ "function", "isPropertyRequired", "(", "property", ",", "requiredArray", ")", "{", "var", "found", "=", "false", ";", "requiredArray", "=", "requiredArray", "||", "[", "]", ";", "requiredArray", ".", "forEach", "(", "function", "(", "requiredProperty", ")", "{...
Checks whether a property is on required array. @param property - the property to check. @param requiredArray - the required array @returns {boolean}
[ "Checks", "whether", "a", "property", "is", "on", "required", "array", "." ]
04c35c5dd452f51a9a4d2f04d11bad57d7a5cba3
https://github.com/tomarad/JSON-Schema-Instantiator/blob/04c35c5dd452f51a9a4d2f04d11bad57d7a5cba3/dist/scripts/scripts.js#L30-L39
26,359
tomarad/JSON-Schema-Instantiator
dist/scripts/scripts.js
instantiatePrimitive
function instantiatePrimitive(val) { var type = val.type; // Support for default values in the JSON Schema. if (val.hasOwnProperty('default')) { return val.default; } return typesInstantiator[type]; }
javascript
function instantiatePrimitive(val) { var type = val.type; // Support for default values in the JSON Schema. if (val.hasOwnProperty('default')) { return val.default; } return typesInstantiator[type]; }
[ "function", "instantiatePrimitive", "(", "val", ")", "{", "var", "type", "=", "val", ".", "type", ";", "// Support for default values in the JSON Schema.", "if", "(", "val", ".", "hasOwnProperty", "(", "'default'", ")", ")", "{", "return", "val", ".", "default",...
Instantiate a primitive. @param val - The object that represents the primitive. @returns {*}
[ "Instantiate", "a", "primitive", "." ]
04c35c5dd452f51a9a4d2f04d11bad57d7a5cba3
https://github.com/tomarad/JSON-Schema-Instantiator/blob/04c35c5dd452f51a9a4d2f04d11bad57d7a5cba3/dist/scripts/scripts.js#L51-L60
26,360
tomarad/JSON-Schema-Instantiator
dist/scripts/scripts.js
getObjectType
function getObjectType(obj) { // Check if type is array of types. if (isArray(obj.type)) { obj.type = obj.type[0]; } return obj.type; }
javascript
function getObjectType(obj) { // Check if type is array of types. if (isArray(obj.type)) { obj.type = obj.type[0]; } return obj.type; }
[ "function", "getObjectType", "(", "obj", ")", "{", "// Check if type is array of types.", "if", "(", "isArray", "(", "obj", ".", "type", ")", ")", "{", "obj", ".", "type", "=", "obj", ".", "type", "[", "0", "]", ";", "}", "return", "obj", ".", "type", ...
Extracts the type of the object. If the type is an array, set type to first in list of types. If obj.type is not overridden, it will fail the isPrimitive check. Which internally also checks obj.type. @param obj - An object.
[ "Extracts", "the", "type", "of", "the", "object", ".", "If", "the", "type", "is", "an", "array", "set", "type", "to", "first", "in", "list", "of", "types", ".", "If", "obj", ".", "type", "is", "not", "overridden", "it", "will", "fail", "the", "isPrim...
04c35c5dd452f51a9a4d2f04d11bad57d7a5cba3
https://github.com/tomarad/JSON-Schema-Instantiator/blob/04c35c5dd452f51a9a4d2f04d11bad57d7a5cba3/dist/scripts/scripts.js#L87-L94
26,361
tomarad/JSON-Schema-Instantiator
dist/scripts/scripts.js
findDefinition
function findDefinition(schema, ref) { var propertyPath = ref.split('/').slice(1); // Ignore the #/uri at the beginning. var currentProperty = propertyPath.splice(0, 1)[0]; var currentValue = schema; while (currentProperty) { currentValue = currentValue[currentProperty]; currentProperty = propertyPath...
javascript
function findDefinition(schema, ref) { var propertyPath = ref.split('/').slice(1); // Ignore the #/uri at the beginning. var currentProperty = propertyPath.splice(0, 1)[0]; var currentValue = schema; while (currentProperty) { currentValue = currentValue[currentProperty]; currentProperty = propertyPath...
[ "function", "findDefinition", "(", "schema", ",", "ref", ")", "{", "var", "propertyPath", "=", "ref", ".", "split", "(", "'/'", ")", ".", "slice", "(", "1", ")", ";", "// Ignore the #/uri at the beginning.", "var", "currentProperty", "=", "propertyPath", ".", ...
Finds a definition in a schema. Useful for finding references. @param schema The full schema object. @param ref The reference to find. @return {*} The object representing the ref.
[ "Finds", "a", "definition", "in", "a", "schema", ".", "Useful", "for", "finding", "references", "." ]
04c35c5dd452f51a9a4d2f04d11bad57d7a5cba3
https://github.com/tomarad/JSON-Schema-Instantiator/blob/04c35c5dd452f51a9a4d2f04d11bad57d7a5cba3/dist/scripts/scripts.js#L120-L132
26,362
tomarad/JSON-Schema-Instantiator
dist/scripts/scripts.js
instantiate
function instantiate(schema, options) { options = options || {}; /** * Visits each sub-object using recursion. * If it reaches a primitive, instantiate it. * @param obj - The object that represents the schema. * @param name - The name of the current object. * @param data - The instance data that rep...
javascript
function instantiate(schema, options) { options = options || {}; /** * Visits each sub-object using recursion. * If it reaches a primitive, instantiate it. * @param obj - The object that represents the schema. * @param name - The name of the current object. * @param data - The instance data that rep...
[ "function", "instantiate", "(", "schema", ",", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "/**\n * Visits each sub-object using recursion.\n * If it reaches a primitive, instantiate it.\n * @param obj - The object that represents the schema.\n * @param...
The main function. Calls sub-objects recursively, depth first, using the sub-function 'visit'. @param schema - The schema to instantiate. @returns {*}
[ "The", "main", "function", ".", "Calls", "sub", "-", "objects", "recursively", "depth", "first", "using", "the", "sub", "-", "function", "visit", "." ]
04c35c5dd452f51a9a4d2f04d11bad57d7a5cba3
https://github.com/tomarad/JSON-Schema-Instantiator/blob/04c35c5dd452f51a9a4d2f04d11bad57d7a5cba3/dist/scripts/scripts.js#L140-L198
26,363
joecohens/laravel-elixir-webpack
index.js
function(options) { if (config.sourcemaps) { options = _.defaults( options, { devtool: '#source-map' } ); } if (config.production) { var currPlugins = _.isArray(options.plugins) ? options.plugins : []; options.plugins = currPlugins.concat([new UglifyJ...
javascript
function(options) { if (config.sourcemaps) { options = _.defaults( options, { devtool: '#source-map' } ); } if (config.production) { var currPlugins = _.isArray(options.plugins) ? options.plugins : []; options.plugins = currPlugins.concat([new UglifyJ...
[ "function", "(", "options", ")", "{", "if", "(", "config", ".", "sourcemaps", ")", "{", "options", "=", "_", ".", "defaults", "(", "options", ",", "{", "devtool", ":", "'#source-map'", "}", ")", ";", "}", "if", "(", "config", ".", "production", ")", ...
Add sensitive default values to webpack options such as sourcemaps and minification. @param {object} options @return {object}
[ "Add", "sensitive", "default", "values", "to", "webpack", "options", "such", "as", "sourcemaps", "and", "minification", "." ]
d56e06bbd854f16304387f737414889d3846be3b
https://github.com/joecohens/laravel-elixir-webpack/blob/d56e06bbd854f16304387f737414889d3846be3b/index.js#L65-L79
26,364
Peakfijn/Conventions
packages/cz-changelog-peakfijn/commitlint-utils.js
getRule
function getRule(commitlintConfig, ruleName) { const rule = commitlintConfig.rules[ruleName]; if (rule) { return { raw: rule, level: rule[0], applicable: rule[1], value: rule[2], }; } }
javascript
function getRule(commitlintConfig, ruleName) { const rule = commitlintConfig.rules[ruleName]; if (rule) { return { raw: rule, level: rule[0], applicable: rule[1], value: rule[2], }; } }
[ "function", "getRule", "(", "commitlintConfig", ",", "ruleName", ")", "{", "const", "rule", "=", "commitlintConfig", ".", "rules", "[", "ruleName", "]", ";", "if", "(", "rule", ")", "{", "return", "{", "raw", ":", "rule", ",", "level", ":", "rule", "["...
Get information from the loaded commitlint config. This will return an object containing the basic information for this rule. @param {Object} commitlintConfig @param {Object} ruleName @return {Object?}
[ "Get", "information", "from", "the", "loaded", "commitlint", "config", ".", "This", "will", "return", "an", "object", "containing", "the", "basic", "information", "for", "this", "rule", "." ]
09ac205ec93d18d0721517ccc80af5e22031de4b
https://github.com/Peakfijn/Conventions/blob/09ac205ec93d18d0721517ccc80af5e22031de4b/packages/cz-changelog-peakfijn/commitlint-utils.js#L11-L22
26,365
Peakfijn/Conventions
packages/cz-changelog-peakfijn/commitlint-utils.js
reportIsValid
function reportIsValid(report = {}) { return report.valid && report.errors.length === 0 && report.warnings.length === 0; }
javascript
function reportIsValid(report = {}) { return report.valid && report.errors.length === 0 && report.warnings.length === 0; }
[ "function", "reportIsValid", "(", "report", "=", "{", "}", ")", "{", "return", "report", ".", "valid", "&&", "report", ".", "errors", ".", "length", "===", "0", "&&", "report", ".", "warnings", ".", "length", "===", "0", ";", "}" ]
Determine if the report is valid and doesn't contain errors or warnings. @param {Object} report @return {boolean}
[ "Determine", "if", "the", "report", "is", "valid", "and", "doesn", "t", "contain", "errors", "or", "warnings", "." ]
09ac205ec93d18d0721517ccc80af5e22031de4b
https://github.com/Peakfijn/Conventions/blob/09ac205ec93d18d0721517ccc80af5e22031de4b/packages/cz-changelog-peakfijn/commitlint-utils.js#L51-L53
26,366
Peakfijn/Conventions
packages/cz-changelog-peakfijn/commitlint-utils.js
reportSummary
function reportSummary(report = {}) { if (reportIsValid(report)) { return ''; } const countErrors = report.errors.length; const countWarnings = report.warnings.length; const color = countErrors > 0 ? 'red' : 'yellow'; const summaries = []; const issues = []; if (countErrors > 0) { summaries.push(chalk`{r...
javascript
function reportSummary(report = {}) { if (reportIsValid(report)) { return ''; } const countErrors = report.errors.length; const countWarnings = report.warnings.length; const color = countErrors > 0 ? 'red' : 'yellow'; const summaries = []; const issues = []; if (countErrors > 0) { summaries.push(chalk`{r...
[ "function", "reportSummary", "(", "report", "=", "{", "}", ")", "{", "if", "(", "reportIsValid", "(", "report", ")", ")", "{", "return", "''", ";", "}", "const", "countErrors", "=", "report", ".", "errors", ".", "length", ";", "const", "countWarnings", ...
Log the provided lint report to the console. It should contain all information for the user to understand a possible rejection. @param {Object} report @return {string}
[ "Log", "the", "provided", "lint", "report", "to", "the", "console", ".", "It", "should", "contain", "all", "information", "for", "the", "user", "to", "understand", "a", "possible", "rejection", "." ]
09ac205ec93d18d0721517ccc80af5e22031de4b
https://github.com/Peakfijn/Conventions/blob/09ac205ec93d18d0721517ccc80af5e22031de4b/packages/cz-changelog-peakfijn/commitlint-utils.js#L62-L93
26,367
ufukomer/node-impala
lib/node-impala.js
connect
function connect() { var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var callback = arguments[1]; this.host = props.host || '127.0.0.1'; this.port = props.port || 21000; this.resultType = props.resultType || null; this.timeout = props.timeout || 1...
javascript
function connect() { var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var callback = arguments[1]; this.host = props.host || '127.0.0.1'; this.port = props.port || 21000; this.resultType = props.resultType || null; this.timeout = props.timeout || 1...
[ "function", "connect", "(", ")", "{", "var", "props", "=", "arguments", ".", "length", ">", "0", "&&", "arguments", "[", "0", "]", "!==", "undefined", "?", "arguments", "[", "0", "]", ":", "{", "}", ";", "var", "callback", "=", "arguments", "[", "1...
Creates connection using given props. @param props {object} @param callback {function} @returns {function|promise}
[ "Creates", "connection", "using", "given", "props", "." ]
6d82c7bac101c18f4ee77051e832be2168ca73df
https://github.com/ufukomer/node-impala/blob/6d82c7bac101c18f4ee77051e832be2168ca73df/lib/node-impala.js#L53-L85
26,368
bpedro/node-fs
lib/fs.js
mkdir_p
function mkdir_p (path, mode, callback, position) { var parts = require('path').normalize(path).split(osSep); mode = mode || process.umask(); position = position || 0; if (position >= parts.length) { return callback(); } var directory = parts.slice(0, position + 1).join(osSep) || os...
javascript
function mkdir_p (path, mode, callback, position) { var parts = require('path').normalize(path).split(osSep); mode = mode || process.umask(); position = position || 0; if (position >= parts.length) { return callback(); } var directory = parts.slice(0, position + 1).join(osSep) || os...
[ "function", "mkdir_p", "(", "path", ",", "mode", ",", "callback", ",", "position", ")", "{", "var", "parts", "=", "require", "(", "'path'", ")", ".", "normalize", "(", "path", ")", ".", "split", "(", "osSep", ")", ";", "mode", "=", "mode", "||", "p...
Offers functionality similar to mkdir -p Asynchronous operation. No arguments other than a possible exception are given to the completion callback.
[ "Offers", "functionality", "similar", "to", "mkdir", "-", "p" ]
a03dad5b9389ece9fe47affe83f227baeab0ce2c
https://github.com/bpedro/node-fs/blob/a03dad5b9389ece9fe47affe83f227baeab0ce2c/lib/fs.js#L15-L39
26,369
npm/npm-remote-ls
lib/remote-ls.js
RemoteLS
function RemoteLS (opts) { var _this = this _.extend(this, { logger: console, development: true, // include dev dependencies. optional: true, // include optional dependencies. peer: false, // include peer dependencies. verbose: false, registry: require('registry-url')(), // URL of registry ...
javascript
function RemoteLS (opts) { var _this = this _.extend(this, { logger: console, development: true, // include dev dependencies. optional: true, // include optional dependencies. peer: false, // include peer dependencies. verbose: false, registry: require('registry-url')(), // URL of registry ...
[ "function", "RemoteLS", "(", "opts", ")", "{", "var", "_this", "=", "this", "_", ".", "extend", "(", "this", ",", "{", "logger", ":", "console", ",", "development", ":", "true", ",", "// include dev dependencies.", "optional", ":", "true", ",", "// include...
perform a recursive walk of a remote npm package and determine its dependency tree.
[ "perform", "a", "recursive", "walk", "of", "a", "remote", "npm", "package", "and", "determine", "its", "dependency", "tree", "." ]
bc233b6e15364c3868362030d5b00aa43cc48696
https://github.com/npm/npm-remote-ls/blob/bc233b6e15364c3868362030d5b00aa43cc48696/lib/remote-ls.js#L11-L29
26,370
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnAddColumn
function _fnAddColumn( oSettings, nTh ) { var oDefaults = DataTable.defaults.columns; var iCol = oSettings.aoColumns.length; var oCol = $.extend( {}, DataTable.models.oColumn, oDefaults, { "sSortingClass": oSettings.oClasses.sSortable, "sSortingClassJUI": oSettings.oClasses.sSortJUI, "nTh": nTh ?...
javascript
function _fnAddColumn( oSettings, nTh ) { var oDefaults = DataTable.defaults.columns; var iCol = oSettings.aoColumns.length; var oCol = $.extend( {}, DataTable.models.oColumn, oDefaults, { "sSortingClass": oSettings.oClasses.sSortable, "sSortingClassJUI": oSettings.oClasses.sSortJUI, "nTh": nTh ?...
[ "function", "_fnAddColumn", "(", "oSettings", ",", "nTh", ")", "{", "var", "oDefaults", "=", "DataTable", ".", "defaults", ".", "columns", ";", "var", "iCol", "=", "oSettings", ".", "aoColumns", ".", "length", ";", "var", "oCol", "=", "$", ".", "extend",...
Add a column to the list used for the table with default values @param {object} oSettings dataTables settings object @param {node} nTh The th element for this column @memberof DataTable#oApi
[ "Add", "a", "column", "to", "the", "list", "used", "for", "the", "table", "with", "default", "values" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L69-L111
26,371
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnVisbleColumns
function _fnVisbleColumns( oS ) { var iVis = 0; for ( var i=0 ; i<oS.aoColumns.length ; i++ ) { if ( oS.aoColumns[i].bVisible === true ) { iVis++; } } return iVis; }
javascript
function _fnVisbleColumns( oS ) { var iVis = 0; for ( var i=0 ; i<oS.aoColumns.length ; i++ ) { if ( oS.aoColumns[i].bVisible === true ) { iVis++; } } return iVis; }
[ "function", "_fnVisbleColumns", "(", "oS", ")", "{", "var", "iVis", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "oS", ".", "aoColumns", ".", "length", ";", "i", "++", ")", "{", "if", "(", "oS", ".", "aoColumns", "[", "i", ...
Get the number of visible columns @returns {int} i the number of visible columns @param {object} oS dataTables settings object @memberof DataTable#oApi
[ "Get", "the", "number", "of", "visible", "columns" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L268-L279
26,372
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnDetectType
function _fnDetectType( sData ) { var aTypes = DataTable.ext.aTypes; var iLen = aTypes.length; for ( var i=0 ; i<iLen ; i++ ) { var sType = aTypes[i]( sData ); if ( sType !== null ) { return sType; } } return 'string'; }
javascript
function _fnDetectType( sData ) { var aTypes = DataTable.ext.aTypes; var iLen = aTypes.length; for ( var i=0 ; i<iLen ; i++ ) { var sType = aTypes[i]( sData ); if ( sType !== null ) { return sType; } } return 'string'; }
[ "function", "_fnDetectType", "(", "sData", ")", "{", "var", "aTypes", "=", "DataTable", ".", "ext", ".", "aTypes", ";", "var", "iLen", "=", "aTypes", ".", "length", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "iLen", ";", "i", "++", ")"...
Get the sort type based on an input string @param {string} sData data we wish to know the type of @returns {string} type (defaults to 'string' if no type can be detected) @memberof DataTable#oApi
[ "Get", "the", "sort", "type", "based", "on", "an", "input", "string" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L288-L303
26,373
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnReOrderIndex
function _fnReOrderIndex ( oSettings, sColumns ) { var aColumns = sColumns.split(','); var aiReturn = []; for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) { for ( var j=0 ; j<iLen ; j++ ) { if ( oSettings.aoColumns[i].sName == aColumns[j] ) { aiReturn.push( j ); ...
javascript
function _fnReOrderIndex ( oSettings, sColumns ) { var aColumns = sColumns.split(','); var aiReturn = []; for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) { for ( var j=0 ; j<iLen ; j++ ) { if ( oSettings.aoColumns[i].sName == aColumns[j] ) { aiReturn.push( j ); ...
[ "function", "_fnReOrderIndex", "(", "oSettings", ",", "sColumns", ")", "{", "var", "aColumns", "=", "sColumns", ".", "split", "(", "','", ")", ";", "var", "aiReturn", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ",", "iLen", "=", "oSettings"...
Figure out how to reorder a display list @param {object} oSettings dataTables settings object @returns array {int} aiReturn index list for reordering @memberof DataTable#oApi
[ "Figure", "out", "how", "to", "reorder", "a", "display", "list" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L312-L330
26,374
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnColumnOrdering
function _fnColumnOrdering ( oSettings ) { var sNames = ''; for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) { sNames += oSettings.aoColumns[i].sName+','; } if ( sNames.length == iLen ) { return ""; } return sNames.slice(0, -1); }
javascript
function _fnColumnOrdering ( oSettings ) { var sNames = ''; for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) { sNames += oSettings.aoColumns[i].sName+','; } if ( sNames.length == iLen ) { return ""; } return sNames.slice(0, -1); }
[ "function", "_fnColumnOrdering", "(", "oSettings", ")", "{", "var", "sNames", "=", "''", ";", "for", "(", "var", "i", "=", "0", ",", "iLen", "=", "oSettings", ".", "aoColumns", ".", "length", ";", "i", "<", "iLen", ";", "i", "++", ")", "{", "sNames...
Get the column ordering that DataTables expects @param {object} oSettings dataTables settings object @returns {string} comma separated list of names @memberof DataTable#oApi
[ "Get", "the", "column", "ordering", "that", "DataTables", "expects" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L339-L351
26,375
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnGetRowData
function _fnGetRowData( oSettings, iRow, sSpecific ) { var out = []; for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) { out.push( _fnGetCellData( oSettings, iRow, i, sSpecific ) ); } return out; }
javascript
function _fnGetRowData( oSettings, iRow, sSpecific ) { var out = []; for ( var i=0, iLen=oSettings.aoColumns.length ; i<iLen ; i++ ) { out.push( _fnGetCellData( oSettings, iRow, i, sSpecific ) ); } return out; }
[ "function", "_fnGetRowData", "(", "oSettings", ",", "iRow", ",", "sSpecific", ")", "{", "var", "out", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ",", "iLen", "=", "oSettings", ".", "aoColumns", ".", "length", ";", "i", "<", "iLen", ";", ...
Get an array of data for a given row from the internal data cache @param {object} oSettings dataTables settings object @param {int} iRow aoData row id @param {string} sSpecific data get type ('type' 'filter' 'sort') @returns {array} Data array @memberof DataTable#oApi
[ "Get", "an", "array", "of", "data", "for", "a", "given", "row", "from", "the", "internal", "data", "cache" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L714-L722
26,376
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnSetCellData
function _fnSetCellData( oSettings, iRow, iCol, val ) { var oCol = oSettings.aoColumns[iCol]; var oData = oSettings.aoData[iRow]._aData; oCol.fnSetData( oData, val ); }
javascript
function _fnSetCellData( oSettings, iRow, iCol, val ) { var oCol = oSettings.aoColumns[iCol]; var oData = oSettings.aoData[iRow]._aData; oCol.fnSetData( oData, val ); }
[ "function", "_fnSetCellData", "(", "oSettings", ",", "iRow", ",", "iCol", ",", "val", ")", "{", "var", "oCol", "=", "oSettings", ".", "aoColumns", "[", "iCol", "]", ";", "var", "oData", "=", "oSettings", ".", "aoData", "[", "iRow", "]", ".", "_aData", ...
Set the value for a specific cell, into the internal data cache @param {object} oSettings dataTables settings object @param {int} iRow aoData row id @param {int} iCol Column index @param {*} val Value to set @memberof DataTable#oApi
[ "Set", "the", "value", "for", "a", "specific", "cell", "into", "the", "internal", "data", "cache" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L779-L785
26,377
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnGetDataMaster
function _fnGetDataMaster ( oSettings ) { var aData = []; var iLen = oSettings.aoData.length; for ( var i=0 ; i<iLen; i++ ) { aData.push( oSettings.aoData[i]._aData ); } return aData; }
javascript
function _fnGetDataMaster ( oSettings ) { var aData = []; var iLen = oSettings.aoData.length; for ( var i=0 ; i<iLen; i++ ) { aData.push( oSettings.aoData[i]._aData ); } return aData; }
[ "function", "_fnGetDataMaster", "(", "oSettings", ")", "{", "var", "aData", "=", "[", "]", ";", "var", "iLen", "=", "oSettings", ".", "aoData", ".", "length", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "iLen", ";", "i", "++", ")", "{",...
Return an array with the full table data @param {object} oSettings dataTables settings object @returns array {array} aData Master data array @memberof DataTable#oApi
[ "Return", "an", "array", "with", "the", "full", "table", "data" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L893-L902
26,378
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnGetUniqueThs
function _fnGetUniqueThs ( oSettings, nHeader, aLayout ) { var aReturn = []; if ( !aLayout ) { aLayout = oSettings.aoHeader; if ( nHeader ) { aLayout = []; _fnDetectHeader( aLayout, nHeader ); } } for ( var i=0, iLen=aLayout.length ; i<iLen ; i++ ) { for ( var j=0, j...
javascript
function _fnGetUniqueThs ( oSettings, nHeader, aLayout ) { var aReturn = []; if ( !aLayout ) { aLayout = oSettings.aoHeader; if ( nHeader ) { aLayout = []; _fnDetectHeader( aLayout, nHeader ); } } for ( var i=0, iLen=aLayout.length ; i<iLen ; i++ ) { for ( var j=0, j...
[ "function", "_fnGetUniqueThs", "(", "oSettings", ",", "nHeader", ",", "aLayout", ")", "{", "var", "aReturn", "=", "[", "]", ";", "if", "(", "!", "aLayout", ")", "{", "aLayout", "=", "oSettings", ".", "aoHeader", ";", "if", "(", "nHeader", ")", "{", "...
Get an array of unique th elements, one for each column @param {object} oSettings dataTables settings object @param {node} nHeader automatically detect the layout from this node - optional @param {array} aLayout thead/tfoot layout from _fnDetectHeader - optional @returns array {node} aReturn list of unique ths @membero...
[ "Get", "an", "array", "of", "unique", "th", "elements", "one", "for", "each", "column" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L1731-L1757
26,379
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnBuildSearchArray
function _fnBuildSearchArray ( oSettings, iMaster ) { if ( !oSettings.oFeatures.bServerSide ) { /* Clear out the old data */ oSettings.asDataSearch.splice( 0, oSettings.asDataSearch.length ); var aArray = (iMaster && iMaster===1) ? oSettings.aiDisplayMaster : oSettings.aiDisplay; ...
javascript
function _fnBuildSearchArray ( oSettings, iMaster ) { if ( !oSettings.oFeatures.bServerSide ) { /* Clear out the old data */ oSettings.asDataSearch.splice( 0, oSettings.asDataSearch.length ); var aArray = (iMaster && iMaster===1) ? oSettings.aiDisplayMaster : oSettings.aiDisplay; ...
[ "function", "_fnBuildSearchArray", "(", "oSettings", ",", "iMaster", ")", "{", "if", "(", "!", "oSettings", ".", "oFeatures", ".", "bServerSide", ")", "{", "/* Clear out the old data */", "oSettings", ".", "asDataSearch", ".", "splice", "(", "0", ",", "oSettings...
Create an array which can be quickly search through @param {object} oSettings dataTables settings object @param {int} iMaster use the master data array - optional @memberof DataTable#oApi
[ "Create", "an", "array", "which", "can", "be", "quickly", "search", "through" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L2221-L2237
26,380
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnBuildSearchRow
function _fnBuildSearchRow( oSettings, aData ) { var sSearch = ''; if ( oSettings.__nTmpFilter === undefined ) { oSettings.__nTmpFilter = document.createElement('div'); } var nTmp = oSettings.__nTmpFilter; for ( var j=0, jLen=oSettings.aoColumns.length ; j<jLen ; j++ ) { if ( oSetting...
javascript
function _fnBuildSearchRow( oSettings, aData ) { var sSearch = ''; if ( oSettings.__nTmpFilter === undefined ) { oSettings.__nTmpFilter = document.createElement('div'); } var nTmp = oSettings.__nTmpFilter; for ( var j=0, jLen=oSettings.aoColumns.length ; j<jLen ; j++ ) { if ( oSetting...
[ "function", "_fnBuildSearchRow", "(", "oSettings", ",", "aData", ")", "{", "var", "sSearch", "=", "''", ";", "if", "(", "oSettings", ".", "__nTmpFilter", "===", "undefined", ")", "{", "oSettings", ".", "__nTmpFilter", "=", "document", ".", "createElement", "...
Create a searchable string from a single data row @param {object} oSettings dataTables settings object @param {array} aData Row data array to use for the data to search @memberof DataTable#oApi
[ "Create", "a", "searchable", "string", "from", "a", "single", "data", "row" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L2246-L2275
26,381
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnDataToSearch
function _fnDataToSearch ( sData, sType ) { if ( typeof DataTable.ext.ofnSearch[sType] === "function" ) { return DataTable.ext.ofnSearch[sType]( sData ); } else if ( sData === null ) { return ''; } else if ( sType == "html" ) { return sData.replace(/[\r\n]/g," ").replace( /<.*?>/g,...
javascript
function _fnDataToSearch ( sData, sType ) { if ( typeof DataTable.ext.ofnSearch[sType] === "function" ) { return DataTable.ext.ofnSearch[sType]( sData ); } else if ( sData === null ) { return ''; } else if ( sType == "html" ) { return sData.replace(/[\r\n]/g," ").replace( /<.*?>/g,...
[ "function", "_fnDataToSearch", "(", "sData", ",", "sType", ")", "{", "if", "(", "typeof", "DataTable", ".", "ext", ".", "ofnSearch", "[", "sType", "]", "===", "\"function\"", ")", "{", "return", "DataTable", ".", "ext", ".", "ofnSearch", "[", "sType", "]...
Convert raw data into something that the user can search on @param {string} sData data to be modified @param {string} sType data type @returns {string} search string @memberof DataTable#oApi
[ "Convert", "raw", "data", "into", "something", "that", "the", "user", "can", "search", "on" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L2314-L2333
26,382
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnEscapeRegex
function _fnEscapeRegex ( sVal ) { var acEscape = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^' ]; var reReplace = new RegExp( '(\\' + acEscape.join('|\\') + ')', 'g' ); return sVal.replace(reReplace, '\\$1'); }
javascript
function _fnEscapeRegex ( sVal ) { var acEscape = [ '/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\', '$', '^' ]; var reReplace = new RegExp( '(\\' + acEscape.join('|\\') + ')', 'g' ); return sVal.replace(reReplace, '\\$1'); }
[ "function", "_fnEscapeRegex", "(", "sVal", ")", "{", "var", "acEscape", "=", "[", "'/'", ",", "'.'", ",", "'*'", ",", "'+'", ",", "'?'", ",", "'|'", ",", "'('", ",", "')'", ",", "'['", ",", "']'", ",", "'{'", ",", "'}'", ",", "'\\\\'", ",", "'$...
scape a string stuch that it can be used in a regular expression @param {string} sVal string to escape @returns {string} escaped string @memberof DataTable#oApi
[ "scape", "a", "string", "stuch", "that", "it", "can", "be", "used", "in", "a", "regular", "expression" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L2342-L2347
26,383
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnCalculateEnd
function _fnCalculateEnd( oSettings ) { if ( oSettings.oFeatures.bPaginate === false ) { oSettings._iDisplayEnd = oSettings.aiDisplay.length; } else { /* Set the end point of the display - based on how many elements there are * still to display */ if ( oSettings._iDisplayStart + o...
javascript
function _fnCalculateEnd( oSettings ) { if ( oSettings.oFeatures.bPaginate === false ) { oSettings._iDisplayEnd = oSettings.aiDisplay.length; } else { /* Set the end point of the display - based on how many elements there are * still to display */ if ( oSettings._iDisplayStart + o...
[ "function", "_fnCalculateEnd", "(", "oSettings", ")", "{", "if", "(", "oSettings", ".", "oFeatures", ".", "bPaginate", "===", "false", ")", "{", "oSettings", ".", "_iDisplayEnd", "=", "oSettings", ".", "aiDisplay", ".", "length", ";", "}", "else", "{", "/*...
Rcalculate the end point based on the start point @param {object} oSettings dataTables settings object @memberof DataTable#oApi
[ "Rcalculate", "the", "end", "point", "based", "on", "the", "start", "point" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L2718-L2739
26,384
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnScrollingWidthAdjust
function _fnScrollingWidthAdjust ( oSettings, n ) { if ( oSettings.oScroll.sX === "" && oSettings.oScroll.sY !== "" ) { /* When y-scrolling only, we want to remove the width of the scroll bar so the table * + scroll bar will fit into the area avaialble. */ var iOrigWidth = $(n).width(); n....
javascript
function _fnScrollingWidthAdjust ( oSettings, n ) { if ( oSettings.oScroll.sX === "" && oSettings.oScroll.sY !== "" ) { /* When y-scrolling only, we want to remove the width of the scroll bar so the table * + scroll bar will fit into the area avaialble. */ var iOrigWidth = $(n).width(); n....
[ "function", "_fnScrollingWidthAdjust", "(", "oSettings", ",", "n", ")", "{", "if", "(", "oSettings", ".", "oScroll", ".", "sX", "===", "\"\"", "&&", "oSettings", ".", "oScroll", ".", "sY", "!==", "\"\"", ")", "{", "/* When y-scrolling only, we want to remove the...
Adjust a table's width to take account of scrolling @param {object} oSettings dataTables settings object @param {node} n table node @memberof DataTable#oApi
[ "Adjust", "a", "table", "s", "width", "to", "take", "account", "of", "scrolling" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L3663-L3678
26,385
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnSaveState
function _fnSaveState ( oSettings ) { if ( !oSettings.oFeatures.bStateSave || oSettings.bDestroying ) { return; } /* Store the interesting variables */ var i, iLen, bInfinite=oSettings.oScroll.bInfinite; var oState = { "iCreate": new Date().getTime(), "iStart": (bInfinite ?...
javascript
function _fnSaveState ( oSettings ) { if ( !oSettings.oFeatures.bStateSave || oSettings.bDestroying ) { return; } /* Store the interesting variables */ var i, iLen, bInfinite=oSettings.oScroll.bInfinite; var oState = { "iCreate": new Date().getTime(), "iStart": (bInfinite ?...
[ "function", "_fnSaveState", "(", "oSettings", ")", "{", "if", "(", "!", "oSettings", ".", "oFeatures", ".", "bStateSave", "||", "oSettings", ".", "bDestroying", ")", "{", "return", ";", "}", "/* Store the interesting variables */", "var", "i", ",", "iLen", ","...
Save the state of a table in a cookie such that the page can be reloaded @param {object} oSettings dataTables settings object @memberof DataTable#oApi
[ "Save", "the", "state", "of", "a", "table", "in", "a", "cookie", "such", "that", "the", "page", "can", "be", "reloaded" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L4271-L4299
26,386
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnLoadState
function _fnLoadState ( oSettings, oInit ) { if ( !oSettings.oFeatures.bStateSave ) { return; } var oData = oSettings.fnStateLoad.call( oSettings.oInstance, oSettings ); if ( !oData ) { return; } /* Allow custom and plug-in manipulation functions to alter the saved data set and ...
javascript
function _fnLoadState ( oSettings, oInit ) { if ( !oSettings.oFeatures.bStateSave ) { return; } var oData = oSettings.fnStateLoad.call( oSettings.oInstance, oSettings ); if ( !oData ) { return; } /* Allow custom and plug-in manipulation functions to alter the saved data set and ...
[ "function", "_fnLoadState", "(", "oSettings", ",", "oInit", ")", "{", "if", "(", "!", "oSettings", ".", "oFeatures", ".", "bStateSave", ")", "{", "return", ";", "}", "var", "oData", "=", "oSettings", ".", "fnStateLoad", ".", "call", "(", "oSettings", "."...
Attempt to load a saved table state from a cookie @param {object} oSettings dataTables settings object @param {object} oInit DataTables init object so we can override settings @memberof DataTable#oApi
[ "Attempt", "to", "load", "a", "saved", "table", "state", "from", "a", "cookie" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L4308-L4357
26,387
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnCreateCookie
function _fnCreateCookie ( sName, sValue, iSecs, sBaseName, fnCallback ) { var date = new Date(); date.setTime( date.getTime()+(iSecs*1000) ); /* * Shocking but true - it would appear IE has major issues with having the path not having * a trailing slash on it. We need the cookie to be available...
javascript
function _fnCreateCookie ( sName, sValue, iSecs, sBaseName, fnCallback ) { var date = new Date(); date.setTime( date.getTime()+(iSecs*1000) ); /* * Shocking but true - it would appear IE has major issues with having the path not having * a trailing slash on it. We need the cookie to be available...
[ "function", "_fnCreateCookie", "(", "sName", ",", "sValue", ",", "iSecs", ",", "sBaseName", ",", "fnCallback", ")", "{", "var", "date", "=", "new", "Date", "(", ")", ";", "date", ".", "setTime", "(", "date", ".", "getTime", "(", ")", "+", "(", "iSecs...
Create a new cookie with a value to store the state of a table @param {string} sName name of the cookie to create @param {string} sValue the value the cookie should take @param {int} iSecs duration of the cookie @param {string} sBaseName sName is made up of the base + file name - this is the base @param {function} fnCa...
[ "Create", "a", "new", "cookie", "with", "a", "value", "to", "store", "the", "state", "of", "a", "table" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L4369-L4432
26,388
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnReadCookie
function _fnReadCookie ( sName ) { var aParts = window.location.pathname.split('/'), sNameEQ = sName + '_' + aParts[aParts.length-1].replace(/[\/:]/g,"").toLowerCase() + '=', sCookieContents = document.cookie.split(';'); for( var i=0 ; i<sCookieContents.length ; i++ ) { var c = sCookieCo...
javascript
function _fnReadCookie ( sName ) { var aParts = window.location.pathname.split('/'), sNameEQ = sName + '_' + aParts[aParts.length-1].replace(/[\/:]/g,"").toLowerCase() + '=', sCookieContents = document.cookie.split(';'); for( var i=0 ; i<sCookieContents.length ; i++ ) { var c = sCookieCo...
[ "function", "_fnReadCookie", "(", "sName", ")", "{", "var", "aParts", "=", "window", ".", "location", ".", "pathname", ".", "split", "(", "'/'", ")", ",", "sNameEQ", "=", "sName", "+", "'_'", "+", "aParts", "[", "aParts", ".", "length", "-", "1", "]"...
Read an old cookie to get a cookie with an old table state @param {string} sName name of the cookie to read @returns {string} contents of the cookie - or null if no cookie with that name found @memberof DataTable#oApi
[ "Read", "an", "old", "cookie", "to", "get", "a", "cookie", "with", "an", "old", "table", "state" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L4441-L4463
26,389
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnGetTrNodes
function _fnGetTrNodes ( oSettings ) { var aNodes = []; var aoData = oSettings.aoData; for ( var i=0, iLen=aoData.length ; i<iLen ; i++ ) { if ( aoData[i].nTr !== null ) { aNodes.push( aoData[i].nTr ); } } return aNodes; }
javascript
function _fnGetTrNodes ( oSettings ) { var aNodes = []; var aoData = oSettings.aoData; for ( var i=0, iLen=aoData.length ; i<iLen ; i++ ) { if ( aoData[i].nTr !== null ) { aNodes.push( aoData[i].nTr ); } } return aNodes; }
[ "function", "_fnGetTrNodes", "(", "oSettings", ")", "{", "var", "aNodes", "=", "[", "]", ";", "var", "aoData", "=", "oSettings", ".", "aoData", ";", "for", "(", "var", "i", "=", "0", ",", "iLen", "=", "aoData", ".", "length", ";", "i", "<", "iLen",...
Return an array with the TR nodes for the table @param {object} oSettings dataTables settings object @returns {array} TR array @memberof DataTable#oApi
[ "Return", "an", "array", "with", "the", "TR", "nodes", "for", "the", "table" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L4493-L4505
26,390
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnGetTdNodes
function _fnGetTdNodes ( oSettings, iIndividualRow ) { var anReturn = []; var iCorrector; var anTds; var iRow, iRows=oSettings.aoData.length, iColumn, iColumns, oData, sNodeName, iStart=0, iEnd=iRows; /* Allow the collection to be limited to just one row */ if ( iIndividualRow !== undefined ...
javascript
function _fnGetTdNodes ( oSettings, iIndividualRow ) { var anReturn = []; var iCorrector; var anTds; var iRow, iRows=oSettings.aoData.length, iColumn, iColumns, oData, sNodeName, iStart=0, iEnd=iRows; /* Allow the collection to be limited to just one row */ if ( iIndividualRow !== undefined ...
[ "function", "_fnGetTdNodes", "(", "oSettings", ",", "iIndividualRow", ")", "{", "var", "anReturn", "=", "[", "]", ";", "var", "iCorrector", ";", "var", "anTds", ";", "var", "iRow", ",", "iRows", "=", "oSettings", ".", "aoData", ".", "length", ",", "iColu...
Return an flat array with all TD nodes for the table, or row @param {object} oSettings dataTables settings object @param {int} [iIndividualRow] aoData index to get the nodes for - optional if not given then the return array will contain all nodes for the table @returns {array} TD array @memberof DataTable#oApi
[ "Return", "an", "flat", "array", "with", "all", "TD", "nodes", "for", "the", "table", "or", "row" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L4516-L4564
26,391
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnBindAction
function _fnBindAction( n, oData, fn ) { $(n) .bind( 'click.DT', oData, function (e) { n.blur(); // Remove focus outline for mouse users fn(e); } ) .bind( 'keypress.DT', oData, function (e){ if ( e.which === 13 ) { fn(e); } } ) .bind( 'selectstart.DT', function () { ...
javascript
function _fnBindAction( n, oData, fn ) { $(n) .bind( 'click.DT', oData, function (e) { n.blur(); // Remove focus outline for mouse users fn(e); } ) .bind( 'keypress.DT', oData, function (e){ if ( e.which === 13 ) { fn(e); } } ) .bind( 'selectstart.DT', function () { ...
[ "function", "_fnBindAction", "(", "n", ",", "oData", ",", "fn", ")", "{", "$", "(", "n", ")", ".", "bind", "(", "'click.DT'", ",", "oData", ",", "function", "(", "e", ")", "{", "n", ".", "blur", "(", ")", ";", "// Remove focus outline for mouse users",...
Bind an event handers to allow a click or return key to activate the callback. This is good for accessability since a return on the keyboard will have the same effect as a click, if the element has focus. @param {element} n Element to bind the action to @param {object} oData Data object to pass to the triggered functio...
[ "Bind", "an", "event", "handers", "to", "allow", "a", "click", "or", "return", "key", "to", "activate", "the", "callback", ".", "This", "is", "good", "for", "accessability", "since", "a", "return", "on", "the", "keyboard", "will", "have", "the", "same", ...
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L4661-L4676
26,392
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
_fnCallbackReg
function _fnCallbackReg( oSettings, sStore, fn, sName ) { if ( fn ) { oSettings[sStore].push( { "fn": fn, "sName": sName } ); } }
javascript
function _fnCallbackReg( oSettings, sStore, fn, sName ) { if ( fn ) { oSettings[sStore].push( { "fn": fn, "sName": sName } ); } }
[ "function", "_fnCallbackReg", "(", "oSettings", ",", "sStore", ",", "fn", ",", "sName", ")", "{", "if", "(", "fn", ")", "{", "oSettings", "[", "sStore", "]", ".", "push", "(", "{", "\"fn\"", ":", "fn", ",", "\"sName\"", ":", "sName", "}", ")", ";",...
Register a callback function. Easily allows a callback function to be added to an array store of callback functions that can then all be called together. @param {object} oSettings dataTables settings object @param {string} sStore Name of the array storeage for the callbacks in oSettings @param {function} fn Function to...
[ "Register", "a", "callback", "function", ".", "Easily", "allows", "a", "callback", "function", "to", "be", "added", "to", "an", "array", "store", "of", "callback", "functions", "that", "can", "then", "all", "be", "called", "together", "." ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L4688-L4697
26,393
joyent/kang
examples/webconsole/resources/js/jquery/jquery.dataTables.js
function () { if ( this.oFeatures.bServerSide ) { if ( this.oFeatures.bPaginate === false || this._iDisplayLength == -1 ) { return this._iDisplayStart+this.aiDisplay.length; } else { return Math.min( this._iDisplayStart+this._iDisplayLength, this._iRecordsDisplay ); } } else { r...
javascript
function () { if ( this.oFeatures.bServerSide ) { if ( this.oFeatures.bPaginate === false || this._iDisplayLength == -1 ) { return this._iDisplayStart+this.aiDisplay.length; } else { return Math.min( this._iDisplayStart+this._iDisplayLength, this._iRecordsDisplay ); } } else { r...
[ "function", "(", ")", "{", "if", "(", "this", ".", "oFeatures", ".", "bServerSide", ")", "{", "if", "(", "this", ".", "oFeatures", ".", "bPaginate", "===", "false", "||", "this", ".", "_iDisplayLength", "==", "-", "1", ")", "{", "return", "this", "."...
Set the display end point - aiDisplay index @type function @todo Should do away with _iDisplayEnd and calculate it on-the-fly here
[ "Set", "the", "display", "end", "point", "-", "aiDisplay", "index" ]
9b138f2b4fb7873b9b0f271516daf36e20c9c037
https://github.com/joyent/kang/blob/9b138f2b4fb7873b9b0f271516daf36e20c9c037/examples/webconsole/resources/js/jquery/jquery.dataTables.js#L11123-L11135
26,394
uber-workflow/probot-app-pr-title
validate-title.js
validateSentence
function validateSentence(parsed) { const sentences = parsed.sentences(); return [ !isSingleSentence(sentences) ? 'Must be one and only one sentence.' : null, !isNotTooShort(parsed) ? 'Must be at least two words long.' : null, !isNotPunctuated(sentences) ? 'Must not have any end punctuation.' : null, ...
javascript
function validateSentence(parsed) { const sentences = parsed.sentences(); return [ !isSingleSentence(sentences) ? 'Must be one and only one sentence.' : null, !isNotTooShort(parsed) ? 'Must be at least two words long.' : null, !isNotPunctuated(sentences) ? 'Must not have any end punctuation.' : null, ...
[ "function", "validateSentence", "(", "parsed", ")", "{", "const", "sentences", "=", "parsed", ".", "sentences", "(", ")", ";", "return", "[", "!", "isSingleSentence", "(", "sentences", ")", "?", "'Must be one and only one sentence.'", ":", "null", ",", "!", "i...
Validate text is a single sentence with no end punctuation
[ "Validate", "text", "is", "a", "single", "sentence", "with", "no", "end", "punctuation" ]
c3b29c5c9a9571e3e9a44fc5992003a2e744d69c
https://github.com/uber-workflow/probot-app-pr-title/blob/c3b29c5c9a9571e3e9a44fc5992003a2e744d69c/validate-title.js#L15-L22
26,395
uber-workflow/probot-app-pr-title
validate-title.js
validateFirstTerm
function validateFirstTerm(parsed) { const term = parsed.terms().data()[0]; return [ !isValidVerb(term) ? 'First word must be imperative verb.' : null, !isCapitalized(term) ? 'First word must be capitalized.' : null, ].filter(Boolean); }
javascript
function validateFirstTerm(parsed) { const term = parsed.terms().data()[0]; return [ !isValidVerb(term) ? 'First word must be imperative verb.' : null, !isCapitalized(term) ? 'First word must be capitalized.' : null, ].filter(Boolean); }
[ "function", "validateFirstTerm", "(", "parsed", ")", "{", "const", "term", "=", "parsed", ".", "terms", "(", ")", ".", "data", "(", ")", "[", "0", "]", ";", "return", "[", "!", "isValidVerb", "(", "term", ")", "?", "'First word must be imperative verb.'", ...
Validate first word is a capitalized imperative mood verb
[ "Validate", "first", "word", "is", "a", "capitalized", "imperative", "mood", "verb" ]
c3b29c5c9a9571e3e9a44fc5992003a2e744d69c
https://github.com/uber-workflow/probot-app-pr-title/blob/c3b29c5c9a9571e3e9a44fc5992003a2e744d69c/validate-title.js#L25-L31
26,396
stream-utils/destroy
index.js
destroy
function destroy (stream) { if (stream instanceof ReadStream) { return destroyReadStream(stream) } if (!(stream instanceof Stream)) { return stream } if (typeof stream.destroy === 'function') { stream.destroy() } return stream }
javascript
function destroy (stream) { if (stream instanceof ReadStream) { return destroyReadStream(stream) } if (!(stream instanceof Stream)) { return stream } if (typeof stream.destroy === 'function') { stream.destroy() } return stream }
[ "function", "destroy", "(", "stream", ")", "{", "if", "(", "stream", "instanceof", "ReadStream", ")", "{", "return", "destroyReadStream", "(", "stream", ")", "}", "if", "(", "!", "(", "stream", "instanceof", "Stream", ")", ")", "{", "return", "stream", "...
Destroy a stream. @param {object} stream @public
[ "Destroy", "a", "stream", "." ]
d1a76c640b63ef662d19c8d6211f705eed06f32e
https://github.com/stream-utils/destroy/blob/d1a76c640b63ef662d19c8d6211f705eed06f32e/index.js#L31-L45
26,397
stream-utils/destroy
index.js
destroyReadStream
function destroyReadStream (stream) { stream.destroy() if (typeof stream.close === 'function') { // node.js core bug work-around stream.on('open', onOpenClose) } return stream }
javascript
function destroyReadStream (stream) { stream.destroy() if (typeof stream.close === 'function') { // node.js core bug work-around stream.on('open', onOpenClose) } return stream }
[ "function", "destroyReadStream", "(", "stream", ")", "{", "stream", ".", "destroy", "(", ")", "if", "(", "typeof", "stream", ".", "close", "===", "'function'", ")", "{", "// node.js core bug work-around", "stream", ".", "on", "(", "'open'", ",", "onOpenClose",...
Destroy a ReadStream. @param {object} stream @private
[ "Destroy", "a", "ReadStream", "." ]
d1a76c640b63ef662d19c8d6211f705eed06f32e
https://github.com/stream-utils/destroy/blob/d1a76c640b63ef662d19c8d6211f705eed06f32e/index.js#L54-L63
26,398
jaredhanson/passport-windowslive
lib/errors/liveconnectapierror.js
LiveConnectAPIError
function LiveConnectAPIError(message, code) { Error.call(this); Error.captureStackTrace(this, arguments.callee); this.name = 'LiveConnectAPIError'; this.message = message; this.code = code; }
javascript
function LiveConnectAPIError(message, code) { Error.call(this); Error.captureStackTrace(this, arguments.callee); this.name = 'LiveConnectAPIError'; this.message = message; this.code = code; }
[ "function", "LiveConnectAPIError", "(", "message", ",", "code", ")", "{", "Error", ".", "call", "(", "this", ")", ";", "Error", ".", "captureStackTrace", "(", "this", ",", "arguments", ".", "callee", ")", ";", "this", ".", "name", "=", "'LiveConnectAPIErro...
`LiveConnectAPIError` error. References: - http://msdn.microsoft.com/en-us/library/live/hh243648.aspx#error @constructor @param {string} [message] @param {string} [code] @access public
[ "LiveConnectAPIError", "error", "." ]
47cad2be5830c13d46eb9f1d334990fd8702aa1e
https://github.com/jaredhanson/passport-windowslive/blob/47cad2be5830c13d46eb9f1d334990fd8702aa1e/lib/errors/liveconnectapierror.js#L12-L18
26,399
rniemeyer/knockout-amd-helpers
spec/amdBindings.spec.js
function(observable, value, callback) { var subscription = observable.subscribe(function() { subscription.dispose(); setTimeout(function() { callback(); }, 50); }); observable(value); }
javascript
function(observable, value, callback) { var subscription = observable.subscribe(function() { subscription.dispose(); setTimeout(function() { callback(); }, 50); }); observable(value); }
[ "function", "(", "observable", ",", "value", ",", "callback", ")", "{", "var", "subscription", "=", "observable", ".", "subscribe", "(", "function", "(", ")", "{", "subscription", ".", "dispose", "(", ")", ";", "setTimeout", "(", "function", "(", ")", "{...
helper to update an observable, wait, and check result
[ "helper", "to", "update", "an", "observable", "wait", "and", "check", "result" ]
0e4884bb1c95b15be950b8f4474393ac042ecb24
https://github.com/rniemeyer/knockout-amd-helpers/blob/0e4884bb1c95b15be950b8f4474393ac042ecb24/spec/amdBindings.spec.js#L38-L49