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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
56,100 | sittingbool/sbool-node-utils | util/configLoader.js | function( path) {
var stat = null;
try {
stat = fs.statSync( path );
} catch (err) {
console.log(err);
}
return ( stat && stat.isFile() );
} | javascript | function( path) {
var stat = null;
try {
stat = fs.statSync( path );
} catch (err) {
console.log(err);
}
return ( stat && stat.isFile() );
} | [
"function",
"(",
"path",
")",
"{",
"var",
"stat",
"=",
"null",
";",
"try",
"{",
"stat",
"=",
"fs",
".",
"statSync",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"err",
")",
"{",
"console",
".",
"log",
"(",
"err",
")",
";",
"}",
"return",
"(",
"s... | Loads config file with many options
@param configDir - directory which should be used for
@param options - object that can take following parameters:
configEnvironmentVar: key that is used on process.env[<key>] to use it as oath to config directory
subDirPath: path within the directory loaded over configEnvironmentVa... | [
"Loads",
"config",
"file",
"with",
"many",
"options"
] | 30a5b71bc258b160883451ede8c6c3991294fd68 | https://github.com/sittingbool/sbool-node-utils/blob/30a5b71bc258b160883451ede8c6c3991294fd68/util/configLoader.js#L24-L35 | |
56,101 | joshwnj/marki | src/setup-highlighter.js | loadHighlighter | function loadHighlighter () {
var headElem = d.querySelector('head');
headElem.appendChild(h('link', {
rel: 'stylesheet',
href: 'http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css'
}));
headElem.appendChild(h('script', {
src: 'http://cdnjs.cloudflare.com/ajax/libs/highli... | javascript | function loadHighlighter () {
var headElem = d.querySelector('head');
headElem.appendChild(h('link', {
rel: 'stylesheet',
href: 'http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/default.min.css'
}));
headElem.appendChild(h('script', {
src: 'http://cdnjs.cloudflare.com/ajax/libs/highli... | [
"function",
"loadHighlighter",
"(",
")",
"{",
"var",
"headElem",
"=",
"d",
".",
"querySelector",
"(",
"'head'",
")",
";",
"headElem",
".",
"appendChild",
"(",
"h",
"(",
"'link'",
",",
"{",
"rel",
":",
"'stylesheet'",
",",
"href",
":",
"'http://cdnjs.cloudf... | load syntax highlighting code | [
"load",
"syntax",
"highlighting",
"code"
] | 1809630593c74b38313add82d54f88491e00cd4f | https://github.com/joshwnj/marki/blob/1809630593c74b38313add82d54f88491e00cd4f/src/setup-highlighter.js#L5-L23 |
56,102 | fibo/algebra-ring | algebra-ring.js | algebraRing | function algebraRing (identities, given) {
// A ring is a group, with multiplication.
const ring = group({
identity: identities[0],
contains: given.contains,
equality: given.equality,
compositionLaw: given.addition,
inversion: given.negation
})
// operators
function multiplication () {
... | javascript | function algebraRing (identities, given) {
// A ring is a group, with multiplication.
const ring = group({
identity: identities[0],
contains: given.contains,
equality: given.equality,
compositionLaw: given.addition,
inversion: given.negation
})
// operators
function multiplication () {
... | [
"function",
"algebraRing",
"(",
"identities",
",",
"given",
")",
"{",
"// A ring is a group, with multiplication.",
"const",
"ring",
"=",
"group",
"(",
"{",
"identity",
":",
"identities",
"[",
"0",
"]",
",",
"contains",
":",
"given",
".",
"contains",
",",
"equ... | Define an algebra ring structure
@param {Array} identities
@param {*} identities[0] a.k.a zero
@param {*} identities[1] a.k.a uno
@param {Object} given operator functions
@param {Function} given.contains
@param {Function} given.equality
@param {Function} given.addition
@param {Function} given.negation
@param... | [
"Define",
"an",
"algebra",
"ring",
"structure"
] | 5fb3c6e88e6ded23f20b478eb5aeb1ff142a59a4 | https://github.com/fibo/algebra-ring/blob/5fb3c6e88e6ded23f20b478eb5aeb1ff142a59a4/algebra-ring.js#L37-L92 |
56,103 | substance/converter | src/converter.js | __pandocAvailable | function __pandocAvailable(cb) {
var test = spawn('pandoc', ['--help']);
test.on('error', function() {
console.error('Pandoc not found');
cb('Pandoc not found');
});
test.on('exit', function() { cb(null); });
test.stdin.end();
} | javascript | function __pandocAvailable(cb) {
var test = spawn('pandoc', ['--help']);
test.on('error', function() {
console.error('Pandoc not found');
cb('Pandoc not found');
});
test.on('exit', function() { cb(null); });
test.stdin.end();
} | [
"function",
"__pandocAvailable",
"(",
"cb",
")",
"{",
"var",
"test",
"=",
"spawn",
"(",
"'pandoc'",
",",
"[",
"'--help'",
"]",
")",
";",
"test",
".",
"on",
"(",
"'error'",
",",
"function",
"(",
")",
"{",
"console",
".",
"error",
"(",
"'Pandoc not found... | Checks if the pandoc tool is available | [
"Checks",
"if",
"the",
"pandoc",
"tool",
"is",
"available"
] | d98f4d531a339cada47ac6329cec4b7aaacb1605 | https://github.com/substance/converter/blob/d98f4d531a339cada47ac6329cec4b7aaacb1605/src/converter.js#L30-L38 |
56,104 | RnbWd/parse-browserify | lib/facebook.js | function(user, permissions, options) {
if (!permissions || _.isString(permissions)) {
if (!initialized) {
throw "You must initialize FacebookUtils before calling link.";
}
requestedPermissions = permissions;
return user._linkWith("facebook", options);
} else {
... | javascript | function(user, permissions, options) {
if (!permissions || _.isString(permissions)) {
if (!initialized) {
throw "You must initialize FacebookUtils before calling link.";
}
requestedPermissions = permissions;
return user._linkWith("facebook", options);
} else {
... | [
"function",
"(",
"user",
",",
"permissions",
",",
"options",
")",
"{",
"if",
"(",
"!",
"permissions",
"||",
"_",
".",
"isString",
"(",
"permissions",
")",
")",
"{",
"if",
"(",
"!",
"initialized",
")",
"{",
"throw",
"\"You must initialize FacebookUtils before... | Links Facebook to an existing PFUser. This method delegates to the
Facebook SDK to authenticate the user, and then automatically links
the account to the Parse.User.
@param {Parse.User} user User to link to Facebook. This must be the
current user.
@param {String, Object} permissions The permissions required for Facebo... | [
"Links",
"Facebook",
"to",
"an",
"existing",
"PFUser",
".",
"This",
"method",
"delegates",
"to",
"the",
"Facebook",
"SDK",
"to",
"authenticate",
"the",
"user",
"and",
"then",
"automatically",
"links",
"the",
"account",
"to",
"the",
"Parse",
".",
"User",
"."
... | c19c1b798e4010a552e130b1a9ce3b5d084dc101 | https://github.com/RnbWd/parse-browserify/blob/c19c1b798e4010a552e130b1a9ce3b5d084dc101/lib/facebook.js#L162-L174 | |
56,105 | cli-kit/cli-property | lib/expand.js | expand | function expand(source, opts) {
opts = opts || {};
var re = opts.re = opts.re || '.'
, isre = (re instanceof RegExp)
, o = {}, k, v, parts, i, p;
for(k in source) {
v = source[k];
if(isre ? !re.test(k) : !~k.indexOf(re)) {
o[k] = v;
}else{
parts = k.split(re);
p = o;
fo... | javascript | function expand(source, opts) {
opts = opts || {};
var re = opts.re = opts.re || '.'
, isre = (re instanceof RegExp)
, o = {}, k, v, parts, i, p;
for(k in source) {
v = source[k];
if(isre ? !re.test(k) : !~k.indexOf(re)) {
o[k] = v;
}else{
parts = k.split(re);
p = o;
fo... | [
"function",
"expand",
"(",
"source",
",",
"opts",
")",
"{",
"opts",
"=",
"opts",
"||",
"{",
"}",
";",
"var",
"re",
"=",
"opts",
".",
"re",
"=",
"opts",
".",
"re",
"||",
"'.'",
",",
"isre",
"=",
"(",
"re",
"instanceof",
"RegExp",
")",
",",
"o",
... | Takes a source object with dot-delimited keys
and expands it to a deep object representation.
Such that:
{'obj.field.num': 10}
Becomes:
{obj:{field: {num: 10}}}
Returns the transformed object.
@param source The source object to expand.
@param opts Processing opts.
@param opts.re The string or regexp delimiter
use... | [
"Takes",
"a",
"source",
"object",
"with",
"dot",
"-",
"delimited",
"keys",
"and",
"expands",
"it",
"to",
"a",
"deep",
"object",
"representation",
"."
] | de6f727af1f8fc1f613fe42200c5e070aa6b0b21 | https://github.com/cli-kit/cli-property/blob/de6f727af1f8fc1f613fe42200c5e070aa6b0b21/lib/expand.js#L20-L44 |
56,106 | ugate/releasebot | lib/utils.js | validateFile | function validateFile(path, rollCall) {
var stat = path ? fs.statSync(path) : {
size : 0
};
if (!stat.size) {
rollCall.error('Failed to find any entries in "' + path + '" (file size: ' + stat.size + ')');
return false;
}
return true;
} | javascript | function validateFile(path, rollCall) {
var stat = path ? fs.statSync(path) : {
size : 0
};
if (!stat.size) {
rollCall.error('Failed to find any entries in "' + path + '" (file size: ' + stat.size + ')');
return false;
}
return true;
} | [
"function",
"validateFile",
"(",
"path",
",",
"rollCall",
")",
"{",
"var",
"stat",
"=",
"path",
"?",
"fs",
".",
"statSync",
"(",
"path",
")",
":",
"{",
"size",
":",
"0",
"}",
";",
"if",
"(",
"!",
"stat",
".",
"size",
")",
"{",
"rollCall",
".",
... | Determines if a file has content and logs an error when the the file is empty
@param path
the path to the file
@param the
roll call instance
@returns true when the file contains data or the path is invalid | [
"Determines",
"if",
"a",
"file",
"has",
"content",
"and",
"logs",
"an",
"error",
"when",
"the",
"the",
"file",
"is",
"empty"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/lib/utils.js#L85-L94 |
56,107 | ugate/releasebot | lib/utils.js | updateFiles | function updateFiles(files, func, bpath, eh) {
try {
if (Array.isArray(files) && typeof func === 'function') {
for (var i = 0; i < files.length; i++) {
var p = path.join(bpath, files[i]), au = '';
var content = rbot.file.read(p, {
encoding : rbot.file.defaultEncoding
});
var ec = func(content... | javascript | function updateFiles(files, func, bpath, eh) {
try {
if (Array.isArray(files) && typeof func === 'function') {
for (var i = 0; i < files.length; i++) {
var p = path.join(bpath, files[i]), au = '';
var content = rbot.file.read(p, {
encoding : rbot.file.defaultEncoding
});
var ec = func(content... | [
"function",
"updateFiles",
"(",
"files",
",",
"func",
",",
"bpath",
",",
"eh",
")",
"{",
"try",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"files",
")",
"&&",
"typeof",
"func",
"===",
"'function'",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
"... | Updates file contents using a specified function
@param files
the {Array} of files to read/write
@param func
the function to call for the read/write operation
@param bpath
the base path to that will be used to prefix each file used in the
update process
@param eh
an optional function that will be called when the updat... | [
"Updates",
"file",
"contents",
"using",
"a",
"specified",
"function"
] | 1a2ff42796e77f47f9590992c014fee461aad80b | https://github.com/ugate/releasebot/blob/1a2ff42796e77f47f9590992c014fee461aad80b/lib/utils.js#L110-L131 |
56,108 | sdgluck/pick-to-array | index.js | pickToArray | function pickToArray (entities, property, deep) {
if (!(entities instanceof Array) && !isPlainObject(entities)) {
throw new Error('Expecting entity to be object or array of objects')
} else if (typeof property !== 'string' && !(property instanceof Array)) {
throw new Error('Expecting property to be string o... | javascript | function pickToArray (entities, property, deep) {
if (!(entities instanceof Array) && !isPlainObject(entities)) {
throw new Error('Expecting entity to be object or array of objects')
} else if (typeof property !== 'string' && !(property instanceof Array)) {
throw new Error('Expecting property to be string o... | [
"function",
"pickToArray",
"(",
"entities",
",",
"property",
",",
"deep",
")",
"{",
"if",
"(",
"!",
"(",
"entities",
"instanceof",
"Array",
")",
"&&",
"!",
"isPlainObject",
"(",
"entities",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Expecting entity to... | Pick the value of the `property` property from each object in `entities`.
Operation is recursive with `deep == true`.
@param {Array|Object} entities An array of objects or a single object
@param {String|Array} property Property name(s) to pick
@param {Boolean} [deep] Pick from nested properties, default false
@returns ... | [
"Pick",
"the",
"value",
"of",
"the",
"property",
"property",
"from",
"each",
"object",
"in",
"entities",
".",
"Operation",
"is",
"recursive",
"with",
"deep",
"==",
"true",
"."
] | b496e27770b41ad9aa1260390664b1c282498a34 | https://github.com/sdgluck/pick-to-array/blob/b496e27770b41ad9aa1260390664b1c282498a34/index.js#L35-L66 |
56,109 | rxaviers/builder-amd-css | bower_components/require-css/css-builder.js | loadFile | function loadFile(path) {
if ( config.asReference && config.asReference.loadFile ) {
return config.asReference.loadFile( path );
} else if (typeof process !== "undefined" && process.versions && !!process.versions.node && require.nodeRequire) {
var fs = require.nodeRequire('fs');
var file = fs.... | javascript | function loadFile(path) {
if ( config.asReference && config.asReference.loadFile ) {
return config.asReference.loadFile( path );
} else if (typeof process !== "undefined" && process.versions && !!process.versions.node && require.nodeRequire) {
var fs = require.nodeRequire('fs');
var file = fs.... | [
"function",
"loadFile",
"(",
"path",
")",
"{",
"if",
"(",
"config",
".",
"asReference",
"&&",
"config",
".",
"asReference",
".",
"loadFile",
")",
"{",
"return",
"config",
".",
"asReference",
".",
"loadFile",
"(",
"path",
")",
";",
"}",
"else",
"if",
"(... | load file code - stolen from text plugin | [
"load",
"file",
"code",
"-",
"stolen",
"from",
"text",
"plugin"
] | ad225d76285a68c5fa750fdc31e2f2c7365aa8b3 | https://github.com/rxaviers/builder-amd-css/blob/ad225d76285a68c5fa750fdc31e2f2c7365aa8b3/bower_components/require-css/css-builder.js#L35-L65 |
56,110 | rxaviers/builder-amd-css | bower_components/require-css/css-builder.js | escape | function escape(content) {
return content.replace(/(["'\\])/g, '\\$1')
.replace(/[\f]/g, "\\f")
.replace(/[\b]/g, "\\b")
.replace(/[\n]/g, "\\n")
.replace(/[\t]/g, "\\t")
.replace(/[\r]/g, "\\r");
} | javascript | function escape(content) {
return content.replace(/(["'\\])/g, '\\$1')
.replace(/[\f]/g, "\\f")
.replace(/[\b]/g, "\\b")
.replace(/[\n]/g, "\\n")
.replace(/[\t]/g, "\\t")
.replace(/[\r]/g, "\\r");
} | [
"function",
"escape",
"(",
"content",
")",
"{",
"return",
"content",
".",
"replace",
"(",
"/",
"([\"'\\\\])",
"/",
"g",
",",
"'\\\\$1'",
")",
".",
"replace",
"(",
"/",
"[\\f]",
"/",
"g",
",",
"\"\\\\f\"",
")",
".",
"replace",
"(",
"/",
"[\\b]",
"/",
... | when adding to the link buffer, paths are normalised to the baseUrl when removing from the link buffer, paths are normalised to the output file path | [
"when",
"adding",
"to",
"the",
"link",
"buffer",
"paths",
"are",
"normalised",
"to",
"the",
"baseUrl",
"when",
"removing",
"from",
"the",
"link",
"buffer",
"paths",
"are",
"normalised",
"to",
"the",
"output",
"file",
"path"
] | ad225d76285a68c5fa750fdc31e2f2c7365aa8b3 | https://github.com/rxaviers/builder-amd-css/blob/ad225d76285a68c5fa750fdc31e2f2c7365aa8b3/bower_components/require-css/css-builder.js#L91-L98 |
56,111 | agitojs/agito-json-loader | lib/agitoJsonLoader.js | areArgumentsValid | function areArgumentsValid(args) {
var isValid = args.every(function(arg) {
if (Array.isArray(arg)) {
return areArgumentsValid(arg);
}
return (arg !== null && typeof arg === 'object');
});
return isValid;
} | javascript | function areArgumentsValid(args) {
var isValid = args.every(function(arg) {
if (Array.isArray(arg)) {
return areArgumentsValid(arg);
}
return (arg !== null && typeof arg === 'object');
});
return isValid;
} | [
"function",
"areArgumentsValid",
"(",
"args",
")",
"{",
"var",
"isValid",
"=",
"args",
".",
"every",
"(",
"function",
"(",
"arg",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"arg",
")",
")",
"{",
"return",
"areArgumentsValid",
"(",
"arg",
")",
... | Check if the passed arguments are valid. As long as arrays are encountered,
they are recursively checked.
@param {*[]} args - The arguments to check
@return {Boolean} - true when the arguments are correct, otherwise false | [
"Check",
"if",
"the",
"passed",
"arguments",
"are",
"valid",
".",
"As",
"long",
"as",
"arrays",
"are",
"encountered",
"they",
"are",
"recursively",
"checked",
"."
] | 158543455359bcc2bed8cc28c794f9b7b50244aa | https://github.com/agitojs/agito-json-loader/blob/158543455359bcc2bed8cc28c794f9b7b50244aa/lib/agitoJsonLoader.js#L33-L44 |
56,112 | prescottprue/devshare | examples/react/app/containers/Account/Account.js | mapStateToProps | function mapStateToProps (state) {
return {
account: state.account ? state.entities.accounts[state.account.id] : null,
router: state.router
}
} | javascript | function mapStateToProps (state) {
return {
account: state.account ? state.entities.accounts[state.account.id] : null,
router: state.router
}
} | [
"function",
"mapStateToProps",
"(",
"state",
")",
"{",
"return",
"{",
"account",
":",
"state",
".",
"account",
"?",
"state",
".",
"entities",
".",
"accounts",
"[",
"state",
".",
"account",
".",
"id",
"]",
":",
"null",
",",
"router",
":",
"state",
".",
... | Place state of redux store into props of component | [
"Place",
"state",
"of",
"redux",
"store",
"into",
"props",
"of",
"component"
] | 38a7081f210857f2ef106836c30ea404c12c1643 | https://github.com/prescottprue/devshare/blob/38a7081f210857f2ef106836c30ea404c12c1643/examples/react/app/containers/Account/Account.js#L44-L49 |
56,113 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function() {
var clone = new CKEDITOR.dom.range( this.root );
clone.startContainer = this.startContainer;
clone.startOffset = this.startOffset;
clone.endContainer = this.endContainer;
clone.endOffset = this.endOffset;
clone.collapsed = this.collapsed;
return clone;
} | javascript | function() {
var clone = new CKEDITOR.dom.range( this.root );
clone.startContainer = this.startContainer;
clone.startOffset = this.startOffset;
clone.endContainer = this.endContainer;
clone.endOffset = this.endOffset;
clone.collapsed = this.collapsed;
return clone;
} | [
"function",
"(",
")",
"{",
"var",
"clone",
"=",
"new",
"CKEDITOR",
".",
"dom",
".",
"range",
"(",
"this",
".",
"root",
")",
";",
"clone",
".",
"startContainer",
"=",
"this",
".",
"startContainer",
";",
"clone",
".",
"startOffset",
"=",
"this",
".",
"... | Clones this range.
@returns {CKEDITOR.dom.range} | [
"Clones",
"this",
"range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L460-L470 | |
56,114 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | getLengthOfPrecedingTextNodes | function getLengthOfPrecedingTextNodes( node ) {
var sum = 0;
while ( ( node = node.getPrevious() ) && node.type == CKEDITOR.NODE_TEXT )
sum += node.getLength();
return sum;
} | javascript | function getLengthOfPrecedingTextNodes( node ) {
var sum = 0;
while ( ( node = node.getPrevious() ) && node.type == CKEDITOR.NODE_TEXT )
sum += node.getLength();
return sum;
} | [
"function",
"getLengthOfPrecedingTextNodes",
"(",
"node",
")",
"{",
"var",
"sum",
"=",
"0",
";",
"while",
"(",
"(",
"node",
"=",
"node",
".",
"getPrevious",
"(",
")",
")",
"&&",
"node",
".",
"type",
"==",
"CKEDITOR",
".",
"NODE_TEXT",
")",
"sum",
"+=",... | Sums lengths of all preceding text nodes. | [
"Sums",
"lengths",
"of",
"all",
"preceding",
"text",
"nodes",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L647-L654 |
56,115 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function() {
var startNode = this.startContainer,
endNode = this.endContainer,
startOffset = this.startOffset,
endOffset = this.endOffset,
childCount;
if ( startNode.type == CKEDITOR.NODE_ELEMENT ) {
childCount = startNode.getChildCount();
if ( childCount > startOffset )
startNode = ... | javascript | function() {
var startNode = this.startContainer,
endNode = this.endContainer,
startOffset = this.startOffset,
endOffset = this.endOffset,
childCount;
if ( startNode.type == CKEDITOR.NODE_ELEMENT ) {
childCount = startNode.getChildCount();
if ( childCount > startOffset )
startNode = ... | [
"function",
"(",
")",
"{",
"var",
"startNode",
"=",
"this",
".",
"startContainer",
",",
"endNode",
"=",
"this",
".",
"endContainer",
",",
"startOffset",
"=",
"this",
".",
"startOffset",
",",
"endOffset",
"=",
"this",
".",
"endOffset",
",",
"childCount",
";... | Returns two nodes which are on the boundaries of this range.
@returns {Object}
@returns {CKEDITOR.dom.node} return.startNode
@returns {CKEDITOR.dom.node} return.endNode
@todo precise desc/algorithm | [
"Returns",
"two",
"nodes",
"which",
"are",
"on",
"the",
"boundaries",
"of",
"this",
"range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L769-L818 | |
56,116 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( includeSelf, ignoreTextNode ) {
var start = this.startContainer,
end = this.endContainer,
ancestor;
if ( start.equals( end ) ) {
if ( includeSelf && start.type == CKEDITOR.NODE_ELEMENT && this.startOffset == this.endOffset - 1 )
ancestor = start.getChild( this.startOffset );
else
... | javascript | function( includeSelf, ignoreTextNode ) {
var start = this.startContainer,
end = this.endContainer,
ancestor;
if ( start.equals( end ) ) {
if ( includeSelf && start.type == CKEDITOR.NODE_ELEMENT && this.startOffset == this.endOffset - 1 )
ancestor = start.getChild( this.startOffset );
else
... | [
"function",
"(",
"includeSelf",
",",
"ignoreTextNode",
")",
"{",
"var",
"start",
"=",
"this",
".",
"startContainer",
",",
"end",
"=",
"this",
".",
"endContainer",
",",
"ancestor",
";",
"if",
"(",
"start",
".",
"equals",
"(",
"end",
")",
")",
"{",
"if",... | Find the node which fully contains the range.
@param {Boolean} [includeSelf=false]
@param {Boolean} [ignoreTextNode=false] Whether ignore {@link CKEDITOR#NODE_TEXT} type.
@returns {CKEDITOR.dom.element} | [
"Find",
"the",
"node",
"which",
"fully",
"contains",
"the",
"range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L827-L842 | |
56,117 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | getValidEnlargeable | function getValidEnlargeable( enlargeable ) {
return enlargeable && enlargeable.type == CKEDITOR.NODE_ELEMENT && enlargeable.hasAttribute( 'contenteditable' ) ?
null : enlargeable;
} | javascript | function getValidEnlargeable( enlargeable ) {
return enlargeable && enlargeable.type == CKEDITOR.NODE_ELEMENT && enlargeable.hasAttribute( 'contenteditable' ) ?
null : enlargeable;
} | [
"function",
"getValidEnlargeable",
"(",
"enlargeable",
")",
"{",
"return",
"enlargeable",
"&&",
"enlargeable",
".",
"type",
"==",
"CKEDITOR",
".",
"NODE_ELEMENT",
"&&",
"enlargeable",
".",
"hasAttribute",
"(",
"'contenteditable'",
")",
"?",
"null",
":",
"enlargeab... | Ensures that returned element can be enlarged by selection, null otherwise. @param {CKEDITOR.dom.element} enlargeable @returns {CKEDITOR.dom.element/null} | [
"Ensures",
"that",
"returned",
"element",
"can",
"be",
"enlarged",
"by",
"selection",
"null",
"otherwise",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1468-L1471 |
56,118 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( mode, selectContents, shrinkOnBlockBoundary ) {
// Unable to shrink a collapsed range.
if ( !this.collapsed ) {
mode = mode || CKEDITOR.SHRINK_TEXT;
var walkerRange = this.clone();
var startContainer = this.startContainer,
endContainer = this.endContainer,
startOffset = this.star... | javascript | function( mode, selectContents, shrinkOnBlockBoundary ) {
// Unable to shrink a collapsed range.
if ( !this.collapsed ) {
mode = mode || CKEDITOR.SHRINK_TEXT;
var walkerRange = this.clone();
var startContainer = this.startContainer,
endContainer = this.endContainer,
startOffset = this.star... | [
"function",
"(",
"mode",
",",
"selectContents",
",",
"shrinkOnBlockBoundary",
")",
"{",
"// Unable to shrink a collapsed range.",
"if",
"(",
"!",
"this",
".",
"collapsed",
")",
"{",
"mode",
"=",
"mode",
"||",
"CKEDITOR",
".",
"SHRINK_TEXT",
";",
"var",
"walkerRa... | Descrease the range to make sure that boundaries
always anchor beside text nodes or innermost element.
@param {Number} mode The shrinking mode ({@link CKEDITOR#SHRINK_ELEMENT} or {@link CKEDITOR#SHRINK_TEXT}).
* {@link CKEDITOR#SHRINK_ELEMENT} - Shrink the range boundaries to the edge of the innermost element.
* {@li... | [
"Descrease",
"the",
"range",
"to",
"make",
"sure",
"that",
"boundaries",
"always",
"anchor",
"beside",
"text",
"nodes",
"or",
"innermost",
"element",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1486-L1572 | |
56,119 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( node ) {
this.optimizeBookmark();
this.trim( false, true );
var startContainer = this.startContainer;
var startOffset = this.startOffset;
var nextNode = startContainer.getChild( startOffset );
if ( nextNode )
node.insertBefore( nextNode );
else
startContainer.append( node );
... | javascript | function( node ) {
this.optimizeBookmark();
this.trim( false, true );
var startContainer = this.startContainer;
var startOffset = this.startOffset;
var nextNode = startContainer.getChild( startOffset );
if ( nextNode )
node.insertBefore( nextNode );
else
startContainer.append( node );
... | [
"function",
"(",
"node",
")",
"{",
"this",
".",
"optimizeBookmark",
"(",
")",
";",
"this",
".",
"trim",
"(",
"false",
",",
"true",
")",
";",
"var",
"startContainer",
"=",
"this",
".",
"startContainer",
";",
"var",
"startOffset",
"=",
"this",
".",
"star... | Inserts a node at the start of the range. The range will be expanded
the contain the node.
@param {CKEDITOR.dom.node} node | [
"Inserts",
"a",
"node",
"at",
"the",
"start",
"of",
"the",
"range",
".",
"The",
"range",
"will",
"be",
"expanded",
"the",
"contain",
"the",
"node",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1580-L1600 | |
56,120 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( range ) {
this.setStart( range.startContainer, range.startOffset );
this.setEnd( range.endContainer, range.endOffset );
} | javascript | function( range ) {
this.setStart( range.startContainer, range.startOffset );
this.setEnd( range.endContainer, range.endOffset );
} | [
"function",
"(",
"range",
")",
"{",
"this",
".",
"setStart",
"(",
"range",
".",
"startContainer",
",",
"range",
".",
"startOffset",
")",
";",
"this",
".",
"setEnd",
"(",
"range",
".",
"endContainer",
",",
"range",
".",
"endOffset",
")",
";",
"}"
] | Moves the range to the exact position of the specified range.
@param {CKEDITOR.dom.range} range | [
"Moves",
"the",
"range",
"to",
"the",
"exact",
"position",
"of",
"the",
"specified",
"range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1626-L1629 | |
56,121 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( startNode, startOffset ) {
// W3C requires a check for the new position. If it is after the end
// boundary, the range should be collapsed to the new start. It seams
// we will not need this check for our use of this class so we can
// ignore it for now.
// Fixing invalid range start inside dt... | javascript | function( startNode, startOffset ) {
// W3C requires a check for the new position. If it is after the end
// boundary, the range should be collapsed to the new start. It seams
// we will not need this check for our use of this class so we can
// ignore it for now.
// Fixing invalid range start inside dt... | [
"function",
"(",
"startNode",
",",
"startOffset",
")",
"{",
"// W3C requires a check for the new position. If it is after the end",
"// boundary, the range should be collapsed to the new start. It seams",
"// we will not need this check for our use of this class so we can",
"// ignore it for now... | Sets the start position of a range.
@param {CKEDITOR.dom.node} startNode The node to start the range.
@param {Number} startOffset An integer greater than or equal to zero
representing the offset for the start of the range from the start
of `startNode`. | [
"Sets",
"the",
"start",
"position",
"of",
"a",
"range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1649-L1668 | |
56,122 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( endNode, endOffset ) {
// W3C requires a check for the new position. If it is before the start
// boundary, the range should be collapsed to the new end. It seams we
// will not need this check for our use of this class so we can ignore
// it for now.
// Fixing invalid range end inside dtd emp... | javascript | function( endNode, endOffset ) {
// W3C requires a check for the new position. If it is before the start
// boundary, the range should be collapsed to the new end. It seams we
// will not need this check for our use of this class so we can ignore
// it for now.
// Fixing invalid range end inside dtd emp... | [
"function",
"(",
"endNode",
",",
"endOffset",
")",
"{",
"// W3C requires a check for the new position. If it is before the start",
"// boundary, the range should be collapsed to the new end. It seams we",
"// will not need this check for our use of this class so we can ignore",
"// it for now.",... | Sets the end position of a Range.
@param {CKEDITOR.dom.node} endNode The node to end the range.
@param {Number} endOffset An integer greater than or equal to zero
representing the offset for the end of the range from the start
of `endNode`. | [
"Sets",
"the",
"end",
"position",
"of",
"a",
"Range",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1678-L1697 | |
56,123 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function( toSplit ) {
if ( !this.collapsed )
return null;
// Extract the contents of the block from the selection point to the end
// of its contents.
this.setEndAt( toSplit, CKEDITOR.POSITION_BEFORE_END );
var documentFragment = this.extractContents();
// Duplicate the element after it.
var ... | javascript | function( toSplit ) {
if ( !this.collapsed )
return null;
// Extract the contents of the block from the selection point to the end
// of its contents.
this.setEndAt( toSplit, CKEDITOR.POSITION_BEFORE_END );
var documentFragment = this.extractContents();
// Duplicate the element after it.
var ... | [
"function",
"(",
"toSplit",
")",
"{",
"if",
"(",
"!",
"this",
".",
"collapsed",
")",
"return",
"null",
";",
"// Extract the contents of the block from the selection point to the end",
"// of its contents.",
"this",
".",
"setEndAt",
"(",
"toSplit",
",",
"CKEDITOR",
"."... | Branch the specified element from the collapsed range position and
place the caret between the two result branches.
**Note:** The range must be collapsed and been enclosed by this element.
@param {CKEDITOR.dom.element} element
@returns {CKEDITOR.dom.element} Root element of the new branch after the split. | [
"Branch",
"the",
"specified",
"element",
"from",
"the",
"collapsed",
"range",
"position",
"and",
"place",
"the",
"caret",
"between",
"the",
"two",
"result",
"branches",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L1953-L1970 | |
56,124 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function() {
var walkerRange = this.clone();
// Optimize and analyze the range to avoid DOM destructive nature of walker. (#5780)
walkerRange.optimize();
if ( walkerRange.startContainer.type != CKEDITOR.NODE_ELEMENT || walkerRange.endContainer.type != CKEDITOR.NODE_ELEMENT )
return null;
var walker... | javascript | function() {
var walkerRange = this.clone();
// Optimize and analyze the range to avoid DOM destructive nature of walker. (#5780)
walkerRange.optimize();
if ( walkerRange.startContainer.type != CKEDITOR.NODE_ELEMENT || walkerRange.endContainer.type != CKEDITOR.NODE_ELEMENT )
return null;
var walker... | [
"function",
"(",
")",
"{",
"var",
"walkerRange",
"=",
"this",
".",
"clone",
"(",
")",
";",
"// Optimize and analyze the range to avoid DOM destructive nature of walker. (#5780)",
"walkerRange",
".",
"optimize",
"(",
")",
";",
"if",
"(",
"walkerRange",
".",
"startConta... | Get the single node enclosed within the range if there's one.
@returns {CKEDITOR.dom.node} | [
"Get",
"the",
"single",
"node",
"enclosed",
"within",
"the",
"range",
"if",
"there",
"s",
"one",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L2368-L2386 | |
56,125 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/core/dom/range.js | function() {
// The reference element contains a zero-width space to avoid
// a premature removal. The view is to be scrolled with respect
// to this element.
var reference = new CKEDITOR.dom.element.createFromHtml( '<span> </span>', this.document ),
afterCaretNode, startContainerText, isStartText... | javascript | function() {
// The reference element contains a zero-width space to avoid
// a premature removal. The view is to be scrolled with respect
// to this element.
var reference = new CKEDITOR.dom.element.createFromHtml( '<span> </span>', this.document ),
afterCaretNode, startContainerText, isStartText... | [
"function",
"(",
")",
"{",
"// The reference element contains a zero-width space to avoid",
"// a premature removal. The view is to be scrolled with respect",
"// to this element.",
"var",
"reference",
"=",
"new",
"CKEDITOR",
".",
"dom",
".",
"element",
".",
"createFromHtml",
"("... | Scrolls the start of current range into view. | [
"Scrolls",
"the",
"start",
"of",
"current",
"range",
"into",
"view",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/core/dom/range.js#L2440-L2483 | |
56,126 | JChapman202/flux-rx | src/PureView.js | shallowEquals | function shallowEquals(objA, objB) {
var returnVal = false;
if (objA === objB || objA === null && objB === null) {
returnVal = true;
}
if (!returnVal) {
var propsEqual = true;
if (Object.keys(objA).length === Object.keys(objB).length) {
for (var key in objA) {
propsEqual = propsEqual && objA[key] ===... | javascript | function shallowEquals(objA, objB) {
var returnVal = false;
if (objA === objB || objA === null && objB === null) {
returnVal = true;
}
if (!returnVal) {
var propsEqual = true;
if (Object.keys(objA).length === Object.keys(objB).length) {
for (var key in objA) {
propsEqual = propsEqual && objA[key] ===... | [
"function",
"shallowEquals",
"(",
"objA",
",",
"objB",
")",
"{",
"var",
"returnVal",
"=",
"false",
";",
"if",
"(",
"objA",
"===",
"objB",
"||",
"objA",
"===",
"null",
"&&",
"objB",
"===",
"null",
")",
"{",
"returnVal",
"=",
"true",
";",
"}",
"if",
... | Utility function which evaluates if the two provided instances
have all of the same properties as each other and if all
of the properties on each other are equal.
@param {Object} objA [description]
@param {Object} objB [description]
@return {Boolean} [description] | [
"Utility",
"function",
"which",
"evaluates",
"if",
"the",
"two",
"provided",
"instances",
"have",
"all",
"of",
"the",
"same",
"properties",
"as",
"each",
"other",
"and",
"if",
"all",
"of",
"the",
"properties",
"on",
"each",
"other",
"are",
"equal",
"."
] | 0063c400c991c5347e6a9751f9a86f8f2aa083fe | https://github.com/JChapman202/flux-rx/blob/0063c400c991c5347e6a9751f9a86f8f2aa083fe/src/PureView.js#L23-L42 |
56,127 | ngageoint/eslint-plugin-opensphere | no-suppress.js | checkCommentForSuppress | function checkCommentForSuppress(node) {
// Skip if types aren't provided or the comment is empty.
if (!node || !node.value || node.value.length === 0) {
return;
}
const match = node.value.match(/@suppress \{(.*?)\}/);
if (match && match.length === 2) {
if (!blacklistedTyp... | javascript | function checkCommentForSuppress(node) {
// Skip if types aren't provided or the comment is empty.
if (!node || !node.value || node.value.length === 0) {
return;
}
const match = node.value.match(/@suppress \{(.*?)\}/);
if (match && match.length === 2) {
if (!blacklistedTyp... | [
"function",
"checkCommentForSuppress",
"(",
"node",
")",
"{",
"// Skip if types aren't provided or the comment is empty.",
"if",
"(",
"!",
"node",
"||",
"!",
"node",
".",
"value",
"||",
"node",
".",
"value",
".",
"length",
"===",
"0",
")",
"{",
"return",
";",
... | Reports a given comment if it contains blocked suppress types.
@param {ASTNode} node A comment node to check. | [
"Reports",
"a",
"given",
"comment",
"if",
"it",
"contains",
"blocked",
"suppress",
"types",
"."
] | 3d1804b49a0349aeba0eb694e45266fb2cb2d83b | https://github.com/ngageoint/eslint-plugin-opensphere/blob/3d1804b49a0349aeba0eb694e45266fb2cb2d83b/no-suppress.js#L28-L55 |
56,128 | ForbesLindesay-Unmaintained/to-bool-function | index.js | toBoolFunction | function toBoolFunction(selector, condition) {
if (arguments.length == 2) {
selector = toBoolFunction(selector);
condition = toBoolFunction(condition);
return function () {
return condition(selector.apply(this, arguments));
};
} else {
condition = selector;
}
var alternate = false;
t... | javascript | function toBoolFunction(selector, condition) {
if (arguments.length == 2) {
selector = toBoolFunction(selector);
condition = toBoolFunction(condition);
return function () {
return condition(selector.apply(this, arguments));
};
} else {
condition = selector;
}
var alternate = false;
t... | [
"function",
"toBoolFunction",
"(",
"selector",
",",
"condition",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"==",
"2",
")",
"{",
"selector",
"=",
"toBoolFunction",
"(",
"selector",
")",
";",
"condition",
"=",
"toBoolFunction",
"(",
"condition",
")",
... | Convert various possible things into a match function
@param {Any} [selector]
@param {Any} condition
@return {Function} | [
"Convert",
"various",
"possible",
"things",
"into",
"a",
"match",
"function"
] | 731073819369d97559ef4038937df998df3e5e90 | https://github.com/ForbesLindesay-Unmaintained/to-bool-function/blob/731073819369d97559ef4038937df998df3e5e90/index.js#L12-L45 |
56,129 | ForbesLindesay-Unmaintained/to-bool-function | index.js | objectToFunction | function objectToFunction(obj) {
var fns = Object.keys(obj)
.map(function (key) {
return toBoolFunction(key, obj[key]);
});
return function(o){
for (var i = 0; i < fns.length; i++) {
if (!fns[i](o)) return false;
}
return true;
}
} | javascript | function objectToFunction(obj) {
var fns = Object.keys(obj)
.map(function (key) {
return toBoolFunction(key, obj[key]);
});
return function(o){
for (var i = 0; i < fns.length; i++) {
if (!fns[i](o)) return false;
}
return true;
}
} | [
"function",
"objectToFunction",
"(",
"obj",
")",
"{",
"var",
"fns",
"=",
"Object",
".",
"keys",
"(",
"obj",
")",
".",
"map",
"(",
"function",
"(",
"key",
")",
"{",
"return",
"toBoolFunction",
"(",
"key",
",",
"obj",
"[",
"key",
"]",
")",
";",
"}",
... | Convert `obj` into a match function.
@param {Object} obj
@return {Function}
@api private | [
"Convert",
"obj",
"into",
"a",
"match",
"function",
"."
] | 731073819369d97559ef4038937df998df3e5e90 | https://github.com/ForbesLindesay-Unmaintained/to-bool-function/blob/731073819369d97559ef4038937df998df3e5e90/index.js#L67-L78 |
56,130 | ForbesLindesay-Unmaintained/to-bool-function | index.js | stringToFunction | function stringToFunction(str) {
// immediate such as "> 20"
if (/^ *\W+/.test(str)) return new Function('_', 'return _ ' + str);
// properties such as "name.first" or "age > 18"
var fn = new Function('_', 'return _.' + str);
return fn
} | javascript | function stringToFunction(str) {
// immediate such as "> 20"
if (/^ *\W+/.test(str)) return new Function('_', 'return _ ' + str);
// properties such as "name.first" or "age > 18"
var fn = new Function('_', 'return _.' + str);
return fn
} | [
"function",
"stringToFunction",
"(",
"str",
")",
"{",
"// immediate such as \"> 20\"",
"if",
"(",
"/",
"^ *\\W+",
"/",
".",
"test",
"(",
"str",
")",
")",
"return",
"new",
"Function",
"(",
"'_'",
",",
"'return _ '",
"+",
"str",
")",
";",
"// properties such a... | Convert property `str` to a function.
@param {String} str
@return {Function}
@api private | [
"Convert",
"property",
"str",
"to",
"a",
"function",
"."
] | 731073819369d97559ef4038937df998df3e5e90 | https://github.com/ForbesLindesay-Unmaintained/to-bool-function/blob/731073819369d97559ef4038937df998df3e5e90/index.js#L88-L95 |
56,131 | benzhou1/iod | index.js | function(apiKey, host, port, reqOpts) {
var iod = this
if (_.isObject(host)) {
reqOpts = host
host = null
}
else if (_.isObject(port)) {
reqOpts = port
port = null
}
if (!apiKey) throw Error('IOD apiKey is missing!')
else if (host && !url.parse(host, false, true).protocol) {
throw Error('Protocol not... | javascript | function(apiKey, host, port, reqOpts) {
var iod = this
if (_.isObject(host)) {
reqOpts = host
host = null
}
else if (_.isObject(port)) {
reqOpts = port
port = null
}
if (!apiKey) throw Error('IOD apiKey is missing!')
else if (host && !url.parse(host, false, true).protocol) {
throw Error('Protocol not... | [
"function",
"(",
"apiKey",
",",
"host",
",",
"port",
",",
"reqOpts",
")",
"{",
"var",
"iod",
"=",
"this",
"if",
"(",
"_",
".",
"isObject",
"(",
"host",
")",
")",
"{",
"reqOpts",
"=",
"host",
"host",
"=",
"null",
"}",
"else",
"if",
"(",
"_",
"."... | Creates a IOD object with specified apiKey, host and port.
@param {String} apiKey - Api key
@param {String} [host] - IOD host
@param {Integer | null} [port] - IOD port
@param {Integer} [reqOpts] - Request options
@property {String} apiKey - Api key
@property {String} host - IOD host
@property {Integer} port - IOD port... | [
"Creates",
"a",
"IOD",
"object",
"with",
"specified",
"apiKey",
"host",
"and",
"port",
"."
] | a346628f9bc5e4420e4d00e8f21c4cb268b6237c | https://github.com/benzhou1/iod/blob/a346628f9bc5e4420e4d00e8f21c4cb268b6237c/index.js#L35-L73 | |
56,132 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | insert_token | function insert_token(item) {
var $this_token = $($(input).data("settings").tokenFormatter(item));
var readonly = item.readonly === true ? true : false;
if(readonly) $this_token.addClass($(input).data("settings").classes.tokenReadOnly);
$this_token.addClass($(input).data("setti... | javascript | function insert_token(item) {
var $this_token = $($(input).data("settings").tokenFormatter(item));
var readonly = item.readonly === true ? true : false;
if(readonly) $this_token.addClass($(input).data("settings").classes.tokenReadOnly);
$this_token.addClass($(input).data("setti... | [
"function",
"insert_token",
"(",
"item",
")",
"{",
"var",
"$this_token",
"=",
"$",
"(",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"tokenFormatter",
"(",
"item",
")",
")",
";",
"var",
"readonly",
"=",
"item",
".",
"readonly",
... | Inner function to a token to the list | [
"Inner",
"function",
"to",
"a",
"token",
"to",
"the",
"list"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L607-L649 |
56,133 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | add_token | function add_token (item) {
var callback = $(input).data("settings").onAdd;
// See if the token already exists and select it if we don't want duplicates
if(token_count > 0 && $(input).data("settings").preventDuplicates) {
var found_existing_token = null;
token_... | javascript | function add_token (item) {
var callback = $(input).data("settings").onAdd;
// See if the token already exists and select it if we don't want duplicates
if(token_count > 0 && $(input).data("settings").preventDuplicates) {
var found_existing_token = null;
token_... | [
"function",
"add_token",
"(",
"item",
")",
"{",
"var",
"callback",
"=",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"onAdd",
";",
"// See if the token already exists and select it if we don't want duplicates",
"if",
"(",
"token_count",
">",
... | Add a token to the token list based on user input | [
"Add",
"a",
"token",
"to",
"the",
"token",
"list",
"based",
"on",
"user",
"input"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L652-L696 |
56,134 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | select_token | function select_token (token) {
if (!$(input).data("settings").disabled) {
token.addClass($(input).data("settings").classes.selectedToken);
selected_token = token.get(0);
// Hide input box
input_box.val("");
// Hide dropdown if it is visi... | javascript | function select_token (token) {
if (!$(input).data("settings").disabled) {
token.addClass($(input).data("settings").classes.selectedToken);
selected_token = token.get(0);
// Hide input box
input_box.val("");
// Hide dropdown if it is visi... | [
"function",
"select_token",
"(",
"token",
")",
"{",
"if",
"(",
"!",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"disabled",
")",
"{",
"token",
".",
"addClass",
"(",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
"... | Select a token in the token list | [
"Select",
"a",
"token",
"in",
"the",
"token",
"list"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L699-L710 |
56,135 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | deselect_token | function deselect_token (token, position) {
token.removeClass($(input).data("settings").classes.selectedToken);
selected_token = null;
if(position === POSITION.BEFORE) {
input_token.insertBefore(token);
selected_token_index--;
} else if(position === P... | javascript | function deselect_token (token, position) {
token.removeClass($(input).data("settings").classes.selectedToken);
selected_token = null;
if(position === POSITION.BEFORE) {
input_token.insertBefore(token);
selected_token_index--;
} else if(position === P... | [
"function",
"deselect_token",
"(",
"token",
",",
"position",
")",
"{",
"token",
".",
"removeClass",
"(",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"classes",
".",
"selectedToken",
")",
";",
"selected_token",
"=",
"null",
";",
"i... | Deselect a token in the token list | [
"Deselect",
"a",
"token",
"in",
"the",
"token",
"list"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L713-L730 |
56,136 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | toggle_select_token | function toggle_select_token(token) {
var previous_selected_token = selected_token;
if(selected_token) {
deselect_token($(selected_token), POSITION.END);
}
if(previous_selected_token === token.get(0)) {
deselect_token(token, POSITION.END);
... | javascript | function toggle_select_token(token) {
var previous_selected_token = selected_token;
if(selected_token) {
deselect_token($(selected_token), POSITION.END);
}
if(previous_selected_token === token.get(0)) {
deselect_token(token, POSITION.END);
... | [
"function",
"toggle_select_token",
"(",
"token",
")",
"{",
"var",
"previous_selected_token",
"=",
"selected_token",
";",
"if",
"(",
"selected_token",
")",
"{",
"deselect_token",
"(",
"$",
"(",
"selected_token",
")",
",",
"POSITION",
".",
"END",
")",
";",
"}",
... | Toggle selection of a token in the token list | [
"Toggle",
"selection",
"of",
"a",
"token",
"in",
"the",
"token",
"list"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L733-L745 |
56,137 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | delete_token | function delete_token (token) {
// Remove the id from the saved list
var token_data = $.data(token.get(0), "tokeninput");
var callback = $(input).data("settings").onDelete;
var index = token.prevAll().length;
if(index > selected_token_index) index--;
// Dele... | javascript | function delete_token (token) {
// Remove the id from the saved list
var token_data = $.data(token.get(0), "tokeninput");
var callback = $(input).data("settings").onDelete;
var index = token.prevAll().length;
if(index > selected_token_index) index--;
// Dele... | [
"function",
"delete_token",
"(",
"token",
")",
"{",
"// Remove the id from the saved list",
"var",
"token_data",
"=",
"$",
".",
"data",
"(",
"token",
".",
"get",
"(",
"0",
")",
",",
"\"tokeninput\"",
")",
";",
"var",
"callback",
"=",
"$",
"(",
"input",
")"... | Delete a token from the token list | [
"Delete",
"a",
"token",
"from",
"the",
"token",
"list"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L748-L786 |
56,138 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | update_hidden_input | function update_hidden_input(saved_tokens, hidden_input) {
var token_values = $.map(saved_tokens, function (el) {
if(typeof $(input).data("settings").tokenValue == 'function')
return $(input).data("settings").tokenValue.call(this, el);
return el[$(input).data("sett... | javascript | function update_hidden_input(saved_tokens, hidden_input) {
var token_values = $.map(saved_tokens, function (el) {
if(typeof $(input).data("settings").tokenValue == 'function')
return $(input).data("settings").tokenValue.call(this, el);
return el[$(input).data("sett... | [
"function",
"update_hidden_input",
"(",
"saved_tokens",
",",
"hidden_input",
")",
"{",
"var",
"token_values",
"=",
"$",
".",
"map",
"(",
"saved_tokens",
",",
"function",
"(",
"el",
")",
"{",
"if",
"(",
"typeof",
"$",
"(",
"input",
")",
".",
"data",
"(",
... | Update the hidden input box value | [
"Update",
"the",
"hidden",
"input",
"box",
"value"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L789-L798 |
56,139 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | highlight_term | function highlight_term(value, term) {
return value.replace(
new RegExp(
"(?![^&;]+;)(?!<[^<>]*)(" + regexp_escape(term) + ")(?![^<>]*>)(?![^&;]+;)",
"gi"
), function(match, p1) {
return "<b>" + escapeHTML(p1) + "</b>";
}
... | javascript | function highlight_term(value, term) {
return value.replace(
new RegExp(
"(?![^&;]+;)(?!<[^<>]*)(" + regexp_escape(term) + ")(?![^<>]*>)(?![^&;]+;)",
"gi"
), function(match, p1) {
return "<b>" + escapeHTML(p1) + "</b>";
}
... | [
"function",
"highlight_term",
"(",
"value",
",",
"term",
")",
"{",
"return",
"value",
".",
"replace",
"(",
"new",
"RegExp",
"(",
"\"(?![^&;]+;)(?!<[^<>]*)(\"",
"+",
"regexp_escape",
"(",
"term",
")",
"+",
"\")(?![^<>]*>)(?![^&;]+;)\"",
",",
"\"gi\"",
")",
",",
... | Highlight the query part of the search term | [
"Highlight",
"the",
"query",
"part",
"of",
"the",
"search",
"term"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L838-L847 |
56,140 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | excludeCurrent | function excludeCurrent(results) {
if ($(input).data("settings").excludeCurrent) {
var currentTokens = $(input).data("tokenInputObject").getTokens(),
trimmedList = [];
if (currentTokens.length) {
$.each(results, function(index, value) {
... | javascript | function excludeCurrent(results) {
if ($(input).data("settings").excludeCurrent) {
var currentTokens = $(input).data("tokenInputObject").getTokens(),
trimmedList = [];
if (currentTokens.length) {
$.each(results, function(index, value) {
... | [
"function",
"excludeCurrent",
"(",
"results",
")",
"{",
"if",
"(",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"excludeCurrent",
")",
"{",
"var",
"currentTokens",
"=",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"tokenInputObject\... | exclude existing tokens from dropdown, so the list is clearer | [
"exclude",
"existing",
"tokens",
"from",
"dropdown",
"so",
"the",
"list",
"is",
"clearer"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L854-L877 |
56,141 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | populate_dropdown | function populate_dropdown (query, results) {
// exclude current tokens if configured
results = excludeCurrent(results);
if(results && results.length) {
dropdown.empty();
var dropdown_ul = $("<ul/>")
.appendTo(dropdown)
.mous... | javascript | function populate_dropdown (query, results) {
// exclude current tokens if configured
results = excludeCurrent(results);
if(results && results.length) {
dropdown.empty();
var dropdown_ul = $("<ul/>")
.appendTo(dropdown)
.mous... | [
"function",
"populate_dropdown",
"(",
"query",
",",
"results",
")",
"{",
"// exclude current tokens if configured",
"results",
"=",
"excludeCurrent",
"(",
"results",
")",
";",
"if",
"(",
"results",
"&&",
"results",
".",
"length",
")",
"{",
"dropdown",
".",
"empt... | Populate the results dropdown with some results | [
"Populate",
"the",
"results",
"dropdown",
"with",
"some",
"results"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L880-L934 |
56,142 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | select_dropdown_item | function select_dropdown_item (item) {
if(item) {
if(selected_dropdown_item) {
deselect_dropdown_item($(selected_dropdown_item));
}
item.addClass($(input).data("settings").classes.selectedDropdownItem);
selected_dropdown_item = item.ge... | javascript | function select_dropdown_item (item) {
if(item) {
if(selected_dropdown_item) {
deselect_dropdown_item($(selected_dropdown_item));
}
item.addClass($(input).data("settings").classes.selectedDropdownItem);
selected_dropdown_item = item.ge... | [
"function",
"select_dropdown_item",
"(",
"item",
")",
"{",
"if",
"(",
"item",
")",
"{",
"if",
"(",
"selected_dropdown_item",
")",
"{",
"deselect_dropdown_item",
"(",
"$",
"(",
"selected_dropdown_item",
")",
")",
";",
"}",
"item",
".",
"addClass",
"(",
"$",
... | Highlight an item in the results dropdown | [
"Highlight",
"an",
"item",
"in",
"the",
"results",
"dropdown"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L937-L946 |
56,143 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | deselect_dropdown_item | function deselect_dropdown_item (item) {
item.removeClass($(input).data("settings").classes.selectedDropdownItem);
selected_dropdown_item = null;
} | javascript | function deselect_dropdown_item (item) {
item.removeClass($(input).data("settings").classes.selectedDropdownItem);
selected_dropdown_item = null;
} | [
"function",
"deselect_dropdown_item",
"(",
"item",
")",
"{",
"item",
".",
"removeClass",
"(",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"classes",
".",
"selectedDropdownItem",
")",
";",
"selected_dropdown_item",
"=",
"null",
";",
"}... | Remove highlighting from an item in the results dropdown | [
"Remove",
"highlighting",
"from",
"an",
"item",
"in",
"the",
"results",
"dropdown"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L949-L952 |
56,144 | icanjs/grid-filter | src/jquery-tokeninput/jquery-tokeninput.js | computeURL | function computeURL() {
var url = $(input).data("settings").url;
if(typeof $(input).data("settings").url == 'function') {
url = $(input).data("settings").url.call($(input).data("settings"));
}
return url;
} | javascript | function computeURL() {
var url = $(input).data("settings").url;
if(typeof $(input).data("settings").url == 'function') {
url = $(input).data("settings").url.call($(input).data("settings"));
}
return url;
} | [
"function",
"computeURL",
"(",
")",
"{",
"var",
"url",
"=",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"url",
";",
"if",
"(",
"typeof",
"$",
"(",
"input",
")",
".",
"data",
"(",
"\"settings\"",
")",
".",
"url",
"==",
"'fu... | compute the dynamic URL | [
"compute",
"the",
"dynamic",
"URL"
] | 48d9ce876cdc6ef459fcae70ac67b23229e85a5a | https://github.com/icanjs/grid-filter/blob/48d9ce876cdc6ef459fcae70ac67b23229e85a5a/src/jquery-tokeninput/jquery-tokeninput.js#L1064-L1070 |
56,145 | shyam-dasgupta/mongo-query-builder | index.js | _matchAllFields | function _matchAllFields(fields, matchAnyRegex) {
var regExp = regExps ? matchAnyRegex ? regExps.any : regExps.all : null;
if (regExp) {
for (var i = 0; i < fields.length; ++i) {
parentBuilder.field(fields[i]).is("$regex", regExp);
}
}
return paren... | javascript | function _matchAllFields(fields, matchAnyRegex) {
var regExp = regExps ? matchAnyRegex ? regExps.any : regExps.all : null;
if (regExp) {
for (var i = 0; i < fields.length; ++i) {
parentBuilder.field(fields[i]).is("$regex", regExp);
}
}
return paren... | [
"function",
"_matchAllFields",
"(",
"fields",
",",
"matchAnyRegex",
")",
"{",
"var",
"regExp",
"=",
"regExps",
"?",
"matchAnyRegex",
"?",
"regExps",
".",
"any",
":",
"regExps",
".",
"all",
":",
"null",
";",
"if",
"(",
"regExp",
")",
"{",
"for",
"(",
"v... | Matches the given Regular expression with all the fields.
@param {Array.<string>} fields Array of document fields.
@param {boolean} [matchAnyRegex=false] If true, match any
of the search query tokens, else match all.
@returns {QueryBuilder} the parent Builder.
@private | [
"Matches",
"the",
"given",
"Regular",
"expression",
"with",
"all",
"the",
"fields",
"."
] | adc7af2389aeba40d3041e81c91ffee9bd6ca68a | https://github.com/shyam-dasgupta/mongo-query-builder/blob/adc7af2389aeba40d3041e81c91ffee9bd6ca68a/index.js#L39-L47 |
56,146 | shyam-dasgupta/mongo-query-builder | index.js | _matchAnyField | function _matchAnyField(fields, matchAnyRegex) {
var regExp = regExps ? matchAnyRegex ? regExps.any : regExps.all : null;
if (regExp) {
var orBuilder = parentBuilder.either();
for (var i = 0; i < fields.length; ++i) {
orBuilder = orBuilder.or().field(fields[i]).is... | javascript | function _matchAnyField(fields, matchAnyRegex) {
var regExp = regExps ? matchAnyRegex ? regExps.any : regExps.all : null;
if (regExp) {
var orBuilder = parentBuilder.either();
for (var i = 0; i < fields.length; ++i) {
orBuilder = orBuilder.or().field(fields[i]).is... | [
"function",
"_matchAnyField",
"(",
"fields",
",",
"matchAnyRegex",
")",
"{",
"var",
"regExp",
"=",
"regExps",
"?",
"matchAnyRegex",
"?",
"regExps",
".",
"any",
":",
"regExps",
".",
"all",
":",
"null",
";",
"if",
"(",
"regExp",
")",
"{",
"var",
"orBuilder... | Matches the given Regular expression with at least one
of the fields.
@param {Array.<string>} fields Array of document fields.
@param {boolean} [matchAnyRegex=false] If true, match any
of the search query tokens, else match all.
@returns {QueryBuilder} the parent Builder.
@private | [
"Matches",
"the",
"given",
"Regular",
"expression",
"with",
"at",
"least",
"one",
"of",
"the",
"fields",
"."
] | adc7af2389aeba40d3041e81c91ffee9bd6ca68a | https://github.com/shyam-dasgupta/mongo-query-builder/blob/adc7af2389aeba40d3041e81c91ffee9bd6ca68a/index.js#L58-L67 |
56,147 | shyam-dasgupta/mongo-query-builder | index.js | function (parentBuilder, field) {
if (!dataUtils.isValidStr(field)) throw "Invalid field, should be a string: " + dataUtils.JSONstringify(field);
/**
* Ensures a comparison of the field with the value.
* @param {string} comparator e.g. "$gt", "$gte", etc.
* @param {*} value
* @returns {Quer... | javascript | function (parentBuilder, field) {
if (!dataUtils.isValidStr(field)) throw "Invalid field, should be a string: " + dataUtils.JSONstringify(field);
/**
* Ensures a comparison of the field with the value.
* @param {string} comparator e.g. "$gt", "$gte", etc.
* @param {*} value
* @returns {Quer... | [
"function",
"(",
"parentBuilder",
",",
"field",
")",
"{",
"if",
"(",
"!",
"dataUtils",
".",
"isValidStr",
"(",
"field",
")",
")",
"throw",
"\"Invalid field, should be a string: \"",
"+",
"dataUtils",
".",
"JSONstringify",
"(",
"field",
")",
";",
"/**\n * Ens... | This builder helps create efficient queries and expressions
for document fields.
@param {QueryBuilder} parentBuilder The parent query builder.
@param {string} field A field in the target document.
@constructor | [
"This",
"builder",
"helps",
"create",
"efficient",
"queries",
"and",
"expressions",
"for",
"document",
"fields",
"."
] | adc7af2389aeba40d3041e81c91ffee9bd6ca68a | https://github.com/shyam-dasgupta/mongo-query-builder/blob/adc7af2389aeba40d3041e81c91ffee9bd6ca68a/index.js#L180-L226 | |
56,148 | shyam-dasgupta/mongo-query-builder | index.js | function () {
var _orBuilder = this;
var _queries = [];
var _currentChildBuilder = new ChildQueryBuilder(_orBuilder);
/**
* Process the current OR entry, and continue adding to this OR
* query group.
* @returns {ChildQueryBuilder} A new {@link ChildQueryBuilder}
* child in this OR g... | javascript | function () {
var _orBuilder = this;
var _queries = [];
var _currentChildBuilder = new ChildQueryBuilder(_orBuilder);
/**
* Process the current OR entry, and continue adding to this OR
* query group.
* @returns {ChildQueryBuilder} A new {@link ChildQueryBuilder}
* child in this OR g... | [
"function",
"(",
")",
"{",
"var",
"_orBuilder",
"=",
"this",
";",
"var",
"_queries",
"=",
"[",
"]",
";",
"var",
"_currentChildBuilder",
"=",
"new",
"ChildQueryBuilder",
"(",
"_orBuilder",
")",
";",
"/**\n * Process the current OR entry, and continue adding to this... | This builder helps create efficient OR queries and expressions.
@constructor | [
"This",
"builder",
"helps",
"create",
"efficient",
"OR",
"queries",
"and",
"expressions",
"."
] | adc7af2389aeba40d3041e81c91ffee9bd6ca68a | https://github.com/shyam-dasgupta/mongo-query-builder/blob/adc7af2389aeba40d3041e81c91ffee9bd6ca68a/index.js#L232-L265 | |
56,149 | travism/solid-logger-js | lib/solid-logger.js | init | function init(configuration){
var self = {
config : configuration,
adapters : [],
getWhenCurrentWritesDone : getWhenCurrentWritesDone
};
_.each(self.config.adapters, function(adapter){
var adapterInstance;
try {
adapterInstance = require('./adapters/' + ... | javascript | function init(configuration){
var self = {
config : configuration,
adapters : [],
getWhenCurrentWritesDone : getWhenCurrentWritesDone
};
_.each(self.config.adapters, function(adapter){
var adapterInstance;
try {
adapterInstance = require('./adapters/' + ... | [
"function",
"init",
"(",
"configuration",
")",
"{",
"var",
"self",
"=",
"{",
"config",
":",
"configuration",
",",
"adapters",
":",
"[",
"]",
",",
"getWhenCurrentWritesDone",
":",
"getWhenCurrentWritesDone",
"}",
";",
"_",
".",
"each",
"(",
"self",
".",
"co... | Public method required to load in all of the configuration info for adapters.
Init initialize and reinitializes, so the list of adapters is set to empty before it runs.
@param configuration Object for your adapters.
@returns {logger} | [
"Public",
"method",
"required",
"to",
"load",
"in",
"all",
"of",
"the",
"configuration",
"info",
"for",
"adapters",
".",
"Init",
"initialize",
"and",
"reinitializes",
"so",
"the",
"list",
"of",
"adapters",
"is",
"set",
"to",
"empty",
"before",
"it",
"runs",
... | e5287dcfc680fcfa3eb449dd29bc8c92106184a9 | https://github.com/travism/solid-logger-js/blob/e5287dcfc680fcfa3eb449dd29bc8c92106184a9/lib/solid-logger.js#L23-L70 |
56,150 | travism/solid-logger-js | lib/solid-logger.js | initWithFile | function initWithFile(configPath){
var configString = fs.readFileSync(path.resolve(configPath));
this.config = JSON.parse(configString);
this.init(this.config);
return this;
} | javascript | function initWithFile(configPath){
var configString = fs.readFileSync(path.resolve(configPath));
this.config = JSON.parse(configString);
this.init(this.config);
return this;
} | [
"function",
"initWithFile",
"(",
"configPath",
")",
"{",
"var",
"configString",
"=",
"fs",
".",
"readFileSync",
"(",
"path",
".",
"resolve",
"(",
"configPath",
")",
")",
";",
"this",
".",
"config",
"=",
"JSON",
".",
"parse",
"(",
"configString",
")",
";"... | Method that will load configuration info for your adapters from a file.
Method that will load configuration info for your adapters from a file.
@param configPath path to your configuration file
@returns {logger} | [
"Method",
"that",
"will",
"load",
"configuration",
"info",
"for",
"your",
"adapters",
"from",
"a",
"file",
".",
"Method",
"that",
"will",
"load",
"configuration",
"info",
"for",
"your",
"adapters",
"from",
"a",
"file",
"."
] | e5287dcfc680fcfa3eb449dd29bc8c92106184a9 | https://github.com/travism/solid-logger-js/blob/e5287dcfc680fcfa3eb449dd29bc8c92106184a9/lib/solid-logger.js#L78-L85 |
56,151 | travism/solid-logger-js | lib/solid-logger.js | _write | function _write(type, category, message){
var config = this.config;
this.adapters.forEach(function(adapter) {
//Check configuration to see if we should continue.
if(adapter.config.filter && (adapter.config.filter.indexOf(type) > -1)){
return;
}
//We are not filterin... | javascript | function _write(type, category, message){
var config = this.config;
this.adapters.forEach(function(adapter) {
//Check configuration to see if we should continue.
if(adapter.config.filter && (adapter.config.filter.indexOf(type) > -1)){
return;
}
//We are not filterin... | [
"function",
"_write",
"(",
"type",
",",
"category",
",",
"message",
")",
"{",
"var",
"config",
"=",
"this",
".",
"config",
";",
"this",
".",
"adapters",
".",
"forEach",
"(",
"function",
"(",
"adapter",
")",
"{",
"//Check configuration to see if we should conti... | Local method to load up a write 'job'. We create a tracker so that the async callbacks stay in order and then we
kick off the adapterWrite method which recursively loads the adapters and write per their 'write' method. It will
also load in the configuration for the adapter each time so you can have the same type of ada... | [
"Local",
"method",
"to",
"load",
"up",
"a",
"write",
"job",
".",
"We",
"create",
"a",
"tracker",
"so",
"that",
"the",
"async",
"callbacks",
"stay",
"in",
"order",
"and",
"then",
"we",
"kick",
"off",
"the",
"adapterWrite",
"method",
"which",
"recursively",
... | e5287dcfc680fcfa3eb449dd29bc8c92106184a9 | https://github.com/travism/solid-logger-js/blob/e5287dcfc680fcfa3eb449dd29bc8c92106184a9/lib/solid-logger.js#L109-L121 |
56,152 | CloudCoreo/gitane-windows | index.js | clone | function clone(args, baseDir, privKey, cb) {
run(baseDir, privKey, "git clone " + args, cb)
} | javascript | function clone(args, baseDir, privKey, cb) {
run(baseDir, privKey, "git clone " + args, cb)
} | [
"function",
"clone",
"(",
"args",
",",
"baseDir",
",",
"privKey",
",",
"cb",
")",
"{",
"run",
"(",
"baseDir",
",",
"privKey",
",",
"\"git clone \"",
"+",
"args",
",",
"cb",
")",
"}"
] | convenience wrapper for clone. maybe add more later. | [
"convenience",
"wrapper",
"for",
"clone",
".",
"maybe",
"add",
"more",
"later",
"."
] | 4adf92f1640cc7e5c34ccc17722d0ecf409e03d7 | https://github.com/CloudCoreo/gitane-windows/blob/4adf92f1640cc7e5c34ccc17722d0ecf409e03d7/index.js#L185-L187 |
56,153 | bestander/jasmine-node-sugar | index.js | function (spec) {
spec.addMatchers({
/**
* Array contains all elements of another array
* @param needles another array
* @returns {Boolean} true/false
*/
toContainAll: function(needles) {
var haystack = this.actual;
return needles.every(function (elem) {
... | javascript | function (spec) {
spec.addMatchers({
/**
* Array contains all elements of another array
* @param needles another array
* @returns {Boolean} true/false
*/
toContainAll: function(needles) {
var haystack = this.actual;
return needles.every(function (elem) {
... | [
"function",
"(",
"spec",
")",
"{",
"spec",
".",
"addMatchers",
"(",
"{",
"/**\n * Array contains all elements of another array\n * @param needles another array\n * @returns {Boolean} true/false\n */",
"toContainAll",
":",
"function",
"(",
"needles",
")",
"{"... | call this in beforeEach method to add more available matchers
@param spec "this" within spec | [
"call",
"this",
"in",
"beforeEach",
"method",
"to",
"add",
"more",
"available",
"matchers"
] | 8e49710fa63b6216ec717b4dbecd84a77eee2148 | https://github.com/bestander/jasmine-node-sugar/blob/8e49710fa63b6216ec717b4dbecd84a77eee2148/index.js#L20-L36 | |
56,154 | kjirou/mocha-automatic-coffeemaker | index.js | function(data) {
var filePath = data.filePath;
var noExtensionFilePath = data.noExtensionFilePath;
var fileName = data.fileName;
var noExtensionFileName = data.noExtensionFileName;
return [
"describe('" + noExtensionFilePath + "', function() {",
"});",
].join('\n');
} | javascript | function(data) {
var filePath = data.filePath;
var noExtensionFilePath = data.noExtensionFilePath;
var fileName = data.fileName;
var noExtensionFileName = data.noExtensionFileName;
return [
"describe('" + noExtensionFilePath + "', function() {",
"});",
].join('\n');
} | [
"function",
"(",
"data",
")",
"{",
"var",
"filePath",
"=",
"data",
".",
"filePath",
";",
"var",
"noExtensionFilePath",
"=",
"data",
".",
"noExtensionFilePath",
";",
"var",
"fileName",
"=",
"data",
".",
"fileName",
";",
"var",
"noExtensionFileName",
"=",
"dat... | get test code template | [
"get",
"test",
"code",
"template"
] | 52db2766030bc039e9f9ffc133dbd2b8bc162085 | https://github.com/kjirou/mocha-automatic-coffeemaker/blob/52db2766030bc039e9f9ffc133dbd2b8bc162085/index.js#L54-L64 | |
56,155 | 75lb/reduce-extract | lib/reduce-extract.js | extract | function extract (query) {
var toSplice = []
var extracted = []
return function (prev, curr, index, array) {
if (prev !== extracted) {
if (testValue(prev, query)) {
extracted.push(prev)
toSplice.push(index - 1)
}
}
if (testValue(curr, query)) {
extracted.push(curr)
... | javascript | function extract (query) {
var toSplice = []
var extracted = []
return function (prev, curr, index, array) {
if (prev !== extracted) {
if (testValue(prev, query)) {
extracted.push(prev)
toSplice.push(index - 1)
}
}
if (testValue(curr, query)) {
extracted.push(curr)
... | [
"function",
"extract",
"(",
"query",
")",
"{",
"var",
"toSplice",
"=",
"[",
"]",
"var",
"extracted",
"=",
"[",
"]",
"return",
"function",
"(",
"prev",
",",
"curr",
",",
"index",
",",
"array",
")",
"{",
"if",
"(",
"prev",
"!==",
"extracted",
")",
"{... | Removes items from `array` which satisfy the query. Modifies the input array, returns the extracted.
@param {Array} - the input array, modified directly
@param {any} - if an item in the input array passes this test it is removed
@alias module:reduce-extract
@example
> DJs = [
{ name: "Trevor", sacked: true },
{ name: ... | [
"Removes",
"items",
"from",
"array",
"which",
"satisfy",
"the",
"query",
".",
"Modifies",
"the",
"input",
"array",
"returns",
"the",
"extracted",
"."
] | 6482517dd0107b4adea56aa3516e586c189e44f5 | https://github.com/75lb/reduce-extract/blob/6482517dd0107b4adea56aa3516e586c189e44f5/lib/reduce-extract.js#L32-L56 |
56,156 | fresheneesz/grapetree-core | grapetreeCore.js | getNewRouteInfo | function getNewRouteInfo(that, newRoutePath, path, pathToEmit) {
var indexes = getDivergenceIndexes(that.currentPath, path, newRoutePath)
if(indexes === undefined) {
return undefined
}
var routeDivergenceIndex = indexes.routeIndex
var pathDivergenceIndex = indexes.pa... | javascript | function getNewRouteInfo(that, newRoutePath, path, pathToEmit) {
var indexes = getDivergenceIndexes(that.currentPath, path, newRoutePath)
if(indexes === undefined) {
return undefined
}
var routeDivergenceIndex = indexes.routeIndex
var pathDivergenceIndex = indexes.pa... | [
"function",
"getNewRouteInfo",
"(",
"that",
",",
"newRoutePath",
",",
"path",
",",
"pathToEmit",
")",
"{",
"var",
"indexes",
"=",
"getDivergenceIndexes",
"(",
"that",
".",
"currentPath",
",",
"path",
",",
"newRoutePath",
")",
"if",
"(",
"indexes",
"===",
"un... | returns an object with the properties newRoutes - an array of Route objects; the list of new routes to enter divergenceIndex - the route divergence index pathToEmit - the path to use when emitting the 'change' event or undefined - if the paths are the same | [
"returns",
"an",
"object",
"with",
"the",
"properties",
"newRoutes",
"-",
"an",
"array",
"of",
"Route",
"objects",
";",
"the",
"list",
"of",
"new",
"routes",
"to",
"enter",
"divergenceIndex",
"-",
"the",
"route",
"divergence",
"index",
"pathToEmit",
"-",
"th... | 3dbe622ba56cb1d227e104dd68d4787ae9aaf201 | https://github.com/fresheneesz/grapetree-core/blob/3dbe622ba56cb1d227e104dd68d4787ae9aaf201/grapetreeCore.js#L136-L182 |
56,157 | fresheneesz/grapetree-core | grapetreeCore.js | loopThroughHandlers | function loopThroughHandlers(lastFuture, n) {
if(n < routes.length) {
var route = routes[n].route
var handler = route[handlerProperty]
if(direction === -1) {
var originalIndexFromCurrentRoutes = currentRoutes.length - n - 1
... | javascript | function loopThroughHandlers(lastFuture, n) {
if(n < routes.length) {
var route = routes[n].route
var handler = route[handlerProperty]
if(direction === -1) {
var originalIndexFromCurrentRoutes = currentRoutes.length - n - 1
... | [
"function",
"loopThroughHandlers",
"(",
"lastFuture",
",",
"n",
")",
"{",
"if",
"(",
"n",
"<",
"routes",
".",
"length",
")",
"{",
"var",
"route",
"=",
"routes",
"[",
"n",
"]",
".",
"route",
"var",
"handler",
"=",
"route",
"[",
"handlerProperty",
"]",
... | returns a future that resolves to the maximum depth that succeeded | [
"returns",
"a",
"future",
"that",
"resolves",
"to",
"the",
"maximum",
"depth",
"that",
"succeeded"
] | 3dbe622ba56cb1d227e104dd68d4787ae9aaf201 | https://github.com/fresheneesz/grapetree-core/blob/3dbe622ba56cb1d227e104dd68d4787ae9aaf201/grapetreeCore.js#L413-L463 |
56,158 | feedm3/hypem-resolver | hypem-resolver.js | urlToId | function urlToId(hypemUrl) {
var trimmedUrl = _.trim(hypemUrl);
if (_.startsWith(trimmedUrl, HYPEM_TRACK_URL)) {
var parsedUrl = url.parse(hypemUrl);
var pathname = parsedUrl.pathname; // '/trach/31jfi/...'
var hypemId = pathname.split("/")[2];
return hype... | javascript | function urlToId(hypemUrl) {
var trimmedUrl = _.trim(hypemUrl);
if (_.startsWith(trimmedUrl, HYPEM_TRACK_URL)) {
var parsedUrl = url.parse(hypemUrl);
var pathname = parsedUrl.pathname; // '/trach/31jfi/...'
var hypemId = pathname.split("/")[2];
return hype... | [
"function",
"urlToId",
"(",
"hypemUrl",
")",
"{",
"var",
"trimmedUrl",
"=",
"_",
".",
"trim",
"(",
"hypemUrl",
")",
";",
"if",
"(",
"_",
".",
"startsWith",
"(",
"trimmedUrl",
",",
"HYPEM_TRACK_URL",
")",
")",
"{",
"var",
"parsedUrl",
"=",
"url",
".",
... | Extract the hypem id from a song's url.
@param {string} hypemUrl the url to extract the id
@returns {string} the id or "" if no id was found | [
"Extract",
"the",
"hypem",
"id",
"from",
"a",
"song",
"s",
"url",
"."
] | e20e0cf1ba93eac47f830c4b8693f13c4ca2588b | https://github.com/feedm3/hypem-resolver/blob/e20e0cf1ba93eac47f830c4b8693f13c4ca2588b/hypem-resolver.js#L27-L36 |
56,159 | feedm3/hypem-resolver | hypem-resolver.js | getById | function getById(hypemId, callback) {
var options = {
method: 'HEAD',
url: HYPEM_GO_URL + hypemId,
followRedirect: false,
timeout: FIVE_SECONDS_IN_MILLIS
};
request(options, function (error, response) {
if (error || response.statusCode... | javascript | function getById(hypemId, callback) {
var options = {
method: 'HEAD',
url: HYPEM_GO_URL + hypemId,
followRedirect: false,
timeout: FIVE_SECONDS_IN_MILLIS
};
request(options, function (error, response) {
if (error || response.statusCode... | [
"function",
"getById",
"(",
"hypemId",
",",
"callback",
")",
"{",
"var",
"options",
"=",
"{",
"method",
":",
"'HEAD'",
",",
"url",
":",
"HYPEM_GO_URL",
"+",
"hypemId",
",",
"followRedirect",
":",
"false",
",",
"timeout",
":",
"FIVE_SECONDS_IN_MILLIS",
"}",
... | Get the soundcloud or mp3 url from a song's id.
@param hypemId {string} the id of the song
@param {Function}[callback] callback function
@param {Error} callback.err null if no error occurred
@param {string} callback.url the soundcloud or mp3 url | [
"Get",
"the",
"soundcloud",
"or",
"mp3",
"url",
"from",
"a",
"song",
"s",
"id",
"."
] | e20e0cf1ba93eac47f830c4b8693f13c4ca2588b | https://github.com/feedm3/hypem-resolver/blob/e20e0cf1ba93eac47f830c4b8693f13c4ca2588b/hypem-resolver.js#L46-L73 |
56,160 | feedm3/hypem-resolver | hypem-resolver.js | requestHypemKey | function requestHypemKey(hypemId, callback) {
var options = {
method: "GET",
url: HYPEM_TRACK_URL + hypemId,
headers: {"Cookie": COOKIE},
timeout: FIVE_SECONDS_IN_MILLIS
};
request(options, function (error, response) {
if (!error && re... | javascript | function requestHypemKey(hypemId, callback) {
var options = {
method: "GET",
url: HYPEM_TRACK_URL + hypemId,
headers: {"Cookie": COOKIE},
timeout: FIVE_SECONDS_IN_MILLIS
};
request(options, function (error, response) {
if (!error && re... | [
"function",
"requestHypemKey",
"(",
"hypemId",
",",
"callback",
")",
"{",
"var",
"options",
"=",
"{",
"method",
":",
"\"GET\"",
",",
"url",
":",
"HYPEM_TRACK_URL",
"+",
"hypemId",
",",
"headers",
":",
"{",
"\"Cookie\"",
":",
"COOKIE",
"}",
",",
"timeout",
... | Get the key for hypem. The key is necessary to request
the hypem serve url which gives us the mp3 url. We dont
need a key if the song is hosted on soundcloud.
@private
@param {string} hypemId the id of the song
@param {Function}[callback] callback function
@param {Error} callback.err null if no error occurred
@param {... | [
"Get",
"the",
"key",
"for",
"hypem",
".",
"The",
"key",
"is",
"necessary",
"to",
"request",
"the",
"hypem",
"serve",
"url",
"which",
"gives",
"us",
"the",
"mp3",
"url",
".",
"We",
"dont",
"need",
"a",
"key",
"if",
"the",
"song",
"is",
"hosted",
"on",... | e20e0cf1ba93eac47f830c4b8693f13c4ca2588b | https://github.com/feedm3/hypem-resolver/blob/e20e0cf1ba93eac47f830c4b8693f13c4ca2588b/hypem-resolver.js#L91-L119 |
56,161 | feedm3/hypem-resolver | hypem-resolver.js | requestMp3Url | function requestMp3Url(hypemId, hypemKey, callback) {
var options = {
method: "GET",
url: HYPEM_SERVE_URL + hypemId + "/" + hypemKey,
headers: {"Cookie": COOKIE},
timeout: FIVE_SECONDS_IN_MILLIS
};
request(options, function (error, response) {
... | javascript | function requestMp3Url(hypemId, hypemKey, callback) {
var options = {
method: "GET",
url: HYPEM_SERVE_URL + hypemId + "/" + hypemKey,
headers: {"Cookie": COOKIE},
timeout: FIVE_SECONDS_IN_MILLIS
};
request(options, function (error, response) {
... | [
"function",
"requestMp3Url",
"(",
"hypemId",
",",
"hypemKey",
",",
"callback",
")",
"{",
"var",
"options",
"=",
"{",
"method",
":",
"\"GET\"",
",",
"url",
":",
"HYPEM_SERVE_URL",
"+",
"hypemId",
"+",
"\"/\"",
"+",
"hypemKey",
",",
"headers",
":",
"{",
"\... | Get the mp3 url of the song's id with a given key.
@private
@param {string} hypemId the id of the song
@param {string} hypemKey the key to make the request succeed
@param {Function}[callback] callback function
@param {Error} callback.err null if no error occurred
@param {string} callback.url the mp3 url | [
"Get",
"the",
"mp3",
"url",
"of",
"the",
"song",
"s",
"id",
"with",
"a",
"given",
"key",
"."
] | e20e0cf1ba93eac47f830c4b8693f13c4ca2588b | https://github.com/feedm3/hypem-resolver/blob/e20e0cf1ba93eac47f830c4b8693f13c4ca2588b/hypem-resolver.js#L131-L154 |
56,162 | feedm3/hypem-resolver | hypem-resolver.js | getNormalizedSoundcloudUrl | function getNormalizedSoundcloudUrl(soundcloudUrl) {
var parsedUrl = url.parse(soundcloudUrl);
var protocol = parsedUrl.protocol;
var host = parsedUrl.host;
var pathname = parsedUrl.pathname;
var splitHostname = pathname.split('/');
var normalizedUrl = protocol + "//" + h... | javascript | function getNormalizedSoundcloudUrl(soundcloudUrl) {
var parsedUrl = url.parse(soundcloudUrl);
var protocol = parsedUrl.protocol;
var host = parsedUrl.host;
var pathname = parsedUrl.pathname;
var splitHostname = pathname.split('/');
var normalizedUrl = protocol + "//" + h... | [
"function",
"getNormalizedSoundcloudUrl",
"(",
"soundcloudUrl",
")",
"{",
"var",
"parsedUrl",
"=",
"url",
".",
"parse",
"(",
"soundcloudUrl",
")",
";",
"var",
"protocol",
"=",
"parsedUrl",
".",
"protocol",
";",
"var",
"host",
"=",
"parsedUrl",
".",
"host",
"... | Get the normalized soundcloud url. This means that every
parameter or path which is not necessary gets removed.
@private
@param {string} soundcloudUrl the url to normalize
@returns {string} the normalized soundcloud url | [
"Get",
"the",
"normalized",
"soundcloud",
"url",
".",
"This",
"means",
"that",
"every",
"parameter",
"or",
"path",
"which",
"is",
"not",
"necessary",
"gets",
"removed",
"."
] | e20e0cf1ba93eac47f830c4b8693f13c4ca2588b | https://github.com/feedm3/hypem-resolver/blob/e20e0cf1ba93eac47f830c4b8693f13c4ca2588b/hypem-resolver.js#L176-L184 |
56,163 | mrself/ya-del | del.js | function(options) {
this.DelOptions = $.extend({}, defaults, this.DelOptions, options);
this.dName = this.DelOptions.dName || this._name;
this.selector = this.selector || '.' + this.dName;
this.namespace = this.DelOptions.namespace || this.dName;
this.initEl();
} | javascript | function(options) {
this.DelOptions = $.extend({}, defaults, this.DelOptions, options);
this.dName = this.DelOptions.dName || this._name;
this.selector = this.selector || '.' + this.dName;
this.namespace = this.DelOptions.namespace || this.dName;
this.initEl();
} | [
"function",
"(",
"options",
")",
"{",
"this",
".",
"DelOptions",
"=",
"$",
".",
"extend",
"(",
"{",
"}",
",",
"defaults",
",",
"this",
".",
"DelOptions",
",",
"options",
")",
";",
"this",
".",
"dName",
"=",
"this",
".",
"DelOptions",
".",
"dName",
... | Init del module
@param {Object} options
@param {String} [options.dName]
@param {String} [options.namespace] Namespace
@param {jQuery|DOMElement} [options.$el] | [
"Init",
"del",
"module"
] | 11f8bff925f4df385a79e74f5d53830b20447b17 | https://github.com/mrself/ya-del/blob/11f8bff925f4df385a79e74f5d53830b20447b17/del.js#L23-L29 | |
56,164 | mrself/ya-del | del.js | function(el) {
return (el instanceof $ ? el : $(el)).find(this.makeSelector.apply(this, [].slice.call(arguments, 1)));
} | javascript | function(el) {
return (el instanceof $ ? el : $(el)).find(this.makeSelector.apply(this, [].slice.call(arguments, 1)));
} | [
"function",
"(",
"el",
")",
"{",
"return",
"(",
"el",
"instanceof",
"$",
"?",
"el",
":",
"$",
"(",
"el",
")",
")",
".",
"find",
"(",
"this",
".",
"makeSelector",
".",
"apply",
"(",
"this",
",",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"argumen... | Find element in other el
@param {jQuery|string|DOMElement} el el to find in
@param {string|array} element name
@return {jQuery} | [
"Find",
"element",
"in",
"other",
"el"
] | 11f8bff925f4df385a79e74f5d53830b20447b17 | https://github.com/mrself/ya-del/blob/11f8bff925f4df385a79e74f5d53830b20447b17/del.js#L79-L81 | |
56,165 | gabrielcsapo/krayon | util.js | parse | function parse (code) {
Object.keys(syntax).forEach((s) => {
code = code.replace(syntax[s], (_, m) => {
// ensure if the regex only matches part of the string that we keep the leftover
let leftOver = _.replace(m, '')
// encode the string and class
let parsed = `{#${s}#${encode(m)}#}`
... | javascript | function parse (code) {
Object.keys(syntax).forEach((s) => {
code = code.replace(syntax[s], (_, m) => {
// ensure if the regex only matches part of the string that we keep the leftover
let leftOver = _.replace(m, '')
// encode the string and class
let parsed = `{#${s}#${encode(m)}#}`
... | [
"function",
"parse",
"(",
"code",
")",
"{",
"Object",
".",
"keys",
"(",
"syntax",
")",
".",
"forEach",
"(",
"(",
"s",
")",
"=>",
"{",
"code",
"=",
"code",
".",
"replace",
"(",
"syntax",
"[",
"s",
"]",
",",
"(",
"_",
",",
"m",
")",
"=>",
"{",
... | walks through the syntaxes that we have and tokenizes the entities that correspond
@method parse
@param {String} code - raw code string
@return {String} - encoded code string | [
"walks",
"through",
"the",
"syntaxes",
"that",
"we",
"have",
"and",
"tokenizes",
"the",
"entities",
"that",
"correspond"
] | 3a97cd33715a6e2fe5d9cac3c8c6a7e6e15d43c2 | https://github.com/gabrielcsapo/krayon/blob/3a97cd33715a6e2fe5d9cac3c8c6a7e6e15d43c2/util.js#L48-L83 |
56,166 | gabrielcsapo/krayon | util.js | encode | function encode (str) {
return str.split('').map((s) => {
if (s.charCodeAt(0) > 127) return s
return String.fromCharCode(s.charCodeAt(0) + 0x2800)
}).join(' ')
} | javascript | function encode (str) {
return str.split('').map((s) => {
if (s.charCodeAt(0) > 127) return s
return String.fromCharCode(s.charCodeAt(0) + 0x2800)
}).join(' ')
} | [
"function",
"encode",
"(",
"str",
")",
"{",
"return",
"str",
".",
"split",
"(",
"''",
")",
".",
"map",
"(",
"(",
"s",
")",
"=>",
"{",
"if",
"(",
"s",
".",
"charCodeAt",
"(",
"0",
")",
">",
"127",
")",
"return",
"s",
"return",
"String",
".",
"... | encode utf8 string to braile
@method encode
@param {String} str - utf8 string
@return {String} - brailed encoded string | [
"encode",
"utf8",
"string",
"to",
"braile"
] | 3a97cd33715a6e2fe5d9cac3c8c6a7e6e15d43c2 | https://github.com/gabrielcsapo/krayon/blob/3a97cd33715a6e2fe5d9cac3c8c6a7e6e15d43c2/util.js#L91-L96 |
56,167 | gabrielcsapo/krayon | util.js | decode | function decode (str) {
return str.trim().split(' ').map((s) => {
if (s.charCodeAt(0) - 0x2800 > 127) return s
return String.fromCharCode(s.charCodeAt(0) - 0x2800)
}).join('')
} | javascript | function decode (str) {
return str.trim().split(' ').map((s) => {
if (s.charCodeAt(0) - 0x2800 > 127) return s
return String.fromCharCode(s.charCodeAt(0) - 0x2800)
}).join('')
} | [
"function",
"decode",
"(",
"str",
")",
"{",
"return",
"str",
".",
"trim",
"(",
")",
".",
"split",
"(",
"' '",
")",
".",
"map",
"(",
"(",
"s",
")",
"=>",
"{",
"if",
"(",
"s",
".",
"charCodeAt",
"(",
"0",
")",
"-",
"0x2800",
">",
"127",
")",
... | decode brail back to utf8
@method decode
@param {String} str - brail string
@return {String} - utf8 decoded string | [
"decode",
"brail",
"back",
"to",
"utf8"
] | 3a97cd33715a6e2fe5d9cac3c8c6a7e6e15d43c2 | https://github.com/gabrielcsapo/krayon/blob/3a97cd33715a6e2fe5d9cac3c8c6a7e6e15d43c2/util.js#L104-L109 |
56,168 | ForbesLindesay-Unmaintained/sauce-test | lib/run-browsers-bail.js | runBrowsersBail | function runBrowsersBail(location, remote, platforms, options) {
var throttle = options.throttle || function (fn) { return fn(); };
var results = [];
results.passedBrowsers = [];
results.failedBrowsers = [];
return new Promise(function (resolve) {
function next(i) {
if (i >= platforms.length) {
... | javascript | function runBrowsersBail(location, remote, platforms, options) {
var throttle = options.throttle || function (fn) { return fn(); };
var results = [];
results.passedBrowsers = [];
results.failedBrowsers = [];
return new Promise(function (resolve) {
function next(i) {
if (i >= platforms.length) {
... | [
"function",
"runBrowsersBail",
"(",
"location",
",",
"remote",
",",
"platforms",
",",
"options",
")",
"{",
"var",
"throttle",
"=",
"options",
".",
"throttle",
"||",
"function",
"(",
"fn",
")",
"{",
"return",
"fn",
"(",
")",
";",
"}",
";",
"var",
"resul... | Run a test in a series of browsers, one at at time until one of them fails
@option {Function} throttle
@option {Object} capabilities
@option {Boolean} debug
@option {Object|Function} jobInfo
@option {Boolean} allowExceptions
@option {String|Function} testComplete
@option {String|Functio... | [
"Run",
"a",
"test",
"in",
"a",
"series",
"of",
"browsers",
"one",
"at",
"at",
"time",
"until",
"one",
"of",
"them",
"fails"
] | 7c671b3321dc63aefc00c1c8d49e943ead2e7f5e | https://github.com/ForbesLindesay-Unmaintained/sauce-test/blob/7c671b3321dc63aefc00c1c8d49e943ead2e7f5e/lib/run-browsers-bail.js#L32-L83 |
56,169 | danheberden/bear | lib/bear.js | function() {
var bear = this;
// don't bind until we're ready
var srv = bear.ready.then( function() {
var dfd = _.Deferred();
// only make once
if ( !bear.githInstance ) {
bear.githInstance = bear.gith({
repo: bear.settings.repo,
}).on( 'all', bear._processPayload... | javascript | function() {
var bear = this;
// don't bind until we're ready
var srv = bear.ready.then( function() {
var dfd = _.Deferred();
// only make once
if ( !bear.githInstance ) {
bear.githInstance = bear.gith({
repo: bear.settings.repo,
}).on( 'all', bear._processPayload... | [
"function",
"(",
")",
"{",
"var",
"bear",
"=",
"this",
";",
"// don't bind until we're ready",
"var",
"srv",
"=",
"bear",
".",
"ready",
".",
"then",
"(",
"function",
"(",
")",
"{",
"var",
"dfd",
"=",
"_",
".",
"Deferred",
"(",
")",
";",
"// only make o... | but this is where the gold is | [
"but",
"this",
"is",
"where",
"the",
"gold",
"is"
] | c712108a0fe0ba105e9f65e925f9918b25ecec5c | https://github.com/danheberden/bear/blob/c712108a0fe0ba105e9f65e925f9918b25ecec5c/lib/bear.js#L187-L203 | |
56,170 | danheberden/bear | lib/bear.js | function( payload ) {
var bear = this;
var dfd = _.Deferred();
var action = dfd.promise();
// ok to launch live?
if ( payload.branch === bear.settings.liveBranch ) {
// can we just upload master without worrying about tags?
if ( !bear.settings.deployOnTag ) {
action = action.th... | javascript | function( payload ) {
var bear = this;
var dfd = _.Deferred();
var action = dfd.promise();
// ok to launch live?
if ( payload.branch === bear.settings.liveBranch ) {
// can we just upload master without worrying about tags?
if ( !bear.settings.deployOnTag ) {
action = action.th... | [
"function",
"(",
"payload",
")",
"{",
"var",
"bear",
"=",
"this",
";",
"var",
"dfd",
"=",
"_",
".",
"Deferred",
"(",
")",
";",
"var",
"action",
"=",
"dfd",
".",
"promise",
"(",
")",
";",
"// ok to launch live?",
"if",
"(",
"payload",
".",
"branch",
... | process the payload gith emitted | [
"process",
"the",
"payload",
"gith",
"emitted"
] | c712108a0fe0ba105e9f65e925f9918b25ecec5c | https://github.com/danheberden/bear/blob/c712108a0fe0ba105e9f65e925f9918b25ecec5c/lib/bear.js#L206-L240 | |
56,171 | danheberden/bear | lib/bear.js | function() {
return dexec( 'cd ' + this.settings.git + '; npm install' ).done(function( stdout, stderr ) {
log( 'npm install successful' );
log.extra( stdout, stderr );
});
} | javascript | function() {
return dexec( 'cd ' + this.settings.git + '; npm install' ).done(function( stdout, stderr ) {
log( 'npm install successful' );
log.extra( stdout, stderr );
});
} | [
"function",
"(",
")",
"{",
"return",
"dexec",
"(",
"'cd '",
"+",
"this",
".",
"settings",
".",
"git",
"+",
"'; npm install'",
")",
".",
"done",
"(",
"function",
"(",
"stdout",
",",
"stderr",
")",
"{",
"log",
"(",
"'npm install successful'",
")",
";",
"... | hook into our process | [
"hook",
"into",
"our",
"process"
] | c712108a0fe0ba105e9f65e925f9918b25ecec5c | https://github.com/danheberden/bear/blob/c712108a0fe0ba105e9f65e925f9918b25ecec5c/lib/bear.js#L268-L273 | |
56,172 | sfrdmn/node-randword | index.js | textStream | function textStream() {
var start = randomInt(0, config.size - bufferSize)
return fs.createReadStream(dictPath, {
encoding: config.encoding,
start: start,
end: start + bufferSize
})
} | javascript | function textStream() {
var start = randomInt(0, config.size - bufferSize)
return fs.createReadStream(dictPath, {
encoding: config.encoding,
start: start,
end: start + bufferSize
})
} | [
"function",
"textStream",
"(",
")",
"{",
"var",
"start",
"=",
"randomInt",
"(",
"0",
",",
"config",
".",
"size",
"-",
"bufferSize",
")",
"return",
"fs",
".",
"createReadStream",
"(",
"dictPath",
",",
"{",
"encoding",
":",
"config",
".",
"encoding",
",",
... | read dictionary with stream | [
"read",
"dictionary",
"with",
"stream"
] | cab6611aa44c4b572ba405e266f0a4f736a21e3d | https://github.com/sfrdmn/node-randword/blob/cab6611aa44c4b572ba405e266f0a4f736a21e3d/index.js#L12-L19 |
56,173 | transomjs/transom-socketio-internal | lib/socket-io-handler.js | SocketioHandler | function SocketioHandler(io, options) {
/**
* Emit 'data' to all sockets for the provided User or array of Users.
*
* @param {*} channelName
* @param {*} users
* @param {*} data
*/
function emitToUsers(users, channelName, data) {
const usersArray = Array.isArray(users)... | javascript | function SocketioHandler(io, options) {
/**
* Emit 'data' to all sockets for the provided User or array of Users.
*
* @param {*} channelName
* @param {*} users
* @param {*} data
*/
function emitToUsers(users, channelName, data) {
const usersArray = Array.isArray(users)... | [
"function",
"SocketioHandler",
"(",
"io",
",",
"options",
")",
"{",
"/**\n * Emit 'data' to all sockets for the provided User or array of Users.\n * \n * @param {*} channelName \n * @param {*} users \n * @param {*} data \n */",
"function",
"emitToUsers",
"(",
"users",... | Module for the socket handler. Exports this function that creates the instance of the handler.
which is added to the server registry as 'transomMessageClient'
@param {*} io the initialized SocketIO server
@param {*} options The socketHandler options object | [
"Module",
"for",
"the",
"socket",
"handler",
".",
"Exports",
"this",
"function",
"that",
"creates",
"the",
"instance",
"of",
"the",
"handler",
".",
"which",
"is",
"added",
"to",
"the",
"server",
"registry",
"as",
"transomMessageClient"
] | 24932b1f3614ec3d234ff8654f63f15b395126e8 | https://github.com/transomjs/transom-socketio-internal/blob/24932b1f3614ec3d234ff8654f63f15b395126e8/lib/socket-io-handler.js#L10-L52 |
56,174 | transomjs/transom-socketio-internal | lib/socket-io-handler.js | emitToUsers | function emitToUsers(users, channelName, data) {
const usersArray = Array.isArray(users) ? users : [users];
usersArray.map(function (user) {
Object.keys(io.sockets.sockets).filter(function (key) {
return io.sockets.sockets[key].transomUser._id.toString() === user._id.toString... | javascript | function emitToUsers(users, channelName, data) {
const usersArray = Array.isArray(users) ? users : [users];
usersArray.map(function (user) {
Object.keys(io.sockets.sockets).filter(function (key) {
return io.sockets.sockets[key].transomUser._id.toString() === user._id.toString... | [
"function",
"emitToUsers",
"(",
"users",
",",
"channelName",
",",
"data",
")",
"{",
"const",
"usersArray",
"=",
"Array",
".",
"isArray",
"(",
"users",
")",
"?",
"users",
":",
"[",
"users",
"]",
";",
"usersArray",
".",
"map",
"(",
"function",
"(",
"user... | Emit 'data' to all sockets for the provided User or array of Users.
@param {*} channelName
@param {*} users
@param {*} data | [
"Emit",
"data",
"to",
"all",
"sockets",
"for",
"the",
"provided",
"User",
"or",
"array",
"of",
"Users",
"."
] | 24932b1f3614ec3d234ff8654f63f15b395126e8 | https://github.com/transomjs/transom-socketio-internal/blob/24932b1f3614ec3d234ff8654f63f15b395126e8/lib/socket-io-handler.js#L19-L28 |
56,175 | transomjs/transom-socketio-internal | lib/socket-io-handler.js | emitToEveryone | function emitToEveryone(channelName, data) {
Object.keys(io.sockets.sockets).filter(function (key) {
return !!io.sockets.sockets[key].transomUser;
}).map(function (socketKey) {
io.sockets.sockets[socketKey].emit(channelName, data);
});
} | javascript | function emitToEveryone(channelName, data) {
Object.keys(io.sockets.sockets).filter(function (key) {
return !!io.sockets.sockets[key].transomUser;
}).map(function (socketKey) {
io.sockets.sockets[socketKey].emit(channelName, data);
});
} | [
"function",
"emitToEveryone",
"(",
"channelName",
",",
"data",
")",
"{",
"Object",
".",
"keys",
"(",
"io",
".",
"sockets",
".",
"sockets",
")",
".",
"filter",
"(",
"function",
"(",
"key",
")",
"{",
"return",
"!",
"!",
"io",
".",
"sockets",
".",
"sock... | Emit 'data' to all sockets for the authenticated Users.
@param {*} channelName
@param {*} data | [
"Emit",
"data",
"to",
"all",
"sockets",
"for",
"the",
"authenticated",
"Users",
"."
] | 24932b1f3614ec3d234ff8654f63f15b395126e8 | https://github.com/transomjs/transom-socketio-internal/blob/24932b1f3614ec3d234ff8654f63f15b395126e8/lib/socket-io-handler.js#L36-L42 |
56,176 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/floatingspace/plugin.js | updatePos | function updatePos( pos, prop, val ) {
floatSpace.setStyle( prop, pixelate( val ) );
floatSpace.setStyle( 'position', pos );
} | javascript | function updatePos( pos, prop, val ) {
floatSpace.setStyle( prop, pixelate( val ) );
floatSpace.setStyle( 'position', pos );
} | [
"function",
"updatePos",
"(",
"pos",
",",
"prop",
",",
"val",
")",
"{",
"floatSpace",
".",
"setStyle",
"(",
"prop",
",",
"pixelate",
"(",
"val",
")",
")",
";",
"floatSpace",
".",
"setStyle",
"(",
"'position'",
",",
"pos",
")",
";",
"}"
] | Update the float space position. | [
"Update",
"the",
"float",
"space",
"position",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/floatingspace/plugin.js#L49-L52 |
56,177 | skerit/alchemy-styleboost | public/ckeditor/4.4dev/plugins/floatingspace/plugin.js | changeMode | function changeMode( newMode ) {
var editorPos = editable.getDocumentPosition();
switch ( newMode ) {
case 'top':
updatePos( 'absolute', 'top', editorPos.y - spaceHeight - dockedOffsetY );
break;
case 'pin':
updatePos( 'fixed', 'top', pinnedOffsetY );
break;
... | javascript | function changeMode( newMode ) {
var editorPos = editable.getDocumentPosition();
switch ( newMode ) {
case 'top':
updatePos( 'absolute', 'top', editorPos.y - spaceHeight - dockedOffsetY );
break;
case 'pin':
updatePos( 'fixed', 'top', pinnedOffsetY );
break;
... | [
"function",
"changeMode",
"(",
"newMode",
")",
"{",
"var",
"editorPos",
"=",
"editable",
".",
"getDocumentPosition",
"(",
")",
";",
"switch",
"(",
"newMode",
")",
"{",
"case",
"'top'",
":",
"updatePos",
"(",
"'absolute'",
",",
"'top'",
",",
"editorPos",
".... | Change the current mode and update float space position accordingly. | [
"Change",
"the",
"current",
"mode",
"and",
"update",
"float",
"space",
"position",
"accordingly",
"."
] | 2b90b8a6afc9f065f785651292fb193940021d90 | https://github.com/skerit/alchemy-styleboost/blob/2b90b8a6afc9f065f785651292fb193940021d90/public/ckeditor/4.4dev/plugins/floatingspace/plugin.js#L55-L71 |
56,178 | agneta/angularjs | source/ui/gallery/photoswipe.module.js | function(e) {
e = e || window.event;
e.preventDefault ? e.preventDefault() : (e.returnValue = false);
var eTarget = e.target || e.srcElement;
// find root element of slide
var clickedListItem = closest(eTarget, function(el) {
//console.log(el.getAttribute('ui-gallery-item'));
return el... | javascript | function(e) {
e = e || window.event;
e.preventDefault ? e.preventDefault() : (e.returnValue = false);
var eTarget = e.target || e.srcElement;
// find root element of slide
var clickedListItem = closest(eTarget, function(el) {
//console.log(el.getAttribute('ui-gallery-item'));
return el... | [
"function",
"(",
"e",
")",
"{",
"e",
"=",
"e",
"||",
"window",
".",
"event",
";",
"e",
".",
"preventDefault",
"?",
"e",
".",
"preventDefault",
"(",
")",
":",
"(",
"e",
".",
"returnValue",
"=",
"false",
")",
";",
"var",
"eTarget",
"=",
"e",
".",
... | triggers when user clicks on thumbnail | [
"triggers",
"when",
"user",
"clicks",
"on",
"thumbnail"
] | 25fa30337a609b4f79948d7f1b86f8d49208a417 | https://github.com/agneta/angularjs/blob/25fa30337a609b4f79948d7f1b86f8d49208a417/source/ui/gallery/photoswipe.module.js#L60-L109 | |
56,179 | alonbardavid/coffee-script-mapped | lib/source-map-support.js | handleUncaughtExceptions | function handleUncaughtExceptions(error) {
if (!error || !error.stack) {
console.log('Uncaught exception:', error);
process.exit();
}
var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
if (match) {
var cache = {};
var position = mapSourcePosition(cache, {
source: match[1]... | javascript | function handleUncaughtExceptions(error) {
if (!error || !error.stack) {
console.log('Uncaught exception:', error);
process.exit();
}
var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
if (match) {
var cache = {};
var position = mapSourcePosition(cache, {
source: match[1]... | [
"function",
"handleUncaughtExceptions",
"(",
"error",
")",
"{",
"if",
"(",
"!",
"error",
"||",
"!",
"error",
".",
"stack",
")",
"{",
"console",
".",
"log",
"(",
"'Uncaught exception:'",
",",
"error",
")",
";",
"process",
".",
"exit",
"(",
")",
";",
"}"... | Mimic node's stack trace printing when an exception escapes the process | [
"Mimic",
"node",
"s",
"stack",
"trace",
"printing",
"when",
"an",
"exception",
"escapes",
"the",
"process"
] | c658ca79ab24800ab5bbde6e56343cfa4a5e6dfe | https://github.com/alonbardavid/coffee-script-mapped/blob/c658ca79ab24800ab5bbde6e56343cfa4a5e6dfe/lib/source-map-support.js#L127-L152 |
56,180 | JohnnieFucker/dreamix-admin | lib/master/masterAgent.js | broadcastMonitors | function broadcastMonitors(records, moduleId, msg) {
msg = protocol.composeRequest(null, moduleId, msg);
if (records instanceof Array) {
for (let i = 0, l = records.length; i < l; i++) {
const socket = records[i].socket;
doSend(socket, 'monitor', msg);
}
} else {
... | javascript | function broadcastMonitors(records, moduleId, msg) {
msg = protocol.composeRequest(null, moduleId, msg);
if (records instanceof Array) {
for (let i = 0, l = records.length; i < l; i++) {
const socket = records[i].socket;
doSend(socket, 'monitor', msg);
}
} else {
... | [
"function",
"broadcastMonitors",
"(",
"records",
",",
"moduleId",
",",
"msg",
")",
"{",
"msg",
"=",
"protocol",
".",
"composeRequest",
"(",
"null",
",",
"moduleId",
",",
"msg",
")",
";",
"if",
"(",
"records",
"instanceof",
"Array",
")",
"{",
"for",
"(",
... | broadcast msg to monitor
@param {Object} records registered modules
@param {String} moduleId module id/name
@param {Object} msg message
@api private | [
"broadcast",
"msg",
"to",
"monitor"
] | fc169e2481d5a7456725fb33f7a7907e0776ef79 | https://github.com/JohnnieFucker/dreamix-admin/blob/fc169e2481d5a7456725fb33f7a7907e0776ef79/lib/master/masterAgent.js#L137-L153 |
56,181 | OctaveWealth/passy | lib/baseURL.js | getChar | function getChar (bits) {
var index = parseInt(bits,2);
if (isNaN(index) || index < 0 || index > 63) throw new Error('baseURL#getChar: Need valid bitString');
return ALPHABET[index];
} | javascript | function getChar (bits) {
var index = parseInt(bits,2);
if (isNaN(index) || index < 0 || index > 63) throw new Error('baseURL#getChar: Need valid bitString');
return ALPHABET[index];
} | [
"function",
"getChar",
"(",
"bits",
")",
"{",
"var",
"index",
"=",
"parseInt",
"(",
"bits",
",",
"2",
")",
";",
"if",
"(",
"isNaN",
"(",
"index",
")",
"||",
"index",
"<",
"0",
"||",
"index",
">",
"63",
")",
"throw",
"new",
"Error",
"(",
"'baseURL... | Get baseURL char from given 6bit bitstring
@param {string} bits 6bit bitstring
@return {string} baseURL char | [
"Get",
"baseURL",
"char",
"from",
"given",
"6bit",
"bitstring"
] | 6e357b018952f73e8570b89eda95393780328fab | https://github.com/OctaveWealth/passy/blob/6e357b018952f73e8570b89eda95393780328fab/lib/baseURL.js#L26-L30 |
56,182 | OctaveWealth/passy | lib/baseURL.js | indexOfBits | function indexOfBits (char) {
var index = ALPHABET.indexOf(char);
if (index < 0) throw new Error('baseURL#indexOfBits: Need valid baseURL char');
return bitString.pad(index.toString(2), 6) ;
} | javascript | function indexOfBits (char) {
var index = ALPHABET.indexOf(char);
if (index < 0) throw new Error('baseURL#indexOfBits: Need valid baseURL char');
return bitString.pad(index.toString(2), 6) ;
} | [
"function",
"indexOfBits",
"(",
"char",
")",
"{",
"var",
"index",
"=",
"ALPHABET",
".",
"indexOf",
"(",
"char",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"throw",
"new",
"Error",
"(",
"'baseURL#indexOfBits: Need valid baseURL char'",
")",
";",
"return",
... | Get 6bit bitstring given a baseURL char
@param {string} char Single baseURL char
@return {string} 6bit bitstring of 'indexof' (0-63) | [
"Get",
"6bit",
"bitstring",
"given",
"a",
"baseURL",
"char"
] | 6e357b018952f73e8570b89eda95393780328fab | https://github.com/OctaveWealth/passy/blob/6e357b018952f73e8570b89eda95393780328fab/lib/baseURL.js#L37-L41 |
56,183 | OctaveWealth/passy | lib/baseURL.js | encode | function encode (bits) {
if (!bitString.isValid(bits)) throw new Error('baseURL#encode: bits not valid bitstring');
if (bits.length % 6 !== 0) throw new Error('baseURL#encode: bits must be a multiple of 6');
var result = '';
for (var i = 0; i < bits.length; i = i + 6) {
result += getChar(bits.slice(i, i + ... | javascript | function encode (bits) {
if (!bitString.isValid(bits)) throw new Error('baseURL#encode: bits not valid bitstring');
if (bits.length % 6 !== 0) throw new Error('baseURL#encode: bits must be a multiple of 6');
var result = '';
for (var i = 0; i < bits.length; i = i + 6) {
result += getChar(bits.slice(i, i + ... | [
"function",
"encode",
"(",
"bits",
")",
"{",
"if",
"(",
"!",
"bitString",
".",
"isValid",
"(",
"bits",
")",
")",
"throw",
"new",
"Error",
"(",
"'baseURL#encode: bits not valid bitstring'",
")",
";",
"if",
"(",
"bits",
".",
"length",
"%",
"6",
"!==",
"0",... | Encode a mod 6 bitstring into a baseURL string
@param {string} bits A mod 6 bitstring
@return {string} baseURL encoded string | [
"Encode",
"a",
"mod",
"6",
"bitstring",
"into",
"a",
"baseURL",
"string"
] | 6e357b018952f73e8570b89eda95393780328fab | https://github.com/OctaveWealth/passy/blob/6e357b018952f73e8570b89eda95393780328fab/lib/baseURL.js#L48-L57 |
56,184 | OctaveWealth/passy | lib/baseURL.js | decode | function decode (str) {
if (!isValid(str)) throw new Error('baseURL#decode: str not valid baseURL string');
var bits = '';
// Decode
for (var i = 0; i < str.length; i++) {
bits += indexOfBits(str[i]);
}
return bits;
} | javascript | function decode (str) {
if (!isValid(str)) throw new Error('baseURL#decode: str not valid baseURL string');
var bits = '';
// Decode
for (var i = 0; i < str.length; i++) {
bits += indexOfBits(str[i]);
}
return bits;
} | [
"function",
"decode",
"(",
"str",
")",
"{",
"if",
"(",
"!",
"isValid",
"(",
"str",
")",
")",
"throw",
"new",
"Error",
"(",
"'baseURL#decode: str not valid baseURL string'",
")",
";",
"var",
"bits",
"=",
"''",
";",
"// Decode",
"for",
"(",
"var",
"i",
"="... | Decode a baseURL string to a mod 6 bitstring
@param {string} str A valid baseURL string
@return {string} A mod 6 bitstring | [
"Decode",
"a",
"baseURL",
"string",
"to",
"a",
"mod",
"6",
"bitstring"
] | 6e357b018952f73e8570b89eda95393780328fab | https://github.com/OctaveWealth/passy/blob/6e357b018952f73e8570b89eda95393780328fab/lib/baseURL.js#L75-L84 |
56,185 | Pilatch/simple-component-v0 | index.js | simpleComponent | function simpleComponent(elementName, elementClass, elementClassToExtend) {
elementClass = elementClass || {}
elementClassToExtend = elementClassToExtend || HTMLElement
elementClass.prototype = Object.create(elementClassToExtend.prototype)
assign(elementClass.prototype, elementClass)
elementClass._... | javascript | function simpleComponent(elementName, elementClass, elementClassToExtend) {
elementClass = elementClass || {}
elementClassToExtend = elementClassToExtend || HTMLElement
elementClass.prototype = Object.create(elementClassToExtend.prototype)
assign(elementClass.prototype, elementClass)
elementClass._... | [
"function",
"simpleComponent",
"(",
"elementName",
",",
"elementClass",
",",
"elementClassToExtend",
")",
"{",
"elementClass",
"=",
"elementClass",
"||",
"{",
"}",
"elementClassToExtend",
"=",
"elementClassToExtend",
"||",
"HTMLElement",
"elementClass",
".",
"prototype"... | Define a stateless custom element with no behaviors.
Give the element's template an ID attribute with the "-template" suffix.
@module simpleComponent
@example
<template id="simple-bling-template">
<style>
simple-bling {
color: gold;
font-weight: bold;
}
</style>
</template>
<script>
simpleComponent('simple-bling')
</sc... | [
"Define",
"a",
"stateless",
"custom",
"element",
"with",
"no",
"behaviors",
".",
"Give",
"the",
"element",
"s",
"template",
"an",
"ID",
"attribute",
"with",
"the",
"-",
"template",
"suffix",
"."
] | da1f223a85beff68420f579e34a07f6b2851d734 | https://github.com/Pilatch/simple-component-v0/blob/da1f223a85beff68420f579e34a07f6b2851d734/index.js#L36-L56 |
56,186 | Pilatch/simple-component-v0 | index.js | fill | function fill(toElement, templateElement) {
var templateContentClone = templateElement.content.cloneNode(true)
var slot
var i
if (toElement.childNodes.length) {
slot = templateContentClone.querySelector('slot')
if (slot) {
while (toElement.childNodes.length) {
slot.append... | javascript | function fill(toElement, templateElement) {
var templateContentClone = templateElement.content.cloneNode(true)
var slot
var i
if (toElement.childNodes.length) {
slot = templateContentClone.querySelector('slot')
if (slot) {
while (toElement.childNodes.length) {
slot.append... | [
"function",
"fill",
"(",
"toElement",
",",
"templateElement",
")",
"{",
"var",
"templateContentClone",
"=",
"templateElement",
".",
"content",
".",
"cloneNode",
"(",
"true",
")",
"var",
"slot",
"var",
"i",
"if",
"(",
"toElement",
".",
"childNodes",
".",
"len... | Attach a template's content to an element.
@public
@memberof module:simpleComponent
@param {HTMLElement} toElement The element to attach the template content to
@param {HTMLElement} template A template element that has the markup guts for the custom element.
@return {void} | [
"Attach",
"a",
"template",
"s",
"content",
"to",
"an",
"element",
"."
] | da1f223a85beff68420f579e34a07f6b2851d734 | https://github.com/Pilatch/simple-component-v0/blob/da1f223a85beff68420f579e34a07f6b2851d734/index.js#L66-L82 |
56,187 | bryanwayb/js-html | lib/context.js | makeRequire | function makeRequire(m, self) {
function _require(_path) {
return m.require(_path);
}
_require.resolve = function(request) {
return _module._resolveFilename(request, self);
};
_require.cache = _module._cache;
_require.extensions = _module._extensions;
return _require;
} | javascript | function makeRequire(m, self) {
function _require(_path) {
return m.require(_path);
}
_require.resolve = function(request) {
return _module._resolveFilename(request, self);
};
_require.cache = _module._cache;
_require.extensions = _module._extensions;
return _require;
} | [
"function",
"makeRequire",
"(",
"m",
",",
"self",
")",
"{",
"function",
"_require",
"(",
"_path",
")",
"{",
"return",
"m",
".",
"require",
"(",
"_path",
")",
";",
"}",
"_require",
".",
"resolve",
"=",
"function",
"(",
"request",
")",
"{",
"return",
"... | Basically takes the place of Module.prototype._compile, with some features stripped out | [
"Basically",
"takes",
"the",
"place",
"of",
"Module",
".",
"prototype",
".",
"_compile",
"with",
"some",
"features",
"stripped",
"out"
] | 6cfb9bb73cc4609d3089da0eba6ed2b3c3ce4380 | https://github.com/bryanwayb/js-html/blob/6cfb9bb73cc4609d3089da0eba6ed2b3c3ce4380/lib/context.js#L88-L100 |
56,188 | Industryswarm/isnode-mod-data | lib/mongodb/mongodb-core/lib/connection/pool.js | _connectionFailureHandler | function _connectionFailureHandler(self) {
return function() {
if (this._connectionFailHandled) return;
this._connectionFailHandled = true;
// Destroy the connection
this.destroy();
// Count down the number of reconnects
self.retriesLeft = self.retriesLeft - 1;
... | javascript | function _connectionFailureHandler(self) {
return function() {
if (this._connectionFailHandled) return;
this._connectionFailHandled = true;
// Destroy the connection
this.destroy();
// Count down the number of reconnects
self.retriesLeft = self.retriesLeft - 1;
... | [
"function",
"_connectionFailureHandler",
"(",
"self",
")",
"{",
"return",
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"_connectionFailHandled",
")",
"return",
";",
"this",
".",
"_connectionFailHandled",
"=",
"true",
";",
"// Destroy the connection",
"this",... | If we have failure schedule a retry | [
"If",
"we",
"have",
"failure",
"schedule",
"a",
"retry"
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb-core/lib/connection/pool.js#L349-L376 |
56,189 | Industryswarm/isnode-mod-data | lib/mongodb/mongodb-core/lib/connection/pool.js | _connectHandler | function _connectHandler(self) {
return function() {
// Assign
var connection = this;
// Pool destroyed stop the connection
if (self.state === DESTROYED || self.state === DESTROYING) {
return connection.destroy();
}
// Clear out all handlers
hand... | javascript | function _connectHandler(self) {
return function() {
// Assign
var connection = this;
// Pool destroyed stop the connection
if (self.state === DESTROYED || self.state === DESTROYING) {
return connection.destroy();
}
// Clear out all handlers
hand... | [
"function",
"_connectHandler",
"(",
"self",
")",
"{",
"return",
"function",
"(",
")",
"{",
"// Assign",
"var",
"connection",
"=",
"this",
";",
"// Pool destroyed stop the connection",
"if",
"(",
"self",
".",
"state",
"===",
"DESTROYED",
"||",
"self",
".",
"sta... | Got a connect handler | [
"Got",
"a",
"connect",
"handler"
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb-core/lib/connection/pool.js#L379-L417 |
56,190 | Industryswarm/isnode-mod-data | lib/mongodb/mongodb-core/lib/connection/pool.js | authenticateStragglers | function authenticateStragglers(self, connection, callback) {
// Get any non authenticated connections
var connections = self.nonAuthenticatedConnections.slice(0);
var nonAuthenticatedConnections = self.nonAuthenticatedConnections;
self.nonAuthenticatedConnections = [];
// Establish if th... | javascript | function authenticateStragglers(self, connection, callback) {
// Get any non authenticated connections
var connections = self.nonAuthenticatedConnections.slice(0);
var nonAuthenticatedConnections = self.nonAuthenticatedConnections;
self.nonAuthenticatedConnections = [];
// Establish if th... | [
"function",
"authenticateStragglers",
"(",
"self",
",",
"connection",
",",
"callback",
")",
"{",
"// Get any non authenticated connections",
"var",
"connections",
"=",
"self",
".",
"nonAuthenticatedConnections",
".",
"slice",
"(",
"0",
")",
";",
"var",
"nonAuthenticat... | Authenticate any straggler connections | [
"Authenticate",
"any",
"straggler",
"connections"
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb-core/lib/connection/pool.js#L479-L526 |
56,191 | Industryswarm/isnode-mod-data | lib/mongodb/mongodb-core/lib/connection/pool.js | authenticateLiveConnections | function authenticateLiveConnections(self, args, cb) {
// Get the current viable connections
var connections = self.allConnections();
// Allow nothing else to use the connections while we authenticate them
self.availableConnections = [];
self.inUseConnections = [];
self.connectingConnections = [... | javascript | function authenticateLiveConnections(self, args, cb) {
// Get the current viable connections
var connections = self.allConnections();
// Allow nothing else to use the connections while we authenticate them
self.availableConnections = [];
self.inUseConnections = [];
self.connectingConnections = [... | [
"function",
"authenticateLiveConnections",
"(",
"self",
",",
"args",
",",
"cb",
")",
"{",
"// Get the current viable connections",
"var",
"connections",
"=",
"self",
".",
"allConnections",
"(",
")",
";",
"// Allow nothing else to use the connections while we authenticate them... | Authenticate all live connections | [
"Authenticate",
"all",
"live",
"connections"
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb-core/lib/connection/pool.js#L801-L851 |
56,192 | Industryswarm/isnode-mod-data | lib/mongodb/mongodb-core/lib/connection/pool.js | waitForLogout | function waitForLogout(self, cb) {
if (!self.loggingout) return cb();
setTimeout(function() {
waitForLogout(self, cb);
}, 1);
} | javascript | function waitForLogout(self, cb) {
if (!self.loggingout) return cb();
setTimeout(function() {
waitForLogout(self, cb);
}, 1);
} | [
"function",
"waitForLogout",
"(",
"self",
",",
"cb",
")",
"{",
"if",
"(",
"!",
"self",
".",
"loggingout",
")",
"return",
"cb",
"(",
")",
";",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"waitForLogout",
"(",
"self",
",",
"cb",
")",
";",
"}",
",",... | Wait for a logout in process to happen | [
"Wait",
"for",
"a",
"logout",
"in",
"process",
"to",
"happen"
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb-core/lib/connection/pool.js#L854-L859 |
56,193 | Industryswarm/isnode-mod-data | lib/mongodb/mongodb-core/lib/connection/pool.js | function(_connection) {
return function() {
// Destroyed state return
if (self.state === DESTROYED || self.state === DESTROYING) {
// Remove the connection from the list
removeConnection(self, _connection);
return _connection.destroy();
}
// Destroy all event emitter... | javascript | function(_connection) {
return function() {
// Destroyed state return
if (self.state === DESTROYED || self.state === DESTROYING) {
// Remove the connection from the list
removeConnection(self, _connection);
return _connection.destroy();
}
// Destroy all event emitter... | [
"function",
"(",
"_connection",
")",
"{",
"return",
"function",
"(",
")",
"{",
"// Destroyed state return",
"if",
"(",
"self",
".",
"state",
"===",
"DESTROYED",
"||",
"self",
".",
"state",
"===",
"DESTROYING",
")",
"{",
"// Remove the connection from the list",
... | Handle successful connection | [
"Handle",
"successful",
"connection"
] | 5adc639b88a0d72cbeef23a6b5df7f4540745089 | https://github.com/Industryswarm/isnode-mod-data/blob/5adc639b88a0d72cbeef23a6b5df7f4540745089/lib/mongodb/mongodb-core/lib/connection/pool.js#L1336-L1382 | |
56,194 | decanat/miscue | lib/miscue.js | Miscue | function Miscue(code, data) {
if (!(this instanceof Miscue))
return new Miscue(code, data);
return this.initialize(code, data);
} | javascript | function Miscue(code, data) {
if (!(this instanceof Miscue))
return new Miscue(code, data);
return this.initialize(code, data);
} | [
"function",
"Miscue",
"(",
"code",
",",
"data",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Miscue",
")",
")",
"return",
"new",
"Miscue",
"(",
"code",
",",
"data",
")",
";",
"return",
"this",
".",
"initialize",
"(",
"code",
",",
"data",
"... | Creates a new Miscue object
@constructor
@param {Number} code
@param {Mixed} data [optional]
@return {Object} | [
"Creates",
"a",
"new",
"Miscue",
"object"
] | 45e4cbbfe0868c81cb5a407e6139656b237e9191 | https://github.com/decanat/miscue/blob/45e4cbbfe0868c81cb5a407e6139656b237e9191/lib/miscue.js#L42-L47 |
56,195 | meisterplayer/js-dev | gulp/eslint.js | createLint | function createLint(inPath, opts = {}) {
if (!inPath) {
throw new Error('Input path argument is required');
}
return function lint() {
return gulp.src(inPath)
.pipe(eslint(opts))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
};
} | javascript | function createLint(inPath, opts = {}) {
if (!inPath) {
throw new Error('Input path argument is required');
}
return function lint() {
return gulp.src(inPath)
.pipe(eslint(opts))
.pipe(eslint.format())
.pipe(eslint.failAfterError());
};
} | [
"function",
"createLint",
"(",
"inPath",
",",
"opts",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"!",
"inPath",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Input path argument is required'",
")",
";",
"}",
"return",
"function",
"lint",
"(",
")",
"{",
"return",
... | Higher order function to create gulp function that lints files using eslint.
@param {string|string[]} inPath The globs to the files that need to be copied.
@param {Object} [opts={}] Options object to be passed to the gulp eslint plugin.
@return {function} Function that can be used as a gulp task. | [
"Higher",
"order",
"function",
"to",
"create",
"gulp",
"function",
"that",
"lints",
"files",
"using",
"eslint",
"."
] | c2646678c49dcdaa120ba3f24824da52b0c63e31 | https://github.com/meisterplayer/js-dev/blob/c2646678c49dcdaa120ba3f24824da52b0c63e31/gulp/eslint.js#L10-L21 |
56,196 | angeloocana/joj-core | dist-esnext/Board.js | getStartEndRowsFromBoardSize | function getStartEndRowsFromBoardSize(boardSize) {
const endRow = boardSize.y - 1;
return {
white: getStartEndRow(endRow, false),
black: getStartEndRow(endRow, true)
};
} | javascript | function getStartEndRowsFromBoardSize(boardSize) {
const endRow = boardSize.y - 1;
return {
white: getStartEndRow(endRow, false),
black: getStartEndRow(endRow, true)
};
} | [
"function",
"getStartEndRowsFromBoardSize",
"(",
"boardSize",
")",
"{",
"const",
"endRow",
"=",
"boardSize",
".",
"y",
"-",
"1",
";",
"return",
"{",
"white",
":",
"getStartEndRow",
"(",
"endRow",
",",
"false",
")",
",",
"black",
":",
"getStartEndRow",
"(",
... | Takes a boardSize and return START and END rows for WHITE and BLACK.
returns { white:{startRow, endRow}, black:{startRow, endRow} } | [
"Takes",
"a",
"boardSize",
"and",
"return",
"START",
"and",
"END",
"rows",
"for",
"WHITE",
"and",
"BLACK",
"."
] | 14bc7801c004271cefafff6cc0abb0c3173c805a | https://github.com/angeloocana/joj-core/blob/14bc7801c004271cefafff6cc0abb0c3173c805a/dist-esnext/Board.js#L37-L43 |
56,197 | angeloocana/joj-core | dist-esnext/Board.js | getJumpPosition | function getJumpPosition(from, toJump, board) {
const jumpXY = getJumpXY(from, toJump);
if (!hasPosition(board, jumpXY))
return;
const jumpPosition = getPositionFromBoard(board, jumpXY);
if (Position.hasPiece(jumpPosition))
return;
return jumpPosition;
} | javascript | function getJumpPosition(from, toJump, board) {
const jumpXY = getJumpXY(from, toJump);
if (!hasPosition(board, jumpXY))
return;
const jumpPosition = getPositionFromBoard(board, jumpXY);
if (Position.hasPiece(jumpPosition))
return;
return jumpPosition;
} | [
"function",
"getJumpPosition",
"(",
"from",
",",
"toJump",
",",
"board",
")",
"{",
"const",
"jumpXY",
"=",
"getJumpXY",
"(",
"from",
",",
"toJump",
")",
";",
"if",
"(",
"!",
"hasPosition",
"(",
"board",
",",
"jumpXY",
")",
")",
"return",
";",
"const",
... | Returns the target board position from a jump if this position exists and is empty. | [
"Returns",
"the",
"target",
"board",
"position",
"from",
"a",
"jump",
"if",
"this",
"position",
"exists",
"and",
"is",
"empty",
"."
] | 14bc7801c004271cefafff6cc0abb0c3173c805a | https://github.com/angeloocana/joj-core/blob/14bc7801c004271cefafff6cc0abb0c3173c805a/dist-esnext/Board.js#L284-L292 |
56,198 | s-p-n/devez-node-gyp | lib/install.js | isValid | function isValid (path, entry) {
var isValid = valid(path)
if (isValid) {
log.verbose('extracted file from tarball', path)
extractCount++
} else {
// invalid
log.silly('ignoring from tarball', path)
}
return isValid
} | javascript | function isValid (path, entry) {
var isValid = valid(path)
if (isValid) {
log.verbose('extracted file from tarball', path)
extractCount++
} else {
// invalid
log.silly('ignoring from tarball', path)
}
return isValid
} | [
"function",
"isValid",
"(",
"path",
",",
"entry",
")",
"{",
"var",
"isValid",
"=",
"valid",
"(",
"path",
")",
"if",
"(",
"isValid",
")",
"{",
"log",
".",
"verbose",
"(",
"'extracted file from tarball'",
",",
"path",
")",
"extractCount",
"++",
"}",
"else"... | checks if a file to be extracted from the tarball is valid. only .h header files and the gyp files get extracted | [
"checks",
"if",
"a",
"file",
"to",
"be",
"extracted",
"from",
"the",
"tarball",
"is",
"valid",
".",
"only",
".",
"h",
"header",
"files",
"and",
"the",
"gyp",
"files",
"get",
"extracted"
] | a55f5b8c885c417e7d1ce0af5e16aabfaa6ed73e | https://github.com/s-p-n/devez-node-gyp/blob/a55f5b8c885c417e7d1ce0af5e16aabfaa6ed73e/lib/install.js#L155-L165 |
56,199 | adoyle-h/config-sp | src/get.js | get | function get(path) {
var conf = this;
if (typeof path !== 'string') {
throw new Error('path should be a string!');
} else if (path.length === 0) {
throw new Error('path cannot be empty!');
}
var result = baseGet(conf, getPathArray(path));
if (result === undefined) {
thr... | javascript | function get(path) {
var conf = this;
if (typeof path !== 'string') {
throw new Error('path should be a string!');
} else if (path.length === 0) {
throw new Error('path cannot be empty!');
}
var result = baseGet(conf, getPathArray(path));
if (result === undefined) {
thr... | [
"function",
"get",
"(",
"path",
")",
"{",
"var",
"conf",
"=",
"this",
";",
"if",
"(",
"typeof",
"path",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"Error",
"(",
"'path should be a string!'",
")",
";",
"}",
"else",
"if",
"(",
"path",
".",
"length",
... | Gets the property value at path of config.
If the resolved value is undefined, it will throw an error.
@param {String} path
@return {*}
@method get | [
"Gets",
"the",
"property",
"value",
"at",
"path",
"of",
"config",
".",
"If",
"the",
"resolved",
"value",
"is",
"undefined",
"it",
"will",
"throw",
"an",
"error",
"."
] | cdfefc1b1c292d834b1144695bb284f0e26a6a77 | https://github.com/adoyle-h/config-sp/blob/cdfefc1b1c292d834b1144695bb284f0e26a6a77/src/get.js#L64-L81 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.