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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
47,000 | mkay581/build-tools | src/copy.js | copyFileIntoDirectory | function copyFileIntoDirectory(srcPath, destPath) {
return ensureDestinationDirectory(destPath).then(function () {
return new Promise(function (resolve, reject) {
fs.readFile(srcPath, 'utf8', function (err, contents) {
if (!err) {
resolve()... | javascript | function copyFileIntoDirectory(srcPath, destPath) {
return ensureDestinationDirectory(destPath).then(function () {
return new Promise(function (resolve, reject) {
fs.readFile(srcPath, 'utf8', function (err, contents) {
if (!err) {
resolve()... | [
"function",
"copyFileIntoDirectory",
"(",
"srcPath",
",",
"destPath",
")",
"{",
"return",
"ensureDestinationDirectory",
"(",
"destPath",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject... | Copies a file into a directory.
@param {String} srcPath - source path
@param {String} destPath - destination path
@returns {Promise} Returns a promise when completed | [
"Copies",
"a",
"file",
"into",
"a",
"directory",
"."
] | 005cb840b5db017a33597a8d44d941d156a7a000 | https://github.com/mkay581/build-tools/blob/005cb840b5db017a33597a8d44d941d156a7a000/src/copy.js#L46-L65 |
47,001 | mkay581/build-tools | src/copy.js | copyFile | function copyFile(srcPath, destPath) {
let srcFileInfo = path.parse(srcPath) || {};
if (!path.extname(destPath) && srcFileInfo.ext) {
// destination is a directory!
return copyFileIntoDirectory(srcPath, destPath);
} else {
return new Promise(function (resolve,... | javascript | function copyFile(srcPath, destPath) {
let srcFileInfo = path.parse(srcPath) || {};
if (!path.extname(destPath) && srcFileInfo.ext) {
// destination is a directory!
return copyFileIntoDirectory(srcPath, destPath);
} else {
return new Promise(function (resolve,... | [
"function",
"copyFile",
"(",
"srcPath",
",",
"destPath",
")",
"{",
"let",
"srcFileInfo",
"=",
"path",
".",
"parse",
"(",
"srcPath",
")",
"||",
"{",
"}",
";",
"if",
"(",
"!",
"path",
".",
"extname",
"(",
"destPath",
")",
"&&",
"srcFileInfo",
".",
"ext... | Copies one path to another one.
@param {String} srcPath - source path
@param {String} destPath - destination path
@returns {Promise} Returns a promise when done | [
"Copies",
"one",
"path",
"to",
"another",
"one",
"."
] | 005cb840b5db017a33597a8d44d941d156a7a000 | https://github.com/mkay581/build-tools/blob/005cb840b5db017a33597a8d44d941d156a7a000/src/copy.js#L73-L89 |
47,002 | mkay581/build-tools | src/copy.js | getSourceDestinationPath | function getSourceDestinationPath (srcPath) {
let dests = _.keys(options.files);
return _.find(dests, function (destPath) {
let paths = options.files[destPath];
return _.find(paths, function (p) {
return p === srcPath || srcPath.indexOf(p) !== -1;
});
... | javascript | function getSourceDestinationPath (srcPath) {
let dests = _.keys(options.files);
return _.find(dests, function (destPath) {
let paths = options.files[destPath];
return _.find(paths, function (p) {
return p === srcPath || srcPath.indexOf(p) !== -1;
});
... | [
"function",
"getSourceDestinationPath",
"(",
"srcPath",
")",
"{",
"let",
"dests",
"=",
"_",
".",
"keys",
"(",
"options",
".",
"files",
")",
";",
"return",
"_",
".",
"find",
"(",
"dests",
",",
"function",
"(",
"destPath",
")",
"{",
"let",
"paths",
"=",
... | Gets the destination path for a source file.
@param srcPath
@returns {string} Returns the matching destination path | [
"Gets",
"the",
"destination",
"path",
"for",
"a",
"source",
"file",
"."
] | 005cb840b5db017a33597a8d44d941d156a7a000 | https://github.com/mkay581/build-tools/blob/005cb840b5db017a33597a8d44d941d156a7a000/src/copy.js#L96-L104 |
47,003 | andrewfhart/openassets | lib/protocol/ColoringEngine.js | function (tx) {
var outs = [];
tx.outputs.forEach(function (o) {
outs.push(new TransactionOutput(o.satoshis,o.script.toBuffer()));
});
return outs;
} | javascript | function (tx) {
var outs = [];
tx.outputs.forEach(function (o) {
outs.push(new TransactionOutput(o.satoshis,o.script.toBuffer()));
});
return outs;
} | [
"function",
"(",
"tx",
")",
"{",
"var",
"outs",
"=",
"[",
"]",
";",
"tx",
".",
"outputs",
".",
"forEach",
"(",
"function",
"(",
"o",
")",
"{",
"outs",
".",
"push",
"(",
"new",
"TransactionOutput",
"(",
"o",
".",
"satoshis",
",",
"o",
".",
"script... | Helper function to make the appropriate response in the case where no valid asset ids were found in a transaction. In this case all of the transaction outputs are considered uncolored. | [
"Helper",
"function",
"to",
"make",
"the",
"appropriate",
"response",
"in",
"the",
"case",
"where",
"no",
"valid",
"asset",
"ids",
"were",
"found",
"in",
"a",
"transaction",
".",
"In",
"this",
"case",
"all",
"of",
"the",
"transaction",
"outputs",
"are",
"c... | e61f238e159ae5584d28bb2e911f2995c14d45e0 | https://github.com/andrewfhart/openassets/blob/e61f238e159ae5584d28bb2e911f2995c14d45e0/lib/protocol/ColoringEngine.js#L116-L122 | |
47,004 | greg-js/hexo-easy-edit | lib/edit.js | filterTitle | function filterTitle(posts) {
var reTitle = title.map(function makeRE(word) {
return new RegExp(word, 'i');
});
return posts.filter(function filterPosts(post) {
return reTitle.every(function checkRE(regex) {
return regex.test(post.title) || regex.test(post.slug);
});... | javascript | function filterTitle(posts) {
var reTitle = title.map(function makeRE(word) {
return new RegExp(word, 'i');
});
return posts.filter(function filterPosts(post) {
return reTitle.every(function checkRE(regex) {
return regex.test(post.title) || regex.test(post.slug);
});... | [
"function",
"filterTitle",
"(",
"posts",
")",
"{",
"var",
"reTitle",
"=",
"title",
".",
"map",
"(",
"function",
"makeRE",
"(",
"word",
")",
"{",
"return",
"new",
"RegExp",
"(",
"word",
",",
"'i'",
")",
";",
"}",
")",
";",
"return",
"posts",
".",
"f... | filter the posts with the supplied regular expression | [
"filter",
"the",
"posts",
"with",
"the",
"supplied",
"regular",
"expression"
] | a2686184de47bc0c8024f40816e637bb671b280f | https://github.com/greg-js/hexo-easy-edit/blob/a2686184de47bc0c8024f40816e637bb671b280f/lib/edit.js#L93-L103 |
47,005 | greg-js/hexo-easy-edit | lib/edit.js | filterFolder | function filterFolder(posts) {
var reFolder = new RegExp(folder);
return posts.filter(function filterPosts(post) {
return reFolder.test(post.source.substr(0, post.source.lastIndexOf(path.sep)));
});
} | javascript | function filterFolder(posts) {
var reFolder = new RegExp(folder);
return posts.filter(function filterPosts(post) {
return reFolder.test(post.source.substr(0, post.source.lastIndexOf(path.sep)));
});
} | [
"function",
"filterFolder",
"(",
"posts",
")",
"{",
"var",
"reFolder",
"=",
"new",
"RegExp",
"(",
"folder",
")",
";",
"return",
"posts",
".",
"filter",
"(",
"function",
"filterPosts",
"(",
"post",
")",
"{",
"return",
"reFolder",
".",
"test",
"(",
"post",... | filter the posts using a subfolder if supplied | [
"filter",
"the",
"posts",
"using",
"a",
"subfolder",
"if",
"supplied"
] | a2686184de47bc0c8024f40816e637bb671b280f | https://github.com/greg-js/hexo-easy-edit/blob/a2686184de47bc0c8024f40816e637bb671b280f/lib/edit.js#L106-L111 |
47,006 | greg-js/hexo-easy-edit | lib/edit.js | filterTag | function filterTag(posts) {
var reTag = new RegExp(tag);
return posts.filter(function filterPosts(post) {
return post.tags.data.some(function checkRe(postTag) {
return reTag.test(postTag.name);
});
});
} | javascript | function filterTag(posts) {
var reTag = new RegExp(tag);
return posts.filter(function filterPosts(post) {
return post.tags.data.some(function checkRe(postTag) {
return reTag.test(postTag.name);
});
});
} | [
"function",
"filterTag",
"(",
"posts",
")",
"{",
"var",
"reTag",
"=",
"new",
"RegExp",
"(",
"tag",
")",
";",
"return",
"posts",
".",
"filter",
"(",
"function",
"filterPosts",
"(",
"post",
")",
"{",
"return",
"post",
".",
"tags",
".",
"data",
".",
"so... | filter the posts using a tag if supplied | [
"filter",
"the",
"posts",
"using",
"a",
"tag",
"if",
"supplied"
] | a2686184de47bc0c8024f40816e637bb671b280f | https://github.com/greg-js/hexo-easy-edit/blob/a2686184de47bc0c8024f40816e637bb671b280f/lib/edit.js#L114-L121 |
47,007 | greg-js/hexo-easy-edit | lib/edit.js | filterCategory | function filterCategory(posts) {
var reCat = new RegExp(cat);
return posts.filter(function filterPosts(post) {
return post.categories.data.some(function checkRe(postCat) {
return reCat.test(postCat.name);
});
});
} | javascript | function filterCategory(posts) {
var reCat = new RegExp(cat);
return posts.filter(function filterPosts(post) {
return post.categories.data.some(function checkRe(postCat) {
return reCat.test(postCat.name);
});
});
} | [
"function",
"filterCategory",
"(",
"posts",
")",
"{",
"var",
"reCat",
"=",
"new",
"RegExp",
"(",
"cat",
")",
";",
"return",
"posts",
".",
"filter",
"(",
"function",
"filterPosts",
"(",
"post",
")",
"{",
"return",
"post",
".",
"categories",
".",
"data",
... | filter the posts using a category if supplied | [
"filter",
"the",
"posts",
"using",
"a",
"category",
"if",
"supplied"
] | a2686184de47bc0c8024f40816e637bb671b280f | https://github.com/greg-js/hexo-easy-edit/blob/a2686184de47bc0c8024f40816e637bb671b280f/lib/edit.js#L124-L131 |
47,008 | greg-js/hexo-easy-edit | lib/edit.js | filterLayout | function filterLayout(posts) {
var reLayout = new RegExp(layout, 'i');
return posts.filter(function filterPosts(post) {
return reLayout.test(post.layout);
});
} | javascript | function filterLayout(posts) {
var reLayout = new RegExp(layout, 'i');
return posts.filter(function filterPosts(post) {
return reLayout.test(post.layout);
});
} | [
"function",
"filterLayout",
"(",
"posts",
")",
"{",
"var",
"reLayout",
"=",
"new",
"RegExp",
"(",
"layout",
",",
"'i'",
")",
";",
"return",
"posts",
".",
"filter",
"(",
"function",
"filterPosts",
"(",
"post",
")",
"{",
"return",
"reLayout",
".",
"test",
... | filter the posts using a layout if supplied | [
"filter",
"the",
"posts",
"using",
"a",
"layout",
"if",
"supplied"
] | a2686184de47bc0c8024f40816e637bb671b280f | https://github.com/greg-js/hexo-easy-edit/blob/a2686184de47bc0c8024f40816e637bb671b280f/lib/edit.js#L134-L140 |
47,009 | greg-js/hexo-easy-edit | lib/edit.js | filterBefore | function filterBefore(posts) {
before = moment(before.replace(/\//g, '-'), 'MM-DD-YYYY', true);
if (!before.isValid()) {
console.log(chalk.red('Before date is not valid (expecting `MM-DD-YYYY`), ignoring argument.'));
return posts;
}
return posts.filter(function filterPosts(post... | javascript | function filterBefore(posts) {
before = moment(before.replace(/\//g, '-'), 'MM-DD-YYYY', true);
if (!before.isValid()) {
console.log(chalk.red('Before date is not valid (expecting `MM-DD-YYYY`), ignoring argument.'));
return posts;
}
return posts.filter(function filterPosts(post... | [
"function",
"filterBefore",
"(",
"posts",
")",
"{",
"before",
"=",
"moment",
"(",
"before",
".",
"replace",
"(",
"/",
"\\/",
"/",
"g",
",",
"'-'",
")",
",",
"'MM-DD-YYYY'",
",",
"true",
")",
";",
"if",
"(",
"!",
"before",
".",
"isValid",
"(",
")",
... | filter the posts using a before date if supplied | [
"filter",
"the",
"posts",
"using",
"a",
"before",
"date",
"if",
"supplied"
] | a2686184de47bc0c8024f40816e637bb671b280f | https://github.com/greg-js/hexo-easy-edit/blob/a2686184de47bc0c8024f40816e637bb671b280f/lib/edit.js#L150-L160 |
47,010 | greg-js/hexo-easy-edit | lib/edit.js | filterAfter | function filterAfter(posts) {
after = moment(after.replace(/\//g, '-'), 'MM-DD-YYYY', true);
if (!after.isValid()) {
console.log(chalk.red('After date is not valid (expecting `MM-DD-YYYY`), ignoring argument.'));
return posts;
}
return posts.filter(function filterPosts(post) {
... | javascript | function filterAfter(posts) {
after = moment(after.replace(/\//g, '-'), 'MM-DD-YYYY', true);
if (!after.isValid()) {
console.log(chalk.red('After date is not valid (expecting `MM-DD-YYYY`), ignoring argument.'));
return posts;
}
return posts.filter(function filterPosts(post) {
... | [
"function",
"filterAfter",
"(",
"posts",
")",
"{",
"after",
"=",
"moment",
"(",
"after",
".",
"replace",
"(",
"/",
"\\/",
"/",
"g",
",",
"'-'",
")",
",",
"'MM-DD-YYYY'",
",",
"true",
")",
";",
"if",
"(",
"!",
"after",
".",
"isValid",
"(",
")",
")... | filter the posts using an after date if supplied | [
"filter",
"the",
"posts",
"using",
"an",
"after",
"date",
"if",
"supplied"
] | a2686184de47bc0c8024f40816e637bb671b280f | https://github.com/greg-js/hexo-easy-edit/blob/a2686184de47bc0c8024f40816e637bb671b280f/lib/edit.js#L163-L173 |
47,011 | greg-js/hexo-easy-edit | lib/edit.js | openFile | function openFile(file) {
var edit;
if (!editor || gui) {
open(file);
} else {
edit = spawn(editor, [file], {stdio: 'inherit'});
edit.on('exit', process.exit);
}
} | javascript | function openFile(file) {
var edit;
if (!editor || gui) {
open(file);
} else {
edit = spawn(editor, [file], {stdio: 'inherit'});
edit.on('exit', process.exit);
}
} | [
"function",
"openFile",
"(",
"file",
")",
"{",
"var",
"edit",
";",
"if",
"(",
"!",
"editor",
"||",
"gui",
")",
"{",
"open",
"(",
"file",
")",
";",
"}",
"else",
"{",
"edit",
"=",
"spawn",
"(",
"editor",
",",
"[",
"file",
"]",
",",
"{",
"stdio",
... | spawn process and open with associated gui or terminal editor | [
"spawn",
"process",
"and",
"open",
"with",
"associated",
"gui",
"or",
"terminal",
"editor"
] | a2686184de47bc0c8024f40816e637bb671b280f | https://github.com/greg-js/hexo-easy-edit/blob/a2686184de47bc0c8024f40816e637bb671b280f/lib/edit.js#L176-L184 |
47,012 | porkchop/bitid-js | lib/bitid.js | Bitid | function Bitid(params) {
params = params || {};
var self = this;
this._nonce = params.nonce;
this.callback = url.parse(params.callback, true);
this.signature = params.signature;
this.address = params.address;
this.unsecure = params.unsecure;
this._uri = !params.uri ? buildURI() : url.parse(params.uri, ... | javascript | function Bitid(params) {
params = params || {};
var self = this;
this._nonce = params.nonce;
this.callback = url.parse(params.callback, true);
this.signature = params.signature;
this.address = params.address;
this.unsecure = params.unsecure;
this._uri = !params.uri ? buildURI() : url.parse(params.uri, ... | [
"function",
"Bitid",
"(",
"params",
")",
"{",
"params",
"=",
"params",
"||",
"{",
"}",
";",
"var",
"self",
"=",
"this",
";",
"this",
".",
"_nonce",
"=",
"params",
".",
"nonce",
";",
"this",
".",
"callback",
"=",
"url",
".",
"parse",
"(",
"params",
... | Initialize a new `Bitid` with the given `params`
@param {JSON} params
@api public | [
"Initialize",
"a",
"new",
"Bitid",
"with",
"the",
"given",
"params"
] | 994d468c624e6bc816a73cce108daa303eb09c4e | https://github.com/porkchop/bitid-js/blob/994d468c624e6bc816a73cce108daa303eb09c4e/lib/bitid.js#L32-L54 |
47,013 | mini-eggs/cra-babel-extend | src/index.js | getPresetsString | function getPresetsString(presetArray) {
if (!presetArray.includes("react-app")) {
presetArray.push("react-app");
}
return presetArray.map(attachRequestResolve("preset")).join(",");
} | javascript | function getPresetsString(presetArray) {
if (!presetArray.includes("react-app")) {
presetArray.push("react-app");
}
return presetArray.map(attachRequestResolve("preset")).join(",");
} | [
"function",
"getPresetsString",
"(",
"presetArray",
")",
"{",
"if",
"(",
"!",
"presetArray",
".",
"includes",
"(",
"\"react-app\"",
")",
")",
"{",
"presetArray",
".",
"push",
"(",
"\"react-app\"",
")",
";",
"}",
"return",
"presetArray",
".",
"map",
"(",
"a... | Build string to insert from presets array. | [
"Build",
"string",
"to",
"insert",
"from",
"presets",
"array",
"."
] | 39bce9a446f1fd380b661d787cab5928fa6ecc86 | https://github.com/mini-eggs/cra-babel-extend/blob/39bce9a446f1fd380b661d787cab5928fa6ecc86/src/index.js#L22-L27 |
47,014 | soajs/connect-mongo-soajs | lib/mongo.js | connect | function connect(obj, cb) {
if (obj.db) {
return cb();
}
if (obj.pending) {
return setImmediate(function () {
connect(obj, cb);
});
}
obj.pending = true;
var url = constructMongoLink(obj.config.name, obj.config.prefix, obj.config.servers, obj.config.URLParam,... | javascript | function connect(obj, cb) {
if (obj.db) {
return cb();
}
if (obj.pending) {
return setImmediate(function () {
connect(obj, cb);
});
}
obj.pending = true;
var url = constructMongoLink(obj.config.name, obj.config.prefix, obj.config.servers, obj.config.URLParam,... | [
"function",
"connect",
"(",
"obj",
",",
"cb",
")",
"{",
"if",
"(",
"obj",
".",
"db",
")",
"{",
"return",
"cb",
"(",
")",
";",
"}",
"if",
"(",
"obj",
".",
"pending",
")",
"{",
"return",
"setImmediate",
"(",
"function",
"(",
")",
"{",
"connect",
... | Ensure a connection to mongo without any race condition problem
@param {Object} obj
@param {Function} cb
@returns {*} | [
"Ensure",
"a",
"connection",
"to",
"mongo",
"without",
"any",
"race",
"condition",
"problem"
] | 27b7b0b0f25e75168857fd9d2be83cc07a0da868 | https://github.com/soajs/connect-mongo-soajs/blob/27b7b0b0f25e75168857fd9d2be83cc07a0da868/lib/mongo.js#L212-L285 |
47,015 | dtudury/discontinuous-range | index.js | _SubRange | function _SubRange(low, high) {
this.low = low;
this.high = high;
this.length = 1 + high - low;
} | javascript | function _SubRange(low, high) {
this.low = low;
this.high = high;
this.length = 1 + high - low;
} | [
"function",
"_SubRange",
"(",
"low",
",",
"high",
")",
"{",
"this",
".",
"low",
"=",
"low",
";",
"this",
".",
"high",
"=",
"high",
";",
"this",
".",
"length",
"=",
"1",
"+",
"high",
"-",
"low",
";",
"}"
] | protected helper class | [
"protected",
"helper",
"class"
] | 8c9a05039f09ad795fa7aea1da5e75fa3a6a949a | https://github.com/dtudury/discontinuous-range/blob/8c9a05039f09ad795fa7aea1da5e75fa3a6a949a/index.js#L2-L6 |
47,016 | makenova/nodeginx | nodeginx.js | manageNginx | function manageNginx (action, callback) {
// TODO: research if sending signals is better
// i.e. sudo nginx -s stop|quit|reload
exec(`sudo service nginx ${action}`, (err, stdout, stderr) => {
if (err) return callback(err)
return callback()
})
} | javascript | function manageNginx (action, callback) {
// TODO: research if sending signals is better
// i.e. sudo nginx -s stop|quit|reload
exec(`sudo service nginx ${action}`, (err, stdout, stderr) => {
if (err) return callback(err)
return callback()
})
} | [
"function",
"manageNginx",
"(",
"action",
",",
"callback",
")",
"{",
"// TODO: research if sending signals is better",
"// i.e. sudo nginx -s stop|quit|reload",
"exec",
"(",
"`",
"${",
"action",
"}",
"`",
",",
"(",
"err",
",",
"stdout",
",",
"stderr",
")",
"=>",
"... | Nginx process functions | [
"Nginx",
"process",
"functions"
] | 8c5d0c53780fbd4c94e4a15782f14cb0ab92498d | https://github.com/makenova/nodeginx/blob/8c5d0c53780fbd4c94e4a15782f14cb0ab92498d/nodeginx.js#L62-L69 |
47,017 | hkjels/ntask | lib/project.js | Project | function Project(path) {
path = path || PWD;
this.root = '';
this.storage = '';
this.ignore = [];
this.resolvePaths(path);
} | javascript | function Project(path) {
path = path || PWD;
this.root = '';
this.storage = '';
this.ignore = [];
this.resolvePaths(path);
} | [
"function",
"Project",
"(",
"path",
")",
"{",
"path",
"=",
"path",
"||",
"PWD",
";",
"this",
".",
"root",
"=",
"''",
";",
"this",
".",
"storage",
"=",
"''",
";",
"this",
".",
"ignore",
"=",
"[",
"]",
";",
"this",
".",
"resolvePaths",
"(",
"path",... | Locates & sets up project
Path is only needed for testing, usual case `pwd` by default
@param {String}
@api private | [
"Locates",
"&",
"sets",
"up",
"project",
"Path",
"is",
"only",
"needed",
"for",
"testing",
"usual",
"case",
"pwd",
"by",
"default"
] | e0552042e743ef9584bc0f911245635df7acd634 | https://github.com/hkjels/ntask/blob/e0552042e743ef9584bc0f911245635df7acd634/lib/project.js#L47-L53 |
47,018 | dpjanes/iotdb-homestar | bin/commands/install.js | function (module_name, module_folder) {
var module_path = path.resolve(module_folder);
// load current keystore
let keystored = {};
const filename = ".iotdb/keystore.json";
_.cfg.load.json([ filename ], docd => keystored = _.d.compose.deep(keystored, docd.doc));
// change it
_.d.set(keysto... | javascript | function (module_name, module_folder) {
var module_path = path.resolve(module_folder);
// load current keystore
let keystored = {};
const filename = ".iotdb/keystore.json";
_.cfg.load.json([ filename ], docd => keystored = _.d.compose.deep(keystored, docd.doc));
// change it
_.d.set(keysto... | [
"function",
"(",
"module_name",
",",
"module_folder",
")",
"{",
"var",
"module_path",
"=",
"path",
".",
"resolve",
"(",
"module_folder",
")",
";",
"// load current keystore",
"let",
"keystored",
"=",
"{",
"}",
";",
"const",
"filename",
"=",
"\".iotdb/keystore.js... | Add module info to the keystore | [
"Add",
"module",
"info",
"to",
"the",
"keystore"
] | ed6535aa17c8b0538f43a876c9a6025e26a389e3 | https://github.com/dpjanes/iotdb-homestar/blob/ed6535aa17c8b0538f43a876c9a6025e26a389e3/bin/commands/install.js#L217-L234 | |
47,019 | dpjanes/iotdb-homestar | bin/commands/install.js | function (module_name, module_folder) {
var iotdb_dir = path.join(process.cwd(), module_folder, "node_modules", "iotdb");
console.log("- cleanup");
console.log(" path:", iotdb_dir);
try {
_rmdirSync(iotdb_dir);
} catch (x) {
}
} | javascript | function (module_name, module_folder) {
var iotdb_dir = path.join(process.cwd(), module_folder, "node_modules", "iotdb");
console.log("- cleanup");
console.log(" path:", iotdb_dir);
try {
_rmdirSync(iotdb_dir);
} catch (x) {
}
} | [
"function",
"(",
"module_name",
",",
"module_folder",
")",
"{",
"var",
"iotdb_dir",
"=",
"path",
".",
"join",
"(",
"process",
".",
"cwd",
"(",
")",
",",
"module_folder",
",",
"\"node_modules\"",
",",
"\"iotdb\"",
")",
";",
"console",
".",
"log",
"(",
"\"... | We don't need to have many copies of IOTDB laying about | [
"We",
"don",
"t",
"need",
"to",
"have",
"many",
"copies",
"of",
"IOTDB",
"laying",
"about"
] | ed6535aa17c8b0538f43a876c9a6025e26a389e3 | https://github.com/dpjanes/iotdb-homestar/blob/ed6535aa17c8b0538f43a876c9a6025e26a389e3/bin/commands/install.js#L239-L248 | |
47,020 | dpjanes/iotdb-homestar | bin/commands/install.js | function (module_name, module_folder, callback) {
var module_folder = path.resolve(module_folder)
var module_packaged = _load_package(module_folder);
var module_dependencies = _.d.get(module_packaged, "/dependencies");
if (!module_dependencies) {
return callback();
}
module_dependencie... | javascript | function (module_name, module_folder, callback) {
var module_folder = path.resolve(module_folder)
var module_packaged = _load_package(module_folder);
var module_dependencies = _.d.get(module_packaged, "/dependencies");
if (!module_dependencies) {
return callback();
}
module_dependencie... | [
"function",
"(",
"module_name",
",",
"module_folder",
",",
"callback",
")",
"{",
"var",
"module_folder",
"=",
"path",
".",
"resolve",
"(",
"module_folder",
")",
"var",
"module_packaged",
"=",
"_load_package",
"(",
"module_folder",
")",
";",
"var",
"module_depend... | homestar.dependencies can allow more things to be installed into homestar,
essentially recursively | [
"homestar",
".",
"dependencies",
"can",
"allow",
"more",
"things",
"to",
"be",
"installed",
"into",
"homestar",
"essentially",
"recursively"
] | ed6535aa17c8b0538f43a876c9a6025e26a389e3 | https://github.com/dpjanes/iotdb-homestar/blob/ed6535aa17c8b0538f43a876c9a6025e26a389e3/bin/commands/install.js#L254-L293 | |
47,021 | dpjanes/iotdb-homestar | bin/commands/install.js | function() {
try {
var statbuf = fs.statSync(folder);
if (statbuf.isDirectory()) {
return;
}
}
catch (x) {
}
try {
fs.mkdirSync("node_modules");
} catch (x) {
}
statbuf = fs.statSync(folder);
if (statbuf.isDirectory()) {
return;
... | javascript | function() {
try {
var statbuf = fs.statSync(folder);
if (statbuf.isDirectory()) {
return;
}
}
catch (x) {
}
try {
fs.mkdirSync("node_modules");
} catch (x) {
}
statbuf = fs.statSync(folder);
if (statbuf.isDirectory()) {
return;
... | [
"function",
"(",
")",
"{",
"try",
"{",
"var",
"statbuf",
"=",
"fs",
".",
"statSync",
"(",
"folder",
")",
";",
"if",
"(",
"statbuf",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
";",
"}",
"}",
"catch",
"(",
"x",
")",
"{",
"}",
"try",
"{",
... | The node_modules directory always goes in the current directory
so that NPM doesn't start placing things in parent directories | [
"The",
"node_modules",
"directory",
"always",
"goes",
"in",
"the",
"current",
"directory",
"so",
"that",
"NPM",
"doesn",
"t",
"start",
"placing",
"things",
"in",
"parent",
"directories"
] | ed6535aa17c8b0538f43a876c9a6025e26a389e3 | https://github.com/dpjanes/iotdb-homestar/blob/ed6535aa17c8b0538f43a876c9a6025e26a389e3/bin/commands/install.js#L299-L318 | |
47,022 | creationix/git-node-fs | lib/node-fs.js | readFile | function readFile(path, callback) {
nodeFs.readFile(path, function (err, binary) {
if (err) {
if (err.code === "ENOENT") return callback();
return callback(err);
}
return callback(null, binary);
});
} | javascript | function readFile(path, callback) {
nodeFs.readFile(path, function (err, binary) {
if (err) {
if (err.code === "ENOENT") return callback();
return callback(err);
}
return callback(null, binary);
});
} | [
"function",
"readFile",
"(",
"path",
",",
"callback",
")",
"{",
"nodeFs",
".",
"readFile",
"(",
"path",
",",
"function",
"(",
"err",
",",
"binary",
")",
"{",
"if",
"(",
"err",
")",
"{",
"if",
"(",
"err",
".",
"code",
"===",
"\"ENOENT\"",
")",
"retu... | Reads all bytes for given path. => binary => undefined if file does not exist | [
"Reads",
"all",
"bytes",
"for",
"given",
"path",
".",
"=",
">",
"binary",
"=",
">",
"undefined",
"if",
"file",
"does",
"not",
"exist"
] | 7c691d7281b49b1be77426701c2bf0535e1abcc9 | https://github.com/creationix/git-node-fs/blob/7c691d7281b49b1be77426701c2bf0535e1abcc9/lib/node-fs.js#L17-L25 |
47,023 | creationix/git-node-fs | lib/node-fs.js | readChunk | function readChunk(path, start, end, callback) {
if (end < 0) {
return readLastChunk(path, start, end, callback);
}
var stream = nodeFs.createReadStream(path, {
start: start,
end: end - 1
});
var chunks = [];
stream.on("readable", function () {
var chunk = stream.read();
if (chunk === nu... | javascript | function readChunk(path, start, end, callback) {
if (end < 0) {
return readLastChunk(path, start, end, callback);
}
var stream = nodeFs.createReadStream(path, {
start: start,
end: end - 1
});
var chunks = [];
stream.on("readable", function () {
var chunk = stream.read();
if (chunk === nu... | [
"function",
"readChunk",
"(",
"path",
",",
"start",
",",
"end",
",",
"callback",
")",
"{",
"if",
"(",
"end",
"<",
"0",
")",
"{",
"return",
"readLastChunk",
"(",
"path",
",",
"start",
",",
"end",
",",
"callback",
")",
";",
"}",
"var",
"stream",
"=",... | Reads bytes from inclusive [start, end) exclusive for given path. => binary => undefined if file does not exist | [
"Reads",
"bytes",
"from",
"inclusive",
"[",
"start",
"end",
")",
"exclusive",
"for",
"given",
"path",
".",
"=",
">",
"binary",
"=",
">",
"undefined",
"if",
"file",
"does",
"not",
"exist"
] | 7c691d7281b49b1be77426701c2bf0535e1abcc9 | https://github.com/creationix/git-node-fs/blob/7c691d7281b49b1be77426701c2bf0535e1abcc9/lib/node-fs.js#L30-L48 |
47,024 | creationix/git-node-fs | lib/node-fs.js | readLastChunk | function readLastChunk(path, start, end, callback) {
nodeFs.open(path, "r", function (err, fd) {
if (err) {
if (err.code === "EACCES") return callback();
return callback(err);
}
var buffer = new Buffer(4096);
var length = 0;
read();
// Only the first read needs to seek.
// All ... | javascript | function readLastChunk(path, start, end, callback) {
nodeFs.open(path, "r", function (err, fd) {
if (err) {
if (err.code === "EACCES") return callback();
return callback(err);
}
var buffer = new Buffer(4096);
var length = 0;
read();
// Only the first read needs to seek.
// All ... | [
"function",
"readLastChunk",
"(",
"path",
",",
"start",
",",
"end",
",",
"callback",
")",
"{",
"nodeFs",
".",
"open",
"(",
"path",
",",
"\"r\"",
",",
"function",
"(",
"err",
",",
"fd",
")",
"{",
"if",
"(",
"err",
")",
"{",
"if",
"(",
"err",
".",
... | Node.js readable streams do not support reading from a position to the end of the file, but we can roll our own using the lower-level fs.open and fs.read on a file descriptor, which allows read to seek. | [
"Node",
".",
"js",
"readable",
"streams",
"do",
"not",
"support",
"reading",
"from",
"a",
"position",
"to",
"the",
"end",
"of",
"the",
"file",
"but",
"we",
"can",
"roll",
"our",
"own",
"using",
"the",
"lower",
"-",
"level",
"fs",
".",
"open",
"and",
... | 7c691d7281b49b1be77426701c2bf0535e1abcc9 | https://github.com/creationix/git-node-fs/blob/7c691d7281b49b1be77426701c2bf0535e1abcc9/lib/node-fs.js#L53-L88 |
47,025 | creationix/git-node-fs | lib/node-fs.js | writeFile | function writeFile(path, binary, callback) {
mkdirp(nodePath.dirname(path), function (err) {
if (err) return callback(err);
nodeFs.writeFile(path, binary, callback);
});
} | javascript | function writeFile(path, binary, callback) {
mkdirp(nodePath.dirname(path), function (err) {
if (err) return callback(err);
nodeFs.writeFile(path, binary, callback);
});
} | [
"function",
"writeFile",
"(",
"path",
",",
"binary",
",",
"callback",
")",
"{",
"mkdirp",
"(",
"nodePath",
".",
"dirname",
"(",
"path",
")",
",",
"function",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"return",
"callback",
"(",
"err",
")",
";",
"... | Writes all bytes over file at given path. Creates all necessary parent directories. => undefined | [
"Writes",
"all",
"bytes",
"over",
"file",
"at",
"given",
"path",
".",
"Creates",
"all",
"necessary",
"parent",
"directories",
".",
"=",
">",
"undefined"
] | 7c691d7281b49b1be77426701c2bf0535e1abcc9 | https://github.com/creationix/git-node-fs/blob/7c691d7281b49b1be77426701c2bf0535e1abcc9/lib/node-fs.js#L93-L98 |
47,026 | creationix/git-node-fs | lib/node-fs.js | rename | function rename(oldPath, newPath, callback) {
var oldBase = nodePath.dirname(oldPath);
var newBase = nodePath.dirname(newPath);
if (oldBase === newBase) {
return nodeFs.rename(oldPath, newPath, callback);
}
mkdirp(nodePath.dirname(path), function (err) {
if (err) return callback(err);
nodeFs.renam... | javascript | function rename(oldPath, newPath, callback) {
var oldBase = nodePath.dirname(oldPath);
var newBase = nodePath.dirname(newPath);
if (oldBase === newBase) {
return nodeFs.rename(oldPath, newPath, callback);
}
mkdirp(nodePath.dirname(path), function (err) {
if (err) return callback(err);
nodeFs.renam... | [
"function",
"rename",
"(",
"oldPath",
",",
"newPath",
",",
"callback",
")",
"{",
"var",
"oldBase",
"=",
"nodePath",
".",
"dirname",
"(",
"oldPath",
")",
";",
"var",
"newBase",
"=",
"nodePath",
".",
"dirname",
"(",
"newPath",
")",
";",
"if",
"(",
"oldBa... | Renames the given file. Creates all necessary parent directories. => undefined | [
"Renames",
"the",
"given",
"file",
".",
"Creates",
"all",
"necessary",
"parent",
"directories",
".",
"=",
">",
"undefined"
] | 7c691d7281b49b1be77426701c2bf0535e1abcc9 | https://github.com/creationix/git-node-fs/blob/7c691d7281b49b1be77426701c2bf0535e1abcc9/lib/node-fs.js#L103-L113 |
47,027 | IonicaBizau/emoji-logger | lib/index.js | emojiLogger | function emojiLogger(msg, type, override) {
// Get the type
var _type = emojiLogger.types[type || "info"];
if (!_type) {
throw new Err(`There is no such logger type: ${type}`, "NO_SUCH_LOGGER_TYPE");
}
emojiLogger.log(msg, _type, override);
} | javascript | function emojiLogger(msg, type, override) {
// Get the type
var _type = emojiLogger.types[type || "info"];
if (!_type) {
throw new Err(`There is no such logger type: ${type}`, "NO_SUCH_LOGGER_TYPE");
}
emojiLogger.log(msg, _type, override);
} | [
"function",
"emojiLogger",
"(",
"msg",
",",
"type",
",",
"override",
")",
"{",
"// Get the type",
"var",
"_type",
"=",
"emojiLogger",
".",
"types",
"[",
"type",
"||",
"\"info\"",
"]",
";",
"if",
"(",
"!",
"_type",
")",
"{",
"throw",
"new",
"Err",
"(",
... | emojiLogger
Logs the specified message.
@name emojiLogger
@function
@param {String} msg The message to log.
@param {String} type The message type (default: `"info"`).
@param {Object} override An object to override the type object fields. | [
"emojiLogger",
"Logs",
"the",
"specified",
"message",
"."
] | 50f33240f31059642a805badd018e1bf0ec90bff | https://github.com/IonicaBizau/emoji-logger/blob/50f33240f31059642a805badd018e1bf0ec90bff/lib/index.js#L22-L31 |
47,028 | ghosert/grunt-applymin | tasks/applymin.js | function (targetFilePath, abspaths) {
// Change 'assets/mdeditor.min.js' to 'assets/' and 'mdeditor.min.js'
var pathFilename = _splitPathAndFilename(targetFilePath);
var targetPath = pathFilename[0];
var targetFilename = pathFilename[1];
// bug fix: assets/xxxxxxxx.mdeditor.min.js, xxxxxxxx can't c... | javascript | function (targetFilePath, abspaths) {
// Change 'assets/mdeditor.min.js' to 'assets/' and 'mdeditor.min.js'
var pathFilename = _splitPathAndFilename(targetFilePath);
var targetPath = pathFilename[0];
var targetFilename = pathFilename[1];
// bug fix: assets/xxxxxxxx.mdeditor.min.js, xxxxxxxx can't c... | [
"function",
"(",
"targetFilePath",
",",
"abspaths",
")",
"{",
"// Change 'assets/mdeditor.min.js' to 'assets/' and 'mdeditor.min.js'",
"var",
"pathFilename",
"=",
"_splitPathAndFilename",
"(",
"targetFilePath",
")",
";",
"var",
"targetPath",
"=",
"pathFilename",
"[",
"0",
... | Get the revTargetFilePath based on targetFilePath. | [
"Get",
"the",
"revTargetFilePath",
"based",
"on",
"targetFilePath",
"."
] | 2e8e0a7cb0c92ae12f1440dea1675dea5c7f1490 | https://github.com/ghosert/grunt-applymin/blob/2e8e0a7cb0c92ae12f1440dea1675dea5c7f1490/tasks/applymin.js#L132-L167 | |
47,029 | zuren/catdown | lib/codemirror/keymap/sublime.js | findPosSubword | function findPosSubword(doc, start, dir) {
if (dir < 0 && start.ch == 0) return doc.clipPos(Pos(start.line - 1));
var line = doc.getLine(start.line);
if (dir > 0 && start.ch >= line.length) return doc.clipPos(Pos(start.line + 1, 0));
var state = "start", type;
for (var pos = start.ch, e = dir < 0 ? ... | javascript | function findPosSubword(doc, start, dir) {
if (dir < 0 && start.ch == 0) return doc.clipPos(Pos(start.line - 1));
var line = doc.getLine(start.line);
if (dir > 0 && start.ch >= line.length) return doc.clipPos(Pos(start.line + 1, 0));
var state = "start", type;
for (var pos = start.ch, e = dir < 0 ? ... | [
"function",
"findPosSubword",
"(",
"doc",
",",
"start",
",",
"dir",
")",
"{",
"if",
"(",
"dir",
"<",
"0",
"&&",
"start",
".",
"ch",
"==",
"0",
")",
"return",
"doc",
".",
"clipPos",
"(",
"Pos",
"(",
"start",
".",
"line",
"-",
"1",
")",
")",
";",... | This is not exactly Sublime's algorithm. I couldn't make heads or tails of that. | [
"This",
"is",
"not",
"exactly",
"Sublime",
"s",
"algorithm",
".",
"I",
"couldn",
"t",
"make",
"heads",
"or",
"tails",
"of",
"that",
"."
] | c45d6e3ca365c5f73cd9903a4ed6ef1369475327 | https://github.com/zuren/catdown/blob/c45d6e3ca365c5f73cd9903a4ed6ef1369475327/lib/codemirror/keymap/sublime.js#L17-L37 |
47,030 | hkjels/ntask | lib/task.js | Task | function Task(task) {
_.extend(this, task);
if (task != undefined) this.createId();
// Short id
this.__defineGetter__('id', function () {
return this.__uuid__.substr(0, 8).toString();
});
// Keyword
this.__defineGetter__('keyword', function () {
return this.labels[0].replace('#', '').toUpperCase... | javascript | function Task(task) {
_.extend(this, task);
if (task != undefined) this.createId();
// Short id
this.__defineGetter__('id', function () {
return this.__uuid__.substr(0, 8).toString();
});
// Keyword
this.__defineGetter__('keyword', function () {
return this.labels[0].replace('#', '').toUpperCase... | [
"function",
"Task",
"(",
"task",
")",
"{",
"_",
".",
"extend",
"(",
"this",
",",
"task",
")",
";",
"if",
"(",
"task",
"!=",
"undefined",
")",
"this",
".",
"createId",
"(",
")",
";",
"// Short id",
"this",
".",
"__defineGetter__",
"(",
"'id'",
",",
... | Task
Model used by Barricane | [
"Task",
"Model",
"used",
"by",
"Barricane"
] | e0552042e743ef9584bc0f911245635df7acd634 | https://github.com/hkjels/ntask/blob/e0552042e743ef9584bc0f911245635df7acd634/lib/task.js#L27-L51 |
47,031 | dpjanes/iotdb-homestar | bin/commands/old/model-to-jsonld.js | function (v, paramd) {
var nd = {};
var _add = function(v) {
if (!_.is.String(v)) {
return false;
}
var vmatch = v.match(/^([-a-z0-9]*):.+/);
if (!vmatch) {
return false;
}
var nshort = vmatch[1];
var nurl = _namespace[ns... | javascript | function (v, paramd) {
var nd = {};
var _add = function(v) {
if (!_.is.String(v)) {
return false;
}
var vmatch = v.match(/^([-a-z0-9]*):.+/);
if (!vmatch) {
return false;
}
var nshort = vmatch[1];
var nurl = _namespace[ns... | [
"function",
"(",
"v",
",",
"paramd",
")",
"{",
"var",
"nd",
"=",
"{",
"}",
";",
"var",
"_add",
"=",
"function",
"(",
"v",
")",
"{",
"if",
"(",
"!",
"_",
".",
"is",
".",
"String",
"(",
"v",
")",
")",
"{",
"return",
"false",
";",
"}",
"var",
... | This make sure all name spaces and @id types
we are aware of are properly represented
in the @context | [
"This",
"make",
"sure",
"all",
"name",
"spaces",
"and"
] | ed6535aa17c8b0538f43a876c9a6025e26a389e3 | https://github.com/dpjanes/iotdb-homestar/blob/ed6535aa17c8b0538f43a876c9a6025e26a389e3/bin/commands/old/model-to-jsonld.js#L169-L234 | |
47,032 | urosjarc/gitbook-plugin-build | src/index.js | function () { // eslint-disable-line object-shorthand
// Inits helper
helper.init(this);
// Check cli args for output format, and override on existance of string.
if (typeof pluginBuildFlag === 'string' || pluginBuildFlag instanceof String) {
helper.config.format = pluginBuildFlag;
}
// Fill sum... | javascript | function () { // eslint-disable-line object-shorthand
// Inits helper
helper.init(this);
// Check cli args for output format, and override on existance of string.
if (typeof pluginBuildFlag === 'string' || pluginBuildFlag instanceof String) {
helper.config.format = pluginBuildFlag;
}
// Fill sum... | [
"function",
"(",
")",
"{",
"// eslint-disable-line object-shorthand",
"// Inits helper",
"helper",
".",
"init",
"(",
"this",
")",
";",
"// Check cli args for output format, and override on existance of string.",
"if",
"(",
"typeof",
"pluginBuildFlag",
"===",
"'string'",
"||",... | Gitbook hook on initilization.
@memberOf module:index~hooks | [
"Gitbook",
"hook",
"on",
"initilization",
"."
] | 0a77829ab81a65c70bea57f72a7256e60a1004b1 | https://github.com/urosjarc/gitbook-plugin-build/blob/0a77829ab81a65c70bea57f72a7256e60a1004b1/src/index.js#L28-L41 | |
47,033 | urosjarc/gitbook-plugin-build | src/index.js | function () { // eslint-disable-line object-shorthand
const self = this;
const outputPath = helper.getOutput();
// Render template.
const rawContent = helper.renderTemp({summary: helper.summary});
// Create output dir.
mkdirp.sync(path.parse(outputPath).dir);
// Compile rendered main file
ret... | javascript | function () { // eslint-disable-line object-shorthand
const self = this;
const outputPath = helper.getOutput();
// Render template.
const rawContent = helper.renderTemp({summary: helper.summary});
// Create output dir.
mkdirp.sync(path.parse(outputPath).dir);
// Compile rendered main file
ret... | [
"function",
"(",
")",
"{",
"// eslint-disable-line object-shorthand",
"const",
"self",
"=",
"this",
";",
"const",
"outputPath",
"=",
"helper",
".",
"getOutput",
"(",
")",
";",
"// Render template.",
"const",
"rawContent",
"=",
"helper",
".",
"renderTemp",
"(",
"... | Gitbook hook on finishing.
@memberOf module:index~hooks
@returns {Promise} | [
"Gitbook",
"hook",
"on",
"finishing",
"."
] | 0a77829ab81a65c70bea57f72a7256e60a1004b1 | https://github.com/urosjarc/gitbook-plugin-build/blob/0a77829ab81a65c70bea57f72a7256e60a1004b1/src/index.js#L48-L67 | |
47,034 | urosjarc/gitbook-plugin-build | src/index.js | function (page) { // eslint-disable-line object-shorthand
// Fill summary with compiled page content
helper.summary.forEach((article, i, array) => {
if (article.path === page.path) {
array[i].content = page.content;
}
});
// Returns unchanged page.
return page;
} | javascript | function (page) { // eslint-disable-line object-shorthand
// Fill summary with compiled page content
helper.summary.forEach((article, i, array) => {
if (article.path === page.path) {
array[i].content = page.content;
}
});
// Returns unchanged page.
return page;
} | [
"function",
"(",
"page",
")",
"{",
"// eslint-disable-line object-shorthand",
"// Fill summary with compiled page content",
"helper",
".",
"summary",
".",
"forEach",
"(",
"(",
"article",
",",
"i",
",",
"array",
")",
"=>",
"{",
"if",
"(",
"article",
".",
"path",
... | Gitbook hook for page. Function will be executed
after markdown is processed with other plugins.
@memberOf module:index~hooks
@param page
@returns {page} The same as page parameter. | [
"Gitbook",
"hook",
"for",
"page",
".",
"Function",
"will",
"be",
"executed",
"after",
"markdown",
"is",
"processed",
"with",
"other",
"plugins",
"."
] | 0a77829ab81a65c70bea57f72a7256e60a1004b1 | https://github.com/urosjarc/gitbook-plugin-build/blob/0a77829ab81a65c70bea57f72a7256e60a1004b1/src/index.js#L76-L86 | |
47,035 | itajaja/websocket-monkeypatch | lib/index.js | sendJson | function sendJson(data, options, callback) {
var jsonData = JSON.stringify(data);
return this.send(jsonData, options, callback);
} | javascript | function sendJson(data, options, callback) {
var jsonData = JSON.stringify(data);
return this.send(jsonData, options, callback);
} | [
"function",
"sendJson",
"(",
"data",
",",
"options",
",",
"callback",
")",
"{",
"var",
"jsonData",
"=",
"JSON",
".",
"stringify",
"(",
"data",
")",
";",
"return",
"this",
".",
"send",
"(",
"jsonData",
",",
"options",
",",
"callback",
")",
";",
"}"
] | send a json message serialized to string | [
"send",
"a",
"json",
"message",
"serialized",
"to",
"string"
] | 7dc97366f6b863b73241a2a2f092938a8236a64e | https://github.com/itajaja/websocket-monkeypatch/blob/7dc97366f6b863b73241a2a2f092938a8236a64e/lib/index.js#L10-L13 |
47,036 | weisjohn/mongoose-csv | index.js | find_props | function find_props(schema) {
var props = _(schema.paths).keys().without('_id', 'id')
// transform the schema tree into an array for filtering
.map(function(key) { return { name : key, value : _.get(schema.tree, key) }; })
// remove paths that are annotated with csv: false
.filter... | javascript | function find_props(schema) {
var props = _(schema.paths).keys().without('_id', 'id')
// transform the schema tree into an array for filtering
.map(function(key) { return { name : key, value : _.get(schema.tree, key) }; })
// remove paths that are annotated with csv: false
.filter... | [
"function",
"find_props",
"(",
"schema",
")",
"{",
"var",
"props",
"=",
"_",
"(",
"schema",
".",
"paths",
")",
".",
"keys",
"(",
")",
".",
"without",
"(",
"'_id'",
",",
"'id'",
")",
"// transform the schema tree into an array for filtering",
".",
"map",
"(",... | walk the paths, rejecting those that opt-out | [
"walk",
"the",
"paths",
"rejecting",
"those",
"that",
"opt",
"-",
"out"
] | b87f1dc906ef0521a68942bfcd8b304ae274fa3b | https://github.com/weisjohn/mongoose-csv/blob/b87f1dc906ef0521a68942bfcd8b304ae274fa3b/index.js#L59-L93 |
47,037 | weisjohn/mongoose-csv | index.js | prop_to_csv | function prop_to_csv(prop) {
var val = String(prop);
if (val === 'undefined') val = '';
return '"' + val.toString().replace(/"/g, '""') + '"';
} | javascript | function prop_to_csv(prop) {
var val = String(prop);
if (val === 'undefined') val = '';
return '"' + val.toString().replace(/"/g, '""') + '"';
} | [
"function",
"prop_to_csv",
"(",
"prop",
")",
"{",
"var",
"val",
"=",
"String",
"(",
"prop",
")",
";",
"if",
"(",
"val",
"===",
"'undefined'",
")",
"val",
"=",
"''",
";",
"return",
"'\"'",
"+",
"val",
".",
"toString",
"(",
")",
".",
"replace",
"(",
... | return empty string if not truthy, escape quotes | [
"return",
"empty",
"string",
"if",
"not",
"truthy",
"escape",
"quotes"
] | b87f1dc906ef0521a68942bfcd8b304ae274fa3b | https://github.com/weisjohn/mongoose-csv/blob/b87f1dc906ef0521a68942bfcd8b304ae274fa3b/index.js#L102-L108 |
47,038 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(view_config, raw_hash) {
for (var name in raw_hash) {
if (Lava.schema.DEBUG && this._allowed_hash_options.indexOf(name) == -1) Lava.t("Hash option is not supported: " + name);
if (name in this._view_config_property_setters) {
this[this._view_config_property_setters[name]](view_config, raw_hash[na... | javascript | function(view_config, raw_hash) {
for (var name in raw_hash) {
if (Lava.schema.DEBUG && this._allowed_hash_options.indexOf(name) == -1) Lava.t("Hash option is not supported: " + name);
if (name in this._view_config_property_setters) {
this[this._view_config_property_setters[name]](view_config, raw_hash[na... | [
"function",
"(",
"view_config",
",",
"raw_hash",
")",
"{",
"for",
"(",
"var",
"name",
"in",
"raw_hash",
")",
"{",
"if",
"(",
"Lava",
".",
"schema",
".",
"DEBUG",
"&&",
"this",
".",
"_allowed_hash_options",
".",
"indexOf",
"(",
"name",
")",
"==",
"-",
... | Store values from view's hash as config properties
@param {_cView} view_config
@param {Object} raw_hash | [
"Store",
"values",
"from",
"view",
"s",
"hash",
"as",
"config",
"properties"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L102-L115 | |
47,039 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(result, raw_expression) {
if (raw_expression.arguments.length != 1) Lava.t("Expression block requires exactly one argument");
var config = {
type: 'view',
"class": 'Expression',
argument: raw_expression.arguments[0]
};
if (raw_expression.prefix == '$') {
config.container = {type: 'Morph... | javascript | function(result, raw_expression) {
if (raw_expression.arguments.length != 1) Lava.t("Expression block requires exactly one argument");
var config = {
type: 'view',
"class": 'Expression',
argument: raw_expression.arguments[0]
};
if (raw_expression.prefix == '$') {
config.container = {type: 'Morph... | [
"function",
"(",
"result",
",",
"raw_expression",
")",
"{",
"if",
"(",
"raw_expression",
".",
"arguments",
".",
"length",
"!=",
"1",
")",
"Lava",
".",
"t",
"(",
"\"Expression block requires exactly one argument\"",
")",
";",
"var",
"config",
"=",
"{",
"type",
... | Compile raw expression view. Will produce a view config with class="Expression"
@param {_tTemplate} result
@param {_cRawExpression} raw_expression | [
"Compile",
"raw",
"expression",
"view",
".",
"Will",
"produce",
"a",
"view",
"config",
"with",
"class",
"=",
"Expression"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L335-L353 | |
47,040 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(result, tag) {
var is_void = Lava.isVoidTag(tag.name),
tag_start_text = "<" + tag.name
+ this.renderTagAttributes(tag.attributes)
+ (is_void ? '/>' : '>'),
inner_template,
count;
this. _compileString(result, tag_start_text);
if (Lava.schema.DEBUG && is_void && tag.content) Lava.t("Voi... | javascript | function(result, tag) {
var is_void = Lava.isVoidTag(tag.name),
tag_start_text = "<" + tag.name
+ this.renderTagAttributes(tag.attributes)
+ (is_void ? '/>' : '>'),
inner_template,
count;
this. _compileString(result, tag_start_text);
if (Lava.schema.DEBUG && is_void && tag.content) Lava.t("Voi... | [
"function",
"(",
"result",
",",
"tag",
")",
"{",
"var",
"is_void",
"=",
"Lava",
".",
"isVoidTag",
"(",
"tag",
".",
"name",
")",
",",
"tag_start_text",
"=",
"\"<\"",
"+",
"tag",
".",
"name",
"+",
"this",
".",
"renderTagAttributes",
"(",
"tag",
".",
"a... | Serialize the tag back into text
@param {_tTemplate} result
@param {_cRawTag} tag | [
"Serialize",
"the",
"tag",
"back",
"into",
"text"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L360-L399 | |
47,041 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(raw_tag) {
var container_config = {
type: 'Element',
tag_name: raw_tag.name
};
if ('attributes' in raw_tag) this._parseContainerStaticAttributes(container_config, raw_tag.attributes);
if ('x' in raw_tag) this._parseContainerControlAttributes(container_config, raw_tag.x);
return /** @type ... | javascript | function(raw_tag) {
var container_config = {
type: 'Element',
tag_name: raw_tag.name
};
if ('attributes' in raw_tag) this._parseContainerStaticAttributes(container_config, raw_tag.attributes);
if ('x' in raw_tag) this._parseContainerControlAttributes(container_config, raw_tag.x);
return /** @type ... | [
"function",
"(",
"raw_tag",
")",
"{",
"var",
"container_config",
"=",
"{",
"type",
":",
"'Element'",
",",
"tag_name",
":",
"raw_tag",
".",
"name",
"}",
";",
"if",
"(",
"'attributes'",
"in",
"raw_tag",
")",
"this",
".",
"_parseContainerStaticAttributes",
"(",... | Convert raw tag to an Element container config
@param {_cRawTag} raw_tag
@returns {_cElementContainer} | [
"Convert",
"raw",
"tag",
"to",
"an",
"Element",
"container",
"config"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L656-L668 | |
47,042 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(container_config, x) {
var i,
count,
name;
if ('event' in x) {
if (typeof(x.event) != 'object') Lava.t("Malformed x:event attribute");
container_config.events = {};
for (name in x.event) {
container_config.events[name] = Lava.parsers.Common.parseTargets(x.event[name]);
}
}
... | javascript | function(container_config, x) {
var i,
count,
name;
if ('event' in x) {
if (typeof(x.event) != 'object') Lava.t("Malformed x:event attribute");
container_config.events = {};
for (name in x.event) {
container_config.events[name] = Lava.parsers.Common.parseTargets(x.event[name]);
}
}
... | [
"function",
"(",
"container_config",
",",
"x",
")",
"{",
"var",
"i",
",",
"count",
",",
"name",
";",
"if",
"(",
"'event'",
"in",
"x",
")",
"{",
"if",
"(",
"typeof",
"(",
"x",
".",
"event",
")",
"!=",
"'object'",
")",
"Lava",
".",
"t",
"(",
"\"M... | Take raw control attributes, parse them, and store in `container_config`
@param {_cElementContainer} container_config
@param {_cRawX} x | [
"Take",
"raw",
"control",
"attributes",
"parse",
"them",
"and",
"store",
"in",
"container_config"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L675-L733 | |
47,043 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(blocks, view_config) {
var current_block,
result = [],
type,
i = 0,
count = blocks.length,
x;
for (; i < count; i++) {
current_block = blocks[i];
type = (typeof(current_block) == 'string') ? 'string' : current_block.type;
if (type == 'tag') {
x = current_block.x;
if (x... | javascript | function(blocks, view_config) {
var current_block,
result = [],
type,
i = 0,
count = blocks.length,
x;
for (; i < count; i++) {
current_block = blocks[i];
type = (typeof(current_block) == 'string') ? 'string' : current_block.type;
if (type == 'tag') {
x = current_block.x;
if (x... | [
"function",
"(",
"blocks",
",",
"view_config",
")",
"{",
"var",
"current_block",
",",
"result",
"=",
"[",
"]",
",",
"type",
",",
"i",
"=",
"0",
",",
"count",
"=",
"blocks",
".",
"length",
",",
"x",
";",
"for",
"(",
";",
"i",
"<",
"count",
";",
... | Compile raw template config
@param {_tRawTemplate} blocks
@param {_cView} [view_config]
@returns {_tTemplate} | [
"Compile",
"raw",
"template",
"config"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L863-L917 | |
47,044 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(raw_blocks) {
var result = this.asBlocks(this.compileTemplate(raw_blocks));
if (result.length != 1) Lava.t("Expected: exactly one view, got either several or none.");
if (result[0].type != 'view' && result[0].type != 'widget') Lava.t("Expected: view, got: " + result[0].type);
return result[0];
} | javascript | function(raw_blocks) {
var result = this.asBlocks(this.compileTemplate(raw_blocks));
if (result.length != 1) Lava.t("Expected: exactly one view, got either several or none.");
if (result[0].type != 'view' && result[0].type != 'widget') Lava.t("Expected: view, got: " + result[0].type);
return result[0];
} | [
"function",
"(",
"raw_blocks",
")",
"{",
"var",
"result",
"=",
"this",
".",
"asBlocks",
"(",
"this",
".",
"compileTemplate",
"(",
"raw_blocks",
")",
")",
";",
"if",
"(",
"result",
".",
"length",
"!=",
"1",
")",
"Lava",
".",
"t",
"(",
"\"Expected: exact... | Compile template as usual and assert that it contains single view inside. Return that view
@param {_tRawTemplate} raw_blocks
@returns {_cView} | [
"Compile",
"template",
"as",
"usual",
"and",
"assert",
"that",
"it",
"contains",
"single",
"view",
"inside",
".",
"Return",
"that",
"view"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L925-L932 | |
47,045 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(template) {
var i = 0,
count = template.length,
result = [];
for (; i < count; i++) {
if (typeof(template[i]) == 'string') {
if (!Lava.EMPTY_REGEX.test(template[i])) Lava.t("Text between tags is not allowed in this context. You may want to use a lava-style comment ({* ... *})");
} else... | javascript | function(template) {
var i = 0,
count = template.length,
result = [];
for (; i < count; i++) {
if (typeof(template[i]) == 'string') {
if (!Lava.EMPTY_REGEX.test(template[i])) Lava.t("Text between tags is not allowed in this context. You may want to use a lava-style comment ({* ... *})");
} else... | [
"function",
"(",
"template",
")",
"{",
"var",
"i",
"=",
"0",
",",
"count",
"=",
"template",
".",
"length",
",",
"result",
"=",
"[",
"]",
";",
"for",
"(",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"if",
"(",
"typeof",
"(",
"template",
... | Remove strings from template and assert they are empty
@param {(_tRawTemplate|_tTemplate)} template
@returns {Array} | [
"Remove",
"strings",
"from",
"template",
"and",
"assert",
"they",
"are",
"empty"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L939-L961 | |
47,046 | kogarashisan/LiquidLava | lib/packages/parsers.js | function() {
return {
type: 'widget',
"class": Lava.schema.widget.DEFAULT_EXTENSION_GATEWAY,
extender_type: Lava.schema.widget.DEFAULT_EXTENDER
}
} | javascript | function() {
return {
type: 'widget',
"class": Lava.schema.widget.DEFAULT_EXTENSION_GATEWAY,
extender_type: Lava.schema.widget.DEFAULT_EXTENDER
}
} | [
"function",
"(",
")",
"{",
"return",
"{",
"type",
":",
"'widget'",
",",
"\"class\"",
":",
"Lava",
".",
"schema",
".",
"widget",
".",
"DEFAULT_EXTENSION_GATEWAY",
",",
"extender_type",
":",
"Lava",
".",
"schema",
".",
"widget",
".",
"DEFAULT_EXTENDER",
"}",
... | Create an empty widget config with default class and extender from schema
@returns {_cWidget} | [
"Create",
"an",
"empty",
"widget",
"config",
"with",
"default",
"class",
"and",
"extender",
"from",
"schema"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L1150-L1158 | |
47,047 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(raw_string) {
var map = Firestorm.String.quote_escape_map,
result;
try {
result = eval("(" + raw_string.replace(this.UNQUOTE_ESCAPE_REGEX, function (a) {
var c = map[a];
return typeof c == 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + ")");
} catch (e) ... | javascript | function(raw_string) {
var map = Firestorm.String.quote_escape_map,
result;
try {
result = eval("(" + raw_string.replace(this.UNQUOTE_ESCAPE_REGEX, function (a) {
var c = map[a];
return typeof c == 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + ")");
} catch (e) ... | [
"function",
"(",
"raw_string",
")",
"{",
"var",
"map",
"=",
"Firestorm",
".",
"String",
".",
"quote_escape_map",
",",
"result",
";",
"try",
"{",
"result",
"=",
"eval",
"(",
"\"(\"",
"+",
"raw_string",
".",
"replace",
"(",
"this",
".",
"UNQUOTE_ESCAPE_REGEX... | Turn a serialized and quoted string back into it's JavaScript representation.
Assume that everything that follows a backslash is a valid escape sequence
(all backslashes are prefixed with another backslash).
Quotes inside string: lexer's regex will match all escaped quotes
@param {string} raw_string
@returns {string... | [
"Turn",
"a",
"serialized",
"and",
"quoted",
"string",
"back",
"into",
"it",
"s",
"JavaScript",
"representation",
"."
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L1171-L1187 | |
47,048 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(raw_directive, view_config, is_top_directive) {
var directive_name = raw_directive.name,
config = this._directives_schema[directive_name];
if (!config) Lava.t("Unknown directive: " + directive_name);
if (config.view_config_presence) {
if (view_config && !config.view_config_presence) Lava.t('Dire... | javascript | function(raw_directive, view_config, is_top_directive) {
var directive_name = raw_directive.name,
config = this._directives_schema[directive_name];
if (!config) Lava.t("Unknown directive: " + directive_name);
if (config.view_config_presence) {
if (view_config && !config.view_config_presence) Lava.t('Dire... | [
"function",
"(",
"raw_directive",
",",
"view_config",
",",
"is_top_directive",
")",
"{",
"var",
"directive_name",
"=",
"raw_directive",
".",
"name",
",",
"config",
"=",
"this",
".",
"_directives_schema",
"[",
"directive_name",
"]",
";",
"if",
"(",
"!",
"config... | Handle directive tag
@param {_cRawDirective} raw_directive Raw directive tag
@param {(_cView|_cWidget)} view_config Config of the directive's parent view
@param {boolean} is_top_directive Code style validation switch. Some directives must be at the top of templates
@returns {*} Compiled template item or nothing | [
"Handle",
"directive",
"tag"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L1295-L1311 | |
47,049 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(destination, source, name_list) {
for (var i = 0, count = name_list.length; i < count; i++) {
var name = name_list[i];
if (name in source) destination[name] = source[name];
}
} | javascript | function(destination, source, name_list) {
for (var i = 0, count = name_list.length; i < count; i++) {
var name = name_list[i];
if (name in source) destination[name] = source[name];
}
} | [
"function",
"(",
"destination",
",",
"source",
",",
"name_list",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"count",
"=",
"name_list",
".",
"length",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{",
"var",
"name",
"=",
"name_list",
"[",
"i... | Helper method to copy properties from `source` to `destination`, if they exist
@param {Object} destination
@param {Object} source
@param {Array.<string>} name_list List of properties to copy from `source` to `destination` | [
"Helper",
"method",
"to",
"copy",
"properties",
"from",
"source",
"to",
"destination",
"if",
"they",
"exist"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L1319-L1324 | |
47,050 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(raw_tag) {
if (Lava.schema.DEBUG && (!raw_tag.content || raw_tag.content.length != 1 || raw_tag.content[0] == '')) Lava.t("Malformed resources options tag");
return {
type: 'options',
value: Lava.parseOptions(raw_tag.content[0])
};
} | javascript | function(raw_tag) {
if (Lava.schema.DEBUG && (!raw_tag.content || raw_tag.content.length != 1 || raw_tag.content[0] == '')) Lava.t("Malformed resources options tag");
return {
type: 'options',
value: Lava.parseOptions(raw_tag.content[0])
};
} | [
"function",
"(",
"raw_tag",
")",
"{",
"if",
"(",
"Lava",
".",
"schema",
".",
"DEBUG",
"&&",
"(",
"!",
"raw_tag",
".",
"content",
"||",
"raw_tag",
".",
"content",
".",
"length",
"!=",
"1",
"||",
"raw_tag",
".",
"content",
"[",
"0",
"]",
"==",
"''",
... | Parse resource value as any JavaScript type, including arrays, objects and literals
@param {_cRawTag} raw_tag | [
"Parse",
"resource",
"value",
"as",
"any",
"JavaScript",
"type",
"including",
"arrays",
"objects",
"and",
"literals"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L1519-L1528 | |
47,051 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(raw_tag) {
if (Lava.schema.DEBUG && raw_tag.content && raw_tag.content.length != 1) Lava.t("Malformed resources string tag");
var result = {
type: 'string',
value: raw_tag.content ? raw_tag.content[0].trim() : ''
};
if (raw_tag.attributes.description) result.description = raw_tag.attributes.de... | javascript | function(raw_tag) {
if (Lava.schema.DEBUG && raw_tag.content && raw_tag.content.length != 1) Lava.t("Malformed resources string tag");
var result = {
type: 'string',
value: raw_tag.content ? raw_tag.content[0].trim() : ''
};
if (raw_tag.attributes.description) result.description = raw_tag.attributes.de... | [
"function",
"(",
"raw_tag",
")",
"{",
"if",
"(",
"Lava",
".",
"schema",
".",
"DEBUG",
"&&",
"raw_tag",
".",
"content",
"&&",
"raw_tag",
".",
"content",
".",
"length",
"!=",
"1",
")",
"Lava",
".",
"t",
"(",
"\"Malformed resources string tag\"",
")",
";",
... | Parse a translatable string
@param {_cRawTag} raw_tag | [
"Parse",
"a",
"translatable",
"string"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L1534-L1547 | |
47,052 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(raw_tag) {
if (Lava.schema.DEBUG && (!raw_tag.content)) Lava.t("Malformed resources plural string tag");
var plural_tags = Lava.parsers.Common.asBlockType(raw_tag.content, 'tag'),
i = 0,
count = plural_tags.length,
plurals = [],
result;
if (Lava.schema.DEBUG && count == 0) Lava.t("Malforme... | javascript | function(raw_tag) {
if (Lava.schema.DEBUG && (!raw_tag.content)) Lava.t("Malformed resources plural string tag");
var plural_tags = Lava.parsers.Common.asBlockType(raw_tag.content, 'tag'),
i = 0,
count = plural_tags.length,
plurals = [],
result;
if (Lava.schema.DEBUG && count == 0) Lava.t("Malforme... | [
"function",
"(",
"raw_tag",
")",
"{",
"if",
"(",
"Lava",
".",
"schema",
".",
"DEBUG",
"&&",
"(",
"!",
"raw_tag",
".",
"content",
")",
")",
"Lava",
".",
"t",
"(",
"\"Malformed resources plural string tag\"",
")",
";",
"var",
"plural_tags",
"=",
"Lava",
".... | Parse translatable plural string
@param {_cRawTag} raw_tag | [
"Parse",
"translatable",
"plural",
"string"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L1553-L1581 | |
47,053 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(raw_directive) {
if (Lava.schema.DEBUG) {
if (!raw_directive.attributes || !raw_directive.attributes.title) Lava.t("define: missing 'title' attribute");
if (raw_directive.attributes.title.indexOf(' ') != -1) Lava.t("Widget title must not contain spaces");
if ('resource_id' in raw_directive.attribut... | javascript | function(raw_directive) {
if (Lava.schema.DEBUG) {
if (!raw_directive.attributes || !raw_directive.attributes.title) Lava.t("define: missing 'title' attribute");
if (raw_directive.attributes.title.indexOf(' ') != -1) Lava.t("Widget title must not contain spaces");
if ('resource_id' in raw_directive.attribut... | [
"function",
"(",
"raw_directive",
")",
"{",
"if",
"(",
"Lava",
".",
"schema",
".",
"DEBUG",
")",
"{",
"if",
"(",
"!",
"raw_directive",
".",
"attributes",
"||",
"!",
"raw_directive",
".",
"attributes",
".",
"title",
")",
"Lava",
".",
"t",
"(",
"\"define... | Define a widget
@param {_cRawDirective} raw_directive | [
"Define",
"a",
"widget"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L1788-L1806 | |
47,054 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(raw_directive) {
var widget_config = this._parseWidgetDefinition(raw_directive);
if (Lava.schema.DEBUG && ('sugar' in widget_config)) Lava.t("Inline widgets must not have sugar");
if (Lava.schema.DEBUG && !widget_config['class'] && !widget_config['extends']) Lava.t("x:define: widget definition is missi... | javascript | function(raw_directive) {
var widget_config = this._parseWidgetDefinition(raw_directive);
if (Lava.schema.DEBUG && ('sugar' in widget_config)) Lava.t("Inline widgets must not have sugar");
if (Lava.schema.DEBUG && !widget_config['class'] && !widget_config['extends']) Lava.t("x:define: widget definition is missi... | [
"function",
"(",
"raw_directive",
")",
"{",
"var",
"widget_config",
"=",
"this",
".",
"_parseWidgetDefinition",
"(",
"raw_directive",
")",
";",
"if",
"(",
"Lava",
".",
"schema",
".",
"DEBUG",
"&&",
"(",
"'sugar'",
"in",
"widget_config",
")",
")",
"Lava",
"... | Inline widget definition
@param {_cRawDirective} raw_directive | [
"Inline",
"widget",
"definition"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L1812-L1823 | |
47,055 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(config, raw_tag, config_property_name) {
if (Lava.schema.DEBUG && !('attributes' in raw_tag)) Lava.t("option: missing attributes");
if (Lava.schema.DEBUG && (!raw_tag.content || raw_tag.content.length != 1)) Lava.t("Malformed option: " + raw_tag.attributes.name);
var option_type = raw_tag.attributes.ty... | javascript | function(config, raw_tag, config_property_name) {
if (Lava.schema.DEBUG && !('attributes' in raw_tag)) Lava.t("option: missing attributes");
if (Lava.schema.DEBUG && (!raw_tag.content || raw_tag.content.length != 1)) Lava.t("Malformed option: " + raw_tag.attributes.name);
var option_type = raw_tag.attributes.ty... | [
"function",
"(",
"config",
",",
"raw_tag",
",",
"config_property_name",
")",
"{",
"if",
"(",
"Lava",
".",
"schema",
".",
"DEBUG",
"&&",
"!",
"(",
"'attributes'",
"in",
"raw_tag",
")",
")",
"Lava",
".",
"t",
"(",
"\"option: missing attributes\"",
")",
";",
... | Perform parsing of a tag with serialized JavaScript object inside it
@param {(_cView|_cWidget)} config
@param {(_cRawDirective|_cRawTag)} raw_tag
@param {string} config_property_name Name of the config member, which holds target JavaScript object | [
"Perform",
"parsing",
"of",
"a",
"tag",
"with",
"serialized",
"JavaScript",
"object",
"inside",
"it"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L1879-L1911 | |
47,056 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(config, name, raw_tag) {
if (Lava.schema.DEBUG && (name in config)) Lava.t("Object already exists: " + name + ". Ensure, that x:options and x:properties directives appear before x:option and x:property.");
if (Lava.schema.DEBUG && (!raw_tag.content || raw_tag.content.length != 1)) Lava.t("Malformed direct... | javascript | function(config, name, raw_tag) {
if (Lava.schema.DEBUG && (name in config)) Lava.t("Object already exists: " + name + ". Ensure, that x:options and x:properties directives appear before x:option and x:property.");
if (Lava.schema.DEBUG && (!raw_tag.content || raw_tag.content.length != 1)) Lava.t("Malformed direct... | [
"function",
"(",
"config",
",",
"name",
",",
"raw_tag",
")",
"{",
"if",
"(",
"Lava",
".",
"schema",
".",
"DEBUG",
"&&",
"(",
"name",
"in",
"config",
")",
")",
"Lava",
".",
"t",
"(",
"\"Object already exists: \"",
"+",
"name",
"+",
"\". Ensure, that x:opt... | Parse a tag with JavaScript object inside
@param {(_cView|_cWidget)} config
@param {string} name
@param {(_cRawDirective|_cRawTag)} raw_tag | [
"Parse",
"a",
"tag",
"with",
"JavaScript",
"object",
"inside"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L2032-L2038 | |
47,057 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(widget_config, raw_directive, config_property_name) {
if (Lava.schema.DEBUG && !('attributes' in raw_directive)) Lava.t("option: missing attributes");
if (Lava.schema.DEBUG && (!raw_directive.content || raw_directive.content.length != 1)) Lava.t("Malformed property: " + raw_directive.attributes.name);
L... | javascript | function(widget_config, raw_directive, config_property_name) {
if (Lava.schema.DEBUG && !('attributes' in raw_directive)) Lava.t("option: missing attributes");
if (Lava.schema.DEBUG && (!raw_directive.content || raw_directive.content.length != 1)) Lava.t("Malformed property: " + raw_directive.attributes.name);
L... | [
"function",
"(",
"widget_config",
",",
"raw_directive",
",",
"config_property_name",
")",
"{",
"if",
"(",
"Lava",
".",
"schema",
".",
"DEBUG",
"&&",
"!",
"(",
"'attributes'",
"in",
"raw_directive",
")",
")",
"Lava",
".",
"t",
"(",
"\"option: missing attributes... | Helper method for widget directives
@param {_cWidget} widget_config
@param {_cRawDirective} raw_directive
@param {string} config_property_name | [
"Helper",
"method",
"for",
"widget",
"directives"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L2083-L2089 | |
47,058 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(raw_directive) {
if (Lava.schema.DEBUG && (!raw_directive.attributes || !raw_directive.attributes['locale'] || !raw_directive.attributes['for']))
Lava.t("Malformed x:resources definition. 'locale' and 'for' are required");
Lava.resources.addWidgetResource(
raw_directive.attributes['for'],
raw_di... | javascript | function(raw_directive) {
if (Lava.schema.DEBUG && (!raw_directive.attributes || !raw_directive.attributes['locale'] || !raw_directive.attributes['for']))
Lava.t("Malformed x:resources definition. 'locale' and 'for' are required");
Lava.resources.addWidgetResource(
raw_directive.attributes['for'],
raw_di... | [
"function",
"(",
"raw_directive",
")",
"{",
"if",
"(",
"Lava",
".",
"schema",
".",
"DEBUG",
"&&",
"(",
"!",
"raw_directive",
".",
"attributes",
"||",
"!",
"raw_directive",
".",
"attributes",
"[",
"'locale'",
"]",
"||",
"!",
"raw_directive",
".",
"attribute... | Standalone resources definition for global widget
@param {_cRawDirective} raw_directive | [
"Standalone",
"resources",
"definition",
"for",
"global",
"widget"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L2119-L2130 | |
47,059 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(raw_directive) {
if (Lava.schema.DEBUG && !raw_directive.content) Lava.t("empty attach_directives");
var blocks = Lava.parsers.Common.asBlocks(raw_directive.content),
sugar = blocks[0],
directives = blocks.slice(1),
i,
count;
if (Lava.schema.DEBUG) {
if (sugar.type != 'tag' || sugar.con... | javascript | function(raw_directive) {
if (Lava.schema.DEBUG && !raw_directive.content) Lava.t("empty attach_directives");
var blocks = Lava.parsers.Common.asBlocks(raw_directive.content),
sugar = blocks[0],
directives = blocks.slice(1),
i,
count;
if (Lava.schema.DEBUG) {
if (sugar.type != 'tag' || sugar.con... | [
"function",
"(",
"raw_directive",
")",
"{",
"if",
"(",
"Lava",
".",
"schema",
".",
"DEBUG",
"&&",
"!",
"raw_directive",
".",
"content",
")",
"Lava",
".",
"t",
"(",
"\"empty attach_directives\"",
")",
";",
"var",
"blocks",
"=",
"Lava",
".",
"parsers",
"."... | Wrapper, used to apply directives to a void tag
@param {_cRawDirective} raw_directive | [
"Wrapper",
"used",
"to",
"apply",
"directives",
"to",
"a",
"void",
"tag"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L2195-L2215 | |
47,060 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(widget_config, raw_template) {
var storage_schema = this.getMergedStorageSchema(widget_config),
tags = Lava.parsers.Common.asBlockType(raw_template, 'tag'),
i = 0,
count = tags.length,
item_schema;
for (; i < count; i++) {
item_schema = storage_schema[tags[i].name];
if (Lava.schema.DEB... | javascript | function(widget_config, raw_template) {
var storage_schema = this.getMergedStorageSchema(widget_config),
tags = Lava.parsers.Common.asBlockType(raw_template, 'tag'),
i = 0,
count = tags.length,
item_schema;
for (; i < count; i++) {
item_schema = storage_schema[tags[i].name];
if (Lava.schema.DEB... | [
"function",
"(",
"widget_config",
",",
"raw_template",
")",
"{",
"var",
"storage_schema",
"=",
"this",
".",
"getMergedStorageSchema",
"(",
"widget_config",
")",
",",
"tags",
"=",
"Lava",
".",
"parsers",
".",
"Common",
".",
"asBlockType",
"(",
"raw_template",
"... | Parse raw tags as widget's storage
@param {_cWidget} widget_config
@param {_tRawTemplate} raw_template | [
"Parse",
"raw",
"tags",
"as",
"widget",
"s",
"storage"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L2293-L2309 | |
47,061 | kogarashisan/LiquidLava | lib/packages/parsers.js | function(schema, raw_tag, exclude_name) {
var tags = Lava.parsers.Common.asBlockType(raw_tag.content, 'tag'),
i = 0,
count = tags.length,
result = {},
descriptor,
name;
for (; i < count; i++) {
descriptor = schema.properties[tags[i].name];
if (Lava.schema.DEBUG && !descriptor) Lava.t("Unknow... | javascript | function(schema, raw_tag, exclude_name) {
var tags = Lava.parsers.Common.asBlockType(raw_tag.content, 'tag'),
i = 0,
count = tags.length,
result = {},
descriptor,
name;
for (; i < count; i++) {
descriptor = schema.properties[tags[i].name];
if (Lava.schema.DEBUG && !descriptor) Lava.t("Unknow... | [
"function",
"(",
"schema",
",",
"raw_tag",
",",
"exclude_name",
")",
"{",
"var",
"tags",
"=",
"Lava",
".",
"parsers",
".",
"Common",
".",
"asBlockType",
"(",
"raw_tag",
".",
"content",
",",
"'tag'",
")",
",",
"i",
"=",
"0",
",",
"count",
"=",
"tags",... | Convert `raw_rag` into object with given `schema`
@param {_cStorageItemSchema} schema
@param {_cRawTag} raw_tag
@param {boolean} exclude_name
@returns {Object} | [
"Convert",
"raw_rag",
"into",
"object",
"with",
"given",
"schema"
] | fb8618821a51fad373106b5cc9247464b0a23cf6 | https://github.com/kogarashisan/LiquidLava/blob/fb8618821a51fad373106b5cc9247464b0a23cf6/lib/packages/parsers.js#L2387-L2417 | |
47,062 | jonwoodring/octal-number-loader | index.js | function(s) {
var r = '';
for (var i = s.length - 1; i >= 0; i--) {
r += s[i];
}
return r;
} | javascript | function(s) {
var r = '';
for (var i = s.length - 1; i >= 0; i--) {
r += s[i];
}
return r;
} | [
"function",
"(",
"s",
")",
"{",
"var",
"r",
"=",
"''",
";",
"for",
"(",
"var",
"i",
"=",
"s",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"r",
"+=",
"s",
"[",
"i",
"]",
";",
"}",
"return",
"r",
";",
"}"
] | javascript doesn't have negative lookbehind so we have to reverse the string | [
"javascript",
"doesn",
"t",
"have",
"negative",
"lookbehind",
"so",
"we",
"have",
"to",
"reverse",
"the",
"string"
] | 5b49b9ab8b116bbf9c1f0e36dd85c28ef8318c21 | https://github.com/jonwoodring/octal-number-loader/blob/5b49b9ab8b116bbf9c1f0e36dd85c28ef8318c21/index.js#L9-L15 | |
47,063 | shama/grunt-required | tasks/required.js | npmInstall | function npmInstall(requires, done) {
var npmBin = path.join(path.dirname(process.argv[0]), 'npm');
if (process.platform === 'win32') { npmBin += '.cmd'; }
async.forEachSeries(requires, function(module, next) {
// skip existing modules
if (grunt.file.exists(path.join('./node_modules/' + module))... | javascript | function npmInstall(requires, done) {
var npmBin = path.join(path.dirname(process.argv[0]), 'npm');
if (process.platform === 'win32') { npmBin += '.cmd'; }
async.forEachSeries(requires, function(module, next) {
// skip existing modules
if (grunt.file.exists(path.join('./node_modules/' + module))... | [
"function",
"npmInstall",
"(",
"requires",
",",
"done",
")",
"{",
"var",
"npmBin",
"=",
"path",
".",
"join",
"(",
"path",
".",
"dirname",
"(",
"process",
".",
"argv",
"[",
"0",
"]",
")",
",",
"'npm'",
")",
";",
"if",
"(",
"process",
".",
"platform"... | use npm to install given modules | [
"use",
"npm",
"to",
"install",
"given",
"modules"
] | 367f1e7517592fedf1a0612f44e41c05437bfcbe | https://github.com/shama/grunt-required/blob/367f1e7517592fedf1a0612f44e41c05437bfcbe/tasks/required.js#L17-L36 |
47,064 | bvalosek/sticky | util/camelize.js | camelize | function camelize()
{
return function(input, output)
{
var target = output || input;
var f = output ? remove : add;
for (var key in target) {
var value = target[key];
var key_ = f(key);
if (key_ === key) continue;
delete target[key];
target[key_] = value;
}
};
} | javascript | function camelize()
{
return function(input, output)
{
var target = output || input;
var f = output ? remove : add;
for (var key in target) {
var value = target[key];
var key_ = f(key);
if (key_ === key) continue;
delete target[key];
target[key_] = value;
}
};
} | [
"function",
"camelize",
"(",
")",
"{",
"return",
"function",
"(",
"input",
",",
"output",
")",
"{",
"var",
"target",
"=",
"output",
"||",
"input",
";",
"var",
"f",
"=",
"output",
"?",
"remove",
":",
"add",
";",
"for",
"(",
"var",
"key",
"in",
"targ... | A sticky transform that will change vars_like_this into varsLikeThis. | [
"A",
"sticky",
"transform",
"that",
"will",
"change",
"vars_like_this",
"into",
"varsLikeThis",
"."
] | 8cb5fdba05be161e5936f7208558bc4702aae59a | https://github.com/bvalosek/sticky/blob/8cb5fdba05be161e5936f7208558bc4702aae59a/util/camelize.js#L6-L22 |
47,065 | timkuijsten/node-object-key-filter | index.js | filter | function filter(obj, keys, recurse) {
if (typeof obj !== 'object') { throw new TypeError('obj must be an object'); }
if (!Array.isArray(keys)) { throw new TypeError('keys must be an array'); }
if (recurse == null) {
recurse = false;
}
if (typeof recurse !== 'boolean') { throw new TypeError('recurse must ... | javascript | function filter(obj, keys, recurse) {
if (typeof obj !== 'object') { throw new TypeError('obj must be an object'); }
if (!Array.isArray(keys)) { throw new TypeError('keys must be an array'); }
if (recurse == null) {
recurse = false;
}
if (typeof recurse !== 'boolean') { throw new TypeError('recurse must ... | [
"function",
"filter",
"(",
"obj",
",",
"keys",
",",
"recurse",
")",
"{",
"if",
"(",
"typeof",
"obj",
"!==",
"'object'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'obj must be an object'",
")",
";",
"}",
"if",
"(",
"!",
"Array",
".",
"isArray",
"(",
... | Filter certain keys from an object without side-effects, optionally recurse.
@param {Object|Array} obj object to filter keys from
@param {Array} keys array of key names to filter
@param {Boolean, default: false} recurse whether or not to recurse
@return {Object} object same as input but without the specified keys | [
"Filter",
"certain",
"keys",
"from",
"an",
"object",
"without",
"side",
"-",
"effects",
"optionally",
"recurse",
"."
] | 5452a6db0f85b55351742307cbce063654ebbb15 | https://github.com/timkuijsten/node-object-key-filter/blob/5452a6db0f85b55351742307cbce063654ebbb15/index.js#L27-L55 |
47,066 | alexindigo/deeply | extra/arrays_append.js | arraysAppendAdapter | function arraysAppendAdapter(to, from, merge)
{
// transfer actual values
from.reduce(function(target, value)
{
target.push(merge(undefined, value));
return target;
}, to);
return to;
} | javascript | function arraysAppendAdapter(to, from, merge)
{
// transfer actual values
from.reduce(function(target, value)
{
target.push(merge(undefined, value));
return target;
}, to);
return to;
} | [
"function",
"arraysAppendAdapter",
"(",
"to",
",",
"from",
",",
"merge",
")",
"{",
"// transfer actual values",
"from",
".",
"reduce",
"(",
"function",
"(",
"target",
",",
"value",
")",
"{",
"target",
".",
"push",
"(",
"merge",
"(",
"undefined",
",",
"valu... | Adapter to merge arrays
by appending cloned elements
of the second array to the first
@param {array} to - target array to update
@param {array} from - array to clone
@param {function} merge - iterator to merge sub elements
@returns {array} - modified target object | [
"Adapter",
"to",
"merge",
"arrays",
"by",
"appending",
"cloned",
"elements",
"of",
"the",
"second",
"array",
"to",
"the",
"first"
] | d9f59eec37b75ce52038b3fcfb0fd86d4989c0c1 | https://github.com/alexindigo/deeply/blob/d9f59eec37b75ce52038b3fcfb0fd86d4989c0c1/extra/arrays_append.js#L14-L25 |
47,067 | SilentCicero/ethdeploy | src/lib/index.js | loadEnvironment | function loadEnvironment(environment, callback) {
const errorMsgBase = 'while transforming environment, ';
var transformedEnvironment = cloneDeep(environment); // eslint-disable-line
const query = new Eth(transformedEnvironment.provider);
query.net_version((versionError, result) => { // eslint-disable-line
... | javascript | function loadEnvironment(environment, callback) {
const errorMsgBase = 'while transforming environment, ';
var transformedEnvironment = cloneDeep(environment); // eslint-disable-line
const query = new Eth(transformedEnvironment.provider);
query.net_version((versionError, result) => { // eslint-disable-line
... | [
"function",
"loadEnvironment",
"(",
"environment",
",",
"callback",
")",
"{",
"const",
"errorMsgBase",
"=",
"'while transforming environment, '",
";",
"var",
"transformedEnvironment",
"=",
"cloneDeep",
"(",
"environment",
")",
";",
"// eslint-disable-line",
"const",
"qu... | Load the environment, get accounts, gas limits, balances etc.
@method loadEnvironment
@param {Object} environment the environment object specified in the config.js
@param {Function} callback the callback to return the environment
@callback {Object} output the transformed environment object | [
"Load",
"the",
"environment",
"get",
"accounts",
"gas",
"limits",
"balances",
"etc",
"."
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/lib/index.js#L40-L58 |
47,068 | SilentCicero/ethdeploy | src/lib/index.js | transformContracts | function transformContracts(contracts, environmentName) {
const scopedContracts = Object.assign({}, cloneDeep(contracts[environmentName] || {}));
// add name property to all contracts for deployment identification
Object.keys(scopedContracts).forEach((contractName) => {
scopedContracts[contractName].name = c... | javascript | function transformContracts(contracts, environmentName) {
const scopedContracts = Object.assign({}, cloneDeep(contracts[environmentName] || {}));
// add name property to all contracts for deployment identification
Object.keys(scopedContracts).forEach((contractName) => {
scopedContracts[contractName].name = c... | [
"function",
"transformContracts",
"(",
"contracts",
",",
"environmentName",
")",
"{",
"const",
"scopedContracts",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
",",
"cloneDeep",
"(",
"contracts",
"[",
"environmentName",
"]",
"||",
"{",
"}",
")",
")",
";",
"... | Prepair the contracts for deployment, scope contracts array, add name
@method transformContracts
@param {Object} contracts the environment object specified in the config.js
@param {String} environmentName the callback to return the environment
@return {Object} output the scoped contracts object, ready for deployment m... | [
"Prepair",
"the",
"contracts",
"for",
"deployment",
"scope",
"contracts",
"array",
"add",
"name"
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/lib/index.js#L68-L78 |
47,069 | SilentCicero/ethdeploy | src/lib/index.js | configError | function configError(config) {
if (typeof config !== 'object') { return `the config method must return a config object, got type ${typeof config}`; }
if (typeof config.entry === 'undefined') { return `No defined entry! 'config.entry' must be defined, got type ${typeof config.entry}.`; }
if (typeof config.module !... | javascript | function configError(config) {
if (typeof config !== 'object') { return `the config method must return a config object, got type ${typeof config}`; }
if (typeof config.entry === 'undefined') { return `No defined entry! 'config.entry' must be defined, got type ${typeof config.entry}.`; }
if (typeof config.module !... | [
"function",
"configError",
"(",
"config",
")",
"{",
"if",
"(",
"typeof",
"config",
"!==",
"'object'",
")",
"{",
"return",
"`",
"${",
"typeof",
"config",
"}",
"`",
";",
"}",
"if",
"(",
"typeof",
"config",
".",
"entry",
"===",
"'undefined'",
")",
"{",
... | Validate the config, after the method has been called
@method configError
@param {Object} config the environment object specified in the config.js
@return {Object|Null} output the config error, if any | [
"Validate",
"the",
"config",
"after",
"the",
"method",
"has",
"been",
"called"
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/lib/index.js#L87-L99 |
47,070 | SilentCicero/ethdeploy | src/lib/index.js | requireLoader | function requireLoader(loaderConfig) {
const errMsgBase = `while requiring loader ${JSON.stringify(loaderConfig)} config,`;
if (typeof loaderConfig !== 'object') { throw error(`${errMsgBase}, config must be object, got ${typeof loaderConfig}`); }
if (typeof loaderConfig.loader !== 'string') { throw error(`${errMs... | javascript | function requireLoader(loaderConfig) {
const errMsgBase = `while requiring loader ${JSON.stringify(loaderConfig)} config,`;
if (typeof loaderConfig !== 'object') { throw error(`${errMsgBase}, config must be object, got ${typeof loaderConfig}`); }
if (typeof loaderConfig.loader !== 'string') { throw error(`${errMs... | [
"function",
"requireLoader",
"(",
"loaderConfig",
")",
"{",
"const",
"errMsgBase",
"=",
"`",
"${",
"JSON",
".",
"stringify",
"(",
"loaderConfig",
")",
"}",
"`",
";",
"if",
"(",
"typeof",
"loaderConfig",
"!==",
"'object'",
")",
"{",
"throw",
"error",
"(",
... | Require the loader
@method requireLoader
@param {Object} loaderConfig the loader config
@return {Object} loader the required loader | [
"Require",
"the",
"loader"
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/lib/index.js#L108-L114 |
47,071 | SilentCicero/ethdeploy | src/lib/index.js | loadContracts | function loadContracts(loaders, base, sourceMap, environment, callback) { // eslint-disable-line
var outputContracts = cloneDeep(base); // eslint-disable-line
const errMsgBase = 'while processing entry data, ';
if (!Array.isArray(loaders)) { return callback(error(`${errMsgBase}loaders must be type Array, got ${ty... | javascript | function loadContracts(loaders, base, sourceMap, environment, callback) { // eslint-disable-line
var outputContracts = cloneDeep(base); // eslint-disable-line
const errMsgBase = 'while processing entry data, ';
if (!Array.isArray(loaders)) { return callback(error(`${errMsgBase}loaders must be type Array, got ${ty... | [
"function",
"loadContracts",
"(",
"loaders",
",",
"base",
",",
"sourceMap",
",",
"environment",
",",
"callback",
")",
"{",
"// eslint-disable-line",
"var",
"outputContracts",
"=",
"cloneDeep",
"(",
"base",
")",
";",
"// eslint-disable-line",
"const",
"errMsgBase",
... | Load contracts from the sourcemap, start from base
@method loadContracts
@param {Array} loaders the array of loaders
@param {Object} base the base contracts object from which to assign to
@param {Object} sourceMap the sourcemap from load time
@param {Object} environment the environments object
@param {Function} callba... | [
"Load",
"contracts",
"from",
"the",
"sourcemap",
"start",
"from",
"base"
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/lib/index.js#L127-L156 |
47,072 | SilentCicero/ethdeploy | src/lib/index.js | processOutput | function processOutput(plugins, outputObject, configObject, baseContracts, contracts, environment, callback) { // eslint-disable-line
// the final string to be outputed
let outputString = JSON.stringify(outputObject, null, 2); // eslint-disable-line
// the err msg base
const errMsgBase = 'while processing outp... | javascript | function processOutput(plugins, outputObject, configObject, baseContracts, contracts, environment, callback) { // eslint-disable-line
// the final string to be outputed
let outputString = JSON.stringify(outputObject, null, 2); // eslint-disable-line
// the err msg base
const errMsgBase = 'while processing outp... | [
"function",
"processOutput",
"(",
"plugins",
",",
"outputObject",
",",
"configObject",
",",
"baseContracts",
",",
"contracts",
",",
"environment",
",",
"callback",
")",
"{",
"// eslint-disable-line",
"// the final string to be outputed",
"let",
"outputString",
"=",
"JSO... | Process the final load output into string output for file creation.
@method processOutput
@param {Array} plugins the array of plugins, if any
@param {Object} outputObject the deplyed contracts
@param {Object} configObject the config js object
@param {Function} callback the method callback that returns the final string... | [
"Process",
"the",
"final",
"load",
"output",
"into",
"string",
"output",
"for",
"file",
"creation",
"."
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/lib/index.js#L168-L188 |
47,073 | SilentCicero/ethdeploy | src/lib/index.js | contractIsDeployed | function contractIsDeployed(baseContract, stagedContract) {
// if bytecode and inputs match, then skip with instance
if (deepEqual(typeof baseContract.address, 'string')
&& deepEqual(baseContract.transactionObject, stagedContract.transactionObject)
&& deepEqual(`0x${stripHexPrefix(baseContract.bytecode)}`, ... | javascript | function contractIsDeployed(baseContract, stagedContract) {
// if bytecode and inputs match, then skip with instance
if (deepEqual(typeof baseContract.address, 'string')
&& deepEqual(baseContract.transactionObject, stagedContract.transactionObject)
&& deepEqual(`0x${stripHexPrefix(baseContract.bytecode)}`, ... | [
"function",
"contractIsDeployed",
"(",
"baseContract",
",",
"stagedContract",
")",
"{",
"// if bytecode and inputs match, then skip with instance",
"if",
"(",
"deepEqual",
"(",
"typeof",
"baseContract",
".",
"address",
",",
"'string'",
")",
"&&",
"deepEqual",
"(",
"base... | Determine if the contract has already been deployed.
@method contractIsDeployed
@param {Object} baseContract the base contracts on which to deploy new ones
@param {Object} stagedContract the transformed environment
@return {Boolean} isDeployed has the contract already been deployed | [
"Determine",
"if",
"the",
"contract",
"has",
"already",
"been",
"deployed",
"."
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/lib/index.js#L198-L208 |
47,074 | SilentCicero/ethdeploy | src/lib/index.js | isTransactionObject | function isTransactionObject(value) {
if (typeof value !== 'object') { return false; }
const keys = Object.keys(value);
if (keys.length > 5) { return false; }
if (keys.length === 0) { return true; }
if (keys.length > 0 && isDefined(value.from) || isDefined(value.to) || isDefined(value.data) || isDefined(val... | javascript | function isTransactionObject(value) {
if (typeof value !== 'object') { return false; }
const keys = Object.keys(value);
if (keys.length > 5) { return false; }
if (keys.length === 0) { return true; }
if (keys.length > 0 && isDefined(value.from) || isDefined(value.to) || isDefined(value.data) || isDefined(val... | [
"function",
"isTransactionObject",
"(",
"value",
")",
"{",
"if",
"(",
"typeof",
"value",
"!==",
"'object'",
")",
"{",
"return",
"false",
";",
"}",
"const",
"keys",
"=",
"Object",
".",
"keys",
"(",
"value",
")",
";",
"if",
"(",
"keys",
".",
"length",
... | Is the value a transaction object.
@method isTransactionObject
@param {Optional} value the potential tx object
@return {Boolean} isTransactionObject is the object a tx object | [
"Is",
"the",
"value",
"a",
"transaction",
"object",
"."
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/lib/index.js#L221-L233 |
47,075 | SilentCicero/ethdeploy | src/lib/index.js | buildDeployMethod | function buildDeployMethod(baseContracts, transformedEnvironment, report) {
return (...args) => {
let transactionObject = {};
const defaultTxObject = transformedEnvironment.defaultTxObject || {};
const contractData = args[0];
if (typeof contractData !== 'object') {
const noContractError = 'A c... | javascript | function buildDeployMethod(baseContracts, transformedEnvironment, report) {
return (...args) => {
let transactionObject = {};
const defaultTxObject = transformedEnvironment.defaultTxObject || {};
const contractData = args[0];
if (typeof contractData !== 'object') {
const noContractError = 'A c... | [
"function",
"buildDeployMethod",
"(",
"baseContracts",
",",
"transformedEnvironment",
",",
"report",
")",
"{",
"return",
"(",
"...",
"args",
")",
"=>",
"{",
"let",
"transactionObject",
"=",
"{",
"}",
";",
"const",
"defaultTxObject",
"=",
"transformedEnvironment",
... | Basic deployer, if not deployed, deploy, else, skip and return instance
@method buildDeployMethod
@param {Array} baseContracts the base contracts on which to compare to see if already deployed
@param {Object} transformedEnvironment the transformed environment
@param {Object} report the reporter method to report newly ... | [
"Basic",
"deployer",
"if",
"not",
"deployed",
"deploy",
"else",
"skip",
"and",
"return",
"instance"
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/lib/index.js#L244-L323 |
47,076 | SilentCicero/ethdeploy | src/lib/index.js | singleEntrySourceMap | function singleEntrySourceMap(entryItem, entryData, sourceMap, callback) { // eslint-disable-line
if (typeof entryItem !== 'string') { return callback(null, sourceMap); }
// get input sources for this entry
getInputSources(entryItem, (inputSourceError, inputSourceMap) => { // eslint-disable-line
if (inputSou... | javascript | function singleEntrySourceMap(entryItem, entryData, sourceMap, callback) { // eslint-disable-line
if (typeof entryItem !== 'string') { return callback(null, sourceMap); }
// get input sources for this entry
getInputSources(entryItem, (inputSourceError, inputSourceMap) => { // eslint-disable-line
if (inputSou... | [
"function",
"singleEntrySourceMap",
"(",
"entryItem",
",",
"entryData",
",",
"sourceMap",
",",
"callback",
")",
"{",
"// eslint-disable-line",
"if",
"(",
"typeof",
"entryItem",
"!==",
"'string'",
")",
"{",
"return",
"callback",
"(",
"null",
",",
"sourceMap",
")"... | Get source map for a single config object entry path.
@method singleEntrySourceMap
@param {String} entryItem the entry item string, generally a file or dir path
@param {Array} entryData the entry data
@param {Object} sourceMap the source map
@callback {Function} callback the callback | [
"Get",
"source",
"map",
"for",
"a",
"single",
"config",
"object",
"entry",
"path",
"."
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/lib/index.js#L334-L350 |
47,077 | SilentCicero/ethdeploy | src/lib/index.js | entrySourceMap | function entrySourceMap(entry, callback) {
const entryData = typeof entry === 'string' ? [entry] : entry;
// get source map
singleEntrySourceMap(entryData[0], entryData, {}, callback);
} | javascript | function entrySourceMap(entry, callback) {
const entryData = typeof entry === 'string' ? [entry] : entry;
// get source map
singleEntrySourceMap(entryData[0], entryData, {}, callback);
} | [
"function",
"entrySourceMap",
"(",
"entry",
",",
"callback",
")",
"{",
"const",
"entryData",
"=",
"typeof",
"entry",
"===",
"'string'",
"?",
"[",
"entry",
"]",
":",
"entry",
";",
"// get source map",
"singleEntrySourceMap",
"(",
"entryData",
"[",
"0",
"]",
"... | Build complete file source map of all entry items from the config.entry.
@method entrySourceMap
@param {Array|String} entry the entry object
@param {Function} callback the callback that will return the source map
@callback {Object} sourceMap the source map object with all files/dirs in entry | [
"Build",
"complete",
"file",
"source",
"map",
"of",
"all",
"entry",
"items",
"from",
"the",
"config",
".",
"entry",
"."
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/lib/index.js#L360-L365 |
47,078 | jsonmaur/node-crypto-extra | src/encryption.js | constantTimeCompare | function constantTimeCompare (val1, val2) {
let sentinel
if (val1.length !== val2.length) return false
for (let i = 0, len = val1.length; i < len; i++) {
sentinel |= val1.charCodeAt(i) ^ val2.charCodeAt(i)
}
return sentinel === 0
} | javascript | function constantTimeCompare (val1, val2) {
let sentinel
if (val1.length !== val2.length) return false
for (let i = 0, len = val1.length; i < len; i++) {
sentinel |= val1.charCodeAt(i) ^ val2.charCodeAt(i)
}
return sentinel === 0
} | [
"function",
"constantTimeCompare",
"(",
"val1",
",",
"val2",
")",
"{",
"let",
"sentinel",
"if",
"(",
"val1",
".",
"length",
"!==",
"val2",
".",
"length",
")",
"return",
"false",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"len",
"=",
"val1",
".",
"length"... | Ensures the encrypted payload has not been tampered with.
@param {string} val1 - Hash to compare
@param {string} val2 - Hash to compare to
@return {boolean} Whether it is valid | [
"Ensures",
"the",
"encrypted",
"payload",
"has",
"not",
"been",
"tampered",
"with",
"."
] | 43f73dd892e1ffcb38e0be4fe387a8da2695c986 | https://github.com/jsonmaur/node-crypto-extra/blob/43f73dd892e1ffcb38e0be4fe387a8da2695c986/src/encryption.js#L83-L93 |
47,079 | mrzmmr/remark-extract-frontmatter | index.js | settings | function settings (options) {
var parsers
var throws
var name
if (options && typeof options === 'function') {
options = { yaml: options }
}
if (options && typeof options === 'object' && !Array.isArray(options)) {
throws = options.throws || false
name = options.name || null
delete options.t... | javascript | function settings (options) {
var parsers
var throws
var name
if (options && typeof options === 'function') {
options = { yaml: options }
}
if (options && typeof options === 'object' && !Array.isArray(options)) {
throws = options.throws || false
name = options.name || null
delete options.t... | [
"function",
"settings",
"(",
"options",
")",
"{",
"var",
"parsers",
"var",
"throws",
"var",
"name",
"if",
"(",
"options",
"&&",
"typeof",
"options",
"===",
"'function'",
")",
"{",
"options",
"=",
"{",
"yaml",
":",
"options",
"}",
"}",
"if",
"(",
"optio... | Formats options passed. If options is a function then assume its a yaml
parser. Any keys other than the known options, `name`, `throws` are
assumed to be a parser type and put in `parsers`
options - Object of options, or a function to parse frontmatter
options.throws - Boolean whether to throw when there's an error or... | [
"Formats",
"options",
"passed",
".",
"If",
"options",
"is",
"a",
"function",
"then",
"assume",
"its",
"a",
"yaml",
"parser",
".",
"Any",
"keys",
"other",
"than",
"the",
"known",
"options",
"name",
"throws",
"are",
"assumed",
"to",
"be",
"a",
"parser",
"t... | be3dcba3b371940bacfba2fe1c8f0b47c3397262 | https://github.com/mrzmmr/remark-extract-frontmatter/blob/be3dcba3b371940bacfba2fe1c8f0b47c3397262/index.js#L156-L180 |
47,080 | IonicaBizau/match.js | lib/index.js | Match | function Match(elm, options, data) {
this.ev = new EventEmitter();
this.data = options.data || data;
this.found = {};
this.timestamps = [];
this.flippedPairs = 0;
// [elm, elm]
this.active = [];
this.options = Ul.deepMerge(options, {
autoremove: true
, size: {
... | javascript | function Match(elm, options, data) {
this.ev = new EventEmitter();
this.data = options.data || data;
this.found = {};
this.timestamps = [];
this.flippedPairs = 0;
// [elm, elm]
this.active = [];
this.options = Ul.deepMerge(options, {
autoremove: true
, size: {
... | [
"function",
"Match",
"(",
"elm",
",",
"options",
",",
"data",
")",
"{",
"this",
".",
"ev",
"=",
"new",
"EventEmitter",
"(",
")",
";",
"this",
".",
"data",
"=",
"options",
".",
"data",
"||",
"data",
";",
"this",
".",
"found",
"=",
"{",
"}",
";",
... | Match
Creates a new `Match` instance.
Events you can listen to:
- `deactivate` (HTMLElement): Triggered when the block is deactivated.
- `activate` (HTMLElement): Triggered when the block is activated.
- `pair-flip` (HTMLElement, HTMLElement): After a pair flip.
- `success` (HTMLElement, HTMLElement): When a match is... | [
"Match",
"Creates",
"a",
"new",
"Match",
"instance",
"."
] | 0910530725dc7bc62fac55df6c371e75f9528112 | https://github.com/IonicaBizau/match.js/blob/0910530725dc7bc62fac55df6c371e75f9528112/lib/index.js#L47-L90 |
47,081 | bevacqua/ponyedit | src/ponyedit.js | fix | function fix (html) {
if (self.options.htmlWrap === false) { return html; }
if (html.substr(0,5) !== '<div>') {
html = '<div>' + html + '</div>';
}
return html;
} | javascript | function fix (html) {
if (self.options.htmlWrap === false) { return html; }
if (html.substr(0,5) !== '<div>') {
html = '<div>' + html + '</div>';
}
return html;
} | [
"function",
"fix",
"(",
"html",
")",
"{",
"if",
"(",
"self",
".",
"options",
".",
"htmlWrap",
"===",
"false",
")",
"{",
"return",
"html",
";",
"}",
"if",
"(",
"html",
".",
"substr",
"(",
"0",
",",
"5",
")",
"!==",
"'<div>'",
")",
"{",
"html",
"... | wrap the HTML in a div. | [
"wrap",
"the",
"HTML",
"in",
"a",
"div",
"."
] | f142f70c6933686a088d2ed0e361182f56f77dbb | https://github.com/bevacqua/ponyedit/blob/f142f70c6933686a088d2ed0e361182f56f77dbb/src/ponyedit.js#L216-L223 |
47,082 | bevacqua/ponyedit | src/ponyedit.js | report | function report (property, name, parse) {
var rquotes = /^['"]|['"]$/g;
var inspect = queries[property] || query;
return function () {
var self = this;
var value = inspect.call(self, property);
var ev = 'report.' + name;
if (parse === 'bool') {
... | javascript | function report (property, name, parse) {
var rquotes = /^['"]|['"]$/g;
var inspect = queries[property] || query;
return function () {
var self = this;
var value = inspect.call(self, property);
var ev = 'report.' + name;
if (parse === 'bool') {
... | [
"function",
"report",
"(",
"property",
",",
"name",
",",
"parse",
")",
"{",
"var",
"rquotes",
"=",
"/",
"^['\"]|['\"]$",
"/",
"g",
";",
"var",
"inspect",
"=",
"queries",
"[",
"property",
"]",
"||",
"query",
";",
"return",
"function",
"(",
")",
"{",
"... | property state emission | [
"property",
"state",
"emission"
] | f142f70c6933686a088d2ed0e361182f56f77dbb | https://github.com/bevacqua/ponyedit/blob/f142f70c6933686a088d2ed0e361182f56f77dbb/src/ponyedit.js#L526-L546 |
47,083 | Saunalol/cssbeautify-cli | lib/cssbeautify-cli.js | isValid | function isValid(name, value) {
var tests = {
indent: function (value) {
return (/^(\s*|\d*)$/).test(value);
},
openbrace: function (value) {
return (['end-of-line', 'separate-line']).indexOf(value) !== -1;
},
autosemicolon: function (value) {
... | javascript | function isValid(name, value) {
var tests = {
indent: function (value) {
return (/^(\s*|\d*)$/).test(value);
},
openbrace: function (value) {
return (['end-of-line', 'separate-line']).indexOf(value) !== -1;
},
autosemicolon: function (value) {
... | [
"function",
"isValid",
"(",
"name",
",",
"value",
")",
"{",
"var",
"tests",
"=",
"{",
"indent",
":",
"function",
"(",
"value",
")",
"{",
"return",
"(",
"/",
"^(\\s*|\\d*)$",
"/",
")",
".",
"test",
"(",
"value",
")",
";",
"}",
",",
"openbrace",
":",... | Checks parameter validity
@param {string} name
@param {string} value
@return {Boolean} | [
"Checks",
"parameter",
"validity"
] | 6ecc56073659e82386ed855b02be9ceb2c44340e | https://github.com/Saunalol/cssbeautify-cli/blob/6ecc56073659e82386ed855b02be9ceb2c44340e/lib/cssbeautify-cli.js#L115-L129 |
47,084 | SilentCicero/ethdeploy | src/plugins/index.js | JSONMinifier | function JSONMinifier() {
const self = this;
self.process = ({ output }) => JSON.stringify(JSON.parse(output));
} | javascript | function JSONMinifier() {
const self = this;
self.process = ({ output }) => JSON.stringify(JSON.parse(output));
} | [
"function",
"JSONMinifier",
"(",
")",
"{",
"const",
"self",
"=",
"this",
";",
"self",
".",
"process",
"=",
"(",
"{",
"output",
"}",
")",
"=>",
"JSON",
".",
"stringify",
"(",
"JSON",
".",
"parse",
"(",
"output",
")",
")",
";",
"}"
] | Minifies JSON output
@method JSONMinifier
@param {String} output the final build file produced by ethdeploy
@return {String} parsedOutput parsed output | [
"Minifies",
"JSON",
"output"
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/plugins/index.js#L8-L11 |
47,085 | SilentCicero/ethdeploy | src/plugins/index.js | JSONExpander | function JSONExpander() {
const self = this;
self.process = ({ output }) => JSON.stringify(JSON.parse(output), null, 2);
} | javascript | function JSONExpander() {
const self = this;
self.process = ({ output }) => JSON.stringify(JSON.parse(output), null, 2);
} | [
"function",
"JSONExpander",
"(",
")",
"{",
"const",
"self",
"=",
"this",
";",
"self",
".",
"process",
"=",
"(",
"{",
"output",
"}",
")",
"=>",
"JSON",
".",
"stringify",
"(",
"JSON",
".",
"parse",
"(",
"output",
")",
",",
"null",
",",
"2",
")",
";... | Expands JSON output
@method JSONMinifier
@param {String} output the final build file produced by ethdeploy with indents
@return {String} parsedOutput parsed output | [
"Expands",
"JSON",
"output"
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/plugins/index.js#L20-L23 |
47,086 | SilentCicero/ethdeploy | src/plugins/index.js | keyFilter | function keyFilter(obj, predicate) {
var result = {}, key; // eslint-disable-line
for (key in obj) { // eslint-disable-line
if (obj[key] && predicate(key)) {
result[key] = obj[key];
}
}
return result;
} | javascript | function keyFilter(obj, predicate) {
var result = {}, key; // eslint-disable-line
for (key in obj) { // eslint-disable-line
if (obj[key] && predicate(key)) {
result[key] = obj[key];
}
}
return result;
} | [
"function",
"keyFilter",
"(",
"obj",
",",
"predicate",
")",
"{",
"var",
"result",
"=",
"{",
"}",
",",
"key",
";",
"// eslint-disable-line",
"for",
"(",
"key",
"in",
"obj",
")",
"{",
"// eslint-disable-line",
"if",
"(",
"obj",
"[",
"key",
"]",
"&&",
"pr... | a basic util filter function | [
"a",
"basic",
"util",
"filter",
"function"
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/plugins/index.js#L26-L36 |
47,087 | SilentCicero/ethdeploy | src/plugins/index.js | IncludeContracts | function IncludeContracts(
contractsSelector,
propertyFilter = ['interface', 'bytecode'],
environmentName = 'contracts') {
const self = this;
self.process = ({ output, contracts }) => {
// parse output
const parsedOutput = JSON.parse(output);
// add contracts environment
parsedOutput[environm... | javascript | function IncludeContracts(
contractsSelector,
propertyFilter = ['interface', 'bytecode'],
environmentName = 'contracts') {
const self = this;
self.process = ({ output, contracts }) => {
// parse output
const parsedOutput = JSON.parse(output);
// add contracts environment
parsedOutput[environm... | [
"function",
"IncludeContracts",
"(",
"contractsSelector",
",",
"propertyFilter",
"=",
"[",
"'interface'",
",",
"'bytecode'",
"]",
",",
"environmentName",
"=",
"'contracts'",
")",
"{",
"const",
"self",
"=",
"this",
";",
"self",
".",
"process",
"=",
"(",
"{",
... | This wil include contracts data in the environments output
@method IncludeContracts
@param {Array} contractsSelector contracts to include in a contracts property
@param {Array} propertyFilter if fiter is not truthy, then ignore filtering
@param {String} environmentName environment name is usually contracts
@return {St... | [
"This",
"wil",
"include",
"contracts",
"data",
"in",
"the",
"environments",
"output"
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/plugins/index.js#L47-L73 |
47,088 | magne4000/node-libquassel | src/request.js | sync | function sync(className, functionName, ...datatypes) {
const qsync = qtypes.QInt.from(Types.SYNC);
const qclassName = qtypes.QByteArray.from(className);
const qfunctionName = qtypes.QByteArray.from(functionName);
return function(target, _key, descriptor) {
return {
enumerable: false,
configurabl... | javascript | function sync(className, functionName, ...datatypes) {
const qsync = qtypes.QInt.from(Types.SYNC);
const qclassName = qtypes.QByteArray.from(className);
const qfunctionName = qtypes.QByteArray.from(functionName);
return function(target, _key, descriptor) {
return {
enumerable: false,
configurabl... | [
"function",
"sync",
"(",
"className",
",",
"functionName",
",",
"...",
"datatypes",
")",
"{",
"const",
"qsync",
"=",
"qtypes",
".",
"QInt",
".",
"from",
"(",
"Types",
".",
"SYNC",
")",
";",
"const",
"qclassName",
"=",
"qtypes",
".",
"QByteArray",
".",
... | Decorator for SYNC methods
@protected | [
"Decorator",
"for",
"SYNC",
"methods"
] | 0cf97378ebe170b0abf4bdcc112933009a84156f | https://github.com/magne4000/node-libquassel/blob/0cf97378ebe170b0abf4bdcc112933009a84156f/src/request.js#L40-L61 |
47,089 | magne4000/node-libquassel | src/request.js | rpc | function rpc(functionName, ...datatypes) {
const qrpc = qtypes.QInt.from(Types.RPCCALL);
const qfunctionName = qtypes.QByteArray.from(`2${functionName}`);
return function(target, _key, descriptor) {
return {
enumerable: false,
configurable: false,
writable: false,
value: function(...ar... | javascript | function rpc(functionName, ...datatypes) {
const qrpc = qtypes.QInt.from(Types.RPCCALL);
const qfunctionName = qtypes.QByteArray.from(`2${functionName}`);
return function(target, _key, descriptor) {
return {
enumerable: false,
configurable: false,
writable: false,
value: function(...ar... | [
"function",
"rpc",
"(",
"functionName",
",",
"...",
"datatypes",
")",
"{",
"const",
"qrpc",
"=",
"qtypes",
".",
"QInt",
".",
"from",
"(",
"Types",
".",
"RPCCALL",
")",
";",
"const",
"qfunctionName",
"=",
"qtypes",
".",
"QByteArray",
".",
"from",
"(",
"... | Decorator for RPC methods
@protected | [
"Decorator",
"for",
"RPC",
"methods"
] | 0cf97378ebe170b0abf4bdcc112933009a84156f | https://github.com/magne4000/node-libquassel/blob/0cf97378ebe170b0abf4bdcc112933009a84156f/src/request.js#L67-L85 |
47,090 | dpjanes/iotdb-homestar | static/flat-ui/js/flat-ui.js | simulateMouseEvent | function simulateMouseEvent (event, simulatedType) {
// Ignore multi-touch events
if (event.originalEvent.touches.length > 1) {
return;
}
event.preventDefault();
var touch = event.originalEvent.changedTouches[0],
simulatedEvent = document.createEvent('MouseEvents');
... | javascript | function simulateMouseEvent (event, simulatedType) {
// Ignore multi-touch events
if (event.originalEvent.touches.length > 1) {
return;
}
event.preventDefault();
var touch = event.originalEvent.changedTouches[0],
simulatedEvent = document.createEvent('MouseEvents');
... | [
"function",
"simulateMouseEvent",
"(",
"event",
",",
"simulatedType",
")",
"{",
"// Ignore multi-touch events\r",
"if",
"(",
"event",
".",
"originalEvent",
".",
"touches",
".",
"length",
">",
"1",
")",
"{",
"return",
";",
"}",
"event",
".",
"preventDefault",
"... | Simulate a mouse event based on a corresponding touch event
@param {Object} event A touch event
@param {String} simulatedType The corresponding mouse event | [
"Simulate",
"a",
"mouse",
"event",
"based",
"on",
"a",
"corresponding",
"touch",
"event"
] | ed6535aa17c8b0538f43a876c9a6025e26a389e3 | https://github.com/dpjanes/iotdb-homestar/blob/ed6535aa17c8b0538f43a876c9a6025e26a389e3/static/flat-ui/js/flat-ui.js#L3912-L3945 |
47,091 | dpjanes/iotdb-homestar | static/flat-ui/js/flat-ui.js | evaluate | function evaluate(val, context) {
if ($.isFunction(val)) {
var args = Array.prototype.slice.call(arguments, 2);
return val.apply(context, args);
}
return val;
} | javascript | function evaluate(val, context) {
if ($.isFunction(val)) {
var args = Array.prototype.slice.call(arguments, 2);
return val.apply(context, args);
}
return val;
} | [
"function",
"evaluate",
"(",
"val",
",",
"context",
")",
"{",
"if",
"(",
"$",
".",
"isFunction",
"(",
"val",
")",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"2",
")",
";",
"return",
... | Returns a given value
If given a function, returns its output
@param val string|function
@param context value of "this" to be passed to function
@returns {*} | [
"Returns",
"a",
"given",
"value",
"If",
"given",
"a",
"function",
"returns",
"its",
"output"
] | ed6535aa17c8b0538f43a876c9a6025e26a389e3 | https://github.com/dpjanes/iotdb-homestar/blob/ed6535aa17c8b0538f43a876c9a6025e26a389e3/static/flat-ui/js/flat-ui.js#L9680-L9686 |
47,092 | dpjanes/iotdb-homestar | static/flat-ui/js/flat-ui.js | function (details) {
details = details || {};
details= $.extend({}, details, { type: "change", val: this.val() });
// prevents recursive triggering
this.opts.element.data("select2-change-triggered", true);
this.opts.element.trigger(details);
this.... | javascript | function (details) {
details = details || {};
details= $.extend({}, details, { type: "change", val: this.val() });
// prevents recursive triggering
this.opts.element.data("select2-change-triggered", true);
this.opts.element.trigger(details);
this.... | [
"function",
"(",
"details",
")",
"{",
"details",
"=",
"details",
"||",
"{",
"}",
";",
"details",
"=",
"$",
".",
"extend",
"(",
"{",
"}",
",",
"details",
",",
"{",
"type",
":",
"\"change\"",
",",
"val",
":",
"this",
".",
"val",
"(",
")",
"}",
")... | Triggers the change event on the source element
abstract | [
"Triggers",
"the",
"change",
"event",
"on",
"the",
"source",
"element",
"abstract"
] | ed6535aa17c8b0538f43a876c9a6025e26a389e3 | https://github.com/dpjanes/iotdb-homestar/blob/ed6535aa17c8b0538f43a876c9a6025e26a389e3/static/flat-ui/js/flat-ui.js#L10255-L10272 | |
47,093 | dpjanes/iotdb-homestar | static/flat-ui/js/flat-ui.js | function () {
if (!this.shouldOpen()) return false;
this.opening();
// Only bind the document mousemove when the dropdown is visible
$document.on("mousemove.select2Event", function (e) {
lastMousePosition.x = e.pageX;
lastMousePosition.y... | javascript | function () {
if (!this.shouldOpen()) return false;
this.opening();
// Only bind the document mousemove when the dropdown is visible
$document.on("mousemove.select2Event", function (e) {
lastMousePosition.x = e.pageX;
lastMousePosition.y... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"shouldOpen",
"(",
")",
")",
"return",
"false",
";",
"this",
".",
"opening",
"(",
")",
";",
"// Only bind the document mousemove when the dropdown is visible",
"$document",
".",
"on",
"(",
"\"mousemove.sele... | Opens the dropdown
@return {Boolean} whether or not dropdown was opened. This method will return false if, for example,
the dropdown is already open, or if the 'open' event listener on the element called preventDefault().
abstract | [
"Opens",
"the",
"dropdown"
] | ed6535aa17c8b0538f43a876c9a6025e26a389e3 | https://github.com/dpjanes/iotdb-homestar/blob/ed6535aa17c8b0538f43a876c9a6025e26a389e3/static/flat-ui/js/flat-ui.js#L10460-L10473 | |
47,094 | dpjanes/iotdb-homestar | static/flat-ui/js/flat-ui.js | function () {
var selected;
if (this.isPlaceholderOptionSelected()) {
this.updateSelection(null);
this.close();
this.setPlaceholder();
} else {
var self = this;
this.opts.initSelection.call(null, this.opt... | javascript | function () {
var selected;
if (this.isPlaceholderOptionSelected()) {
this.updateSelection(null);
this.close();
this.setPlaceholder();
} else {
var self = this;
this.opts.initSelection.call(null, this.opt... | [
"function",
"(",
")",
"{",
"var",
"selected",
";",
"if",
"(",
"this",
".",
"isPlaceholderOptionSelected",
"(",
")",
")",
"{",
"this",
".",
"updateSelection",
"(",
"null",
")",
";",
"this",
".",
"close",
"(",
")",
";",
"this",
".",
"setPlaceholder",
"("... | Sets selection based on source element's value
single | [
"Sets",
"selection",
"based",
"on",
"source",
"element",
"s",
"value",
"single"
] | ed6535aa17c8b0538f43a876c9a6025e26a389e3 | https://github.com/dpjanes/iotdb-homestar/blob/ed6535aa17c8b0538f43a876c9a6025e26a389e3/static/flat-ui/js/flat-ui.js#L11389-L11406 | |
47,095 | SilentCicero/ethdeploy | src/utils/index.js | bnToString | function bnToString(objInput, baseInput, hexPrefixed) {
var obj = objInput; // eslint-disable-line
const base = baseInput || 10;
// obj is an array
if (typeof obj === 'object' && obj !== null) {
if (Array.isArray(obj)) {
// convert items in array
obj = obj.map((item) => bnToString(item, base, h... | javascript | function bnToString(objInput, baseInput, hexPrefixed) {
var obj = objInput; // eslint-disable-line
const base = baseInput || 10;
// obj is an array
if (typeof obj === 'object' && obj !== null) {
if (Array.isArray(obj)) {
// convert items in array
obj = obj.map((item) => bnToString(item, base, h... | [
"function",
"bnToString",
"(",
"objInput",
",",
"baseInput",
",",
"hexPrefixed",
")",
"{",
"var",
"obj",
"=",
"objInput",
";",
"// eslint-disable-line",
"const",
"base",
"=",
"baseInput",
"||",
"10",
";",
"// obj is an array",
"if",
"(",
"typeof",
"obj",
"==="... | recursively converts all BN or BigNumber instances into string
Converts all BigNumber and BN instances to string, even nested deep in Arrays or Objects.
@method bnToString
@param {Optional} objInput optional input type, bypasses most
@param {Number} baseInput the base number (usually either 10 or 16).
@param {Boolean... | [
"recursively",
"converts",
"all",
"BN",
"or",
"BigNumber",
"instances",
"into",
"string",
"Converts",
"all",
"BigNumber",
"and",
"BN",
"instances",
"to",
"string",
"even",
"nested",
"deep",
"in",
"Arrays",
"or",
"Objects",
"."
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/utils/index.js#L49-L71 |
47,096 | SilentCicero/ethdeploy | src/utils/index.js | filterSourceMap | function filterSourceMap(testRegex, includeRegex, sourceMap, excludeRegex) {
const outputData = Object.assign({});
const testTestRegex = testRegex || /./g;
const testIncludeRegex = includeRegex || null;
const testExcludeRegex = excludeRegex || null;
if (typeof testTestRegex !== 'object') { throw error(`while... | javascript | function filterSourceMap(testRegex, includeRegex, sourceMap, excludeRegex) {
const outputData = Object.assign({});
const testTestRegex = testRegex || /./g;
const testIncludeRegex = includeRegex || null;
const testExcludeRegex = excludeRegex || null;
if (typeof testTestRegex !== 'object') { throw error(`while... | [
"function",
"filterSourceMap",
"(",
"testRegex",
",",
"includeRegex",
",",
"sourceMap",
",",
"excludeRegex",
")",
"{",
"const",
"outputData",
"=",
"Object",
".",
"assign",
"(",
"{",
"}",
")",
";",
"const",
"testTestRegex",
"=",
"testRegex",
"||",
"/",
".",
... | Filters a given sourcemap by specific test regex's.
@method filterSourceMap
@param {Regex} testRegex the test regex (only include these files)
@param {Regex} includeRegex the include test regex (only include these files)
@param {Object} sourceMap the complete file sourcemap
@return {Object} filteredSourceMap the filte... | [
"Filters",
"a",
"given",
"sourcemap",
"by",
"specific",
"test",
"regex",
"s",
"."
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/utils/index.js#L103-L122 |
47,097 | SilentCicero/ethdeploy | src/utils/index.js | getTransactionSuccess | function getTransactionSuccess(eth, txHash, timeout = 800000, callback) {
const cb = callback || function cb() {};
let count = 0;
return new Promise((resolve, reject) => {
const txInterval = setInterval(() => {
eth.getTransactionReceipt(txHash, (err, result) => {
if (err) {
clearInterv... | javascript | function getTransactionSuccess(eth, txHash, timeout = 800000, callback) {
const cb = callback || function cb() {};
let count = 0;
return new Promise((resolve, reject) => {
const txInterval = setInterval(() => {
eth.getTransactionReceipt(txHash, (err, result) => {
if (err) {
clearInterv... | [
"function",
"getTransactionSuccess",
"(",
"eth",
",",
"txHash",
",",
"timeout",
"=",
"800000",
",",
"callback",
")",
"{",
"const",
"cb",
"=",
"callback",
"||",
"function",
"cb",
"(",
")",
"{",
"}",
";",
"let",
"count",
"=",
"0",
";",
"return",
"new",
... | This will wait for a transaction to present a receipt
@method getTransactionSuccess
@param {Object} eth the eth query instance
@param {Object} txHash the transaction hash
@param {Object} timeout settings
@param {Function} callback the final callback
@callback {Object} contractInstance the deployed contract instance wi... | [
"This",
"will",
"wait",
"for",
"a",
"transaction",
"to",
"present",
"a",
"receipt"
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/utils/index.js#L135-L163 |
47,098 | SilentCicero/ethdeploy | src/utils/index.js | deployContract | function deployContract(eth, factory, args, callback) {
factory.new.apply(factory, args).then((txHash) => {
getTransactionSuccess(eth, txHash, 8000000, (receiptError, receipt) => {
if (receiptError) {
callback(receiptError, null);
}
if (receipt) {
const contractInstance = factor... | javascript | function deployContract(eth, factory, args, callback) {
factory.new.apply(factory, args).then((txHash) => {
getTransactionSuccess(eth, txHash, 8000000, (receiptError, receipt) => {
if (receiptError) {
callback(receiptError, null);
}
if (receipt) {
const contractInstance = factor... | [
"function",
"deployContract",
"(",
"eth",
",",
"factory",
",",
"args",
",",
"callback",
")",
"{",
"factory",
".",
"new",
".",
"apply",
"(",
"factory",
",",
"args",
")",
".",
"then",
"(",
"(",
"txHash",
")",
"=>",
"{",
"getTransactionSuccess",
"(",
"eth... | Deploy the contract with eth, factory, and args
@method deployContract
@param {Object} eth the eth query instance
@param {Object} factory the contract factory
@param {Array} args the contract constructor arguments
@param {Function} callback the final callback
@callback {Object} contractInstance the deployed contract i... | [
"Deploy",
"the",
"contract",
"with",
"eth",
"factory",
"and",
"args"
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/utils/index.js#L175-L189 |
47,099 | SilentCicero/ethdeploy | src/utils/index.js | getInputSources | function getInputSources(pathname, callback) {
let filesRead = 0;
let sources = {};
// test file is a file, the last section contains a extention period
if (String(pathname).split('/').pop().indexOf('.') !== -1) {
const searchPathname = pathname.substr(0, 2) === './' ? pathname.slice(2) : pathname;
fs... | javascript | function getInputSources(pathname, callback) {
let filesRead = 0;
let sources = {};
// test file is a file, the last section contains a extention period
if (String(pathname).split('/').pop().indexOf('.') !== -1) {
const searchPathname = pathname.substr(0, 2) === './' ? pathname.slice(2) : pathname;
fs... | [
"function",
"getInputSources",
"(",
"pathname",
",",
"callback",
")",
"{",
"let",
"filesRead",
"=",
"0",
";",
"let",
"sources",
"=",
"{",
"}",
";",
"// test file is a file, the last section contains a extention period",
"if",
"(",
"String",
"(",
"pathname",
")",
"... | Get all input source for a specific pathname, used for mapping config entry
@method getInputSources
@param {String} pathname a path string to a file or directory
@param {Function} callback the final callback that returns the sources
@callback {Object} sourceMap returns a source map for this pathname | [
"Get",
"all",
"input",
"source",
"for",
"a",
"specific",
"pathname",
"used",
"for",
"mapping",
"config",
"entry"
] | acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6 | https://github.com/SilentCicero/ethdeploy/blob/acb1212e1942ce604eb82e34ce2f8c9d6b20a0a6/src/utils/index.js#L199-L249 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.