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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
41,400 | suskind/network-list | src/index.js | checkPort | function checkPort(port, host, callback) {
var socket = new Socket(),
status = null;
socket.on('connect', () => {
status = 'open';
socket.end();
});
socket.setTimeout(1500);
socket.on('timeout', () => {
status = 'closed';
socket.destroy();
});
socket.o... | javascript | function checkPort(port, host, callback) {
var socket = new Socket(),
status = null;
socket.on('connect', () => {
status = 'open';
socket.end();
});
socket.setTimeout(1500);
socket.on('timeout', () => {
status = 'closed';
socket.destroy();
});
socket.o... | [
"function",
"checkPort",
"(",
"port",
",",
"host",
",",
"callback",
")",
"{",
"var",
"socket",
"=",
"new",
"Socket",
"(",
")",
",",
"status",
"=",
"null",
";",
"socket",
".",
"on",
"(",
"'connect'",
",",
"(",
")",
"=>",
"{",
"status",
"=",
"'open'"... | Keep this function to use in a future version to port scan | [
"Keep",
"this",
"function",
"to",
"use",
"in",
"a",
"future",
"version",
"to",
"port",
"scan"
] | 1e3289a13df866954576089334b1a8012091784b | https://github.com/suskind/network-list/blob/1e3289a13df866954576089334b1a8012091784b/src/index.js#L77-L96 |
41,401 | TendaDigital/Tournamenter | models/View.js | getNextID | function getNextID () {
var max = 0;
_.forEach(newPages, function(page){
if(page.id) max = Math.max(max, page.id*1);
});
var next = max*1+1;
return next;
} | javascript | function getNextID () {
var max = 0;
_.forEach(newPages, function(page){
if(page.id) max = Math.max(max, page.id*1);
});
var next = max*1+1;
return next;
} | [
"function",
"getNextID",
"(",
")",
"{",
"var",
"max",
"=",
"0",
";",
"_",
".",
"forEach",
"(",
"newPages",
",",
"function",
"(",
"page",
")",
"{",
"if",
"(",
"page",
".",
"id",
")",
"max",
"=",
"Math",
".",
"max",
"(",
"max",
",",
"page",
".",
... | Helper function that will return next available ID | [
"Helper",
"function",
"that",
"will",
"return",
"next",
"available",
"ID"
] | 2733ae9b454ae90896249ab1d7a07007eb4a69e4 | https://github.com/TendaDigital/Tournamenter/blob/2733ae9b454ae90896249ab1d7a07007eb4a69e4/models/View.js#L140-L147 |
41,402 | hcodes/yandex-speller | lib/yandex-speller.js | checkText | function checkText(text, callback, settings) {
const form = prepareSettings(settings);
form.text = text;
post({
host: YASPELLER_HOST,
path: YASPELLER_PATH + 'checkText',
form: form,
}, function(error, response, body) {
if (error) {
callback(error, null);
... | javascript | function checkText(text, callback, settings) {
const form = prepareSettings(settings);
form.text = text;
post({
host: YASPELLER_HOST,
path: YASPELLER_PATH + 'checkText',
form: form,
}, function(error, response, body) {
if (error) {
callback(error, null);
... | [
"function",
"checkText",
"(",
"text",
",",
"callback",
",",
"settings",
")",
"{",
"const",
"form",
"=",
"prepareSettings",
"(",
"settings",
")",
";",
"form",
".",
"text",
"=",
"text",
";",
"post",
"(",
"{",
"host",
":",
"YASPELLER_HOST",
",",
"path",
"... | Check text for typos.
@param {string} text
@param {Function} callback
@param {Settings} settings
@see {@link https://tech.yandex.ru/speller/doc/dg/reference/checkText-docpage/} | [
"Check",
"text",
"for",
"typos",
"."
] | 78d641980fdf594e417e22e370752e79a1799798 | https://github.com/hcodes/yandex-speller/blob/78d641980fdf594e417e22e370752e79a1799798/lib/yandex-speller.js#L16-L38 |
41,403 | TendaDigital/Tournamenter | models/Table.js | resolveMethod | function resolveMethod(wrapedMethod, methodRaw){
// Get method string and `methodify` it recursivelly
var method = getMethodFor(methodRaw);
// Check if method is ok to continue, or, return null
if(!method) throw new Error('Could not parse method: '+methodRaw);
// Create a wrapped method of the cu... | javascript | function resolveMethod(wrapedMethod, methodRaw){
// Get method string and `methodify` it recursivelly
var method = getMethodFor(methodRaw);
// Check if method is ok to continue, or, return null
if(!method) throw new Error('Could not parse method: '+methodRaw);
// Create a wrapped method of the cu... | [
"function",
"resolveMethod",
"(",
"wrapedMethod",
",",
"methodRaw",
")",
"{",
"// Get method string and `methodify` it recursivelly",
"var",
"method",
"=",
"getMethodFor",
"(",
"methodRaw",
")",
";",
"// Check if method is ok to continue, or, return null",
"if",
"(",
"!",
"... | Default function to resolve methods | [
"Default",
"function",
"to",
"resolve",
"methods"
] | 2733ae9b454ae90896249ab1d7a07007eb4a69e4 | https://github.com/TendaDigital/Tournamenter/blob/2733ae9b454ae90896249ab1d7a07007eb4a69e4/models/Table.js#L591-L603 |
41,404 | TendaDigital/Tournamenter | modules/pageview-group/public/js/pageview-group.js | function(match){
/*
Depending on the match state, we shall render
a different match view. Templates are:
+ pageview-group.match.scheduled
+ pageview-group.match.playing
+ pageview-group.match.endend
*/
var templates = {
'scheduled': JST['pageview-group.match.scheduled'],
'playing... | javascript | function(match){
/*
Depending on the match state, we shall render
a different match view. Templates are:
+ pageview-group.match.scheduled
+ pageview-group.match.playing
+ pageview-group.match.endend
*/
var templates = {
'scheduled': JST['pageview-group.match.scheduled'],
'playing... | [
"function",
"(",
"match",
")",
"{",
"/*\n\t\t\t\tDepending on the match state, we shall render\n\t\t\t\ta different match view. Templates are:\n\t\t\t\t\t+ pageview-group.match.scheduled\n\t\t\t\t\t+ pageview-group.match.playing\n\t\t\t\t\t+ pageview-group.match.endend\n\t\t\t*/",
"var",
"templates",
... | Render a single match view with the correct view state | [
"Render",
"a",
"single",
"match",
"view",
"with",
"the",
"correct",
"view",
"state"
] | 2733ae9b454ae90896249ab1d7a07007eb4a69e4 | https://github.com/TendaDigital/Tournamenter/blob/2733ae9b454ae90896249ab1d7a07007eb4a69e4/modules/pageview-group/public/js/pageview-group.js#L641-L677 | |
41,405 | neoziro/angular-draganddrop | angular-draganddrop.js | draggableDirective | function draggableDirective() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var domElement = element[0];
var effectAllowed = attrs.effectAllowed;
var draggableData = attrs.draggableData;
var draggableType = attrs.draggableType;
var draggable = attrs.draggable... | javascript | function draggableDirective() {
return {
restrict: 'A',
link: function (scope, element, attrs) {
var domElement = element[0];
var effectAllowed = attrs.effectAllowed;
var draggableData = attrs.draggableData;
var draggableType = attrs.draggableType;
var draggable = attrs.draggable... | [
"function",
"draggableDirective",
"(",
")",
"{",
"return",
"{",
"restrict",
":",
"'A'",
",",
"link",
":",
"function",
"(",
"scope",
",",
"element",
",",
"attrs",
")",
"{",
"var",
"domElement",
"=",
"element",
"[",
"0",
"]",
";",
"var",
"effectAllowed",
... | Draggable directive.
@example
<div draggable="true" effect-allowed="link" draggable-type="image" draggable-data="{foo: 'bar'}"></div>
- "draggable" Make the element draggable. Accepts a boolean.
- "effect-allowed" Allowed effects for the dragged element,
see https://developer.mozilla.org/en-US/docs/Web/API/DataTransf... | [
"Draggable",
"directive",
"."
] | 69b1fafd48a6d288fd39cf6e29813ad328c096ec | https://github.com/neoziro/angular-draganddrop/blob/69b1fafd48a6d288fd39cf6e29813ad328c096ec/angular-draganddrop.js#L24-L54 |
41,406 | neoziro/angular-draganddrop | angular-draganddrop.js | accepts | function accepts(type, event) {
if (typeof type === 'boolean') return type;
if (typeof type === 'string') return accepts([type], event);
if (Array.isArray(type)) {
return accepts(function (types) {
return types.some(function (_type) {
return type.indexOf(_type... | javascript | function accepts(type, event) {
if (typeof type === 'boolean') return type;
if (typeof type === 'string') return accepts([type], event);
if (Array.isArray(type)) {
return accepts(function (types) {
return types.some(function (_type) {
return type.indexOf(_type... | [
"function",
"accepts",
"(",
"type",
",",
"event",
")",
"{",
"if",
"(",
"typeof",
"type",
"===",
"'boolean'",
")",
"return",
"type",
";",
"if",
"(",
"typeof",
"type",
"===",
"'string'",
")",
"return",
"accepts",
"(",
"[",
"type",
"]",
",",
"event",
")... | Test if a type is accepted.
@param {String|Array|Function} type
@param {Event} event
@returns {Boolean} | [
"Test",
"if",
"a",
"type",
"is",
"accepted",
"."
] | 69b1fafd48a6d288fd39cf6e29813ad328c096ec | https://github.com/neoziro/angular-draganddrop/blob/69b1fafd48a6d288fd39cf6e29813ad328c096ec/angular-draganddrop.js#L143-L156 |
41,407 | neoziro/angular-draganddrop | angular-draganddrop.js | getData | function getData(event) {
var types = toArray(event.dataTransfer.types);
return types.reduce(function (collection, type) {
// Get data.
var data = event.dataTransfer.getData(type);
// Get data format.
var format = /(.*)\//.exec(type);
format = format ?... | javascript | function getData(event) {
var types = toArray(event.dataTransfer.types);
return types.reduce(function (collection, type) {
// Get data.
var data = event.dataTransfer.getData(type);
// Get data format.
var format = /(.*)\//.exec(type);
format = format ?... | [
"function",
"getData",
"(",
"event",
")",
"{",
"var",
"types",
"=",
"toArray",
"(",
"event",
".",
"dataTransfer",
".",
"types",
")",
";",
"return",
"types",
".",
"reduce",
"(",
"function",
"(",
"collection",
",",
"type",
")",
"{",
"// Get data.",
"var",
... | Get data from a drag event.
@param {Event} event
@returns {Object} | [
"Get",
"data",
"from",
"a",
"drag",
"event",
"."
] | 69b1fafd48a6d288fd39cf6e29813ad328c096ec | https://github.com/neoziro/angular-draganddrop/blob/69b1fafd48a6d288fd39cf6e29813ad328c096ec/angular-draganddrop.js#L165-L183 |
41,408 | TendaDigital/Tournamenter | modules/view-default/public/js/page-indicator.js | function(el){
if(!el)
el = this.$el.last();
else
el = $(el);
el.fadeOut(el.remove);
} | javascript | function(el){
if(!el)
el = this.$el.last();
else
el = $(el);
el.fadeOut(el.remove);
} | [
"function",
"(",
"el",
")",
"{",
"if",
"(",
"!",
"el",
")",
"el",
"=",
"this",
".",
"$el",
".",
"last",
"(",
")",
";",
"else",
"el",
"=",
"$",
"(",
"el",
")",
";",
"el",
".",
"fadeOut",
"(",
"el",
".",
"remove",
")",
";",
"}"
] | Remove the element "el". If not set, will remove the last one | [
"Remove",
"the",
"element",
"el",
".",
"If",
"not",
"set",
"will",
"remove",
"the",
"last",
"one"
] | 2733ae9b454ae90896249ab1d7a07007eb4a69e4 | https://github.com/TendaDigital/Tournamenter/blob/2733ae9b454ae90896249ab1d7a07007eb4a69e4/modules/view-default/public/js/page-indicator.js#L98-L105 | |
41,409 | onury/jsdoc-x | src/index.js | sortDocs | function sortDocs(docs, sortType) {
if (!sortType) return;
const fnSorter = sorter.getSymbolsComparer(sortType, '$longname');
const fnPropSorter = sorter.getSymbolsComparer(sortType, 'name');
docs.sort(fnSorter);
docs.forEach(symbol => {
if (symbol && Array.isArray(symbol.properties)) {
... | javascript | function sortDocs(docs, sortType) {
if (!sortType) return;
const fnSorter = sorter.getSymbolsComparer(sortType, '$longname');
const fnPropSorter = sorter.getSymbolsComparer(sortType, 'name');
docs.sort(fnSorter);
docs.forEach(symbol => {
if (symbol && Array.isArray(symbol.properties)) {
... | [
"function",
"sortDocs",
"(",
"docs",
",",
"sortType",
")",
"{",
"if",
"(",
"!",
"sortType",
")",
"return",
";",
"const",
"fnSorter",
"=",
"sorter",
".",
"getSymbolsComparer",
"(",
"sortType",
",",
"'$longname'",
")",
";",
"const",
"fnPropSorter",
"=",
"sor... | sorts documentation symbols and properties of each symbol, if any. | [
"sorts",
"documentation",
"symbols",
"and",
"properties",
"of",
"each",
"symbol",
"if",
"any",
"."
] | 33e4e0cc3e3c5ad9b17589b42e7a9dfa706b7d30 | https://github.com/onury/jsdoc-x/blob/33e4e0cc3e3c5ad9b17589b42e7a9dfa706b7d30/src/index.js#L132-L142 |
41,410 | philgs/grunt-available-tasks | lib/filterTasks.js | filterTasks | function filterTasks (type, tasks, alltasks) {
var contains = function (task) {
return _.includes(tasks, task.name);
};
if (type === 'include') {
return _.filter(alltasks, contains);
} else if (type === 'exclude') {
return _.reject(alltasks, contains);
}
return alltasks;... | javascript | function filterTasks (type, tasks, alltasks) {
var contains = function (task) {
return _.includes(tasks, task.name);
};
if (type === 'include') {
return _.filter(alltasks, contains);
} else if (type === 'exclude') {
return _.reject(alltasks, contains);
}
return alltasks;... | [
"function",
"filterTasks",
"(",
"type",
",",
"tasks",
",",
"alltasks",
")",
"{",
"var",
"contains",
"=",
"function",
"(",
"task",
")",
"{",
"return",
"_",
".",
"includes",
"(",
"tasks",
",",
"task",
".",
"name",
")",
";",
"}",
";",
"if",
"(",
"type... | Filtering rules are optional; delete those tasks that don't pass a filter | [
"Filtering",
"rules",
"are",
"optional",
";",
"delete",
"those",
"tasks",
"that",
"don",
"t",
"pass",
"a",
"filter"
] | faf0c76196cde8b3ed377fed2c2fae3ec1c33f6b | https://github.com/philgs/grunt-available-tasks/blob/faf0c76196cde8b3ed377fed2c2fae3ec1c33f6b/lib/filterTasks.js#L6-L17 |
41,411 | bambusoideae/passport-firebase-auth | lib/errors/internalautherror.js | InternalAuthError | function InternalAuthError(message, err) {
Error.call(this);
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.authError = err;
} | javascript | function InternalAuthError(message, err) {
Error.call(this);
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.authError = err;
} | [
"function",
"InternalAuthError",
"(",
"message",
",",
"err",
")",
"{",
"Error",
".",
"call",
"(",
"this",
")",
";",
"Error",
".",
"captureStackTrace",
"(",
"this",
",",
"this",
".",
"constructor",
")",
";",
"this",
".",
"name",
"=",
"this",
".",
"const... | `InternalAuthError` error.
InternalAuthError wraps errors generated by node-oauth. By wrapping these
objects, error messages can be formatted in a manner that aids in debugging
OAuth issues.
@constructor
@param {String} [message]
@param {Object|Error} [err]
@api public | [
"InternalAuthError",
"error",
"."
] | 149a78c4e4cdc5315722b2f7bb7c0a0552c4500a | https://github.com/bambusoideae/passport-firebase-auth/blob/149a78c4e4cdc5315722b2f7bb7c0a0552c4500a/lib/errors/internalautherror.js#L13-L19 |
41,412 | fxa/uritemplate-js | bin/uritemplate.js | encodeCharacter | function encodeCharacter (chr) {
var
result = '',
octets = utf8.encode(chr),
octet,
index;
for (index = 0; index < octets.length; index += 1) {
octet = octets.charCodeAt(index);
result += '%' + (octet < 0x10 ? '0' : '') + octet.toSt... | javascript | function encodeCharacter (chr) {
var
result = '',
octets = utf8.encode(chr),
octet,
index;
for (index = 0; index < octets.length; index += 1) {
octet = octets.charCodeAt(index);
result += '%' + (octet < 0x10 ? '0' : '') + octet.toSt... | [
"function",
"encodeCharacter",
"(",
"chr",
")",
"{",
"var",
"result",
"=",
"''",
",",
"octets",
"=",
"utf8",
".",
"encode",
"(",
"chr",
")",
",",
"octet",
",",
"index",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"octets",
".",
"length",... | encodes a character, if needed or not.
@param chr
@return pct-encoded character | [
"encodes",
"a",
"character",
"if",
"needed",
"or",
"not",
"."
] | d9c73932b42173c0f1bbafa88badc7a8e0cd6c06 | https://github.com/fxa/uritemplate-js/blob/d9c73932b42173c0f1bbafa88badc7a8e0cd6c06/bin/uritemplate.js#L176-L187 |
41,413 | fxa/uritemplate-js | bin/uritemplate.js | isPercentDigitDigit | function isPercentDigitDigit (text, start) {
return text.charAt(start) === '%' && charHelper.isHexDigit(text.charAt(start + 1)) && charHelper.isHexDigit(text.charAt(start + 2));
} | javascript | function isPercentDigitDigit (text, start) {
return text.charAt(start) === '%' && charHelper.isHexDigit(text.charAt(start + 1)) && charHelper.isHexDigit(text.charAt(start + 2));
} | [
"function",
"isPercentDigitDigit",
"(",
"text",
",",
"start",
")",
"{",
"return",
"text",
".",
"charAt",
"(",
"start",
")",
"===",
"'%'",
"&&",
"charHelper",
".",
"isHexDigit",
"(",
"text",
".",
"charAt",
"(",
"start",
"+",
"1",
")",
")",
"&&",
"charHe... | Returns, whether the given text at start is in the form 'percent hex-digit hex-digit', like '%3F'
@param text
@param start
@return {boolean|*|*} | [
"Returns",
"whether",
"the",
"given",
"text",
"at",
"start",
"is",
"in",
"the",
"form",
"percent",
"hex",
"-",
"digit",
"hex",
"-",
"digit",
"like",
"%3F"
] | d9c73932b42173c0f1bbafa88badc7a8e0cd6c06 | https://github.com/fxa/uritemplate-js/blob/d9c73932b42173c0f1bbafa88badc7a8e0cd6c06/bin/uritemplate.js#L195-L197 |
41,414 | fxa/uritemplate-js | bin/uritemplate.js | isPctEncoded | function isPctEncoded (chr) {
if (!isPercentDigitDigit(chr, 0)) {
return false;
}
var firstCharCode = parseHex2(chr, 1);
var numBytes = utf8.numBytes(firstCharCode);
if (numBytes === 0) {
return false;
}
for (var byteNumber = 1; byteNumber ... | javascript | function isPctEncoded (chr) {
if (!isPercentDigitDigit(chr, 0)) {
return false;
}
var firstCharCode = parseHex2(chr, 1);
var numBytes = utf8.numBytes(firstCharCode);
if (numBytes === 0) {
return false;
}
for (var byteNumber = 1; byteNumber ... | [
"function",
"isPctEncoded",
"(",
"chr",
")",
"{",
"if",
"(",
"!",
"isPercentDigitDigit",
"(",
"chr",
",",
"0",
")",
")",
"{",
"return",
"false",
";",
"}",
"var",
"firstCharCode",
"=",
"parseHex2",
"(",
"chr",
",",
"1",
")",
";",
"var",
"numBytes",
"=... | Returns whether or not the given char sequence is a correctly pct-encoded sequence.
@param chr
@return {boolean} | [
"Returns",
"whether",
"or",
"not",
"the",
"given",
"char",
"sequence",
"is",
"a",
"correctly",
"pct",
"-",
"encoded",
"sequence",
"."
] | d9c73932b42173c0f1bbafa88badc7a8e0cd6c06 | https://github.com/fxa/uritemplate-js/blob/d9c73932b42173c0f1bbafa88badc7a8e0cd6c06/bin/uritemplate.js#L214-L229 |
41,415 | fxa/uritemplate-js | bin/uritemplate.js | isVarchar | function isVarchar (chr) {
return charHelper.isAlpha(chr) || charHelper.isDigit(chr) || chr === '_' || pctEncoder.isPctEncoded(chr);
} | javascript | function isVarchar (chr) {
return charHelper.isAlpha(chr) || charHelper.isDigit(chr) || chr === '_' || pctEncoder.isPctEncoded(chr);
} | [
"function",
"isVarchar",
"(",
"chr",
")",
"{",
"return",
"charHelper",
".",
"isAlpha",
"(",
"chr",
")",
"||",
"charHelper",
".",
"isDigit",
"(",
"chr",
")",
"||",
"chr",
"===",
"'_'",
"||",
"pctEncoder",
".",
"isPctEncoded",
"(",
"chr",
")",
";",
"}"
] | Returns if an character is an varchar character according 2.3 of rfc 6570
@param chr
@return (Boolean) | [
"Returns",
"if",
"an",
"character",
"is",
"an",
"varchar",
"character",
"according",
"2",
".",
"3",
"of",
"rfc",
"6570"
] | d9c73932b42173c0f1bbafa88badc7a8e0cd6c06 | https://github.com/fxa/uritemplate-js/blob/d9c73932b42173c0f1bbafa88badc7a8e0cd6c06/bin/uritemplate.js#L269-L271 |
41,416 | fxa/uritemplate-js | bin/uritemplate.js | isUnreserved | function isUnreserved (chr) {
return charHelper.isAlpha(chr) || charHelper.isDigit(chr) || chr === '-' || chr === '.' || chr === '_' || chr === '~';
} | javascript | function isUnreserved (chr) {
return charHelper.isAlpha(chr) || charHelper.isDigit(chr) || chr === '-' || chr === '.' || chr === '_' || chr === '~';
} | [
"function",
"isUnreserved",
"(",
"chr",
")",
"{",
"return",
"charHelper",
".",
"isAlpha",
"(",
"chr",
")",
"||",
"charHelper",
".",
"isDigit",
"(",
"chr",
")",
"||",
"chr",
"===",
"'-'",
"||",
"chr",
"===",
"'.'",
"||",
"chr",
"===",
"'_'",
"||",
"ch... | Returns if chr is an unreserved character according 1.5 of rfc 6570
@param chr
@return {Boolean} | [
"Returns",
"if",
"chr",
"is",
"an",
"unreserved",
"character",
"according",
"1",
".",
"5",
"of",
"rfc",
"6570"
] | d9c73932b42173c0f1bbafa88badc7a8e0cd6c06 | https://github.com/fxa/uritemplate-js/blob/d9c73932b42173c0f1bbafa88badc7a8e0cd6c06/bin/uritemplate.js#L278-L280 |
41,417 | fxa/uritemplate-js | bin/uritemplate.js | isReserved | function isReserved (chr) {
return chr === ':' || chr === '/' || chr === '?' || chr === '#' || chr === '[' || chr === ']' || chr === '@' || chr === '!' || chr === '$' || chr === '&' || chr === '(' ||
chr === ')' || chr === '*' || chr === '+' || chr === ',' || chr === ';' || chr === '=' || chr === "'... | javascript | function isReserved (chr) {
return chr === ':' || chr === '/' || chr === '?' || chr === '#' || chr === '[' || chr === ']' || chr === '@' || chr === '!' || chr === '$' || chr === '&' || chr === '(' ||
chr === ')' || chr === '*' || chr === '+' || chr === ',' || chr === ';' || chr === '=' || chr === "'... | [
"function",
"isReserved",
"(",
"chr",
")",
"{",
"return",
"chr",
"===",
"':'",
"||",
"chr",
"===",
"'/'",
"||",
"chr",
"===",
"'?'",
"||",
"chr",
"===",
"'#'",
"||",
"chr",
"===",
"'['",
"||",
"chr",
"===",
"']'",
"||",
"chr",
"===",
"'@'",
"||",
... | Returns if chr is an reserved character according 1.5 of rfc 6570
or the percent character mentioned in 3.2.1.
@param chr
@return {Boolean} | [
"Returns",
"if",
"chr",
"is",
"an",
"reserved",
"character",
"according",
"1",
".",
"5",
"of",
"rfc",
"6570",
"or",
"the",
"percent",
"character",
"mentioned",
"in",
"3",
".",
"2",
".",
"1",
"."
] | d9c73932b42173c0f1bbafa88badc7a8e0cd6c06 | https://github.com/fxa/uritemplate-js/blob/d9c73932b42173c0f1bbafa88badc7a8e0cd6c06/bin/uritemplate.js#L288-L291 |
41,418 | gwtw/js-sorting | lib/gnome-sort.js | sort | function sort(array, compare, swap) {
var pos = 1;
while (pos < array.length) {
if (compare(array, pos, pos - 1) >= 0) {
pos++;
} else {
swap(array, pos, pos - 1);
if (pos > 1) {
pos--;
}
}
}
return array;
} | javascript | function sort(array, compare, swap) {
var pos = 1;
while (pos < array.length) {
if (compare(array, pos, pos - 1) >= 0) {
pos++;
} else {
swap(array, pos, pos - 1);
if (pos > 1) {
pos--;
}
}
}
return array;
} | [
"function",
"sort",
"(",
"array",
",",
"compare",
",",
"swap",
")",
"{",
"var",
"pos",
"=",
"1",
";",
"while",
"(",
"pos",
"<",
"array",
".",
"length",
")",
"{",
"if",
"(",
"compare",
"(",
"array",
",",
"pos",
",",
"pos",
"-",
"1",
")",
">=",
... | Sorts an array using gnome sort.
@param {Array} array The array to sort.
@param {function} compare The compare function.
@param {function} swap A function to call when the swap operation is
performed. This can be used to listen in on internals of the algorithm.
@returns The sorted array. | [
"Sorts",
"an",
"array",
"using",
"gnome",
"sort",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/gnome-sort.js#L21-L36 |
41,419 | rhapsodyjs/RhapsodyJS | lib/rhapsody/responseUtils.js | respond | function respond(res, code, data) {
return res.status(code).send(data || http.STATUS_CODES[code]);
} | javascript | function respond(res, code, data) {
return res.status(code).send(data || http.STATUS_CODES[code]);
} | [
"function",
"respond",
"(",
"res",
",",
"code",
",",
"data",
")",
"{",
"return",
"res",
".",
"status",
"(",
"code",
")",
".",
"send",
"(",
"data",
"||",
"http",
".",
"STATUS_CODES",
"[",
"code",
"]",
")",
";",
"}"
] | Respond to a request sending the correct status code, message and data
@param {ExpressResponse} res
@param {Number} code
@param {String} data | [
"Respond",
"to",
"a",
"request",
"sending",
"the",
"correct",
"status",
"code",
"message",
"and",
"data"
] | 49cd89d3f82841b2d8086811e63f59a34999b07f | https://github.com/rhapsodyjs/RhapsodyJS/blob/49cd89d3f82841b2d8086811e63f59a34999b07f/lib/rhapsody/responseUtils.js#L12-L14 |
41,420 | gwtw/js-sorting | lib/insertion-sort.js | sort | function sort(array, compare) {
for (var i = 1; i < array.length; i++) {
var item = array[i];
var indexHole = i;
while (indexHole > 0 && compare(array[indexHole - 1], item) > 0) {
array[indexHole] = array[--indexHole];
}
array[indexHole] = item;
if (sortExternal.shiftObserver) {
so... | javascript | function sort(array, compare) {
for (var i = 1; i < array.length; i++) {
var item = array[i];
var indexHole = i;
while (indexHole > 0 && compare(array[indexHole - 1], item) > 0) {
array[indexHole] = array[--indexHole];
}
array[indexHole] = item;
if (sortExternal.shiftObserver) {
so... | [
"function",
"sort",
"(",
"array",
",",
"compare",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"1",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"var",
"item",
"=",
"array",
"[",
"i",
"]",
";",
"var",
"indexHole",
"=",
"i",
";",... | Sorts an array using insertion sort.
@param {Array} array The array to sort.
@param {function} compare The compare function.
@returns The sorted array. | [
"Sorts",
"an",
"array",
"using",
"insertion",
"sort",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/insertion-sort.js#L18-L32 |
41,421 | gwtw/js-sorting | lib/merge-sort-bottom-up.js | bottomUpMerge | function bottomUpMerge(
array, leftPosition, chunkSize, workArray, compare) {
var i;
var rightPosition = leftPosition + chunkSize;
var endPosition = Math.min(leftPosition + chunkSize * 2 - 1,
array.length - 1);
var leftIndex = leftPosition;
var rightIndex = rightPosition;
f... | javascript | function bottomUpMerge(
array, leftPosition, chunkSize, workArray, compare) {
var i;
var rightPosition = leftPosition + chunkSize;
var endPosition = Math.min(leftPosition + chunkSize * 2 - 1,
array.length - 1);
var leftIndex = leftPosition;
var rightIndex = rightPosition;
f... | [
"function",
"bottomUpMerge",
"(",
"array",
",",
"leftPosition",
",",
"chunkSize",
",",
"workArray",
",",
"compare",
")",
"{",
"var",
"i",
";",
"var",
"rightPosition",
"=",
"leftPosition",
"+",
"chunkSize",
";",
"var",
"endPosition",
"=",
"Math",
".",
"min",
... | Merge a portion of the array.
@param {Array} array The array to merge.
@param {number} leftPosition The starting index of the array to merge.
@param {number} chunkSize The size of the portion of the array to merge.
@param {Array} workArray A work array the size of the array argument, this
parameter is for performance r... | [
"Merge",
"a",
"portion",
"of",
"the",
"array",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/merge-sort-bottom-up.js#L20-L42 |
41,422 | gwtw/js-sorting | lib/merge-sort-bottom-up.js | sort | function sort(array, compare) {
var workArray = new Array(array.length);
var chunkSize = 1;
while (chunkSize < array.length) {
var i = 0;
while (i < array.length - chunkSize) {
bottomUpMerge(array, i, chunkSize, workArray, compare);
i += chunkSize * 2;
}
chunkSize *= 2;
}
return ar... | javascript | function sort(array, compare) {
var workArray = new Array(array.length);
var chunkSize = 1;
while (chunkSize < array.length) {
var i = 0;
while (i < array.length - chunkSize) {
bottomUpMerge(array, i, chunkSize, workArray, compare);
i += chunkSize * 2;
}
chunkSize *= 2;
}
return ar... | [
"function",
"sort",
"(",
"array",
",",
"compare",
")",
"{",
"var",
"workArray",
"=",
"new",
"Array",
"(",
"array",
".",
"length",
")",
";",
"var",
"chunkSize",
"=",
"1",
";",
"while",
"(",
"chunkSize",
"<",
"array",
".",
"length",
")",
"{",
"var",
... | Sorts an array using bottom up merge sort.
@param {Array} array The array to sort.
@param {function} compare The compare function.
@returns The sorted array. | [
"Sorts",
"an",
"array",
"using",
"bottom",
"up",
"merge",
"sort",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/merge-sort-bottom-up.js#L50-L62 |
41,423 | rhapsodyjs/RhapsodyJS | lib/rhapsody/mvc/model.js | createRelationships | function createRelationships(rhapsodyApp) {
var relationshipModel,
relationshipName,
relationship,
relatedModel;
this.relationships = this.relationships || {};
for(relationshipName in this.relationships) {
relationship = this.relationships[relationshipName];
//If it's a valid relationship
if(... | javascript | function createRelationships(rhapsodyApp) {
var relationshipModel,
relationshipName,
relationship,
relatedModel;
this.relationships = this.relationships || {};
for(relationshipName in this.relationships) {
relationship = this.relationships[relationshipName];
//If it's a valid relationship
if(... | [
"function",
"createRelationships",
"(",
"rhapsodyApp",
")",
"{",
"var",
"relationshipModel",
",",
"relationshipName",
",",
"relationship",
",",
"relatedModel",
";",
"this",
".",
"relationships",
"=",
"this",
".",
"relationships",
"||",
"{",
"}",
";",
"for",
"(",... | Generate all the relationships of the model
@param {Rhapsody} rhapsodyApp | [
"Generate",
"all",
"the",
"relationships",
"of",
"the",
"model"
] | 49cd89d3f82841b2d8086811e63f59a34999b07f | https://github.com/rhapsodyjs/RhapsodyJS/blob/49cd89d3f82841b2d8086811e63f59a34999b07f/lib/rhapsody/mvc/model.js#L48-L93 |
41,424 | subschema/subschema | src/Dom.js | ownerDocument | function ownerDocument(componentOrElement) {
var elem = ReactDOM.findDOMNode(componentOrElement);
return elem && elem.ownerDocument || document;
} | javascript | function ownerDocument(componentOrElement) {
var elem = ReactDOM.findDOMNode(componentOrElement);
return elem && elem.ownerDocument || document;
} | [
"function",
"ownerDocument",
"(",
"componentOrElement",
")",
"{",
"var",
"elem",
"=",
"ReactDOM",
".",
"findDOMNode",
"(",
"componentOrElement",
")",
";",
"return",
"elem",
"&&",
"elem",
".",
"ownerDocument",
"||",
"document",
";",
"}"
] | Get elements owner document
@param {ReactComponent|HTMLElement} componentOrElement
@returns {HTMLElement} | [
"Get",
"elements",
"owner",
"document"
] | 55c07ee019b1e1ca0ebfb9266ccddd258c3e45b3 | https://github.com/subschema/subschema/blob/55c07ee019b1e1ca0ebfb9266ccddd258c3e45b3/src/Dom.js#L25-L28 |
41,425 | subschema/subschema | src/Dom.js | isNodeInRoot | function isNodeInRoot(node, root) {
node = ReactDOM.findDOMNode(node), root = ReactDOM.findDOMNode(root);
return _isNodeInRoot(node, root);
} | javascript | function isNodeInRoot(node, root) {
node = ReactDOM.findDOMNode(node), root = ReactDOM.findDOMNode(root);
return _isNodeInRoot(node, root);
} | [
"function",
"isNodeInRoot",
"(",
"node",
",",
"root",
")",
"{",
"node",
"=",
"ReactDOM",
".",
"findDOMNode",
"(",
"node",
")",
",",
"root",
"=",
"ReactDOM",
".",
"findDOMNode",
"(",
"root",
")",
";",
"return",
"_isNodeInRoot",
"(",
"node",
",",
"root",
... | Checks whether a node is within
a root nodes tree
@param {DOMElement} node
@param {DOMElement} root
@returns {boolean} | [
"Checks",
"whether",
"a",
"node",
"is",
"within",
"a",
"root",
"nodes",
"tree"
] | 55c07ee019b1e1ca0ebfb9266ccddd258c3e45b3 | https://github.com/subschema/subschema/blob/55c07ee019b1e1ca0ebfb9266ccddd258c3e45b3/src/Dom.js#L37-L40 |
41,426 | philipwalton/mozart | lib/class.js | Class | function Class(name, definition, parent) {
// Argument shifting.
if (typeof name == 'function') {
parent = definition;
definition = name;
name = null;
}
this.definition = definition;
this.parent = parent;
// Create the constructor, add some methods to it, and store the association.
this.Ctor... | javascript | function Class(name, definition, parent) {
// Argument shifting.
if (typeof name == 'function') {
parent = definition;
definition = name;
name = null;
}
this.definition = definition;
this.parent = parent;
// Create the constructor, add some methods to it, and store the association.
this.Ctor... | [
"function",
"Class",
"(",
"name",
",",
"definition",
",",
"parent",
")",
"{",
"// Argument shifting.",
"if",
"(",
"typeof",
"name",
"==",
"'function'",
")",
"{",
"parent",
"=",
"definition",
";",
"definition",
"=",
"name",
";",
"name",
"=",
"null",
";",
... | A Class.
@constructor
@param {string} name An optional function name given to the produced
constructor. This can be useful for debugging purposes.
@param {Function} definition An optional function used to define the new
constructor.
@param {Class} parent An optional parent Class instance to extend from.
This parameter ... | [
"A",
"Class",
"."
] | 8322dcfbb4da445f2c19ffcaba678ac07988b2b7 | https://github.com/philipwalton/mozart/blob/8322dcfbb4da445f2c19ffcaba678ac07988b2b7/lib/class.js#L27-L47 |
41,427 | philipwalton/mozart | lib/class.js | protectedFactory | function protectedFactory(instance) {
var publicPrototype = Object.getPrototypeOf(instance);
var protectedPrototype = protectToPrototypeMap.get(publicPrototype);
if (!protectedPrototype) {
throw new Error('The protected key function only accepts instances '
+ 'of objects created using Mozart constructor... | javascript | function protectedFactory(instance) {
var publicPrototype = Object.getPrototypeOf(instance);
var protectedPrototype = protectToPrototypeMap.get(publicPrototype);
if (!protectedPrototype) {
throw new Error('The protected key function only accepts instances '
+ 'of objects created using Mozart constructor... | [
"function",
"protectedFactory",
"(",
"instance",
")",
"{",
"var",
"publicPrototype",
"=",
"Object",
".",
"getPrototypeOf",
"(",
"instance",
")",
";",
"var",
"protectedPrototype",
"=",
"protectToPrototypeMap",
".",
"get",
"(",
"publicPrototype",
")",
";",
"if",
"... | A creator function that can be passed to the Private Parts `createKey`
method. If accepts an object and return a new object whose prototype is
the protected counterpart to the prototype of the passed object.
@param {Object} instance An instance of a constructor created with Class.
@return {Object} The protected methods... | [
"A",
"creator",
"function",
"that",
"can",
"be",
"passed",
"to",
"the",
"Private",
"Parts",
"createKey",
"method",
".",
"If",
"accepts",
"an",
"object",
"and",
"return",
"a",
"new",
"object",
"whose",
"prototype",
"is",
"the",
"protected",
"counterpart",
"to... | 8322dcfbb4da445f2c19ffcaba678ac07988b2b7 | https://github.com/philipwalton/mozart/blob/8322dcfbb4da445f2c19ffcaba678ac07988b2b7/lib/class.js#L192-L201 |
41,428 | gwtw/js-sorting | lib/cocktail-sort.js | sort | function sort(array, compare, swap) {
var start = -1;
var end = array.length - 2;
var swapped;
var i;
do {
swapped = false;
for (i = ++start; i <= end; i++) {
if (compare(array, i, i + 1) > 0) {
swap(array, i, i + 1);
swapped = true;
}
}
if (!swapped) {
brea... | javascript | function sort(array, compare, swap) {
var start = -1;
var end = array.length - 2;
var swapped;
var i;
do {
swapped = false;
for (i = ++start; i <= end; i++) {
if (compare(array, i, i + 1) > 0) {
swap(array, i, i + 1);
swapped = true;
}
}
if (!swapped) {
brea... | [
"function",
"sort",
"(",
"array",
",",
"compare",
",",
"swap",
")",
"{",
"var",
"start",
"=",
"-",
"1",
";",
"var",
"end",
"=",
"array",
".",
"length",
"-",
"2",
";",
"var",
"swapped",
";",
"var",
"i",
";",
"do",
"{",
"swapped",
"=",
"false",
"... | Sorts an array using cocktail sort.
@param {Array} array The array to sort.
@param {function} compare The compare function.
@param {function} swap A function to call when the swap operation is
performed. This can be used to listen in on internals of the algorithm.
@returns The sorted array. | [
"Sorts",
"an",
"array",
"using",
"cocktail",
"sort",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/cocktail-sort.js#L21-L50 |
41,429 | mcollina/pbkdf2-password | pbkdf2-password.js | hasher | function hasher(opts, callback) {
if (typeof opts.password !== 'string') {
passNeeded(opts, callback);
} else if (typeof opts.salt !== 'string') {
saltNeeded(opts, callback);
} else {
opts.salt = new Buffer(opts.salt, 'base64');
genHash(opts, callback);
}
} | javascript | function hasher(opts, callback) {
if (typeof opts.password !== 'string') {
passNeeded(opts, callback);
} else if (typeof opts.salt !== 'string') {
saltNeeded(opts, callback);
} else {
opts.salt = new Buffer(opts.salt, 'base64');
genHash(opts, callback);
}
} | [
"function",
"hasher",
"(",
"opts",
",",
"callback",
")",
"{",
"if",
"(",
"typeof",
"opts",
".",
"password",
"!==",
"'string'",
")",
"{",
"passNeeded",
"(",
"opts",
",",
"callback",
")",
";",
"}",
"else",
"if",
"(",
"typeof",
"opts",
".",
"salt",
"!==... | Hash a password, using a hash and the pbkd2
crypto module.
Options:
- `password`, the password to hash.
- `salt`, the salt to use, as a base64 string.
If the `password` is left undefined, a new
10-bytes password will be generated, and converted
to base64.
If the `salt` is left undefined, a new salt is generated.
Th... | [
"Hash",
"a",
"password",
"using",
"a",
"hash",
"and",
"the",
"pbkd2",
"crypto",
"module",
"."
] | 170c735be649e353c19da0ffc585c22dd6b34c5a | https://github.com/mcollina/pbkdf2-password/blob/170c735be649e353c19da0ffc585c22dd6b34c5a/pbkdf2-password.js#L89-L98 |
41,430 | mcollina/pbkdf2-password | pbkdf2-password.js | genPass | function genPass(opts, cb) {
// generate a 10-bytes password
crypto.randomBytes(10, function(err, buffer) {
if (buffer) {
opts.password = buffer.toString("base64");
}
cb(err, opts);
});
} | javascript | function genPass(opts, cb) {
// generate a 10-bytes password
crypto.randomBytes(10, function(err, buffer) {
if (buffer) {
opts.password = buffer.toString("base64");
}
cb(err, opts);
});
} | [
"function",
"genPass",
"(",
"opts",
",",
"cb",
")",
"{",
"// generate a 10-bytes password",
"crypto",
".",
"randomBytes",
"(",
"10",
",",
"function",
"(",
"err",
",",
"buffer",
")",
"{",
"if",
"(",
"buffer",
")",
"{",
"opts",
".",
"password",
"=",
"buffe... | Generates a new password
@api private
@param {Object} opts The options (where the new password will be stored)
@param {Function} cb The callback | [
"Generates",
"a",
"new",
"password"
] | 170c735be649e353c19da0ffc585c22dd6b34c5a | https://github.com/mcollina/pbkdf2-password/blob/170c735be649e353c19da0ffc585c22dd6b34c5a/pbkdf2-password.js#L107-L115 |
41,431 | mcollina/pbkdf2-password | pbkdf2-password.js | genSalt | function genSalt(opts, cb) {
crypto.randomBytes(saltLength, function(err, buf) {
opts.salt = buf;
cb(err, opts);
});
} | javascript | function genSalt(opts, cb) {
crypto.randomBytes(saltLength, function(err, buf) {
opts.salt = buf;
cb(err, opts);
});
} | [
"function",
"genSalt",
"(",
"opts",
",",
"cb",
")",
"{",
"crypto",
".",
"randomBytes",
"(",
"saltLength",
",",
"function",
"(",
"err",
",",
"buf",
")",
"{",
"opts",
".",
"salt",
"=",
"buf",
";",
"cb",
"(",
"err",
",",
"opts",
")",
";",
"}",
")",
... | Generates a new salt
@api private
@param {Object} opts The options (where the new password will be stored)
@param {Function} cb The callback | [
"Generates",
"a",
"new",
"salt"
] | 170c735be649e353c19da0ffc585c22dd6b34c5a | https://github.com/mcollina/pbkdf2-password/blob/170c735be649e353c19da0ffc585c22dd6b34c5a/pbkdf2-password.js#L124-L129 |
41,432 | mcollina/pbkdf2-password | pbkdf2-password.js | genHashWithDigest | function genHashWithDigest(opts, cb) {
crypto.pbkdf2(opts.password, opts.salt, iterations, keyLength, digest, function(err, hash) {
if (typeof hash === 'string') {
hash = new Buffer(hash, 'binary');
}
cb(err, opts.password, opts.salt.toString("base64"), hash.toString("base64"));
});
... | javascript | function genHashWithDigest(opts, cb) {
crypto.pbkdf2(opts.password, opts.salt, iterations, keyLength, digest, function(err, hash) {
if (typeof hash === 'string') {
hash = new Buffer(hash, 'binary');
}
cb(err, opts.password, opts.salt.toString("base64"), hash.toString("base64"));
});
... | [
"function",
"genHashWithDigest",
"(",
"opts",
",",
"cb",
")",
"{",
"crypto",
".",
"pbkdf2",
"(",
"opts",
".",
"password",
",",
"opts",
".",
"salt",
",",
"iterations",
",",
"keyLength",
",",
"digest",
",",
"function",
"(",
"err",
",",
"hash",
")",
"{",
... | Generates a new hash using the password and the salt
The callback will be called with the following arguments:
- the error, if something when wrong.
- the password.
- the salt, encoded in base64.
- the hash, encoded in base64.
@api private
@param {Object} opts The options used to generate the hash (password & salt)
@... | [
"Generates",
"a",
"new",
"hash",
"using",
"the",
"password",
"and",
"the",
"salt"
] | 170c735be649e353c19da0ffc585c22dd6b34c5a | https://github.com/mcollina/pbkdf2-password/blob/170c735be649e353c19da0ffc585c22dd6b34c5a/pbkdf2-password.js#L144-L152 |
41,433 | gwtw/js-sorting | lib/bucket-sort.js | sort | function sort(array, bucketSize) {
if (array.length === 0) {
return array;
}
// Determine minimum and maximum values
var i;
var minValue = array[0];
var maxValue = array[0];
for (i = 1; i < array.length; i++) {
if (array[i] < minValue) {
minValue = array[i];
} else if (array[i] > maxVal... | javascript | function sort(array, bucketSize) {
if (array.length === 0) {
return array;
}
// Determine minimum and maximum values
var i;
var minValue = array[0];
var maxValue = array[0];
for (i = 1; i < array.length; i++) {
if (array[i] < minValue) {
minValue = array[i];
} else if (array[i] > maxVal... | [
"function",
"sort",
"(",
"array",
",",
"bucketSize",
")",
"{",
"if",
"(",
"array",
".",
"length",
"===",
"0",
")",
"{",
"return",
"array",
";",
"}",
"// Determine minimum and maximum values",
"var",
"i",
";",
"var",
"minValue",
"=",
"array",
"[",
"0",
"]... | Sorts an array using bucket sort.
@param {number[]} array The array to sort.
@param {number} [bucketSize=5] The number of values a bucket can hold.
@returns The sorted array. | [
"Sorts",
"an",
"array",
"using",
"bucket",
"sort",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/bucket-sort.js#L15-L56 |
41,434 | subschema/subschema | src/core.js | newSubschemaContext | function newSubschemaContext(defaultLoaders = [], defaultResolvers = {}, defaultPropTypes = PropTypes, defaultInjectorFactory = injectorFactory, Subschema = {
Conditional,
Field,
FieldSet,
RenderContent,
RenderTemplate,
Form,
NewChildContext,
Dom,
PropTypes,
ValueManager,
css... | javascript | function newSubschemaContext(defaultLoaders = [], defaultResolvers = {}, defaultPropTypes = PropTypes, defaultInjectorFactory = injectorFactory, Subschema = {
Conditional,
Field,
FieldSet,
RenderContent,
RenderTemplate,
Form,
NewChildContext,
Dom,
PropTypes,
ValueManager,
css... | [
"function",
"newSubschemaContext",
"(",
"defaultLoaders",
"=",
"[",
"]",
",",
"defaultResolvers",
"=",
"{",
"}",
",",
"defaultPropTypes",
"=",
"PropTypes",
",",
"defaultInjectorFactory",
"=",
"injectorFactory",
",",
"Subschema",
"=",
"{",
"Conditional",
",",
"Fiel... | Used to initialize new subschema for testing. But also to override behaviours if necessary.
@param defaultLoaders
@param defaultResolvers
@param defaultPropTypes
@param defaultInjectorFactory
@param Subschema | [
"Used",
"to",
"initialize",
"new",
"subschema",
"for",
"testing",
".",
"But",
"also",
"to",
"override",
"behaviours",
"if",
"necessary",
"."
] | 55c07ee019b1e1ca0ebfb9266ccddd258c3e45b3 | https://github.com/subschema/subschema/blob/55c07ee019b1e1ca0ebfb9266ccddd258c3e45b3/src/core.js#L76-L119 |
41,435 | rhapsodyjs/RhapsodyJS | lib/rhapsody.js | Rhapsody | function Rhapsody(options) {
//Expose object as global
//Should fix it latter
global.Rhapsody = this;
this.options = options;
this.root = options.root;
//Libs used internally that the programmer can access
this.libs = {
express: require('express'),
jsmin: require('jsmin').jsmin,
lodash: require('lodash')... | javascript | function Rhapsody(options) {
//Expose object as global
//Should fix it latter
global.Rhapsody = this;
this.options = options;
this.root = options.root;
//Libs used internally that the programmer can access
this.libs = {
express: require('express'),
jsmin: require('jsmin').jsmin,
lodash: require('lodash')... | [
"function",
"Rhapsody",
"(",
"options",
")",
"{",
"//Expose object as global",
"//Should fix it latter",
"global",
".",
"Rhapsody",
"=",
"this",
";",
"this",
".",
"options",
"=",
"options",
";",
"this",
".",
"root",
"=",
"options",
".",
"root",
";",
"//Libs us... | RhapsodyJS app class
@param {Object} options Options
@constructor | [
"RhapsodyJS",
"app",
"class"
] | 49cd89d3f82841b2d8086811e63f59a34999b07f | https://github.com/rhapsodyjs/RhapsodyJS/blob/49cd89d3f82841b2d8086811e63f59a34999b07f/lib/rhapsody.js#L16-L46 |
41,436 | rhapsodyjs/RhapsodyJS | lib/rhapsody.js | requireModel | function requireModel(modelName, full) {
if(!modelName) {
return false;
}
var model = this.models[modelName];
if(full) {
return (model ? model : false);
}
return (model ? model.serverModel : false);
} | javascript | function requireModel(modelName, full) {
if(!modelName) {
return false;
}
var model = this.models[modelName];
if(full) {
return (model ? model : false);
}
return (model ? model.serverModel : false);
} | [
"function",
"requireModel",
"(",
"modelName",
",",
"full",
")",
"{",
"if",
"(",
"!",
"modelName",
")",
"{",
"return",
"false",
";",
"}",
"var",
"model",
"=",
"this",
".",
"models",
"[",
"modelName",
"]",
";",
"if",
"(",
"full",
")",
"{",
"return",
... | Returns the serverModel or the whole model
@param {String} modelName The name of the model
@param {Boolean} full Optional. Makes return the whole model
@return {Model} | [
"Returns",
"the",
"serverModel",
"or",
"the",
"whole",
"model"
] | 49cd89d3f82841b2d8086811e63f59a34999b07f | https://github.com/rhapsodyjs/RhapsodyJS/blob/49cd89d3f82841b2d8086811e63f59a34999b07f/lib/rhapsody.js#L64-L75 |
41,437 | rhapsodyjs/RhapsodyJS | lib/rhapsody.js | onlineMessage | function onlineMessage() {
_this.showLogo();
var httpPort = _this.config.http.port;
Logger.info('Listening HTTP on port ' + httpPort);
if(_this.config.https.enabled) {
var httpsPort = _this.config.https.port;
Logger.info('Listening HTTPS on port ' + httpsPort);
}
} | javascript | function onlineMessage() {
_this.showLogo();
var httpPort = _this.config.http.port;
Logger.info('Listening HTTP on port ' + httpPort);
if(_this.config.https.enabled) {
var httpsPort = _this.config.https.port;
Logger.info('Listening HTTPS on port ' + httpsPort);
}
} | [
"function",
"onlineMessage",
"(",
")",
"{",
"_this",
".",
"showLogo",
"(",
")",
";",
"var",
"httpPort",
"=",
"_this",
".",
"config",
".",
"http",
".",
"port",
";",
"Logger",
".",
"info",
"(",
"'Listening HTTP on port '",
"+",
"httpPort",
")",
";",
"if",
... | Show the message that it's all online | [
"Show",
"the",
"message",
"that",
"it",
"s",
"all",
"online"
] | 49cd89d3f82841b2d8086811e63f59a34999b07f | https://github.com/rhapsodyjs/RhapsodyJS/blob/49cd89d3f82841b2d8086811e63f59a34999b07f/lib/rhapsody.js#L398-L408 |
41,438 | subschema/subschema | src/tutils.js | nextFunc | function nextFunc(f1, f2) {
if (f1 && !f2) return f1;
if (f2 && !f1) return f2;
return function nextFunc$wrapper(...args) {
if (f1.apply(this, args) !== false) {
return f2.apply(this, args);
}
};
} | javascript | function nextFunc(f1, f2) {
if (f1 && !f2) return f1;
if (f2 && !f1) return f2;
return function nextFunc$wrapper(...args) {
if (f1.apply(this, args) !== false) {
return f2.apply(this, args);
}
};
} | [
"function",
"nextFunc",
"(",
"f1",
",",
"f2",
")",
"{",
"if",
"(",
"f1",
"&&",
"!",
"f2",
")",
"return",
"f1",
";",
"if",
"(",
"f2",
"&&",
"!",
"f1",
")",
"return",
"f2",
";",
"return",
"function",
"nextFunc$wrapper",
"(",
"...",
"args",
")",
"{"... | When f1 and f2 are defined-
Calls f1 and f2 if f1 and f2 are defined and f1 does not return false.
If f1 returns false, f2 is not called.
If f2 is not defined f1 is returned.
if f1 is not defined f2 is returned.
@param f1
@param f2
@returns {function} | [
"When",
"f1",
"and",
"f2",
"are",
"defined",
"-"
] | 55c07ee019b1e1ca0ebfb9266ccddd258c3e45b3 | https://github.com/subschema/subschema/blob/55c07ee019b1e1ca0ebfb9266ccddd258c3e45b3/src/tutils.js#L171-L179 |
41,439 | subschema/subschema | src/types/RestrictedMixin.js | clean | function clean(parts) {
var p = '';
for (var i = 0; i < parts.length; i += 3) {
p += parts[i] || '';
}
return p;
} | javascript | function clean(parts) {
var p = '';
for (var i = 0; i < parts.length; i += 3) {
p += parts[i] || '';
}
return p;
} | [
"function",
"clean",
"(",
"parts",
")",
"{",
"var",
"p",
"=",
"''",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"parts",
".",
"length",
";",
"i",
"+=",
"3",
")",
"{",
"p",
"+=",
"parts",
"[",
"i",
"]",
"||",
"''",
";",
"}",
"ret... | So we only care about every 3rd group. Remove delimeters and such, so the next parse can have something nice to work with. | [
"So",
"we",
"only",
"care",
"about",
"every",
"3rd",
"group",
".",
"Remove",
"delimeters",
"and",
"such",
"so",
"the",
"next",
"parse",
"can",
"have",
"something",
"nice",
"to",
"work",
"with",
"."
] | 55c07ee019b1e1ca0ebfb9266ccddd258c3e45b3 | https://github.com/subschema/subschema/blob/55c07ee019b1e1ca0ebfb9266ccddd258c3e45b3/src/types/RestrictedMixin.js#L190-L196 |
41,440 | WebReflection/broadcast | src/broadcast.js | function (x) {
var i = indexOf.call(k, x);
k.splice(i, 1);
v.splice(i, 1);
} | javascript | function (x) {
var i = indexOf.call(k, x);
k.splice(i, 1);
v.splice(i, 1);
} | [
"function",
"(",
"x",
")",
"{",
"var",
"i",
"=",
"indexOf",
".",
"call",
"(",
"k",
",",
"x",
")",
";",
"k",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"v",
".",
"splice",
"(",
"i",
",",
"1",
")",
";",
"}"
] | delete used to be a reserved property name | [
"delete",
"used",
"to",
"be",
"a",
"reserved",
"property",
"name"
] | f58a0812bbcdf9c224000b64cc79cc6ffe7f818d | https://github.com/WebReflection/broadcast/blob/f58a0812bbcdf9c224000b64cc79cc6ffe7f818d/src/broadcast.js#L74-L78 | |
41,441 | WebReflection/broadcast | src/broadcast.js | drop | function drop(type, callback) {
if (arguments.length === 1)
delete _[type];
else {
var fn = wm.get(callback), cb, i;
if (fn) {
wm['delete'](callback);
drop(type, fn);
} else {
cb = get(type).cb;
i = indexOf.call(cb, callback);
... | javascript | function drop(type, callback) {
if (arguments.length === 1)
delete _[type];
else {
var fn = wm.get(callback), cb, i;
if (fn) {
wm['delete'](callback);
drop(type, fn);
} else {
cb = get(type).cb;
i = indexOf.call(cb, callback);
... | [
"function",
"drop",
"(",
"type",
",",
"callback",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"===",
"1",
")",
"delete",
"_",
"[",
"type",
"]",
";",
"else",
"{",
"var",
"fn",
"=",
"wm",
".",
"get",
"(",
"callback",
")",
",",
"cb",
",",
"i"... | if we set a listener through `.when` and this hasn't been notified yet but we changed our mind about such notification we can still remove such listener via `.drop` otherwise, if we know the key, we can drop it. | [
"if",
"we",
"set",
"a",
"listener",
"through",
".",
"when",
"and",
"this",
"hasn",
"t",
"been",
"notified",
"yet",
"but",
"we",
"changed",
"our",
"mind",
"about",
"such",
"notification",
"we",
"can",
"still",
"remove",
"such",
"listener",
"via",
".",
"dr... | f58a0812bbcdf9c224000b64cc79cc6ffe7f818d | https://github.com/WebReflection/broadcast/blob/f58a0812bbcdf9c224000b64cc79cc6ffe7f818d/src/broadcast.js#L201-L215 |
41,442 | WebReflection/broadcast | src/broadcast.js | all | function all(type, callback) {
if (!wm.get(callback)) {
wm.set(callback, function fn() {
invoke = false;
when(type, fn);
invoke = true;
resolve(arguments).then(bind.call(broadcast, callback));
});
when(type, wm.get(callback));
}
} | javascript | function all(type, callback) {
if (!wm.get(callback)) {
wm.set(callback, function fn() {
invoke = false;
when(type, fn);
invoke = true;
resolve(arguments).then(bind.call(broadcast, callback));
});
when(type, wm.get(callback));
}
} | [
"function",
"all",
"(",
"type",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"wm",
".",
"get",
"(",
"callback",
")",
")",
"{",
"wm",
".",
"set",
"(",
"callback",
",",
"function",
"fn",
"(",
")",
"{",
"invoke",
"=",
"false",
";",
"when",
"(",
"typ... | in case we'd like to react each time to a specific event. In this case a callback is mandatory, and it's also needed to eventually drop. | [
"in",
"case",
"we",
"d",
"like",
"to",
"react",
"each",
"time",
"to",
"a",
"specific",
"event",
".",
"In",
"this",
"case",
"a",
"callback",
"is",
"mandatory",
"and",
"it",
"s",
"also",
"needed",
"to",
"eventually",
"drop",
"."
] | f58a0812bbcdf9c224000b64cc79cc6ffe7f818d | https://github.com/WebReflection/broadcast/blob/f58a0812bbcdf9c224000b64cc79cc6ffe7f818d/src/broadcast.js#L226-L236 |
41,443 | rhapsodyjs/RhapsodyJS | lib/rhapsody/router/modelRouter/index.js | getModel | function getModel(req, res, next, model) {
var fullModel = Rhapsody.requireModel(model, true);
if(!fullModel) {
Rhapsody.log.verbose('Nonexistent model', 'Couldn\'t find collection %s.', model);
return responseUtils.respond(res, 400); //Malformed syntax or a bad query
}
//This model does not allow REST ... | javascript | function getModel(req, res, next, model) {
var fullModel = Rhapsody.requireModel(model, true);
if(!fullModel) {
Rhapsody.log.verbose('Nonexistent model', 'Couldn\'t find collection %s.', model);
return responseUtils.respond(res, 400); //Malformed syntax or a bad query
}
//This model does not allow REST ... | [
"function",
"getModel",
"(",
"req",
",",
"res",
",",
"next",
",",
"model",
")",
"{",
"var",
"fullModel",
"=",
"Rhapsody",
".",
"requireModel",
"(",
"model",
",",
"true",
")",
";",
"if",
"(",
"!",
"fullModel",
")",
"{",
"Rhapsody",
".",
"log",
".",
... | Gets the model and save it in the req object
@param {ExpressRequest} req
@param {ExpressResponse} res
@param {Function} next Pass to the next route | [
"Gets",
"the",
"model",
"and",
"save",
"it",
"in",
"the",
"req",
"object"
] | 49cd89d3f82841b2d8086811e63f59a34999b07f | https://github.com/rhapsodyjs/RhapsodyJS/blob/49cd89d3f82841b2d8086811e63f59a34999b07f/lib/rhapsody/router/modelRouter/index.js#L47-L63 |
41,444 | rhapsodyjs/RhapsodyJS | lib/rhapsody/router/modelRouter/index.js | function(req, res, next, relationship) {
if(req.fullModel.hasRelationship(relationship)) {
return next();
}
return responseUtils.respond(res, 400); //Malformed syntax or a bad query
} | javascript | function(req, res, next, relationship) {
if(req.fullModel.hasRelationship(relationship)) {
return next();
}
return responseUtils.respond(res, 400); //Malformed syntax or a bad query
} | [
"function",
"(",
"req",
",",
"res",
",",
"next",
",",
"relationship",
")",
"{",
"if",
"(",
"req",
".",
"fullModel",
".",
"hasRelationship",
"(",
"relationship",
")",
")",
"{",
"return",
"next",
"(",
")",
";",
"}",
"return",
"responseUtils",
".",
"respo... | Check whether req.fullModel has relationship
@param {ExpressRequest} req
@param {ExpressResponse} res
@param {Function} next Pass to the next route
@param {String} relationship Relationship name | [
"Check",
"whether",
"req",
".",
"fullModel",
"has",
"relationship"
] | 49cd89d3f82841b2d8086811e63f59a34999b07f | https://github.com/rhapsodyjs/RhapsodyJS/blob/49cd89d3f82841b2d8086811e63f59a34999b07f/lib/rhapsody/router/modelRouter/index.js#L72-L78 | |
41,445 | rhapsodyjs/RhapsodyJS | lib/rhapsody/router/modelRouter/index.js | bindMiddlewares | function bindMiddlewares() {
var modelName,
_this = this;
for(modelName in Rhapsody.models) {
(function(model) {
model.options.middlewares.forEach(function(middleware) {
if(typeof middleware !== 'function') {
middleware = require(path.join(Rhapsody.root, '/app/middlewares/' + middleware));
... | javascript | function bindMiddlewares() {
var modelName,
_this = this;
for(modelName in Rhapsody.models) {
(function(model) {
model.options.middlewares.forEach(function(middleware) {
if(typeof middleware !== 'function') {
middleware = require(path.join(Rhapsody.root, '/app/middlewares/' + middleware));
... | [
"function",
"bindMiddlewares",
"(",
")",
"{",
"var",
"modelName",
",",
"_this",
"=",
"this",
";",
"for",
"(",
"modelName",
"in",
"Rhapsody",
".",
"models",
")",
"{",
"(",
"function",
"(",
"model",
")",
"{",
"model",
".",
"options",
".",
"middlewares",
... | Bind the middlewares to the model routes | [
"Bind",
"the",
"middlewares",
"to",
"the",
"model",
"routes"
] | 49cd89d3f82841b2d8086811e63f59a34999b07f | https://github.com/rhapsodyjs/RhapsodyJS/blob/49cd89d3f82841b2d8086811e63f59a34999b07f/lib/rhapsody/router/modelRouter/index.js#L83-L109 |
41,446 | subschema/subschema | src/ValueManager.js | function (e, errors, value, path) {
var parts = path && path.split('.') || [], i = 0, l = parts.length, pp = null;
do {
if (this.submitListeners.some(v=> {
if (v.path === pp) {
return (v.listener.call(v.scope, e, errors, value, path) === false);
... | javascript | function (e, errors, value, path) {
var parts = path && path.split('.') || [], i = 0, l = parts.length, pp = null;
do {
if (this.submitListeners.some(v=> {
if (v.path === pp) {
return (v.listener.call(v.scope, e, errors, value, path) === false);
... | [
"function",
"(",
"e",
",",
"errors",
",",
"value",
",",
"path",
")",
"{",
"var",
"parts",
"=",
"path",
"&&",
"path",
".",
"split",
"(",
"'.'",
")",
"||",
"[",
"]",
",",
"i",
"=",
"0",
",",
"l",
"=",
"parts",
".",
"length",
",",
"pp",
"=",
"... | When onSubmit is called this is fired | [
"When",
"onSubmit",
"is",
"called",
"this",
"is",
"fired"
] | 55c07ee019b1e1ca0ebfb9266ccddd258c3e45b3 | https://github.com/subschema/subschema/blob/55c07ee019b1e1ca0ebfb9266ccddd258c3e45b3/src/ValueManager.js#L130-L143 | |
41,447 | gwtw/js-sorting | lib/heapsort.js | heapify | function heapify(array, heapSize, i, compare, swap) {
var left = i * 2 + 1;
var right = i * 2 + 2;
var largest = i;
if (left < heapSize && compare(array, left, largest) > 0) {
largest = left;
}
if (right < heapSize && compare(array, right, largest) > 0) {
largest = right;
}
if (largest !== i) ... | javascript | function heapify(array, heapSize, i, compare, swap) {
var left = i * 2 + 1;
var right = i * 2 + 2;
var largest = i;
if (left < heapSize && compare(array, left, largest) > 0) {
largest = left;
}
if (right < heapSize && compare(array, right, largest) > 0) {
largest = right;
}
if (largest !== i) ... | [
"function",
"heapify",
"(",
"array",
",",
"heapSize",
",",
"i",
",",
"compare",
",",
"swap",
")",
"{",
"var",
"left",
"=",
"i",
"*",
"2",
"+",
"1",
";",
"var",
"right",
"=",
"i",
"*",
"2",
"+",
"2",
";",
"var",
"largest",
"=",
"i",
";",
"if",... | Heapify an array.
@param {Array} array The array to build a heapify.
@param {number} heapSize The size of the heap.
@param {number} i The index of the array to heapify.
@param {function} compare The compare function.
@param {function} swap A function to call when the swap operation is
performed. This can be used to lis... | [
"Heapify",
"an",
"array",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/heapsort.js#L23-L39 |
41,448 | gwtw/js-sorting | lib/heapsort.js | buildHeap | function buildHeap(array, heapSize, compare, swap) {
for (var i = Math.floor(array.length / 2); i >= 0; i--) {
heapify(array, heapSize, i, compare, swap);
}
} | javascript | function buildHeap(array, heapSize, compare, swap) {
for (var i = Math.floor(array.length / 2); i >= 0; i--) {
heapify(array, heapSize, i, compare, swap);
}
} | [
"function",
"buildHeap",
"(",
"array",
",",
"heapSize",
",",
"compare",
",",
"swap",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"Math",
".",
"floor",
"(",
"array",
".",
"length",
"/",
"2",
")",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"heapif... | Build a heap out of an array.
@param {Array} array The array to build a heap on.
@param {number} heapSize The size of the heap.
@param {function} compare The compare function.
@param {function} swap A function to call when the swap operation is
performed. This can be used to listen in on internals of the algorithm.
@re... | [
"Build",
"a",
"heap",
"out",
"of",
"an",
"array",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/heapsort.js#L50-L54 |
41,449 | gwtw/js-sorting | lib/heapsort.js | sort | function sort(array, compare, swap) {
var heapSize = array.length;
buildHeap(array, heapSize, compare, swap);
while (heapSize > 1) {
swap(array, 0, --heapSize);
heapify(array, heapSize, 0, compare, swap);
}
return array;
} | javascript | function sort(array, compare, swap) {
var heapSize = array.length;
buildHeap(array, heapSize, compare, swap);
while (heapSize > 1) {
swap(array, 0, --heapSize);
heapify(array, heapSize, 0, compare, swap);
}
return array;
} | [
"function",
"sort",
"(",
"array",
",",
"compare",
",",
"swap",
")",
"{",
"var",
"heapSize",
"=",
"array",
".",
"length",
";",
"buildHeap",
"(",
"array",
",",
"heapSize",
",",
"compare",
",",
"swap",
")",
";",
"while",
"(",
"heapSize",
">",
"1",
")",
... | Sorts an array using heapsort.
@param {Array} array The array to sort.
@param {function} compare The compare function.
@param {function} swap A function to call when the swap operation is
performed. This can be used to listen in on internals of the algorithm.
@returns The sorted array. | [
"Sorts",
"an",
"array",
"using",
"heapsort",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/heapsort.js#L64-L72 |
41,450 | themouette/selenium-grid | src/driver/native.js | exposeNative | function exposeNative(Browser, command, exposed) {
if (_.isNumber(exposed)) {
exposed = command;
}
Browser.prototype[exposed] = function () {
ensureDriverCommand.call(this, command, 'exposeNative');
var args = wrapArguments.call(this, arguments, errorToExceptionCallback);
th... | javascript | function exposeNative(Browser, command, exposed) {
if (_.isNumber(exposed)) {
exposed = command;
}
Browser.prototype[exposed] = function () {
ensureDriverCommand.call(this, command, 'exposeNative');
var args = wrapArguments.call(this, arguments, errorToExceptionCallback);
th... | [
"function",
"exposeNative",
"(",
"Browser",
",",
"command",
",",
"exposed",
")",
"{",
"if",
"(",
"_",
".",
"isNumber",
"(",
"exposed",
")",
")",
"{",
"exposed",
"=",
"command",
";",
"}",
"Browser",
".",
"prototype",
"[",
"exposed",
"]",
"=",
"function"... | exposed methods handle errors as exceptions. | [
"exposed",
"methods",
"handle",
"errors",
"as",
"exceptions",
"."
] | b1971890ff0c6ee27869df0c6e8b384687492bb6 | https://github.com/themouette/selenium-grid/blob/b1971890ff0c6ee27869df0c6e8b384687492bb6/src/driver/native.js#L76-L88 |
41,451 | gwtw/js-sorting | lib/comb-sort.js | sort | function sort(array, compare, swap) {
var gap = array.length;
var shrinkFactor = 1.3;
var swapped;
while (gap > 1 || swapped) {
if (gap > 1) {
gap = Math.floor(gap / shrinkFactor);
}
swapped = false;
for (var i = 0; gap + i < array.length; ++i) {
if (compare(array, i, i + gap) > 0... | javascript | function sort(array, compare, swap) {
var gap = array.length;
var shrinkFactor = 1.3;
var swapped;
while (gap > 1 || swapped) {
if (gap > 1) {
gap = Math.floor(gap / shrinkFactor);
}
swapped = false;
for (var i = 0; gap + i < array.length; ++i) {
if (compare(array, i, i + gap) > 0... | [
"function",
"sort",
"(",
"array",
",",
"compare",
",",
"swap",
")",
"{",
"var",
"gap",
"=",
"array",
".",
"length",
";",
"var",
"shrinkFactor",
"=",
"1.3",
";",
"var",
"swapped",
";",
"while",
"(",
"gap",
">",
"1",
"||",
"swapped",
")",
"{",
"if",
... | Sorts an array using comb sort.
@param {Array} array The array to sort.
@param {function} compare The compare function.
@param {function} swap A function to call when the swap operation is
performed. This can be used to listen in on internals of the algorithm.
@returns The sorted array. | [
"Sorts",
"an",
"array",
"using",
"comb",
"sort",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/comb-sort.js#L21-L42 |
41,452 | gwtw/js-sorting | lib/odd-even-sort.js | innerSort | function innerSort(array, i, compare, swap) {
var sorted = true;
for (; i < array.length - 1; i += 2) {
if (compare(array, i, i + 1) > 0) {
swap(array, i, i + 1);
sorted = false;
}
}
return sorted;
} | javascript | function innerSort(array, i, compare, swap) {
var sorted = true;
for (; i < array.length - 1; i += 2) {
if (compare(array, i, i + 1) > 0) {
swap(array, i, i + 1);
sorted = false;
}
}
return sorted;
} | [
"function",
"innerSort",
"(",
"array",
",",
"i",
",",
"compare",
",",
"swap",
")",
"{",
"var",
"sorted",
"=",
"true",
";",
"for",
"(",
";",
"i",
"<",
"array",
".",
"length",
"-",
"1",
";",
"i",
"+=",
"2",
")",
"{",
"if",
"(",
"compare",
"(",
... | Compares every second element of an array with its following element and
swaps it if not in order using a compare function.
@param {Array} array The array to sort.
@param {number} i The index to start at, should be either 0 or 1.
@param {function} compare The compare function.
@param {function} swap A function to call ... | [
"Compares",
"every",
"second",
"element",
"of",
"an",
"array",
"with",
"its",
"following",
"element",
"and",
"swaps",
"it",
"if",
"not",
"in",
"order",
"using",
"a",
"compare",
"function",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/odd-even-sort.js#L23-L32 |
41,453 | gwtw/js-sorting | lib/odd-even-sort.js | sort | function sort(array, compare, swap) {
var sorted = false;
while (!sorted) {
sorted = innerSort(array, 1, compare, swap);
sorted = innerSort(array, 0, compare, swap) && sorted;
}
return array;
} | javascript | function sort(array, compare, swap) {
var sorted = false;
while (!sorted) {
sorted = innerSort(array, 1, compare, swap);
sorted = innerSort(array, 0, compare, swap) && sorted;
}
return array;
} | [
"function",
"sort",
"(",
"array",
",",
"compare",
",",
"swap",
")",
"{",
"var",
"sorted",
"=",
"false",
";",
"while",
"(",
"!",
"sorted",
")",
"{",
"sorted",
"=",
"innerSort",
"(",
"array",
",",
"1",
",",
"compare",
",",
"swap",
")",
";",
"sorted",... | Sorts an array using odd even sort.
@param {Array} array The array to sort.
@param {function} compare The compare function.
@param {function} swap A function to call when the swap operation is
performed. This can be used to listen in on internals of the algorithm.
@returns The sorted array. | [
"Sorts",
"an",
"array",
"using",
"odd",
"even",
"sort",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/odd-even-sort.js#L42-L49 |
41,454 | themouette/selenium-grid | src/driver/utils.js | errorToExceptionCallback | function errorToExceptionCallback(cb) {
var browser = this;
return function errorWrapped(err) {
if (err) throw err;
if (cb) {
cb.apply(browser, _.tail(arguments));
}
};
} | javascript | function errorToExceptionCallback(cb) {
var browser = this;
return function errorWrapped(err) {
if (err) throw err;
if (cb) {
cb.apply(browser, _.tail(arguments));
}
};
} | [
"function",
"errorToExceptionCallback",
"(",
"cb",
")",
"{",
"var",
"browser",
"=",
"this",
";",
"return",
"function",
"errorWrapped",
"(",
"err",
")",
"{",
"if",
"(",
"err",
")",
"throw",
"err",
";",
"if",
"(",
"cb",
")",
"{",
"cb",
".",
"apply",
"(... | any error is thrown as an exception. remaining arguments are given to callback. | [
"any",
"error",
"is",
"thrown",
"as",
"an",
"exception",
".",
"remaining",
"arguments",
"are",
"given",
"to",
"callback",
"."
] | b1971890ff0c6ee27869df0c6e8b384687492bb6 | https://github.com/themouette/selenium-grid/blob/b1971890ff0c6ee27869df0c6e8b384687492bb6/src/driver/utils.js#L66-L75 |
41,455 | themouette/selenium-grid | src/driver/utils.js | exposeThenNative | function exposeThenNative(Browser, command) {
var exposed = ['then', ucfirst(command)].join('');
Browser.prototype[exposed] = function () {
var args = arguments;
ensureDriverCommand.call(this, command, 'exposeThenNative');
this.then(function (next) {
args = wrapArguments.ca... | javascript | function exposeThenNative(Browser, command) {
var exposed = ['then', ucfirst(command)].join('');
Browser.prototype[exposed] = function () {
var args = arguments;
ensureDriverCommand.call(this, command, 'exposeThenNative');
this.then(function (next) {
args = wrapArguments.ca... | [
"function",
"exposeThenNative",
"(",
"Browser",
",",
"command",
")",
"{",
"var",
"exposed",
"=",
"[",
"'then'",
",",
"ucfirst",
"(",
"command",
")",
"]",
".",
"join",
"(",
"''",
")",
";",
"Browser",
".",
"prototype",
"[",
"exposed",
"]",
"=",
"function... | expose a native command to promise api. if a callback is given, next is not called automaticly. | [
"expose",
"a",
"native",
"command",
"to",
"promise",
"api",
".",
"if",
"a",
"callback",
"is",
"given",
"next",
"is",
"not",
"called",
"automaticly",
"."
] | b1971890ff0c6ee27869df0c6e8b384687492bb6 | https://github.com/themouette/selenium-grid/blob/b1971890ff0c6ee27869df0c6e8b384687492bb6/src/driver/utils.js#L132-L146 |
41,456 | gwtw/js-sorting | lib/radix-sort.js | countingSortByDigit | function countingSortByDigit(array, radix, exponent, minValue) {
var i;
var bucketIndex;
var buckets = new Array(radix);
var output = new Array(array.length);
// Initialize bucket
for (i = 0; i < radix; i++) {
buckets[i] = 0;
}
// Count frequencies
for (i = 0; i < array.length; i++) {
bucket... | javascript | function countingSortByDigit(array, radix, exponent, minValue) {
var i;
var bucketIndex;
var buckets = new Array(radix);
var output = new Array(array.length);
// Initialize bucket
for (i = 0; i < radix; i++) {
buckets[i] = 0;
}
// Count frequencies
for (i = 0; i < array.length; i++) {
bucket... | [
"function",
"countingSortByDigit",
"(",
"array",
",",
"radix",
",",
"exponent",
",",
"minValue",
")",
"{",
"var",
"i",
";",
"var",
"bucketIndex",
";",
"var",
"buckets",
"=",
"new",
"Array",
"(",
"radix",
")",
";",
"var",
"output",
"=",
"new",
"Array",
... | Stable sorts an array by a particular digit using counting sort.
@param {Array} array The array to sort.
@param {number} radix The base/radix to use to sort.
@param {number} exponent The exponent of the significant digit to sort.
@param {number} minValue The minimum value within the array.
@returns The sorted array. | [
"Stable",
"sorts",
"an",
"array",
"by",
"a",
"particular",
"digit",
"using",
"counting",
"sort",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/radix-sort.js#L15-L49 |
41,457 | gwtw/js-sorting | lib/radix-sort.js | sort | function sort(array, radix) {
if (array.length === 0) {
return array;
}
radix = radix || 10;
// Determine minimum and maximum values
var minValue = array[0];
var maxValue = array[0];
for (var i = 1; i < array.length; i++) {
if (array[i] < minValue) {
minValue = array[i];
} else if (arr... | javascript | function sort(array, radix) {
if (array.length === 0) {
return array;
}
radix = radix || 10;
// Determine minimum and maximum values
var minValue = array[0];
var maxValue = array[0];
for (var i = 1; i < array.length; i++) {
if (array[i] < minValue) {
minValue = array[i];
} else if (arr... | [
"function",
"sort",
"(",
"array",
",",
"radix",
")",
"{",
"if",
"(",
"array",
".",
"length",
"===",
"0",
")",
"{",
"return",
"array",
";",
"}",
"radix",
"=",
"radix",
"||",
"10",
";",
"// Determine minimum and maximum values",
"var",
"minValue",
"=",
"ar... | Sorts an array using radix sort.
@param {Array} array The array to sort.
@param {number} [radix=10] The base/radix to use.
@returns The sorted array. | [
"Sorts",
"an",
"array",
"using",
"radix",
"sort",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/radix-sort.js#L57-L85 |
41,458 | gwtw/js-sorting | lib/quicksort.js | partitionRandom | function partitionRandom(array, left, right, compare, swap) {
var pivot = left + Math.floor(Math.random() * (right - left));
if (pivot !== right) {
swap(array, right, pivot);
}
return partitionRight(array, left, right, compare, swap);
} | javascript | function partitionRandom(array, left, right, compare, swap) {
var pivot = left + Math.floor(Math.random() * (right - left));
if (pivot !== right) {
swap(array, right, pivot);
}
return partitionRight(array, left, right, compare, swap);
} | [
"function",
"partitionRandom",
"(",
"array",
",",
"left",
",",
"right",
",",
"compare",
",",
"swap",
")",
"{",
"var",
"pivot",
"=",
"left",
"+",
"Math",
".",
"floor",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"right",
"-",
"left",
")",
")",
... | Partition the array by selecting a random pivot and moving all elements less
than the pivot to a lesser index and all elements greater than the pivot to a
greater index.
@param {Array} array The array to sort.
@param {number} left The index to sort from.
@param {number} right The index to sort to.
@param {function} com... | [
"Partition",
"the",
"array",
"by",
"selecting",
"a",
"random",
"pivot",
"and",
"moving",
"all",
"elements",
"less",
"than",
"the",
"pivot",
"to",
"a",
"lesser",
"index",
"and",
"all",
"elements",
"greater",
"than",
"the",
"pivot",
"to",
"a",
"greater",
"in... | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/quicksort.js#L44-L50 |
41,459 | gwtw/js-sorting | lib/quicksort.js | partitionRight | function partitionRight(array, left, right, compare, swap) {
var mid = left;
for (var i = mid; i < right; i++) {
if (compare(array, i, right) <= 0) {
if (i !== mid) {
swap(array, i, mid);
}
mid++;
}
}
if (right !== mid) {
swap(array, right, mid);
}
return mid;
} | javascript | function partitionRight(array, left, right, compare, swap) {
var mid = left;
for (var i = mid; i < right; i++) {
if (compare(array, i, right) <= 0) {
if (i !== mid) {
swap(array, i, mid);
}
mid++;
}
}
if (right !== mid) {
swap(array, right, mid);
}
return mid;
} | [
"function",
"partitionRight",
"(",
"array",
",",
"left",
",",
"right",
",",
"compare",
",",
"swap",
")",
"{",
"var",
"mid",
"=",
"left",
";",
"for",
"(",
"var",
"i",
"=",
"mid",
";",
"i",
"<",
"right",
";",
"i",
"++",
")",
"{",
"if",
"(",
"comp... | Partition the array using the right most element as the pivot by moving all
elements less than the pivot to a lesser index and all elements greater than
the pivot to a greater index.
@param {Array} array The array to sort.
@param {number} left The index to sort from.
@param {number} right The index to sort to.
@param {... | [
"Partition",
"the",
"array",
"using",
"the",
"right",
"most",
"element",
"as",
"the",
"pivot",
"by",
"moving",
"all",
"elements",
"less",
"than",
"the",
"pivot",
"to",
"a",
"lesser",
"index",
"and",
"all",
"elements",
"greater",
"than",
"the",
"pivot",
"to... | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/quicksort.js#L64-L80 |
41,460 | davedoesdev/simple-crypt | dist/simple-crypt-deps.js | function(word,iteration)
{
/* rotate the 32-bit word 8 bits to the left */
word = this.rotate(word);
/* apply S-Box substitution on all 4 parts of the 32-bit word */
for (var i = 0; i < 4; ++i)
word[i] = this.sbox[word[i]];
/* XOR the output of the rcon operation with i to the first part (le... | javascript | function(word,iteration)
{
/* rotate the 32-bit word 8 bits to the left */
word = this.rotate(word);
/* apply S-Box substitution on all 4 parts of the 32-bit word */
for (var i = 0; i < 4; ++i)
word[i] = this.sbox[word[i]];
/* XOR the output of the rcon operation with i to the first part (le... | [
"function",
"(",
"word",
",",
"iteration",
")",
"{",
"/* rotate the 32-bit word 8 bits to the left */",
"word",
"=",
"this",
".",
"rotate",
"(",
"word",
")",
";",
"/* apply S-Box substitution on all 4 parts of the 32-bit word */",
"for",
"(",
"var",
"i",
"=",
"0",
";"... | Key Schedule Core | [
"Key",
"Schedule",
"Core"
] | 406225a854239db7d4cccc82b1e482388a48b758 | https://github.com/davedoesdev/simple-crypt/blob/406225a854239db7d4cccc82b1e482388a48b758/dist/simple-crypt-deps.js#L249-L259 | |
41,461 | davedoesdev/simple-crypt | dist/simple-crypt-deps.js | function(expandedKey,roundKeyPointer)
{
var roundKey = [];
for (var i = 0; i < 4; i++)
for (var j = 0; j < 4; j++)
roundKey[j*4+i] = expandedKey[roundKeyPointer + i*4 + j];
return roundKey;
} | javascript | function(expandedKey,roundKeyPointer)
{
var roundKey = [];
for (var i = 0; i < 4; i++)
for (var j = 0; j < 4; j++)
roundKey[j*4+i] = expandedKey[roundKeyPointer + i*4 + j];
return roundKey;
} | [
"function",
"(",
"expandedKey",
",",
"roundKeyPointer",
")",
"{",
"var",
"roundKey",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"for",
"(",
"var",
"j",
"=",
"0",
";",
"j",
"<",
"4",
";",
"... | Creates a round key from the given expanded key and the position within the expanded key. | [
"Creates",
"a",
"round",
"key",
"from",
"the",
"given",
"expanded",
"key",
"and",
"the",
"position",
"within",
"the",
"expanded",
"key",
"."
] | 406225a854239db7d4cccc82b1e482388a48b758 | https://github.com/davedoesdev/simple-crypt/blob/406225a854239db7d4cccc82b1e482388a48b758/dist/simple-crypt-deps.js#L323-L330 | |
41,462 | davedoesdev/simple-crypt | dist/simple-crypt-deps.js | function(a,b)
{
var p = 0;
for(var counter = 0; counter < 8; counter++)
{
if((b & 1) == 1)
p ^= a;
if(p > 0x100) p ^= 0x100;
var hi_bit_set = (a & 0x80); //keep p 8 bit
a <<= 1;
if(a > 0x100) a ^= 0x100; //keep a 8 bit
if(hi_bit_set == 0x80)
a ^= 0x1b;
if(a ... | javascript | function(a,b)
{
var p = 0;
for(var counter = 0; counter < 8; counter++)
{
if((b & 1) == 1)
p ^= a;
if(p > 0x100) p ^= 0x100;
var hi_bit_set = (a & 0x80); //keep p 8 bit
a <<= 1;
if(a > 0x100) a ^= 0x100; //keep a 8 bit
if(hi_bit_set == 0x80)
a ^= 0x1b;
if(a ... | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"var",
"p",
"=",
"0",
";",
"for",
"(",
"var",
"counter",
"=",
"0",
";",
"counter",
"<",
"8",
";",
"counter",
"++",
")",
"{",
"if",
"(",
"(",
"b",
"&",
"1",
")",
"==",
"1",
")",
"p",
"^=",
"a",
"... | galois multiplication of 8 bit characters a and b | [
"galois",
"multiplication",
"of",
"8",
"bit",
"characters",
"a",
"and",
"b"
] | 406225a854239db7d4cccc82b1e482388a48b758 | https://github.com/davedoesdev/simple-crypt/blob/406225a854239db7d4cccc82b1e482388a48b758/dist/simple-crypt-deps.js#L374-L392 | |
41,463 | davedoesdev/simple-crypt | dist/simple-crypt-deps.js | function(state,isInv)
{
var column = [];
/* iterate over the 4 columns */
for (var i = 0; i < 4; i++)
{
/* construct one column by iterating over the 4 rows */
for (var j = 0; j < 4; j++)
column[j] = state[(j*4)+i];
/* apply the mixColumn on one column */
column = this.mixCo... | javascript | function(state,isInv)
{
var column = [];
/* iterate over the 4 columns */
for (var i = 0; i < 4; i++)
{
/* construct one column by iterating over the 4 rows */
for (var j = 0; j < 4; j++)
column[j] = state[(j*4)+i];
/* apply the mixColumn on one column */
column = this.mixCo... | [
"function",
"(",
"state",
",",
"isInv",
")",
"{",
"var",
"column",
"=",
"[",
"]",
";",
"/* iterate over the 4 columns */",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"/* construct one column by iterating over the 4 rows *... | galois multipication of the 4x4 matrix | [
"galois",
"multipication",
"of",
"the",
"4x4",
"matrix"
] | 406225a854239db7d4cccc82b1e482388a48b758 | https://github.com/davedoesdev/simple-crypt/blob/406225a854239db7d4cccc82b1e482388a48b758/dist/simple-crypt-deps.js#L395-L411 | |
41,464 | davedoesdev/simple-crypt | dist/simple-crypt-deps.js | function(column,isInv)
{
var mult = [];
if(isInv)
mult = [14,9,13,11];
else
mult = [2,1,1,3];
var cpy = [];
for(var i = 0; i < 4; i++)
cpy[i] = column[i];
column[0] = this.galois_multiplication(cpy[0],mult[0]) ^
this.galois_multiplication(cpy[3],mult[1]) ^
th... | javascript | function(column,isInv)
{
var mult = [];
if(isInv)
mult = [14,9,13,11];
else
mult = [2,1,1,3];
var cpy = [];
for(var i = 0; i < 4; i++)
cpy[i] = column[i];
column[0] = this.galois_multiplication(cpy[0],mult[0]) ^
this.galois_multiplication(cpy[3],mult[1]) ^
th... | [
"function",
"(",
"column",
",",
"isInv",
")",
"{",
"var",
"mult",
"=",
"[",
"]",
";",
"if",
"(",
"isInv",
")",
"mult",
"=",
"[",
"14",
",",
"9",
",",
"13",
",",
"11",
"]",
";",
"else",
"mult",
"=",
"[",
"2",
",",
"1",
",",
"1",
",",
"3",
... | galois multipication of 1 column of the 4x4 matrix | [
"galois",
"multipication",
"of",
"1",
"column",
"of",
"the",
"4x4",
"matrix"
] | 406225a854239db7d4cccc82b1e482388a48b758 | https://github.com/davedoesdev/simple-crypt/blob/406225a854239db7d4cccc82b1e482388a48b758/dist/simple-crypt-deps.js#L414-L442 | |
41,465 | davedoesdev/simple-crypt | dist/simple-crypt-deps.js | function(state, roundKey)
{
state = this.subBytes(state,false);
state = this.shiftRows(state,false);
state = this.mixColumns(state,false);
state = this.addRoundKey(state, roundKey);
return state;
} | javascript | function(state, roundKey)
{
state = this.subBytes(state,false);
state = this.shiftRows(state,false);
state = this.mixColumns(state,false);
state = this.addRoundKey(state, roundKey);
return state;
} | [
"function",
"(",
"state",
",",
"roundKey",
")",
"{",
"state",
"=",
"this",
".",
"subBytes",
"(",
"state",
",",
"false",
")",
";",
"state",
"=",
"this",
".",
"shiftRows",
"(",
"state",
",",
"false",
")",
";",
"state",
"=",
"this",
".",
"mixColumns",
... | applies the 4 operations of the forward round in sequence | [
"applies",
"the",
"4",
"operations",
"of",
"the",
"forward",
"round",
"in",
"sequence"
] | 406225a854239db7d4cccc82b1e482388a48b758 | https://github.com/davedoesdev/simple-crypt/blob/406225a854239db7d4cccc82b1e482388a48b758/dist/simple-crypt-deps.js#L445-L452 | |
41,466 | davedoesdev/simple-crypt | dist/simple-crypt-deps.js | function(state,roundKey)
{
state = this.shiftRows(state,true);
state = this.subBytes(state,true);
state = this.addRoundKey(state, roundKey);
state = this.mixColumns(state,true);
return state;
} | javascript | function(state,roundKey)
{
state = this.shiftRows(state,true);
state = this.subBytes(state,true);
state = this.addRoundKey(state, roundKey);
state = this.mixColumns(state,true);
return state;
} | [
"function",
"(",
"state",
",",
"roundKey",
")",
"{",
"state",
"=",
"this",
".",
"shiftRows",
"(",
"state",
",",
"true",
")",
";",
"state",
"=",
"this",
".",
"subBytes",
"(",
"state",
",",
"true",
")",
";",
"state",
"=",
"this",
".",
"addRoundKey",
... | applies the 4 operations of the inverse round in sequence | [
"applies",
"the",
"4",
"operations",
"of",
"the",
"inverse",
"round",
"in",
"sequence"
] | 406225a854239db7d4cccc82b1e482388a48b758 | https://github.com/davedoesdev/simple-crypt/blob/406225a854239db7d4cccc82b1e482388a48b758/dist/simple-crypt-deps.js#L455-L462 | |
41,467 | davedoesdev/simple-crypt | dist/simple-crypt-deps.js | function(input,key,size)
{
var output = [];
var block = []; /* the 128 bit block to encode */
var nbrRounds = this.numberOfRounds(size);
/* Set the block values, for the block:
* a0,0 a0,1 a0,2 a0,3
* a1,0 a1,1 a1,2 a1,3
* a2,0 a2,1 a2,2 a2,3
* a3,0 a3,1 a3,2 a3,3
* the mappi... | javascript | function(input,key,size)
{
var output = [];
var block = []; /* the 128 bit block to encode */
var nbrRounds = this.numberOfRounds(size);
/* Set the block values, for the block:
* a0,0 a0,1 a0,2 a0,3
* a1,0 a1,1 a1,2 a1,3
* a2,0 a2,1 a2,2 a2,3
* a3,0 a3,1 a3,2 a3,3
* the mappi... | [
"function",
"(",
"input",
",",
"key",
",",
"size",
")",
"{",
"var",
"output",
"=",
"[",
"]",
";",
"var",
"block",
"=",
"[",
"]",
";",
"/* the 128 bit block to encode */",
"var",
"nbrRounds",
"=",
"this",
".",
"numberOfRounds",
"(",
"size",
")",
";",
"/... | encrypts a 128 bit input block against the given key of size specified | [
"encrypts",
"a",
"128",
"bit",
"input",
"block",
"against",
"the",
"given",
"key",
"of",
"size",
"specified"
] | 406225a854239db7d4cccc82b1e482388a48b758 | https://github.com/davedoesdev/simple-crypt/blob/406225a854239db7d4cccc82b1e482388a48b758/dist/simple-crypt-deps.js#L516-L540 | |
41,468 | davedoesdev/simple-crypt | dist/simple-crypt-deps.js | function(s1, s2) {
var n = s1.length;
if (s1.length > s2.length) n = s2.length;
for (var i = 0; i < n; i++) {
if (s1.charCodeAt(i) != s2.charCodeAt(i)) return i;
}
if (s1.length != s2.length) return n;
return -1; // same
} | javascript | function(s1, s2) {
var n = s1.length;
if (s1.length > s2.length) n = s2.length;
for (var i = 0; i < n; i++) {
if (s1.charCodeAt(i) != s2.charCodeAt(i)) return i;
}
if (s1.length != s2.length) return n;
return -1; // same
} | [
"function",
"(",
"s1",
",",
"s2",
")",
"{",
"var",
"n",
"=",
"s1",
".",
"length",
";",
"if",
"(",
"s1",
".",
"length",
">",
"s2",
".",
"length",
")",
"n",
"=",
"s2",
".",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"n"... | find index of string where two string differs
@name strdiffidx
@function
@param {String} s1 string to compare
@param {String} s2 string to compare
@return {Number} string index of where character differs. Return -1 if same.
@since jsrsasign 4.9.0 base64x 1.1.5
@example
strdiffidx("abcdefg", "abcd4fg") -> 4
strdiffidx("... | [
"find",
"index",
"of",
"string",
"where",
"two",
"string",
"differs"
] | 406225a854239db7d4cccc82b1e482388a48b758 | https://github.com/davedoesdev/simple-crypt/blob/406225a854239db7d4cccc82b1e482388a48b758/dist/simple-crypt-deps.js#L6321-L6329 | |
41,469 | davedoesdev/simple-crypt | dist/simple-crypt-deps.js | _rsapem_privateKeyToPkcs1HexString | function _rsapem_privateKeyToPkcs1HexString(rsaKey) {
var result = _rsapem_derEncodeNumber(0);
result += _rsapem_derEncodeNumber(rsaKey.n);
result += _rsapem_derEncodeNumber(rsaKey.e);
result += _rsapem_derEncodeNumber(rsaKey.d);
result += _rsapem_derEncodeNumber(rsaKey.p);
result += _rsapem_der... | javascript | function _rsapem_privateKeyToPkcs1HexString(rsaKey) {
var result = _rsapem_derEncodeNumber(0);
result += _rsapem_derEncodeNumber(rsaKey.n);
result += _rsapem_derEncodeNumber(rsaKey.e);
result += _rsapem_derEncodeNumber(rsaKey.d);
result += _rsapem_derEncodeNumber(rsaKey.p);
result += _rsapem_der... | [
"function",
"_rsapem_privateKeyToPkcs1HexString",
"(",
"rsaKey",
")",
"{",
"var",
"result",
"=",
"_rsapem_derEncodeNumber",
"(",
"0",
")",
";",
"result",
"+=",
"_rsapem_derEncodeNumber",
"(",
"rsaKey",
".",
"n",
")",
";",
"result",
"+=",
"_rsapem_derEncodeNumber",
... | Converts private & public part of given key to ASN1 Hex String. | [
"Converts",
"private",
"&",
"public",
"part",
"of",
"given",
"key",
"to",
"ASN1",
"Hex",
"String",
"."
] | 406225a854239db7d4cccc82b1e482388a48b758 | https://github.com/davedoesdev/simple-crypt/blob/406225a854239db7d4cccc82b1e482388a48b758/dist/simple-crypt-deps.js#L8364-L8377 |
41,470 | davedoesdev/simple-crypt | dist/simple-crypt-deps.js | _rsapem_publicKeyToX509HexString | function _rsapem_publicKeyToX509HexString(rsaKey) {
var encodedIdentifier = "06092A864886F70D010101";
var encodedNull = "0500";
var headerSequence = "300D" + encodedIdentifier + encodedNull;
var keys = _rsapem_derEncodeNumber(rsaKey.n);
keys += _rsapem_derEncodeNumber(rsaKey.e);
var keySequenc... | javascript | function _rsapem_publicKeyToX509HexString(rsaKey) {
var encodedIdentifier = "06092A864886F70D010101";
var encodedNull = "0500";
var headerSequence = "300D" + encodedIdentifier + encodedNull;
var keys = _rsapem_derEncodeNumber(rsaKey.n);
keys += _rsapem_derEncodeNumber(rsaKey.e);
var keySequenc... | [
"function",
"_rsapem_publicKeyToX509HexString",
"(",
"rsaKey",
")",
"{",
"var",
"encodedIdentifier",
"=",
"\"06092A864886F70D010101\"",
";",
"var",
"encodedNull",
"=",
"\"0500\"",
";",
"var",
"headerSequence",
"=",
"\"300D\"",
"+",
"encodedIdentifier",
"+",
"encodedNull... | Converts public part of given key to ASN1 Hex String. | [
"Converts",
"public",
"part",
"of",
"given",
"key",
"to",
"ASN1",
"Hex",
"String",
"."
] | 406225a854239db7d4cccc82b1e482388a48b758 | https://github.com/davedoesdev/simple-crypt/blob/406225a854239db7d4cccc82b1e482388a48b758/dist/simple-crypt-deps.js#L8398-L8412 |
41,471 | gwtw/js-sorting | lib/selection-sort.js | sort | function sort(array, compare, swap) {
for (var i = 0; i < array.length - 1; i++) {
var minIndex = i;
for (var j = i + 1; j < array.length; j++) {
if (compare(array, j, minIndex) < 0) {
minIndex = j;
}
}
if (minIndex !== i) {
swap(array, i, minIndex);
}
}
return arr... | javascript | function sort(array, compare, swap) {
for (var i = 0; i < array.length - 1; i++) {
var minIndex = i;
for (var j = i + 1; j < array.length; j++) {
if (compare(array, j, minIndex) < 0) {
minIndex = j;
}
}
if (minIndex !== i) {
swap(array, i, minIndex);
}
}
return arr... | [
"function",
"sort",
"(",
"array",
",",
"compare",
",",
"swap",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
"-",
"1",
";",
"i",
"++",
")",
"{",
"var",
"minIndex",
"=",
"i",
";",
"for",
"(",
"var",
"j",
... | Sorts an array using selection sort.
@param {Array} array The array to sort.
@param {function} compare The compare function.
@param {function} swap A function to call when the swap operation is
performed. This can be used to listen in on internals of the algorithm.
@returns The sorted array. | [
"Sorts",
"an",
"array",
"using",
"selection",
"sort",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/selection-sort.js#L21-L37 |
41,472 | MrPeak/flatten-tree | index.js | function(tree, options) {
let list = [];
const stack = [];
console.log(tree);
const _tree = _.cloneDeep(tree);
const settings = {
initNode: options.initNode || (node => node),
itemsKey: options.itemsKey || 'children',
idKey: options.idKey || 'id',
uniqueIdStart: options.uniqueIdStart || 1,
... | javascript | function(tree, options) {
let list = [];
const stack = [];
console.log(tree);
const _tree = _.cloneDeep(tree);
const settings = {
initNode: options.initNode || (node => node),
itemsKey: options.itemsKey || 'children',
idKey: options.idKey || 'id',
uniqueIdStart: options.uniqueIdStart || 1,
... | [
"function",
"(",
"tree",
",",
"options",
")",
"{",
"let",
"list",
"=",
"[",
"]",
";",
"const",
"stack",
"=",
"[",
"]",
";",
"console",
".",
"log",
"(",
"tree",
")",
";",
"const",
"_tree",
"=",
"_",
".",
"cloneDeep",
"(",
"tree",
")",
";",
"cons... | Flatten Object tree
@param {Array|Object} tree - Object tree
@param {Object} options - Config options
@param {Function=} [options.initNode=(node=>node)] - Initialize node
@param {String=} [options.itemsKey='children'] - Specifies item's children itemsKey
@param {String=} [options.idKey='id'] - Specifies item's idKey
@... | [
"Flatten",
"Object",
"tree"
] | 61f1fdf542334f597a055c9a59d8862404660cd1 | https://github.com/MrPeak/flatten-tree/blob/61f1fdf542334f597a055c9a59d8862404660cd1/index.js#L60-L97 | |
41,473 | dwieeb/node-jsondir | src/File.js | function(options) {
options = options || {};
this.path = PATH.resolve(PATH.normalize(options.path));
this.exists = FS.existsSync(this.path);
this.umask = 'umask' in options ? options.umask : File.UMASK;
if (this.exists) {
this.stats = this.getStats();
this.type = this.getType();
this.mode = this... | javascript | function(options) {
options = options || {};
this.path = PATH.resolve(PATH.normalize(options.path));
this.exists = FS.existsSync(this.path);
this.umask = 'umask' in options ? options.umask : File.UMASK;
if (this.exists) {
this.stats = this.getStats();
this.type = this.getType();
this.mode = this... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"path",
"=",
"PATH",
".",
"resolve",
"(",
"PATH",
".",
"normalize",
"(",
"options",
".",
"path",
")",
")",
";",
"this",
".",
"exists",
"=",
"FS",
"... | A File represents any regular, directory, or symlink file.
@param {object} options | [
"A",
"File",
"represents",
"any",
"regular",
"directory",
"or",
"symlink",
"file",
"."
] | 40894504be170a74759de804e559dc0c589574eb | https://github.com/dwieeb/node-jsondir/blob/40894504be170a74759de804e559dc0c589574eb/src/File.js#L26-L78 | |
41,474 | gwtw/js-sorting | lib/merge-sort.js | sort | function sort(array, compare) {
if (array.length <= 1) {
return array;
}
var i;
var middle = Math.floor(array.length / 2);
var left = new Array(middle);
var right = new Array(array.length - middle);
for (i = 0; i < left.length; i++) {
left[i] = array[i];
}
for (i = 0; i < right.length; i++) ... | javascript | function sort(array, compare) {
if (array.length <= 1) {
return array;
}
var i;
var middle = Math.floor(array.length / 2);
var left = new Array(middle);
var right = new Array(array.length - middle);
for (i = 0; i < left.length; i++) {
left[i] = array[i];
}
for (i = 0; i < right.length; i++) ... | [
"function",
"sort",
"(",
"array",
",",
"compare",
")",
"{",
"if",
"(",
"array",
".",
"length",
"<=",
"1",
")",
"{",
"return",
"array",
";",
"}",
"var",
"i",
";",
"var",
"middle",
"=",
"Math",
".",
"floor",
"(",
"array",
".",
"length",
"/",
"2",
... | Sorts an array using top down merge sort.
@param {Array} array The array to sort.
@param {function} compare The compare function.
@returns The sorted array. | [
"Sorts",
"an",
"array",
"using",
"top",
"down",
"merge",
"sort",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/merge-sort.js#L15-L33 |
41,475 | gwtw/js-sorting | lib/merge-sort.js | merge | function merge(left, right, compare) {
var result = [];
var leftIndex = 0;
var rightIndex = 0;
while (leftIndex < left.length || rightIndex < right.length) {
if (leftIndex < left.length && rightIndex < right.length) {
if (compare(left[leftIndex], right[rightIndex]) <= 0) {
result.push(left[le... | javascript | function merge(left, right, compare) {
var result = [];
var leftIndex = 0;
var rightIndex = 0;
while (leftIndex < left.length || rightIndex < right.length) {
if (leftIndex < left.length && rightIndex < right.length) {
if (compare(left[leftIndex], right[rightIndex]) <= 0) {
result.push(left[le... | [
"function",
"merge",
"(",
"left",
",",
"right",
",",
"compare",
")",
"{",
"var",
"result",
"=",
"[",
"]",
";",
"var",
"leftIndex",
"=",
"0",
";",
"var",
"rightIndex",
"=",
"0",
";",
"while",
"(",
"leftIndex",
"<",
"left",
".",
"length",
"||",
"righ... | Merges two arrays in to a new array.
@param {Array} left The first array.
@param {Array} left The second array.
@param {function} compare The compare function.
@return The merged array. | [
"Merges",
"two",
"arrays",
"in",
"to",
"a",
"new",
"array",
"."
] | 158286752539a4ec3bfc7c0f578372953357d4ed | https://github.com/gwtw/js-sorting/blob/158286752539a4ec3bfc7c0f578372953357d4ed/lib/merge-sort.js#L42-L61 |
41,476 | themouette/selenium-grid | src/driver/selector.js | exposeThenSelector | function exposeThenSelector(Browser, command, exposed) {
if (_.isNumber(exposed)) {
exposed = command;
}
exposed = ['then', ucfirst(exposed)].join('');
Browser.prototype[exposed] = function () {
var args = arguments;
ensureDriverCommand.call(this, command, 'exposeThenSelector');... | javascript | function exposeThenSelector(Browser, command, exposed) {
if (_.isNumber(exposed)) {
exposed = command;
}
exposed = ['then', ucfirst(exposed)].join('');
Browser.prototype[exposed] = function () {
var args = arguments;
ensureDriverCommand.call(this, command, 'exposeThenSelector');... | [
"function",
"exposeThenSelector",
"(",
"Browser",
",",
"command",
",",
"exposed",
")",
"{",
"if",
"(",
"_",
".",
"isNumber",
"(",
"exposed",
")",
")",
"{",
"exposed",
"=",
"command",
";",
"}",
"exposed",
"=",
"[",
"'then'",
",",
"ucfirst",
"(",
"expose... | expose a native selector command to promise api. if a callback is given, next is not called automaticly. | [
"expose",
"a",
"native",
"selector",
"command",
"to",
"promise",
"api",
".",
"if",
"a",
"callback",
"is",
"given",
"next",
"is",
"not",
"called",
"automaticly",
"."
] | b1971890ff0c6ee27869df0c6e8b384687492bb6 | https://github.com/themouette/selenium-grid/blob/b1971890ff0c6ee27869df0c6e8b384687492bb6/src/driver/selector.js#L109-L127 |
41,477 | themouette/selenium-grid | src/driver/selector.js | _fillInputText | function _fillInputText(element, value, next) {
var onFilled = chainAndErrorCallback.call(this, null, next);
var onClear = chainAndErrorCallback.call(this, function () {
element.type(value || '', onFilled);
}, onFilled);
element.clear(onClear);
} | javascript | function _fillInputText(element, value, next) {
var onFilled = chainAndErrorCallback.call(this, null, next);
var onClear = chainAndErrorCallback.call(this, function () {
element.type(value || '', onFilled);
}, onFilled);
element.clear(onClear);
} | [
"function",
"_fillInputText",
"(",
"element",
",",
"value",
",",
"next",
")",
"{",
"var",
"onFilled",
"=",
"chainAndErrorCallback",
".",
"call",
"(",
"this",
",",
"null",
",",
"next",
")",
";",
"var",
"onClear",
"=",
"chainAndErrorCallback",
".",
"call",
"... | fill an input text or a textarea | [
"fill",
"an",
"input",
"text",
"or",
"a",
"textarea"
] | b1971890ff0c6ee27869df0c6e8b384687492bb6 | https://github.com/themouette/selenium-grid/blob/b1971890ff0c6ee27869df0c6e8b384687492bb6/src/driver/selector.js#L305-L312 |
41,478 | themouette/selenium-grid | src/driver/selector.js | _fillInputFile | function _fillInputFile(element, value, next) {
var onUploadDone = function (localPath) {
element.type(localPath, next);
};
this.uploadFile(value, onUploadDone);
} | javascript | function _fillInputFile(element, value, next) {
var onUploadDone = function (localPath) {
element.type(localPath, next);
};
this.uploadFile(value, onUploadDone);
} | [
"function",
"_fillInputFile",
"(",
"element",
",",
"value",
",",
"next",
")",
"{",
"var",
"onUploadDone",
"=",
"function",
"(",
"localPath",
")",
"{",
"element",
".",
"type",
"(",
"localPath",
",",
"next",
")",
";",
"}",
";",
"this",
".",
"uploadFile",
... | upload a file to selenium slave and fill the input with reference. | [
"upload",
"a",
"file",
"to",
"selenium",
"slave",
"and",
"fill",
"the",
"input",
"with",
"reference",
"."
] | b1971890ff0c6ee27869df0c6e8b384687492bb6 | https://github.com/themouette/selenium-grid/blob/b1971890ff0c6ee27869df0c6e8b384687492bb6/src/driver/selector.js#L314-L319 |
41,479 | themouette/selenium-grid | src/driver/selector.js | _fillInputCheckbox | function _fillInputCheckbox(element, value, next) {
var onIsSelected = chainAndErrorCallback.call(this, function (selected, next) {
//ensure boolean
value = !!value;
if (value === selected) {
// nothing to do
return next();
}
... | javascript | function _fillInputCheckbox(element, value, next) {
var onIsSelected = chainAndErrorCallback.call(this, function (selected, next) {
//ensure boolean
value = !!value;
if (value === selected) {
// nothing to do
return next();
}
... | [
"function",
"_fillInputCheckbox",
"(",
"element",
",",
"value",
",",
"next",
")",
"{",
"var",
"onIsSelected",
"=",
"chainAndErrorCallback",
".",
"call",
"(",
"this",
",",
"function",
"(",
"selected",
",",
"next",
")",
"{",
"//ensure boolean",
"value",
"=",
"... | check or uncheck given checkbox | [
"check",
"or",
"uncheck",
"given",
"checkbox"
] | b1971890ff0c6ee27869df0c6e8b384687492bb6 | https://github.com/themouette/selenium-grid/blob/b1971890ff0c6ee27869df0c6e8b384687492bb6/src/driver/selector.js#L321-L332 |
41,480 | themouette/selenium-grid | src/driver/selector.js | _fillInputRadio | function _fillInputRadio(name, value, next) {
this.element({
value: "//input[@name='"+escapeString(name, "'")+"' and @value='"+escapeString(value, "'")+"']",
strategy: "xpath"
}, function (el) {
el.click(next);
});
} | javascript | function _fillInputRadio(name, value, next) {
this.element({
value: "//input[@name='"+escapeString(name, "'")+"' and @value='"+escapeString(value, "'")+"']",
strategy: "xpath"
}, function (el) {
el.click(next);
});
} | [
"function",
"_fillInputRadio",
"(",
"name",
",",
"value",
",",
"next",
")",
"{",
"this",
".",
"element",
"(",
"{",
"value",
":",
"\"//input[@name='\"",
"+",
"escapeString",
"(",
"name",
",",
"\"'\"",
")",
"+",
"\"' and @value='\"",
"+",
"escapeString",
"(",
... | retrieve the radio button qith value and click on it | [
"retrieve",
"the",
"radio",
"button",
"qith",
"value",
"and",
"click",
"on",
"it"
] | b1971890ff0c6ee27869df0c6e8b384687492bb6 | https://github.com/themouette/selenium-grid/blob/b1971890ff0c6ee27869df0c6e8b384687492bb6/src/driver/selector.js#L334-L341 |
41,481 | themouette/selenium-grid | src/driver/selector.js | _fillSelect | function _fillSelect(element, value, next) {
var clickOnOption = chainAndErrorCallback.call(this, function (el, next) {
el.click(next);
}, next);
element.elementByXPath("//option[@value='"+escapeString(value, "'")+"']", clickOnOption);
} | javascript | function _fillSelect(element, value, next) {
var clickOnOption = chainAndErrorCallback.call(this, function (el, next) {
el.click(next);
}, next);
element.elementByXPath("//option[@value='"+escapeString(value, "'")+"']", clickOnOption);
} | [
"function",
"_fillSelect",
"(",
"element",
",",
"value",
",",
"next",
")",
"{",
"var",
"clickOnOption",
"=",
"chainAndErrorCallback",
".",
"call",
"(",
"this",
",",
"function",
"(",
"el",
",",
"next",
")",
"{",
"el",
".",
"click",
"(",
"next",
")",
";"... | open select and select element | [
"open",
"select",
"and",
"select",
"element"
] | b1971890ff0c6ee27869df0c6e8b384687492bb6 | https://github.com/themouette/selenium-grid/blob/b1971890ff0c6ee27869df0c6e8b384687492bb6/src/driver/selector.js#L343-L348 |
41,482 | sitegui/ejs-html | lib/custom.js | appendJSValue | function appendJSValue(token) {
builder.add('(')
if (options.compileDebug) {
builder.add(`${compile._getDebugMarker(token)},`)
}
builder.addToken(token)
builder.add(')')
} | javascript | function appendJSValue(token) {
builder.add('(')
if (options.compileDebug) {
builder.add(`${compile._getDebugMarker(token)},`)
}
builder.addToken(token)
builder.add(')')
} | [
"function",
"appendJSValue",
"(",
"token",
")",
"{",
"builder",
".",
"add",
"(",
"'('",
")",
"if",
"(",
"options",
".",
"compileDebug",
")",
"{",
"builder",
".",
"add",
"(",
"`",
"${",
"compile",
".",
"_getDebugMarker",
"(",
"token",
")",
"}",
"`",
"... | Append ejs expression, with position update
@param {Token} token - ejs-escaped token | [
"Append",
"ejs",
"expression",
"with",
"position",
"update"
] | cfad09dd07d4b121da130327c8221222db5f6cb4 | https://github.com/sitegui/ejs-html/blob/cfad09dd07d4b121da130327c8221222db5f6cb4/lib/custom.js#L99-L106 |
41,483 | sitegui/ejs-html | lib/custom.js | prepareContents | function prepareContents(tokens) {
let contents = new Map
for (let i = 0, len = tokens.length; i < len; i++) {
let token = tokens[i]
if (token.type === 'element' && token.name === 'eh-content') {
// Find attribute 'name'
let name = getNameAttributeValue(token),
arr = getArr(name)
for (let j = 0, l... | javascript | function prepareContents(tokens) {
let contents = new Map
for (let i = 0, len = tokens.length; i < len; i++) {
let token = tokens[i]
if (token.type === 'element' && token.name === 'eh-content') {
// Find attribute 'name'
let name = getNameAttributeValue(token),
arr = getArr(name)
for (let j = 0, l... | [
"function",
"prepareContents",
"(",
"tokens",
")",
"{",
"let",
"contents",
"=",
"new",
"Map",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"len",
"=",
"tokens",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"let",
"token",
"=",
"tokens... | Split children tokens by content name
@param {Array<Token>} tokens
@returns {Map<string, Array<Token>>} | [
"Split",
"children",
"tokens",
"by",
"content",
"name"
] | cfad09dd07d4b121da130327c8221222db5f6cb4 | https://github.com/sitegui/ejs-html/blob/cfad09dd07d4b121da130327c8221222db5f6cb4/lib/custom.js#L135-L168 |
41,484 | sitegui/ejs-html | lib/custom.js | getNameAttributeValue | function getNameAttributeValue(element) {
for (let i = 0, len = element.attributes.length; i < len; i++) {
let attribute = element.attributes[i]
if (attribute.name === 'name') {
if (attribute.type !== 'attribute-simple') {
throw new Error(`name attribute for ${element.name} tag must be a literal value`)
... | javascript | function getNameAttributeValue(element) {
for (let i = 0, len = element.attributes.length; i < len; i++) {
let attribute = element.attributes[i]
if (attribute.name === 'name') {
if (attribute.type !== 'attribute-simple') {
throw new Error(`name attribute for ${element.name} tag must be a literal value`)
... | [
"function",
"getNameAttributeValue",
"(",
"element",
")",
"{",
"for",
"(",
"let",
"i",
"=",
"0",
",",
"len",
"=",
"element",
".",
"attributes",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"let",
"attribute",
"=",
"element",
".",
... | Return the value of the `value` attribute
@param {Token} element - must be of type 'element'
@returns {string} | [
"Return",
"the",
"value",
"of",
"the",
"value",
"attribute"
] | cfad09dd07d4b121da130327c8221222db5f6cb4 | https://github.com/sitegui/ejs-html/blob/cfad09dd07d4b121da130327c8221222db5f6cb4/lib/custom.js#L175-L188 |
41,485 | sitegui/ejs-html | lib/compile.js | prepareInternalJSCode | function prepareInternalJSCode(source, options) {
// Parse
let tokens = parse(source)
// Transform
if (options.transformer) {
tokens = options.transformer(tokens) || tokens
}
let reducedTokens = reduce(tokens, options)
return createCode(reducedTokens, options, false)
} | javascript | function prepareInternalJSCode(source, options) {
// Parse
let tokens = parse(source)
// Transform
if (options.transformer) {
tokens = options.transformer(tokens) || tokens
}
let reducedTokens = reduce(tokens, options)
return createCode(reducedTokens, options, false)
} | [
"function",
"prepareInternalJSCode",
"(",
"source",
",",
"options",
")",
"{",
"// Parse",
"let",
"tokens",
"=",
"parse",
"(",
"source",
")",
"// Transform",
"if",
"(",
"options",
".",
"transformer",
")",
"{",
"tokens",
"=",
"options",
".",
"transformer",
"("... | Common logic for `compile` and `compile.standAlone`
@private
@param {string} source
@param {Object} options - already prepared
@returns {SourceBuilder} | [
"Common",
"logic",
"for",
"compile",
"and",
"compile",
".",
"standAlone"
] | cfad09dd07d4b121da130327c8221222db5f6cb4 | https://github.com/sitegui/ejs-html/blob/cfad09dd07d4b121da130327c8221222db5f6cb4/lib/compile.js#L151-L163 |
41,486 | sitegui/ejs-html | lib/compile.js | appendExpression | function appendExpression(prefix, token, suffix, isString) {
if (state === 'very-first') {
if (!isString) {
builder.add('""+')
}
} else if (state === 'first') {
builder.add('__o+=')
} else {
builder.add('+')
}
if (options.compileDebug && token) {
builder.add(`(${getDebugMarker(token)},`)
... | javascript | function appendExpression(prefix, token, suffix, isString) {
if (state === 'very-first') {
if (!isString) {
builder.add('""+')
}
} else if (state === 'first') {
builder.add('__o+=')
} else {
builder.add('+')
}
if (options.compileDebug && token) {
builder.add(`(${getDebugMarker(token)},`)
... | [
"function",
"appendExpression",
"(",
"prefix",
",",
"token",
",",
"suffix",
",",
"isString",
")",
"{",
"if",
"(",
"state",
"===",
"'very-first'",
")",
"{",
"if",
"(",
"!",
"isString",
")",
"{",
"builder",
".",
"add",
"(",
"'\"\"+'",
")",
"}",
"}",
"e... | Append an expression that contributes directly to the output
@param {?string} prefix
@param {?Token|SourceBuilder} token
@param {?string} suffix
@param {boolean} isString - whether this expression certainly evaluates to a string | [
"Append",
"an",
"expression",
"that",
"contributes",
"directly",
"to",
"the",
"output"
] | cfad09dd07d4b121da130327c8221222db5f6cb4 | https://github.com/sitegui/ejs-html/blob/cfad09dd07d4b121da130327c8221222db5f6cb4/lib/compile.js#L256-L288 |
41,487 | ohager/nanoflux | examples/fullflux.js | ActionProvider | function ActionProvider(dispatcher){
this.action1 = function(data){
console.log("Action 1");
// this way, the dispatcher establishes dynamically the action binding.
dispatcher.dispatch('action1', data);
};
this.action2 = function(data){
console.log("Action 2");
... | javascript | function ActionProvider(dispatcher){
this.action1 = function(data){
console.log("Action 1");
// this way, the dispatcher establishes dynamically the action binding.
dispatcher.dispatch('action1', data);
};
this.action2 = function(data){
console.log("Action 2");
... | [
"function",
"ActionProvider",
"(",
"dispatcher",
")",
"{",
"this",
".",
"action1",
"=",
"function",
"(",
"data",
")",
"{",
"console",
".",
"log",
"(",
"\"Action 1\"",
")",
";",
"// this way, the dispatcher establishes dynamically the action binding.\r",
"dispatcher",
... | The full flux concept foresees a separation of actions and dispatcher Here we create an action provider using the more dynamic Dispatcher.dispatch method. | [
"The",
"full",
"flux",
"concept",
"foresees",
"a",
"separation",
"of",
"actions",
"and",
"dispatcher",
"Here",
"we",
"create",
"an",
"action",
"provider",
"using",
"the",
"more",
"dynamic",
"Dispatcher",
".",
"dispatch",
"method",
"."
] | df3840a496867869ddaccf6c0433819d6caaf125 | https://github.com/ohager/nanoflux/blob/df3840a496867869ddaccf6c0433819d6caaf125/examples/fullflux.js#L32-L44 |
41,488 | sitegui/ejs-html | lib/parse.js | readSimpleToken | function readSimpleToken(type, endRegex, trimRight) {
if (trimRight) {
let matchTrim = exec(/\S/g)
if (matchTrim) {
advanceTo(matchTrim.index)
}
}
let match = exec(endRegex)
if (!match) {
throwSyntaxError(`Unterminated ${type}`)
}
let start = getSourcePoint()
advanceTo(match.index)
let t... | javascript | function readSimpleToken(type, endRegex, trimRight) {
if (trimRight) {
let matchTrim = exec(/\S/g)
if (matchTrim) {
advanceTo(matchTrim.index)
}
}
let match = exec(endRegex)
if (!match) {
throwSyntaxError(`Unterminated ${type}`)
}
let start = getSourcePoint()
advanceTo(match.index)
let t... | [
"function",
"readSimpleToken",
"(",
"type",
",",
"endRegex",
",",
"trimRight",
")",
"{",
"if",
"(",
"trimRight",
")",
"{",
"let",
"matchTrim",
"=",
"exec",
"(",
"/",
"\\S",
"/",
"g",
")",
"if",
"(",
"matchTrim",
")",
"{",
"advanceTo",
"(",
"matchTrim",... | Read a single token that has a known end
@param {string} type
@param {RegExp} endRegex
@param {boolean} trimRight - ignore starting empty spaces (\s)
@returns {Token} | [
"Read",
"a",
"single",
"token",
"that",
"has",
"a",
"known",
"end"
] | cfad09dd07d4b121da130327c8221222db5f6cb4 | https://github.com/sitegui/ejs-html/blob/cfad09dd07d4b121da130327c8221222db5f6cb4/lib/parse.js#L174-L190 |
41,489 | sitegui/ejs-html | lib/parse.js | readCloseTag | function readCloseTag() {
let start = getSourcePoint(),
match = tagCloseRegex.exec(source.substr(pos))
if (!match) {
throwSyntaxError('Invalid close tag')
}
advanceTo(pos + match[0].length)
let end = getSourcePoint()
return {
type: 'tag-close',
start,
end,
name: match[1].toLowerCase()
}
... | javascript | function readCloseTag() {
let start = getSourcePoint(),
match = tagCloseRegex.exec(source.substr(pos))
if (!match) {
throwSyntaxError('Invalid close tag')
}
advanceTo(pos + match[0].length)
let end = getSourcePoint()
return {
type: 'tag-close',
start,
end,
name: match[1].toLowerCase()
}
... | [
"function",
"readCloseTag",
"(",
")",
"{",
"let",
"start",
"=",
"getSourcePoint",
"(",
")",
",",
"match",
"=",
"tagCloseRegex",
".",
"exec",
"(",
"source",
".",
"substr",
"(",
"pos",
")",
")",
"if",
"(",
"!",
"match",
")",
"{",
"throwSyntaxError",
"(",... | Read a close tag token
@returns {Token} | [
"Read",
"a",
"close",
"tag",
"token"
] | cfad09dd07d4b121da130327c8221222db5f6cb4 | https://github.com/sitegui/ejs-html/blob/cfad09dd07d4b121da130327c8221222db5f6cb4/lib/parse.js#L196-L210 |
41,490 | sitegui/ejs-html | lib/parse.js | readOpenTag | function readOpenTag() {
// Read tag name
let start = getSourcePoint(),
match = tagNameRegex.exec(source.substr(pos))
if (!match) {
throwSyntaxError('Invalid open tag')
}
let tagName = match[0].toLowerCase(),
isVoid = voidElementsRegex.test(tagName)
advanceTo(pos + tagName.length)
// Keep readin... | javascript | function readOpenTag() {
// Read tag name
let start = getSourcePoint(),
match = tagNameRegex.exec(source.substr(pos))
if (!match) {
throwSyntaxError('Invalid open tag')
}
let tagName = match[0].toLowerCase(),
isVoid = voidElementsRegex.test(tagName)
advanceTo(pos + tagName.length)
// Keep readin... | [
"function",
"readOpenTag",
"(",
")",
"{",
"// Read tag name",
"let",
"start",
"=",
"getSourcePoint",
"(",
")",
",",
"match",
"=",
"tagNameRegex",
".",
"exec",
"(",
"source",
".",
"substr",
"(",
"pos",
")",
")",
"if",
"(",
"!",
"match",
")",
"{",
"throw... | Read an open tag token
@returns {Token} | [
"Read",
"an",
"open",
"tag",
"token"
] | cfad09dd07d4b121da130327c8221222db5f6cb4 | https://github.com/sitegui/ejs-html/blob/cfad09dd07d4b121da130327c8221222db5f6cb4/lib/parse.js#L216-L275 |
41,491 | sitegui/ejs-html | lib/parse.js | advanceTo | function advanceTo(newPos) {
let n = newPos - pos
assert(n >= 0)
while (n--) {
if (source[pos] === '\n') {
column = 1
line++
} else {
column++
}
pos += 1
}
} | javascript | function advanceTo(newPos) {
let n = newPos - pos
assert(n >= 0)
while (n--) {
if (source[pos] === '\n') {
column = 1
line++
} else {
column++
}
pos += 1
}
} | [
"function",
"advanceTo",
"(",
"newPos",
")",
"{",
"let",
"n",
"=",
"newPos",
"-",
"pos",
"assert",
"(",
"n",
">=",
"0",
")",
"while",
"(",
"n",
"--",
")",
"{",
"if",
"(",
"source",
"[",
"pos",
"]",
"===",
"'\\n'",
")",
"{",
"column",
"=",
"1",
... | Advance reading position, updating `pos`, `line` and `column`
@param {number} newPos - must be greater or equal to current pos | [
"Advance",
"reading",
"position",
"updating",
"pos",
"line",
"and",
"column"
] | cfad09dd07d4b121da130327c8221222db5f6cb4 | https://github.com/sitegui/ejs-html/blob/cfad09dd07d4b121da130327c8221222db5f6cb4/lib/parse.js#L370-L382 |
41,492 | sitegui/ejs-html | lib/parse.js | createContentToken | function createContentToken(type, start) {
let end = getSourcePoint()
return {
type,
start,
end,
content: source.substring(start.pos, end.pos)
}
} | javascript | function createContentToken(type, start) {
let end = getSourcePoint()
return {
type,
start,
end,
content: source.substring(start.pos, end.pos)
}
} | [
"function",
"createContentToken",
"(",
"type",
",",
"start",
")",
"{",
"let",
"end",
"=",
"getSourcePoint",
"(",
")",
"return",
"{",
"type",
",",
"start",
",",
"end",
",",
"content",
":",
"source",
".",
"substring",
"(",
"start",
".",
"pos",
",",
"end"... | Create a simple, content-oriented token up to current position
@param {string} type - one of: text, ejs-eval, ejs-escaped, ejs-raw, comment, doctype
@param {SourcePoint} start
@returns {Token} | [
"Create",
"a",
"simple",
"content",
"-",
"oriented",
"token",
"up",
"to",
"current",
"position"
] | cfad09dd07d4b121da130327c8221222db5f6cb4 | https://github.com/sitegui/ejs-html/blob/cfad09dd07d4b121da130327c8221222db5f6cb4/lib/parse.js#L412-L420 |
41,493 | sitegui/ejs-html | lib/parse.js | throwSyntaxError | function throwSyntaxError(message) {
let curr = getSourcePoint(),
snippet = getSnippet(source, curr.line, curr.line),
err = new SyntaxError(`${message}\n${snippet}`)
err.pos = getSourcePoint()
throw err
} | javascript | function throwSyntaxError(message) {
let curr = getSourcePoint(),
snippet = getSnippet(source, curr.line, curr.line),
err = new SyntaxError(`${message}\n${snippet}`)
err.pos = getSourcePoint()
throw err
} | [
"function",
"throwSyntaxError",
"(",
"message",
")",
"{",
"let",
"curr",
"=",
"getSourcePoint",
"(",
")",
",",
"snippet",
"=",
"getSnippet",
"(",
"source",
",",
"curr",
".",
"line",
",",
"curr",
".",
"line",
")",
",",
"err",
"=",
"new",
"SyntaxError",
... | Throw a syntax error in the current position
@param {string} message
@throws {SyntaxError} | [
"Throw",
"a",
"syntax",
"error",
"in",
"the",
"current",
"position"
] | cfad09dd07d4b121da130327c8221222db5f6cb4 | https://github.com/sitegui/ejs-html/blob/cfad09dd07d4b121da130327c8221222db5f6cb4/lib/parse.js#L427-L433 |
41,494 | conveyal/lonlat | index.js | fromLatFirstString | function fromLatFirstString (str) {
var arr = str.split(',')
return floatize({lat: arr[0], lon: arr[1]})
} | javascript | function fromLatFirstString (str) {
var arr = str.split(',')
return floatize({lat: arr[0], lon: arr[1]})
} | [
"function",
"fromLatFirstString",
"(",
"str",
")",
"{",
"var",
"arr",
"=",
"str",
".",
"split",
"(",
"','",
")",
"return",
"floatize",
"(",
"{",
"lat",
":",
"arr",
"[",
"0",
"]",
",",
"lon",
":",
"arr",
"[",
"1",
"]",
"}",
")",
"}"
] | Tries to parse from a string where the latitude appears before the longitude.
@memberof conveyal/lonlat
@param {string} str A string in the format: `latitude,longitude`
@return {lonlat.types.output}
@throws {lonlat.types.InvalidCoordinateException}
@example
var lonlat = require('@conveyal/lonlat')
var posi... | [
"Tries",
"to",
"parse",
"from",
"a",
"string",
"where",
"the",
"latitude",
"appears",
"before",
"the",
"longitude",
"."
] | 91240d483d302ad9f19cf6dd04d5f908357aaefa | https://github.com/conveyal/lonlat/blob/91240d483d302ad9f19cf6dd04d5f908357aaefa/index.js#L170-L173 |
41,495 | conveyal/lonlat | index.js | latitudeToPixel | function latitudeToPixel (latitude, zoom) {
const latRad = toRadians(latitude)
return (1 -
Math.log(Math.tan(latRad) + (1 / Math.cos(latRad))) /
Math.PI) / 2 * zScale(zoom)
} | javascript | function latitudeToPixel (latitude, zoom) {
const latRad = toRadians(latitude)
return (1 -
Math.log(Math.tan(latRad) + (1 / Math.cos(latRad))) /
Math.PI) / 2 * zScale(zoom)
} | [
"function",
"latitudeToPixel",
"(",
"latitude",
",",
"zoom",
")",
"{",
"const",
"latRad",
"=",
"toRadians",
"(",
"latitude",
")",
"return",
"(",
"1",
"-",
"Math",
".",
"log",
"(",
"Math",
".",
"tan",
"(",
"latRad",
")",
"+",
"(",
"1",
"/",
"Math",
... | Convert a latitude to it's pixel value given a `zoom` level.
@param {number} latitude
@param {number} zoom
@return {number} pixel
@example
var yPixel = lonlat.latitudeToPixel(40, 9) //= 49621.12736343896 | [
"Convert",
"a",
"latitude",
"to",
"it",
"s",
"pixel",
"value",
"given",
"a",
"zoom",
"level",
"."
] | 91240d483d302ad9f19cf6dd04d5f908357aaefa | https://github.com/conveyal/lonlat/blob/91240d483d302ad9f19cf6dd04d5f908357aaefa/index.js#L347-L352 |
41,496 | conveyal/lonlat | index.js | pixelToLatitude | function pixelToLatitude (y, zoom) {
var latRad = Math.atan(Math.sinh(Math.PI * (1 - 2 * y / zScale(zoom))))
return toDegrees(latRad)
} | javascript | function pixelToLatitude (y, zoom) {
var latRad = Math.atan(Math.sinh(Math.PI * (1 - 2 * y / zScale(zoom))))
return toDegrees(latRad)
} | [
"function",
"pixelToLatitude",
"(",
"y",
",",
"zoom",
")",
"{",
"var",
"latRad",
"=",
"Math",
".",
"atan",
"(",
"Math",
".",
"sinh",
"(",
"Math",
".",
"PI",
"*",
"(",
"1",
"-",
"2",
"*",
"y",
"/",
"zScale",
"(",
"zoom",
")",
")",
")",
")",
"r... | Convert a pixel to it's latitude value given a zoom level.
@param {number} y
@param {number} zoom
@return {number} latitude
@example
var lat = lonlat.pixelToLatitude(50000, 9) //= 39.1982053488948 | [
"Convert",
"a",
"pixel",
"to",
"it",
"s",
"latitude",
"value",
"given",
"a",
"zoom",
"level",
"."
] | 91240d483d302ad9f19cf6dd04d5f908357aaefa | https://github.com/conveyal/lonlat/blob/91240d483d302ad9f19cf6dd04d5f908357aaefa/index.js#L407-L410 |
41,497 | chad-autry/hex-grid-map-3D | src/contexts/InverseGridContext.js | function(hexDimensions, radius) {
var positionArray = [];
var pixelCoordinates;
//For every hex, place an instance of the original mesh. The symbol fills in 3 of the 6 lines, the other 3 being shared with an adjacent hex
//Make a hexagonal grid of hexagons since it is approximately circular.
var u = 0;
va... | javascript | function(hexDimensions, radius) {
var positionArray = [];
var pixelCoordinates;
//For every hex, place an instance of the original mesh. The symbol fills in 3 of the 6 lines, the other 3 being shared with an adjacent hex
//Make a hexagonal grid of hexagons since it is approximately circular.
var u = 0;
va... | [
"function",
"(",
"hexDimensions",
",",
"radius",
")",
"{",
"var",
"positionArray",
"=",
"[",
"]",
";",
"var",
"pixelCoordinates",
";",
"//For every hex, place an instance of the original mesh. The symbol fills in 3 of the 6 lines, the other 3 being shared with an adjacent hex",
"//... | Creates a full grid from the single mesh
@private | [
"Creates",
"a",
"full",
"grid",
"from",
"the",
"single",
"mesh"
] | 4c80bcb2580b2ba573df257b40082de97e8938e8 | https://github.com/chad-autry/hex-grid-map-3D/blob/4c80bcb2580b2ba573df257b40082de97e8938e8/src/contexts/InverseGridContext.js#L151-L202 | |
41,498 | Suor/serverless-docker-artifacts | index.js | run | function run(cmd, args, options) {
if (process.env.SLS_DEBUG) console.log('Running', cmd, args.join(' '));
const stdio = process.env.SLS_DEBUG && options && options.showOutput
? ['pipe', 'inherit', 'pipe'] : 'pipe';
const ps = child_process.spawnSync(cmd, args, {encoding: 'utf-8', 'stdio': stdio});
if (ps.... | javascript | function run(cmd, args, options) {
if (process.env.SLS_DEBUG) console.log('Running', cmd, args.join(' '));
const stdio = process.env.SLS_DEBUG && options && options.showOutput
? ['pipe', 'inherit', 'pipe'] : 'pipe';
const ps = child_process.spawnSync(cmd, args, {encoding: 'utf-8', 'stdio': stdio});
if (ps.... | [
"function",
"run",
"(",
"cmd",
",",
"args",
",",
"options",
")",
"{",
"if",
"(",
"process",
".",
"env",
".",
"SLS_DEBUG",
")",
"console",
".",
"log",
"(",
"'Running'",
",",
"cmd",
",",
"args",
".",
"join",
"(",
"' '",
")",
")",
";",
"const",
"std... | Helper function to run commands | [
"Helper",
"function",
"to",
"run",
"commands"
] | 4ea6edba602ec2c03ce6f0fc9c1b20c09ca35c77 | https://github.com/Suor/serverless-docker-artifacts/blob/4ea6edba602ec2c03ce6f0fc9c1b20c09ca35c77/index.js#L109-L124 |
41,499 | chad-autry/hex-grid-map-3D | jsdoc-template/publish.js | linkto | function linkto(parentState, longname, name) {
if (!!longname && longname !== '') {
return '<a ui-sref="jsdoc.' + parentState + "({anchor:'" + longname.replace('module:', '') + "'})" + '">' + name + '</a>';
}
return '<a ui-sref="jsdoc.' + parentState + '">' + name + '</a>';
} | javascript | function linkto(parentState, longname, name) {
if (!!longname && longname !== '') {
return '<a ui-sref="jsdoc.' + parentState + "({anchor:'" + longname.replace('module:', '') + "'})" + '">' + name + '</a>';
}
return '<a ui-sref="jsdoc.' + parentState + '">' + name + '</a>';
} | [
"function",
"linkto",
"(",
"parentState",
",",
"longname",
",",
"name",
")",
"{",
"if",
"(",
"!",
"!",
"longname",
"&&",
"longname",
"!==",
"''",
")",
"{",
"return",
"'<a ui-sref=\"jsdoc.'",
"+",
"parentState",
"+",
"\"({anchor:'\"",
"+",
"longname",
".",
... | Create links to items | [
"Create",
"links",
"to",
"items"
] | 4c80bcb2580b2ba573df257b40082de97e8938e8 | https://github.com/chad-autry/hex-grid-map-3D/blob/4c80bcb2580b2ba573df257b40082de97e8938e8/jsdoc-template/publish.js#L379-L386 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.