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
38,200
amida-tech/blue-button-cms
lib/cmsTxtToIntObj.js
getSectionBody
function getSectionBody(sectionString) { /*first, use regular expressions to parse the section body into different objects */ var sectionBody = {}; var sectionBodyData = []; var objectFromBodyRegExp = /-*(\n){2,}(?!-{4,})[\S\s,]+?((?=((\n){3,}?))|\n\n$)/gi; //or go to the end of the string. va...
javascript
function getSectionBody(sectionString) { /*first, use regular expressions to parse the section body into different objects */ var sectionBody = {}; var sectionBodyData = []; var objectFromBodyRegExp = /-*(\n){2,}(?!-{4,})[\S\s,]+?((?=((\n){3,}?))|\n\n$)/gi; //or go to the end of the string. va...
[ "function", "getSectionBody", "(", "sectionString", ")", "{", "/*first, use regular expressions to parse the section body into different\n objects */", "var", "sectionBody", "=", "{", "}", ";", "var", "sectionBodyData", "=", "[", "]", ";", "var", "objectFromBodyRegExp", "=...
parses the section body into an object
[ "parses", "the", "section", "body", "into", "an", "object" ]
749b8cf071910b22f8176a9ed8fc3b05062e1aad
https://github.com/amida-tech/blue-button-cms/blob/749b8cf071910b22f8176a9ed8fc3b05062e1aad/lib/cmsTxtToIntObj.js#L266-L290
38,201
amida-tech/blue-button-cms
lib/cmsTxtToIntObj.js
getMetaBody
function getMetaBody(sectionString) { var sectionBody = {}; var sectionBodyObj = {}; var metaBodyCode = /-{2,}((\n*?\*{3,}[\S\s]+\*{3,})|(\n{2,}))[\S\s]+?\n{3,}/gi; var objectStrings = sectionString.match(metaBodyCode); for (var obj = 0; obj < objectStrings.length; obj++) { var sectionChild ...
javascript
function getMetaBody(sectionString) { var sectionBody = {}; var sectionBodyObj = {}; var metaBodyCode = /-{2,}((\n*?\*{3,}[\S\s]+\*{3,})|(\n{2,}))[\S\s]+?\n{3,}/gi; var objectStrings = sectionString.match(metaBodyCode); for (var obj = 0; obj < objectStrings.length; obj++) { var sectionChild ...
[ "function", "getMetaBody", "(", "sectionString", ")", "{", "var", "sectionBody", "=", "{", "}", ";", "var", "sectionBodyObj", "=", "{", "}", ";", "var", "metaBodyCode", "=", "/", "-{2,}((\\n*?\\*{3,}[\\S\\s]+\\*{3,})|(\\n{2,}))[\\S\\s]+?\\n{3,}", "/", "gi", ";", "...
functions for specific meta characters
[ "functions", "for", "specific", "meta", "characters" ]
749b8cf071910b22f8176a9ed8fc3b05062e1aad
https://github.com/amida-tech/blue-button-cms/blob/749b8cf071910b22f8176a9ed8fc3b05062e1aad/lib/cmsTxtToIntObj.js#L394-L414
38,202
amida-tech/blue-button-cms
lib/cmsTxtToIntObj.js
convertToObject
function convertToObject(sectionString) { var sectionObj = {}; //get the section title(get it raw, clean it) var sectionTitleRegExp = /(-){3,}([\S\s]+?)(-){3,}/; var sectionRawTitle = sectionString.match(sectionTitleRegExp)[0]; var sectionTitle = cleanUpTitle(sectionRawTitle).toLowerCase(); //...
javascript
function convertToObject(sectionString) { var sectionObj = {}; //get the section title(get it raw, clean it) var sectionTitleRegExp = /(-){3,}([\S\s]+?)(-){3,}/; var sectionRawTitle = sectionString.match(sectionTitleRegExp)[0]; var sectionTitle = cleanUpTitle(sectionRawTitle).toLowerCase(); //...
[ "function", "convertToObject", "(", "sectionString", ")", "{", "var", "sectionObj", "=", "{", "}", ";", "//get the section title(get it raw, clean it)", "var", "sectionTitleRegExp", "=", "/", "(-){3,}([\\S\\s]+?)(-){3,}", "/", ";", "var", "sectionRawTitle", "=", "sectio...
converts each section to an object representation
[ "converts", "each", "section", "to", "an", "object", "representation" ]
749b8cf071910b22f8176a9ed8fc3b05062e1aad
https://github.com/amida-tech/blue-button-cms/blob/749b8cf071910b22f8176a9ed8fc3b05062e1aad/lib/cmsTxtToIntObj.js#L418-L443
38,203
amida-tech/blue-button-cms
lib/cmsTxtToIntObj.js
getTitles
function getTitles(fileString) { var headerMatchCode = '(-){4,}[\\S\\s]+?(\\n){2,}(-){4,}'; var headerRegExp = new RegExp(headerMatchCode, 'gi'); var rawTitleArray = fileString.match(headerRegExp); var titleArray = []; if (rawTitleArray === null) { return null; } for (var i = 0, len ...
javascript
function getTitles(fileString) { var headerMatchCode = '(-){4,}[\\S\\s]+?(\\n){2,}(-){4,}'; var headerRegExp = new RegExp(headerMatchCode, 'gi'); var rawTitleArray = fileString.match(headerRegExp); var titleArray = []; if (rawTitleArray === null) { return null; } for (var i = 0, len ...
[ "function", "getTitles", "(", "fileString", ")", "{", "var", "headerMatchCode", "=", "'(-){4,}[\\\\S\\\\s]+?(\\\\n){2,}(-){4,}'", ";", "var", "headerRegExp", "=", "new", "RegExp", "(", "headerMatchCode", ",", "'gi'", ")", ";", "var", "rawTitleArray", "=", "fileStrin...
Gets all section titles given the entire data file string
[ "Gets", "all", "section", "titles", "given", "the", "entire", "data", "file", "string" ]
749b8cf071910b22f8176a9ed8fc3b05062e1aad
https://github.com/amida-tech/blue-button-cms/blob/749b8cf071910b22f8176a9ed8fc3b05062e1aad/lib/cmsTxtToIntObj.js#L464-L481
38,204
akoenig/kast
lib/socket.js
Socket
function Socket (options) { this.$ipaddress = ip.address(); this.$port = options.port; this.$host = options.host || '224.1.1.1'; this.$ttl = options.ttl || 128; this.$dispatcher = options.dispatcher; // // The native socket implementation. // Will be filled on opening the socket. /...
javascript
function Socket (options) { this.$ipaddress = ip.address(); this.$port = options.port; this.$host = options.host || '224.1.1.1'; this.$ttl = options.ttl || 128; this.$dispatcher = options.dispatcher; // // The native socket implementation. // Will be filled on opening the socket. /...
[ "function", "Socket", "(", "options", ")", "{", "this", ".", "$ipaddress", "=", "ip", ".", "address", "(", ")", ";", "this", ".", "$port", "=", "options", ".", "port", ";", "this", ".", "$host", "=", "options", ".", "host", "||", "'224.1.1.1'", ";", ...
Wrapper around the socket implementation of Node.js with some proxy functionality for incoming messages. @param {object} options A configuration object Should have the following structure: `port`: The respective port on which the multicast socket should be opened. `host`: The multicast ip address (optional; default: ...
[ "Wrapper", "around", "the", "socket", "implementation", "of", "Node", ".", "js", "with", "some", "proxy", "functionality", "for", "incoming", "messages", "." ]
c7be9d728ca499c728a4c7258fa7901ac7948831
https://github.com/akoenig/kast/blob/c7be9d728ca499c728a4c7258fa7901ac7948831/lib/socket.js#L48-L61
38,205
crysalead-js/dom-layer
src/node/patcher/style.js
patch
function patch(element, previous, style) { if (!previous && !style) { return style; } var rule; if (typeof style === 'object') { if (typeof previous === 'object') { for (rule in previous) { if (!style[rule]) { domElementCss(element, rule, null); } } domElement...
javascript
function patch(element, previous, style) { if (!previous && !style) { return style; } var rule; if (typeof style === 'object') { if (typeof previous === 'object') { for (rule in previous) { if (!style[rule]) { domElementCss(element, rule, null); } } domElement...
[ "function", "patch", "(", "element", ",", "previous", ",", "style", ")", "{", "if", "(", "!", "previous", "&&", "!", "style", ")", "{", "return", "style", ";", "}", "var", "rule", ";", "if", "(", "typeof", "style", "===", "'object'", ")", "{", "if"...
Maintains state of element style attribute. @param Object element A DOM element. @param Object previous The previous state of style attributes. @param Object style The style attributes to match on.
[ "Maintains", "state", "of", "element", "style", "attribute", "." ]
0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2
https://github.com/crysalead-js/dom-layer/blob/0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2/src/node/patcher/style.js#L10-L32
38,206
crysalead-js/dom-layer
src/node/patcher/props.js
patch
function patch(element, previous, props) { if (!previous && !props) { return props; } var name, value; previous = previous || {}; props = props || {}; for (name in previous) { if (previous[name] === undefined || props[name] !== undefined) { continue; } unset(name, element, previous); ...
javascript
function patch(element, previous, props) { if (!previous && !props) { return props; } var name, value; previous = previous || {}; props = props || {}; for (name in previous) { if (previous[name] === undefined || props[name] !== undefined) { continue; } unset(name, element, previous); ...
[ "function", "patch", "(", "element", ",", "previous", ",", "props", ")", "{", "if", "(", "!", "previous", "&&", "!", "props", ")", "{", "return", "props", ";", "}", "var", "name", ",", "value", ";", "previous", "=", "previous", "||", "{", "}", ";",...
Maintains state of element properties. @param Object element A DOM element. @param Object previous The previous state of properties. @param Object props The properties to match on. @return Object props The element properties state.
[ "Maintains", "state", "of", "element", "properties", "." ]
0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2
https://github.com/crysalead-js/dom-layer/blob/0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2/src/node/patcher/props.js#L12-L30
38,207
crysalead-js/dom-layer
src/node/patcher/props.js
set
function set(name, element, previous, props) { if (set.handlers[name]) { set.handlers[name](name, element, previous, props); } else if (previous[name] !== props[name]) { element[name] = props[name]; } }
javascript
function set(name, element, previous, props) { if (set.handlers[name]) { set.handlers[name](name, element, previous, props); } else if (previous[name] !== props[name]) { element[name] = props[name]; } }
[ "function", "set", "(", "name", ",", "element", ",", "previous", ",", "props", ")", "{", "if", "(", "set", ".", "handlers", "[", "name", "]", ")", "{", "set", ".", "handlers", "[", "name", "]", "(", "name", ",", "element", ",", "previous", ",", "...
Sets a property. @param String name The property name to set. @param Object element A DOM element. @param Object previous The previous state of properties. @param Object props The properties to match on.
[ "Sets", "a", "property", "." ]
0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2
https://github.com/crysalead-js/dom-layer/blob/0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2/src/node/patcher/props.js#L40-L46
38,208
crysalead-js/dom-layer
src/node/patcher/props.js
unset
function unset(name, element, previous) { if (unset.handlers[name]) { unset.handlers[name](name, element, previous); } else { element[name] = null; } }
javascript
function unset(name, element, previous) { if (unset.handlers[name]) { unset.handlers[name](name, element, previous); } else { element[name] = null; } }
[ "function", "unset", "(", "name", ",", "element", ",", "previous", ")", "{", "if", "(", "unset", ".", "handlers", "[", "name", "]", ")", "{", "unset", ".", "handlers", "[", "name", "]", "(", "name", ",", "element", ",", "previous", ")", ";", "}", ...
Unsets a property. @param String name The property name to unset. @param Object element A DOM element. @param Object previous The previous state of properties.
[ "Unsets", "a", "property", "." ]
0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2
https://github.com/crysalead-js/dom-layer/blob/0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2/src/node/patcher/props.js#L56-L62
38,209
seancheung/kuconfig
lib/conditional.js
$cond
function $cond(params) { if ( Array.isArray(params) && params.length === 3 && typeof params[0] === 'boolean' ) { return params[0] ? params[1] : params[2]; } throw new Error( '$cond expects an array of three elements of which the first must be a boolean' ); }
javascript
function $cond(params) { if ( Array.isArray(params) && params.length === 3 && typeof params[0] === 'boolean' ) { return params[0] ? params[1] : params[2]; } throw new Error( '$cond expects an array of three elements of which the first must be a boolean' ); }
[ "function", "$cond", "(", "params", ")", "{", "if", "(", "Array", ".", "isArray", "(", "params", ")", "&&", "params", ".", "length", "===", "3", "&&", "typeof", "params", "[", "0", "]", "===", "'boolean'", ")", "{", "return", "params", "[", "0", "]...
Return the second or third element based on the boolean value of the first element @param {[boolean, any, any]} params @returns {any}
[ "Return", "the", "second", "or", "third", "element", "based", "on", "the", "boolean", "value", "of", "the", "first", "element" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/conditional.js#L7-L18
38,210
crysalead-js/dom-layer
src/tree/tree.js
broadcastInserted
function broadcastInserted(node) { if (node.hooks && node.hooks.inserted) { return node.hooks.inserted(node, node.element); } if (node.children) { for (var i = 0, len = node.children.length; i < len; i++) { if (node.children[i]) { broadcastInserted(node.children[i]); } } } }
javascript
function broadcastInserted(node) { if (node.hooks && node.hooks.inserted) { return node.hooks.inserted(node, node.element); } if (node.children) { for (var i = 0, len = node.children.length; i < len; i++) { if (node.children[i]) { broadcastInserted(node.children[i]); } } } }
[ "function", "broadcastInserted", "(", "node", ")", "{", "if", "(", "node", ".", "hooks", "&&", "node", ".", "hooks", ".", "inserted", ")", "{", "return", "node", ".", "hooks", ".", "inserted", "(", "node", ",", "node", ".", "element", ")", ";", "}", ...
Broadcasts the inserted 'event'.
[ "Broadcasts", "the", "inserted", "event", "." ]
0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2
https://github.com/crysalead-js/dom-layer/blob/0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2/src/tree/tree.js#L15-L26
38,211
charto/charto
bundler/publish.js
walk
function walk(dir, before, after, handler, name = null, depth = 0) { const listed = fs.readdirAsync( dir ).then((list) => Promise.map(list, (item) => { const child = path.resolve(dir, item); const result = fs.lstatAsync( child ).then((stat) => ({ path: child, name: item, isFile: stat.isFile(), ...
javascript
function walk(dir, before, after, handler, name = null, depth = 0) { const listed = fs.readdirAsync( dir ).then((list) => Promise.map(list, (item) => { const child = path.resolve(dir, item); const result = fs.lstatAsync( child ).then((stat) => ({ path: child, name: item, isFile: stat.isFile(), ...
[ "function", "walk", "(", "dir", ",", "before", ",", "after", ",", "handler", ",", "name", "=", "null", ",", "depth", "=", "0", ")", "{", "const", "listed", "=", "fs", ".", "readdirAsync", "(", "dir", ")", ".", "then", "(", "(", "list", ")", "=>",...
Recursively walk a directory tree. @param dir Path to root of tree to explore. @param before Function called with contents of each directory, before entering subdirectories. Directories have an enterDir flag set and clearing it prevents recursing inside. @param after Function called for each directory after exploring s...
[ "Recursively", "walk", "a", "directory", "tree", "." ]
bbdb49b8a5a3f5a7a715d2f7219df667e6062b39
https://github.com/charto/charto/blob/bbdb49b8a5a3f5a7a715d2f7219df667e6062b39/bundler/publish.js#L29-L60
38,212
charto/charto
bundler/publish.js
filterChildren
function filterChildren(children, depth) { if(depth == 1) { let found = false; for(let item of children) { if(item.name == 'package.json') found = true; if(item.name != 'src') item.enterDir = false; } if(!found) throw(new Error()); } return(children); }
javascript
function filterChildren(children, depth) { if(depth == 1) { let found = false; for(let item of children) { if(item.name == 'package.json') found = true; if(item.name != 'src') item.enterDir = false; } if(!found) throw(new Error()); } return(children); }
[ "function", "filterChildren", "(", "children", ",", "depth", ")", "{", "if", "(", "depth", "==", "1", ")", "{", "let", "found", "=", "false", ";", "for", "(", "let", "item", "of", "children", ")", "{", "if", "(", "item", ".", "name", "==", "'packag...
Detect NPM package root directories by presence of a package.json file. Only enter a subdirectory called "src". Usable as a "before" callback for the walk function. @return Filtered list of directory contents.
[ "Detect", "NPM", "package", "root", "directories", "by", "presence", "of", "a", "package", ".", "json", "file", ".", "Only", "enter", "a", "subdirectory", "called", "src", ".", "Usable", "as", "a", "before", "callback", "for", "the", "walk", "function", "....
bbdb49b8a5a3f5a7a715d2f7219df667e6062b39
https://github.com/charto/charto/blob/bbdb49b8a5a3f5a7a715d2f7219df667e6062b39/bundler/publish.js#L67-L80
38,213
maichong/number-random
index.js
random
function random(min, max, float) { if (min === undefined) { return Math.random(); } if (max === undefined) { max = min; min = 0; } if (max < min) { var tmp = max; max = min; min = tmp; } if (float) { var result = Math.random() * (max - min) + min; if (float === true) { ...
javascript
function random(min, max, float) { if (min === undefined) { return Math.random(); } if (max === undefined) { max = min; min = 0; } if (max < min) { var tmp = max; max = min; min = tmp; } if (float) { var result = Math.random() * (max - min) + min; if (float === true) { ...
[ "function", "random", "(", "min", ",", "max", ",", "float", ")", "{", "if", "(", "min", "===", "undefined", ")", "{", "return", "Math", ".", "random", "(", ")", ";", "}", "if", "(", "max", "===", "undefined", ")", "{", "max", "=", "min", ";", "...
Generate random number in a range @param {number} min @param {number} max [optional] @param {number|boolean} float [optional] default false @returns {number}
[ "Generate", "random", "number", "in", "a", "range" ]
246a9dc8d9d14263f9dda38e1a7227581ee24917
https://github.com/maichong/number-random/blob/246a9dc8d9d14263f9dda38e1a7227581ee24917/index.js#L8-L40
38,214
base/base-npm
index.js
checkName
function checkName(name, cb) { request(`https://registry.npmjs.org/${name}/latest`, {}, function(err, res, msg) { if (err) return cb(err); if (typeof msg === 'string' && msg === 'Package not found') { cb(null, false); return; } if (res && res.statusCode === 404) { return cb(null, f...
javascript
function checkName(name, cb) { request(`https://registry.npmjs.org/${name}/latest`, {}, function(err, res, msg) { if (err) return cb(err); if (typeof msg === 'string' && msg === 'Package not found') { cb(null, false); return; } if (res && res.statusCode === 404) { return cb(null, f...
[ "function", "checkName", "(", "name", ",", "cb", ")", "{", "request", "(", "`", "${", "name", "}", "`", ",", "{", "}", ",", "function", "(", "err", ",", "res", ",", "msg", ")", "{", "if", "(", "err", ")", "return", "cb", "(", "err", ")", ";",...
Check if a name exists on npm. ```js checkName('foo', function(err, exists) { if (err) throw err; console.log(exists); }); //=> true ``` @param {String} `name` Name of module to check. @param {Function} `cb` Callback function
[ "Check", "if", "a", "name", "exists", "on", "npm", "." ]
c08b0760b40a1d2db05bef091e37ad1425933a91
https://github.com/base/base-npm/blob/c08b0760b40a1d2db05bef091e37ad1425933a91/index.js#L277-L292
38,215
edjafarov/PromisePipe
example/auction/src/client.js
upTo
function upTo(el, tagName) { tagName = tagName.toLowerCase(); while (el && el.parentNode) { el = el.parentNode; if (el.tagName && el.tagName.toLowerCase() == tagName) { return el; } } // Many DOM methods return null if they don't // find the element they are searching for // It would be O...
javascript
function upTo(el, tagName) { tagName = tagName.toLowerCase(); while (el && el.parentNode) { el = el.parentNode; if (el.tagName && el.tagName.toLowerCase() == tagName) { return el; } } // Many DOM methods return null if they don't // find the element they are searching for // It would be O...
[ "function", "upTo", "(", "el", ",", "tagName", ")", "{", "tagName", "=", "tagName", ".", "toLowerCase", "(", ")", ";", "while", "(", "el", "&&", "el", ".", "parentNode", ")", "{", "el", "=", "el", ".", "parentNode", ";", "if", "(", "el", ".", "ta...
Find first ancestor of el with tagName or undefined if not found
[ "Find", "first", "ancestor", "of", "el", "with", "tagName", "or", "undefined", "if", "not", "found" ]
ec37d5eaab57feadc2e1f5a9f9e7306e32565143
https://github.com/edjafarov/PromisePipe/blob/ec37d5eaab57feadc2e1f5a9f9e7306e32565143/example/auction/src/client.js#L55-L69
38,216
switer/Zect
lib/zect.js
getComponent
function getComponent(tn) { var cid = tn.toLowerCase() var compDef components.some(function (comp) { if (comp.hasOwnProperty(cid)) { compDef = comp[cid] return true } }) return compDef }
javascript
function getComponent(tn) { var cid = tn.toLowerCase() var compDef components.some(function (comp) { if (comp.hasOwnProperty(cid)) { compDef = comp[cid] return true } }) return compDef }
[ "function", "getComponent", "(", "tn", ")", "{", "var", "cid", "=", "tn", ".", "toLowerCase", "(", ")", "var", "compDef", "components", ".", "some", "(", "function", "(", "comp", ")", "{", "if", "(", "comp", ".", "hasOwnProperty", "(", "cid", ")", ")...
Reverse component Constructor by tagName
[ "Reverse", "component", "Constructor", "by", "tagName" ]
88b92d62d5000d999c3043e6379790f79608bdfa
https://github.com/switer/Zect/blob/88b92d62d5000d999c3043e6379790f79608bdfa/lib/zect.js#L399-L409
38,217
switer/Zect
lib/zect.js
compileElement
function compileElement(node, scope, isRoot) { var tagName = node.tagName var inst switch(true) { /** * <*-if></*-if> */ case is.IfElement(tagName): var children = _slice(node.children) var exprs = [$(node).attr('...
javascript
function compileElement(node, scope, isRoot) { var tagName = node.tagName var inst switch(true) { /** * <*-if></*-if> */ case is.IfElement(tagName): var children = _slice(node.children) var exprs = [$(node).attr('...
[ "function", "compileElement", "(", "node", ",", "scope", ",", "isRoot", ")", "{", "var", "tagName", "=", "node", ".", "tagName", "var", "inst", "switch", "(", "true", ")", "{", "/**\n * <*-if></*-if>\n */", "case", "is", ".", "IfElement"...
Compile element for block syntax handling
[ "Compile", "element", "for", "block", "syntax", "handling" ]
88b92d62d5000d999c3043e6379790f79608bdfa
https://github.com/switer/Zect/blob/88b92d62d5000d999c3043e6379790f79608bdfa/lib/zect.js#L413-L463
38,218
switer/Zect
lib/zect.js
compileDirective
function compileDirective (node, scope) { var ast = { attrs: {}, dires: {} } var dirtDefs = _getAllDirts() /** * attributes walk */ _slice(node.attributes).forEach(function(att) { var aname = att.name ...
javascript
function compileDirective (node, scope) { var ast = { attrs: {}, dires: {} } var dirtDefs = _getAllDirts() /** * attributes walk */ _slice(node.attributes).forEach(function(att) { var aname = att.name ...
[ "function", "compileDirective", "(", "node", ",", "scope", ")", "{", "var", "ast", "=", "{", "attrs", ":", "{", "}", ",", "dires", ":", "{", "}", "}", "var", "dirtDefs", "=", "_getAllDirts", "(", ")", "/**\n * attributes walk\n */", "_slice"...
Compile attributes to directive
[ "Compile", "attributes", "to", "directive" ]
88b92d62d5000d999c3043e6379790f79608bdfa
https://github.com/switer/Zect/blob/88b92d62d5000d999c3043e6379790f79608bdfa/lib/zect.js#L587-L660
38,219
bodyno/nunjucks-volt
src/parser.js
function(){ var node = this.parseAdd(); while(this.skipValue(lexer.TOKEN_TILDE, '~')) { var node2 = this.parseAdd(); node = new nodes.Concat(node.lineno, node.colno, node, node2); ...
javascript
function(){ var node = this.parseAdd(); while(this.skipValue(lexer.TOKEN_TILDE, '~')) { var node2 = this.parseAdd(); node = new nodes.Concat(node.lineno, node.colno, node, node2); ...
[ "function", "(", ")", "{", "var", "node", "=", "this", ".", "parseAdd", "(", ")", ";", "while", "(", "this", ".", "skipValue", "(", "lexer", ".", "TOKEN_TILDE", ",", "'~'", ")", ")", "{", "var", "node2", "=", "this", ".", "parseAdd", "(", ")", ";...
finds the '~' for string concatenation
[ "finds", "the", "~", "for", "string", "concatenation" ]
a7c0908bf98acc2af497069d7d2701bb880d3323
https://github.com/bodyno/nunjucks-volt/blob/a7c0908bf98acc2af497069d7d2701bb880d3323/src/parser.js#L797-L807
38,220
billstron/passwordless-mysql
lib/mysql-store.js
Store
function Store(conString, options) { var self = this; this._table = "passwordless"; this._client = mysql.createPool(conString); this._client.query("CREATE TABLE IF NOT EXISTS " + this._table + " " + "( id serial NOT NULL, uid character varying(160), token character varying(60) NOT NULL, origin text, ttl bi...
javascript
function Store(conString, options) { var self = this; this._table = "passwordless"; this._client = mysql.createPool(conString); this._client.query("CREATE TABLE IF NOT EXISTS " + this._table + " " + "( id serial NOT NULL, uid character varying(160), token character varying(60) NOT NULL, origin text, ttl bi...
[ "function", "Store", "(", "conString", ",", "options", ")", "{", "var", "self", "=", "this", ";", "this", ".", "_table", "=", "\"passwordless\"", ";", "this", ".", "_client", "=", "mysql", ".", "createPool", "(", "conString", ")", ";", "this", ".", "_c...
Constructor of Store @param {String} conString URI as defined by the MySQL specification. @param {Object} [options] Combines both the options for the MySQL Client as well as the options for Store. For the MySQL Client options please refer back to the documentation. @constructor
[ "Constructor", "of", "Store" ]
d298078977dffc997c9cb96342bdf7304b1f23d1
https://github.com/billstron/passwordless-mysql/blob/d298078977dffc997c9cb96342bdf7304b1f23d1/lib/mysql-store.js#L14-L21
38,221
seancheung/kuconfig
lib/object.js
$merge
function $merge(params, fn) { if ( Array.isArray(params) && params.length === 2 && params.every(p => typeof p === 'object') ) { return fn.merge(params[0], params[1]); } throw new Error('$merge expects an array of two objects'); }
javascript
function $merge(params, fn) { if ( Array.isArray(params) && params.length === 2 && params.every(p => typeof p === 'object') ) { return fn.merge(params[0], params[1]); } throw new Error('$merge expects an array of two objects'); }
[ "function", "$merge", "(", "params", ",", "fn", ")", "{", "if", "(", "Array", ".", "isArray", "(", "params", ")", "&&", "params", ".", "length", "===", "2", "&&", "params", ".", "every", "(", "p", "=>", "typeof", "p", "===", "'object'", ")", ")", ...
Return the merge of two objects @param {[any, any]} params @returns {any}
[ "Return", "the", "merge", "of", "two", "objects" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/object.js#L7-L16
38,222
seancheung/kuconfig
lib/object.js
$keys
function $keys(params) { if (params == null) { return params; } if (params != null && typeof params === 'object') { return Object.keys(params); } throw new Error('$keys expects object'); }
javascript
function $keys(params) { if (params == null) { return params; } if (params != null && typeof params === 'object') { return Object.keys(params); } throw new Error('$keys expects object'); }
[ "function", "$keys", "(", "params", ")", "{", "if", "(", "params", "==", "null", ")", "{", "return", "params", ";", "}", "if", "(", "params", "!=", "null", "&&", "typeof", "params", "===", "'object'", ")", "{", "return", "Object", ".", "keys", "(", ...
Return the keys of an object @param {any} params @returns {string[]}
[ "Return", "the", "keys", "of", "an", "object" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/object.js#L24-L32
38,223
seancheung/kuconfig
lib/object.js
$vals
function $vals(params) { if (params == null) { return params; } if (params != null && typeof params === 'object') { return Object.keys(params).map(k => params[k]); } throw new Error('$vals expects object'); }
javascript
function $vals(params) { if (params == null) { return params; } if (params != null && typeof params === 'object') { return Object.keys(params).map(k => params[k]); } throw new Error('$vals expects object'); }
[ "function", "$vals", "(", "params", ")", "{", "if", "(", "params", "==", "null", ")", "{", "return", "params", ";", "}", "if", "(", "params", "!=", "null", "&&", "typeof", "params", "===", "'object'", ")", "{", "return", "Object", ".", "keys", "(", ...
Return the values of an object @param {any} params @returns {any[]}
[ "Return", "the", "values", "of", "an", "object" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/object.js#L40-L48
38,224
seancheung/kuconfig
lib/object.js
$zip
function $zip(params) { if ( Array.isArray(params) && params.every(p => Array.isArray(p) && p.length === 2) ) { return params.reduce((o, p) => Object.assign(o, { [p[0]]: p[1] }), {}); } throw new Error('$zip expects an array of two-element-array'); }
javascript
function $zip(params) { if ( Array.isArray(params) && params.every(p => Array.isArray(p) && p.length === 2) ) { return params.reduce((o, p) => Object.assign(o, { [p[0]]: p[1] }), {}); } throw new Error('$zip expects an array of two-element-array'); }
[ "function", "$zip", "(", "params", ")", "{", "if", "(", "Array", ".", "isArray", "(", "params", ")", "&&", "params", ".", "every", "(", "p", "=>", "Array", ".", "isArray", "(", "p", ")", "&&", "p", ".", "length", "===", "2", ")", ")", "{", "ret...
Merge a series of key-value pairs into an object @param {[any, any][]} params @returns {any}
[ "Merge", "a", "series", "of", "key", "-", "value", "pairs", "into", "an", "object" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/object.js#L56-L64
38,225
nknapp/thought
lib/utils/resolve-package-root.js
resolvePackageRoot
function resolvePackageRoot (file) { try { const fullPath = path.resolve(file) for (let lead = fullPath; path.dirname(lead) !== lead; lead = path.dirname(lead)) { debug('Looking for package.json in ' + lead) let packagePath = path.join(lead, 'package.json') try { if (fs.statSync(pack...
javascript
function resolvePackageRoot (file) { try { const fullPath = path.resolve(file) for (let lead = fullPath; path.dirname(lead) !== lead; lead = path.dirname(lead)) { debug('Looking for package.json in ' + lead) let packagePath = path.join(lead, 'package.json') try { if (fs.statSync(pack...
[ "function", "resolvePackageRoot", "(", "file", ")", "{", "try", "{", "const", "fullPath", "=", "path", ".", "resolve", "(", "file", ")", "for", "(", "let", "lead", "=", "fullPath", ";", "path", ".", "dirname", "(", "lead", ")", "!==", "lead", ";", "l...
Find the `package.json` by walking up from a given file. The result contains the following properties * **packageRoot**: The base-directory of the package containing the file (i.e. the parent of the `package.json` * **relativeFile**: The path of "file" relative to the packageRoot * **packageJson**: The required packag...
[ "Find", "the", "package", ".", "json", "by", "walking", "up", "from", "a", "given", "file", ".", "The", "result", "contains", "the", "following", "properties" ]
2ae991f2d3065ff4eae4df544d20787b07be5116
https://github.com/nknapp/thought/blob/2ae991f2d3065ff4eae4df544d20787b07be5116/lib/utils/resolve-package-root.js#L18-L50
38,226
tarquas/mongoose-hook
lib/v0/mongoose-hook.js
function(pluginIdx) { if (pluginIdx >= plugins.length) return callback(hooks.collectionHook); var plugin = plugins[pluginIdx]; var next = function() {iterPlugins(pluginIdx + 1);}; var func = plugin[stage]; // call the plugin's stage hook, if defined if (func) { // T is database operation...
javascript
function(pluginIdx) { if (pluginIdx >= plugins.length) return callback(hooks.collectionHook); var plugin = plugins[pluginIdx]; var next = function() {iterPlugins(pluginIdx + 1);}; var func = plugin[stage]; // call the plugin's stage hook, if defined if (func) { // T is database operation...
[ "function", "(", "pluginIdx", ")", "{", "if", "(", "pluginIdx", ">=", "plugins", ".", "length", ")", "return", "callback", "(", "hooks", ".", "collectionHook", ")", ";", "var", "plugin", "=", "plugins", "[", "pluginIdx", "]", ";", "var", "next", "=", "...
iterate through the hook-based plugins
[ "iterate", "through", "the", "hook", "-", "based", "plugins" ]
f9bf74886fe0145efaa5a3591deeae3163e116b7
https://github.com/tarquas/mongoose-hook/blob/f9bf74886fe0145efaa5a3591deeae3163e116b7/lib/v0/mongoose-hook.js#L146-L158
38,227
nknapp/thought
handlebars/helpers/index.js
include
function include (filename, language) { return fs.readFile(filename, 'utf-8').then(function (contents) { return '```' + (typeof language === 'string' ? language : path.extname(filename).substr(1)) + '\n' + contents + '\n```\n' }) }
javascript
function include (filename, language) { return fs.readFile(filename, 'utf-8').then(function (contents) { return '```' + (typeof language === 'string' ? language : path.extname(filename).substr(1)) + '\n' + contents + '\n```\n' }) }
[ "function", "include", "(", "filename", ",", "language", ")", "{", "return", "fs", ".", "readFile", "(", "filename", ",", "'utf-8'", ")", ".", "then", "(", "function", "(", "contents", ")", "{", "return", "'```'", "+", "(", "typeof", "language", "===", ...
Include a file into a markdown code-block @param filename @param language the programming language used for the code-block @returns {string} @access public @memberOf helpers
[ "Include", "a", "file", "into", "a", "markdown", "code", "-", "block" ]
2ae991f2d3065ff4eae4df544d20787b07be5116
https://github.com/nknapp/thought/blob/2ae991f2d3065ff4eae4df544d20787b07be5116/handlebars/helpers/index.js#L59-L67
38,228
nknapp/thought
handlebars/helpers/index.js
exec
function exec (command, options) { let start let end const lang = options.hash && options.hash.lang switch (lang) { case 'raw': start = end = '' break case 'inline': start = end = '`' break default: const fenceLanguage = lang || '' start = '```' + fenceLanguage + ...
javascript
function exec (command, options) { let start let end const lang = options.hash && options.hash.lang switch (lang) { case 'raw': start = end = '' break case 'inline': start = end = '`' break default: const fenceLanguage = lang || '' start = '```' + fenceLanguage + ...
[ "function", "exec", "(", "command", ",", "options", ")", "{", "let", "start", "let", "end", "const", "lang", "=", "options", ".", "hash", "&&", "options", ".", "hash", ".", "lang", "switch", "(", "lang", ")", "{", "case", "'raw'", ":", "start", "=", ...
Execute a command and include the output in a fenced code-block. @param {string} command the command, passed to `child-process#execSync()` @param {object} options optional arguments and Handlebars internal args. @param {string} options.hash.lang the language tag that should be attached to the fence (like `js` or `bash...
[ "Execute", "a", "command", "and", "include", "the", "output", "in", "a", "fenced", "code", "-", "block", "." ]
2ae991f2d3065ff4eae4df544d20787b07be5116
https://github.com/nknapp/thought/blob/2ae991f2d3065ff4eae4df544d20787b07be5116/handlebars/helpers/index.js#L147-L168
38,229
nknapp/thought
handlebars/helpers/index.js
renderTree
function renderTree (object, options) { const tree = require('archy')(transformTree(object, options.fn)) return '<pre><code>\n' + tree + '</code></pre>' }
javascript
function renderTree (object, options) { const tree = require('archy')(transformTree(object, options.fn)) return '<pre><code>\n' + tree + '</code></pre>' }
[ "function", "renderTree", "(", "object", ",", "options", ")", "{", "const", "tree", "=", "require", "(", "'archy'", ")", "(", "transformTree", "(", "object", ",", "options", ".", "fn", ")", ")", "return", "'<pre><code>\\n'", "+", "tree", "+", "'</code></pr...
Render an object hierarchy. The expected input is of the form ``` { prop1: 'value', prop2: 'value', ..., children: [ { prop1: 'value', propt2: 'value', ..., children: ... } ] } ``` The tree is transformed and rendered using [archy](https://www.npmjs.com/package/archy) @param object @param options @param {function} ...
[ "Render", "an", "object", "hierarchy", "." ]
2ae991f2d3065ff4eae4df544d20787b07be5116
https://github.com/nknapp/thought/blob/2ae991f2d3065ff4eae4df544d20787b07be5116/handlebars/helpers/index.js#L200-L203
38,230
nknapp/thought
handlebars/helpers/index.js
transformTree
function transformTree (object, fn) { const label = fn(object).trim() if (object.children) { return { label: label, nodes: object.children.map(function (child) { return transformTree(child, fn) }) } } else { return label } }
javascript
function transformTree (object, fn) { const label = fn(object).trim() if (object.children) { return { label: label, nodes: object.children.map(function (child) { return transformTree(child, fn) }) } } else { return label } }
[ "function", "transformTree", "(", "object", ",", "fn", ")", "{", "const", "label", "=", "fn", "(", "object", ")", ".", "trim", "(", ")", "if", "(", "object", ".", "children", ")", "{", "return", "{", "label", ":", "label", ",", "nodes", ":", "objec...
Transfrom an object hierarchy into `archy`'s format Transform a tree-structure of the form ``` { prop1: 'value', prop2: 'value', ..., children: [ { prop1: 'value', propt2: 'value', ..., children: ... } ] } ``` Into an [archy](https://www.npmjs.com/package/archy)-compatible format, by passing each node to a block-helpe...
[ "Transfrom", "an", "object", "hierarchy", "into", "archy", "s", "format" ]
2ae991f2d3065ff4eae4df544d20787b07be5116
https://github.com/nknapp/thought/blob/2ae991f2d3065ff4eae4df544d20787b07be5116/handlebars/helpers/index.js#L384-L396
38,231
nknapp/thought
handlebars/helpers/index.js
repoWebUrl
function repoWebUrl (gitUrl) { if (!gitUrl) { return undefined } const orgRepo = _githubOrgRepo(gitUrl) if (orgRepo) { return 'https://github.com/' + orgRepo } else { return null } }
javascript
function repoWebUrl (gitUrl) { if (!gitUrl) { return undefined } const orgRepo = _githubOrgRepo(gitUrl) if (orgRepo) { return 'https://github.com/' + orgRepo } else { return null } }
[ "function", "repoWebUrl", "(", "gitUrl", ")", "{", "if", "(", "!", "gitUrl", ")", "{", "return", "undefined", "}", "const", "orgRepo", "=", "_githubOrgRepo", "(", "gitUrl", ")", "if", "(", "orgRepo", ")", "{", "return", "'https://github.com/'", "+", "orgRe...
Returns the http-url for viewing a git-repository in the browser given a repo-url from the package.json Currently, only github urls are supported @param {string} gitUrl the git url from the repository.url-property of package.json @access public @memberOf helpers
[ "Returns", "the", "http", "-", "url", "for", "viewing", "a", "git", "-", "repository", "in", "the", "browser", "given", "a", "repo", "-", "url", "from", "the", "package", ".", "json", "Currently", "only", "github", "urls", "are", "supported" ]
2ae991f2d3065ff4eae4df544d20787b07be5116
https://github.com/nknapp/thought/blob/2ae991f2d3065ff4eae4df544d20787b07be5116/handlebars/helpers/index.js#L421-L431
38,232
nknapp/thought
handlebars/helpers/index.js
regex
function regex (strings, ...args) { return String.raw(strings, ...args.map(_.escapeRegExp)) }
javascript
function regex (strings, ...args) { return String.raw(strings, ...args.map(_.escapeRegExp)) }
[ "function", "regex", "(", "strings", ",", "...", "args", ")", "{", "return", "String", ".", "raw", "(", "strings", ",", "...", "args", ".", "map", "(", "_", ".", "escapeRegExp", ")", ")", "}" ]
Helper function for composing template-literals to properly escaped regexes @param strings @param args @returns {string} @access private
[ "Helper", "function", "for", "composing", "template", "-", "literals", "to", "properly", "escaped", "regexes" ]
2ae991f2d3065ff4eae4df544d20787b07be5116
https://github.com/nknapp/thought/blob/2ae991f2d3065ff4eae4df544d20787b07be5116/handlebars/helpers/index.js#L462-L464
38,233
nknapp/thought
handlebars/helpers/index.js
_rawGithubUrl
function _rawGithubUrl (resolvedPackageRoot) { var { packageJson, relativeFile } = resolvedPackageRoot const orgRepo = _githubOrgRepo(packageJson && packageJson.repository && packageJson.repository.url) if (orgRepo) { return `https://raw.githubusercontent.com/${orgRepo}/v${packageJson.version}/${relativeFile}...
javascript
function _rawGithubUrl (resolvedPackageRoot) { var { packageJson, relativeFile } = resolvedPackageRoot const orgRepo = _githubOrgRepo(packageJson && packageJson.repository && packageJson.repository.url) if (orgRepo) { return `https://raw.githubusercontent.com/${orgRepo}/v${packageJson.version}/${relativeFile}...
[ "function", "_rawGithubUrl", "(", "resolvedPackageRoot", ")", "{", "var", "{", "packageJson", ",", "relativeFile", "}", "=", "resolvedPackageRoot", "const", "orgRepo", "=", "_githubOrgRepo", "(", "packageJson", "&&", "packageJson", ".", "repository", "&&", "packageJ...
Return the raw url of a file in a githb repository @private
[ "Return", "the", "raw", "url", "of", "a", "file", "in", "a", "githb", "repository" ]
2ae991f2d3065ff4eae4df544d20787b07be5116
https://github.com/nknapp/thought/blob/2ae991f2d3065ff4eae4df544d20787b07be5116/handlebars/helpers/index.js#L499-L505
38,234
solid/issue-pane
issuePane.js
function (subject) { var kb = UI.store var t = kb.findTypeURIs(subject) if (t['http://www.w3.org/2005/01/wf/flow#Task'] || kb.holds(subject, UI.ns.wf('tracker'))) return 'issue' // in case ontology not available if (t['http://www.w3.org/2005/01/wf/flow#Tracker']) return 'tracker' // Later: Per...
javascript
function (subject) { var kb = UI.store var t = kb.findTypeURIs(subject) if (t['http://www.w3.org/2005/01/wf/flow#Task'] || kb.holds(subject, UI.ns.wf('tracker'))) return 'issue' // in case ontology not available if (t['http://www.w3.org/2005/01/wf/flow#Tracker']) return 'tracker' // Later: Per...
[ "function", "(", "subject", ")", "{", "var", "kb", "=", "UI", ".", "store", "var", "t", "=", "kb", ".", "findTypeURIs", "(", "subject", ")", "if", "(", "t", "[", "'http://www.w3.org/2005/01/wf/flow#Task'", "]", "||", "kb", ".", "holds", "(", "subject", ...
Does the subject deserve an issue pane?
[ "Does", "the", "subject", "deserve", "an", "issue", "pane?" ]
e14bd32ec5629b6cd09899ab8c1e38989a3c8d58
https://github.com/solid/issue-pane/blob/e14bd32ec5629b6cd09899ab8c1e38989a3c8d58/issuePane.js#L25-L34
38,235
solid/issue-pane
issuePane.js
function (root) { if (root.refresh) { root.refresh() return } for (var i = 0; i < root.children.length; i++) { refreshTree(root.children[i]) } }
javascript
function (root) { if (root.refresh) { root.refresh() return } for (var i = 0; i < root.children.length; i++) { refreshTree(root.children[i]) } }
[ "function", "(", "root", ")", "{", "if", "(", "root", ".", "refresh", ")", "{", "root", ".", "refresh", "(", ")", "return", "}", "for", "(", "var", "i", "=", "0", ";", "i", "<", "root", ".", "children", ".", "length", ";", "i", "++", ")", "{"...
Refresh the DOM tree
[ "Refresh", "the", "DOM", "tree" ]
e14bd32ec5629b6cd09899ab8c1e38989a3c8d58
https://github.com/solid/issue-pane/blob/e14bd32ec5629b6cd09899ab8c1e38989a3c8d58/issuePane.js#L278-L286
38,236
solid/issue-pane
issuePane.js
getPossibleAssignees
async function getPossibleAssignees () { var devs = [] var devGroups = kb.each(subject, ns.wf('assigneeGroup')) for (let i = 0; i < devGroups.length; i++) { let group = devGroups[i] await kb.fetcher.load() devs = devs.concat(kb.each(group, ns.vcard('member'))) ...
javascript
async function getPossibleAssignees () { var devs = [] var devGroups = kb.each(subject, ns.wf('assigneeGroup')) for (let i = 0; i < devGroups.length; i++) { let group = devGroups[i] await kb.fetcher.load() devs = devs.concat(kb.each(group, ns.vcard('member'))) ...
[ "async", "function", "getPossibleAssignees", "(", ")", "{", "var", "devs", "=", "[", "]", "var", "devGroups", "=", "kb", ".", "each", "(", "subject", ",", "ns", ".", "wf", "(", "'assigneeGroup'", ")", ")", "for", "(", "let", "i", "=", "0", ";", "i"...
Who could be assigned to this? Anyone assigned to any issue we know about
[ "Who", "could", "be", "assigned", "to", "this?", "Anyone", "assigned", "to", "any", "issue", "we", "know", "about" ]
e14bd32ec5629b6cd09899ab8c1e38989a3c8d58
https://github.com/solid/issue-pane/blob/e14bd32ec5629b6cd09899ab8c1e38989a3c8d58/issuePane.js#L377-L392
38,237
seancheung/kuconfig
utils/index.js
merge
function merge(source, target) { if (target == null) { return clone(source); } if (source == null) { return clone(target); } if (typeof source !== 'object' || typeof target !== 'object') { return clone(target); } const merge = (source, target) => { Object.keys...
javascript
function merge(source, target) { if (target == null) { return clone(source); } if (source == null) { return clone(target); } if (typeof source !== 'object' || typeof target !== 'object') { return clone(target); } const merge = (source, target) => { Object.keys...
[ "function", "merge", "(", "source", ",", "target", ")", "{", "if", "(", "target", "==", "null", ")", "{", "return", "clone", "(", "source", ")", ";", "}", "if", "(", "source", "==", "null", ")", "{", "return", "clone", "(", "target", ")", ";", "}...
Make clones of two objects then merge the second one into the first one and returns the merged object @param {any} source @param {any} target @returns {any}
[ "Make", "clones", "of", "two", "objects", "then", "merge", "the", "second", "one", "into", "the", "first", "one", "and", "returns", "the", "merged", "object" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/utils/index.js#L34-L63
38,238
seancheung/kuconfig
utils/index.js
env
function env(file, inject) { const envs = {}; if (!path.isAbsolute(file)) { file = path.resolve(process.cwd(), file); } if (fs.existsSync(file) && fs.lstatSync(file).isFile()) { const content = fs.readFileSync(file, 'utf8'); content.split('\n').forEach(line => { const...
javascript
function env(file, inject) { const envs = {}; if (!path.isAbsolute(file)) { file = path.resolve(process.cwd(), file); } if (fs.existsSync(file) && fs.lstatSync(file).isFile()) { const content = fs.readFileSync(file, 'utf8'); content.split('\n').forEach(line => { const...
[ "function", "env", "(", "file", ",", "inject", ")", "{", "const", "envs", "=", "{", "}", ";", "if", "(", "!", "path", ".", "isAbsolute", "(", "file", ")", ")", "{", "file", "=", "path", ".", "resolve", "(", "process", ".", "cwd", "(", ")", ",",...
Read envs from file path @param {string} file @param {boolean} [inject] @returns {{[x: string]: string}}
[ "Read", "envs", "from", "file", "path" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/utils/index.js#L72-L107
38,239
RideAmigosCorp/grandfatherson
index.js
toDelete
function toDelete(datetimes, options) { // We can't just a function like _.difference, because moment objects can't be compared that simply // and the incoming values might not already be moment objects var seenSurvivors = {}; toKeep(datetimes, options).map(function (dt) { seenSurvivors[dt.toISOString()] =...
javascript
function toDelete(datetimes, options) { // We can't just a function like _.difference, because moment objects can't be compared that simply // and the incoming values might not already be moment objects var seenSurvivors = {}; toKeep(datetimes, options).map(function (dt) { seenSurvivors[dt.toISOString()] =...
[ "function", "toDelete", "(", "datetimes", ",", "options", ")", "{", "// We can't just a function like _.difference, because moment objects can't be compared that simply", "// and the incoming values might not already be moment objects", "var", "seenSurvivors", "=", "{", "}", ";", "to...
Return a set of datetimes that should be deleted, out of 'datetimes`
[ "Return", "a", "set", "of", "datetimes", "that", "should", "be", "deleted", "out", "of", "datetimes" ]
5fcd39ee260523db45c25fb3cba6c1f0e02b3400
https://github.com/RideAmigosCorp/grandfatherson/blob/5fcd39ee260523db45c25fb3cba6c1f0e02b3400/index.js#L64-L78
38,240
NotNinja/nevis
src/equals/context.js
EqualsContext
function EqualsContext(value, other, equals, options) { if (options == null) { options = {}; } /** * A reference to {@link Nevis.equals} which can be called within an {@link EqualsComparator}. * * @private * @type {Function} */ this._equals = equals; /** * The options to be used to tes...
javascript
function EqualsContext(value, other, equals, options) { if (options == null) { options = {}; } /** * A reference to {@link Nevis.equals} which can be called within an {@link EqualsComparator}. * * @private * @type {Function} */ this._equals = equals; /** * The options to be used to tes...
[ "function", "EqualsContext", "(", "value", ",", "other", ",", "equals", ",", "options", ")", "{", "if", "(", "options", "==", "null", ")", "{", "options", "=", "{", "}", ";", "}", "/**\n * A reference to {@link Nevis.equals} which can be called within an {@link Eq...
Contains the values whose equality is to be tested as well as the string representation and type for the value which can be checked elsewhere for type-checking etc. A <code>EqualsContext</code> is <b>only</b> created once it has been determined that both values not exactly equal and neither are <code>null</code>. Once...
[ "Contains", "the", "values", "whose", "equality", "is", "to", "be", "tested", "as", "well", "as", "the", "string", "representation", "and", "type", "for", "the", "value", "which", "can", "be", "checked", "elsewhere", "for", "type", "-", "checking", "etc", ...
1885e154e6e52d8d3eb307da9f27ed591bac455c
https://github.com/NotNinja/nevis/blob/1885e154e6e52d8d3eb307da9f27ed591bac455c/src/equals/context.js#L40-L105
38,241
jsalis/video-fullscreen
src/fullscreen.js
findSupported
function findSupported(apiList, document) { let standardApi = apiList[0]; let supportedApi = null; for (let i = 0, len = apiList.length; i < len; i++) { let api = apiList[ i ]; if (api[1] in document) { supportedApi = api; break; } } if (Array.isArray(supportedApi)) { return supportedApi.reduce...
javascript
function findSupported(apiList, document) { let standardApi = apiList[0]; let supportedApi = null; for (let i = 0, len = apiList.length; i < len; i++) { let api = apiList[ i ]; if (api[1] in document) { supportedApi = api; break; } } if (Array.isArray(supportedApi)) { return supportedApi.reduce...
[ "function", "findSupported", "(", "apiList", ",", "document", ")", "{", "let", "standardApi", "=", "apiList", "[", "0", "]", ";", "let", "supportedApi", "=", "null", ";", "for", "(", "let", "i", "=", "0", ",", "len", "=", "apiList", ".", "length", ";...
Finds a supported fullscreen API. @param {Array} apiList The list of possible fullscreen APIs. @param {Document} document The source of the fullscreen interface. @returns {Object}
[ "Finds", "a", "supported", "fullscreen", "API", "." ]
5654cc911f1d6e598b9eb221bc131a533f2862b1
https://github.com/jsalis/video-fullscreen/blob/5654cc911f1d6e598b9eb221bc131a533f2862b1/src/fullscreen.js#L51-L77
38,242
NotNinja/nevis
src/hash-code/builder.js
HashCodeBuilder
function HashCodeBuilder(initial, multiplier) { if (initial == null) { initial = HashCodeBuilder.DEFAULT_INITIAL_VALUE; } else if (initial % 2 === 0) { throw new Error('initial must be an odd number'); } if (multiplier == null) { multiplier = HashCodeBuilder.DEFAULT_MULTIPLIER_VALUE; } else if (m...
javascript
function HashCodeBuilder(initial, multiplier) { if (initial == null) { initial = HashCodeBuilder.DEFAULT_INITIAL_VALUE; } else if (initial % 2 === 0) { throw new Error('initial must be an odd number'); } if (multiplier == null) { multiplier = HashCodeBuilder.DEFAULT_MULTIPLIER_VALUE; } else if (m...
[ "function", "HashCodeBuilder", "(", "initial", ",", "multiplier", ")", "{", "if", "(", "initial", "==", "null", ")", "{", "initial", "=", "HashCodeBuilder", ".", "DEFAULT_INITIAL_VALUE", ";", "}", "else", "if", "(", "initial", "%", "2", "===", "0", ")", ...
Assists in building hash codes for complex classes. Ideally the <code>initial</code> value and <code>multiplier</code> should be different for each class, however, this is not vital. Prime numbers are preferred, especially for <code>multiplier</code>. @param {number} [initial=HashCodeBuilder.DEFAULT_INITIAL_VALUE] - ...
[ "Assists", "in", "building", "hash", "codes", "for", "complex", "classes", "." ]
1885e154e6e52d8d3eb307da9f27ed591bac455c
https://github.com/NotNinja/nevis/blob/1885e154e6e52d8d3eb307da9f27ed591bac455c/src/hash-code/builder.js#L41-L69
38,243
Doodle3D/connman-simplified
lib/WiFi.js
function(next) { // already connected to service? stop if (targetServiceProperties.state === STATES.READY || targetServiceProperties.state === STATES.ONLINE) { debug('already connected'); if (callback) callback(); _lockJoin = false; return; } else { ne...
javascript
function(next) { // already connected to service? stop if (targetServiceProperties.state === STATES.READY || targetServiceProperties.state === STATES.ONLINE) { debug('already connected'); if (callback) callback(); _lockJoin = false; return; } else { ne...
[ "function", "(", "next", ")", "{", "// already connected to service? stop", "if", "(", "targetServiceProperties", ".", "state", "===", "STATES", ".", "READY", "||", "targetServiceProperties", ".", "state", "===", "STATES", ".", "ONLINE", ")", "{", "debug", "(", ...
check current state
[ "check", "current", "state" ]
9dd9109660baa4673ff77d52bca1b630a2f756f1
https://github.com/Doodle3D/connman-simplified/blob/9dd9109660baa4673ff77d52bca1b630a2f756f1/lib/WiFi.js#L190-L201
38,244
Doodle3D/connman-simplified
lib/WiFi.js
function(next) { function finishJoining(err) { targetService.removeListener('PropertyChanged', onChange); if (typeof(passphraseSender) == 'function') { self.connman.Agent.removeListener('RequestInput', passphraseSender); passphraseSender = null } next(err); ...
javascript
function(next) { function finishJoining(err) { targetService.removeListener('PropertyChanged', onChange); if (typeof(passphraseSender) == 'function') { self.connman.Agent.removeListener('RequestInput', passphraseSender); passphraseSender = null } next(err); ...
[ "function", "(", "next", ")", "{", "function", "finishJoining", "(", "err", ")", "{", "targetService", ".", "removeListener", "(", "'PropertyChanged'", ",", "onChange", ")", ";", "if", "(", "typeof", "(", "passphraseSender", ")", "==", "'function'", ")", "{"...
listen to state
[ "listen", "to", "state" ]
9dd9109660baa4673ff77d52bca1b630a2f756f1
https://github.com/Doodle3D/connman-simplified/blob/9dd9109660baa4673ff77d52bca1b630a2f756f1/lib/WiFi.js#L234-L267
38,245
adrai/devicestack
lib/serial/deviceloader.js
SerialDeviceLoader
function SerialDeviceLoader(Device, useGlobal) { // call super class DeviceLoader.call(this); this.Device = Device; this.useGlobal = (useGlobal === undefined || useGlobal === null) ? true : useGlobal; if (this.useGlobal) { this.globalSerialDeviceLoader = globalSerialDeviceLoader.create(Device, this.fi...
javascript
function SerialDeviceLoader(Device, useGlobal) { // call super class DeviceLoader.call(this); this.Device = Device; this.useGlobal = (useGlobal === undefined || useGlobal === null) ? true : useGlobal; if (this.useGlobal) { this.globalSerialDeviceLoader = globalSerialDeviceLoader.create(Device, this.fi...
[ "function", "SerialDeviceLoader", "(", "Device", ",", "useGlobal", ")", "{", "// call super class", "DeviceLoader", ".", "call", "(", "this", ")", ";", "this", ".", "Device", "=", "Device", ";", "this", ".", "useGlobal", "=", "(", "useGlobal", "===", "undefi...
A serialdeviceloader can check if there are available some serial devices. @param {Object} Device The constructor function of the device.
[ "A", "serialdeviceloader", "can", "check", "if", "there", "are", "available", "some", "serial", "devices", "." ]
c0e20b799b5d3d7b5fbd8f0a3b8ab21c13fcad76
https://github.com/adrai/devicestack/blob/c0e20b799b5d3d7b5fbd8f0a3b8ab21c13fcad76/lib/serial/deviceloader.js#L11-L23
38,246
crysalead-js/dom-layer
src/tree/patch.js
keysIndexes
function keysIndexes(children, startIndex, endIndex) { var i, keys = Object.create(null), key; for (i = startIndex; i <= endIndex; ++i) { if (children[i]) { key = children[i].key; if (key !== undefined) { keys[key] = i; } } } return keys; }
javascript
function keysIndexes(children, startIndex, endIndex) { var i, keys = Object.create(null), key; for (i = startIndex; i <= endIndex; ++i) { if (children[i]) { key = children[i].key; if (key !== undefined) { keys[key] = i; } } } return keys; }
[ "function", "keysIndexes", "(", "children", ",", "startIndex", ",", "endIndex", ")", "{", "var", "i", ",", "keys", "=", "Object", ".", "create", "(", "null", ")", ",", "key", ";", "for", "(", "i", "=", "startIndex", ";", "i", "<=", "endIndex", ";", ...
Returns indexes of keyed nodes. @param Array children An array of nodes. @return Object An object of keyed nodes indexes.
[ "Returns", "indexes", "of", "keyed", "nodes", "." ]
0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2
https://github.com/crysalead-js/dom-layer/blob/0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2/src/tree/patch.js#L99-L110
38,247
crysalead-js/dom-layer
src/node/patcher/dataset.js
patch
function patch(element, previous, dataset) { if (!previous && !dataset) { return dataset; } var name; previous = previous || {}; dataset = dataset || {}; for (name in previous) { if (dataset[name] === undefined) { delete element.dataset[name]; } } for (name in dataset) { if (prev...
javascript
function patch(element, previous, dataset) { if (!previous && !dataset) { return dataset; } var name; previous = previous || {}; dataset = dataset || {}; for (name in previous) { if (dataset[name] === undefined) { delete element.dataset[name]; } } for (name in dataset) { if (prev...
[ "function", "patch", "(", "element", ",", "previous", ",", "dataset", ")", "{", "if", "(", "!", "previous", "&&", "!", "dataset", ")", "{", "return", "dataset", ";", "}", "var", "name", ";", "previous", "=", "previous", "||", "{", "}", ";", "dataset"...
Maintains state of element dataset. @param Object element A DOM element. @param Object previous The previous state of dataset. @param Object dataset The dataset to match on. @return Object dataset The element dataset state.
[ "Maintains", "state", "of", "element", "dataset", "." ]
0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2
https://github.com/crysalead-js/dom-layer/blob/0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2/src/node/patcher/dataset.js#L9-L31
38,248
CSTARS/poplar-3pg-model
lib/fn.js
function(stem, p) { var avDOB = Math.pow( ( stem / p.stemCnt / p.stemC) , (1 / p.stemP) ); var ppfs= p.pfsC * Math.pow(avDOB , p.pfsP); return Math.min(p.pfsMx,ppfs); }
javascript
function(stem, p) { var avDOB = Math.pow( ( stem / p.stemCnt / p.stemC) , (1 / p.stemP) ); var ppfs= p.pfsC * Math.pow(avDOB , p.pfsP); return Math.min(p.pfsMx,ppfs); }
[ "function", "(", "stem", ",", "p", ")", "{", "var", "avDOB", "=", "Math", ".", "pow", "(", "(", "stem", "/", "p", ".", "stemCnt", "/", "p", ".", "stemC", ")", ",", "(", "1", "/", "p", ".", "stemP", ")", ")", ";", "var", "ppfs", "=", "p", ...
Coppice Functions are based on Diameter on Stump, NOT DBH. Calculates the pfs based on the stem weight in KG
[ "Coppice", "Functions", "are", "based", "on", "Diameter", "on", "Stump", "NOT", "DBH", ".", "Calculates", "the", "pfs", "based", "on", "the", "stem", "weight", "in", "KG" ]
3d8c330b9d7f760611be4532204f7742096e165c
https://github.com/CSTARS/poplar-3pg-model/blob/3d8c330b9d7f760611be4532204f7742096e165c/lib/fn.js#L380-L385
38,249
CSTARS/poplar-3pg-model
lib/fn.js
function (stemG, wsVI, laVI, SLA) { if (stemG < 10) { stemG=10; } var VI = Math.pow( (stemG / wsVI.stems_per_stump / wsVI.constant),(1 / wsVI.power) ); // Add up for all stems var la = laVI.constant * Math.pow(VI,laVI.power) * wsVI.stems_per_stump; var wf = 1000 * (la / SLA); // Foilage ...
javascript
function (stemG, wsVI, laVI, SLA) { if (stemG < 10) { stemG=10; } var VI = Math.pow( (stemG / wsVI.stems_per_stump / wsVI.constant),(1 / wsVI.power) ); // Add up for all stems var la = laVI.constant * Math.pow(VI,laVI.power) * wsVI.stems_per_stump; var wf = 1000 * (la / SLA); // Foilage ...
[ "function", "(", "stemG", ",", "wsVI", ",", "laVI", ",", "SLA", ")", "{", "if", "(", "stemG", "<", "10", ")", "{", "stemG", "=", "10", ";", "}", "var", "VI", "=", "Math", ".", "pow", "(", "(", "stemG", "/", "wsVI", ".", "stems_per_stump", "/", ...
Calculates the pfs based on stem with in G. Uses volume Index as guide
[ "Calculates", "the", "pfs", "based", "on", "stem", "with", "in", "G", ".", "Uses", "volume", "Index", "as", "guide" ]
3d8c330b9d7f760611be4532204f7742096e165c
https://github.com/CSTARS/poplar-3pg-model/blob/3d8c330b9d7f760611be4532204f7742096e165c/lib/fn.js#L388-L399
38,250
bodyno/nunjucks-volt
src/globals.js
globals
function globals() { return { range: function(start, stop, step) { if(typeof stop === 'undefined') { stop = start; start = 0; step = 1; } else if(!step) { step = 1; } var arr = []; ...
javascript
function globals() { return { range: function(start, stop, step) { if(typeof stop === 'undefined') { stop = start; start = 0; step = 1; } else if(!step) { step = 1; } var arr = []; ...
[ "function", "globals", "(", ")", "{", "return", "{", "range", ":", "function", "(", "start", ",", "stop", ",", "step", ")", "{", "if", "(", "typeof", "stop", "===", "'undefined'", ")", "{", "stop", "=", "start", ";", "start", "=", "0", ";", "step",...
Making this a function instead so it returns a new object each time it's called. That way, if something like an environment uses it, they will each have their own copy.
[ "Making", "this", "a", "function", "instead", "so", "it", "returns", "a", "new", "object", "each", "time", "it", "s", "called", ".", "That", "way", "if", "something", "like", "an", "environment", "uses", "it", "they", "will", "each", "have", "their", "ow...
a7c0908bf98acc2af497069d7d2701bb880d3323
https://github.com/bodyno/nunjucks-volt/blob/a7c0908bf98acc2af497069d7d2701bb880d3323/src/globals.js#L40-L77
38,251
iammapping/githooks
githooks.js
filterFiles
function filterFiles(files, check) { return files.filter(function(file) { if (typeof check == 'string') { // ignore typecase equal return check.toLowerCase() === file.toLowerCase(); } else if (Util.isRegExp(check)) { // regexp test return check.test(file); } else if (typeof check == 'function') { ...
javascript
function filterFiles(files, check) { return files.filter(function(file) { if (typeof check == 'string') { // ignore typecase equal return check.toLowerCase() === file.toLowerCase(); } else if (Util.isRegExp(check)) { // regexp test return check.test(file); } else if (typeof check == 'function') { ...
[ "function", "filterFiles", "(", "files", ",", "check", ")", "{", "return", "files", ".", "filter", "(", "function", "(", "file", ")", "{", "if", "(", "typeof", "check", "==", "'string'", ")", "{", "// ignore typecase equal", "return", "check", ".", "toLowe...
filter files array @param {Array} files @param {String|RegExp|Function} check @return {Array}
[ "filter", "files", "array" ]
91fdb886c59840a0d210575684292fa022f339ed
https://github.com/iammapping/githooks/blob/91fdb886c59840a0d210575684292fa022f339ed/githooks.js#L162-L175
38,252
iammapping/githooks
githooks.js
function() { var hooks = {}; return { // ignore hook error ignore: false, // provide async api async: async, /** * add a new hook * @param {String} hook [hook name] * @param {Object} rules [hook trigger rules] * @return Githook */ hook: function(hook, rules) { if (cfg.AVAILABLE_HOOKS....
javascript
function() { var hooks = {}; return { // ignore hook error ignore: false, // provide async api async: async, /** * add a new hook * @param {String} hook [hook name] * @param {Object} rules [hook trigger rules] * @return Githook */ hook: function(hook, rules) { if (cfg.AVAILABLE_HOOKS....
[ "function", "(", ")", "{", "var", "hooks", "=", "{", "}", ";", "return", "{", "// ignore hook error", "ignore", ":", "false", ",", "// provide async api", "async", ":", "async", ",", "/**\n\t\t * add a new hook\n\t\t * @param {String} hook [hook name]\n\t\t * @param {O...
set of Githook
[ "set", "of", "Githook" ]
91fdb886c59840a0d210575684292fa022f339ed
https://github.com/iammapping/githooks/blob/91fdb886c59840a0d210575684292fa022f339ed/githooks.js#L180-L249
38,253
iammapping/githooks
githooks.js
function(hook, rules) { if (cfg.AVAILABLE_HOOKS.indexOf(hook) < 0 && !this.ignore) { this.error('hook "' + hook + '" not support'); } if (!hooks[hook]) { hooks[hook] = new Githook(rules); } return hooks[hook]; }
javascript
function(hook, rules) { if (cfg.AVAILABLE_HOOKS.indexOf(hook) < 0 && !this.ignore) { this.error('hook "' + hook + '" not support'); } if (!hooks[hook]) { hooks[hook] = new Githook(rules); } return hooks[hook]; }
[ "function", "(", "hook", ",", "rules", ")", "{", "if", "(", "cfg", ".", "AVAILABLE_HOOKS", ".", "indexOf", "(", "hook", ")", "<", "0", "&&", "!", "this", ".", "ignore", ")", "{", "this", ".", "error", "(", "'hook \"'", "+", "hook", "+", "'\" not su...
add a new hook @param {String} hook [hook name] @param {Object} rules [hook trigger rules] @return Githook
[ "add", "a", "new", "hook" ]
91fdb886c59840a0d210575684292fa022f339ed
https://github.com/iammapping/githooks/blob/91fdb886c59840a0d210575684292fa022f339ed/githooks.js#L193-L202
38,254
iammapping/githooks
githooks.js
function(error) { if (error) { console.error(error.toString()); } process.exit(cfg.ERROR_EXIT); }
javascript
function(error) { if (error) { console.error(error.toString()); } process.exit(cfg.ERROR_EXIT); }
[ "function", "(", "error", ")", "{", "if", "(", "error", ")", "{", "console", ".", "error", "(", "error", ".", "toString", "(", ")", ")", ";", "}", "process", ".", "exit", "(", "cfg", ".", "ERROR_EXIT", ")", ";", "}" ]
output error message and exit with ERROR_EXIT @param {String|Error} error
[ "output", "error", "message", "and", "exit", "with", "ERROR_EXIT" ]
91fdb886c59840a0d210575684292fa022f339ed
https://github.com/iammapping/githooks/blob/91fdb886c59840a0d210575684292fa022f339ed/githooks.js#L230-L235
38,255
MarcDiethelm/xtc
lib/configure.js
configurePaths
function configurePaths(cfg) { var sourcesBasePath = path.resolve(appPath, cfg.get('sourcesBasePath')) ,sources = cfg.get('sources') ,build = cfg.get('build') ,buildBaseUri ,buildDir = nodeEnv == 'development' ? build.baseDirNameDev : build.baseDirNameDist ,buildPath = path.join( path.resolve(appPa...
javascript
function configurePaths(cfg) { var sourcesBasePath = path.resolve(appPath, cfg.get('sourcesBasePath')) ,sources = cfg.get('sources') ,build = cfg.get('build') ,buildBaseUri ,buildDir = nodeEnv == 'development' ? build.baseDirNameDev : build.baseDirNameDist ,buildPath = path.join( path.resolve(appPa...
[ "function", "configurePaths", "(", "cfg", ")", "{", "var", "sourcesBasePath", "=", "path", ".", "resolve", "(", "appPath", ",", "cfg", ".", "get", "(", "'sourcesBasePath'", ")", ")", ",", "sources", "=", "cfg", ".", "get", "(", "'sources'", ")", ",", "...
Build some paths and create absolute paths from the cfg.sources using our base path
[ "Build", "some", "paths", "and", "create", "absolute", "paths", "from", "the", "cfg", ".", "sources", "using", "our", "base", "path" ]
dd422136b27ca52b17255d4e8778ca30a70e987b
https://github.com/MarcDiethelm/xtc/blob/dd422136b27ca52b17255d4e8778ca30a70e987b/lib/configure.js#L103-L151
38,256
edjafarov/PromisePipe
example/connectors/HTTPDuplexStream.js
ServerClientStream
function ServerClientStream(app){ var StreamHandler; app.use(function(req, res, next){ if(req.originalUrl == '/promise-pipe-connector' && req.method=='POST'){ var message = req.body; message._response = res; StreamHandler(message) } else { return next(); } }...
javascript
function ServerClientStream(app){ var StreamHandler; app.use(function(req, res, next){ if(req.originalUrl == '/promise-pipe-connector' && req.method=='POST'){ var message = req.body; message._response = res; StreamHandler(message) } else { return next(); } }...
[ "function", "ServerClientStream", "(", "app", ")", "{", "var", "StreamHandler", ";", "app", ".", "use", "(", "function", "(", "req", ",", "res", ",", "next", ")", "{", "if", "(", "req", ".", "originalUrl", "==", "'/promise-pipe-connector'", "&&", "req", ...
express app highly experimental
[ "express", "app", "highly", "experimental" ]
ec37d5eaab57feadc2e1f5a9f9e7306e32565143
https://github.com/edjafarov/PromisePipe/blob/ec37d5eaab57feadc2e1f5a9f9e7306e32565143/example/connectors/HTTPDuplexStream.js#L29-L51
38,257
chjj/node-pingback
lib/pingback.js
function(url, body, func) { if (typeof url !== 'object') { url = parse(url); } if (!func) { func = body; body = undefined; } var opt = { host: url.hostname, port: url.port || 80, path: url.pathname //agent: false }; if (body) { opt.headers = { 'Content-Type': 'appl...
javascript
function(url, body, func) { if (typeof url !== 'object') { url = parse(url); } if (!func) { func = body; body = undefined; } var opt = { host: url.hostname, port: url.port || 80, path: url.pathname //agent: false }; if (body) { opt.headers = { 'Content-Type': 'appl...
[ "function", "(", "url", ",", "body", ",", "func", ")", "{", "if", "(", "typeof", "url", "!==", "'object'", ")", "{", "url", "=", "parse", "(", "url", ")", ";", "}", "if", "(", "!", "func", ")", "{", "func", "=", "body", ";", "body", "=", "und...
HTTP Request make an http request
[ "HTTP", "Request", "make", "an", "http", "request" ]
4f2fa8847c7657e495a1065d5013eda0c4f16fee
https://github.com/chjj/node-pingback/blob/4f2fa8847c7657e495a1065d5013eda0c4f16fee/lib/pingback.js#L428-L489
38,258
jasonkneen/TiCh
bin/tich.js
status
function status() { console.log('\n'); console.log('Name: ' + chalk.cyan(tiapp.name)); console.log('AppId: ' + chalk.cyan(tiapp.id)); console.log('Version: ' + chalk.cyan(tiapp.version)); console.log('GUID: ' + chalk.cyan(tiapp.guid)); console.log('\n'); }
javascript
function status() { console.log('\n'); console.log('Name: ' + chalk.cyan(tiapp.name)); console.log('AppId: ' + chalk.cyan(tiapp.id)); console.log('Version: ' + chalk.cyan(tiapp.version)); console.log('GUID: ' + chalk.cyan(tiapp.guid)); console.log('\n'); }
[ "function", "status", "(", ")", "{", "console", ".", "log", "(", "'\\n'", ")", ";", "console", ".", "log", "(", "'Name: '", "+", "chalk", ".", "cyan", "(", "tiapp", ".", "name", ")", ")", ";", "console", ".", "log", "(", "'AppId: '", "+", "chalk", ...
status command, shows the current config
[ "status", "command", "shows", "the", "current", "config" ]
a7d7e36a73d591d2aa3ae0df9c6b3a3b2b8b3500
https://github.com/jasonkneen/TiCh/blob/a7d7e36a73d591d2aa3ae0df9c6b3a3b2b8b3500/bin/tich.js#L23-L30
38,259
jasonkneen/TiCh
bin/tich.js
select
function select(name, outfilename) { var regex = /\$tiapp\.(.*)\$/; if (!name) { if (fs.existsSync('./app/config.json')) { var alloyCfg = JSON.parse(fs.readFileSync("./app/config.json", "utf-8")); if (alloyCfg.global.theme) { console.log('...
javascript
function select(name, outfilename) { var regex = /\$tiapp\.(.*)\$/; if (!name) { if (fs.existsSync('./app/config.json')) { var alloyCfg = JSON.parse(fs.readFileSync("./app/config.json", "utf-8")); if (alloyCfg.global.theme) { console.log('...
[ "function", "select", "(", "name", ",", "outfilename", ")", "{", "var", "regex", "=", "/", "\\$tiapp\\.(.*)\\$", "/", ";", "if", "(", "!", "name", ")", "{", "if", "(", "fs", ".", "existsSync", "(", "'./app/config.json'", ")", ")", "{", "var", "alloyCfg...
select a new config by name
[ "select", "a", "new", "config", "by", "name" ]
a7d7e36a73d591d2aa3ae0df9c6b3a3b2b8b3500
https://github.com/jasonkneen/TiCh/blob/a7d7e36a73d591d2aa3ae0df9c6b3a3b2b8b3500/bin/tich.js#L33-L179
38,260
seancheung/kuconfig
lib/accumulator.js
$max
function $max(params) { if (Array.isArray(params) && params.every(p => typeof p === 'number')) { return Math.max(...params); } throw new Error('$max expects an array of number'); }
javascript
function $max(params) { if (Array.isArray(params) && params.every(p => typeof p === 'number')) { return Math.max(...params); } throw new Error('$max expects an array of number'); }
[ "function", "$max", "(", "params", ")", "{", "if", "(", "Array", ".", "isArray", "(", "params", ")", "&&", "params", ".", "every", "(", "p", "=>", "typeof", "p", "===", "'number'", ")", ")", "{", "return", "Math", ".", "max", "(", "...", "params", ...
Return the max number in the array @param {number[]} params @returns {number}
[ "Return", "the", "max", "number", "in", "the", "array" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/accumulator.js#L7-L12
38,261
seancheung/kuconfig
lib/accumulator.js
$min
function $min(params) { if (Array.isArray(params) && params.every(p => typeof p === 'number')) { return Math.min(...params); } throw new Error('$min expects an array of number'); }
javascript
function $min(params) { if (Array.isArray(params) && params.every(p => typeof p === 'number')) { return Math.min(...params); } throw new Error('$min expects an array of number'); }
[ "function", "$min", "(", "params", ")", "{", "if", "(", "Array", ".", "isArray", "(", "params", ")", "&&", "params", ".", "every", "(", "p", "=>", "typeof", "p", "===", "'number'", ")", ")", "{", "return", "Math", ".", "min", "(", "...", "params", ...
Return the min number in the array @param {number[]} params @returns {number}
[ "Return", "the", "min", "number", "in", "the", "array" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/accumulator.js#L20-L25
38,262
seancheung/kuconfig
lib/accumulator.js
$sum
function $sum(params) { if (Array.isArray(params) && params.every(p => typeof p === 'number')) { return params.reduce((t, n) => t + n, 0); } throw new Error('$sum expects an array of number'); }
javascript
function $sum(params) { if (Array.isArray(params) && params.every(p => typeof p === 'number')) { return params.reduce((t, n) => t + n, 0); } throw new Error('$sum expects an array of number'); }
[ "function", "$sum", "(", "params", ")", "{", "if", "(", "Array", ".", "isArray", "(", "params", ")", "&&", "params", ".", "every", "(", "p", "=>", "typeof", "p", "===", "'number'", ")", ")", "{", "return", "params", ".", "reduce", "(", "(", "t", ...
Sum the numbers in the array @param {number[]} params @returns {number}
[ "Sum", "the", "numbers", "in", "the", "array" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/accumulator.js#L33-L38
38,263
seancheung/kuconfig
lib/accumulator.js
$concat
function $concat(params) { if ( Array.isArray(params) && (params.every(p => typeof p === 'string') || params.every(p => Array.isArray(p))) ) { return params[0].concat(...params.slice(1)); } throw new Error('$concat expects an array of array or string'); }
javascript
function $concat(params) { if ( Array.isArray(params) && (params.every(p => typeof p === 'string') || params.every(p => Array.isArray(p))) ) { return params[0].concat(...params.slice(1)); } throw new Error('$concat expects an array of array or string'); }
[ "function", "$concat", "(", "params", ")", "{", "if", "(", "Array", ".", "isArray", "(", "params", ")", "&&", "(", "params", ".", "every", "(", "p", "=>", "typeof", "p", "===", "'string'", ")", "||", "params", ".", "every", "(", "p", "=>", "Array",...
Concat strings or arrays @param {string[]|[][]} params @returns {string|any[]}
[ "Concat", "strings", "or", "arrays" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/accumulator.js#L105-L114
38,264
johnturingan/gulp-html-to-json
index.js
htmlToJsonController
function htmlToJsonController (fileContents, filePath, output, p) { var matches; var includePaths = false; while (matches = _DIRECTIVE_REGEX.exec(fileContents)) { var relPath = path.dirname(filePath), fullPath = path.join(relPath, matches[3].replace(/['"]/g, '')).trim(), ...
javascript
function htmlToJsonController (fileContents, filePath, output, p) { var matches; var includePaths = false; while (matches = _DIRECTIVE_REGEX.exec(fileContents)) { var relPath = path.dirname(filePath), fullPath = path.join(relPath, matches[3].replace(/['"]/g, '')).trim(), ...
[ "function", "htmlToJsonController", "(", "fileContents", ",", "filePath", ",", "output", ",", "p", ")", "{", "var", "matches", ";", "var", "includePaths", "=", "false", ";", "while", "(", "matches", "=", "_DIRECTIVE_REGEX", ".", "exec", "(", "fileContents", ...
Control HTML to JSON @param fileContents @param filePath @param output @param p
[ "Control", "HTML", "to", "JSON" ]
c5b6d01ef57de59d985662dd9dd7f31e188a8b57
https://github.com/johnturingan/gulp-html-to-json/blob/c5b6d01ef57de59d985662dd9dd7f31e188a8b57/index.js#L117-L181
38,265
johnturingan/gulp-html-to-json
index.js
angularTemplate
function angularTemplate (p, json) { var prefix = (p.prefix !== "") ? p.prefix + "." : "", tpl = 'angular.module("'+ prefix + p.filename +'",["ng"]).run(["$templateCache",'; tpl += 'function($templateCache) {'; for (var key in json) { if (json.hasOwnProperty(key)) { tpl += '$...
javascript
function angularTemplate (p, json) { var prefix = (p.prefix !== "") ? p.prefix + "." : "", tpl = 'angular.module("'+ prefix + p.filename +'",["ng"]).run(["$templateCache",'; tpl += 'function($templateCache) {'; for (var key in json) { if (json.hasOwnProperty(key)) { tpl += '$...
[ "function", "angularTemplate", "(", "p", ",", "json", ")", "{", "var", "prefix", "=", "(", "p", ".", "prefix", "!==", "\"\"", ")", "?", "p", ".", "prefix", "+", "\".\"", ":", "\"\"", ",", "tpl", "=", "'angular.module(\"'", "+", "prefix", "+", "p", ...
Make Angular Template @param p @param json @returns {string}
[ "Make", "Angular", "Template" ]
c5b6d01ef57de59d985662dd9dd7f31e188a8b57
https://github.com/johnturingan/gulp-html-to-json/blob/c5b6d01ef57de59d985662dd9dd7f31e188a8b57/index.js#L189-L207
38,266
sliptype/sass-shake
src/sass-shake.js
getDependencies
async function getDependencies(includePaths, file) { const result = await util.promisify(sass.render)({ includePaths, file }); return result.stats.includedFiles.map(path.normalize); }
javascript
async function getDependencies(includePaths, file) { const result = await util.promisify(sass.render)({ includePaths, file }); return result.stats.includedFiles.map(path.normalize); }
[ "async", "function", "getDependencies", "(", "includePaths", ",", "file", ")", "{", "const", "result", "=", "await", "util", ".", "promisify", "(", "sass", ".", "render", ")", "(", "{", "includePaths", ",", "file", "}", ")", ";", "return", "result", ".",...
Gather a list of dependencies from a single sass tree @param { String } file @returns { Array } dependencies
[ "Gather", "a", "list", "of", "dependencies", "from", "a", "single", "sass", "tree" ]
dfd43f181a969b0e26d7e5f2b7e6dad6fba05405
https://github.com/sliptype/sass-shake/blob/dfd43f181a969b0e26d7e5f2b7e6dad6fba05405/src/sass-shake.js#L40-L43
38,267
sliptype/sass-shake
src/sass-shake.js
reduceEntryPointsToDependencies
async function reduceEntryPointsToDependencies(includePaths, entryPoints) { return await entryPoints.reduce(async function (allDeps, entry) { const resolvedDeps = await allDeps.then(); const newDeps = await getDependencies(includePaths, entry); return Promise.resolve([ ...resolvedDeps, ...newD...
javascript
async function reduceEntryPointsToDependencies(includePaths, entryPoints) { return await entryPoints.reduce(async function (allDeps, entry) { const resolvedDeps = await allDeps.then(); const newDeps = await getDependencies(includePaths, entry); return Promise.resolve([ ...resolvedDeps, ...newD...
[ "async", "function", "reduceEntryPointsToDependencies", "(", "includePaths", ",", "entryPoints", ")", "{", "return", "await", "entryPoints", ".", "reduce", "(", "async", "function", "(", "allDeps", ",", "entry", ")", "{", "const", "resolvedDeps", "=", "await", "...
Transform a list of entry points into a list of all dependencies @param { Array } entryPoints @returns { Array } dependencies
[ "Transform", "a", "list", "of", "entry", "points", "into", "a", "list", "of", "all", "dependencies" ]
dfd43f181a969b0e26d7e5f2b7e6dad6fba05405
https://github.com/sliptype/sass-shake/blob/dfd43f181a969b0e26d7e5f2b7e6dad6fba05405/src/sass-shake.js#L50-L59
38,268
sliptype/sass-shake
src/sass-shake.js
async function (directory, filesInSassTree, exclusions) { const filesInDirectory = (await recursive(directory)); const unusedFiles = filesInDirectory .filter((file) => isUnused(file, filesInSassTree, exclusions)); return unusedFiles; }
javascript
async function (directory, filesInSassTree, exclusions) { const filesInDirectory = (await recursive(directory)); const unusedFiles = filesInDirectory .filter((file) => isUnused(file, filesInSassTree, exclusions)); return unusedFiles; }
[ "async", "function", "(", "directory", ",", "filesInSassTree", ",", "exclusions", ")", "{", "const", "filesInDirectory", "=", "(", "await", "recursive", "(", "directory", ")", ")", ";", "const", "unusedFiles", "=", "filesInDirectory", ".", "filter", "(", "(", ...
Compare directory contents with a list of files that are in use @param { String } directory @param { Array } filesInSassTree @param { Array } exclusions @returns { Array } files that are unused
[ "Compare", "directory", "contents", "with", "a", "list", "of", "files", "that", "are", "in", "use" ]
dfd43f181a969b0e26d7e5f2b7e6dad6fba05405
https://github.com/sliptype/sass-shake/blob/dfd43f181a969b0e26d7e5f2b7e6dad6fba05405/src/sass-shake.js#L91-L98
38,269
s1gtrap/node-binary-vdf
index.js
readIntoBuf
function readIntoBuf(stream) { return new Promise((resolve, reject) => { const chunks = [] stream.on('data', chunk => { chunks.push(chunk) }) stream.on('error', err => { reject(err) }) stream.on('end', () => { resolve(Buffer.concat(chunks)) }) }) }
javascript
function readIntoBuf(stream) { return new Promise((resolve, reject) => { const chunks = [] stream.on('data', chunk => { chunks.push(chunk) }) stream.on('error', err => { reject(err) }) stream.on('end', () => { resolve(Buffer.concat(chunks)) }) }) }
[ "function", "readIntoBuf", "(", "stream", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "const", "chunks", "=", "[", "]", "stream", ".", "on", "(", "'data'", ",", "chunk", "=>", "{", "chunks", ".", "push", ...
Produces a Promise that consumes a Readable entirely into a Buffer
[ "Produces", "a", "Promise", "that", "consumes", "a", "Readable", "entirely", "into", "a", "Buffer" ]
6d503bcc2053293d6aff3e0d85571404f1bdc1d7
https://github.com/s1gtrap/node-binary-vdf/blob/6d503bcc2053293d6aff3e0d85571404f1bdc1d7/index.js#L2-L18
38,270
s1gtrap/node-binary-vdf
index.js
readStr
function readStr(buf) { let size = 0 while (buf.readUInt8(size++) != 0x00) continue let str = buf.toString('utf8', 0, size - 1) return [str, size] }
javascript
function readStr(buf) { let size = 0 while (buf.readUInt8(size++) != 0x00) continue let str = buf.toString('utf8', 0, size - 1) return [str, size] }
[ "function", "readStr", "(", "buf", ")", "{", "let", "size", "=", "0", "while", "(", "buf", ".", "readUInt8", "(", "size", "++", ")", "!=", "0x00", ")", "continue", "let", "str", "=", "buf", ".", "toString", "(", "'utf8'", ",", "0", ",", "size", "...
Read a null-terminated UTF-8 string from a Buffer, returning the string and the number of bytes read
[ "Read", "a", "null", "-", "terminated", "UTF", "-", "8", "string", "from", "a", "Buffer", "returning", "the", "string", "and", "the", "number", "of", "bytes", "read" ]
6d503bcc2053293d6aff3e0d85571404f1bdc1d7
https://github.com/s1gtrap/node-binary-vdf/blob/6d503bcc2053293d6aff3e0d85571404f1bdc1d7/index.js#L22-L30
38,271
s1gtrap/node-binary-vdf
index.js
readAppInfo
function readAppInfo(buf) { // First byte varies across installs, only the 2nd and 3rd seem consistent if (buf.readUInt8(1) != 0x44 || buf.readUInt8(2) != 0x56) throw new Error('Invalid file signature') return readAppEntries(buf.slice(8)) }
javascript
function readAppInfo(buf) { // First byte varies across installs, only the 2nd and 3rd seem consistent if (buf.readUInt8(1) != 0x44 || buf.readUInt8(2) != 0x56) throw new Error('Invalid file signature') return readAppEntries(buf.slice(8)) }
[ "function", "readAppInfo", "(", "buf", ")", "{", "// First byte varies across installs, only the 2nd and 3rd seem consistent", "if", "(", "buf", ".", "readUInt8", "(", "1", ")", "!=", "0x44", "||", "buf", ".", "readUInt8", "(", "2", ")", "!=", "0x56", ")", "thro...
Read header and app entries from binary VDF Buffer
[ "Read", "header", "and", "app", "entries", "from", "binary", "VDF", "Buffer" ]
6d503bcc2053293d6aff3e0d85571404f1bdc1d7
https://github.com/s1gtrap/node-binary-vdf/blob/6d503bcc2053293d6aff3e0d85571404f1bdc1d7/index.js#L33-L39
38,272
s1gtrap/node-binary-vdf
index.js
readAppEntries
function readAppEntries(buf) { const entries = [] // App entry collection is terminated by null dword for (let off = 0; buf.readUInt32LE(off) != 0x00000000; ++off) { let [entry, size] = readAppEntry(buf.slice(off)) entries.push(entry) off += size } return entries }
javascript
function readAppEntries(buf) { const entries = [] // App entry collection is terminated by null dword for (let off = 0; buf.readUInt32LE(off) != 0x00000000; ++off) { let [entry, size] = readAppEntry(buf.slice(off)) entries.push(entry) off += size } return entries }
[ "function", "readAppEntries", "(", "buf", ")", "{", "const", "entries", "=", "[", "]", "// App entry collection is terminated by null dword", "for", "(", "let", "off", "=", "0", ";", "buf", ".", "readUInt32LE", "(", "off", ")", "!=", "0x00000000", ";", "++", ...
Read a collection of app entries
[ "Read", "a", "collection", "of", "app", "entries" ]
6d503bcc2053293d6aff3e0d85571404f1bdc1d7
https://github.com/s1gtrap/node-binary-vdf/blob/6d503bcc2053293d6aff3e0d85571404f1bdc1d7/index.js#L42-L55
38,273
s1gtrap/node-binary-vdf
index.js
readAppEntry
function readAppEntry(buf) { let off = 0 const id = buf.readUInt32LE(off) off += 49 // Skip a bunch of fields we don't care about const [name, nameSize] = readStr(buf.slice(off)) off += nameSize const [entries, entriesSize] = readEntries(buf.slice(off)) off += entriesSize return [{id, name, entri...
javascript
function readAppEntry(buf) { let off = 0 const id = buf.readUInt32LE(off) off += 49 // Skip a bunch of fields we don't care about const [name, nameSize] = readStr(buf.slice(off)) off += nameSize const [entries, entriesSize] = readEntries(buf.slice(off)) off += entriesSize return [{id, name, entri...
[ "function", "readAppEntry", "(", "buf", ")", "{", "let", "off", "=", "0", "const", "id", "=", "buf", ".", "readUInt32LE", "(", "off", ")", "off", "+=", "49", "// Skip a bunch of fields we don't care about", "const", "[", "name", ",", "nameSize", "]", "=", ...
Read a single app entry, returning its id, name and key-value entries
[ "Read", "a", "single", "app", "entry", "returning", "its", "id", "name", "and", "key", "-", "value", "entries" ]
6d503bcc2053293d6aff3e0d85571404f1bdc1d7
https://github.com/s1gtrap/node-binary-vdf/blob/6d503bcc2053293d6aff3e0d85571404f1bdc1d7/index.js#L58-L74
38,274
s1gtrap/node-binary-vdf
index.js
readEntries
function readEntries(buf) { const entries = {} let off = 0 // Entry collection is terminated by 0x08 byte for (; buf.readUInt8(off) != 0x08;) { let [key, val, size] = readEntry(buf.slice(off)) entries[key] = val off += size } return [entries, off + 1] }
javascript
function readEntries(buf) { const entries = {} let off = 0 // Entry collection is terminated by 0x08 byte for (; buf.readUInt8(off) != 0x08;) { let [key, val, size] = readEntry(buf.slice(off)) entries[key] = val off += size } return [entries, off + 1] }
[ "function", "readEntries", "(", "buf", ")", "{", "const", "entries", "=", "{", "}", "let", "off", "=", "0", "// Entry collection is terminated by 0x08 byte", "for", "(", ";", "buf", ".", "readUInt8", "(", "off", ")", "!=", "0x08", ";", ")", "{", "let", "...
Read a collection of key-value entries, returning the collection and bytes read
[ "Read", "a", "collection", "of", "key", "-", "value", "entries", "returning", "the", "collection", "and", "bytes", "read" ]
6d503bcc2053293d6aff3e0d85571404f1bdc1d7
https://github.com/s1gtrap/node-binary-vdf/blob/6d503bcc2053293d6aff3e0d85571404f1bdc1d7/index.js#L78-L93
38,275
s1gtrap/node-binary-vdf
index.js
readEntry
function readEntry(buf) { let off = 0 let type = buf.readUInt8(off) off += 1 let [key, keySize] = readStr(buf.slice(off)) off += keySize switch (type) { case 0x00: // Nested entries let [kvs, kvsSize] = readEntries(buf.slice(off)) return [key, kvs, off + kvsSize] case 0x01: // Str...
javascript
function readEntry(buf) { let off = 0 let type = buf.readUInt8(off) off += 1 let [key, keySize] = readStr(buf.slice(off)) off += keySize switch (type) { case 0x00: // Nested entries let [kvs, kvsSize] = readEntries(buf.slice(off)) return [key, kvs, off + kvsSize] case 0x01: // Str...
[ "function", "readEntry", "(", "buf", ")", "{", "let", "off", "=", "0", "let", "type", "=", "buf", ".", "readUInt8", "(", "off", ")", "off", "+=", "1", "let", "[", "key", ",", "keySize", "]", "=", "readStr", "(", "buf", ".", "slice", "(", "off", ...
Read a single entry, returning the key-value pair and bytes read
[ "Read", "a", "single", "entry", "returning", "the", "key", "-", "value", "pair", "and", "bytes", "read" ]
6d503bcc2053293d6aff3e0d85571404f1bdc1d7
https://github.com/s1gtrap/node-binary-vdf/blob/6d503bcc2053293d6aff3e0d85571404f1bdc1d7/index.js#L96-L124
38,276
MarcDiethelm/xtc
lib/mod-render.js
renderModule
function renderModule(context, options) { var cacheKey ,modSourceTemplate ,mergedData ,html ; // this check is used when rendering isolated modules or views for development and testing (in the default layout!). // skip any modules that are not THE module or THE view. // view: skip all modules that have the...
javascript
function renderModule(context, options) { var cacheKey ,modSourceTemplate ,mergedData ,html ; // this check is used when rendering isolated modules or views for development and testing (in the default layout!). // skip any modules that are not THE module or THE view. // view: skip all modules that have the...
[ "function", "renderModule", "(", "context", ",", "options", ")", "{", "var", "cacheKey", ",", "modSourceTemplate", ",", "mergedData", ",", "html", ";", "// this check is used when rendering isolated modules or views for development and testing (in the default layout!).", "// skip...
Render a Terrific markup module @param {Object} context @param {{name: String}} options @returns {String} – Module HTML
[ "Render", "a", "Terrific", "markup", "module" ]
dd422136b27ca52b17255d4e8778ca30a70e987b
https://github.com/MarcDiethelm/xtc/blob/dd422136b27ca52b17255d4e8778ca30a70e987b/lib/mod-render.js#L55-L133
38,277
henrytseng/hostr
lib/watch.js
_recurseFolder
function _recurseFolder(src) { // Ignore var relativeSrc = path.relative(process.cwd(), src); if(_isIgnored(relativeSrc)) return; // Process fs.readdir(src, function(err, files) { files.forEach(function(filename) { fs.stat(src+path.sep+filename, function(err, stat) { if(stat...
javascript
function _recurseFolder(src) { // Ignore var relativeSrc = path.relative(process.cwd(), src); if(_isIgnored(relativeSrc)) return; // Process fs.readdir(src, function(err, files) { files.forEach(function(filename) { fs.stat(src+path.sep+filename, function(err, stat) { if(stat...
[ "function", "_recurseFolder", "(", "src", ")", "{", "// Ignore", "var", "relativeSrc", "=", "path", ".", "relative", "(", "process", ".", "cwd", "(", ")", ",", "src", ")", ";", "if", "(", "_isIgnored", "(", "relativeSrc", ")", ")", "return", ";", "// P...
Internal method to watch folders recursively @param {String} src A path to start from
[ "Internal", "method", "to", "watch", "folders", "recursively" ]
8ef1ec59d2acdd135eafb19d439519a8d87ff21a
https://github.com/henrytseng/hostr/blob/8ef1ec59d2acdd135eafb19d439519a8d87ff21a/lib/watch.js#L85-L103
38,278
roboncode/tang
lib/factory.js
factory
function factory(name, schema = {}, options = {}) { class TangModel extends Model { constructor(data) { super(data, schema, options) } } TangModel.options = options TangModel.schema = schema Object.defineProperty(TangModel, 'name', { value: name }) for (let name in schema.statics) { Tan...
javascript
function factory(name, schema = {}, options = {}) { class TangModel extends Model { constructor(data) { super(data, schema, options) } } TangModel.options = options TangModel.schema = schema Object.defineProperty(TangModel, 'name', { value: name }) for (let name in schema.statics) { Tan...
[ "function", "factory", "(", "name", ",", "schema", "=", "{", "}", ",", "options", "=", "{", "}", ")", "{", "class", "TangModel", "extends", "Model", "{", "constructor", "(", "data", ")", "{", "super", "(", "data", ",", "schema", ",", "options", ")", ...
Constructs a Model class @param {*} name @param {*} schema @param {*} options
[ "Constructs", "a", "Model", "class" ]
3e3826be0e1a621faf3eeea8c769dd28343fb326
https://github.com/roboncode/tang/blob/3e3826be0e1a621faf3eeea8c769dd28343fb326/lib/factory.js#L8-L27
38,279
adrai/devicestack
lib/usb/deviceloader.js
UsbDeviceLoader
function UsbDeviceLoader(Device, vendorId, productId) { // call super class DeviceLoader.call(this); this.Device = Device; this.vidPidPairs = []; if (!productId && _.isArray(vendorId)) { this.vidPidPairs = vendorId; } else { this.vidPidPairs = [{vendorId: vendorId, productId: productId}]; } }
javascript
function UsbDeviceLoader(Device, vendorId, productId) { // call super class DeviceLoader.call(this); this.Device = Device; this.vidPidPairs = []; if (!productId && _.isArray(vendorId)) { this.vidPidPairs = vendorId; } else { this.vidPidPairs = [{vendorId: vendorId, productId: productId}]; } }
[ "function", "UsbDeviceLoader", "(", "Device", ",", "vendorId", ",", "productId", ")", "{", "// call super class", "DeviceLoader", ".", "call", "(", "this", ")", ";", "this", ".", "Device", "=", "Device", ";", "this", ".", "vidPidPairs", "=", "[", "]", ";",...
A usbdeviceloader can check if there are available some serial devices. @param {Object} Device Device The constructor function of the device. @param {Number || Array} vendorId The vendor id or an array of vid/pid pairs. @param {Number} productId The product id or optional.
[ "A", "usbdeviceloader", "can", "check", "if", "there", "are", "available", "some", "serial", "devices", "." ]
c0e20b799b5d3d7b5fbd8f0a3b8ab21c13fcad76
https://github.com/adrai/devicestack/blob/c0e20b799b5d3d7b5fbd8f0a3b8ab21c13fcad76/lib/usb/deviceloader.js#L13-L27
38,280
mkloubert/nativescript-xmlobjects
plugin/index.js
function () { var childNodes = this.nodes(); if (childNodes.length < 1) { return null; } var elementValue = ''; for (var i = 0; i < childNodes.length; i++) { var node = childNodes[i]; var valueToAdd; ...
javascript
function () { var childNodes = this.nodes(); if (childNodes.length < 1) { return null; } var elementValue = ''; for (var i = 0; i < childNodes.length; i++) { var node = childNodes[i]; var valueToAdd; ...
[ "function", "(", ")", "{", "var", "childNodes", "=", "this", ".", "nodes", "(", ")", ";", "if", "(", "childNodes", ".", "length", "<", "1", ")", "{", "return", "null", ";", "}", "var", "elementValue", "=", "''", ";", "for", "(", "var", "i", "=", ...
Gets the value of that element. @return {any} The value.
[ "Gets", "the", "value", "of", "that", "element", "." ]
8e75f9b4a28d0ac3a737021ade03130c9448a2fc
https://github.com/mkloubert/nativescript-xmlobjects/blob/8e75f9b4a28d0ac3a737021ade03130c9448a2fc/plugin/index.js#L485-L505
38,281
mkloubert/nativescript-xmlobjects
plugin/index.js
parse
function parse(xml, processNamespaces, angularSyntax) { var doc = new XDocument(); var errors = []; var elementStack = []; var currentContainer = function () { return elementStack.length > 0 ? elementStack[elementStack.length - 1] : doc; }; var xParser = new Xml.XmlParser(function (e) { ...
javascript
function parse(xml, processNamespaces, angularSyntax) { var doc = new XDocument(); var errors = []; var elementStack = []; var currentContainer = function () { return elementStack.length > 0 ? elementStack[elementStack.length - 1] : doc; }; var xParser = new Xml.XmlParser(function (e) { ...
[ "function", "parse", "(", "xml", ",", "processNamespaces", ",", "angularSyntax", ")", "{", "var", "doc", "=", "new", "XDocument", "(", ")", ";", "var", "errors", "=", "[", "]", ";", "var", "elementStack", "=", "[", "]", ";", "var", "currentContainer", ...
Parses an XML string. @param {String} xml The string to parse. @param {Boolean} [processNamespaces] Process namespaces or not. @param {Boolean} [angularSyntax] Handle Angular syntax or not. @return {XDocument} The new document. @throws Parse error.
[ "Parses", "an", "XML", "string", "." ]
8e75f9b4a28d0ac3a737021ade03130c9448a2fc
https://github.com/mkloubert/nativescript-xmlobjects/blob/8e75f9b4a28d0ac3a737021ade03130c9448a2fc/plugin/index.js#L583-L637
38,282
Losant/bravado-core
lib/entity.js
function(options) { options = options || {}; this.type = options.type; this.body = options.body; this.actions = options.actions; this.links = options.links; this.embedded = options.embedded; }
javascript
function(options) { options = options || {}; this.type = options.type; this.body = options.body; this.actions = options.actions; this.links = options.links; this.embedded = options.embedded; }
[ "function", "(", "options", ")", "{", "options", "=", "options", "||", "{", "}", ";", "this", ".", "type", "=", "options", ".", "type", ";", "this", ".", "body", "=", "options", ".", "body", ";", "this", ".", "actions", "=", "options", ".", "action...
Object that represents an entity returned by a resource's action
[ "Object", "that", "represents", "an", "entity", "returned", "by", "a", "resource", "s", "action" ]
df152017e0aff9e575c1f7beaf4ddbb9cd346a7c
https://github.com/Losant/bravado-core/blob/df152017e0aff9e575c1f7beaf4ddbb9cd346a7c/lib/entity.js#L33-L40
38,283
ibm-watson-data-lab/--deprecated--pipes-sdk
lib/storage/pipeStorage.js
outboundPayload
function outboundPayload( pipe ){ //Clone first var result = JSON.parse(JSON.stringify( pipe ) ); if ( result.hasOwnProperty("tables")){ //Filtered down the table object as the info it contains is too big to be transported back and forth result.tables = _.map( result.tables, function( table ){ var ret = { nam...
javascript
function outboundPayload( pipe ){ //Clone first var result = JSON.parse(JSON.stringify( pipe ) ); if ( result.hasOwnProperty("tables")){ //Filtered down the table object as the info it contains is too big to be transported back and forth result.tables = _.map( result.tables, function( table ){ var ret = { nam...
[ "function", "outboundPayload", "(", "pipe", ")", "{", "//Clone first", "var", "result", "=", "JSON", ".", "parse", "(", "JSON", ".", "stringify", "(", "pipe", ")", ")", ";", "if", "(", "result", ".", "hasOwnProperty", "(", "\"tables\"", ")", ")", "{", ...
Return a filtered down version of the pipe for outbound purposes @param pipe
[ "Return", "a", "filtered", "down", "version", "of", "the", "pipe", "for", "outbound", "purposes" ]
b5cbf238d8d2c6a852f1712eed7dcfabeebfdb25
https://github.com/ibm-watson-data-lab/--deprecated--pipes-sdk/blob/b5cbf238d8d2c6a852f1712eed7dcfabeebfdb25/lib/storage/pipeStorage.js#L204-L225
38,284
ibm-watson-data-lab/--deprecated--pipes-sdk
lib/storage/pipeStorage.js
inboundPayload
function inboundPayload( storedPipe, pipe ){ if ( storedPipe && storedPipe.hasOwnProperty( "tables" ) ){ pipe.tables = storedPipe.tables; } if ( !pipe.hasOwnProperty("sf") ){ if ( storedPipe && storedPipe.hasOwnProperty( "sf" ) ){ pipe.sf = storedPipe.sf; } } return pipe; }
javascript
function inboundPayload( storedPipe, pipe ){ if ( storedPipe && storedPipe.hasOwnProperty( "tables" ) ){ pipe.tables = storedPipe.tables; } if ( !pipe.hasOwnProperty("sf") ){ if ( storedPipe && storedPipe.hasOwnProperty( "sf" ) ){ pipe.sf = storedPipe.sf; } } return pipe; }
[ "function", "inboundPayload", "(", "storedPipe", ",", "pipe", ")", "{", "if", "(", "storedPipe", "&&", "storedPipe", ".", "hasOwnProperty", "(", "\"tables\"", ")", ")", "{", "pipe", ".", "tables", "=", "storedPipe", ".", "tables", ";", "}", "if", "(", "!...
Merge the pipe with the stored value, restoring any fields that have been filtered during outbound
[ "Merge", "the", "pipe", "with", "the", "stored", "value", "restoring", "any", "fields", "that", "have", "been", "filtered", "during", "outbound" ]
b5cbf238d8d2c6a852f1712eed7dcfabeebfdb25
https://github.com/ibm-watson-data-lab/--deprecated--pipes-sdk/blob/b5cbf238d8d2c6a852f1712eed7dcfabeebfdb25/lib/storage/pipeStorage.js#L230-L241
38,285
fuzhenn/maptalks-jsdoc
publish.js
mergeClassOptions
function mergeClassOptions(classes, clazz) { if (!clazz || !clazz.length) { return; } clazz = clazz[0]; var merged = []; var propChecked = {}; var clazzChecking = clazz; while (clazzChecking) { //find class's options var filtere...
javascript
function mergeClassOptions(classes, clazz) { if (!clazz || !clazz.length) { return; } clazz = clazz[0]; var merged = []; var propChecked = {}; var clazzChecking = clazz; while (clazzChecking) { //find class's options var filtere...
[ "function", "mergeClassOptions", "(", "classes", ",", "clazz", ")", "{", "if", "(", "!", "clazz", "||", "!", "clazz", ".", "length", ")", "{", "return", ";", "}", "clazz", "=", "clazz", "[", "0", "]", ";", "var", "merged", "=", "[", "]", ";", "va...
merge class's options with its parent classes recursively
[ "merge", "class", "s", "options", "with", "its", "parent", "classes", "recursively" ]
a3a6adfcaa77ee2eaeb2cbc063b1ad6545a8b5ea
https://github.com/fuzhenn/maptalks-jsdoc/blob/a3a6adfcaa77ee2eaeb2cbc063b1ad6545a8b5ea/publish.js#L740-L780
38,286
adrai/devicestack
lib/serial/device.js
SerialDevice
function SerialDevice(port, settings, Connection) { // call super class Device.call(this, Connection); this.set('portName', port); this.set('settings', settings); this.set('state', 'close'); }
javascript
function SerialDevice(port, settings, Connection) { // call super class Device.call(this, Connection); this.set('portName', port); this.set('settings', settings); this.set('state', 'close'); }
[ "function", "SerialDevice", "(", "port", ",", "settings", ",", "Connection", ")", "{", "// call super class", "Device", ".", "call", "(", "this", ",", "Connection", ")", ";", "this", ".", "set", "(", "'portName'", ",", "port", ")", ";", "this", ".", "set...
SerialDevice represents your physical device. Extends Device. @param {string} port The Com Port path or name for Windows. @param {Object} settings The Com Port Settings. @param {Object} Connection The constructor function of the connection.
[ "SerialDevice", "represents", "your", "physical", "device", ".", "Extends", "Device", "." ]
c0e20b799b5d3d7b5fbd8f0a3b8ab21c13fcad76
https://github.com/adrai/devicestack/blob/c0e20b799b5d3d7b5fbd8f0a3b8ab21c13fcad76/lib/serial/device.js#L15-L24
38,287
marcello3d/node-safestart
git_dependency_match.js
dependencyMatch
function dependencyMatch (expected, actual) { // expand github:user/repo#hash to git://github.com/... if (expected.indexOf('github:') === 0) { expected = expected.replace(/^github:/, 'git://github.com/') var parsed = url.parse(expected) parsed.pathname += '.git' expected = url.format(parsed) } ...
javascript
function dependencyMatch (expected, actual) { // expand github:user/repo#hash to git://github.com/... if (expected.indexOf('github:') === 0) { expected = expected.replace(/^github:/, 'git://github.com/') var parsed = url.parse(expected) parsed.pathname += '.git' expected = url.format(parsed) } ...
[ "function", "dependencyMatch", "(", "expected", ",", "actual", ")", "{", "// expand github:user/repo#hash to git://github.com/...", "if", "(", "expected", ".", "indexOf", "(", "'github:'", ")", "===", "0", ")", "{", "expected", "=", "expected", ".", "replace", "("...
dependency match git urls
[ "dependency", "match", "git", "urls" ]
357b95a6ce73d0da3f65caddda633d56df11621c
https://github.com/marcello3d/node-safestart/blob/357b95a6ce73d0da3f65caddda633d56df11621c/git_dependency_match.js#L5-L33
38,288
switer/Zect
lib/compiler.js
_watch
function _watch(vm, vars, update) { var watchKeys = [] function _handler (kp) { if (watchKeys.some(function(key) { if (_relative(kp, key)) { return true } })) update.apply(null, arguments) } if (vars && vars.length) { vars.forEach(function...
javascript
function _watch(vm, vars, update) { var watchKeys = [] function _handler (kp) { if (watchKeys.some(function(key) { if (_relative(kp, key)) { return true } })) update.apply(null, arguments) } if (vars && vars.length) { vars.forEach(function...
[ "function", "_watch", "(", "vm", ",", "vars", ",", "update", ")", "{", "var", "watchKeys", "=", "[", "]", "function", "_handler", "(", "kp", ")", "{", "if", "(", "watchKeys", ".", "some", "(", "function", "(", "key", ")", "{", "if", "(", "_relative...
watch changes of variable-name of keypath @return <Function> unwatch
[ "watch", "changes", "of", "variable", "-", "name", "of", "keypath" ]
88b92d62d5000d999c3043e6379790f79608bdfa
https://github.com/switer/Zect/blob/88b92d62d5000d999c3043e6379790f79608bdfa/lib/compiler.js#L24-L46
38,289
seancheung/kuconfig
lib/array.js
$asce
function $asce(params) { if (Array.isArray(params) && params.every(p => typeof p === 'number')) { return params.sort((a, b) => a - b); } throw new Error('$asce expects an array of number'); }
javascript
function $asce(params) { if (Array.isArray(params) && params.every(p => typeof p === 'number')) { return params.sort((a, b) => a - b); } throw new Error('$asce expects an array of number'); }
[ "function", "$asce", "(", "params", ")", "{", "if", "(", "Array", ".", "isArray", "(", "params", ")", "&&", "params", ".", "every", "(", "p", "=>", "typeof", "p", "===", "'number'", ")", ")", "{", "return", "params", ".", "sort", "(", "(", "a", "...
Sort the numbers in ascending order @param {number[]} params @returns {number[]}
[ "Sort", "the", "numbers", "in", "ascending", "order" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/array.js#L7-L12
38,290
seancheung/kuconfig
lib/array.js
$rand
function $rand(params) { if (Array.isArray(params)) { return params[Math.floor(Math.random() * params.length)]; } throw new Error('$rand expects an array'); }
javascript
function $rand(params) { if (Array.isArray(params)) { return params[Math.floor(Math.random() * params.length)]; } throw new Error('$rand expects an array'); }
[ "function", "$rand", "(", "params", ")", "{", "if", "(", "Array", ".", "isArray", "(", "params", ")", ")", "{", "return", "params", "[", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "params", ".", "length", ")", "]", ";", "}",...
Return an element at random index @param {any[]} params @returns {any}
[ "Return", "an", "element", "at", "random", "index" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/array.js#L33-L38
38,291
seancheung/kuconfig
lib/array.js
$rands
function $rands(params) { if ( Array.isArray(params) && params.length === 2 && Array.isArray(params[0]) && typeof params[1] === 'number' ) { return Array(params[1]) .fill() .map(() => params[0].splice( Math.floor...
javascript
function $rands(params) { if ( Array.isArray(params) && params.length === 2 && Array.isArray(params[0]) && typeof params[1] === 'number' ) { return Array(params[1]) .fill() .map(() => params[0].splice( Math.floor...
[ "function", "$rands", "(", "params", ")", "{", "if", "(", "Array", ".", "isArray", "(", "params", ")", "&&", "params", ".", "length", "===", "2", "&&", "Array", ".", "isArray", "(", "params", "[", "0", "]", ")", "&&", "typeof", "params", "[", "1", ...
Return the given amount of elements at random indices @param {[any[], number]} params @returns {any[]}
[ "Return", "the", "given", "amount", "of", "elements", "at", "random", "indices" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/array.js#L46-L65
38,292
seancheung/kuconfig
lib/array.js
$slice
function $slice(params) { if ( Array.isArray(params) && (params.length === 2 || params.length === 3) && Array.isArray(params[0]) && typeof params[1] === 'number' && (params[2] === undefined || typeof params[2] === 'number') ) { return params[0].slice(params[1], pa...
javascript
function $slice(params) { if ( Array.isArray(params) && (params.length === 2 || params.length === 3) && Array.isArray(params[0]) && typeof params[1] === 'number' && (params[2] === undefined || typeof params[2] === 'number') ) { return params[0].slice(params[1], pa...
[ "function", "$slice", "(", "params", ")", "{", "if", "(", "Array", ".", "isArray", "(", "params", ")", "&&", "(", "params", ".", "length", "===", "2", "||", "params", ".", "length", "===", "3", ")", "&&", "Array", ".", "isArray", "(", "params", "["...
Slice an array from the given index to an optional end index @param {[any[], number]|[any[], number, number]} params @returns {any[]}
[ "Slice", "an", "array", "from", "the", "given", "index", "to", "an", "optional", "end", "index" ]
eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead
https://github.com/seancheung/kuconfig/blob/eb0de1920c8fcc7b9a28dceceadc87ecaa5a2ead/lib/array.js#L86-L99
38,293
amida-tech/blue-button-cms
lib/sections/vitals.js
getVitalUnits
function getVitalUnits(vitalType) { /*for height and weight, you need some kind of realistic numberical evaluator to determine the weight and height units */ if (vitalType.toLowerCase() === 'blood pressure') { return 'mm[Hg]'; } else if (vitalType.toLowerCase().indexOf('glucose') >= 0) { ...
javascript
function getVitalUnits(vitalType) { /*for height and weight, you need some kind of realistic numberical evaluator to determine the weight and height units */ if (vitalType.toLowerCase() === 'blood pressure') { return 'mm[Hg]'; } else if (vitalType.toLowerCase().indexOf('glucose') >= 0) { ...
[ "function", "getVitalUnits", "(", "vitalType", ")", "{", "/*for height and weight, you need some kind of realistic numberical evaluator to\n determine the weight and height units */", "if", "(", "vitalType", ".", "toLowerCase", "(", ")", "===", "'blood pressure'", ")", "{", "...
this needs to be a more complex function that can correctly analyze what type of units it is. Also should be given the value as well later.
[ "this", "needs", "to", "be", "a", "more", "complex", "function", "that", "can", "correctly", "analyze", "what", "type", "of", "units", "it", "is", ".", "Also", "should", "be", "given", "the", "value", "as", "well", "later", "." ]
749b8cf071910b22f8176a9ed8fc3b05062e1aad
https://github.com/amida-tech/blue-button-cms/blob/749b8cf071910b22f8176a9ed8fc3b05062e1aad/lib/sections/vitals.js#L10-L24
38,294
chemicstry/modular-json-rpc
dist/RPCNode.js
applyMixins
function applyMixins(derivedCtor, baseCtors) { baseCtors.forEach(baseCtor => { Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => { if (name !== 'constructor') { derivedCtor.prototype[name] = baseCtor.prototype[name]; } }); }); }
javascript
function applyMixins(derivedCtor, baseCtors) { baseCtors.forEach(baseCtor => { Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => { if (name !== 'constructor') { derivedCtor.prototype[name] = baseCtor.prototype[name]; } }); }); }
[ "function", "applyMixins", "(", "derivedCtor", ",", "baseCtors", ")", "{", "baseCtors", ".", "forEach", "(", "baseCtor", "=>", "{", "Object", ".", "getOwnPropertyNames", "(", "baseCtor", ".", "prototype", ")", ".", "forEach", "(", "name", "=>", "{", "if", ...
Hack for multiple inheritance
[ "Hack", "for", "multiple", "inheritance" ]
7ffa945fbc3a508df39e160a0342911b2a260d8c
https://github.com/chemicstry/modular-json-rpc/blob/7ffa945fbc3a508df39e160a0342911b2a260d8c/dist/RPCNode.js#L17-L25
38,295
jonschlinkert/file-stat
index.js
stat
function stat(file, cb) { utils.fileExists(file); utils.fs.stat(file.path, function(err, stat) { if (err) { file.stat = null; cb(err, file); return; } file.stat = stat; cb(null, file); }); }
javascript
function stat(file, cb) { utils.fileExists(file); utils.fs.stat(file.path, function(err, stat) { if (err) { file.stat = null; cb(err, file); return; } file.stat = stat; cb(null, file); }); }
[ "function", "stat", "(", "file", ",", "cb", ")", "{", "utils", ".", "fileExists", "(", "file", ")", ";", "utils", ".", "fs", ".", "stat", "(", "file", ".", "path", ",", "function", "(", "err", ",", "stat", ")", "{", "if", "(", "err", ")", "{", ...
Asynchronously add a `stat` property from `fs.stat` to the given file object. ```js var File = require('vinyl'); var stats = require('{%= name %}'); stats.stat(new File({path: 'README.md'}), function(err, file) { console.log(file.stat.isFile()); //=> true }); ``` @name .stat @param {Object} `file` File object @param {...
[ "Asynchronously", "add", "a", "stat", "property", "from", "fs", ".", "stat", "to", "the", "given", "file", "object", "." ]
d10c0d7cddd5af5edbbeb740fd5cf3cab4dd3688
https://github.com/jonschlinkert/file-stat/blob/d10c0d7cddd5af5edbbeb740fd5cf3cab4dd3688/index.js#L28-L39
38,296
jonschlinkert/file-stat
index.js
statSync
function statSync(file) { utils.fileExists(file); Object.defineProperty(file, 'stat', { configurable: true, set: function(val) { file._stat = val; }, get: function() { if (file._stat) { return file._stat; } if (this.exists) { file._stat = utils.fs.statSync(thi...
javascript
function statSync(file) { utils.fileExists(file); Object.defineProperty(file, 'stat', { configurable: true, set: function(val) { file._stat = val; }, get: function() { if (file._stat) { return file._stat; } if (this.exists) { file._stat = utils.fs.statSync(thi...
[ "function", "statSync", "(", "file", ")", "{", "utils", ".", "fileExists", "(", "file", ")", ";", "Object", ".", "defineProperty", "(", "file", ",", "'stat'", ",", "{", "configurable", ":", "true", ",", "set", ":", "function", "(", "val", ")", "{", "...
Synchronously add a `stat` property from `fs.stat` to the given file object. ```js var File = require('vinyl'); var stats = require('{%= name %}'); var file = new File({path: 'README.md'}); stats.statSync(file); console.log(file.stat.isFile()); //=> true ``` @name .statSync @param {Object} `file` File object @param {F...
[ "Synchronously", "add", "a", "stat", "property", "from", "fs", ".", "stat", "to", "the", "given", "file", "object", "." ]
d10c0d7cddd5af5edbbeb740fd5cf3cab4dd3688
https://github.com/jonschlinkert/file-stat/blob/d10c0d7cddd5af5edbbeb740fd5cf3cab4dd3688/index.js#L90-L108
38,297
jonschlinkert/file-stat
index.js
lstatSync
function lstatSync(file) { utils.fileExists(file); Object.defineProperty(file, 'lstat', { configurable: true, set: function(val) { file._lstat = val; }, get: function() { if (file._lstat) { return file._lstat; } if (this.exists) { file._lstat = utils.fs.lstatS...
javascript
function lstatSync(file) { utils.fileExists(file); Object.defineProperty(file, 'lstat', { configurable: true, set: function(val) { file._lstat = val; }, get: function() { if (file._lstat) { return file._lstat; } if (this.exists) { file._lstat = utils.fs.lstatS...
[ "function", "lstatSync", "(", "file", ")", "{", "utils", ".", "fileExists", "(", "file", ")", ";", "Object", ".", "defineProperty", "(", "file", ",", "'lstat'", ",", "{", "configurable", ":", "true", ",", "set", ":", "function", "(", "val", ")", "{", ...
Synchronously add a `lstat` property from `fs.lstat` to the given file object. ```js var File = require('vinyl'); var stats = require('{%= name %}'); var file = new File({path: 'README.md'}); stats.statSync(file); console.log(file.lstat.isFile()); //=> true ``` @name .lstatSync @param {Object} `file` File object @para...
[ "Synchronously", "add", "a", "lstat", "property", "from", "fs", ".", "lstat", "to", "the", "given", "file", "object", "." ]
d10c0d7cddd5af5edbbeb740fd5cf3cab4dd3688
https://github.com/jonschlinkert/file-stat/blob/d10c0d7cddd5af5edbbeb740fd5cf3cab4dd3688/index.js#L127-L145
38,298
amida-tech/blue-button-cms
lib/cmsObjConverter.js
cleanUpModel
function cleanUpModel(bbDocumentModel) { var x; for (x in bbDocumentModel) { if (Object.keys(bbDocumentModel[x]).length === 0) { delete bbDocumentModel[x]; } } var data = bbDocumentModel.data; for (x in data) { if (Object.keys(data[x]).length === 0) { ...
javascript
function cleanUpModel(bbDocumentModel) { var x; for (x in bbDocumentModel) { if (Object.keys(bbDocumentModel[x]).length === 0) { delete bbDocumentModel[x]; } } var data = bbDocumentModel.data; for (x in data) { if (Object.keys(data[x]).length === 0) { ...
[ "function", "cleanUpModel", "(", "bbDocumentModel", ")", "{", "var", "x", ";", "for", "(", "x", "in", "bbDocumentModel", ")", "{", "if", "(", "Object", ".", "keys", "(", "bbDocumentModel", "[", "x", "]", ")", ".", "length", "===", "0", ")", "{", "del...
Intermediate JSON is the initially converted JSON model from raw data, convert model based on
[ "Intermediate", "JSON", "is", "the", "initially", "converted", "JSON", "model", "from", "raw", "data", "convert", "model", "based", "on" ]
749b8cf071910b22f8176a9ed8fc3b05062e1aad
https://github.com/amida-tech/blue-button-cms/blob/749b8cf071910b22f8176a9ed8fc3b05062e1aad/lib/cmsObjConverter.js#L52-L65
38,299
crysalead-js/dom-layer
src/node/tag.js
Tag
function Tag(tagName, config, children) { this.tagName = tagName || 'div'; config = config || {}; this.children = children || []; this.props = config.props; this.attrs = config.attrs; this.attrsNS = config.attrsNS; this.events = config.events; this.hooks = config.hooks; this.data = config.data; this...
javascript
function Tag(tagName, config, children) { this.tagName = tagName || 'div'; config = config || {}; this.children = children || []; this.props = config.props; this.attrs = config.attrs; this.attrsNS = config.attrsNS; this.events = config.events; this.hooks = config.hooks; this.data = config.data; this...
[ "function", "Tag", "(", "tagName", ",", "config", ",", "children", ")", "{", "this", ".", "tagName", "=", "tagName", "||", "'div'", ";", "config", "=", "config", "||", "{", "}", ";", "this", ".", "children", "=", "children", "||", "[", "]", ";", "t...
The Virtual Tag constructor. @param String tagName The tag name. @param Object config The virtual node definition. @param Array children An array for children.
[ "The", "Virtual", "Tag", "constructor", "." ]
0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2
https://github.com/crysalead-js/dom-layer/blob/0c3509fe1b6c4cd2ce0c030b73791f951f5f97a2/src/node/tag.js#L19-L37