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
55,000
darrencruse/sugarlisp-core
reader.js
read_via_closest_dialect
function read_via_closest_dialect(lexer, options) { trace(lexer.message_src_loc("", lexer, {file:false})); // options allow this function to be used when a readtab // handler needs to read by invoking a handler that it's // overridden, without knowing what dialect was overridden. // (see invoke_readfn_overri...
javascript
function read_via_closest_dialect(lexer, options) { trace(lexer.message_src_loc("", lexer, {file:false})); // options allow this function to be used when a readtab // handler needs to read by invoking a handler that it's // overridden, without knowing what dialect was overridden. // (see invoke_readfn_overri...
[ "function", "read_via_closest_dialect", "(", "lexer", ",", "options", ")", "{", "trace", "(", "lexer", ".", "message_src_loc", "(", "\"\"", ",", "lexer", ",", "{", "file", ":", "false", "}", ")", ")", ";", "// options allow this function to be used when a readtab"...
Read the form under the current position, using the closest scoped dialect that contains a matching entry in it's readtab. If such an entry returns "reader.retry", try the *next* closest dialect with a match (and so on) until one of the dialect's reads the form, otherwise it gets read by the closest "__default" handle...
[ "Read", "the", "form", "under", "the", "current", "position", "using", "the", "closest", "scoped", "dialect", "that", "contains", "a", "matching", "entry", "in", "it", "s", "readtab", "." ]
c6ff983ebc3d60268054d6fe046db4aff6c5f78c
https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/reader.js#L479-L546
55,001
darrencruse/sugarlisp-core
reader.js
pop_local_dialects
function pop_local_dialects(lexer, list) { if(list && list.length > 0) { // we go in reverse order since the most recently // used (pushed) dialects will be at the end for(var i = list.length-1; i >= 0; i--) { if(list[i].dialect) { unuse_dialect(list[i].dialect, lexer); } } } }
javascript
function pop_local_dialects(lexer, list) { if(list && list.length > 0) { // we go in reverse order since the most recently // used (pushed) dialects will be at the end for(var i = list.length-1; i >= 0; i--) { if(list[i].dialect) { unuse_dialect(list[i].dialect, lexer); } } } }
[ "function", "pop_local_dialects", "(", "lexer", ",", "list", ")", "{", "if", "(", "list", "&&", "list", ".", "length", ">", "0", ")", "{", "// we go in reverse order since the most recently", "// used (pushed) dialects will be at the end", "for", "(", "var", "i", "=...
pop any local dialects enabled within the scope of the provided list. note: here we intentionally look just one level down at the *direct* children of the list, since "grandchildren" have scopes of their own that are "popped" separately.
[ "pop", "any", "local", "dialects", "enabled", "within", "the", "scope", "of", "the", "provided", "list", "." ]
c6ff983ebc3d60268054d6fe046db4aff6c5f78c
https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/reader.js#L809-L819
55,002
darrencruse/sugarlisp-core
reader.js
read_delimited_text
function read_delimited_text(lexer, start, end, options) { options = options || {includeDelimiters: true}; var delimited = lexer.next_delimited_token(start, end, options); return sl.atom(delimited); }
javascript
function read_delimited_text(lexer, start, end, options) { options = options || {includeDelimiters: true}; var delimited = lexer.next_delimited_token(start, end, options); return sl.atom(delimited); }
[ "function", "read_delimited_text", "(", "lexer", ",", "start", ",", "end", ",", "options", ")", "{", "options", "=", "options", "||", "{", "includeDelimiters", ":", "true", "}", ";", "var", "delimited", "=", "lexer", ".", "next_delimited_token", "(", "start"...
scan some delimited text and get it as a string atom lexer.options.omitDelimiters = whether to include the include the delimiters or not
[ "scan", "some", "delimited", "text", "and", "get", "it", "as", "a", "string", "atom", "lexer", ".", "options", ".", "omitDelimiters", "=", "whether", "to", "include", "the", "include", "the", "delimiters", "or", "not" ]
c6ff983ebc3d60268054d6fe046db4aff6c5f78c
https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/reader.js#L849-L853
55,003
darrencruse/sugarlisp-core
reader.js
symbol
function symbol(lexer, text) { var token = lexer.next_token(text); return sl.atom(text, {token: token}); }
javascript
function symbol(lexer, text) { var token = lexer.next_token(text); return sl.atom(text, {token: token}); }
[ "function", "symbol", "(", "lexer", ",", "text", ")", "{", "var", "token", "=", "lexer", ".", "next_token", "(", "text", ")", ";", "return", "sl", ".", "atom", "(", "text", ",", "{", "token", ":", "token", "}", ")", ";", "}" ]
A symbol Use reader.symbol in their readtab to ensure the lexer scans the specified token text correctly as a symbol.
[ "A", "symbol", "Use", "reader", ".", "symbol", "in", "their", "readtab", "to", "ensure", "the", "lexer", "scans", "the", "specified", "token", "text", "correctly", "as", "a", "symbol", "." ]
c6ff983ebc3d60268054d6fe046db4aff6c5f78c
https://github.com/darrencruse/sugarlisp-core/blob/c6ff983ebc3d60268054d6fe046db4aff6c5f78c/reader.js#L1211-L1214
55,004
Knorcedger/mongoose-schema-extender
index.js
callback
function callback(req, res, resolve, reject, error, result, permissions, action) { if (error) { reqlog.error('internal server error', error); if (exports.handleErrors) { responseBuilder.error(req, res, 'INTERNAL_SERVER_ERROR'); } else { reject(error); } } else { // filter the result attributes to sen...
javascript
function callback(req, res, resolve, reject, error, result, permissions, action) { if (error) { reqlog.error('internal server error', error); if (exports.handleErrors) { responseBuilder.error(req, res, 'INTERNAL_SERVER_ERROR'); } else { reject(error); } } else { // filter the result attributes to sen...
[ "function", "callback", "(", "req", ",", "res", ",", "resolve", ",", "reject", ",", "error", ",", "result", ",", "permissions", ",", "action", ")", "{", "if", "(", "error", ")", "{", "reqlog", ".", "error", "(", "'internal server error'", ",", "error", ...
Query callback. Handles errors, filters attributes @method callback @param {object} req The request object @param {object} res The response object @param {function} resolve The promise resolve @param {function} reject The promise reject @param {object} error The query error...
[ "Query", "callback", ".", "Handles", "errors", "filters", "attributes" ]
6878d7bee4a1a4befb8698dd9d1787242c6be395
https://github.com/Knorcedger/mongoose-schema-extender/blob/6878d7bee4a1a4befb8698dd9d1787242c6be395/index.js#L183-L232
55,005
Knorcedger/mongoose-schema-extender
index.js
filterAttributes
function filterAttributes(object, permissions) { if (object) { var userType = req.activeUser && req.activeUser.type || 'null'; for (var attribute in object._doc) { if (object._doc.hasOwnProperty(attribute)) { // dont return this attribute when: if (!permissions[attribute] || // if this attribute i...
javascript
function filterAttributes(object, permissions) { if (object) { var userType = req.activeUser && req.activeUser.type || 'null'; for (var attribute in object._doc) { if (object._doc.hasOwnProperty(attribute)) { // dont return this attribute when: if (!permissions[attribute] || // if this attribute i...
[ "function", "filterAttributes", "(", "object", ",", "permissions", ")", "{", "if", "(", "object", ")", "{", "var", "userType", "=", "req", ".", "activeUser", "&&", "req", ".", "activeUser", ".", "type", "||", "'null'", ";", "for", "(", "var", "attribute"...
Delete the attributes that the activeUser cant see @method filterAttributes @param {object} object The result object @param {object} permissions The permissions object @return {object} The filtered object
[ "Delete", "the", "attributes", "that", "the", "activeUser", "cant", "see" ]
6878d7bee4a1a4befb8698dd9d1787242c6be395
https://github.com/Knorcedger/mongoose-schema-extender/blob/6878d7bee4a1a4befb8698dd9d1787242c6be395/index.js#L213-L231
55,006
Industryswarm/isnode-mod-data
lib/mongodb/mongodb/lib/operations/cursor_ops.js
hasNext
function hasNext(cursor, callback) { const Cursor = require('../cursor'); if (cursor.s.currentDoc) { return callback(null, true); } if (cursor.isNotified()) { return callback(null, false); } nextObject(cursor, (err, doc) => { if (err) return callback(err, null); if (cursor.s.state === Cur...
javascript
function hasNext(cursor, callback) { const Cursor = require('../cursor'); if (cursor.s.currentDoc) { return callback(null, true); } if (cursor.isNotified()) { return callback(null, false); } nextObject(cursor, (err, doc) => { if (err) return callback(err, null); if (cursor.s.state === Cur...
[ "function", "hasNext", "(", "cursor", ",", "callback", ")", "{", "const", "Cursor", "=", "require", "(", "'../cursor'", ")", ";", "if", "(", "cursor", ".", "s", ".", "currentDoc", ")", "{", "return", "callback", "(", "null", ",", "true", ")", ";", "}...
Check if there is any document still available in the cursor. @method @param {Cursor} cursor The Cursor instance on which to run. @param {Cursor~resultCallback} [callback] The result callback.
[ "Check", "if", "there", "is", "any", "document", "still", "available", "in", "the", "cursor", "." ]
5adc639b88a0d72cbeef23a6b5df7f4540745089
https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb/lib/operations/cursor_ops.js#L116-L134
55,007
Industryswarm/isnode-mod-data
lib/mongodb/mongodb/lib/operations/cursor_ops.js
nextObject
function nextObject(cursor, callback) { const Cursor = require('../cursor'); if (cursor.s.state === Cursor.CLOSED || (cursor.isDead && cursor.isDead())) return handleCallback( callback, MongoError.create({ message: 'Cursor is closed', driver: true }) ); if (cursor.s.state === Cursor.INIT && c...
javascript
function nextObject(cursor, callback) { const Cursor = require('../cursor'); if (cursor.s.state === Cursor.CLOSED || (cursor.isDead && cursor.isDead())) return handleCallback( callback, MongoError.create({ message: 'Cursor is closed', driver: true }) ); if (cursor.s.state === Cursor.INIT && c...
[ "function", "nextObject", "(", "cursor", ",", "callback", ")", "{", "const", "Cursor", "=", "require", "(", "'../cursor'", ")", ";", "if", "(", "cursor", ".", "s", ".", "state", "===", "Cursor", ".", "CLOSED", "||", "(", "cursor", ".", "isDead", "&&", ...
Get the next available document from the cursor, returns null if no more documents are available.
[ "Get", "the", "next", "available", "document", "from", "the", "cursor", "returns", "null", "if", "no", "more", "documents", "are", "available", "." ]
5adc639b88a0d72cbeef23a6b5df7f4540745089
https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb/lib/operations/cursor_ops.js#L167-L189
55,008
Industryswarm/isnode-mod-data
lib/mongodb/mongodb/lib/operations/cursor_ops.js
toArray
function toArray(cursor, callback) { const Cursor = require('../cursor'); const items = []; // Reset cursor cursor.rewind(); cursor.s.state = Cursor.INIT; // Fetch all the documents const fetchDocs = () => { cursor._next((err, doc) => { if (err) { return cursor._endSession ?...
javascript
function toArray(cursor, callback) { const Cursor = require('../cursor'); const items = []; // Reset cursor cursor.rewind(); cursor.s.state = Cursor.INIT; // Fetch all the documents const fetchDocs = () => { cursor._next((err, doc) => { if (err) { return cursor._endSession ?...
[ "function", "toArray", "(", "cursor", ",", "callback", ")", "{", "const", "Cursor", "=", "require", "(", "'../cursor'", ")", ";", "const", "items", "=", "[", "]", ";", "// Reset cursor", "cursor", ".", "rewind", "(", ")", ";", "cursor", ".", "s", ".", ...
Returns an array of documents. See Cursor.prototype.toArray for more information. @method @param {Cursor} cursor The Cursor instance from which to get the next document. @param {Cursor~toArrayResultCallback} [callback] The result callback.
[ "Returns", "an", "array", "of", "documents", ".", "See", "Cursor", ".", "prototype", ".", "toArray", "for", "more", "information", "." ]
5adc639b88a0d72cbeef23a6b5df7f4540745089
https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb/lib/operations/cursor_ops.js#L198-L240
55,009
composi/idb
src/index.js
get
function get(key, store = getDefaultStore()) { let req return store[IDBStore]('readonly', store => { req = store.get(key) }).then(() => req.result) }
javascript
function get(key, store = getDefaultStore()) { let req return store[IDBStore]('readonly', store => { req = store.get(key) }).then(() => req.result) }
[ "function", "get", "(", "key", ",", "store", "=", "getDefaultStore", "(", ")", ")", "{", "let", "req", "return", "store", "[", "IDBStore", "]", "(", "'readonly'", ",", "store", "=>", "{", "req", "=", "store", ".", "get", "(", "key", ")", "}", ")", ...
Get a value based on the provided key. @param {string} key The key to use. @param {any} store A default value provided by IDB. @return {Promise} Promise
[ "Get", "a", "value", "based", "on", "the", "provided", "key", "." ]
f64c25ec2b90d23b04820722bac758bc869f0871
https://github.com/composi/idb/blob/f64c25ec2b90d23b04820722bac758bc869f0871/src/index.js#L53-L58
55,010
constantology/id8
src/Source.js
function( config ) { !is_obj( config ) || Object.keys( config ).forEach( function( key ) { if ( typeof config[key] == 'function' && typeof this[key] == 'function' ) // this allows you to override a method for a this[__override__]( key, config[key] ); // specific instance of a Class, rather than requ...
javascript
function( config ) { !is_obj( config ) || Object.keys( config ).forEach( function( key ) { if ( typeof config[key] == 'function' && typeof this[key] == 'function' ) // this allows you to override a method for a this[__override__]( key, config[key] ); // specific instance of a Class, rather than requ...
[ "function", "(", "config", ")", "{", "!", "is_obj", "(", "config", ")", "||", "Object", ".", "keys", "(", "config", ")", ".", "forEach", "(", "function", "(", "key", ")", "{", "if", "(", "typeof", "config", "[", "key", "]", "==", "'function'", "&&"...
this is set by `beforeinstance` to avoid weird behaviour constructor methods
[ "this", "is", "set", "by", "beforeinstance", "to", "avoid", "weird", "behaviour", "constructor", "methods" ]
8e97cbf56406da2cd53f825fa4f24ae2263971ce
https://github.com/constantology/id8/blob/8e97cbf56406da2cd53f825fa4f24ae2263971ce/src/Source.js#L115-L124
55,011
antonycourtney/tabli-core
lib/js/tabWindow.js
makeBookmarkedTabItem
function makeBookmarkedTabItem(bm) { var urlStr = bm.url; if (!urlStr) { console.error('makeBookmarkedTabItem: Malformed bookmark: missing URL!: ', bm); urlStr = ''; // better than null or undefined! } if (bm.title === undefined) { console.warn('makeBookmarkedTabItem: Bookmark title undefined (igno...
javascript
function makeBookmarkedTabItem(bm) { var urlStr = bm.url; if (!urlStr) { console.error('makeBookmarkedTabItem: Malformed bookmark: missing URL!: ', bm); urlStr = ''; // better than null or undefined! } if (bm.title === undefined) { console.warn('makeBookmarkedTabItem: Bookmark title undefined (igno...
[ "function", "makeBookmarkedTabItem", "(", "bm", ")", "{", "var", "urlStr", "=", "bm", ".", "url", ";", "if", "(", "!", "urlStr", ")", "{", "console", ".", "error", "(", "'makeBookmarkedTabItem: Malformed bookmark: missing URL!: '", ",", "bm", ")", ";", "urlStr...
Initialize a TabItem from a bookmark Returned TabItem is closed (not associated with an open tab)
[ "Initialize", "a", "TabItem", "from", "a", "bookmark" ]
76cc540891421bc6c8bdcf00f277ebb6e716fdd9
https://github.com/antonycourtney/tabli-core/blob/76cc540891421bc6c8bdcf00f277ebb6e716fdd9/lib/js/tabWindow.js#L97-L119
55,012
antonycourtney/tabli-core
lib/js/tabWindow.js
makeOpenTabItem
function makeOpenTabItem(tab) { var urlStr = tab.url; if (!urlStr) { console.error('malformed tab -- no URL: ', tab); urlStr = ''; } /* if (!tab.title) { console.warn("tab missing title (ignoring...): ", tab); } */ var tabItem = new TabItem({ url: urlStr, audible: tab.audible, ...
javascript
function makeOpenTabItem(tab) { var urlStr = tab.url; if (!urlStr) { console.error('malformed tab -- no URL: ', tab); urlStr = ''; } /* if (!tab.title) { console.warn("tab missing title (ignoring...): ", tab); } */ var tabItem = new TabItem({ url: urlStr, audible: tab.audible, ...
[ "function", "makeOpenTabItem", "(", "tab", ")", "{", "var", "urlStr", "=", "tab", ".", "url", ";", "if", "(", "!", "urlStr", ")", "{", "console", ".", "error", "(", "'malformed tab -- no URL: '", ",", "tab", ")", ";", "urlStr", "=", "''", ";", "}", "...
Initialize a TabItem from an open Chrome tab
[ "Initialize", "a", "TabItem", "from", "an", "open", "Chrome", "tab" ]
76cc540891421bc6c8bdcf00f277ebb6e716fdd9
https://github.com/antonycourtney/tabli-core/blob/76cc540891421bc6c8bdcf00f277ebb6e716fdd9/lib/js/tabWindow.js#L124-L146
55,013
antonycourtney/tabli-core
lib/js/tabWindow.js
mergeOpenTabs
function mergeOpenTabs(tabItems, openTabs) { var tabInfo = getOpenTabInfo(tabItems, openTabs); /* TODO: Use algorithm from OLDtabWindow.js to determine tab order. * For now, let's just concat open and closed tabs, in their sorted order. */ var openTabItems = tabInfo.get(true, Immutable.Seq()).sortBy(functi...
javascript
function mergeOpenTabs(tabItems, openTabs) { var tabInfo = getOpenTabInfo(tabItems, openTabs); /* TODO: Use algorithm from OLDtabWindow.js to determine tab order. * For now, let's just concat open and closed tabs, in their sorted order. */ var openTabItems = tabInfo.get(true, Immutable.Seq()).sortBy(functi...
[ "function", "mergeOpenTabs", "(", "tabItems", ",", "openTabs", ")", "{", "var", "tabInfo", "=", "getOpenTabInfo", "(", "tabItems", ",", "openTabs", ")", ";", "/* TODO: Use algorithm from OLDtabWindow.js to determine tab order.\n * For now, let's just concat open and closed tabs...
Merge currently open tabs from an open Chrome window with tabItem state of a saved tabWindow @param {Seq<TabItem>} tabItems -- previous TabItem state @param {[Tab]} openTabs -- currently open tabs from Chrome window @returns {Seq<TabItem>} TabItems reflecting current window state
[ "Merge", "currently", "open", "tabs", "from", "an", "open", "Chrome", "window", "with", "tabItem", "state", "of", "a", "saved", "tabWindow" ]
76cc540891421bc6c8bdcf00f277ebb6e716fdd9
https://github.com/antonycourtney/tabli-core/blob/76cc540891421bc6c8bdcf00f277ebb6e716fdd9/lib/js/tabWindow.js#L370-L386
55,014
antonycourtney/tabli-core
lib/js/tabWindow.js
updateWindow
function updateWindow(tabWindow, chromeWindow) { // console.log("updateWindow: ", tabWindow.toJS(), chromeWindow); var mergedTabItems = mergeOpenTabs(tabWindow.tabItems, chromeWindow.tabs); var updWindow = tabWindow.set('tabItems', mergedTabItems).set('focused', chromeWindow.focused).set('open', true).set('openWi...
javascript
function updateWindow(tabWindow, chromeWindow) { // console.log("updateWindow: ", tabWindow.toJS(), chromeWindow); var mergedTabItems = mergeOpenTabs(tabWindow.tabItems, chromeWindow.tabs); var updWindow = tabWindow.set('tabItems', mergedTabItems).set('focused', chromeWindow.focused).set('open', true).set('openWi...
[ "function", "updateWindow", "(", "tabWindow", ",", "chromeWindow", ")", "{", "// console.log(\"updateWindow: \", tabWindow.toJS(), chromeWindow);", "var", "mergedTabItems", "=", "mergeOpenTabs", "(", "tabWindow", ".", "tabItems", ",", "chromeWindow", ".", "tabs", ")", ";"...
update a TabWindow from a current snapshot of the Chrome Window @param {TabWindow} tabWindow - TabWindow to be updated @param {ChromeWindow} chromeWindow - current snapshot of Chrome window state @return {TabWindow} Updated TabWindow
[ "update", "a", "TabWindow", "from", "a", "current", "snapshot", "of", "the", "Chrome", "Window" ]
76cc540891421bc6c8bdcf00f277ebb6e716fdd9
https://github.com/antonycourtney/tabli-core/blob/76cc540891421bc6c8bdcf00f277ebb6e716fdd9/lib/js/tabWindow.js#L396-L401
55,015
antonycourtney/tabli-core
lib/js/tabWindow.js
saveTab
function saveTab(tabWindow, tabItem, tabNode) { var _tabWindow$tabItems$f3 = tabWindow.tabItems.findEntry(function (ti) { return ti.open && ti.openTabId === tabItem.openTabId; }); var _tabWindow$tabItems$f4 = _slicedToArray(_tabWindow$tabItems$f3, 1); var index = _tabWindow$tabItems$f4[0]; var updTabI...
javascript
function saveTab(tabWindow, tabItem, tabNode) { var _tabWindow$tabItems$f3 = tabWindow.tabItems.findEntry(function (ti) { return ti.open && ti.openTabId === tabItem.openTabId; }); var _tabWindow$tabItems$f4 = _slicedToArray(_tabWindow$tabItems$f3, 1); var index = _tabWindow$tabItems$f4[0]; var updTabI...
[ "function", "saveTab", "(", "tabWindow", ",", "tabItem", ",", "tabNode", ")", "{", "var", "_tabWindow$tabItems$f3", "=", "tabWindow", ".", "tabItems", ".", "findEntry", "(", "function", "(", "ti", ")", "{", "return", "ti", ".", "open", "&&", "ti", ".", "...
Update a tab's saved state @param {TabWindow} tabWindow - tab window with tab that's been closed @param {TabItem} tabItem -- open tab that has been saved @param {BookmarkTreeNode} tabNode -- bookmark node for saved bookmark @return {TabWindow} tabWindow with tabItems updated to reflect saved state
[ "Update", "a", "tab", "s", "saved", "state" ]
76cc540891421bc6c8bdcf00f277ebb6e716fdd9
https://github.com/antonycourtney/tabli-core/blob/76cc540891421bc6c8bdcf00f277ebb6e716fdd9/lib/js/tabWindow.js#L445-L460
55,016
terryweiss/papyrus-core
document/probe.js
pushin
function pushin( path, record, setter, newValue ) { var context = record; var parent = record; var lastPart = null; var _i; var _len; var part; var keys; for ( _i = 0, _len = path.length; _i < _len; _i++ ) { part = path[_i]; lastPart = part; parent = context; context = context[part]; if ( sys.isNull(...
javascript
function pushin( path, record, setter, newValue ) { var context = record; var parent = record; var lastPart = null; var _i; var _len; var part; var keys; for ( _i = 0, _len = path.length; _i < _len; _i++ ) { part = path[_i]; lastPart = part; parent = context; context = context[part]; if ( sys.isNull(...
[ "function", "pushin", "(", "path", ",", "record", ",", "setter", ",", "newValue", ")", "{", "var", "context", "=", "record", ";", "var", "parent", "=", "record", ";", "var", "lastPart", "=", "null", ";", "var", "_i", ";", "var", "_len", ";", "var", ...
This will write the value into a record at the path, creating intervening objects if they don't exist @private @param {array} path The split path of the element to work with @param {object} record The record to reach into @param {string} setter The set command, defaults to $set @param {object} newValue The value to wri...
[ "This", "will", "write", "the", "value", "into", "a", "record", "at", "the", "path", "creating", "intervening", "objects", "if", "they", "don", "t", "exist" ]
d80fbcc2a8d07492477bab49df41c536e9a9230b
https://github.com/terryweiss/papyrus-core/blob/d80fbcc2a8d07492477bab49df41c536e9a9230b/document/probe.js#L199-L340
55,017
forfuturellc/svc-fbr
src/lib/fs.js
handle
function handle(options, callback) { if (_.isString(options)) { options = { path: options }; } if (_.isObject(options)) { const opts = { }; _.merge(opts, config, options); options = opts; } else { options = _.cloneDeep(config); } options.path = options.path || config.get("home"); ret...
javascript
function handle(options, callback) { if (_.isString(options)) { options = { path: options }; } if (_.isObject(options)) { const opts = { }; _.merge(opts, config, options); options = opts; } else { options = _.cloneDeep(config); } options.path = options.path || config.get("home"); ret...
[ "function", "handle", "(", "options", ",", "callback", ")", "{", "if", "(", "_", ".", "isString", "(", "options", ")", ")", "{", "options", "=", "{", "path", ":", "options", "}", ";", "}", "if", "(", "_", ".", "isObject", "(", "options", ")", ")"...
Handling requests for browsing file-system @param {Object|String} options @param {Function} callback
[ "Handling", "requests", "for", "browsing", "file", "-", "system" ]
8c07c71d6423d1dbd4f903a032dea0bfec63894e
https://github.com/forfuturellc/svc-fbr/blob/8c07c71d6423d1dbd4f903a032dea0bfec63894e/src/lib/fs.js#L29-L59
55,018
fd/fd-angular-core
lib/Component.js
Component
function Component(opts) { if (typeof opts === "function") { var _constructor = opts;opts = null; return register(_constructor); } opts = opts || {}; var _opts = opts; var _opts$restrict = _opts.restrict; var restrict = _opts$restrict === undefined ? "EA" : _opts$restrict; var _opts$replace = _opts.replace;...
javascript
function Component(opts) { if (typeof opts === "function") { var _constructor = opts;opts = null; return register(_constructor); } opts = opts || {}; var _opts = opts; var _opts$restrict = _opts.restrict; var restrict = _opts$restrict === undefined ? "EA" : _opts$restrict; var _opts$replace = _opts.replace;...
[ "function", "Component", "(", "opts", ")", "{", "if", "(", "typeof", "opts", "===", "\"function\"", ")", "{", "var", "_constructor", "=", "opts", ";", "opts", "=", "null", ";", "return", "register", "(", "_constructor", ")", ";", "}", "opts", "=", "opt...
Declare an angular Component directive. @function Component @param {Object} [opts] @param {String} [opts.name] @param {String} [opts.restrict="EA"] @param {Boolean} [opts.restrict="false"] @param {Boolean} [opts.transclude="EA"] @param {Object} [opts.scope={}] @param {String} [opts.template] @param {String} [opts.tem...
[ "Declare", "an", "angular", "Component", "directive", "." ]
e4206c90310e9fcf440abbd5aa9b12d97ed6c9a6
https://github.com/fd/fd-angular-core/blob/e4206c90310e9fcf440abbd5aa9b12d97ed6c9a6/lib/Component.js#L38-L90
55,019
Majiir/safesocket
safesocket.js
safesocket
function safesocket (expected, fn) { return function () { var _args = []; for (var idx in arguments) { _args.push(arguments[idx]); } var args = _args.filter(notFunction).slice(0, expected); for (var i = args.length; i < expected; i++) { args.push(undefined); } var arg = _args.pop(); args.push((...
javascript
function safesocket (expected, fn) { return function () { var _args = []; for (var idx in arguments) { _args.push(arguments[idx]); } var args = _args.filter(notFunction).slice(0, expected); for (var i = args.length; i < expected; i++) { args.push(undefined); } var arg = _args.pop(); args.push((...
[ "function", "safesocket", "(", "expected", ",", "fn", ")", "{", "return", "function", "(", ")", "{", "var", "_args", "=", "[", "]", ";", "for", "(", "var", "idx", "in", "arguments", ")", "{", "_args", ".", "push", "(", "arguments", "[", "idx", "]",...
Wraps socket.io event handlers to prevent crashes from certain malicious inputs.
[ "Wraps", "socket", ".", "io", "event", "handlers", "to", "prevent", "crashes", "from", "certain", "malicious", "inputs", "." ]
afcb81cc8d861f0f6099c6731c1333265443aa33
https://github.com/Majiir/safesocket/blob/afcb81cc8d861f0f6099c6731c1333265443aa33/safesocket.js#L11-L28
55,020
Acconut/scrib
lib/scrib.js
Scrib
function Scrib(adapters, callback) { EventEmitter.call(this); // Convert array to object if(Array.isArray(adapters)) { var am = adapters; adapters = {}; am.forEach(function(m) { adapters[m] = {}; }); } var all = [], self = this; ...
javascript
function Scrib(adapters, callback) { EventEmitter.call(this); // Convert array to object if(Array.isArray(adapters)) { var am = adapters; adapters = {}; am.forEach(function(m) { adapters[m] = {}; }); } var all = [], self = this; ...
[ "function", "Scrib", "(", "adapters", ",", "callback", ")", "{", "EventEmitter", ".", "call", "(", "this", ")", ";", "// Convert array to object", "if", "(", "Array", ".", "isArray", "(", "adapters", ")", ")", "{", "var", "am", "=", "adapters", ";", "ada...
Initalizes a new logger @param {Array|Object} adapters Array containing adapters to load or object with adapters as keys and options as values @param {Function} callback Callback function
[ "Initalizes", "a", "new", "logger" ]
9a1dae602c0badcd00fe2dad88c07e89029dd402
https://github.com/Acconut/scrib/blob/9a1dae602c0badcd00fe2dad88c07e89029dd402/lib/scrib.js#L12-L44
55,021
mgesmundo/authorify-client
lib/class/Header.js
function(header, key, cert) { var parsedHeader; if (header) { if (!header.isBase64()) { throw new CError('missing header or wrong format').log(); } else { parsedHeader = JSON.parse(forge.util.decode64(header)); this.isModeAllowed.call(this, parsedH...
javascript
function(header, key, cert) { var parsedHeader; if (header) { if (!header.isBase64()) { throw new CError('missing header or wrong format').log(); } else { parsedHeader = JSON.parse(forge.util.decode64(header)); this.isModeAllowed.call(this, parsedH...
[ "function", "(", "header", ",", "key", ",", "cert", ")", "{", "var", "parsedHeader", ";", "if", "(", "header", ")", "{", "if", "(", "!", "header", ".", "isBase64", "(", ")", ")", "{", "throw", "new", "CError", "(", "'missing header or wrong format'", "...
Parse the Authorization header @param {String} header The Authorization header in Base64 format @param {String} key The private RSA key @param {String} cert The public X.509 certificate @return {Object} The parsed header @static
[ "Parse", "the", "Authorization", "header" ]
39fb57db897eaa49b76444ff62bbc0ccedc7ee16
https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/lib/class/Header.js#L57-L114
55,022
mgesmundo/authorify-client
lib/class/Header.js
function(data) { try { data = data || this.getContent(); return this.keychain.sign(JSON.stringify(data)); } catch(e) { throw new CError({ body: { code: 'ImATeapot', message: 'unable to sign content', cause: e } }).log('b...
javascript
function(data) { try { data = data || this.getContent(); return this.keychain.sign(JSON.stringify(data)); } catch(e) { throw new CError({ body: { code: 'ImATeapot', message: 'unable to sign content', cause: e } }).log('b...
[ "function", "(", "data", ")", "{", "try", "{", "data", "=", "data", "||", "this", ".", "getContent", "(", ")", ";", "return", "this", ".", "keychain", ".", "sign", "(", "JSON", ".", "stringify", "(", "data", ")", ")", ";", "}", "catch", "(", "e",...
Generate a signature for for data or content property @param {String/Object} data The data to sign or content if missing @return {String} The signature in Base64 format
[ "Generate", "a", "signature", "for", "for", "data", "or", "content", "property" ]
39fb57db897eaa49b76444ff62bbc0ccedc7ee16
https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/lib/class/Header.js#L183-L196
55,023
mgesmundo/authorify-client
lib/class/Header.js
function() { var content = this.getContent(); var out = { payload: this.getPayload(), content: this.cryptContent(content), signature: this.generateSignature() }; if (debug) { log.debug('%s encode with sid %s', app.name, out.payload.sid); log.debug('%s enco...
javascript
function() { var content = this.getContent(); var out = { payload: this.getPayload(), content: this.cryptContent(content), signature: this.generateSignature() }; if (debug) { log.debug('%s encode with sid %s', app.name, out.payload.sid); log.debug('%s enco...
[ "function", "(", ")", "{", "var", "content", "=", "this", ".", "getContent", "(", ")", ";", "var", "out", "=", "{", "payload", ":", "this", ".", "getPayload", "(", ")", ",", "content", ":", "this", ".", "cryptContent", "(", "content", ")", ",", "si...
Encode the header including payload, content and signature @return {String} The encoded header in Base64 format
[ "Encode", "the", "header", "including", "payload", "content", "and", "signature" ]
39fb57db897eaa49b76444ff62bbc0ccedc7ee16
https://github.com/mgesmundo/authorify-client/blob/39fb57db897eaa49b76444ff62bbc0ccedc7ee16/lib/class/Header.js#L220-L233
55,024
Barandis/xduce
src/modules/iteration.js
stringIterator
function stringIterator(str) { let index = 0; return { next() { return index < bmpLength(str) ? { value: bmpCharAt(str, index++), done: false } : { done: true }; } }; }
javascript
function stringIterator(str) { let index = 0; return { next() { return index < bmpLength(str) ? { value: bmpCharAt(str, index++), done: false } : { done: true }; } }; }
[ "function", "stringIterator", "(", "str", ")", "{", "let", "index", "=", "0", ";", "return", "{", "next", "(", ")", "{", "return", "index", "<", "bmpLength", "(", "str", ")", "?", "{", "value", ":", "bmpCharAt", "(", "str", ",", "index", "++", ")",...
Creates an iterator over strings. ES2015 strings already satisfy the iterator protocol, so this function will not be used for them. This is for ES5 strings where the iterator protocol doesn't exist. As with ES2015 iterators, it takes into account double-width BMP characters and will return the entire character as a two...
[ "Creates", "an", "iterator", "over", "strings", ".", "ES2015", "strings", "already", "satisfy", "the", "iterator", "protocol", "so", "this", "function", "will", "not", "be", "used", "for", "them", ".", "This", "is", "for", "ES5", "strings", "where", "the", ...
b454f154f7663475670d4802e28e98ade8c468e7
https://github.com/Barandis/xduce/blob/b454f154f7663475670d4802e28e98ade8c468e7/src/modules/iteration.js#L48-L62
55,025
Barandis/xduce
src/modules/iteration.js
objectIterator
function objectIterator(obj, sort, kv = false) { let keys = Object.keys(obj); keys = typeof sort === 'function' ? keys.sort(sort) : keys.sort(); let index = 0; return { next() { if (index < keys.length) { const k = keys[index++]; const value = {}; if (kv) { value.k =...
javascript
function objectIterator(obj, sort, kv = false) { let keys = Object.keys(obj); keys = typeof sort === 'function' ? keys.sort(sort) : keys.sort(); let index = 0; return { next() { if (index < keys.length) { const k = keys[index++]; const value = {}; if (kv) { value.k =...
[ "function", "objectIterator", "(", "obj", ",", "sort", ",", "kv", "=", "false", ")", "{", "let", "keys", "=", "Object", ".", "keys", "(", "obj", ")", ";", "keys", "=", "typeof", "sort", "===", "'function'", "?", "keys", ".", "sort", "(", "sort", ")...
Creates an iterator over objcts. Objects are not generally iterable, as there is no defined order for an object, and each "element" of an object actually has two values, unlike any other collection (a key and a property). However, it's tremendously useful to be able to use at least some transformers with objects as we...
[ "Creates", "an", "iterator", "over", "objcts", "." ]
b454f154f7663475670d4802e28e98ade8c468e7
https://github.com/Barandis/xduce/blob/b454f154f7663475670d4802e28e98ade8c468e7/src/modules/iteration.js#L191-L217
55,026
Barandis/xduce
src/modules/iteration.js
functionIterator
function functionIterator(fn) { return function* () { let current; let index = 0; for (;;) { current = fn(index++, current); if (current === undefined) { break; } yield current; } }(); }
javascript
function functionIterator(fn) { return function* () { let current; let index = 0; for (;;) { current = fn(index++, current); if (current === undefined) { break; } yield current; } }(); }
[ "function", "functionIterator", "(", "fn", ")", "{", "return", "function", "*", "(", ")", "{", "let", "current", ";", "let", "index", "=", "0", ";", "for", "(", ";", ";", ")", "{", "current", "=", "fn", "(", "index", "++", ",", "current", ")", ";...
Creates an iterator that runs a function for each `next` value. The function in question is provided two arguments: the current 0-based index (which starts at `0` and increases by one for each run) and the return value for the prior calling of the function (which is `undefined` if the function has not yet been run). T...
[ "Creates", "an", "iterator", "that", "runs", "a", "function", "for", "each", "next", "value", "." ]
b454f154f7663475670d4802e28e98ade8c468e7
https://github.com/Barandis/xduce/blob/b454f154f7663475670d4802e28e98ade8c468e7/src/modules/iteration.js#L238-L251
55,027
Barandis/xduce
src/modules/iteration.js
isKvFormObject
function isKvFormObject(obj) { const keys = Object.keys(obj); if (keys.length !== 2) { return false; } return !!~keys.indexOf('k') && !!~keys.indexOf('v'); }
javascript
function isKvFormObject(obj) { const keys = Object.keys(obj); if (keys.length !== 2) { return false; } return !!~keys.indexOf('k') && !!~keys.indexOf('v'); }
[ "function", "isKvFormObject", "(", "obj", ")", "{", "const", "keys", "=", "Object", ".", "keys", "(", "obj", ")", ";", "if", "(", "keys", ".", "length", "!==", "2", ")", "{", "return", "false", ";", "}", "return", "!", "!", "~", "keys", ".", "ind...
Determines whether an object is in kv-form. This used by the reducers that must recognize this form and reduce those elements back into key-value form. This determination is made by simply checking that the object has exactly two properties and that they are named `k` and `v`. @private @param {object} obj The object...
[ "Determines", "whether", "an", "object", "is", "in", "kv", "-", "form", ".", "This", "used", "by", "the", "reducers", "that", "must", "recognize", "this", "form", "and", "reduce", "those", "elements", "back", "into", "key", "-", "value", "form", "." ]
b454f154f7663475670d4802e28e98ade8c468e7
https://github.com/Barandis/xduce/blob/b454f154f7663475670d4802e28e98ade8c468e7/src/modules/iteration.js#L265-L271
55,028
Barandis/xduce
src/modules/iteration.js
isIterable
function isIterable(obj) { return isImplemented(obj, 'iterator') || isString(obj) || isArray(obj) || isObject(obj); }
javascript
function isIterable(obj) { return isImplemented(obj, 'iterator') || isString(obj) || isArray(obj) || isObject(obj); }
[ "function", "isIterable", "(", "obj", ")", "{", "return", "isImplemented", "(", "obj", ",", "'iterator'", ")", "||", "isString", "(", "obj", ")", "||", "isArray", "(", "obj", ")", "||", "isObject", "(", "obj", ")", ";", "}" ]
Determines whether the passed object is iterable, in terms of what 'iterable' means to this library. In other words, objects and ES5 arrays and strings will return `true`, as will objects with a `next` function. For that reason this function is only really useful within the library and therefore isn't exported. @priva...
[ "Determines", "whether", "the", "passed", "object", "is", "iterable", "in", "terms", "of", "what", "iterable", "means", "to", "this", "library", ".", "In", "other", "words", "objects", "and", "ES5", "arrays", "and", "strings", "will", "return", "true", "as",...
b454f154f7663475670d4802e28e98ade8c468e7
https://github.com/Barandis/xduce/blob/b454f154f7663475670d4802e28e98ade8c468e7/src/modules/iteration.js#L392-L394
55,029
hillscottc/nostra
dist/sentence_mgr.js
relationship
function relationship(mood) { var verb = void 0, talk = void 0; if (mood === "good") { verb = "strengthened"; talk = "discussion"; } else { verb = "strained"; talk = "argument"; } var familiar_people = _word_library2.default.getWords("familiar_people"); var conversation_topics = _wor...
javascript
function relationship(mood) { var verb = void 0, talk = void 0; if (mood === "good") { verb = "strengthened"; talk = "discussion"; } else { verb = "strained"; talk = "argument"; } var familiar_people = _word_library2.default.getWords("familiar_people"); var conversation_topics = _wor...
[ "function", "relationship", "(", "mood", ")", "{", "var", "verb", "=", "void", "0", ",", "talk", "=", "void", "0", ";", "if", "(", "mood", "===", "\"good\"", ")", "{", "verb", "=", "\"strengthened\"", ";", "talk", "=", "\"discussion\"", ";", "}", "el...
Generate a mood-based sentence about a relationship @param mood @returns {*}
[ "Generate", "a", "mood", "-", "based", "sentence", "about", "a", "relationship" ]
1801c8e19f7fab91dd29fea07195789d41624915
https://github.com/hillscottc/nostra/blob/1801c8e19f7fab91dd29fea07195789d41624915/dist/sentence_mgr.js#L24-L46
55,030
hillscottc/nostra
dist/sentence_mgr.js
datePredict
function datePredict() { var daysAhead = Math.floor(Math.random() * 5) + 2; var day = new Date(); day.setDate(day.getDate() + daysAhead); var monthStr = (0, _dateformat2.default)(day, "mmmm"); var dayStr = (0, _dateformat2.default)(day, "d"); var rnum = Math.floor(Math.random() * 10); var str = void 0; ...
javascript
function datePredict() { var daysAhead = Math.floor(Math.random() * 5) + 2; var day = new Date(); day.setDate(day.getDate() + daysAhead); var monthStr = (0, _dateformat2.default)(day, "mmmm"); var dayStr = (0, _dateformat2.default)(day, "d"); var rnum = Math.floor(Math.random() * 10); var str = void 0; ...
[ "function", "datePredict", "(", ")", "{", "var", "daysAhead", "=", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "5", ")", "+", "2", ";", "var", "day", "=", "new", "Date", "(", ")", ";", "day", ".", "setDate", "(", "day", "."...
Generate a random prediction sentence containing a date. @returns {*}
[ "Generate", "a", "random", "prediction", "sentence", "containing", "a", "date", "." ]
1801c8e19f7fab91dd29fea07195789d41624915
https://github.com/hillscottc/nostra/blob/1801c8e19f7fab91dd29fea07195789d41624915/dist/sentence_mgr.js#L121-L139
55,031
futagoza/efe
index.js
modifyStatsObject
function modifyStatsObject ( stats, path ) { stats.path = path; stats.basename = fs.basename(path); stats.dirname = fs.dirname(path); stats.extname = fs.extname(path); return stats; }
javascript
function modifyStatsObject ( stats, path ) { stats.path = path; stats.basename = fs.basename(path); stats.dirname = fs.dirname(path); stats.extname = fs.extname(path); return stats; }
[ "function", "modifyStatsObject", "(", "stats", ",", "path", ")", "{", "stats", ".", "path", "=", "path", ";", "stats", ".", "basename", "=", "fs", ".", "basename", "(", "path", ")", ";", "stats", ".", "dirname", "=", "fs", ".", "dirname", "(", "path"...
Update the `stats` object returned by methods using `fs.Stats`.
[ "Update", "the", "stats", "object", "returned", "by", "methods", "using", "fs", ".", "Stats", "." ]
bd7b0e73006672a8d7620f32f731d87d793eb57c
https://github.com/futagoza/efe/blob/bd7b0e73006672a8d7620f32f731d87d793eb57c/index.js#L110-L116
55,032
andrepolischuk/ies
index.js
parse
function parse() { var msie = /MSIE.(\d+)/i.exec(ua); var rv = /Trident.+rv:(\d+)/i.exec(ua); var version = msie || rv || undefined; return version ? +version[1] : version; }
javascript
function parse() { var msie = /MSIE.(\d+)/i.exec(ua); var rv = /Trident.+rv:(\d+)/i.exec(ua); var version = msie || rv || undefined; return version ? +version[1] : version; }
[ "function", "parse", "(", ")", "{", "var", "msie", "=", "/", "MSIE.(\\d+)", "/", "i", ".", "exec", "(", "ua", ")", ";", "var", "rv", "=", "/", "Trident.+rv:(\\d+)", "/", "i", ".", "exec", "(", "ua", ")", ";", "var", "version", "=", "msie", "||", ...
Get IE major version number @return {Number} @api private
[ "Get", "IE", "major", "version", "number" ]
2641e787897fd1602e5a0bd8bd4bd8e56418f1bf
https://github.com/andrepolischuk/ies/blob/2641e787897fd1602e5a0bd8bd4bd8e56418f1bf/index.js#L23-L28
55,033
creationix/git-node-platform
fs.js
stat
function stat(path, callback) { if (!callback) return stat.bind(this, path); fs.lstat(path, function (err, stat) { if (err) return callback(err); var ctime = stat.ctime / 1000; var cseconds = Math.floor(ctime); var mtime = stat.mtime / 1000; var mseconds = Math.floor(mtime); var mode; if...
javascript
function stat(path, callback) { if (!callback) return stat.bind(this, path); fs.lstat(path, function (err, stat) { if (err) return callback(err); var ctime = stat.ctime / 1000; var cseconds = Math.floor(ctime); var mtime = stat.mtime / 1000; var mseconds = Math.floor(mtime); var mode; if...
[ "function", "stat", "(", "path", ",", "callback", ")", "{", "if", "(", "!", "callback", ")", "return", "stat", ".", "bind", "(", "this", ",", "path", ")", ";", "fs", ".", "lstat", "(", "path", ",", "function", "(", "err", ",", "stat", ")", "{", ...
Given a path, return a continuable for the stat object.
[ "Given", "a", "path", "return", "a", "continuable", "for", "the", "stat", "object", "." ]
fa9b0367e3b92b6f4f50d93b0d2d7ba93cb27fb9
https://github.com/creationix/git-node-platform/blob/fa9b0367e3b92b6f4f50d93b0d2d7ba93cb27fb9/fs.js#L44-L73
55,034
shinuza/captain-core
lib/models/posts.js
find
function find(param) { var fn , asInt = Number(param); fn = isNaN(asInt) ? findBySlug : findById; fn.apply(null, arguments); }
javascript
function find(param) { var fn , asInt = Number(param); fn = isNaN(asInt) ? findBySlug : findById; fn.apply(null, arguments); }
[ "function", "find", "(", "param", ")", "{", "var", "fn", ",", "asInt", "=", "Number", "(", "param", ")", ";", "fn", "=", "isNaN", "(", "asInt", ")", "?", "findBySlug", ":", "findById", ";", "fn", ".", "apply", "(", "null", ",", "arguments", ")", ...
Smart find, uses findBySlug or findById @param {*} param
[ "Smart", "find", "uses", "findBySlug", "or", "findById" ]
02f3a404cdfca608e8726bbacc33e32fec484b21
https://github.com/shinuza/captain-core/blob/02f3a404cdfca608e8726bbacc33e32fec484b21/lib/models/posts.js#L53-L59
55,035
shinuza/captain-core
lib/models/posts.js
update
function update(id, body, cb) { body.updated_at = new Date(); var q = qb.update(id, body); db.getClient(function(err, client, done) { client.query(q[0], q[1], function(err, r) { var result = r && r.rows[0]; if(!err && !result) { err = new exceptions.NotFound(); } if(err) { cb(err); ...
javascript
function update(id, body, cb) { body.updated_at = new Date(); var q = qb.update(id, body); db.getClient(function(err, client, done) { client.query(q[0], q[1], function(err, r) { var result = r && r.rows[0]; if(!err && !result) { err = new exceptions.NotFound(); } if(err) { cb(err); ...
[ "function", "update", "(", "id", ",", "body", ",", "cb", ")", "{", "body", ".", "updated_at", "=", "new", "Date", "(", ")", ";", "var", "q", "=", "qb", ".", "update", "(", "id", ",", "body", ")", ";", "db", ".", "getClient", "(", "function", "(...
Updates post with `id` `cb` is passed the updated post or exceptions.NotFound @param {Number} id @param {Object} body @param {Function} cb
[ "Updates", "post", "with", "id" ]
02f3a404cdfca608e8726bbacc33e32fec484b21
https://github.com/shinuza/captain-core/blob/02f3a404cdfca608e8726bbacc33e32fec484b21/lib/models/posts.js#L165-L182
55,036
shinuza/captain-core
lib/models/posts.js
archive
function archive(cb) { db.getClient(function(err, client, done) { client.query(qb.select() + ' WHERE published = true', function(err, r) { if(err) { cb(err); done(err); } else { cb(null, r.rows); done(); } }); }); }
javascript
function archive(cb) { db.getClient(function(err, client, done) { client.query(qb.select() + ' WHERE published = true', function(err, r) { if(err) { cb(err); done(err); } else { cb(null, r.rows); done(); } }); }); }
[ "function", "archive", "(", "cb", ")", "{", "db", ".", "getClient", "(", "function", "(", "err", ",", "client", ",", "done", ")", "{", "client", ".", "query", "(", "qb", ".", "select", "(", ")", "+", "' WHERE published = true'", ",", "function", "(", ...
Returns all published posts without pagination support @param {Function} cb
[ "Returns", "all", "published", "posts", "without", "pagination", "support" ]
02f3a404cdfca608e8726bbacc33e32fec484b21
https://github.com/shinuza/captain-core/blob/02f3a404cdfca608e8726bbacc33e32fec484b21/lib/models/posts.js#L341-L353
55,037
ronanyeah/ooft
src/methods.js
getTargetSize
function getTargetSize(size, buffer) { size *= 1000000; // Converting to MB to B. // 10% is default. buffer = 1 + (buffer ? buffer / 100 : 0.1); return Math.round(size * buffer); }
javascript
function getTargetSize(size, buffer) { size *= 1000000; // Converting to MB to B. // 10% is default. buffer = 1 + (buffer ? buffer / 100 : 0.1); return Math.round(size * buffer); }
[ "function", "getTargetSize", "(", "size", ",", "buffer", ")", "{", "size", "*=", "1000000", ";", "// Converting to MB to B.", "// 10% is default.", "buffer", "=", "1", "+", "(", "buffer", "?", "buffer", "/", "100", ":", "0.1", ")", ";", "return", "Math", "...
Gets the desired file size for the resize. @param {number} size Desired size in MB. @param {number} buffer Range of tolerance for target size, 0-100. @returns {number} Desired file size in bytes.
[ "Gets", "the", "desired", "file", "size", "for", "the", "resize", "." ]
a86d9db656a7ebd84915ec4e0d5f474a4b87031b
https://github.com/ronanyeah/ooft/blob/a86d9db656a7ebd84915ec4e0d5f474a4b87031b/src/methods.js#L16-L23
55,038
ronanyeah/ooft
src/methods.js
shrinkImage
function shrinkImage(base64Image, targetSize) { return new Promise( (resolve, reject) => { let canvas = document.createElement('canvas'); let image = new Image(); image.onload = _ => { canvas.height = image.naturalHeight; canvas.width = image.naturalWidth; canvas.getContext('2d'...
javascript
function shrinkImage(base64Image, targetSize) { return new Promise( (resolve, reject) => { let canvas = document.createElement('canvas'); let image = new Image(); image.onload = _ => { canvas.height = image.naturalHeight; canvas.width = image.naturalWidth; canvas.getContext('2d'...
[ "function", "shrinkImage", "(", "base64Image", ",", "targetSize", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "let", "canvas", "=", "document", ".", "createElement", "(", "'canvas'", ")", ";", "let", "image", ...
Rewrites base64 image using canvas until it is down to desired file size. @param {string} base64Image Base64 image string. @param {number} targetSize Desired file size in bytes. @returns {string} Base64 string of resized image.
[ "Rewrites", "base64", "image", "using", "canvas", "until", "it", "is", "down", "to", "desired", "file", "size", "." ]
a86d9db656a7ebd84915ec4e0d5f474a4b87031b
https://github.com/ronanyeah/ooft/blob/a86d9db656a7ebd84915ec4e0d5f474a4b87031b/src/methods.js#L31-L60
55,039
ronanyeah/ooft
src/methods.js
base64ToBlob
function base64ToBlob(base64Image, contentType) { // http://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript // Remove leading 'data:image/jpeg;base64,' or 'data:image/png;base64,' base64Image = base64Image.split(',')[1]; let byteCharacters = atob(base64Image); // htt...
javascript
function base64ToBlob(base64Image, contentType) { // http://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript // Remove leading 'data:image/jpeg;base64,' or 'data:image/png;base64,' base64Image = base64Image.split(',')[1]; let byteCharacters = atob(base64Image); // htt...
[ "function", "base64ToBlob", "(", "base64Image", ",", "contentType", ")", "{", "// http://stackoverflow.com/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript", "// Remove leading 'data:image/jpeg;base64,' or 'data:image/png;base64,'", "base64Image", "=", "base64Image", "...
Converts Base64 image into a blob file. @param {string} base64Image Base64 image string. @param {string} contentType 'image/jpg' or 'image/png'. @returns {file} Image file as a blob.
[ "Converts", "Base64", "image", "into", "a", "blob", "file", "." ]
a86d9db656a7ebd84915ec4e0d5f474a4b87031b
https://github.com/ronanyeah/ooft/blob/a86d9db656a7ebd84915ec4e0d5f474a4b87031b/src/methods.js#L68-L87
55,040
ronanyeah/ooft
src/methods.js
convertImageToBase64
function convertImageToBase64(image) { let fileReader = new FileReader(); return new Promise( (resolve, reject) => { fileReader.onload = fileLoadedEvent => resolve(fileLoadedEvent.target.result); fileReader.readAsDataURL(image); }); }
javascript
function convertImageToBase64(image) { let fileReader = new FileReader(); return new Promise( (resolve, reject) => { fileReader.onload = fileLoadedEvent => resolve(fileLoadedEvent.target.result); fileReader.readAsDataURL(image); }); }
[ "function", "convertImageToBase64", "(", "image", ")", "{", "let", "fileReader", "=", "new", "FileReader", "(", ")", ";", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "fileReader", ".", "onload", "=", "fileLoadedEvent", "...
Gets image height and width in pixels. @param {file} image Image file as a blob. @returns {string} Base64 image string.
[ "Gets", "image", "height", "and", "width", "in", "pixels", "." ]
a86d9db656a7ebd84915ec4e0d5f474a4b87031b
https://github.com/ronanyeah/ooft/blob/a86d9db656a7ebd84915ec4e0d5f474a4b87031b/src/methods.js#L94-L104
55,041
wigy/chronicles_of_grunt
lib/server.js
handler
function handler(req, res) { var path = cog.getConfig('options.api_data'); var urlRegex = cog.getConfig('options.api_url_regex'); var url = req.url.replace(/^\//, '').replace(/\/$/, ''); console.log(req.method + ' ' + req.url); // Find the JSON-data file and serve it, if URL p...
javascript
function handler(req, res) { var path = cog.getConfig('options.api_data'); var urlRegex = cog.getConfig('options.api_url_regex'); var url = req.url.replace(/^\//, '').replace(/\/$/, ''); console.log(req.method + ' ' + req.url); // Find the JSON-data file and serve it, if URL p...
[ "function", "handler", "(", "req", ",", "res", ")", "{", "var", "path", "=", "cog", ".", "getConfig", "(", "'options.api_data'", ")", ";", "var", "urlRegex", "=", "cog", ".", "getConfig", "(", "'options.api_url_regex'", ")", ";", "var", "url", "=", "req"...
This is the development server used by CoG.
[ "This", "is", "the", "development", "server", "used", "by", "CoG", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/server.js#L28-L50
55,042
MCluck90/clairvoyant
src/reporter.js
function(name, type, filename, code) { this.name = name; this.type = type; this.filename = filename; this.code = code; }
javascript
function(name, type, filename, code) { this.name = name; this.type = type; this.filename = filename; this.code = code; }
[ "function", "(", "name", ",", "type", ",", "filename", ",", "code", ")", "{", "this", ".", "name", "=", "name", ";", "this", ".", "type", "=", "type", ";", "this", ".", "filename", "=", "filename", ";", "this", ".", "code", "=", "code", ";", "}" ...
Represents a single System @param {string} name - Name of the System @param {string} type - System, RenderSystem, or BehaviorSystem @param {string} filename - File path @param {string} code - Code generated for the System @constructor
[ "Represents", "a", "single", "System" ]
4c347499c5fe0f561a53e180d141884b1fa8c21b
https://github.com/MCluck90/clairvoyant/blob/4c347499c5fe0f561a53e180d141884b1fa8c21b/src/reporter.js#L107-L112
55,043
lukin0110/vorto
vorto.js
vorto
function vorto() { var length = arguments.length; var format, options, callback; if (typeof arguments[length-1] !== 'function') { throw new Error('The last argument must be a callback function: function(err, version){...}'); } else { callback = arguments[length-1]; } if (length...
javascript
function vorto() { var length = arguments.length; var format, options, callback; if (typeof arguments[length-1] !== 'function') { throw new Error('The last argument must be a callback function: function(err, version){...}'); } else { callback = arguments[length-1]; } if (length...
[ "function", "vorto", "(", ")", "{", "var", "length", "=", "arguments", ".", "length", ";", "var", "format", ",", "options", ",", "callback", ";", "if", "(", "typeof", "arguments", "[", "length", "-", "1", "]", "!==", "'function'", ")", "{", "throw", ...
Init function that might take 3 parameters. It checks the input parameters and will throw errors if they're not valid or wrongly ordered. The callback is always required. vorto([format][, options], callback);
[ "Init", "function", "that", "might", "take", "3", "parameters", ".", "It", "checks", "the", "input", "parameters", "and", "will", "throw", "errors", "if", "they", "re", "not", "valid", "or", "wrongly", "ordered", "." ]
a25ab42e38a7e530ece3f9d0b33d8489f0acc1e9
https://github.com/lukin0110/vorto/blob/a25ab42e38a7e530ece3f9d0b33d8489f0acc1e9/vorto.js#L18-L70
55,044
lukin0110/vorto
vorto.js
packageVersion
function packageVersion(repo) { var location = repo ? path.join(repo, 'package.json') : './package.json'; var pack = require(location); return pack['version']; }
javascript
function packageVersion(repo) { var location = repo ? path.join(repo, 'package.json') : './package.json'; var pack = require(location); return pack['version']; }
[ "function", "packageVersion", "(", "repo", ")", "{", "var", "location", "=", "repo", "?", "path", ".", "join", "(", "repo", ",", "'package.json'", ")", ":", "'./package.json'", ";", "var", "pack", "=", "require", "(", "location", ")", ";", "return", "pac...
Load the version from package.json @param {string} repo
[ "Load", "the", "version", "from", "package", ".", "json" ]
a25ab42e38a7e530ece3f9d0b33d8489f0acc1e9
https://github.com/lukin0110/vorto/blob/a25ab42e38a7e530ece3f9d0b33d8489f0acc1e9/vorto.js#L90-L94
55,045
rranauro/boxspringjs
boxspring.js
function(name, value, iType) { var type = iType , coded , attach = { '_attachments': this.get('_attachments') || {} } , types = { "html": {"content_type":"text\/html"}, "text": {"content_type":"text\/plain"}, "xml": {"content_type":"text\/plain"}, "jpeg": {"content_type":"image\/jpeg"...
javascript
function(name, value, iType) { var type = iType , coded , attach = { '_attachments': this.get('_attachments') || {} } , types = { "html": {"content_type":"text\/html"}, "text": {"content_type":"text\/plain"}, "xml": {"content_type":"text\/plain"}, "jpeg": {"content_type":"image\/jpeg"...
[ "function", "(", "name", ",", "value", ",", "iType", ")", "{", "var", "type", "=", "iType", ",", "coded", ",", "attach", "=", "{", "'_attachments'", ":", "this", ".", "get", "(", "'_attachments'", ")", "||", "{", "}", "}", ",", "types", "=", "{", ...
configure the URL for an attachment
[ "configure", "the", "URL", "for", "an", "attachment" ]
43fd13ae45ba5b16ba9144084b96748a1cd8c0ea
https://github.com/rranauro/boxspringjs/blob/43fd13ae45ba5b16ba9144084b96748a1cd8c0ea/boxspring.js#L649-L685
55,046
observing/eventreactor
lib/index.js
EventReactor
function EventReactor(options, proto) { // allow initialization without a new prefix if (!(this instanceof EventReactor)) return new EventReactor(options, proto); options = options || {}; this.restore = {}; // don't attach the extra event reactor methods, we are going to apply them // manually...
javascript
function EventReactor(options, proto) { // allow initialization without a new prefix if (!(this instanceof EventReactor)) return new EventReactor(options, proto); options = options || {}; this.restore = {}; // don't attach the extra event reactor methods, we are going to apply them // manually...
[ "function", "EventReactor", "(", "options", ",", "proto", ")", "{", "// allow initialization without a new prefix", "if", "(", "!", "(", "this", "instanceof", "EventReactor", ")", ")", "return", "new", "EventReactor", "(", "options", ",", "proto", ")", ";", "opt...
The EventReactor plugin that allows you to extend update the EventEmitter prototype. @constructor @param {Object} options @param {Prototype} proto prototype that needs to be extended @api public
[ "The", "EventReactor", "plugin", "that", "allows", "you", "to", "extend", "update", "the", "EventEmitter", "prototype", "." ]
1609083bf56c5ac77809997cd29882910dc2aedf
https://github.com/observing/eventreactor/blob/1609083bf56c5ac77809997cd29882910dc2aedf/lib/index.js#L49-L72
55,047
observing/eventreactor
lib/index.js
every
function every() { for ( var args = slice.call(arguments, 0) , callback = args.pop() , length = args.length , i = 0; i < length; this.on(args[i++], callback) ){} return this; }
javascript
function every() { for ( var args = slice.call(arguments, 0) , callback = args.pop() , length = args.length , i = 0; i < length; this.on(args[i++], callback) ){} return this; }
[ "function", "every", "(", ")", "{", "for", "(", "var", "args", "=", "slice", ".", "call", "(", "arguments", ",", "0", ")", ",", "callback", "=", "args", ".", "pop", "(", ")", ",", "length", "=", "args", ".", "length", ",", "i", "=", "0", ";", ...
Apply the same callback to every given event. @param {String} .. events @param {Function} callback last argument is always the callback @api private
[ "Apply", "the", "same", "callback", "to", "every", "given", "event", "." ]
1609083bf56c5ac77809997cd29882910dc2aedf
https://github.com/observing/eventreactor/blob/1609083bf56c5ac77809997cd29882910dc2aedf/lib/index.js#L172-L184
55,048
observing/eventreactor
lib/index.js
handle
function handle() { for ( var i = 0 , length = args.length; i < length; self.removeListener(args[i++], handle) ){} // call the function as last as the function might be calling on of // events that where in our either queue, so ...
javascript
function handle() { for ( var i = 0 , length = args.length; i < length; self.removeListener(args[i++], handle) ){} // call the function as last as the function might be calling on of // events that where in our either queue, so ...
[ "function", "handle", "(", ")", "{", "for", "(", "var", "i", "=", "0", ",", "length", "=", "args", ".", "length", ";", "i", "<", "length", ";", "self", ".", "removeListener", "(", "args", "[", "i", "++", "]", ",", "handle", ")", ")", "{", "}", ...
Handler for all the calls so every remaining event listener is removed removed properly before we call the callback. @api private
[ "Handler", "for", "all", "the", "calls", "so", "every", "remaining", "event", "listener", "is", "removed", "removed", "properly", "before", "we", "call", "the", "callback", "." ]
1609083bf56c5ac77809997cd29882910dc2aedf
https://github.com/observing/eventreactor/blob/1609083bf56c5ac77809997cd29882910dc2aedf/lib/index.js#L201-L214
55,049
observing/eventreactor
lib/index.js
handle
function handle() { self.removeListener(event, reset); callback.apply(self, [event].concat(args)); }
javascript
function handle() { self.removeListener(event, reset); callback.apply(self, [event].concat(args)); }
[ "function", "handle", "(", ")", "{", "self", ".", "removeListener", "(", "event", ",", "reset", ")", ";", "callback", ".", "apply", "(", "self", ",", "[", "event", "]", ".", "concat", "(", "args", ")", ")", ";", "}" ]
Handle the idle callback as the setTimeout got triggerd. @api private
[ "Handle", "the", "idle", "callback", "as", "the", "setTimeout", "got", "triggerd", "." ]
1609083bf56c5ac77809997cd29882910dc2aedf
https://github.com/observing/eventreactor/blob/1609083bf56c5ac77809997cd29882910dc2aedf/lib/index.js#L317-L320
55,050
observing/eventreactor
lib/index.js
reset
function reset() { clearTimeout(timer); self.idle.apply(self, [event, callback, timeout].concat(args)); }
javascript
function reset() { clearTimeout(timer); self.idle.apply(self, [event, callback, timeout].concat(args)); }
[ "function", "reset", "(", ")", "{", "clearTimeout", "(", "timer", ")", ";", "self", ".", "idle", ".", "apply", "(", "self", ",", "[", "event", ",", "callback", ",", "timeout", "]", ".", "concat", "(", "args", ")", ")", ";", "}" ]
Reset the timeout timer again as the event was triggerd. @api private
[ "Reset", "the", "timeout", "timer", "again", "as", "the", "event", "was", "triggerd", "." ]
1609083bf56c5ac77809997cd29882910dc2aedf
https://github.com/observing/eventreactor/blob/1609083bf56c5ac77809997cd29882910dc2aedf/lib/index.js#L327-L331
55,051
ugate/pulses
index.js
listen
function listen(pw, type, listener, fnm, rf, cbtype, passes) { var fn = function pulseListener(flow, artery, pulse) { if (!rf || !(artery instanceof cat.Artery) || !(pulse instanceof cat.Pulse) || flow instanceof Error) return arguments.length ? fn._callback.apply(pw, Array.prototype.slice.call(...
javascript
function listen(pw, type, listener, fnm, rf, cbtype, passes) { var fn = function pulseListener(flow, artery, pulse) { if (!rf || !(artery instanceof cat.Artery) || !(pulse instanceof cat.Pulse) || flow instanceof Error) return arguments.length ? fn._callback.apply(pw, Array.prototype.slice.call(...
[ "function", "listen", "(", "pw", ",", "type", ",", "listener", ",", "fnm", ",", "rf", ",", "cbtype", ",", "passes", ")", "{", "var", "fn", "=", "function", "pulseListener", "(", "flow", ",", "artery", ",", "pulse", ")", "{", "if", "(", "!", "rf", ...
Listens for incoming events using event emitter's add listener function, but with optional error handling and pulse event only capabilities @private @arg {PulseEmitter} pw the pulse emitter @arg {String} type the event type @arg {function} listener the function to execute when the event type is emitted @arg {String} [...
[ "Listens", "for", "incoming", "events", "using", "event", "emitter", "s", "add", "listener", "function", "but", "with", "optional", "error", "handling", "and", "pulse", "event", "only", "capabilities" ]
214b186e1b72bed9c99c0a7903c70de4eca3c259
https://github.com/ugate/pulses/blob/214b186e1b72bed9c99c0a7903c70de4eca3c259/index.js#L196-L225
55,052
mhelgeson/b9
src/connect/index.js
complete
function complete ( err, msg ){ b9.off('hello', success ); // cleanup // optional callback, error-first... if ( typeof callback == 'function' ){ callback( err, msg ); } }
javascript
function complete ( err, msg ){ b9.off('hello', success ); // cleanup // optional callback, error-first... if ( typeof callback == 'function' ){ callback( err, msg ); } }
[ "function", "complete", "(", "err", ",", "msg", ")", "{", "b9", ".", "off", "(", "'hello'", ",", "success", ")", ";", "// cleanup", "// optional callback, error-first...", "if", "(", "typeof", "callback", "==", "'function'", ")", "{", "callback", "(", "err",...
handle complete callback...
[ "handle", "complete", "callback", "..." ]
5f7ad9ac7c3fa586b06f6460b70a42c50b34e6f1
https://github.com/mhelgeson/b9/blob/5f7ad9ac7c3fa586b06f6460b70a42c50b34e6f1/src/connect/index.js#L43-L49
55,053
mhelgeson/b9
src/connect/index.js
receive
function receive ( str ){ ping(); // clear/schedule next ping var msg = typeof str === 'string' ? JSON.parse( str ) : str; b9.emit('rtm.read', msg, replyTo( null ) ); // acknowledge that a pending message was sent successfully if ( msg.reply_to ){ delete pending[ msg.reply_to ]; } else...
javascript
function receive ( str ){ ping(); // clear/schedule next ping var msg = typeof str === 'string' ? JSON.parse( str ) : str; b9.emit('rtm.read', msg, replyTo( null ) ); // acknowledge that a pending message was sent successfully if ( msg.reply_to ){ delete pending[ msg.reply_to ]; } else...
[ "function", "receive", "(", "str", ")", "{", "ping", "(", ")", ";", "// clear/schedule next ping", "var", "msg", "=", "typeof", "str", "===", "'string'", "?", "JSON", ".", "parse", "(", "str", ")", ":", "str", ";", "b9", ".", "emit", "(", "'rtm.read'",...
handle a websocket message @private method
[ "handle", "a", "websocket", "message" ]
5f7ad9ac7c3fa586b06f6460b70a42c50b34e6f1
https://github.com/mhelgeson/b9/blob/5f7ad9ac7c3fa586b06f6460b70a42c50b34e6f1/src/connect/index.js#L115-L126
55,054
mhelgeson/b9
src/connect/index.js
ping
function ping (){ clearTimeout( ping.timer ); ping.timer = setTimeout(function(){ b9.send({ type: 'ping', time: Date.now() }); }, b9._interval ); }
javascript
function ping (){ clearTimeout( ping.timer ); ping.timer = setTimeout(function(){ b9.send({ type: 'ping', time: Date.now() }); }, b9._interval ); }
[ "function", "ping", "(", ")", "{", "clearTimeout", "(", "ping", ".", "timer", ")", ";", "ping", ".", "timer", "=", "setTimeout", "(", "function", "(", ")", "{", "b9", ".", "send", "(", "{", "type", ":", "'ping'", ",", "time", ":", "Date", ".", "n...
keep the connection alive @private method
[ "keep", "the", "connection", "alive" ]
5f7ad9ac7c3fa586b06f6460b70a42c50b34e6f1
https://github.com/mhelgeson/b9/blob/5f7ad9ac7c3fa586b06f6460b70a42c50b34e6f1/src/connect/index.js#L142-L147
55,055
BladeRunnerJS/jstd-mocha
src/asserts.js
assertEqualsDelta
function assertEqualsDelta(msg, expected, actual, epsilon) { var args = this.argsWithOptionalMsg_(arguments, 4); jstestdriver.assertCount++; msg = args[0]; expected = args[1]; actual = args[2]; epsilon = args[3]; if (!compareDelta_(expected, actual, epsilon)) { this.fail(msg + 'expected ' + epsilon + ' within...
javascript
function assertEqualsDelta(msg, expected, actual, epsilon) { var args = this.argsWithOptionalMsg_(arguments, 4); jstestdriver.assertCount++; msg = args[0]; expected = args[1]; actual = args[2]; epsilon = args[3]; if (!compareDelta_(expected, actual, epsilon)) { this.fail(msg + 'expected ' + epsilon + ' within...
[ "function", "assertEqualsDelta", "(", "msg", ",", "expected", ",", "actual", ",", "epsilon", ")", "{", "var", "args", "=", "this", ".", "argsWithOptionalMsg_", "(", "arguments", ",", "4", ")", ";", "jstestdriver", ".", "assertCount", "++", ";", "msg", "=",...
Asserts that two doubles, or the elements of two arrays of doubles, are equal to within a positive delta.
[ "Asserts", "that", "two", "doubles", "or", "the", "elements", "of", "two", "arrays", "of", "doubles", "are", "equal", "to", "within", "a", "positive", "delta", "." ]
ac5f524763f644873dfa22d920e9780e3d73c737
https://github.com/BladeRunnerJS/jstd-mocha/blob/ac5f524763f644873dfa22d920e9780e3d73c737/src/asserts.js#L568-L582
55,056
waitingsong/node-rxwalker
rollup.config.js
parseName
function parseName(name) { if (name) { const arr = name.split('.') const len = arr.length if (len > 2) { return arr.slice(0, -1).join('.') } else if (len === 2 || len === 1) { return arr[0] } } return name }
javascript
function parseName(name) { if (name) { const arr = name.split('.') const len = arr.length if (len > 2) { return arr.slice(0, -1).join('.') } else if (len === 2 || len === 1) { return arr[0] } } return name }
[ "function", "parseName", "(", "name", ")", "{", "if", "(", "name", ")", "{", "const", "arr", "=", "name", ".", "split", "(", "'.'", ")", "const", "len", "=", "arr", ".", "length", "if", "(", "len", ">", "2", ")", "{", "return", "arr", ".", "sli...
remove pkg.name extension if exists
[ "remove", "pkg", ".", "name", "extension", "if", "exists" ]
b08dae4940329f98229dd38e60da54b7426436ab
https://github.com/waitingsong/node-rxwalker/blob/b08dae4940329f98229dd38e60da54b7426436ab/rollup.config.js#L165-L178
55,057
altshift/altshift
lib/altshift/core/class.js
function (object) { var methodName; methodName = this.test(object, true); if (methodName !== true) { throw new exports.NotImplementedError({ code: 'interface', message: 'Object %(object) does not implement %(interface)#%(method)()', /...
javascript
function (object) { var methodName; methodName = this.test(object, true); if (methodName !== true) { throw new exports.NotImplementedError({ code: 'interface', message: 'Object %(object) does not implement %(interface)#%(method)()', /...
[ "function", "(", "object", ")", "{", "var", "methodName", ";", "methodName", "=", "this", ".", "test", "(", "object", ",", "true", ")", ";", "if", "(", "methodName", "!==", "true", ")", "{", "throw", "new", "exports", ".", "NotImplementedError", "(", "...
Throw error if object does not have all methods @param {Object} object @return this
[ "Throw", "error", "if", "object", "does", "not", "have", "all", "methods" ]
5c051157e6f558636c8e12081b6707caa66249de
https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/class.js#L118-L134
55,058
altshift/altshift
lib/altshift/core/class.js
function (object, returnName) { var methodName; for (methodName in this.methods) { if (!(object[methodName] instanceof Function)) { return returnName ? methodName : false; } } return true; }
javascript
function (object, returnName) { var methodName; for (methodName in this.methods) { if (!(object[methodName] instanceof Function)) { return returnName ? methodName : false; } } return true; }
[ "function", "(", "object", ",", "returnName", ")", "{", "var", "methodName", ";", "for", "(", "methodName", "in", "this", ".", "methods", ")", "{", "if", "(", "!", "(", "object", "[", "methodName", "]", "instanceof", "Function", ")", ")", "{", "return"...
Return false or the missing method name in object if method is missing in object @param {Object} object @param {boolean} returnName @return {boolean|string}
[ "Return", "false", "or", "the", "missing", "method", "name", "in", "object", "if", "method", "is", "missing", "in", "object" ]
5c051157e6f558636c8e12081b6707caa66249de
https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/class.js#L143-L151
55,059
altshift/altshift
lib/altshift/core/class.js
function (_module) { if (! this.name) { throw new exports.ValueError({message: 'name is empty'}); } var _exports = _module.exports || _module; _exports[this.name] = this; return this; }
javascript
function (_module) { if (! this.name) { throw new exports.ValueError({message: 'name is empty'}); } var _exports = _module.exports || _module; _exports[this.name] = this; return this; }
[ "function", "(", "_module", ")", "{", "if", "(", "!", "this", ".", "name", ")", "{", "throw", "new", "exports", ".", "ValueError", "(", "{", "message", ":", "'name is empty'", "}", ")", ";", "}", "var", "_exports", "=", "_module", ".", "exports", "||...
Export this interface into _exports @return this
[ "Export", "this", "interface", "into", "_exports" ]
5c051157e6f558636c8e12081b6707caa66249de
https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/class.js#L158-L165
55,060
altshift/altshift
lib/altshift/core/class.js
function () { var prefix = '%(', suffix = ')', data = this.data, output = '', dataKey; output = this.__message__; for (dataKey in data) { if (data.hasOwnProperty(dataKey)) { output = output.replace(prefix + dataKey + s...
javascript
function () { var prefix = '%(', suffix = ')', data = this.data, output = '', dataKey; output = this.__message__; for (dataKey in data) { if (data.hasOwnProperty(dataKey)) { output = output.replace(prefix + dataKey + s...
[ "function", "(", ")", "{", "var", "prefix", "=", "'%('", ",", "suffix", "=", "')'", ",", "data", "=", "this", ".", "data", ",", "output", "=", "''", ",", "dataKey", ";", "output", "=", "this", ".", "__message__", ";", "for", "(", "dataKey", "in", ...
Return formatted message @return {string}
[ "Return", "formatted", "message" ]
5c051157e6f558636c8e12081b6707caa66249de
https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/class.js#L301-L319
55,061
altshift/altshift
lib/altshift/core/class.js
function (full) { var output, data; output = this.name + '[' + this.code + ']: '; output += this.message; if (full) { output += '\n'; output += this.stack.toString(); } return output; }
javascript
function (full) { var output, data; output = this.name + '[' + this.code + ']: '; output += this.message; if (full) { output += '\n'; output += this.stack.toString(); } return output; }
[ "function", "(", "full", ")", "{", "var", "output", ",", "data", ";", "output", "=", "this", ".", "name", "+", "'['", "+", "this", ".", "code", "+", "']: '", ";", "output", "+=", "this", ".", "message", ";", "if", "(", "full", ")", "{", "output",...
Return string formatted representation @param {boolean} full @return {string}
[ "Return", "string", "formatted", "representation" ]
5c051157e6f558636c8e12081b6707caa66249de
https://github.com/altshift/altshift/blob/5c051157e6f558636c8e12081b6707caa66249de/lib/altshift/core/class.js#L327-L337
55,062
ArtOfCode-/nails
src/handlers.js
setView
function setView({ action, config, route, routes, method }) { const ws = route.ws; return exports.getView(action, config).then(view => { routes[ws ? 'ws' : route.type].push({ action, method, view, match: new Route(route.url), }); }); }
javascript
function setView({ action, config, route, routes, method }) { const ws = route.ws; return exports.getView(action, config).then(view => { routes[ws ? 'ws' : route.type].push({ action, method, view, match: new Route(route.url), }); }); }
[ "function", "setView", "(", "{", "action", ",", "config", ",", "route", ",", "routes", ",", "method", "}", ")", "{", "const", "ws", "=", "route", ".", "ws", ";", "return", "exports", ".", "getView", "(", "action", ",", "config", ")", ".", "then", "...
Set the view for a specific route @private @returns {Promise} Could the view be loaded?
[ "Set", "the", "view", "for", "a", "specific", "route" ]
1ba9158742ba72bc727ad5c881035ee9d99b700c
https://github.com/ArtOfCode-/nails/blob/1ba9158742ba72bc727ad5c881035ee9d99b700c/src/handlers.js#L27-L37
55,063
skerit/alchemy-styleboost
public/ckeditor/4.4dev/core/dom/rangelist.js
function() { var rangeList = this, bookmark = CKEDITOR.dom.walker.bookmark(), bookmarks = [], current; return { /** * Retrieves the next range in the list. * * @member CKEDITOR.dom.rangeListIterator * @param {Boolean} [mergeConsequent=false] Whether join two adjacent * ra...
javascript
function() { var rangeList = this, bookmark = CKEDITOR.dom.walker.bookmark(), bookmarks = [], current; return { /** * Retrieves the next range in the list. * * @member CKEDITOR.dom.rangeListIterator * @param {Boolean} [mergeConsequent=false] Whether join two adjacent * ra...
[ "function", "(", ")", "{", "var", "rangeList", "=", "this", ",", "bookmark", "=", "CKEDITOR", ".", "dom", ".", "walker", ".", "bookmark", "(", ")", ",", "bookmarks", "=", "[", "]", ",", "current", ";", "return", "{", "/**\n\t\t\t\t * Retrieves the next ran...
Creates an instance of the rangeList iterator, it should be used only when the ranges processing could be DOM intrusive, which means it may pollute and break other ranges in this list. Otherwise, it's enough to just iterate over this array in a for loop. @returns {CKEDITOR.dom.rangeListIterator}
[ "Creates", "an", "instance", "of", "the", "rangeList", "iterator", "it", "should", "be", "used", "only", "when", "the", "ranges", "processing", "could", "be", "DOM", "intrusive", "which", "means", "it", "may", "pollute", "and", "break", "other", "ranges", "i...
2b90b8a6afc9f065f785651292fb193940021d90
https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/rangelist.js#L39-L116
55,064
frisb/fdboost
lib/enhance/encoding/adapters/index.js
function(typeCode) { switch (typeCode) { case this.types.undefined: return this.Undefined; case this.types.string: return this.String; case this.types.integer: return this.Integer; case this.types.double: return this.Double;...
javascript
function(typeCode) { switch (typeCode) { case this.types.undefined: return this.Undefined; case this.types.string: return this.String; case this.types.integer: return this.Integer; case this.types.double: return this.Double;...
[ "function", "(", "typeCode", ")", "{", "switch", "(", "typeCode", ")", "{", "case", "this", ".", "types", ".", "undefined", ":", "return", "this", ".", "Undefined", ";", "case", "this", ".", "types", ".", "string", ":", "return", "this", ".", "String",...
Get an Adapter for typeCode @method @param {integer} typeCode Type code. @return {AbstractAdapter} AbstractAdapter extension
[ "Get", "an", "Adapter", "for", "typeCode" ]
66cfb6552940aa92f35dbb1cf4d0695d842205c2
https://github.com/frisb/fdboost/blob/66cfb6552940aa92f35dbb1cf4d0695d842205c2/lib/enhance/encoding/adapters/index.js#L30-L55
55,065
forfuturellc/svc-fbr
src/lib/utils.js
addType
function addType(descriptor) { if (!(descriptor instanceof fs.Stats)) { return descriptor; } [ "isFile", "isDirectory", "isBlockDevice", "isCharacterDevice", "isSymbolicLink", "isFIFO", "isSocket", ].forEach(function(funcName) { if (descriptor[funcName]()) { descriptor[funcName] = true; ...
javascript
function addType(descriptor) { if (!(descriptor instanceof fs.Stats)) { return descriptor; } [ "isFile", "isDirectory", "isBlockDevice", "isCharacterDevice", "isSymbolicLink", "isFIFO", "isSocket", ].forEach(function(funcName) { if (descriptor[funcName]()) { descriptor[funcName] = true; ...
[ "function", "addType", "(", "descriptor", ")", "{", "if", "(", "!", "(", "descriptor", "instanceof", "fs", ".", "Stats", ")", ")", "{", "return", "descriptor", ";", "}", "[", "\"isFile\"", ",", "\"isDirectory\"", ",", "\"isBlockDevice\"", ",", "\"isCharacter...
Add type to all stat objects in a descriptor @param {fs.Stats} stats @return {fs.Stats}
[ "Add", "type", "to", "all", "stat", "objects", "in", "a", "descriptor" ]
8c07c71d6423d1dbd4f903a032dea0bfec63894e
https://github.com/forfuturellc/svc-fbr/blob/8c07c71d6423d1dbd4f903a032dea0bfec63894e/src/lib/utils.js#L26-L46
55,066
forfuturellc/svc-fbr
src/lib/utils.js
getArgs
function getArgs(userArgs, defaultArgs, userCallback) { let args = { }; let callback = userCallback || function() { }; defaultArgs.unshift(args); _.assign.apply(null, defaultArgs); if (_.isPlainObject(userArgs)) { _.merge(args, userArgs); } else { callback = userArgs; } return { options: a...
javascript
function getArgs(userArgs, defaultArgs, userCallback) { let args = { }; let callback = userCallback || function() { }; defaultArgs.unshift(args); _.assign.apply(null, defaultArgs); if (_.isPlainObject(userArgs)) { _.merge(args, userArgs); } else { callback = userArgs; } return { options: a...
[ "function", "getArgs", "(", "userArgs", ",", "defaultArgs", ",", "userCallback", ")", "{", "let", "args", "=", "{", "}", ";", "let", "callback", "=", "userCallback", "||", "function", "(", ")", "{", "}", ";", "defaultArgs", ".", "unshift", "(", "args", ...
Get arguments passed by user curated with configurations @param {Object} userArgs - arguments from user @param {Object[]} defaultArgs - default arguments to use @param {Function} userCallback - callback passed by user
[ "Get", "arguments", "passed", "by", "user", "curated", "with", "configurations" ]
8c07c71d6423d1dbd4f903a032dea0bfec63894e
https://github.com/forfuturellc/svc-fbr/blob/8c07c71d6423d1dbd4f903a032dea0bfec63894e/src/lib/utils.js#L56-L72
55,067
wigy/chronicles_of_grunt
lib/file-filter.js
removeDuplicates
function removeDuplicates(files, duplicates) { var i; var ret = []; var found = {}; if (duplicates) { for (i=0; i < duplicates.length; i++) { found[duplicates[i].dst] = true; } } for (i=0; i < files.length; i++) { if (...
javascript
function removeDuplicates(files, duplicates) { var i; var ret = []; var found = {}; if (duplicates) { for (i=0; i < duplicates.length; i++) { found[duplicates[i].dst] = true; } } for (i=0; i < files.length; i++) { if (...
[ "function", "removeDuplicates", "(", "files", ",", "duplicates", ")", "{", "var", "i", ";", "var", "ret", "=", "[", "]", ";", "var", "found", "=", "{", "}", ";", "if", "(", "duplicates", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "dupl...
Scan file specs and remove duplicates. @param files {Array} List of resolved file specs. @param duplicates {Array} Optional list of resolved file specs to consider duplicates.
[ "Scan", "file", "specs", "and", "remove", "duplicates", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/file-filter.js#L164-L182
55,068
wigy/chronicles_of_grunt
lib/file-filter.js
flatten
function flatten(files) { var ret = []; for (var i=0; i < files.length; i++) { ret.push(files[i].dst); } return ret; }
javascript
function flatten(files) { var ret = []; for (var i=0; i < files.length; i++) { ret.push(files[i].dst); } return ret; }
[ "function", "flatten", "(", "files", ")", "{", "var", "ret", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "files", ".", "length", ";", "i", "++", ")", "{", "ret", ".", "push", "(", "files", "[", "i", "]", ".", "dst",...
Collect destination files from file spec list.
[ "Collect", "destination", "files", "from", "file", "spec", "list", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/file-filter.js#L187-L193
55,069
wigy/chronicles_of_grunt
lib/file-filter.js
prefixDest
function prefixDest(prefix, files) { for (var i = 0; i < files.length; i++) { files[i].dst = prefix + files[i].dst; } return files; }
javascript
function prefixDest(prefix, files) { for (var i = 0; i < files.length; i++) { files[i].dst = prefix + files[i].dst; } return files; }
[ "function", "prefixDest", "(", "prefix", ",", "files", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "files", ".", "length", ";", "i", "++", ")", "{", "files", "[", "i", "]", ".", "dst", "=", "prefix", "+", "files", "[", "i", "]"...
Add a directory prefix to all destinations in the file list.
[ "Add", "a", "directory", "prefix", "to", "all", "destinations", "in", "the", "file", "list", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/file-filter.js#L198-L203
55,070
wigy/chronicles_of_grunt
lib/file-filter.js
filesInRepository
function filesInRepository(dir) { var ignoreDirs = cog.getOption('ignore_dirs'); // TODO: Allow an array and move to config. var ignoreFiles = /~$/; var files = glob.sync(dir ? dir + '/*' : '*'); var ret = []; for (var i = 0; i < files.length; i++) { if (fs.ls...
javascript
function filesInRepository(dir) { var ignoreDirs = cog.getOption('ignore_dirs'); // TODO: Allow an array and move to config. var ignoreFiles = /~$/; var files = glob.sync(dir ? dir + '/*' : '*'); var ret = []; for (var i = 0; i < files.length; i++) { if (fs.ls...
[ "function", "filesInRepository", "(", "dir", ")", "{", "var", "ignoreDirs", "=", "cog", ".", "getOption", "(", "'ignore_dirs'", ")", ";", "// TODO: Allow an array and move to config.", "var", "ignoreFiles", "=", "/", "~$", "/", ";", "var", "files", "=", "glob", ...
Perform recursive lookup for files in the repository. @return {Array} A list of files in the repository ignoring files of not interest.
[ "Perform", "recursive", "lookup", "for", "files", "in", "the", "repository", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/file-filter.js#L210-L230
55,071
wigy/chronicles_of_grunt
lib/file-filter.js
excludeFiles
function excludeFiles(list, regex) { var ret = []; for (var i=0; i < list.length; i++) { if (!regex.test(list[i].dst)) { ret.push(list[i]); } } return ret; }
javascript
function excludeFiles(list, regex) { var ret = []; for (var i=0; i < list.length; i++) { if (!regex.test(list[i].dst)) { ret.push(list[i]); } } return ret; }
[ "function", "excludeFiles", "(", "list", ",", "regex", ")", "{", "var", "ret", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "list", ".", "length", ";", "i", "++", ")", "{", "if", "(", "!", "regex", ".", "test", "(", ...
Remove specs whose destination matches to the given regex pattern.
[ "Remove", "specs", "whose", "destination", "matches", "to", "the", "given", "regex", "pattern", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/file-filter.js#L235-L243
55,072
wigy/chronicles_of_grunt
lib/file-filter.js
srcFiles
function srcFiles() { return removeDuplicates(configFiles().concat(libFiles()).concat(modelFiles()).concat(srcDataFiles()).concat(codeFiles())); }
javascript
function srcFiles() { return removeDuplicates(configFiles().concat(libFiles()).concat(modelFiles()).concat(srcDataFiles()).concat(codeFiles())); }
[ "function", "srcFiles", "(", ")", "{", "return", "removeDuplicates", "(", "configFiles", "(", ")", ".", "concat", "(", "libFiles", "(", ")", ")", ".", "concat", "(", "modelFiles", "(", ")", ")", ".", "concat", "(", "srcDataFiles", "(", ")", ")", ".", ...
Find all source code files for the actual application.
[ "Find", "all", "source", "code", "files", "for", "the", "actual", "application", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/file-filter.js#L359-L361
55,073
wigy/chronicles_of_grunt
lib/file-filter.js
otherNonJsFiles
function otherNonJsFiles() { return removeDuplicates(files(cog.getConfig('src.other'), 'other'), srcFiles().concat(otherJsFiles().concat(appIndexFiles()))); }
javascript
function otherNonJsFiles() { return removeDuplicates(files(cog.getConfig('src.other'), 'other'), srcFiles().concat(otherJsFiles().concat(appIndexFiles()))); }
[ "function", "otherNonJsFiles", "(", ")", "{", "return", "removeDuplicates", "(", "files", "(", "cog", ".", "getConfig", "(", "'src.other'", ")", ",", "'other'", ")", ",", "srcFiles", "(", ")", ".", "concat", "(", "otherJsFiles", "(", ")", ".", "concat", ...
Find other files that are not Javascript.
[ "Find", "other", "files", "that", "are", "not", "Javascript", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/file-filter.js#L387-L389
55,074
wigy/chronicles_of_grunt
lib/file-filter.js
includeJsFiles
function includeJsFiles() { if (cog.getOption('include_only_external')) { return extLibFiles().concat(generatedJsFiles()); } if (cog.getOption('compile_typescript')) { return extLibFiles().concat(generatedJsFiles()); } return extLibFiles().concat(srcFiles(...
javascript
function includeJsFiles() { if (cog.getOption('include_only_external')) { return extLibFiles().concat(generatedJsFiles()); } if (cog.getOption('compile_typescript')) { return extLibFiles().concat(generatedJsFiles()); } return extLibFiles().concat(srcFiles(...
[ "function", "includeJsFiles", "(", ")", "{", "if", "(", "cog", ".", "getOption", "(", "'include_only_external'", ")", ")", "{", "return", "extLibFiles", "(", ")", ".", "concat", "(", "generatedJsFiles", "(", ")", ")", ";", "}", "if", "(", "cog", ".", "...
Find all code files needed to include in HTML index.
[ "Find", "all", "code", "files", "needed", "to", "include", "in", "HTML", "index", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/file-filter.js#L450-L458
55,075
wigy/chronicles_of_grunt
lib/file-filter.js
allJavascriptFiles
function allJavascriptFiles() { return srcFiles().concat(otherJsFiles()).concat(unitTestFiles()).concat(unitTestHelperFiles()).concat(taskFiles()).concat(commonJsFiles()); }
javascript
function allJavascriptFiles() { return srcFiles().concat(otherJsFiles()).concat(unitTestFiles()).concat(unitTestHelperFiles()).concat(taskFiles()).concat(commonJsFiles()); }
[ "function", "allJavascriptFiles", "(", ")", "{", "return", "srcFiles", "(", ")", ".", "concat", "(", "otherJsFiles", "(", ")", ")", ".", "concat", "(", "unitTestFiles", "(", ")", ")", ".", "concat", "(", "unitTestHelperFiles", "(", ")", ")", ".", "concat...
Find all Javascript based work files.
[ "Find", "all", "Javascript", "based", "work", "files", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/file-filter.js#L572-L574
55,076
wigy/chronicles_of_grunt
lib/file-filter.js
workTextFiles
function workTextFiles() { return indexFiles().concat(srcFiles()).concat(allTestFiles()).concat(otherJsFiles()).concat(otherNonJsFiles()).concat(taskFiles()).concat(cssFiles()) .concat(toolsShellFiles()).concat(commonJsFiles()).concat(htmlTemplateFiles()).concat(pythonFiles()).concat(textDataFiles()...
javascript
function workTextFiles() { return indexFiles().concat(srcFiles()).concat(allTestFiles()).concat(otherJsFiles()).concat(otherNonJsFiles()).concat(taskFiles()).concat(cssFiles()) .concat(toolsShellFiles()).concat(commonJsFiles()).concat(htmlTemplateFiles()).concat(pythonFiles()).concat(textDataFiles()...
[ "function", "workTextFiles", "(", ")", "{", "return", "indexFiles", "(", ")", ".", "concat", "(", "srcFiles", "(", ")", ")", ".", "concat", "(", "allTestFiles", "(", ")", ")", ".", "concat", "(", "otherJsFiles", "(", ")", ")", ".", "concat", "(", "ot...
Find all text based work files.
[ "Find", "all", "text", "based", "work", "files", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/file-filter.js#L628-L631
55,077
wigy/chronicles_of_grunt
lib/file-filter.js
generatedJsFiles
function generatedJsFiles(what) { var ret = []; if ((!what || what === 'templates') && cog.getOption('template')) { ret.push({src: null, dst: cog.getOption('template')}); } if (cog.getOption('compile_typescript')) { var src = srcTypescriptFiles(); for ...
javascript
function generatedJsFiles(what) { var ret = []; if ((!what || what === 'templates') && cog.getOption('template')) { ret.push({src: null, dst: cog.getOption('template')}); } if (cog.getOption('compile_typescript')) { var src = srcTypescriptFiles(); for ...
[ "function", "generatedJsFiles", "(", "what", ")", "{", "var", "ret", "=", "[", "]", ";", "if", "(", "(", "!", "what", "||", "what", "===", "'templates'", ")", "&&", "cog", ".", "getOption", "(", "'template'", ")", ")", "{", "ret", ".", "push", "(",...
List of files that are generated Javascript files.
[ "List", "of", "files", "that", "are", "generated", "Javascript", "files", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/file-filter.js#L650-L665
55,078
wigy/chronicles_of_grunt
lib/file-filter.js
fileCategoryMap
function fileCategoryMap() { // Go over every file lookup function we export. var exports = module.exports(grunt); // This list of categories must contain all non-overlapping file categories. var categories = ['extLibFiles', 'extLibMapFiles', 'extCssFiles', 'extFontFiles', 'fontFiles', ...
javascript
function fileCategoryMap() { // Go over every file lookup function we export. var exports = module.exports(grunt); // This list of categories must contain all non-overlapping file categories. var categories = ['extLibFiles', 'extLibMapFiles', 'extCssFiles', 'extFontFiles', 'fontFiles', ...
[ "function", "fileCategoryMap", "(", ")", "{", "// Go over every file lookup function we export.", "var", "exports", "=", "module", ".", "exports", "(", "grunt", ")", ";", "// This list of categories must contain all non-overlapping file categories.", "var", "categories", "=", ...
Build complete map of known files. Note that when adding new file categories, this function must be updated and all new non-overlapping (i.e. atomic) categories needs to be added here.
[ "Build", "complete", "map", "of", "known", "files", "." ]
c5f089a6f391a0ca625fcb81ef51907713471bb3
https://github.com/wigy/chronicles_of_grunt/blob/c5f089a6f391a0ca625fcb81ef51907713471bb3/lib/file-filter.js#L708-L735
55,079
intervolga/bemjson-loader
lib/validate-bemjson.js
validateBemJson
function validateBemJson(bemJson, fileName) { let errors = []; if (Array.isArray(bemJson)) { bemJson.forEach((childBemJson) => { errors = errors.concat(validateBemJson(childBemJson, fileName)); }); } else if (bemJson instanceof Object) { Object.keys(bemJson).forEach((key) => { const child...
javascript
function validateBemJson(bemJson, fileName) { let errors = []; if (Array.isArray(bemJson)) { bemJson.forEach((childBemJson) => { errors = errors.concat(validateBemJson(childBemJson, fileName)); }); } else if (bemJson instanceof Object) { Object.keys(bemJson).forEach((key) => { const child...
[ "function", "validateBemJson", "(", "bemJson", ",", "fileName", ")", "{", "let", "errors", "=", "[", "]", ";", "if", "(", "Array", ".", "isArray", "(", "bemJson", ")", ")", "{", "bemJson", ".", "forEach", "(", "(", "childBemJson", ")", "=>", "{", "er...
Validate BEM JSON @param {Object} bemJson @param {String} fileName @return {Array} of validation errors
[ "Validate", "BEM", "JSON" ]
c4ff680ee07ab939d400f241859fe608411fd8de
https://github.com/intervolga/bemjson-loader/blob/c4ff680ee07ab939d400f241859fe608411fd8de/lib/validate-bemjson.js#L8-L25
55,080
intervolga/bemjson-loader
lib/validate-bemjson.js
extractBemJsonNode
function extractBemJsonNode(bemJson) { let result = JSON.parse(JSON.stringify(bemJson)); Object.keys(result).forEach((key) => { result[key] = result[key].toString(); }); return JSON.stringify(result, null, 2); }
javascript
function extractBemJsonNode(bemJson) { let result = JSON.parse(JSON.stringify(bemJson)); Object.keys(result).forEach((key) => { result[key] = result[key].toString(); }); return JSON.stringify(result, null, 2); }
[ "function", "extractBemJsonNode", "(", "bemJson", ")", "{", "let", "result", "=", "JSON", ".", "parse", "(", "JSON", ".", "stringify", "(", "bemJson", ")", ")", ";", "Object", ".", "keys", "(", "result", ")", ".", "forEach", "(", "(", "key", ")", "=>...
Strips all child nodes from BemJson node for print puproses @param {Object} bemJson @return {Object}
[ "Strips", "all", "child", "nodes", "from", "BemJson", "node", "for", "print", "puproses" ]
c4ff680ee07ab939d400f241859fe608411fd8de
https://github.com/intervolga/bemjson-loader/blob/c4ff680ee07ab939d400f241859fe608411fd8de/lib/validate-bemjson.js#L98-L106
55,081
codenothing/munit
lib/queue.js
function(){ var copy = []; // Handle recursive loops if ( queue.running ) { queue.waiting = true; return; } // Mark queue as running, then search for queue.running = true; munit.each( queue.modules, function( assert, index ) { if ( ! queue.objects.length ) { return false; } else if (...
javascript
function(){ var copy = []; // Handle recursive loops if ( queue.running ) { queue.waiting = true; return; } // Mark queue as running, then search for queue.running = true; munit.each( queue.modules, function( assert, index ) { if ( ! queue.objects.length ) { return false; } else if (...
[ "function", "(", ")", "{", "var", "copy", "=", "[", "]", ";", "// Handle recursive loops", "if", "(", "queue", ".", "running", ")", "{", "queue", ".", "waiting", "=", "true", ";", "return", ";", "}", "// Mark queue as running, then search for ", "queue", "."...
Runs through queued modules and finds objects to run them with
[ "Runs", "through", "queued", "modules", "and", "finds", "objects", "to", "run", "them", "with" ]
aedf3f31aafc05441970eec49eeeb81174c14033
https://github.com/codenothing/munit/blob/aedf3f31aafc05441970eec49eeeb81174c14033/lib/queue.js#L58-L111
55,082
andreypopp/stream-recreate
index.js
recreate
function recreate(makeStream, options) { if (options === undefined && isObject(makeStream)) { options = makeStream; makeStream = options.makeStream; } options = options || {}; if (options.connect === undefined) { options.connect = true; } var connectedEvent = options.connectedEvent || 'open';...
javascript
function recreate(makeStream, options) { if (options === undefined && isObject(makeStream)) { options = makeStream; makeStream = options.makeStream; } options = options || {}; if (options.connect === undefined) { options.connect = true; } var connectedEvent = options.connectedEvent || 'open';...
[ "function", "recreate", "(", "makeStream", ",", "options", ")", "{", "if", "(", "options", "===", "undefined", "&&", "isObject", "(", "makeStream", ")", ")", "{", "options", "=", "makeStream", ";", "makeStream", "=", "options", ".", "makeStream", ";", "}",...
Create wrapper stream which takes care of recreating logic. @param {Function} makeStream a function which returns a stream @param {Object}
[ "Create", "wrapper", "stream", "which", "takes", "care", "of", "recreating", "logic", "." ]
ed814ceb3e6d8c943f9cff919f64a426a196399a
https://github.com/andreypopp/stream-recreate/blob/ed814ceb3e6d8c943f9cff919f64a426a196399a/index.js#L19-L104
55,083
shama/grunt-net
tasks/net.js
createServer
function createServer() { grunt.log.ok('Registered as a grunt-net server [' + host + ':' + port + '].'); dnode({ spawn: spawn }).listen(host, port); }
javascript
function createServer() { grunt.log.ok('Registered as a grunt-net server [' + host + ':' + port + '].'); dnode({ spawn: spawn }).listen(host, port); }
[ "function", "createServer", "(", ")", "{", "grunt", ".", "log", ".", "ok", "(", "'Registered as a grunt-net server ['", "+", "host", "+", "':'", "+", "port", "+", "'].'", ")", ";", "dnode", "(", "{", "spawn", ":", "spawn", "}", ")", ".", "listen", "(",...
create a server
[ "create", "a", "server" ]
19fc0969e14e5db3207dd42b2ac1d76464e7da86
https://github.com/shama/grunt-net/blob/19fc0969e14e5db3207dd42b2ac1d76464e7da86/tasks/net.js#L39-L42
55,084
je3f0o/jeefo_preprocessor
src/preprocessor.js
function (token) { var pp = new JavascriptPreprocessor(this.parser, this.compiler, this.actions, this.scope, this.state); if (token) { pp.code = this.get_code(this.code, token); } return pp; }
javascript
function (token) { var pp = new JavascriptPreprocessor(this.parser, this.compiler, this.actions, this.scope, this.state); if (token) { pp.code = this.get_code(this.code, token); } return pp; }
[ "function", "(", "token", ")", "{", "var", "pp", "=", "new", "JavascriptPreprocessor", "(", "this", ".", "parser", ",", "this", ".", "compiler", ",", "this", ".", "actions", ",", "this", ".", "scope", ",", "this", ".", "state", ")", ";", "if", "(", ...
Utils {{{1
[ "Utils", "{{{", "1" ]
77050d8b2c1856a29a04d6de4fa602d05357175b
https://github.com/je3f0o/jeefo_preprocessor/blob/77050d8b2c1856a29a04d6de4fa602d05357175b/src/preprocessor.js#L26-L32
55,085
je3f0o/jeefo_preprocessor
src/preprocessor.js
function (action) { if (action) { switch (action.type) { case "replace" : this.code = `${ this.code.substr(0, action.start) }${ action.value }${ this.code.substr(action.end) }`; return true; case "remove" : this.code = `${ this.code.substr(0, action.start) }${ this.code.substr(action.end) }`...
javascript
function (action) { if (action) { switch (action.type) { case "replace" : this.code = `${ this.code.substr(0, action.start) }${ action.value }${ this.code.substr(action.end) }`; return true; case "remove" : this.code = `${ this.code.substr(0, action.start) }${ this.code.substr(action.end) }`...
[ "function", "(", "action", ")", "{", "if", "(", "action", ")", "{", "switch", "(", "action", ".", "type", ")", "{", "case", "\"replace\"", ":", "this", ".", "code", "=", "`", "${", "this", ".", "code", ".", "substr", "(", "0", ",", "action", ".",...
Actions {{{1
[ "Actions", "{{{", "1" ]
77050d8b2c1856a29a04d6de4fa602d05357175b
https://github.com/je3f0o/jeefo_preprocessor/blob/77050d8b2c1856a29a04d6de4fa602d05357175b/src/preprocessor.js#L39-L50
55,086
je3f0o/jeefo_preprocessor
src/preprocessor.js
function (name, definition, is_return) { var pp = this.$new(), code = `PP.define("${ name }", ${ definition.toString() }, ${ is_return });`; pp.scope = this.scope; pp.process("[IN MEMORY]", code); }
javascript
function (name, definition, is_return) { var pp = this.$new(), code = `PP.define("${ name }", ${ definition.toString() }, ${ is_return });`; pp.scope = this.scope; pp.process("[IN MEMORY]", code); }
[ "function", "(", "name", ",", "definition", ",", "is_return", ")", "{", "var", "pp", "=", "this", ".", "$new", "(", ")", ",", "code", "=", "`", "${", "name", "}", "${", "definition", ".", "toString", "(", ")", "}", "${", "is_return", "}", "`", ";...
Define {{{1
[ "Define", "{{{", "1" ]
77050d8b2c1856a29a04d6de4fa602d05357175b
https://github.com/je3f0o/jeefo_preprocessor/blob/77050d8b2c1856a29a04d6de4fa602d05357175b/src/preprocessor.js#L70-L76
55,087
je3f0o/jeefo_preprocessor
src/preprocessor.js
function (code, tokens) { var actions = [], i = 0; this.code = code; for (; i < tokens.length; ++i) { actions[i] = this.actions.invoke(this, tokens[i]); } i = actions.length; while (i--) { this.action(actions[i]); } return this.code; }
javascript
function (code, tokens) { var actions = [], i = 0; this.code = code; for (; i < tokens.length; ++i) { actions[i] = this.actions.invoke(this, tokens[i]); } i = actions.length; while (i--) { this.action(actions[i]); } return this.code; }
[ "function", "(", "code", ",", "tokens", ")", "{", "var", "actions", "=", "[", "]", ",", "i", "=", "0", ";", "this", ".", "code", "=", "code", ";", "for", "(", ";", "i", "<", "tokens", ".", "length", ";", "++", "i", ")", "{", "actions", "[", ...
Processor {{{1
[ "Processor", "{{{", "1" ]
77050d8b2c1856a29a04d6de4fa602d05357175b
https://github.com/je3f0o/jeefo_preprocessor/blob/77050d8b2c1856a29a04d6de4fa602d05357175b/src/preprocessor.js#L138-L153
55,088
je3f0o/jeefo_preprocessor
src/preprocessor.js
function (code) { try { return this.parser.parse(code); } catch(e) { console.log("E", e); console.log(code); process.exit(); } }
javascript
function (code) { try { return this.parser.parse(code); } catch(e) { console.log("E", e); console.log(code); process.exit(); } }
[ "function", "(", "code", ")", "{", "try", "{", "return", "this", ".", "parser", ".", "parse", "(", "code", ")", ";", "}", "catch", "(", "e", ")", "{", "console", ".", "log", "(", "\"E\"", ",", "e", ")", ";", "console", ".", "log", "(", "code", ...
Parser {{{1
[ "Parser", "{{{", "1" ]
77050d8b2c1856a29a04d6de4fa602d05357175b
https://github.com/je3f0o/jeefo_preprocessor/blob/77050d8b2c1856a29a04d6de4fa602d05357175b/src/preprocessor.js#L160-L168
55,089
bvalosek/sack
lib/Container.js
callNew
function callNew(T, args) { return new (Function.prototype.bind.apply(T, [null].concat(args))); }
javascript
function callNew(T, args) { return new (Function.prototype.bind.apply(T, [null].concat(args))); }
[ "function", "callNew", "(", "T", ",", "args", ")", "{", "return", "new", "(", "Function", ".", "prototype", ".", "bind", ".", "apply", "(", "T", ",", "[", "null", "]", ".", "concat", "(", "args", ")", ")", ")", ";", "}" ]
Give us a way to instantiate a new class with an array of args @private
[ "Give", "us", "a", "way", "to", "instantiate", "a", "new", "class", "with", "an", "array", "of", "args" ]
65e2ab133b6c40400c200c2e071052dea6b23c24
https://github.com/bvalosek/sack/blob/65e2ab133b6c40400c200c2e071052dea6b23c24/lib/Container.js#L222-L225
55,090
patgrasso/parsey
lib/parser.js
earley
function earley(tokens, grammar) { let states = Array.apply(null, Array(tokens.length + 1)).map(() => []); var i, j; let rulePairs = grammar.map((rule) => ({ name : rule.lhs.name, rule : rule, position: 0, origin : 0 })); [].push.apply(states[0], rulePairs); for (i = 0; i <= token...
javascript
function earley(tokens, grammar) { let states = Array.apply(null, Array(tokens.length + 1)).map(() => []); var i, j; let rulePairs = grammar.map((rule) => ({ name : rule.lhs.name, rule : rule, position: 0, origin : 0 })); [].push.apply(states[0], rulePairs); for (i = 0; i <= token...
[ "function", "earley", "(", "tokens", ",", "grammar", ")", "{", "let", "states", "=", "Array", ".", "apply", "(", "null", ",", "Array", "(", "tokens", ".", "length", "+", "1", ")", ")", ".", "map", "(", "(", ")", "=>", "[", "]", ")", ";", "var",...
Parses the input tokens using the earley top-down chart parsing algorithm to product a set of states, each containing a list of earley items @function earley @memberof module:lib/parser @param {string[]} tokens - Sequence of symbols to be parsed @param {Rule[]|CFG} grammar - Set of rules that define a language @return...
[ "Parses", "the", "input", "tokens", "using", "the", "earley", "top", "-", "down", "chart", "parsing", "algorithm", "to", "product", "a", "set", "of", "states", "each", "containing", "a", "list", "of", "earley", "items" ]
d28b3f330ee03b5c273f1ce5871a5b86dac79fb0
https://github.com/patgrasso/parsey/blob/d28b3f330ee03b5c273f1ce5871a5b86dac79fb0/lib/parser.js#L64-L86
55,091
patgrasso/parsey
lib/parser.js
removeUnfinishedItems
function removeUnfinishedItems(states) { return states.map((state) => state.filter((earleyItem) => { return earleyItem.position >= earleyItem.rule.length; })); }
javascript
function removeUnfinishedItems(states) { return states.map((state) => state.filter((earleyItem) => { return earleyItem.position >= earleyItem.rule.length; })); }
[ "function", "removeUnfinishedItems", "(", "states", ")", "{", "return", "states", ".", "map", "(", "(", "state", ")", "=>", "state", ".", "filter", "(", "(", "earleyItem", ")", "=>", "{", "return", "earleyItem", ".", "position", ">=", "earleyItem", ".", ...
Removes earley items from each state that failed to completely parse through. In other words, removes earley items whose position is less than the length of its rule @function removeUnfinishedItems @param {state[]} states - Set of lists of earley items @return {state[]} Set of lists of completed earley items
[ "Removes", "earley", "items", "from", "each", "state", "that", "failed", "to", "completely", "parse", "through", ".", "In", "other", "words", "removes", "earley", "items", "whose", "position", "is", "less", "than", "the", "length", "of", "its", "rule" ]
d28b3f330ee03b5c273f1ce5871a5b86dac79fb0
https://github.com/patgrasso/parsey/blob/d28b3f330ee03b5c273f1ce5871a5b86dac79fb0/lib/parser.js#L206-L210
55,092
patgrasso/parsey
lib/parser.js
swap
function swap(states) { let newStates = Array.apply(null, Array(states.length)).map(() => []); states.forEach((state, i) => { state.forEach((earleyItem) => { newStates[earleyItem.origin].push(earleyItem); earleyItem.origin = i; }); }); return newStates; }
javascript
function swap(states) { let newStates = Array.apply(null, Array(states.length)).map(() => []); states.forEach((state, i) => { state.forEach((earleyItem) => { newStates[earleyItem.origin].push(earleyItem); earleyItem.origin = i; }); }); return newStates; }
[ "function", "swap", "(", "states", ")", "{", "let", "newStates", "=", "Array", ".", "apply", "(", "null", ",", "Array", "(", "states", ".", "length", ")", ")", ".", "map", "(", "(", ")", "=>", "[", "]", ")", ";", "states", ".", "forEach", "(", ...
Places earley items in the states in which they originated, as opposed to the states in which they finished parsing, and set their `origin` properties to the state in which they finished. This allows a depth-first search of the chart to move forwards through the graph, which is more intuitive than having to move backw...
[ "Places", "earley", "items", "in", "the", "states", "in", "which", "they", "originated", "as", "opposed", "to", "the", "states", "in", "which", "they", "finished", "parsing", "and", "set", "their", "origin", "properties", "to", "the", "state", "in", "which",...
d28b3f330ee03b5c273f1ce5871a5b86dac79fb0
https://github.com/patgrasso/parsey/blob/d28b3f330ee03b5c273f1ce5871a5b86dac79fb0/lib/parser.js#L227-L237
55,093
patgrasso/parsey
lib/parser.js
dfsHelper
function dfsHelper(states, root, state, depth, tokens) { var edges; // Base case: we finished the root rule if (state === root.origin && depth === root.rule.length) { return []; } // If the current production symbol is a terminal if (root.rule[depth] instanceof RegExp) { if (root.rule[depth].test(...
javascript
function dfsHelper(states, root, state, depth, tokens) { var edges; // Base case: we finished the root rule if (state === root.origin && depth === root.rule.length) { return []; } // If the current production symbol is a terminal if (root.rule[depth] instanceof RegExp) { if (root.rule[depth].test(...
[ "function", "dfsHelper", "(", "states", ",", "root", ",", "state", ",", "depth", ",", "tokens", ")", "{", "var", "edges", ";", "// Base case: we finished the root rule", "if", "(", "state", "===", "root", ".", "origin", "&&", "depth", "===", "root", ".", "...
Recursive function that explores a specific earley item, constructs the parse tree for it, then sends it up the chimney! @function dfsHelper @param {state[]} states - Set of lists of earley items @param {earleyItem} root - Current earley item being explored, a tree for which is to be constructed @param {number} state ...
[ "Recursive", "function", "that", "explores", "a", "specific", "earley", "item", "constructs", "the", "parse", "tree", "for", "it", "then", "sends", "it", "up", "the", "chimney!" ]
d28b3f330ee03b5c273f1ce5871a5b86dac79fb0
https://github.com/patgrasso/parsey/blob/d28b3f330ee03b5c273f1ce5871a5b86dac79fb0/lib/parser.js#L309-L366
55,094
tests-always-included/ddq-backend-mock
lib/ddq-backend-mock.js
remove
function remove(ddqBackendInstance, recordId, callback) { // Note, this is not what we want. // it does not handle the times when the // isProcessing flag is true. ddqBackendInstance.deleteData(recordId); ddqBackendInstance.checkAndEmitData(); callback(); }
javascript
function remove(ddqBackendInstance, recordId, callback) { // Note, this is not what we want. // it does not handle the times when the // isProcessing flag is true. ddqBackendInstance.deleteData(recordId); ddqBackendInstance.checkAndEmitData(); callback(); }
[ "function", "remove", "(", "ddqBackendInstance", ",", "recordId", ",", "callback", ")", "{", "// Note, this is not what we want.", "// it does not handle the times when the", "// isProcessing flag is true.", "ddqBackendInstance", ".", "deleteData", "(", "recordId", ")", ";", ...
Removes the message from stored data. @param {Object} ddqBackendInstance @param {string} recordId @param {Function} callback
[ "Removes", "the", "message", "from", "stored", "data", "." ]
7d3cbf25a4533db9dac68193ac0af648ee38a435
https://github.com/tests-always-included/ddq-backend-mock/blob/7d3cbf25a4533db9dac68193ac0af648ee38a435/lib/ddq-backend-mock.js#L59-L66
55,095
tests-always-included/ddq-backend-mock
lib/ddq-backend-mock.js
requeue
function requeue(ddqBackendInstance, recordId, callback) { var record; record = ddqBackendInstance.getRecord(recordId); record.isProcessing = false; record.requeued = true; callback(); }
javascript
function requeue(ddqBackendInstance, recordId, callback) { var record; record = ddqBackendInstance.getRecord(recordId); record.isProcessing = false; record.requeued = true; callback(); }
[ "function", "requeue", "(", "ddqBackendInstance", ",", "recordId", ",", "callback", ")", "{", "var", "record", ";", "record", "=", "ddqBackendInstance", ".", "getRecord", "(", "recordId", ")", ";", "record", ".", "isProcessing", "=", "false", ";", "record", ...
Sets the record to be requeued so another listener can pick it up and try to process the message again. @param {Object} ddqBackendInstance @param {string} recordId @param {Function} callback
[ "Sets", "the", "record", "to", "be", "requeued", "so", "another", "listener", "can", "pick", "it", "up", "and", "try", "to", "process", "the", "message", "again", "." ]
7d3cbf25a4533db9dac68193ac0af648ee38a435
https://github.com/tests-always-included/ddq-backend-mock/blob/7d3cbf25a4533db9dac68193ac0af648ee38a435/lib/ddq-backend-mock.js#L77-L84
55,096
binder-project/binder-health-checker
lib/cli.js
Command
function Command (name, cli, action) { if (!(this instanceof Command)) { return new Command(name, cli, action) } this.name = name this.cli = cli this.action = action }
javascript
function Command (name, cli, action) { if (!(this instanceof Command)) { return new Command(name, cli, action) } this.name = name this.cli = cli this.action = action }
[ "function", "Command", "(", "name", ",", "cli", ",", "action", ")", "{", "if", "(", "!", "(", "this", "instanceof", "Command", ")", ")", "{", "return", "new", "Command", "(", "name", ",", "cli", ",", "action", ")", "}", "this", ".", "name", "=", ...
The argument-parsing and action components of a CLI command are separated so that the CLI can both be imported from other modules and launched via PM2
[ "The", "argument", "-", "parsing", "and", "action", "components", "of", "a", "CLI", "command", "are", "separated", "so", "that", "the", "CLI", "can", "both", "be", "imported", "from", "other", "modules", "and", "launched", "via", "PM2" ]
7c6c7973464c42a67b7f860ca6cceb40f29c1e5e
https://github.com/binder-project/binder-health-checker/blob/7c6c7973464c42a67b7f860ca6cceb40f29c1e5e/lib/cli.js#L13-L20
55,097
peerigon/alamid-sorted-array
lib/sortedArray.js
sortedArray
function sortedArray(arr, comparator1, comparator2, comparator3) { var _ = {}; arr = arr || []; if (typeof arr._sortedArray === "object") { throw new Error("(sortedArray) Cannot extend array: Special key _sortedArray is already defined. Did you apply it twice?"); } arr._sortedArray = _; ...
javascript
function sortedArray(arr, comparator1, comparator2, comparator3) { var _ = {}; arr = arr || []; if (typeof arr._sortedArray === "object") { throw new Error("(sortedArray) Cannot extend array: Special key _sortedArray is already defined. Did you apply it twice?"); } arr._sortedArray = _; ...
[ "function", "sortedArray", "(", "arr", ",", "comparator1", ",", "comparator2", ",", "comparator3", ")", "{", "var", "_", "=", "{", "}", ";", "arr", "=", "arr", "||", "[", "]", ";", "if", "(", "typeof", "arr", ".", "_sortedArray", "===", "\"object\"", ...
Turns an array or every object with an array-like interface into a sorted array that maintains the sort order. This is basically achieved by replacing the original mutator methods with versions that respect the order. If the supplied array has a comparator-function, this function will be used for comparison. You may ...
[ "Turns", "an", "array", "or", "every", "object", "with", "an", "array", "-", "like", "interface", "into", "a", "sorted", "array", "that", "maintains", "the", "sort", "order", ".", "This", "is", "basically", "achieved", "by", "replacing", "the", "original", ...
59d58fd3b94d26c873c2a4ba2ecd18758309bd0b
https://github.com/peerigon/alamid-sorted-array/blob/59d58fd3b94d26c873c2a4ba2ecd18758309bd0b/lib/sortedArray.js#L21-L60
55,098
peerigon/alamid-sorted-array
lib/sortedArray.js
indexOf
function indexOf(element, fromIndex) { /* jshint validthis:true */ var arr = toArray(this), index; if (fromIndex) { arr = arr.slice(fromIndex); } index = binarySearch(arr, element, this.comparator); if (index < 0) { return -1; } else { return index; } }
javascript
function indexOf(element, fromIndex) { /* jshint validthis:true */ var arr = toArray(this), index; if (fromIndex) { arr = arr.slice(fromIndex); } index = binarySearch(arr, element, this.comparator); if (index < 0) { return -1; } else { return index; } }
[ "function", "indexOf", "(", "element", ",", "fromIndex", ")", "{", "/* jshint validthis:true */", "var", "arr", "=", "toArray", "(", "this", ")", ",", "index", ";", "if", "(", "fromIndex", ")", "{", "arr", "=", "arr", ".", "slice", "(", "fromIndex", ")",...
Works like Array.prototype.indexOf but uses a faster binary search. Same signature as Array.prototype.indexOf @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
[ "Works", "like", "Array", ".", "prototype", ".", "indexOf", "but", "uses", "a", "faster", "binary", "search", "." ]
59d58fd3b94d26c873c2a4ba2ecd18758309bd0b
https://github.com/peerigon/alamid-sorted-array/blob/59d58fd3b94d26c873c2a4ba2ecd18758309bd0b/lib/sortedArray.js#L109-L125
55,099
peerigon/alamid-sorted-array
lib/sortedArray.js
reverse
function reverse() { /* jshint validthis:true */ var _ = this._sortedArray, reversed = _.reversed; if (reversed) { this.comparator = this.comparator.original; } else { this.comparator = getInversionOf(this.comparator); } _.reversed = !reversed; _.reverse.call(this);...
javascript
function reverse() { /* jshint validthis:true */ var _ = this._sortedArray, reversed = _.reversed; if (reversed) { this.comparator = this.comparator.original; } else { this.comparator = getInversionOf(this.comparator); } _.reversed = !reversed; _.reverse.call(this);...
[ "function", "reverse", "(", ")", "{", "/* jshint validthis:true */", "var", "_", "=", "this", ".", "_sortedArray", ",", "reversed", "=", "_", ".", "reversed", ";", "if", "(", "reversed", ")", "{", "this", ".", "comparator", "=", "this", ".", "comparator", ...
Works like Array.prototype.reverse. Please note that this function wraps the current arr.comparator in order to invert the result. Reverting it back removes the wrapper. Same signature as Array.prototype.reverse @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse
[ "Works", "like", "Array", ".", "prototype", ".", "reverse", "." ]
59d58fd3b94d26c873c2a4ba2ecd18758309bd0b
https://github.com/peerigon/alamid-sorted-array/blob/59d58fd3b94d26c873c2a4ba2ecd18758309bd0b/lib/sortedArray.js#L167-L180