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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
29,800 | hsnaydd/validetta | dist/validetta.js | function( tmp ) {
if ( tmp.val === '' ) return true; // allow empty because empty check does by required metheod
var reg, cardNumber, pos, digit, i, sub_total, sum = 0, strlen;
reg = new RegExp( /[^0-9]+/g );
cardNumber = tmp.val.replace( reg, '' );
strlen = cardNumber.length;
... | javascript | function( tmp ) {
if ( tmp.val === '' ) return true; // allow empty because empty check does by required metheod
var reg, cardNumber, pos, digit, i, sub_total, sum = 0, strlen;
reg = new RegExp( /[^0-9]+/g );
cardNumber = tmp.val.replace( reg, '' );
strlen = cardNumber.length;
... | [
"function",
"(",
"tmp",
")",
"{",
"if",
"(",
"tmp",
".",
"val",
"===",
"''",
")",
"return",
"true",
";",
"// allow empty because empty check does by required metheod\r",
"var",
"reg",
",",
"cardNumber",
",",
"pos",
",",
"digit",
",",
"i",
",",
"sub_total",
"... | Credit Card Control
@from : http://af-design.com/blog/2010/08/18/validating-credit-card-numbers | [
"Credit",
"Card",
"Control"
] | f712b7375e1465bfc687a8c6fc93ea700cb590e3 | https://github.com/hsnaydd/validetta/blob/f712b7375e1465bfc687a8c6fc93ea700cb590e3/dist/validetta.js#L119-L141 | |
29,801 | hsnaydd/validetta | dist/validetta.js | function( tmp, self ) {
var _arg = self.options.validators.regExp[ tmp.arg ],
_reg = new RegExp( _arg.pattern );
return _reg.test( tmp.val ) || _arg.errorMessage;
} | javascript | function( tmp, self ) {
var _arg = self.options.validators.regExp[ tmp.arg ],
_reg = new RegExp( _arg.pattern );
return _reg.test( tmp.val ) || _arg.errorMessage;
} | [
"function",
"(",
"tmp",
",",
"self",
")",
"{",
"var",
"_arg",
"=",
"self",
".",
"options",
".",
"validators",
".",
"regExp",
"[",
"tmp",
".",
"arg",
"]",
",",
"_reg",
"=",
"new",
"RegExp",
"(",
"_arg",
".",
"pattern",
")",
";",
"return",
"_reg",
... | Custom reg check | [
"Custom",
"reg",
"check"
] | f712b7375e1465bfc687a8c6fc93ea700cb590e3 | https://github.com/hsnaydd/validetta/blob/f712b7375e1465bfc687a8c6fc93ea700cb590e3/dist/validetta.js#L171-L175 | |
29,802 | hsnaydd/validetta | dist/validetta.js | function(){
var self = this; // stored this
// Handle submit event
$( this.form ).submit( function( e ) {
// fields to be controlled transferred to global variable
FIELDS = this.querySelectorAll('[data-validetta]');
return self.init( e );
});
// real-time op... | javascript | function(){
var self = this; // stored this
// Handle submit event
$( this.form ).submit( function( e ) {
// fields to be controlled transferred to global variable
FIELDS = this.querySelectorAll('[data-validetta]');
return self.init( e );
});
// real-time op... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// stored this\r",
"// Handle submit event\r",
"$",
"(",
"this",
".",
"form",
")",
".",
"submit",
"(",
"function",
"(",
"e",
")",
"{",
"// fields to be controlled transferred to global variable\r",
"FIEL... | This is the method of handling events
@return {mixed} | [
"This",
"is",
"the",
"method",
"of",
"handling",
"events"
] | f712b7375e1465bfc687a8c6fc93ea700cb590e3 | https://github.com/hsnaydd/validetta/blob/f712b7375e1465bfc687a8c6fc93ea700cb590e3/dist/validetta.js#L220-L249 | |
29,803 | hsnaydd/validetta | dist/validetta.js | function( e ) {
// Reset error windows from all elements
this.reset( FIELDS );
// Start control each elements
this.checkFields( e );
if( e.type !== 'submit' ) return; // if event type is not submit, break
// This is for when running remote request, return false and wait request... | javascript | function( e ) {
// Reset error windows from all elements
this.reset( FIELDS );
// Start control each elements
this.checkFields( e );
if( e.type !== 'submit' ) return; // if event type is not submit, break
// This is for when running remote request, return false and wait request... | [
"function",
"(",
"e",
")",
"{",
"// Reset error windows from all elements\r",
"this",
".",
"reset",
"(",
"FIELDS",
")",
";",
"// Start control each elements\r",
"this",
".",
"checkFields",
"(",
"e",
")",
";",
"if",
"(",
"e",
".",
"type",
"!==",
"'submit'",
")"... | In this method, fields are validated
@params {object} e : event object
@return {mixed} | [
"In",
"this",
"method",
"fields",
"are",
"validated"
] | f712b7375e1465bfc687a8c6fc93ea700cb590e3 | https://github.com/hsnaydd/validetta/blob/f712b7375e1465bfc687a8c6fc93ea700cb590e3/dist/validetta.js#L257-L268 | |
29,804 | hsnaydd/validetta | dist/validetta.js | function( el, e ) {
var ajaxOptions = {},
data = {},
fieldName = el.name || el.id;
if ( typeof this.remoteCache === 'undefined' ) this.remoteCache = {};
data[ fieldName ] = this.tmp.val; // Set data
// exends ajax options
ajaxOptions = $.extend( true, {}, {
... | javascript | function( el, e ) {
var ajaxOptions = {},
data = {},
fieldName = el.name || el.id;
if ( typeof this.remoteCache === 'undefined' ) this.remoteCache = {};
data[ fieldName ] = this.tmp.val; // Set data
// exends ajax options
ajaxOptions = $.extend( true, {}, {
... | [
"function",
"(",
"el",
",",
"e",
")",
"{",
"var",
"ajaxOptions",
"=",
"{",
"}",
",",
"data",
"=",
"{",
"}",
",",
"fieldName",
"=",
"el",
".",
"name",
"||",
"el",
".",
"id",
";",
"if",
"(",
"typeof",
"this",
".",
"remoteCache",
"===",
"'undefined'... | Checks remote validations
@param {object} el current field
@param {object} e event object
@throws {error} If previous remote request for same value has rejected
@return {void} | [
"Checks",
"remote",
"validations"
] | f712b7375e1465bfc687a8c6fc93ea700cb590e3 | https://github.com/hsnaydd/validetta/blob/f712b7375e1465bfc687a8c6fc93ea700cb590e3/dist/validetta.js#L350-L396 | |
29,805 | hsnaydd/validetta | dist/validetta.js | function( ajaxOptions, cache, el, fieldName, e ) {
var self = this;
$( this.tmp.parent ).addClass('validetta-pending');
// cache xhr
this.xhr[ fieldName ] = $.ajax( ajaxOptions )
.done( function( result ) {
if( typeof result !== 'object' ) result = JSON.parse( resul... | javascript | function( ajaxOptions, cache, el, fieldName, e ) {
var self = this;
$( this.tmp.parent ).addClass('validetta-pending');
// cache xhr
this.xhr[ fieldName ] = $.ajax( ajaxOptions )
.done( function( result ) {
if( typeof result !== 'object' ) result = JSON.parse( resul... | [
"function",
"(",
"ajaxOptions",
",",
"cache",
",",
"el",
",",
"fieldName",
",",
"e",
")",
"{",
"var",
"self",
"=",
"this",
";",
"$",
"(",
"this",
".",
"tmp",
".",
"parent",
")",
".",
"addClass",
"(",
"'validetta-pending'",
")",
";",
"// cache xhr\r",
... | Calls ajax request for remote validations
@param {object} ajaxOptions Ajax options
@param {object} cache Cache object
@param {object} el processing element
@param {string} fieldName Field name for make specific caching
@param {object} e Event object | [
"Calls",
"ajax",
"request",
"for",
"remote",
"validations"
] | f712b7375e1465bfc687a8c6fc93ea700cb590e3 | https://github.com/hsnaydd/validetta/blob/f712b7375e1465bfc687a8c6fc93ea700cb590e3/dist/validetta.js#L407-L441 | |
29,806 | hsnaydd/validetta | dist/validetta.js | function( el, error ) {
// We want display errors ?
if ( !this.options.showErrorMessages ) {
// because of form not valid, set handler true for break submit
this.handler = true;
return;
}
var elParent = this.parents( el );
// If the parent el... | javascript | function( el, error ) {
// We want display errors ?
if ( !this.options.showErrorMessages ) {
// because of form not valid, set handler true for break submit
this.handler = true;
return;
}
var elParent = this.parents( el );
// If the parent el... | [
"function",
"(",
"el",
",",
"error",
")",
"{",
"// We want display errors ?\r",
"if",
"(",
"!",
"this",
".",
"options",
".",
"showErrorMessages",
")",
"{",
"// because of form not valid, set handler true for break submit\r",
"this",
".",
"handler",
"=",
"true",
";",
... | Error window opens
@params {object} el : element which has an error ( it can be native element or jQuery object )
@params {string} error : error messages | [
"Error",
"window",
"opens"
] | f712b7375e1465bfc687a8c6fc93ea700cb590e3 | https://github.com/hsnaydd/validetta/blob/f712b7375e1465bfc687a8c6fc93ea700cb590e3/dist/validetta.js#L455-L492 | |
29,807 | hsnaydd/validetta | dist/validetta.js | function( el ) {
var _errorMessages = {};
// if el is undefined ( This is the process of resetting all <form> )
// or el is an object that has element more than one
// and these elements are not checkbox
if( typeof el === 'undefined' || ( el.length > 1 && el[0].type !== 'checkbox' ) )... | javascript | function( el ) {
var _errorMessages = {};
// if el is undefined ( This is the process of resetting all <form> )
// or el is an object that has element more than one
// and these elements are not checkbox
if( typeof el === 'undefined' || ( el.length > 1 && el[0].type !== 'checkbox' ) )... | [
"function",
"(",
"el",
")",
"{",
"var",
"_errorMessages",
"=",
"{",
"}",
";",
"// if el is undefined ( This is the process of resetting all <form> )\r",
"// or el is an object that has element more than one\r",
"// and these elements are not checkbox\r",
"if",
"(",
"typeof",
"el",
... | Removes all error messages windows
@param {object} or {void} el : form elements which have an error message window | [
"Removes",
"all",
"error",
"messages",
"windows"
] | f712b7375e1465bfc687a8c6fc93ea700cb590e3 | https://github.com/hsnaydd/validetta/blob/f712b7375e1465bfc687a8c6fc93ea700cb590e3/dist/validetta.js#L509-L526 | |
29,808 | hsnaydd/validetta | dist/validetta.js | function( el ) {
var upLength = parseInt( el.getAttribute( 'data-vd-parent-up' ), 10 ) || 0;
for ( var i = 0; i <= upLength ; i++ ) {
el = el.parentNode;
}
return el;
} | javascript | function( el ) {
var upLength = parseInt( el.getAttribute( 'data-vd-parent-up' ), 10 ) || 0;
for ( var i = 0; i <= upLength ; i++ ) {
el = el.parentNode;
}
return el;
} | [
"function",
"(",
"el",
")",
"{",
"var",
"upLength",
"=",
"parseInt",
"(",
"el",
".",
"getAttribute",
"(",
"'data-vd-parent-up'",
")",
",",
"10",
")",
"||",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<=",
"upLength",
";",
"i",
"++",
")... | Finds parent element
@param {object} el element
@return {object} el parent element | [
"Finds",
"parent",
"element"
] | f712b7375e1465bfc687a8c6fc93ea700cb590e3 | https://github.com/hsnaydd/validetta/blob/f712b7375e1465bfc687a8c6fc93ea700cb590e3/dist/validetta.js#L553-L559 | |
29,809 | aweary/alder | fixtures/baz/baz.js | shouldBeIncluded | function shouldBeIncluded(file) {
let isIncluded = false
let isIgnored = false
if (hasIgnorePattern) {
return !ignorePattern.test(file)
}
if (hasIncludePattern) {
return includePattern.test(file)
}
return true
} | javascript | function shouldBeIncluded(file) {
let isIncluded = false
let isIgnored = false
if (hasIgnorePattern) {
return !ignorePattern.test(file)
}
if (hasIncludePattern) {
return includePattern.test(file)
}
return true
} | [
"function",
"shouldBeIncluded",
"(",
"file",
")",
"{",
"let",
"isIncluded",
"=",
"false",
"let",
"isIgnored",
"=",
"false",
"if",
"(",
"hasIgnorePattern",
")",
"{",
"return",
"!",
"ignorePattern",
".",
"test",
"(",
"file",
")",
"}",
"if",
"(",
"hasIncludeP... | Uses either the ignore or include pattern to determine
if a file should be shown.
@param {String} file filename | [
"Uses",
"either",
"the",
"ignore",
"or",
"include",
"pattern",
"to",
"determine",
"if",
"a",
"file",
"should",
"be",
"shown",
"."
] | edf7c40a7a95b61e82a0685bdb720eac47777d01 | https://github.com/aweary/alder/blob/edf7c40a7a95b61e82a0685bdb720eac47777d01/fixtures/baz/baz.js#L66-L76 |
29,810 | aweary/alder | alder.js | buildPrefix | function buildPrefix(depth, bottom) {
if (!shouldIndent) {
return ''
}
let prefix = bottom ? BOX_BOTTOM_LEFT : BOX_INTERSECTION
let spacing = []
let spaceIndex = 0
while(spaceIndex < depth) {
spacing[spaceIndex] = depths[spaceIndex] && !printJSX ? BOX_VERTICAL : EMPTY
spaceIndex++
}
return p... | javascript | function buildPrefix(depth, bottom) {
if (!shouldIndent) {
return ''
}
let prefix = bottom ? BOX_BOTTOM_LEFT : BOX_INTERSECTION
let spacing = []
let spaceIndex = 0
while(spaceIndex < depth) {
spacing[spaceIndex] = depths[spaceIndex] && !printJSX ? BOX_VERTICAL : EMPTY
spaceIndex++
}
return p... | [
"function",
"buildPrefix",
"(",
"depth",
",",
"bottom",
")",
"{",
"if",
"(",
"!",
"shouldIndent",
")",
"{",
"return",
"''",
"}",
"let",
"prefix",
"=",
"bottom",
"?",
"BOX_BOTTOM_LEFT",
":",
"BOX_INTERSECTION",
"let",
"spacing",
"=",
"[",
"]",
"let",
"spa... | Pads filenames with either whitespace or box characters.
The depths map is used to track whether a character should
be whitespace or a vertical character. Typically it will
be whitespace if there are no other files at that depth
that need to be rendered.
@param {Number} depth the level at which this file/filder is n... | [
"Pads",
"filenames",
"with",
"either",
"whitespace",
"or",
"box",
"characters",
".",
"The",
"depths",
"map",
"is",
"used",
"to",
"track",
"whether",
"a",
"character",
"should",
"be",
"whitespace",
"or",
"a",
"vertical",
"character",
".",
"Typically",
"it",
"... | edf7c40a7a95b61e82a0685bdb720eac47777d01 | https://github.com/aweary/alder/blob/edf7c40a7a95b61e82a0685bdb720eac47777d01/alder.js#L104-L116 |
29,811 | aweary/alder | alder.js | shouldBeIncluded | function shouldBeIncluded(file) {
if (!showAllFiles && file[0] === '.') {
return false
}
if (hasExcludePattern) {
return !excludePattern.test(file)
}
if (hasIncludePattern) {
return includePattern.test(file)
}
return true
} | javascript | function shouldBeIncluded(file) {
if (!showAllFiles && file[0] === '.') {
return false
}
if (hasExcludePattern) {
return !excludePattern.test(file)
}
if (hasIncludePattern) {
return includePattern.test(file)
}
return true
} | [
"function",
"shouldBeIncluded",
"(",
"file",
")",
"{",
"if",
"(",
"!",
"showAllFiles",
"&&",
"file",
"[",
"0",
"]",
"===",
"'.'",
")",
"{",
"return",
"false",
"}",
"if",
"(",
"hasExcludePattern",
")",
"{",
"return",
"!",
"excludePattern",
".",
"test",
... | Uses either the exclude or include pattern to determine
if a file should be shown.
@param {String} file filename | [
"Uses",
"either",
"the",
"exclude",
"or",
"include",
"pattern",
"to",
"determine",
"if",
"a",
"file",
"should",
"be",
"shown",
"."
] | edf7c40a7a95b61e82a0685bdb720eac47777d01 | https://github.com/aweary/alder/blob/edf7c40a7a95b61e82a0685bdb720eac47777d01/alder.js#L123-L135 |
29,812 | JakubMrozek/eet | lib/eet.js | generatePKP | function generatePKP (privateKey, dicPopl, idProvoz, idPokl, poradCis, datTrzby, celkTrzba) {
const options = [dicPopl, idProvoz, idPokl, poradCis, datTrzby, celkTrzba]
const strToHash = options.join('|')
const sign = crypto.createSign('RSA-SHA256')
sign.write(strToHash)
sign.end()
return sign.sign(privateK... | javascript | function generatePKP (privateKey, dicPopl, idProvoz, idPokl, poradCis, datTrzby, celkTrzba) {
const options = [dicPopl, idProvoz, idPokl, poradCis, datTrzby, celkTrzba]
const strToHash = options.join('|')
const sign = crypto.createSign('RSA-SHA256')
sign.write(strToHash)
sign.end()
return sign.sign(privateK... | [
"function",
"generatePKP",
"(",
"privateKey",
",",
"dicPopl",
",",
"idProvoz",
",",
"idPokl",
",",
"poradCis",
",",
"datTrzby",
",",
"celkTrzba",
")",
"{",
"const",
"options",
"=",
"[",
"dicPopl",
",",
"idProvoz",
",",
"idPokl",
",",
"poradCis",
",",
"datT... | Vygeneruje podpisovy kod poplatnika.
@see http://www.etrzby.cz/assets/cs/prilohy/EET_popis_rozhrani_v3.1.1.pdf (sekce 4.1) | [
"Vygeneruje",
"podpisovy",
"kod",
"poplatnika",
"."
] | 28a8f0b6743308c705eb0c17e985e0ed065b692e | https://github.com/JakubMrozek/eet/blob/28a8f0b6743308c705eb0c17e985e0ed065b692e/lib/eet.js#L25-L32 |
29,813 | JakubMrozek/eet | lib/eet.js | generateBKP | function generateBKP (pkp) {
const buffer = new Buffer(pkp, 'base64')
const hash = crypto.createHash('sha1')
hash.update(buffer)
const sha1str = hash.digest('hex').toUpperCase()
return sha1str.match(/(.{1,8})/g).join('-')
} | javascript | function generateBKP (pkp) {
const buffer = new Buffer(pkp, 'base64')
const hash = crypto.createHash('sha1')
hash.update(buffer)
const sha1str = hash.digest('hex').toUpperCase()
return sha1str.match(/(.{1,8})/g).join('-')
} | [
"function",
"generateBKP",
"(",
"pkp",
")",
"{",
"const",
"buffer",
"=",
"new",
"Buffer",
"(",
"pkp",
",",
"'base64'",
")",
"const",
"hash",
"=",
"crypto",
".",
"createHash",
"(",
"'sha1'",
")",
"hash",
".",
"update",
"(",
"buffer",
")",
"const",
"sha1... | Vygeneruje bezpecnostni kod poplatnika.
@see http://www.etrzby.cz/assets/cs/prilohy/EET_popis_rozhrani_v3.1.1.pdf (sekce 4.2) | [
"Vygeneruje",
"bezpecnostni",
"kod",
"poplatnika",
"."
] | 28a8f0b6743308c705eb0c17e985e0ed065b692e | https://github.com/JakubMrozek/eet/blob/28a8f0b6743308c705eb0c17e985e0ed065b692e/lib/eet.js#L40-L46 |
29,814 | JakubMrozek/eet | lib/eet.js | doRequest | function doRequest (options, items) {
const uid = options.uid || uuid.v4()
const date = options.currentDate || new Date()
const soapOptions = {}
if (options.playground) {
soapOptions.endpoint = PG_WSDL_URL
}
if (options.httpClient) {
soapOptions.httpClient = options.httpClient
}
const timeout = ... | javascript | function doRequest (options, items) {
const uid = options.uid || uuid.v4()
const date = options.currentDate || new Date()
const soapOptions = {}
if (options.playground) {
soapOptions.endpoint = PG_WSDL_URL
}
if (options.httpClient) {
soapOptions.httpClient = options.httpClient
}
const timeout = ... | [
"function",
"doRequest",
"(",
"options",
",",
"items",
")",
"{",
"const",
"uid",
"=",
"options",
".",
"uid",
"||",
"uuid",
".",
"v4",
"(",
")",
"const",
"date",
"=",
"options",
".",
"currentDate",
"||",
"new",
"Date",
"(",
")",
"const",
"soapOptions",
... | Odeslani platby do EET.
Volby:
- options.playground (boolean): povolit testovaci prostredi, def. false
- options.offline (boolean): při chybě vygeneruje PKP a BKP, def. false
Polozky (items) jsou popsany u funkce getItemsForBody().
Vraci Promise. Pokud je vse v poradku, vrati FIK, v opacnem pripade vraci info o chyb... | [
"Odeslani",
"platby",
"do",
"EET",
"."
] | 28a8f0b6743308c705eb0c17e985e0ed065b692e | https://github.com/JakubMrozek/eet/blob/28a8f0b6743308c705eb0c17e985e0ed065b692e/lib/eet.js#L59-L94 |
29,815 | JakubMrozek/eet | lib/eet.js | getBodyItems | function getBodyItems (privateKey, currentDate, uid, items) {
return {
Hlavicka: getHeaderItems(uid, currentDate, items.prvniZaslani, items.overeni),
Data: getDataItems(items),
KontrolniKody: getFooterItems(privateKey, items)
}
} | javascript | function getBodyItems (privateKey, currentDate, uid, items) {
return {
Hlavicka: getHeaderItems(uid, currentDate, items.prvniZaslani, items.overeni),
Data: getDataItems(items),
KontrolniKody: getFooterItems(privateKey, items)
}
} | [
"function",
"getBodyItems",
"(",
"privateKey",
",",
"currentDate",
",",
"uid",
",",
"items",
")",
"{",
"return",
"{",
"Hlavicka",
":",
"getHeaderItems",
"(",
"uid",
",",
"currentDate",
",",
"items",
".",
"prvniZaslani",
",",
"items",
".",
"overeni",
")",
"... | Vrati vsechny polozky pro obsah SOAP body.
Polozky: | [
"Vrati",
"vsechny",
"polozky",
"pro",
"obsah",
"SOAP",
"body",
"."
] | 28a8f0b6743308c705eb0c17e985e0ed065b692e | https://github.com/JakubMrozek/eet/blob/28a8f0b6743308c705eb0c17e985e0ed065b692e/lib/eet.js#L102-L108 |
29,816 | JakubMrozek/eet | lib/eet.js | getHeaderItems | function getHeaderItems (uid, currentDate, prvniZaslani, overeni) {
return {
attributes: {
uuid_zpravy: uid,
dat_odesl: formatDate(currentDate),
prvni_zaslani: formatBool(prvniZaslani, true),
overeni: formatBool(overeni, false)
}
}
} | javascript | function getHeaderItems (uid, currentDate, prvniZaslani, overeni) {
return {
attributes: {
uuid_zpravy: uid,
dat_odesl: formatDate(currentDate),
prvni_zaslani: formatBool(prvniZaslani, true),
overeni: formatBool(overeni, false)
}
}
} | [
"function",
"getHeaderItems",
"(",
"uid",
",",
"currentDate",
",",
"prvniZaslani",
",",
"overeni",
")",
"{",
"return",
"{",
"attributes",
":",
"{",
"uuid_zpravy",
":",
"uid",
",",
"dat_odesl",
":",
"formatDate",
"(",
"currentDate",
")",
",",
"prvni_zaslani",
... | Vygeneruje polozky pro element Hlavicka. | [
"Vygeneruje",
"polozky",
"pro",
"element",
"Hlavicka",
"."
] | 28a8f0b6743308c705eb0c17e985e0ed065b692e | https://github.com/JakubMrozek/eet/blob/28a8f0b6743308c705eb0c17e985e0ed065b692e/lib/eet.js#L114-L123 |
29,817 | JakubMrozek/eet | lib/eet.js | getFooterItems | function getFooterItems (privateKey, items) {
const pkp = generatePKP(
privateKey,
items.dicPopl,
items.idProvoz,
items.idPokl,
items.poradCis,
formatDate(items.datTrzby),
formatNumber(items.celkTrzba)
)
const bkp = generateBKP(pkp)
return {
pkp: {
attributes: {
di... | javascript | function getFooterItems (privateKey, items) {
const pkp = generatePKP(
privateKey,
items.dicPopl,
items.idProvoz,
items.idPokl,
items.poradCis,
formatDate(items.datTrzby),
formatNumber(items.celkTrzba)
)
const bkp = generateBKP(pkp)
return {
pkp: {
attributes: {
di... | [
"function",
"getFooterItems",
"(",
"privateKey",
",",
"items",
")",
"{",
"const",
"pkp",
"=",
"generatePKP",
"(",
"privateKey",
",",
"items",
".",
"dicPopl",
",",
"items",
".",
"idProvoz",
",",
"items",
".",
"idPokl",
",",
"items",
".",
"poradCis",
",",
... | Vygeneruje polozky pro element KontrolniKody. | [
"Vygeneruje",
"polozky",
"pro",
"element",
"KontrolniKody",
"."
] | 28a8f0b6743308c705eb0c17e985e0ed065b692e | https://github.com/JakubMrozek/eet/blob/28a8f0b6743308c705eb0c17e985e0ed065b692e/lib/eet.js#L194-L223 |
29,818 | JakubMrozek/eet | lib/eet.js | getResponseItems | function getResponseItems (response) {
const header = response.Hlavicka.attributes
const body = response.Potvrzeni.attributes
return {
uuid: header.uuid_zpravy,
bkp: header.bkp,
date: new Date(header.dat_prij),
test: body.test === 'true',
fik: body.fik,
warnings: getWarnings(response.Varov... | javascript | function getResponseItems (response) {
const header = response.Hlavicka.attributes
const body = response.Potvrzeni.attributes
return {
uuid: header.uuid_zpravy,
bkp: header.bkp,
date: new Date(header.dat_prij),
test: body.test === 'true',
fik: body.fik,
warnings: getWarnings(response.Varov... | [
"function",
"getResponseItems",
"(",
"response",
")",
"{",
"const",
"header",
"=",
"response",
".",
"Hlavicka",
".",
"attributes",
"const",
"body",
"=",
"response",
".",
"Potvrzeni",
".",
"attributes",
"return",
"{",
"uuid",
":",
"header",
".",
"uuid_zpravy",
... | Zpracuje OK odpoved ze serveru EET. | [
"Zpracuje",
"OK",
"odpoved",
"ze",
"serveru",
"EET",
"."
] | 28a8f0b6743308c705eb0c17e985e0ed065b692e | https://github.com/JakubMrozek/eet/blob/28a8f0b6743308c705eb0c17e985e0ed065b692e/lib/eet.js#L229-L240 |
29,819 | grasshopper-cms/grasshopper-api-js | lib/routes/social/twitter.js | _loadUserFromToken | function _loadUserFromToken(){
return BB
.bind(this)
.then(function() {
return grasshopper.request(this.token).users.current();
})
.then(function(user){
this.user = user;
});
} | javascript | function _loadUserFromToken(){
return BB
.bind(this)
.then(function() {
return grasshopper.request(this.token).users.current();
})
.then(function(user){
this.user = user;
});
} | [
"function",
"_loadUserFromToken",
"(",
")",
"{",
"return",
"BB",
".",
"bind",
"(",
"this",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"grasshopper",
".",
"request",
"(",
"this",
".",
"token",
")",
".",
"users",
".",
"current",
"(",
"... | Utility function to return the current logged in user. | [
"Utility",
"function",
"to",
"return",
"the",
"current",
"logged",
"in",
"user",
"."
] | 05a952b8b65e3a66c8a27f5d84699ee5cf02844d | https://github.com/grasshopper-cms/grasshopper-api-js/blob/05a952b8b65e3a66c8a27f5d84699ee5cf02844d/lib/routes/social/twitter.js#L62-L71 |
29,820 | grasshopper-cms/grasshopper-api-js | lib/routes/social/twitter.js | _linkIdentity | function _linkIdentity() {
var identityOptions = {
id: this.params.raw.user_id,
accessToken: this.params.access_token,
accessSecret: this.params.access_secret,
screen_name: this.params.raw.screen_name
};
return BB.resolve(grasshopper.request(this.token).u... | javascript | function _linkIdentity() {
var identityOptions = {
id: this.params.raw.user_id,
accessToken: this.params.access_token,
accessSecret: this.params.access_secret,
screen_name: this.params.raw.screen_name
};
return BB.resolve(grasshopper.request(this.token).u... | [
"function",
"_linkIdentity",
"(",
")",
"{",
"var",
"identityOptions",
"=",
"{",
"id",
":",
"this",
".",
"params",
".",
"raw",
".",
"user_id",
",",
"accessToken",
":",
"this",
".",
"params",
".",
"access_token",
",",
"accessSecret",
":",
"this",
".",
"par... | Utility function to link a user's twitter info to the current user. | [
"Utility",
"function",
"to",
"link",
"a",
"user",
"s",
"twitter",
"info",
"to",
"the",
"current",
"user",
"."
] | 05a952b8b65e3a66c8a27f5d84699ee5cf02844d | https://github.com/grasshopper-cms/grasshopper-api-js/blob/05a952b8b65e3a66c8a27f5d84699ee5cf02844d/lib/routes/social/twitter.js#L74-L83 |
29,821 | aaronj1335/webpack-postcss-tools | index.js | makeVarMap | function makeVarMap(filename) {
var map = {vars: {}, media: {}, selector: {}};
function resolveImport(path, basedir) {
if (path[0] === '/')
return path;
if (path[0] === '.')
return pathResolve(join(basedir, path));
// webpack treats anything starting w/ ~ as a module name, which we're
... | javascript | function makeVarMap(filename) {
var map = {vars: {}, media: {}, selector: {}};
function resolveImport(path, basedir) {
if (path[0] === '/')
return path;
if (path[0] === '.')
return pathResolve(join(basedir, path));
// webpack treats anything starting w/ ~ as a module name, which we're
... | [
"function",
"makeVarMap",
"(",
"filename",
")",
"{",
"var",
"map",
"=",
"{",
"vars",
":",
"{",
"}",
",",
"media",
":",
"{",
"}",
",",
"selector",
":",
"{",
"}",
"}",
";",
"function",
"resolveImport",
"(",
"path",
",",
"basedir",
")",
"{",
"if",
"... | create maps of variables and custom media queries
because we want to:
- treat every css file as a separate webpack module
- statically resolve css variables during the build
we run into an issue where we're compiling a css library with variables that
might be overridden by a later stylesheet. we solve this by resolv... | [
"create",
"maps",
"of",
"variables",
"and",
"custom",
"media",
"queries"
] | 9baa0e43cc9929ca94e9cab336089bfb96ffed98 | https://github.com/aaronj1335/webpack-postcss-tools/blob/9baa0e43cc9929ca94e9cab336089bfb96ffed98/index.js#L33-L121 |
29,822 | aaronj1335/webpack-postcss-tools | index.js | prependTildesToImports | function prependTildesToImports(styles) {
styles.eachAtRule(function (atRule) {
if (atRule.name !== 'import')
return;
var stripped = stripQuotes(unwrapUrl(atRule.params));
if (stripped[0] !== '.' && stripped[0] !== '~' && stripped[0] !== '/') {
atRule.params = '"~' + stripped + '"';
}
... | javascript | function prependTildesToImports(styles) {
styles.eachAtRule(function (atRule) {
if (atRule.name !== 'import')
return;
var stripped = stripQuotes(unwrapUrl(atRule.params));
if (stripped[0] !== '.' && stripped[0] !== '~' && stripped[0] !== '/') {
atRule.params = '"~' + stripped + '"';
}
... | [
"function",
"prependTildesToImports",
"(",
"styles",
")",
"{",
"styles",
".",
"eachAtRule",
"(",
"function",
"(",
"atRule",
")",
"{",
"if",
"(",
"atRule",
".",
"name",
"!==",
"'import'",
")",
"return",
";",
"var",
"stripped",
"=",
"stripQuotes",
"(",
"unwr... | prepend a tilde to css module imports
webpack's css-loader [treats css imports as relative paths][url-to-req], not
modules. the easiest way i've found to correct this prepending a `~` to each
import to force webpack to use it's full module lookup machinery.
[url-to-req]: https://github.com/webpack/css-loader/blob/7b5... | [
"prepend",
"a",
"tilde",
"to",
"css",
"module",
"imports"
] | 9baa0e43cc9929ca94e9cab336089bfb96ffed98 | https://github.com/aaronj1335/webpack-postcss-tools/blob/9baa0e43cc9929ca94e9cab336089bfb96ffed98/index.js#L136-L147 |
29,823 | grasshopper-cms/grasshopper-api-js | lib/routes/social/facebook.js | facebookReq | function facebookReq(req, res){
var redirectUrl = _.has(grasshopper.config.identities, 'facebook') ? grasshopper.config.identities.facebook.redirectUrl : 'defaultRoute';
BB.bind({token: req.session.token, params: req.query, res: res, req: req, user: null })
.then(function(){
if(!_.isUndefin... | javascript | function facebookReq(req, res){
var redirectUrl = _.has(grasshopper.config.identities, 'facebook') ? grasshopper.config.identities.facebook.redirectUrl : 'defaultRoute';
BB.bind({token: req.session.token, params: req.query, res: res, req: req, user: null })
.then(function(){
if(!_.isUndefin... | [
"function",
"facebookReq",
"(",
"req",
",",
"res",
")",
"{",
"var",
"redirectUrl",
"=",
"_",
".",
"has",
"(",
"grasshopper",
".",
"config",
".",
"identities",
",",
"'facebook'",
")",
"?",
"grasshopper",
".",
"config",
".",
"identities",
".",
"facebook",
... | Middleware that handles all of the logic for creating and linking social accounts. | [
"Middleware",
"that",
"handles",
"all",
"of",
"the",
"logic",
"for",
"creating",
"and",
"linking",
"social",
"accounts",
"."
] | 05a952b8b65e3a66c8a27f5d84699ee5cf02844d | https://github.com/grasshopper-cms/grasshopper-api-js/blob/05a952b8b65e3a66c8a27f5d84699ee5cf02844d/lib/routes/social/facebook.js#L15-L36 |
29,824 | Aldaviva/mongoose-moment | lib/schema.js | SchemaMoment | function SchemaMoment(key, options) {
SchemaType.call(this, key, options);
this.get(function(val, self){
if(!val){
return val;
} else {
return new Moment(val);
}
});
} | javascript | function SchemaMoment(key, options) {
SchemaType.call(this, key, options);
this.get(function(val, self){
if(!val){
return val;
} else {
return new Moment(val);
}
});
} | [
"function",
"SchemaMoment",
"(",
"key",
",",
"options",
")",
"{",
"SchemaType",
".",
"call",
"(",
"this",
",",
"key",
",",
"options",
")",
";",
"this",
".",
"get",
"(",
"function",
"(",
"val",
",",
"self",
")",
"{",
"if",
"(",
"!",
"val",
")",
"{... | Moment SchemaType constructor.
@param {String} key
@param {Object} options
@inherits SchemaType
@api private | [
"Moment",
"SchemaType",
"constructor",
"."
] | ba36ec59e9a630b21d61d9ad63d9865ff3cb0872 | https://github.com/Aldaviva/mongoose-moment/blob/ba36ec59e9a630b21d61d9ad63d9865ff3cb0872/lib/schema.js#L46-L56 |
29,825 | Battochon/passwordless-postgrestore | lib/postgrestore.js | PostgreStore | function PostgreStore(conString, options) {
if(!conString){
throw new Error('Connection String is missing.');
}
this._options = options || {};
this._options.pgstore = this._options.pgstore || {};
this._difficulty = this._options.pgstore.difficulty || 10;
this._table = this._options.pgstore... | javascript | function PostgreStore(conString, options) {
if(!conString){
throw new Error('Connection String is missing.');
}
this._options = options || {};
this._options.pgstore = this._options.pgstore || {};
this._difficulty = this._options.pgstore.difficulty || 10;
this._table = this._options.pgstore... | [
"function",
"PostgreStore",
"(",
"conString",
",",
"options",
")",
"{",
"if",
"(",
"!",
"conString",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Connection String is missing.'",
")",
";",
"}",
"this",
".",
"_options",
"=",
"options",
"||",
"{",
"}",
";",
"... | Constructor of PostgreStore
@param {String} conString URI as defined by the PostgreSQL specification. Please
check the documentation for details:
https://github.com/brianc/node-postgres
@param {Object} [options] Combines both the options for the PostgreClient as well
as the options for PostgreStore. For the PostgreClie... | [
"Constructor",
"of",
"PostgreStore"
] | feb17613cf4dad8ebfabba54e146d0bc14b390d0 | https://github.com/Battochon/passwordless-postgrestore/blob/feb17613cf4dad8ebfabba54e146d0bc14b390d0/lib/postgrestore.js#L21-L48 |
29,826 | grasshopper-cms/grasshopper-api-js | lib/routes/google.js | oauth | function oauth(httpRequest, httpResponse){
var code = httpRequest.query.code,
redirectUrl = _.has(grasshopper.config.identities, 'google') ? grasshopper.config.identities.google.redirectUrl : 'defaultRoute';
grasshopper.auth('Google', { code: code })
.then(function(token) {
... | javascript | function oauth(httpRequest, httpResponse){
var code = httpRequest.query.code,
redirectUrl = _.has(grasshopper.config.identities, 'google') ? grasshopper.config.identities.google.redirectUrl : 'defaultRoute';
grasshopper.auth('Google', { code: code })
.then(function(token) {
... | [
"function",
"oauth",
"(",
"httpRequest",
",",
"httpResponse",
")",
"{",
"var",
"code",
"=",
"httpRequest",
".",
"query",
".",
"code",
",",
"redirectUrl",
"=",
"_",
".",
"has",
"(",
"grasshopper",
".",
"config",
".",
"identities",
",",
"'google'",
")",
"?... | Method will accept the oauth callback from google, run authentication, then redirect the user to the page that accepts the token. | [
"Method",
"will",
"accept",
"the",
"oauth",
"callback",
"from",
"google",
"run",
"authentication",
"then",
"redirect",
"the",
"user",
"to",
"the",
"page",
"that",
"accepts",
"the",
"token",
"."
] | 05a952b8b65e3a66c8a27f5d84699ee5cf02844d | https://github.com/grasshopper-cms/grasshopper-api-js/blob/05a952b8b65e3a66c8a27f5d84699ee5cf02844d/lib/routes/google.js#L24-L42 |
29,827 | grasshopper-cms/grasshopper-api-js | lib/routes/google.js | url | function url(httpRequest, httpResponse) {
var response = new Response(httpResponse);
grasshopper.googleAuthUrl()
.then(function(url) {
response.writeSuccess(url);
})
.fail(function(message) {
var err = {
code : 400,... | javascript | function url(httpRequest, httpResponse) {
var response = new Response(httpResponse);
grasshopper.googleAuthUrl()
.then(function(url) {
response.writeSuccess(url);
})
.fail(function(message) {
var err = {
code : 400,... | [
"function",
"url",
"(",
"httpRequest",
",",
"httpResponse",
")",
"{",
"var",
"response",
"=",
"new",
"Response",
"(",
"httpResponse",
")",
";",
"grasshopper",
".",
"googleAuthUrl",
"(",
")",
".",
"then",
"(",
"function",
"(",
"url",
")",
"{",
"response",
... | Method will return a google auth url. | [
"Method",
"will",
"return",
"a",
"google",
"auth",
"url",
"."
] | 05a952b8b65e3a66c8a27f5d84699ee5cf02844d | https://github.com/grasshopper-cms/grasshopper-api-js/blob/05a952b8b65e3a66c8a27f5d84699ee5cf02844d/lib/routes/google.js#L47-L63 |
29,828 | grasshopper-cms/grasshopper-api-js | lib/routes/token.js | parseHeader | function parseHeader(authHeader, callback){
try {
var parts=authHeader.split(/:/),
username=parts[0],
password=parts[1];
callback(null, {username: username, password: password});
}
catch(ex){
callback(ex);
}
} | javascript | function parseHeader(authHeader, callback){
try {
var parts=authHeader.split(/:/),
username=parts[0],
password=parts[1];
callback(null, {username: username, password: password});
}
catch(ex){
callback(ex);
}
} | [
"function",
"parseHeader",
"(",
"authHeader",
",",
"callback",
")",
"{",
"try",
"{",
"var",
"parts",
"=",
"authHeader",
".",
"split",
"(",
"/",
":",
"/",
")",
",",
"username",
"=",
"parts",
"[",
"0",
"]",
",",
"password",
"=",
"parts",
"[",
"1",
"]... | Method will pull out the username and password out of the auth header.
@param authHeader String found in the HTTP authentication header.
@param callback | [
"Method",
"will",
"pull",
"out",
"the",
"username",
"and",
"password",
"out",
"of",
"the",
"auth",
"header",
"."
] | 05a952b8b65e3a66c8a27f5d84699ee5cf02844d | https://github.com/grasshopper-cms/grasshopper-api-js/blob/05a952b8b65e3a66c8a27f5d84699ee5cf02844d/lib/routes/token.js#L19-L30 |
29,829 | newrelic/yakaa | https.js | createConnection | function createConnection(port, host, options) {
if (isObject(port)) {
options = port;
}
else if (isObject(host)) {
options = host;
}
else if (isObject(options)) {
options = options;
}
else {
options = {};
}
if (isNumber(port)) {
options.port = port;
}
if (isString(host)) {
... | javascript | function createConnection(port, host, options) {
if (isObject(port)) {
options = port;
}
else if (isObject(host)) {
options = host;
}
else if (isObject(options)) {
options = options;
}
else {
options = {};
}
if (isNumber(port)) {
options.port = port;
}
if (isString(host)) {
... | [
"function",
"createConnection",
"(",
"port",
",",
"host",
",",
"options",
")",
"{",
"if",
"(",
"isObject",
"(",
"port",
")",
")",
"{",
"options",
"=",
"port",
";",
"}",
"else",
"if",
"(",
"isObject",
"(",
"host",
")",
")",
"{",
"options",
"=",
"hos... | HTTPS agents. | [
"HTTPS",
"agents",
"."
] | 8574311a6e35da5122eecef145df386eaa4a6d5e | https://github.com/newrelic/yakaa/blob/8574311a6e35da5122eecef145df386eaa4a6d5e/https.js#L43-L67 |
29,830 | BKWLD/vue-balance-text | index.js | bind | function bind(el, _ref) {
var modifiers = _ref.modifiers;
var target;
// Support children's modifier
target = modifiers.children ? Array.from(el.children) : el;
// Add balance text to the element
Vue.nextTick(function () {
return balanceText(target, {
watch: true... | javascript | function bind(el, _ref) {
var modifiers = _ref.modifiers;
var target;
// Support children's modifier
target = modifiers.children ? Array.from(el.children) : el;
// Add balance text to the element
Vue.nextTick(function () {
return balanceText(target, {
watch: true... | [
"function",
"bind",
"(",
"el",
",",
"_ref",
")",
"{",
"var",
"modifiers",
"=",
"_ref",
".",
"modifiers",
";",
"var",
"target",
";",
"// Support children's modifier",
"target",
"=",
"modifiers",
".",
"children",
"?",
"Array",
".",
"from",
"(",
"el",
".",
... | Add balance text to the element | [
"Add",
"balance",
"text",
"to",
"the",
"element"
] | 86e00b5fbef3d38b7d180cd89b98b66757975010 | https://github.com/BKWLD/vue-balance-text/blob/86e00b5fbef3d38b7d180cd89b98b66757975010/index.js#L17-L35 |
29,831 | BKWLD/vue-balance-text | index.js | componentUpdated | function componentUpdated(el, _ref2) {
var modifiers = _ref2.modifiers;
var target;
target = modifiers.children ? Array.from(el.children) : el;
return balanceText(target);
} | javascript | function componentUpdated(el, _ref2) {
var modifiers = _ref2.modifiers;
var target;
target = modifiers.children ? Array.from(el.children) : el;
return balanceText(target);
} | [
"function",
"componentUpdated",
"(",
"el",
",",
"_ref2",
")",
"{",
"var",
"modifiers",
"=",
"_ref2",
".",
"modifiers",
";",
"var",
"target",
";",
"target",
"=",
"modifiers",
".",
"children",
"?",
"Array",
".",
"from",
"(",
"el",
".",
"children",
")",
"... | Update when contents change | [
"Update",
"when",
"contents",
"change"
] | 86e00b5fbef3d38b7d180cd89b98b66757975010 | https://github.com/BKWLD/vue-balance-text/blob/86e00b5fbef3d38b7d180cd89b98b66757975010/index.js#L37-L43 |
29,832 | JakubMrozek/eet | lib/validate.js | date | function date (value) {
if (Object.prototype.toString.call(value) !== '[object Date]' || isNaN(value)) {
throw new Error(`Value '${value}' is not a date object.`)
}
} | javascript | function date (value) {
if (Object.prototype.toString.call(value) !== '[object Date]' || isNaN(value)) {
throw new Error(`Value '${value}' is not a date object.`)
}
} | [
"function",
"date",
"(",
"value",
")",
"{",
"if",
"(",
"Object",
".",
"prototype",
".",
"toString",
".",
"call",
"(",
"value",
")",
"!==",
"'[object Date]'",
"||",
"isNaN",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"`",
"${",
"value"... | Validace data. | [
"Validace",
"data",
"."
] | 28a8f0b6743308c705eb0c17e985e0ed065b692e | https://github.com/JakubMrozek/eet/blob/28a8f0b6743308c705eb0c17e985e0ed065b692e/lib/validate.js#L67-L71 |
29,833 | JakubMrozek/eet | lib/validate.js | httpResponse | function httpResponse (response) {
if (!response) {
throw new Error('Unable to parse response.')
}
const errorAttrs = response.Chyba && response.Chyba.attributes
if (errorAttrs) {
throw new Error(`${response.Chyba.$value} (${errorAttrs.kod})`)
}
const body = response.Potvrzeni && response.Potvrzeni.... | javascript | function httpResponse (response) {
if (!response) {
throw new Error('Unable to parse response.')
}
const errorAttrs = response.Chyba && response.Chyba.attributes
if (errorAttrs) {
throw new Error(`${response.Chyba.$value} (${errorAttrs.kod})`)
}
const body = response.Potvrzeni && response.Potvrzeni.... | [
"function",
"httpResponse",
"(",
"response",
")",
"{",
"if",
"(",
"!",
"response",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Unable to parse response.'",
")",
"}",
"const",
"errorAttrs",
"=",
"response",
".",
"Chyba",
"&&",
"response",
".",
"Chyba",
".",
"... | Zpracuje chybnou odpoved. | [
"Zpracuje",
"chybnou",
"odpoved",
"."
] | 28a8f0b6743308c705eb0c17e985e0ed065b692e | https://github.com/JakubMrozek/eet/blob/28a8f0b6743308c705eb0c17e985e0ed065b692e/lib/validate.js#L98-L111 |
29,834 | grasshopper-cms/grasshopper-api-js | lib/routes/social/pinterest.js | _createSocialAccount | function _createSocialAccount(){
return BB
.bind(this)
.then(function() {
return grasshopper.auth('Pinterest', this.params);
})
.then(function(token) {
this.req.session.token = new Buffer(token).toString('base64');
this.req.session.save();
... | javascript | function _createSocialAccount(){
return BB
.bind(this)
.then(function() {
return grasshopper.auth('Pinterest', this.params);
})
.then(function(token) {
this.req.session.token = new Buffer(token).toString('base64');
this.req.session.save();
... | [
"function",
"_createSocialAccount",
"(",
")",
"{",
"return",
"BB",
".",
"bind",
"(",
"this",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"grasshopper",
".",
"auth",
"(",
"'Pinterest'",
",",
"this",
".",
"params",
")",
";",
"}",
")",
"... | Function that will create a user in our system. the `auth` function will auto-create a user if there is not already one in the system. | [
"Function",
"that",
"will",
"create",
"a",
"user",
"in",
"our",
"system",
".",
"the",
"auth",
"function",
"will",
"auto",
"-",
"create",
"a",
"user",
"if",
"there",
"is",
"not",
"already",
"one",
"in",
"the",
"system",
"."
] | 05a952b8b65e3a66c8a27f5d84699ee5cf02844d | https://github.com/grasshopper-cms/grasshopper-api-js/blob/05a952b8b65e3a66c8a27f5d84699ee5cf02844d/lib/routes/social/pinterest.js#L66-L76 |
29,835 | grasshopper-cms/grasshopper-api-js | lib/routes/social/pinterest.js | _linkSocialAccount | function _linkSocialAccount(){
return BB.bind(this)
.then(_loadUserFromToken)
.then(_getUserSocialDetails)
.then(_linkIdentity)
.catch(function(){
return _createSocialAccount.call(this); // Could not link account. Create one instead.
});
} | javascript | function _linkSocialAccount(){
return BB.bind(this)
.then(_loadUserFromToken)
.then(_getUserSocialDetails)
.then(_linkIdentity)
.catch(function(){
return _createSocialAccount.call(this); // Could not link account. Create one instead.
});
} | [
"function",
"_linkSocialAccount",
"(",
")",
"{",
"return",
"BB",
".",
"bind",
"(",
"this",
")",
".",
"then",
"(",
"_loadUserFromToken",
")",
".",
"then",
"(",
"_getUserSocialDetails",
")",
".",
"then",
"(",
"_linkIdentity",
")",
".",
"catch",
"(",
"functio... | Function will link an existing account loading the current user from their token. We first load the user from token, then link identities. If there is an issue, we try to create the user. | [
"Function",
"will",
"link",
"an",
"existing",
"account",
"loading",
"the",
"current",
"user",
"from",
"their",
"token",
".",
"We",
"first",
"load",
"the",
"user",
"from",
"token",
"then",
"link",
"identities",
".",
"If",
"there",
"is",
"an",
"issue",
"we",... | 05a952b8b65e3a66c8a27f5d84699ee5cf02844d | https://github.com/grasshopper-cms/grasshopper-api-js/blob/05a952b8b65e3a66c8a27f5d84699ee5cf02844d/lib/routes/social/pinterest.js#L81-L90 |
29,836 | grasshopper-cms/grasshopper-api-js | lib/routes/social/pinterest.js | _getUserSocialDetails | function _getUserSocialDetails(){
return BB
.bind(this)
.then(function() {
return pinterest
.query()
.get('me/?fields=id,first_name,last_name,url,username,image&access_token=' + this.params.access_token)
.request();
})
.then... | javascript | function _getUserSocialDetails(){
return BB
.bind(this)
.then(function() {
return pinterest
.query()
.get('me/?fields=id,first_name,last_name,url,username,image&access_token=' + this.params.access_token)
.request();
})
.then... | [
"function",
"_getUserSocialDetails",
"(",
")",
"{",
"return",
"BB",
".",
"bind",
"(",
"this",
")",
".",
"then",
"(",
"function",
"(",
")",
"{",
"return",
"pinterest",
".",
"query",
"(",
")",
".",
"get",
"(",
"'me/?fields=id,first_name,last_name,url,username,im... | Pinterest doesn't return any user info back with login. So go get some basic info so we can link the account. | [
"Pinterest",
"doesn",
"t",
"return",
"any",
"user",
"info",
"back",
"with",
"login",
".",
"So",
"go",
"get",
"some",
"basic",
"info",
"so",
"we",
"can",
"link",
"the",
"account",
"."
] | 05a952b8b65e3a66c8a27f5d84699ee5cf02844d | https://github.com/grasshopper-cms/grasshopper-api-js/blob/05a952b8b65e3a66c8a27f5d84699ee5cf02844d/lib/routes/social/pinterest.js#L105-L117 |
29,837 | grasshopper-cms/grasshopper-api-js | lib/routes/social/pinterest.js | _linkIdentity | function _linkIdentity() {
var identityOptions = {
id: this.socialUserInfo.id,
accessToken: this.params.access_token,
screen_name: this.socialUserInfo.username
};
return BB.resolve(grasshopper.request(this.token).users.linkIdentity(this.user._id.toString(), 'pinteres... | javascript | function _linkIdentity() {
var identityOptions = {
id: this.socialUserInfo.id,
accessToken: this.params.access_token,
screen_name: this.socialUserInfo.username
};
return BB.resolve(grasshopper.request(this.token).users.linkIdentity(this.user._id.toString(), 'pinteres... | [
"function",
"_linkIdentity",
"(",
")",
"{",
"var",
"identityOptions",
"=",
"{",
"id",
":",
"this",
".",
"socialUserInfo",
".",
"id",
",",
"accessToken",
":",
"this",
".",
"params",
".",
"access_token",
",",
"screen_name",
":",
"this",
".",
"socialUserInfo",
... | Utility function to link a user's pinterest info to the current user. | [
"Utility",
"function",
"to",
"link",
"a",
"user",
"s",
"pinterest",
"info",
"to",
"the",
"current",
"user",
"."
] | 05a952b8b65e3a66c8a27f5d84699ee5cf02844d | https://github.com/grasshopper-cms/grasshopper-api-js/blob/05a952b8b65e3a66c8a27f5d84699ee5cf02844d/lib/routes/social/pinterest.js#L120-L128 |
29,838 | wmfs/tymly-core | lib/boot/refs/first-pass/index.js | firstPass | function firstPass (loadedComponents, messages) {
messages.heading('Reference resolution - first pass')
const components = loadedComponents.blueprintComponents
const tymlyRefs = loadedComponents.blueprintRefs
const resolutions = findFirstPassResolutions(tymlyRefs, components)
if (!resolutions) {
messag... | javascript | function firstPass (loadedComponents, messages) {
messages.heading('Reference resolution - first pass')
const components = loadedComponents.blueprintComponents
const tymlyRefs = loadedComponents.blueprintRefs
const resolutions = findFirstPassResolutions(tymlyRefs, components)
if (!resolutions) {
messag... | [
"function",
"firstPass",
"(",
"loadedComponents",
",",
"messages",
")",
"{",
"messages",
".",
"heading",
"(",
"'Reference resolution - first pass'",
")",
"const",
"components",
"=",
"loadedComponents",
".",
"blueprintComponents",
"const",
"tymlyRefs",
"=",
"loadedCompon... | First pass through the references. None of the services have yet been booted, but we can resolve static references | [
"First",
"pass",
"through",
"the",
"references",
".",
"None",
"of",
"the",
"services",
"have",
"yet",
"been",
"booted",
"but",
"we",
"can",
"resolve",
"static",
"references"
] | 7f05f7b8c2a1c09b03bb4a6ac34013ff4c9edfee | https://github.com/wmfs/tymly-core/blob/7f05f7b8c2a1c09b03bb4a6ac34013ff4c9edfee/lib/boot/refs/first-pass/index.js#L6-L20 |
29,839 | benjamn/arson | index.js | getArrayOfHoles | function getArrayOfHoles(length) {
var holyLen = HOLY_ARRAY.length;
if (length > holyLen) {
HOLY_ARRAY.length = length;
for (var i = holyLen; i < length; ++i) {
HOLY_ARRAY[i] = ARRAY_HOLE_INDEX;
}
}
return HOLY_ARRAY.slice(0, length);
} | javascript | function getArrayOfHoles(length) {
var holyLen = HOLY_ARRAY.length;
if (length > holyLen) {
HOLY_ARRAY.length = length;
for (var i = holyLen; i < length; ++i) {
HOLY_ARRAY[i] = ARRAY_HOLE_INDEX;
}
}
return HOLY_ARRAY.slice(0, length);
} | [
"function",
"getArrayOfHoles",
"(",
"length",
")",
"{",
"var",
"holyLen",
"=",
"HOLY_ARRAY",
".",
"length",
";",
"if",
"(",
"length",
">",
"holyLen",
")",
"{",
"HOLY_ARRAY",
".",
"length",
"=",
"length",
";",
"for",
"(",
"var",
"i",
"=",
"holyLen",
";"... | Returns an array of the given length filled with ARRAY_HOLE_INDEX. | [
"Returns",
"an",
"array",
"of",
"the",
"given",
"length",
"filled",
"with",
"ARRAY_HOLE_INDEX",
"."
] | aeee18764c9901759762d2f011589caea9e768e1 | https://github.com/benjamn/arson/blob/aeee18764c9901759762d2f011589caea9e768e1/index.js#L39-L49 |
29,840 | canjs/can-construct | can-construct.js | function (what, oldProps, propName, val) {
Object.defineProperty(what, propName, {value: val, configurable: true, enumerable: true, writable: true});
} | javascript | function (what, oldProps, propName, val) {
Object.defineProperty(what, propName, {value: val, configurable: true, enumerable: true, writable: true});
} | [
"function",
"(",
"what",
",",
"oldProps",
",",
"propName",
",",
"val",
")",
"{",
"Object",
".",
"defineProperty",
"(",
"what",
",",
"propName",
",",
"{",
"value",
":",
"val",
",",
"configurable",
":",
"true",
",",
"enumerable",
":",
"true",
",",
"writa... | used for overwriting a single property. this should be used for patching other objects the super plugin overwrites this | [
"used",
"for",
"overwriting",
"a",
"single",
"property",
".",
"this",
"should",
"be",
"used",
"for",
"patching",
"other",
"objects",
"the",
"super",
"plugin",
"overwrites",
"this"
] | 0c64cc2ccf917d705070d51416ac8cd1bda35259 | https://github.com/canjs/can-construct/blob/0c64cc2ccf917d705070d51416ac8cd1bda35259/can-construct.js#L334-L336 | |
29,841 | canjs/can-construct | can-construct.js | init | function init() {
/* jshint validthis: true */
// All construction is actually done in the init method.
if (!initializing) {
//!steal-remove-start
if(process.env.NODE_ENV !== 'production') {
if(!this || (this.constructor !== Constructor) &&
// We are being called without `new` or we are exten... | javascript | function init() {
/* jshint validthis: true */
// All construction is actually done in the init method.
if (!initializing) {
//!steal-remove-start
if(process.env.NODE_ENV !== 'production') {
if(!this || (this.constructor !== Constructor) &&
// We are being called without `new` or we are exten... | [
"function",
"init",
"(",
")",
"{",
"/* jshint validthis: true */",
"// All construction is actually done in the init method.",
"if",
"(",
"!",
"initializing",
")",
"{",
"//!steal-remove-start",
"if",
"(",
"process",
".",
"env",
".",
"NODE_ENV",
"!==",
"'production'",
")... | !steal-remove-end The dummy class constructor. | [
"!steal",
"-",
"remove",
"-",
"end",
"The",
"dummy",
"class",
"constructor",
"."
] | 0c64cc2ccf917d705070d51416ac8cd1bda35259 | https://github.com/canjs/can-construct/blob/0c64cc2ccf917d705070d51416ac8cd1bda35259/can-construct.js#L642-L662 |
29,842 | grasshopper-cms/grasshopper-core-nodejs | lib/event/filter.js | findMatch | function findMatch(filters, listener){
var handlers = [],
isMatch = true;
if( !_.isUndefined(listener.filters.nodes) && listener.filters.nodes.length > 0 ) {
isMatch = !_.isUndefined( _.find( listener.filters.nodes , function(node) {
return (node === filters.node... | javascript | function findMatch(filters, listener){
var handlers = [],
isMatch = true;
if( !_.isUndefined(listener.filters.nodes) && listener.filters.nodes.length > 0 ) {
isMatch = !_.isUndefined( _.find( listener.filters.nodes , function(node) {
return (node === filters.node... | [
"function",
"findMatch",
"(",
"filters",
",",
"listener",
")",
"{",
"var",
"handlers",
"=",
"[",
"]",
",",
"isMatch",
"=",
"true",
";",
"if",
"(",
"!",
"_",
".",
"isUndefined",
"(",
"listener",
".",
"filters",
".",
"nodes",
")",
"&&",
"listener",
"."... | Function will look at the filters that have been passed in to the module through an
emit call and compair them to the filters that are attached to all of the listeners.
If there are matches the function will return an array of event handlers that
match the criteria.
@param filters - Event filters that are passed in th... | [
"Function",
"will",
"look",
"at",
"the",
"filters",
"that",
"have",
"been",
"passed",
"in",
"to",
"the",
"module",
"through",
"an",
"emit",
"call",
"and",
"compair",
"them",
"to",
"the",
"filters",
"that",
"are",
"attached",
"to",
"all",
"of",
"the",
"li... | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/event/filter.js#L17-L51 |
29,843 | grasshopper-cms/grasshopper-core-nodejs | lib/event/filter.js | filterListeners | function filterListeners (listenerCollection) {
return function(filters) {
var handlers = [];
_.each(listenerCollection, function(listener){
handlers = handlers.concat( findMatch(filters, listener) );
});
return handlers;
};
} | javascript | function filterListeners (listenerCollection) {
return function(filters) {
var handlers = [];
_.each(listenerCollection, function(listener){
handlers = handlers.concat( findMatch(filters, listener) );
});
return handlers;
};
} | [
"function",
"filterListeners",
"(",
"listenerCollection",
")",
"{",
"return",
"function",
"(",
"filters",
")",
"{",
"var",
"handlers",
"=",
"[",
"]",
";",
"_",
".",
"each",
"(",
"listenerCollection",
",",
"function",
"(",
"listener",
")",
"{",
"handlers",
... | Function that accepts a collection of listeners and inspects each one to determine
if their handler should be called.
@param listenerCollection
@returns {Function} | [
"Function",
"that",
"accepts",
"a",
"collection",
"of",
"listeners",
"and",
"inspects",
"each",
"one",
"to",
"determine",
"if",
"their",
"handler",
"should",
"be",
"called",
"."
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/event/filter.js#L60-L70 |
29,844 | casetext/fireproof | lib/demux.js | Demux | function Demux(refs, limit) {
if (!(this instanceof Fireproof.Demux)) {
return new Fireproof.Demux(refs);
} else if (arguments.length > 1 && !Array.isArray(refs)) {
refs = Array.prototype.slice.call(arguments, 0);
}
this._limit = (limit !== undefined ? limit : true);
this._refs = refs;
this._posit... | javascript | function Demux(refs, limit) {
if (!(this instanceof Fireproof.Demux)) {
return new Fireproof.Demux(refs);
} else if (arguments.length > 1 && !Array.isArray(refs)) {
refs = Array.prototype.slice.call(arguments, 0);
}
this._limit = (limit !== undefined ? limit : true);
this._refs = refs;
this._posit... | [
"function",
"Demux",
"(",
"refs",
",",
"limit",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"Fireproof",
".",
"Demux",
")",
")",
"{",
"return",
"new",
"Fireproof",
".",
"Demux",
"(",
"refs",
")",
";",
"}",
"else",
"if",
"(",
"arguments",
"... | A helper object for retrieving sorted Firebase objects from multiple
locations.
@constructor Fireproof.Demux
@static
@param {Array} refs a list of Fireproof object references to draw from.
@param {boolean} [limitToFirst] Whether to use "limitToFirst" to restrict the length
of queries to Firebase. True by default. Set t... | [
"A",
"helper",
"object",
"for",
"retrieving",
"sorted",
"Firebase",
"objects",
"from",
"multiple",
"locations",
"."
] | a568157310d965d2c115e5a3c9e8287fc8fe021b | https://github.com/casetext/fireproof/blob/a568157310d965d2c115e5a3c9e8287fc8fe021b/lib/demux.js#L12-L38 |
29,845 | reddit/node-build | lib/uploadToSentry.js | createRelease | function createRelease(endpoint, version) {
return new Promise(function(resolve, reject) {
superagent
.post(endpoint)
.set(HEADERS)
.send({ version: version })
.end(function(err, res) {
if (!err) {
console.log('Sentry - Pushed release. Version: ' + version);
res... | javascript | function createRelease(endpoint, version) {
return new Promise(function(resolve, reject) {
superagent
.post(endpoint)
.set(HEADERS)
.send({ version: version })
.end(function(err, res) {
if (!err) {
console.log('Sentry - Pushed release. Version: ' + version);
res... | [
"function",
"createRelease",
"(",
"endpoint",
",",
"version",
")",
"{",
"return",
"new",
"Promise",
"(",
"function",
"(",
"resolve",
",",
"reject",
")",
"{",
"superagent",
".",
"post",
"(",
"endpoint",
")",
".",
"set",
"(",
"HEADERS",
")",
".",
"send",
... | Creates a Sentry release, a versioned collection of compiled js and their
sourcemaps.
@param {String} endpoint
The endpoint this release is being pushed to
@param {String} version
The version for this release | [
"Creates",
"a",
"Sentry",
"release",
"a",
"versioned",
"collection",
"of",
"compiled",
"js",
"and",
"their",
"sourcemaps",
"."
] | af30dc8c637631b177ae33a1984a44ffa839914b | https://github.com/reddit/node-build/blob/af30dc8c637631b177ae33a1984a44ffa839914b/lib/uploadToSentry.js#L20-L35 |
29,846 | reddit/node-build | lib/uploadToSentry.js | uploadFile | function uploadFile(endpoint, releaseVersion, filePath) {
// sentry lets you use the tilde to indicate it just looks at relative locations
// instead of relying on the host/domain.
var IGNORE_DOMAIN = '~';
var staticBase = process.env.STATIC_BASE;
var IGNORE_PATH = staticBase ? url.parse(staticBase).path + '/... | javascript | function uploadFile(endpoint, releaseVersion, filePath) {
// sentry lets you use the tilde to indicate it just looks at relative locations
// instead of relying on the host/domain.
var IGNORE_DOMAIN = '~';
var staticBase = process.env.STATIC_BASE;
var IGNORE_PATH = staticBase ? url.parse(staticBase).path + '/... | [
"function",
"uploadFile",
"(",
"endpoint",
",",
"releaseVersion",
",",
"filePath",
")",
"{",
"// sentry lets you use the tilde to indicate it just looks at relative locations",
"// instead of relying on the host/domain.",
"var",
"IGNORE_DOMAIN",
"=",
"'~'",
";",
"var",
"staticBas... | Uploads a single file to a selected release.
@param {String} endpoint
The endpoint to push these files to
@param {String} releaseVersion
The release version for this file
@param {String} filePath
The absolute file path for the file we want to upload to the release | [
"Uploads",
"a",
"single",
"file",
"to",
"a",
"selected",
"release",
"."
] | af30dc8c637631b177ae33a1984a44ffa839914b | https://github.com/reddit/node-build/blob/af30dc8c637631b177ae33a1984a44ffa839914b/lib/uploadToSentry.js#L46-L78 |
29,847 | reddit/node-build | lib/uploadToSentry.js | uploadToSentry | function uploadToSentry(projectSlug, orgSlug, releaseVersion, assets) {
var releaseEndpoint = makeUrl(projectSlug, orgSlug);
var uploadEndpoint = releaseEndpoint + releaseVersion + '/files/';
createRelease(releaseEndpoint, releaseVersion)
.then(function() {
return Promise.all(assets.map(uploadFile.bind... | javascript | function uploadToSentry(projectSlug, orgSlug, releaseVersion, assets) {
var releaseEndpoint = makeUrl(projectSlug, orgSlug);
var uploadEndpoint = releaseEndpoint + releaseVersion + '/files/';
createRelease(releaseEndpoint, releaseVersion)
.then(function() {
return Promise.all(assets.map(uploadFile.bind... | [
"function",
"uploadToSentry",
"(",
"projectSlug",
",",
"orgSlug",
",",
"releaseVersion",
",",
"assets",
")",
"{",
"var",
"releaseEndpoint",
"=",
"makeUrl",
"(",
"projectSlug",
",",
"orgSlug",
")",
";",
"var",
"uploadEndpoint",
"=",
"releaseEndpoint",
"+",
"relea... | Creates a Sentry release and pushes the relevant assets to that release.
@param {String} projectName
The Sentry project this release belongs to
@param {String} releaseVersion
The release version for the js assets
@param {Array} assets
An array of filepaths to the assets that will be uploaded | [
"Creates",
"a",
"Sentry",
"release",
"and",
"pushes",
"the",
"relevant",
"assets",
"to",
"that",
"release",
"."
] | af30dc8c637631b177ae33a1984a44ffa839914b | https://github.com/reddit/node-build/blob/af30dc8c637631b177ae33a1984a44ffa839914b/lib/uploadToSentry.js#L89-L103 |
29,848 | gilt/swig | packages/swig-cli/index.js | tell | function tell(name, taskInfo) {
if (swig.tasks[name]) {
console.log(`Task '${name}' has been overridden by a local installation`.yellow);
}
swig.tasks[name] = _.extend({
description: '<unknown>',
flags: {},
}, taskInfo);
} | javascript | function tell(name, taskInfo) {
if (swig.tasks[name]) {
console.log(`Task '${name}' has been overridden by a local installation`.yellow);
}
swig.tasks[name] = _.extend({
description: '<unknown>',
flags: {},
}, taskInfo);
} | [
"function",
"tell",
"(",
"name",
",",
"taskInfo",
")",
"{",
"if",
"(",
"swig",
".",
"tasks",
"[",
"name",
"]",
")",
"{",
"console",
".",
"log",
"(",
"`",
"${",
"name",
"}",
"`",
".",
"yellow",
")",
";",
"}",
"swig",
".",
"tasks",
"[",
"name",
... | allows a task to tell swig about itself | [
"allows",
"a",
"task",
"to",
"tell",
"swig",
"about",
"itself"
] | 499e83d60dea7208640549056d99988b29177980 | https://github.com/gilt/swig/blob/499e83d60dea7208640549056d99988b29177980/packages/swig-cli/index.js#L170-L179 |
29,849 | acss-io/gulp-atomizer | index.js | function (file, unused, cb) {
if (file.isNull()) {
// nothing to do
return cb(null, file)
} else if (file.isStream()) {
// file.contents is a Stream. We don't support streams
this.emit('error', new PluginError(PLUGIN_NAME, 'Streams not supported!'))
} else if (file.isBuffer()) {
... | javascript | function (file, unused, cb) {
if (file.isNull()) {
// nothing to do
return cb(null, file)
} else if (file.isStream()) {
// file.contents is a Stream. We don't support streams
this.emit('error', new PluginError(PLUGIN_NAME, 'Streams not supported!'))
} else if (file.isBuffer()) {
... | [
"function",
"(",
"file",
",",
"unused",
",",
"cb",
")",
"{",
"if",
"(",
"file",
".",
"isNull",
"(",
")",
")",
"{",
"// nothing to do",
"return",
"cb",
"(",
"null",
",",
"file",
")",
"}",
"else",
"if",
"(",
"file",
".",
"isStream",
"(",
")",
")",
... | create the file handler | [
"create",
"the",
"file",
"handler"
] | 8a0e4aca88ea4d8cb701b7323fa6164887f97503 | https://github.com/acss-io/gulp-atomizer/blob/8a0e4aca88ea4d8cb701b7323fa6164887f97503/index.js#L36-L67 | |
29,850 | senecajs/seneca-mem-store | mem-store.js | do_save | function do_save(id, isnew) {
var mement = ent.data$(true, 'string')
if (undefined !== id) {
mement.id = id
}
mement.entity$ = ent.entity$
entmap[base] = entmap[base] || {}
entmap[base][name] = entmap[base][name] || {}
var prev = entmap[base][name][m... | javascript | function do_save(id, isnew) {
var mement = ent.data$(true, 'string')
if (undefined !== id) {
mement.id = id
}
mement.entity$ = ent.entity$
entmap[base] = entmap[base] || {}
entmap[base][name] = entmap[base][name] || {}
var prev = entmap[base][name][m... | [
"function",
"do_save",
"(",
"id",
",",
"isnew",
")",
"{",
"var",
"mement",
"=",
"ent",
".",
"data$",
"(",
"true",
",",
"'string'",
")",
"if",
"(",
"undefined",
"!==",
"id",
")",
"{",
"mement",
".",
"id",
"=",
"id",
"}",
"mement",
".",
"entity$",
... | The actual save logic for saving or creating and then saving the entity. | [
"The",
"actual",
"save",
"logic",
"for",
"saving",
"or",
"creating",
"and",
"then",
"saving",
"the",
"entity",
"."
] | 46a25e9fe75f85a31dc6c052f4807eaf4745fdbb | https://github.com/senecajs/seneca-mem-store/blob/46a25e9fe75f85a31dc6c052f4807eaf4745fdbb/mem-store.js#L82-L123 |
29,851 | senecajs/seneca-mem-store | mem-store.js | create_new | function create_new() {
var id
// Check if we already have an id or if
// we need to generate a new one.
if (undefined !== ent.id$) {
// Take a copy of the existing id and
// delete it from the ent object. Do
// save will handle the id for us.
id ... | javascript | function create_new() {
var id
// Check if we already have an id or if
// we need to generate a new one.
if (undefined !== ent.id$) {
// Take a copy of the existing id and
// delete it from the ent object. Do
// save will handle the id for us.
id ... | [
"function",
"create_new",
"(",
")",
"{",
"var",
"id",
"// Check if we already have an id or if",
"// we need to generate a new one.",
"if",
"(",
"undefined",
"!==",
"ent",
".",
"id$",
")",
"{",
"// Take a copy of the existing id and",
"// delete it from the ent object. Do",
"... | We will still use do_save to save the entity but we need a place to handle new entites and id concerns. | [
"We",
"will",
"still",
"use",
"do_save",
"to",
"save",
"the",
"entity",
"but",
"we",
"need",
"a",
"place",
"to",
"handle",
"new",
"entites",
"and",
"id",
"concerns",
"."
] | 46a25e9fe75f85a31dc6c052f4807eaf4745fdbb | https://github.com/senecajs/seneca-mem-store/blob/46a25e9fe75f85a31dc6c052f4807eaf4745fdbb/mem-store.js#L127-L165 |
29,852 | senecajs/seneca-mem-store | mem-store.js | listents | function listents(seneca, entmap, qent, q, done) {
var list = []
var canon = qent.canon$({ object: true })
var base = canon.base
var name = canon.name
var entset = entmap[base] ? entmap[base][name] : null
if (entset) {
if (_.isString(q)) {
var ent = entset[q]
if (ent) {
list.push(... | javascript | function listents(seneca, entmap, qent, q, done) {
var list = []
var canon = qent.canon$({ object: true })
var base = canon.base
var name = canon.name
var entset = entmap[base] ? entmap[base][name] : null
if (entset) {
if (_.isString(q)) {
var ent = entset[q]
if (ent) {
list.push(... | [
"function",
"listents",
"(",
"seneca",
",",
"entmap",
",",
"qent",
",",
"q",
",",
"done",
")",
"{",
"var",
"list",
"=",
"[",
"]",
"var",
"canon",
"=",
"qent",
".",
"canon$",
"(",
"{",
"object",
":",
"true",
"}",
")",
"var",
"base",
"=",
"canon",
... | Seneca supports a reasonable set of features in terms of listing. This function can handle sorting, skiping, limiting and general retrieval. | [
"Seneca",
"supports",
"a",
"reasonable",
"set",
"of",
"features",
"in",
"terms",
"of",
"listing",
".",
"This",
"function",
"can",
"handle",
"sorting",
"skiping",
"limiting",
"and",
"general",
"retrieval",
"."
] | 46a25e9fe75f85a31dc6c052f4807eaf4745fdbb | https://github.com/senecajs/seneca-mem-store/blob/46a25e9fe75f85a31dc6c052f4807eaf4745fdbb/mem-store.js#L329-L404 |
29,853 | grasshopper-cms/grasshopper-core-nodejs | lib/middleware/content/validate.js | validateContentType | function validateContentType(cb) {
if (!_.isUndefined(kontx.args.meta) && !_.isUndefined(kontx.args.meta.type)) {
db.contentTypes.getById(kontx.args.meta.type.toString()).then(
function(contentType) {
cb(null, contentType);
},
funct... | javascript | function validateContentType(cb) {
if (!_.isUndefined(kontx.args.meta) && !_.isUndefined(kontx.args.meta.type)) {
db.contentTypes.getById(kontx.args.meta.type.toString()).then(
function(contentType) {
cb(null, contentType);
},
funct... | [
"function",
"validateContentType",
"(",
"cb",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isUndefined",
"(",
"kontx",
".",
"args",
".",
"meta",
")",
"&&",
"!",
"_",
".",
"isUndefined",
"(",
"kontx",
".",
"args",
".",
"meta",
".",
"type",
")",
")",
"{",
... | Function will test to see if the content type is in the system. | [
"Function",
"will",
"test",
"to",
"see",
"if",
"the",
"content",
"type",
"is",
"in",
"the",
"system",
"."
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/middleware/content/validate.js#L27-L40 |
29,854 | grasshopper-cms/grasshopper-core-nodejs | lib/middleware/content/validate.js | validateFields | function validateFields(contentType, cb) {
if (_.isArray(contentType.fields)) {
async.each(contentType.fields, validateField, function(err) {
cb(err);
});
} else {
cb();
}
} | javascript | function validateFields(contentType, cb) {
if (_.isArray(contentType.fields)) {
async.each(contentType.fields, validateField, function(err) {
cb(err);
});
} else {
cb();
}
} | [
"function",
"validateFields",
"(",
"contentType",
",",
"cb",
")",
"{",
"if",
"(",
"_",
".",
"isArray",
"(",
"contentType",
".",
"fields",
")",
")",
"{",
"async",
".",
"each",
"(",
"contentType",
".",
"fields",
",",
"validateField",
",",
"function",
"(",
... | Function will iterate all the fields in the content type and check the validation rules for each one. | [
"Function",
"will",
"iterate",
"all",
"the",
"fields",
"in",
"the",
"content",
"type",
"and",
"check",
"the",
"validation",
"rules",
"for",
"each",
"one",
"."
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/middleware/content/validate.js#L43-L51 |
29,855 | grasshopper-cms/grasshopper-core-nodejs | lib/middleware/content/validate.js | validateField | function validateField(field, cb) {
if (_.isArray(field.validation)) {
async.each(field.validation, performValidation(field), function(err) {
cb(err);
});
} else {
cb();
}
} | javascript | function validateField(field, cb) {
if (_.isArray(field.validation)) {
async.each(field.validation, performValidation(field), function(err) {
cb(err);
});
} else {
cb();
}
} | [
"function",
"validateField",
"(",
"field",
",",
"cb",
")",
"{",
"if",
"(",
"_",
".",
"isArray",
"(",
"field",
".",
"validation",
")",
")",
"{",
"async",
".",
"each",
"(",
"field",
".",
"validation",
",",
"performValidation",
"(",
"field",
")",
",",
"... | Function will iterate all of the validation rules for a specific field and perform the validation rule. | [
"Function",
"will",
"iterate",
"all",
"of",
"the",
"validation",
"rules",
"for",
"a",
"specific",
"field",
"and",
"perform",
"the",
"validation",
"rule",
"."
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/middleware/content/validate.js#L54-L62 |
29,856 | grasshopper-cms/grasshopper-core-nodejs | lib/middleware/content/validate.js | performValidation | function performValidation(field) {
return function(rule, cb) {
var valueToBeValidated = kontx.args.fields[field._id],
validate = validator.get(rule);
//Undefined values do not need to be validated unless the field is required
if (rule.type === 'required' || ... | javascript | function performValidation(field) {
return function(rule, cb) {
var valueToBeValidated = kontx.args.fields[field._id],
validate = validator.get(rule);
//Undefined values do not need to be validated unless the field is required
if (rule.type === 'required' || ... | [
"function",
"performValidation",
"(",
"field",
")",
"{",
"return",
"function",
"(",
"rule",
",",
"cb",
")",
"{",
"var",
"valueToBeValidated",
"=",
"kontx",
".",
"args",
".",
"fields",
"[",
"field",
".",
"_id",
"]",
",",
"validate",
"=",
"validator",
".",... | Function actually tests the field for a specific validation rule. | [
"Function",
"actually",
"tests",
"the",
"field",
"for",
"a",
"specific",
"validation",
"rule",
"."
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/middleware/content/validate.js#L65-L105 |
29,857 | grasshopper-cms/grasshopper-core-nodejs | lib/security/providers/facebook.js | _getPersistantFacebookToken | function _getPersistantFacebookToken(){
return facebook.query()
.get('/oauth/access_token?' +
'grant_type=fb_exchange_token&' +
'client_id=' + appId + '&' +
'client_secret=' + secret + '&' +
'fb_exchange_token=' + this.options.code)
... | javascript | function _getPersistantFacebookToken(){
return facebook.query()
.get('/oauth/access_token?' +
'grant_type=fb_exchange_token&' +
'client_id=' + appId + '&' +
'client_secret=' + secret + '&' +
'fb_exchange_token=' + this.options.code)
... | [
"function",
"_getPersistantFacebookToken",
"(",
")",
"{",
"return",
"facebook",
".",
"query",
"(",
")",
".",
"get",
"(",
"'/oauth/access_token?'",
"+",
"'grant_type=fb_exchange_token&'",
"+",
"'client_id='",
"+",
"appId",
"+",
"'&'",
"+",
"'client_secret='",
"+",
... | Function will accept the passed in authentication token from FB and exchange it for a permenant token. This token will be saved to the user's identities profile. | [
"Function",
"will",
"accept",
"the",
"passed",
"in",
"authentication",
"token",
"from",
"FB",
"and",
"exchange",
"it",
"for",
"a",
"permenant",
"token",
".",
"This",
"token",
"will",
"be",
"saved",
"to",
"the",
"user",
"s",
"identities",
"profile",
"."
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/security/providers/facebook.js#L39-L55 |
29,858 | grasshopper-cms/grasshopper-core-nodejs | lib/security/providers/facebook.js | _createNewFacebookUser | function _createNewFacebookUser() {
var avatar = '',
excludedFields = ['link', 'email', 'first_name', 'last_name','picture'],
newUser;
//Set Image
if(this.socialUserInfo.picture && this.socialUserInfo.picture.data && this.socialUserInfo.picture.data.url !== ''){
avatar = this.social... | javascript | function _createNewFacebookUser() {
var avatar = '',
excludedFields = ['link', 'email', 'first_name', 'last_name','picture'],
newUser;
//Set Image
if(this.socialUserInfo.picture && this.socialUserInfo.picture.data && this.socialUserInfo.picture.data.url !== ''){
avatar = this.social... | [
"function",
"_createNewFacebookUser",
"(",
")",
"{",
"var",
"avatar",
"=",
"''",
",",
"excludedFields",
"=",
"[",
"'link'",
",",
"'email'",
",",
"'first_name'",
",",
"'last_name'",
",",
"'picture'",
"]",
",",
"newUser",
";",
"//Set Image",
"if",
"(",
"this",... | Function that takes the facebook social data and attaches it to a user in grasshopper | [
"Function",
"that",
"takes",
"the",
"facebook",
"social",
"data",
"and",
"attaches",
"it",
"to",
"a",
"user",
"in",
"grasshopper"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/security/providers/facebook.js#L97-L133 |
29,859 | grasshopper-cms/grasshopper-core-nodejs | lib/security/providers/facebook.js | _createNewToken | function _createNewToken() {
var token = uuid.v4(),
newTokenObj = {
_id: crypto.createHash(token, config.crypto.secret_passphrase),
uid: this.userInfo._id.toString(),
created: new Date().toISOString(),
type: 'facebook'
};
return db.tokens.insert(n... | javascript | function _createNewToken() {
var token = uuid.v4(),
newTokenObj = {
_id: crypto.createHash(token, config.crypto.secret_passphrase),
uid: this.userInfo._id.toString(),
created: new Date().toISOString(),
type: 'facebook'
};
return db.tokens.insert(n... | [
"function",
"_createNewToken",
"(",
")",
"{",
"var",
"token",
"=",
"uuid",
".",
"v4",
"(",
")",
",",
"newTokenObj",
"=",
"{",
"_id",
":",
"crypto",
".",
"createHash",
"(",
"token",
",",
"config",
".",
"crypto",
".",
"secret_passphrase",
")",
",",
"uid"... | Function will create a new access token in grasshopper and return it to the app | [
"Function",
"will",
"create",
"a",
"new",
"access",
"token",
"in",
"grasshopper",
"and",
"return",
"it",
"to",
"the",
"app"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/security/providers/facebook.js#L149-L159 |
29,860 | aureooms/js-itertools | lib/reduce/some.js | some | function some(iterable, n) {
if (n <= 0) return true;
for (let item of iterable) {
if (item && --n === 0) return true;
}
return false;
} | javascript | function some(iterable, n) {
if (n <= 0) return true;
for (let item of iterable) {
if (item && --n === 0) return true;
}
return false;
} | [
"function",
"some",
"(",
"iterable",
",",
"n",
")",
"{",
"if",
"(",
"n",
"<=",
"0",
")",
"return",
"true",
";",
"for",
"(",
"let",
"item",
"of",
"iterable",
")",
"{",
"if",
"(",
"item",
"&&",
"--",
"n",
"===",
"0",
")",
"return",
"true",
";",
... | Returns true if at least some of the elements of the input iterable are
truthy.
@example
some( repeat( true ) , 100 ) ; // returns true
@example
some( repeat( false ) , 0 ) ; // returns true
@example
some( repeat( false ) , 10 ) ; // loops forever
@example
some( nrepeat( true , 10 ) , 11 ) ; // returns false
@para... | [
"Returns",
"true",
"if",
"at",
"least",
"some",
"of",
"the",
"elements",
"of",
"the",
"input",
"iterable",
"are",
"truthy",
"."
] | 72bafa5f3f957ceb37bdfa87a222364fe4974be3 | https://github.com/aureooms/js-itertools/blob/72bafa5f3f957ceb37bdfa87a222364fe4974be3/lib/reduce/some.js#L30-L40 |
29,861 | grasshopper-cms/grasshopper-core-nodejs | lib/runners/users.js | roleOrSelf | function roleOrSelf (role) {
if (!_.isNumber(role)) {
role = roles[role.toUpperCase()];
}
return function validateRoleOrSelf (kontx, next) {
var userPrivLevel = roles[kontx.user.role.toUpperCase()],
passedInUserId = kontx.args[0],
err = cr... | javascript | function roleOrSelf (role) {
if (!_.isNumber(role)) {
role = roles[role.toUpperCase()];
}
return function validateRoleOrSelf (kontx, next) {
var userPrivLevel = roles[kontx.user.role.toUpperCase()],
passedInUserId = kontx.args[0],
err = cr... | [
"function",
"roleOrSelf",
"(",
"role",
")",
"{",
"if",
"(",
"!",
"_",
".",
"isNumber",
"(",
"role",
")",
")",
"{",
"role",
"=",
"roles",
"[",
"role",
".",
"toUpperCase",
"(",
")",
"]",
";",
"}",
"return",
"function",
"validateRoleOrSelf",
"(",
"kontx... | Middleware the ensures that the user either has a good enough role or is trying to get information
about themselves.
@param role
@returns {Function} | [
"Middleware",
"the",
"ensures",
"that",
"the",
"user",
"either",
"has",
"a",
"good",
"enough",
"role",
"or",
"is",
"trying",
"to",
"get",
"information",
"about",
"themselves",
"."
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/runners/users.js#L18-L41 |
29,862 | grasshopper-cms/grasshopper-core-nodejs | lib/runners/users.js | setDefaultUser | function setDefaultUser (kontx, next) {
var a = _.clone(kontx.args);
if (a.length === 0) { //No args are sent in, set first to be user id
a[0] = kontx.user._id;
}
else if (_.has(a[0], 'include') || _.has(a[0], 'exclude')) { // If first arg is options then reassign
... | javascript | function setDefaultUser (kontx, next) {
var a = _.clone(kontx.args);
if (a.length === 0) { //No args are sent in, set first to be user id
a[0] = kontx.user._id;
}
else if (_.has(a[0], 'include') || _.has(a[0], 'exclude')) { // If first arg is options then reassign
... | [
"function",
"setDefaultUser",
"(",
"kontx",
",",
"next",
")",
"{",
"var",
"a",
"=",
"_",
".",
"clone",
"(",
"kontx",
".",
"args",
")",
";",
"if",
"(",
"a",
".",
"length",
"===",
"0",
")",
"{",
"//No args are sent in, set first to be user id",
"a",
"[",
... | Middleware that will set the function argument equal to the currently logged in user id if it is left
empty. This can be used for returning back the currently logged in user's information.
@param kontx
@param next | [
"Middleware",
"that",
"will",
"set",
"the",
"function",
"argument",
"equal",
"to",
"the",
"currently",
"logged",
"in",
"user",
"id",
"if",
"it",
"is",
"left",
"empty",
".",
"This",
"can",
"be",
"used",
"for",
"returning",
"back",
"the",
"currently",
"logge... | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/runners/users.js#L49-L62 |
29,863 | grasshopper-cms/grasshopper-core-nodejs | lib/db/mongodb/mixins/fields.js | function(options){
var cleanOptions = this.parseOptions(options),
excludes = _.clone(this.privateFields),
includeExludes = [];
// If any includes are passed in through the options clean up the
// default excluded fields. A type can have some excluded ... | javascript | function(options){
var cleanOptions = this.parseOptions(options),
excludes = _.clone(this.privateFields),
includeExludes = [];
// If any includes are passed in through the options clean up the
// default excluded fields. A type can have some excluded ... | [
"function",
"(",
"options",
")",
"{",
"var",
"cleanOptions",
"=",
"this",
".",
"parseOptions",
"(",
"options",
")",
",",
"excludes",
"=",
"_",
".",
"clone",
"(",
"this",
".",
"privateFields",
")",
",",
"includeExludes",
"=",
"[",
"]",
";",
"// If any inc... | Build string variable that can be sent to mongo query to include or exclude fields in the response. Your
implementation module should set 'privateFields' so that we can use the parameter here.
@param options Query options object
@returns {string} | [
"Build",
"string",
"variable",
"that",
"can",
"be",
"sent",
"to",
"mongo",
"query",
"to",
"include",
"or",
"exclude",
"fields",
"in",
"the",
"response",
".",
"Your",
"implementation",
"module",
"should",
"set",
"privateFields",
"so",
"that",
"we",
"can",
"us... | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/db/mongodb/mixins/fields.js#L38-L69 | |
29,864 | gilt/swig | packages/swig-minify/lib/regex-replacer.js | Position | function Position(file, line, column) {
this.file = file;
this.line = line || 1;
this.column = column || 0;
} | javascript | function Position(file, line, column) {
this.file = file;
this.line = line || 1;
this.column = column || 0;
} | [
"function",
"Position",
"(",
"file",
",",
"line",
",",
"column",
")",
"{",
"this",
".",
"file",
"=",
"file",
";",
"this",
".",
"line",
"=",
"line",
"||",
"1",
";",
"this",
".",
"column",
"=",
"column",
"||",
"0",
";",
"}"
] | Handle a position in a file | [
"Handle",
"a",
"position",
"in",
"a",
"file"
] | 499e83d60dea7208640549056d99988b29177980 | https://github.com/gilt/swig/blob/499e83d60dea7208640549056d99988b29177980/packages/swig-minify/lib/regex-replacer.js#L13-L17 |
29,865 | gilt/swig | packages/swig-spec/lib/jasmine-nyan-reporter.js | function () {
function draw(color, n) {
n = Math.max(parseInt(n), 0);
write(' ');
write('\u001b[' + color + 'm' + n + '\u001b[0m');
write('\n');
}
draw(colors.green, this.passed);
draw(colors.fail, this.failed);
draw(colors.pending, this.pending + ' ');
... | javascript | function () {
function draw(color, n) {
n = Math.max(parseInt(n), 0);
write(' ');
write('\u001b[' + color + 'm' + n + '\u001b[0m');
write('\n');
}
draw(colors.green, this.passed);
draw(colors.fail, this.failed);
draw(colors.pending, this.pending + ' ');
... | [
"function",
"(",
")",
"{",
"function",
"draw",
"(",
"color",
",",
"n",
")",
"{",
"n",
"=",
"Math",
".",
"max",
"(",
"parseInt",
"(",
"n",
")",
",",
"0",
")",
";",
"write",
"(",
"' '",
")",
";",
"write",
"(",
"'\\u001b['",
"+",
"color",
"+",
"... | Draw the "scoreboard" showing the number
of passes, failures and pending tests.
@api private | [
"Draw",
"the",
"scoreboard",
"showing",
"the",
"number",
"of",
"passes",
"failures",
"and",
"pending",
"tests",
"."
] | 499e83d60dea7208640549056d99988b29177980 | https://github.com/gilt/swig/blob/499e83d60dea7208640549056d99988b29177980/packages/swig-spec/lib/jasmine-nyan-reporter.js#L261-L277 | |
29,866 | gilt/swig | packages/swig-spec/lib/jasmine-nyan-reporter.js | function () {
var self = this;
this.trajectories.forEach(function(line, index) {
write('\u001b[' + self.scoreboardWidth + 'C');
write(line.join(''));
write('\n');
});
cursor.up(this.numberOfLines);
} | javascript | function () {
var self = this;
this.trajectories.forEach(function(line, index) {
write('\u001b[' + self.scoreboardWidth + 'C');
write(line.join(''));
write('\n');
});
cursor.up(this.numberOfLines);
} | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"this",
".",
"trajectories",
".",
"forEach",
"(",
"function",
"(",
"line",
",",
"index",
")",
"{",
"write",
"(",
"'\\u001b['",
"+",
"self",
".",
"scoreboardWidth",
"+",
"'C'",
")",
";",
"wri... | Draw the rainbow.
@api private | [
"Draw",
"the",
"rainbow",
"."
] | 499e83d60dea7208640549056d99988b29177980 | https://github.com/gilt/swig/blob/499e83d60dea7208640549056d99988b29177980/packages/swig-spec/lib/jasmine-nyan-reporter.js#L300-L310 | |
29,867 | gilt/swig | packages/swig-spec/lib/jasmine-nyan-reporter.js | function () {
var self = this;
var startWidth = this.scoreboardWidth + this.trajectories[0].length;
var color = '\u001b[' + startWidth + 'C';
var padding = '';
write(color);
write('_,------,');
write('\n');
write(color);
padding = self.tick ? ' ' : ' ';
w... | javascript | function () {
var self = this;
var startWidth = this.scoreboardWidth + this.trajectories[0].length;
var color = '\u001b[' + startWidth + 'C';
var padding = '';
write(color);
write('_,------,');
write('\n');
write(color);
padding = self.tick ? ' ' : ' ';
w... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"startWidth",
"=",
"this",
".",
"scoreboardWidth",
"+",
"this",
".",
"trajectories",
"[",
"0",
"]",
".",
"length",
";",
"var",
"color",
"=",
"'\\u001b['",
"+",
"startWidth",
"+",
"'C'",... | Draw the nyan cat
@api private | [
"Draw",
"the",
"nyan",
"cat"
] | 499e83d60dea7208640549056d99988b29177980 | https://github.com/gilt/swig/blob/499e83d60dea7208640549056d99988b29177980/packages/swig-spec/lib/jasmine-nyan-reporter.js#L317-L345 | |
29,868 | aureooms/js-itertools | lib/reduce/_reduce.js | _reduce | function _reduce(accumulator, iterable, initializer) {
for (let item of iterable) {
initializer = accumulator(initializer, item);
}
return initializer;
} | javascript | function _reduce(accumulator, iterable, initializer) {
for (let item of iterable) {
initializer = accumulator(initializer, item);
}
return initializer;
} | [
"function",
"_reduce",
"(",
"accumulator",
",",
"iterable",
",",
"initializer",
")",
"{",
"for",
"(",
"let",
"item",
"of",
"iterable",
")",
"{",
"initializer",
"=",
"accumulator",
"(",
"initializer",
",",
"item",
")",
";",
"}",
"return",
"initializer",
";"... | Applies the accumulator function iteratively on the last return value of the
accumulator and the next value in the input iterable. The initial value is
the initializer parameter.
@example
_reduce( ( x , y ) => x + y , range( 10 ) , 0 ) ; // returns 45
@example
_reduce( ( x , y ) => x + y , range( 10 ) , 100 ) ; // re... | [
"Applies",
"the",
"accumulator",
"function",
"iteratively",
"on",
"the",
"last",
"return",
"value",
"of",
"the",
"accumulator",
"and",
"the",
"next",
"value",
"in",
"the",
"input",
"iterable",
".",
"The",
"initial",
"value",
"is",
"the",
"initializer",
"parame... | 72bafa5f3f957ceb37bdfa87a222364fe4974be3 | https://github.com/aureooms/js-itertools/blob/72bafa5f3f957ceb37bdfa87a222364fe4974be3/lib/reduce/_reduce.js#L23-L30 |
29,869 | gilt/swig | packages/swig-install/lib/public-directory.js | compile | function compile() {
swig.log.info('', 'Compiling module list...');
const modulesPath = path.join(swig.temp, '/**/node_modules/@gilt-tech');
const modPaths = glob.sync(modulesPath);
let dirs;
swig.log.verbose(`[compile] searching: ${modulesPath}`);
swig.log.verbose(`[compile] found module dire... | javascript | function compile() {
swig.log.info('', 'Compiling module list...');
const modulesPath = path.join(swig.temp, '/**/node_modules/@gilt-tech');
const modPaths = glob.sync(modulesPath);
let dirs;
swig.log.verbose(`[compile] searching: ${modulesPath}`);
swig.log.verbose(`[compile] found module dire... | [
"function",
"compile",
"(",
")",
"{",
"swig",
".",
"log",
".",
"info",
"(",
"''",
",",
"'Compiling module list...'",
")",
";",
"const",
"modulesPath",
"=",
"path",
".",
"join",
"(",
"swig",
".",
"temp",
",",
"'/**/node_modules/@gilt-tech'",
")",
";",
"cons... | find and compile a list of all unique modules, and their paths | [
"find",
"and",
"compile",
"a",
"list",
"of",
"all",
"unique",
"modules",
"and",
"their",
"paths"
] | 499e83d60dea7208640549056d99988b29177980 | https://github.com/gilt/swig/blob/499e83d60dea7208640549056d99988b29177980/packages/swig-install/lib/public-directory.js#L54-L101 |
29,870 | casetext/fireproof | lib/pager.js | Pager | function Pager(ref, initialCount) {
if (arguments.length < 1) {
throw new Error('Not enough arguments to Pager');
}
this._mainRef = ref.ref();
this._resetCurrentOperation();
this.hasNext = true;
this.hasPrevious = false;
var promise;
if (initialCount) {
promise = this.next(initialCount);
}... | javascript | function Pager(ref, initialCount) {
if (arguments.length < 1) {
throw new Error('Not enough arguments to Pager');
}
this._mainRef = ref.ref();
this._resetCurrentOperation();
this.hasNext = true;
this.hasPrevious = false;
var promise;
if (initialCount) {
promise = this.next(initialCount);
}... | [
"function",
"Pager",
"(",
"ref",
",",
"initialCount",
")",
"{",
"if",
"(",
"arguments",
".",
"length",
"<",
"1",
")",
"{",
"throw",
"new",
"Error",
"(",
"'Not enough arguments to Pager'",
")",
";",
"}",
"this",
".",
"_mainRef",
"=",
"ref",
".",
"ref",
... | A helper object for paging over Firebase objects.
@constructor Fireproof.Pager
@static
@param {Fireproof} ref a Firebase ref whose children you wish to page over.
@param {Number} [initialCount] The number of objects in the first page.
@property {Boolean} hasPrevious True if there are more objects before the current pag... | [
"A",
"helper",
"object",
"for",
"paging",
"over",
"Firebase",
"objects",
"."
] | a568157310d965d2c115e5a3c9e8287fc8fe021b | https://github.com/casetext/fireproof/blob/a568157310d965d2c115e5a3c9e8287fc8fe021b/lib/pager.js#L11-L32 |
29,871 | pex-gl/pex-gl | patch-gl.js | flipImageData | function flipImageData (data, width, height) {
const numComponents = data.length / (width * height)
for (let y = 0; y < height / 2; y++) {
for (let x = 0; x < width; x++) {
for (let c = 0; c < numComponents; c++) {
const i = (y * width + x) * numComponents + c
const flippedI = ((height - y... | javascript | function flipImageData (data, width, height) {
const numComponents = data.length / (width * height)
for (let y = 0; y < height / 2; y++) {
for (let x = 0; x < width; x++) {
for (let c = 0; c < numComponents; c++) {
const i = (y * width + x) * numComponents + c
const flippedI = ((height - y... | [
"function",
"flipImageData",
"(",
"data",
",",
"width",
",",
"height",
")",
"{",
"const",
"numComponents",
"=",
"data",
".",
"length",
"/",
"(",
"width",
"*",
"height",
")",
"for",
"(",
"let",
"y",
"=",
"0",
";",
"y",
"<",
"height",
"/",
"2",
";",
... | Flipping array buffer in place | [
"Flipping",
"array",
"buffer",
"in",
"place"
] | d611c6defd45676da98edb9242da9c30faeef18e | https://github.com/pex-gl/pex-gl/blob/d611c6defd45676da98edb9242da9c30faeef18e/patch-gl.js#L2-L15 |
29,872 | stealjs/steal-npm | npm-load.js | deeplyExtendPkg | function deeplyExtendPkg(a, b) {
if(!a.resolutions) {
a.resolutions = {};
}
utils.extend(a.resolutions, b.resolutions || {});
if(!a.steal) {
a.steal = {};
}
if(!b.steal) {
b.steal = {};
}
utils.extend(a.steal, b.steal, true);
} | javascript | function deeplyExtendPkg(a, b) {
if(!a.resolutions) {
a.resolutions = {};
}
utils.extend(a.resolutions, b.resolutions || {});
if(!a.steal) {
a.steal = {};
}
if(!b.steal) {
b.steal = {};
}
utils.extend(a.steal, b.steal, true);
} | [
"function",
"deeplyExtendPkg",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"!",
"a",
".",
"resolutions",
")",
"{",
"a",
".",
"resolutions",
"=",
"{",
"}",
";",
"}",
"utils",
".",
"extend",
"(",
"a",
".",
"resolutions",
",",
"b",
".",
"resolutions",
... | Deeply extend the configuration that needs to be kept from a previous bundle that runs through the build process. This makes sure that if we load different configuration for different bundles, all of it is retained for use in production. | [
"Deeply",
"extend",
"the",
"configuration",
"that",
"needs",
"to",
"be",
"kept",
"from",
"a",
"previous",
"bundle",
"that",
"runs",
"through",
"the",
"build",
"process",
".",
"This",
"makes",
"sure",
"that",
"if",
"we",
"load",
"different",
"configuration",
... | 216463c552cabe7d9dad86d754da784b5dea3d78 | https://github.com/stealjs/steal-npm/blob/216463c552cabe7d9dad86d754da784b5dea3d78/npm-load.js#L255-L269 |
29,873 | grasshopper-cms/grasshopper-core-nodejs | lib/middleware/nodes/getChildren.js | loadChild | function loadChild(node, cb){
db.nodes.getByParent(node._id.toString()).then(
function(data){
payload = payload.concat(data);
async.each(data, loadChild, cb);
}).done();
} | javascript | function loadChild(node, cb){
db.nodes.getByParent(node._id.toString()).then(
function(data){
payload = payload.concat(data);
async.each(data, loadChild, cb);
}).done();
} | [
"function",
"loadChild",
"(",
"node",
",",
"cb",
")",
"{",
"db",
".",
"nodes",
".",
"getByParent",
"(",
"node",
".",
"_id",
".",
"toString",
"(",
")",
")",
".",
"then",
"(",
"function",
"(",
"data",
")",
"{",
"payload",
"=",
"payload",
".",
"concat... | Recursive function to load children and save them into the payload | [
"Recursive",
"function",
"to",
"load",
"children",
"and",
"save",
"them",
"into",
"the",
"payload"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/middleware/nodes/getChildren.js#L21-L27 |
29,874 | grasshopper-cms/grasshopper-core-nodejs | lib/middleware/nodes/getChildren.js | setNodes | function setNodes(data){
payload = data;
if(kontx.args.deep === true){
async.eachSeries(data, loadChild, sendNext);
}
else {
sendNext();
}
} | javascript | function setNodes(data){
payload = data;
if(kontx.args.deep === true){
async.eachSeries(data, loadChild, sendNext);
}
else {
sendNext();
}
} | [
"function",
"setNodes",
"(",
"data",
")",
"{",
"payload",
"=",
"data",
";",
"if",
"(",
"kontx",
".",
"args",
".",
"deep",
"===",
"true",
")",
"{",
"async",
".",
"eachSeries",
"(",
"data",
",",
"loadChild",
",",
"sendNext",
")",
";",
"}",
"else",
"{... | Initial callback that sets the payload and kicks off the recursive method if "deep" is set to true | [
"Initial",
"callback",
"that",
"sets",
"the",
"payload",
"and",
"kicks",
"off",
"the",
"recursive",
"method",
"if",
"deep",
"is",
"set",
"to",
"true"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/middleware/nodes/getChildren.js#L30-L39 |
29,875 | reddit/node-build | lib/build.js | function() {
if (!builds.length) { return; } // this shouldn't happen
var build = builds.shift();
var buildCallback = function(stats) {
cb(build.buildName, stats);
if (builds.length) {
runNextBuild();
}
};
console.log(colors.cyan('[Starting build]'), build.buildName);
... | javascript | function() {
if (!builds.length) { return; } // this shouldn't happen
var build = builds.shift();
var buildCallback = function(stats) {
cb(build.buildName, stats);
if (builds.length) {
runNextBuild();
}
};
console.log(colors.cyan('[Starting build]'), build.buildName);
... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"builds",
".",
"length",
")",
"{",
"return",
";",
"}",
"// this shouldn't happen",
"var",
"build",
"=",
"builds",
".",
"shift",
"(",
")",
";",
"var",
"buildCallback",
"=",
"function",
"(",
"stats",
")",
"{",
... | Run each build serially so the server can do things like read an app manifest file that's genrated during the client build step. | [
"Run",
"each",
"build",
"serially",
"so",
"the",
"server",
"can",
"do",
"things",
"like",
"read",
"an",
"app",
"manifest",
"file",
"that",
"s",
"genrated",
"during",
"the",
"client",
"build",
"step",
"."
] | af30dc8c637631b177ae33a1984a44ffa839914b | https://github.com/reddit/node-build/blob/af30dc8c637631b177ae33a1984a44ffa839914b/lib/build.js#L20-L32 | |
29,876 | grasshopper-cms/grasshopper-core-nodejs | dev/server/public/admin/vendor/svg-edit-2.7/extensions/ext-overview_window.js | function(){
var portHeight=parseFloat($("#workarea").css("height"));
var portWidth=parseFloat($("#workarea").css("width"));
var portX=$("#workarea").scrollLeft();
var portY=$("#workarea").scrollTop();
var windowWidth=parseFloat($("#svgcanvas").css("width"));
var windowHeight=parseFloat($("#svgcanvas").css("... | javascript | function(){
var portHeight=parseFloat($("#workarea").css("height"));
var portWidth=parseFloat($("#workarea").css("width"));
var portX=$("#workarea").scrollLeft();
var portY=$("#workarea").scrollTop();
var windowWidth=parseFloat($("#svgcanvas").css("width"));
var windowHeight=parseFloat($("#svgcanvas").css("... | [
"function",
"(",
")",
"{",
"var",
"portHeight",
"=",
"parseFloat",
"(",
"$",
"(",
"\"#workarea\"",
")",
".",
"css",
"(",
"\"height\"",
")",
")",
";",
"var",
"portWidth",
"=",
"parseFloat",
"(",
"$",
"(",
"\"#workarea\"",
")",
".",
"css",
"(",
"\"width\... | define dynamic animation of the view box. | [
"define",
"dynamic",
"animation",
"of",
"the",
"view",
"box",
"."
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/dev/server/public/admin/vendor/svg-edit-2.7/extensions/ext-overview_window.js#L30-L49 | |
29,877 | grasshopper-cms/grasshopper-core-nodejs | dev/server/public/admin/vendor/svg-edit-2.7/extensions/ext-overview_window.js | function(){
var viewWidth=$("#svgroot").attr("width");
var viewHeight=$("#svgroot").attr("height");
var viewX=640;
var viewY=480;
if(svgedit.browser.isIE())
{
//This has only been tested with Firefox 10 and IE 9 (without chrome frame).
//I am not sure if if is Firefox or IE that is being non compli... | javascript | function(){
var viewWidth=$("#svgroot").attr("width");
var viewHeight=$("#svgroot").attr("height");
var viewX=640;
var viewY=480;
if(svgedit.browser.isIE())
{
//This has only been tested with Firefox 10 and IE 9 (without chrome frame).
//I am not sure if if is Firefox or IE that is being non compli... | [
"function",
"(",
")",
"{",
"var",
"viewWidth",
"=",
"$",
"(",
"\"#svgroot\"",
")",
".",
"attr",
"(",
"\"width\"",
")",
";",
"var",
"viewHeight",
"=",
"$",
"(",
"\"#svgroot\"",
")",
".",
"attr",
"(",
"\"height\"",
")",
";",
"var",
"viewX",
"=",
"640",... | comphensate for changes in zoom and canvas size | [
"comphensate",
"for",
"changes",
"in",
"zoom",
"and",
"canvas",
"size"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/dev/server/public/admin/vendor/svg-edit-2.7/extensions/ext-overview_window.js#L59-L82 | |
29,878 | grasshopper-cms/grasshopper-core-nodejs | dev/server/public/admin/vendor/svg-edit-2.7/extensions/ext-markers.js | getLinked | function getLinked(elem, attr) {
var str = elem.getAttribute(attr);
if(!str) {return null;}
var m = str.match(/\(\#(.*)\)/);
if(!m || m.length !== 2) {
return null;
}
return S.getElem(m[1]);
} | javascript | function getLinked(elem, attr) {
var str = elem.getAttribute(attr);
if(!str) {return null;}
var m = str.match(/\(\#(.*)\)/);
if(!m || m.length !== 2) {
return null;
}
return S.getElem(m[1]);
} | [
"function",
"getLinked",
"(",
"elem",
",",
"attr",
")",
"{",
"var",
"str",
"=",
"elem",
".",
"getAttribute",
"(",
"attr",
")",
";",
"if",
"(",
"!",
"str",
")",
"{",
"return",
"null",
";",
"}",
"var",
"m",
"=",
"str",
".",
"match",
"(",
"/",
"\\... | elem = a graphic element will have an attribute like marker-start attr - marker-start, marker-mid, or marker-end returns the marker element that is linked to the graphic element | [
"elem",
"=",
"a",
"graphic",
"element",
"will",
"have",
"an",
"attribute",
"like",
"marker",
"-",
"start",
"attr",
"-",
"marker",
"-",
"start",
"marker",
"-",
"mid",
"or",
"marker",
"-",
"end",
"returns",
"the",
"marker",
"element",
"that",
"is",
"linked... | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/dev/server/public/admin/vendor/svg-edit-2.7/extensions/ext-markers.js#L113-L121 |
29,879 | grasshopper-cms/grasshopper-core-nodejs | dev/server/public/admin/vendor/svg-edit-2.7/extensions/ext-markers.js | colorChanged | function colorChanged(elem) {
var color = elem.getAttribute('stroke');
$.each(mtypes, function(i, pos) {
var marker = getLinked(elem, 'marker-'+pos);
if (!marker) {return;}
if (!marker.attributes.se_type) {return;} // not created by this extension
var ch = marker.lastElementChild;
if (!ch) {return;}... | javascript | function colorChanged(elem) {
var color = elem.getAttribute('stroke');
$.each(mtypes, function(i, pos) {
var marker = getLinked(elem, 'marker-'+pos);
if (!marker) {return;}
if (!marker.attributes.se_type) {return;} // not created by this extension
var ch = marker.lastElementChild;
if (!ch) {return;}... | [
"function",
"colorChanged",
"(",
"elem",
")",
"{",
"var",
"color",
"=",
"elem",
".",
"getAttribute",
"(",
"'stroke'",
")",
";",
"$",
".",
"each",
"(",
"mtypes",
",",
"function",
"(",
"i",
",",
"pos",
")",
"{",
"var",
"marker",
"=",
"getLinked",
"(",
... | called when the main system modifies an object this routine changes the associated markers to be the same color | [
"called",
"when",
"the",
"main",
"system",
"modifies",
"an",
"object",
"this",
"routine",
"changes",
"the",
"associated",
"markers",
"to",
"be",
"the",
"same",
"color"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/dev/server/public/admin/vendor/svg-edit-2.7/extensions/ext-markers.js#L329-L343 |
29,880 | grasshopper-cms/grasshopper-core-nodejs | dev/server/public/admin/vendor/svg-edit-2.7/extensions/ext-markers.js | updateReferences | function updateReferences(el) {
$.each(mtypes, function (i, pos) {
var id = marker_prefix + pos + '_' + el.id;
var marker_name = 'marker-'+pos;
var marker = getLinked(el, marker_name);
if (!marker || !marker.attributes.se_type) {return;} // not created by this extension
var url = el.getAttribute(marker... | javascript | function updateReferences(el) {
$.each(mtypes, function (i, pos) {
var id = marker_prefix + pos + '_' + el.id;
var marker_name = 'marker-'+pos;
var marker = getLinked(el, marker_name);
if (!marker || !marker.attributes.se_type) {return;} // not created by this extension
var url = el.getAttribute(marker... | [
"function",
"updateReferences",
"(",
"el",
")",
"{",
"$",
".",
"each",
"(",
"mtypes",
",",
"function",
"(",
"i",
",",
"pos",
")",
"{",
"var",
"id",
"=",
"marker_prefix",
"+",
"pos",
"+",
"'_'",
"+",
"el",
".",
"id",
";",
"var",
"marker_name",
"=",
... | called when the main system creates or modifies an object primary purpose is create new markers for cloned objects | [
"called",
"when",
"the",
"main",
"system",
"creates",
"or",
"modifies",
"an",
"object",
"primary",
"purpose",
"is",
"create",
"new",
"markers",
"for",
"cloned",
"objects"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/dev/server/public/admin/vendor/svg-edit-2.7/extensions/ext-markers.js#L347-L366 |
29,881 | grasshopper-cms/grasshopper-core-nodejs | dev/server/public/admin/vendor/svg-edit-2.7/svgcanvas.js | function(elem) {
try {
// TODO: Fix issue with rotated groups. Currently they work
// fine in FF, but not in other browsers (same problem mentioned
// in Issue 339 comment #2).
var bb = svgedit.utilities.getBBox(elem);
var angle = svgedit.utilities.getRotationAngle(elem);
if ((angle && angle % 90... | javascript | function(elem) {
try {
// TODO: Fix issue with rotated groups. Currently they work
// fine in FF, but not in other browsers (same problem mentioned
// in Issue 339 comment #2).
var bb = svgedit.utilities.getBBox(elem);
var angle = svgedit.utilities.getRotationAngle(elem);
if ((angle && angle % 90... | [
"function",
"(",
"elem",
")",
"{",
"try",
"{",
"// TODO: Fix issue with rotated groups. Currently they work",
"// fine in FF, but not in other browsers (same problem mentioned",
"// in Issue 339 comment #2).",
"var",
"bb",
"=",
"svgedit",
".",
"utilities",
".",
"getBBox",
"(",
... | Make sure the expected BBox is returned if the element is a group | [
"Make",
"sure",
"the",
"expected",
"BBox",
"is",
"returned",
"if",
"the",
"element",
"is",
"a",
"group"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/dev/server/public/admin/vendor/svg-edit-2.7/svgcanvas.js#L602-L679 | |
29,882 | grasshopper-cms/grasshopper-core-nodejs | dev/server/public/admin/vendor/svg-edit-2.7/svgcanvas.js | function(m) {
console.log([m.a, m.b, m.c, m.d, m.e, m.f]);
} | javascript | function(m) {
console.log([m.a, m.b, m.c, m.d, m.e, m.f]);
} | [
"function",
"(",
"m",
")",
"{",
"console",
".",
"log",
"(",
"[",
"m",
".",
"a",
",",
"m",
".",
"b",
",",
"m",
".",
"c",
",",
"m",
".",
"d",
",",
"m",
".",
"e",
",",
"m",
".",
"f",
"]",
")",
";",
"}"
] | Debug tool to easily see the current matrix in the browser's console | [
"Debug",
"tool",
"to",
"easily",
"see",
"the",
"current",
"matrix",
"in",
"the",
"browser",
"s",
"console"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/dev/server/public/admin/vendor/svg-edit-2.7/svgcanvas.js#L1022-L1024 | |
29,883 | apostrophecms-legacy/apostrophe-pages | index.js | sanitizeSpontaneousAreas | function sanitizeSpontaneousAreas(req, data, page, callback) {
var toSanitize = [];
_.each(data, function(val, key) {
if (typeof(val) === 'object') {
if (val.type === 'area') {
if (_.has(page, key) && ((typeof(page[key]) !== 'object') || (page[key].type !== 'area'))) {
// Spo... | javascript | function sanitizeSpontaneousAreas(req, data, page, callback) {
var toSanitize = [];
_.each(data, function(val, key) {
if (typeof(val) === 'object') {
if (val.type === 'area') {
if (_.has(page, key) && ((typeof(page[key]) !== 'object') || (page[key].type !== 'area'))) {
// Spo... | [
"function",
"sanitizeSpontaneousAreas",
"(",
"req",
",",
"data",
",",
"page",
",",
"callback",
")",
"{",
"var",
"toSanitize",
"=",
"[",
"]",
";",
"_",
".",
"each",
"(",
"data",
",",
"function",
"(",
"val",
",",
"key",
")",
"{",
"if",
"(",
"typeof",
... | Both the new and edit page operations utilize this to deal with areas that arise spontaneously via page templates rather than being hardcoded in the schema. The rule is that if an otherwise unknown property is an object with a "type" sub-property set to "area", that is accepted and sanitized as an area. | [
"Both",
"the",
"new",
"and",
"edit",
"page",
"operations",
"utilize",
"this",
"to",
"deal",
"with",
"areas",
"that",
"arise",
"spontaneously",
"via",
"page",
"templates",
"rather",
"than",
"being",
"hardcoded",
"in",
"the",
"schema",
".",
"The",
"rule",
"is"... | 72eb4b1df351b1c253e9b1c2bd2fe3fff6eb71b3 | https://github.com/apostrophecms-legacy/apostrophe-pages/blob/72eb4b1df351b1c253e9b1c2bd2fe3fff6eb71b3/index.js#L1760-L1790 |
29,884 | apostrophecms-legacy/apostrophe-pages | index.js | diffVersions | function diffVersions(callback) {
var prior = null;
_.each(versions, function(version) {
if (!prior) {
version.diff = [ { value: '[NEW]', added: true } ];
} else {
version.diff = apos.diffPages(prior, version);
}
prior = version;
})... | javascript | function diffVersions(callback) {
var prior = null;
_.each(versions, function(version) {
if (!prior) {
version.diff = [ { value: '[NEW]', added: true } ];
} else {
version.diff = apos.diffPages(prior, version);
}
prior = version;
})... | [
"function",
"diffVersions",
"(",
"callback",
")",
"{",
"var",
"prior",
"=",
"null",
";",
"_",
".",
"each",
"(",
"versions",
",",
"function",
"(",
"version",
")",
"{",
"if",
"(",
"!",
"prior",
")",
"{",
"version",
".",
"diff",
"=",
"[",
"{",
"value"... | We must diff on the fly because versions get pruned over time | [
"We",
"must",
"diff",
"on",
"the",
"fly",
"because",
"versions",
"get",
"pruned",
"over",
"time"
] | 72eb4b1df351b1c253e9b1c2bd2fe3fff6eb71b3 | https://github.com/apostrophecms-legacy/apostrophe-pages/blob/72eb4b1df351b1c253e9b1c2bd2fe3fff6eb71b3/index.js#L2226-L2238 |
29,885 | grasshopper-cms/grasshopper-core-nodejs | lib/db/mongodb/nodes.js | getId | function getId(id){
if(_.isObject(id) && !_.isUndefined(id.id)){
if (objectIdRegex.test(id.id)) {
id = id.id;
}
else {
id = null;
}
}
return id;
} | javascript | function getId(id){
if(_.isObject(id) && !_.isUndefined(id.id)){
if (objectIdRegex.test(id.id)) {
id = id.id;
}
else {
id = null;
}
}
return id;
} | [
"function",
"getId",
"(",
"id",
")",
"{",
"if",
"(",
"_",
".",
"isObject",
"(",
"id",
")",
"&&",
"!",
"_",
".",
"isUndefined",
"(",
"id",
".",
"id",
")",
")",
"{",
"if",
"(",
"objectIdRegex",
".",
"test",
"(",
"id",
".",
"id",
")",
")",
"{",
... | Function will look at the id that has been passed to the module and
if it is a string send it back, if it is an object with an `id` property
then it will check to see if it is a valid mongo objectid format and then
send it back.
@param id
@returns {*} | [
"Function",
"will",
"look",
"at",
"the",
"id",
"that",
"has",
"been",
"passed",
"to",
"the",
"module",
"and",
"if",
"it",
"is",
"a",
"string",
"send",
"it",
"back",
"if",
"it",
"is",
"an",
"object",
"with",
"an",
"id",
"property",
"then",
"it",
"will... | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/db/mongodb/nodes.js#L30-L40 |
29,886 | grasshopper-cms/grasshopper-core-nodejs | dev/server/public/admin/vendor/svg-edit-2.7/extensions/ext-connector.js | init | function init() {
// Make sure all connectors have data set
$(svgcontent).find('*').each(function() {
var conn = this.getAttributeNS(se_ns, "connector");
if(conn) {
this.setAttribute('class', conn_sel.substr(1));
var conn_data = conn.split(' ');
var sbb = svgCanvas.getStrokedBBox([getElem(conn_da... | javascript | function init() {
// Make sure all connectors have data set
$(svgcontent).find('*').each(function() {
var conn = this.getAttributeNS(se_ns, "connector");
if(conn) {
this.setAttribute('class', conn_sel.substr(1));
var conn_data = conn.split(' ');
var sbb = svgCanvas.getStrokedBBox([getElem(conn_da... | [
"function",
"init",
"(",
")",
"{",
"// Make sure all connectors have data set",
"$",
"(",
"svgcontent",
")",
".",
"find",
"(",
"'*'",
")",
".",
"each",
"(",
"function",
"(",
")",
"{",
"var",
"conn",
"=",
"this",
".",
"getAttributeNS",
"(",
"se_ns",
",",
... | Do on reset | [
"Do",
"on",
"reset"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/dev/server/public/admin/vendor/svg-edit-2.7/extensions/ext-connector.js#L274-L291 |
29,887 | matmanjs/matman | packages/matman-crawler/asserts/nightmare-preload.js | error | function error(err) {
if (!(err instanceof Error)) return err
return {
code: err.code,
message: err.message,
details: err.detail,
stack: err.stack || ''
}
} | javascript | function error(err) {
if (!(err instanceof Error)) return err
return {
code: err.code,
message: err.message,
details: err.detail,
stack: err.stack || ''
}
} | [
"function",
"error",
"(",
"err",
")",
"{",
"if",
"(",
"!",
"(",
"err",
"instanceof",
"Error",
")",
")",
"return",
"err",
"return",
"{",
"code",
":",
"err",
".",
"code",
",",
"message",
":",
"err",
".",
"message",
",",
"details",
":",
"err",
".",
... | Make errors serializeable | [
"Make",
"errors",
"serializeable"
] | 2ffe0760aba4d8ccb45f056bb1aa1b8429e2c89a | https://github.com/matmanjs/matman/blob/2ffe0760aba4d8ccb45f056bb1aa1b8429e2c89a/packages/matman-crawler/asserts/nightmare-preload.js#L106-L114 |
29,888 | stratumn/js-chainscript | src/proto/chainscript_pb.js | Segment | function Segment(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function Segment(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"Segment",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if",
... | Properties of a Segment.
@memberof stratumn.chainscript
@interface ISegment
@property {stratumn.chainscript.ILink|null} [link] Segment link
@property {stratumn.chainscript.ISegmentMeta|null} [meta] Segment meta
Constructs a new Segment.
@memberof stratumn.chainscript
@classdesc Represents a Segment.
@implements ISegm... | [
"Properties",
"of",
"a",
"Segment",
"."
] | 1aba9933f18107d6d66c0b559cb07255e6398cdb | https://github.com/stratumn/js-chainscript/blob/1aba9933f18107d6d66c0b559cb07255e6398cdb/src/proto/chainscript_pb.js#L48-L53 |
29,889 | stratumn/js-chainscript | src/proto/chainscript_pb.js | SegmentMeta | function SegmentMeta(properties) {
this.evidences = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | function SegmentMeta(properties) {
this.evidences = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | [
"function",
"SegmentMeta",
"(",
"properties",
")",
"{",
"this",
".",
"evidences",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
... | Properties of a SegmentMeta.
@memberof stratumn.chainscript
@interface ISegmentMeta
@property {Uint8Array|null} [linkHash] SegmentMeta linkHash
@property {Array.<stratumn.chainscript.IEvidence>|null} [evidences] SegmentMeta evidences
Constructs a new SegmentMeta.
@memberof stratumn.chainscript
@classdesc Represents a... | [
"Properties",
"of",
"a",
"SegmentMeta",
"."
] | 1aba9933f18107d6d66c0b559cb07255e6398cdb | https://github.com/stratumn/js-chainscript/blob/1aba9933f18107d6d66c0b559cb07255e6398cdb/src/proto/chainscript_pb.js#L268-L274 |
29,890 | stratumn/js-chainscript | src/proto/chainscript_pb.js | Evidence | function Evidence(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function Evidence(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"Evidence",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if",... | Properties of an Evidence.
@memberof stratumn.chainscript
@interface IEvidence
@property {string|null} [version] Evidence version
@property {string|null} [backend] Evidence backend
@property {string|null} [provider] Evidence provider
@property {Uint8Array|null} [proof] Evidence proof
Constructs a new Evidence.
@membe... | [
"Properties",
"of",
"an",
"Evidence",
"."
] | 1aba9933f18107d6d66c0b559cb07255e6398cdb | https://github.com/stratumn/js-chainscript/blob/1aba9933f18107d6d66c0b559cb07255e6398cdb/src/proto/chainscript_pb.js#L510-L515 |
29,891 | stratumn/js-chainscript | src/proto/chainscript_pb.js | Link | function Link(properties) {
this.signatures = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | javascript | function Link(properties) {
this.signatures = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
... | [
"function",
"Link",
"(",
"properties",
")",
"{",
"this",
".",
"signatures",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys"... | Properties of a Link.
@memberof stratumn.chainscript
@interface ILink
@property {string|null} [version] Link version
@property {Uint8Array|null} [data] Link data
@property {stratumn.chainscript.ILinkMeta|null} [meta] Link meta
@property {Array.<stratumn.chainscript.ISignature>|null} [signatures] Link signatures
Const... | [
"Properties",
"of",
"a",
"Link",
"."
] | 1aba9933f18107d6d66c0b559cb07255e6398cdb | https://github.com/stratumn/js-chainscript/blob/1aba9933f18107d6d66c0b559cb07255e6398cdb/src/proto/chainscript_pb.js#L773-L779 |
29,892 | stratumn/js-chainscript | src/proto/chainscript_pb.js | Process | function Process(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function Process(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"Process",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if",
... | Properties of a Process.
@memberof stratumn.chainscript
@interface IProcess
@property {string|null} [name] Process name
@property {string|null} [state] Process state
Constructs a new Process.
@memberof stratumn.chainscript
@classdesc Represents a Process.
@implements IProcess
@constructor
@param {stratumn.chainscript... | [
"Properties",
"of",
"a",
"Process",
"."
] | 1aba9933f18107d6d66c0b559cb07255e6398cdb | https://github.com/stratumn/js-chainscript/blob/1aba9933f18107d6d66c0b559cb07255e6398cdb/src/proto/chainscript_pb.js#L1061-L1066 |
29,893 | stratumn/js-chainscript | src/proto/chainscript_pb.js | LinkMeta | function LinkMeta(properties) {
this.refs = [];
this.tags = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = p... | javascript | function LinkMeta(properties) {
this.refs = [];
this.tags = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = p... | [
"function",
"LinkMeta",
"(",
"properties",
")",
"{",
"this",
".",
"refs",
"=",
"[",
"]",
";",
"this",
".",
"tags",
"=",
"[",
"]",
";",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",... | Properties of a LinkMeta.
@memberof stratumn.chainscript
@interface ILinkMeta
@property {string|null} [clientId] LinkMeta clientId
@property {Uint8Array|null} [prevLinkHash] LinkMeta prevLinkHash
@property {number|null} [priority] LinkMeta priority
@property {Array.<stratumn.chainscript.ILinkReference>|null} [refs] Lin... | [
"Properties",
"of",
"a",
"LinkMeta",
"."
] | 1aba9933f18107d6d66c0b559cb07255e6398cdb | https://github.com/stratumn/js-chainscript/blob/1aba9933f18107d6d66c0b559cb07255e6398cdb/src/proto/chainscript_pb.js#L1280-L1287 |
29,894 | stratumn/js-chainscript | src/proto/chainscript_pb.js | LinkReference | function LinkReference(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function LinkReference(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"LinkReference",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
... | Properties of a LinkReference.
@memberof stratumn.chainscript
@interface ILinkReference
@property {Uint8Array|null} [linkHash] LinkReference linkHash
@property {string|null} [process] LinkReference process
Constructs a new LinkReference.
@memberof stratumn.chainscript
@classdesc Represents a LinkReference.
@implement... | [
"Properties",
"of",
"a",
"LinkReference",
"."
] | 1aba9933f18107d6d66c0b559cb07255e6398cdb | https://github.com/stratumn/js-chainscript/blob/1aba9933f18107d6d66c0b559cb07255e6398cdb/src/proto/chainscript_pb.js#L1741-L1746 |
29,895 | stratumn/js-chainscript | src/proto/chainscript_pb.js | Signature | function Signature(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | javascript | function Signature(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
} | [
"function",
"Signature",
"(",
"properties",
")",
"{",
"if",
"(",
"properties",
")",
"for",
"(",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"properties",
")",
",",
"i",
"=",
"0",
";",
"i",
"<",
"keys",
".",
"length",
";",
"++",
"i",
")",
"if"... | Properties of a Signature.
@memberof stratumn.chainscript
@interface ISignature
@property {string|null} [version] Signature version
@property {string|null} [type] Signature type
@property {string|null} [payloadPath] Signature payloadPath
@property {Uint8Array|null} [publicKey] Signature publicKey
@property {Uint8Array|... | [
"Properties",
"of",
"a",
"Signature",
"."
] | 1aba9933f18107d6d66c0b559cb07255e6398cdb | https://github.com/stratumn/js-chainscript/blob/1aba9933f18107d6d66c0b559cb07255e6398cdb/src/proto/chainscript_pb.js#L1963-L1968 |
29,896 | grasshopper-cms/grasshopper-core-nodejs | lib/middleware/assets/index.js | proxy | function proxy(func){
'use strict';
// Returns a middleware
return function (kontx, next){
func(kontx.args).then(
function(payload){
kontx.payload = payload;
next();
},
function(err){
next(err);
}
... | javascript | function proxy(func){
'use strict';
// Returns a middleware
return function (kontx, next){
func(kontx.args).then(
function(payload){
kontx.payload = payload;
next();
},
function(err){
next(err);
}
... | [
"function",
"proxy",
"(",
"func",
")",
"{",
"'use strict'",
";",
"// Returns a middleware",
"return",
"function",
"(",
"kontx",
",",
"next",
")",
"{",
"func",
"(",
"kontx",
".",
"args",
")",
".",
"then",
"(",
"function",
"(",
"payload",
")",
"{",
"kontx"... | Proxy function will take a assets function and wrap it with a middleware.
@param func
@returns {Function} | [
"Proxy",
"function",
"will",
"take",
"a",
"assets",
"function",
"and",
"wrap",
"it",
"with",
"a",
"middleware",
"."
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/lib/middleware/assets/index.js#L9-L24 |
29,897 | grasshopper-cms/grasshopper-core-nodejs | docs/js/vendor/flipclock/flipclock.js | function(index, obj) {
var lang = this.lang;
var lindex = index.toLowerCase();
if(typeof obj == "object") {
lang = obj;
}
if(lang && lang[lindex]) {
return lang[lindex];
}
return index;
} | javascript | function(index, obj) {
var lang = this.lang;
var lindex = index.toLowerCase();
if(typeof obj == "object") {
lang = obj;
}
if(lang && lang[lindex]) {
return lang[lindex];
}
return index;
} | [
"function",
"(",
"index",
",",
"obj",
")",
"{",
"var",
"lang",
"=",
"this",
".",
"lang",
";",
"var",
"lindex",
"=",
"index",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"typeof",
"obj",
"==",
"\"object\"",
")",
"{",
"lang",
"=",
"obj",
";",
"}"... | Localize strings into various languages
@param string The index of the localized string
@param object Optionally pass a lang object | [
"Localize",
"strings",
"into",
"various",
"languages"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/docs/js/vendor/flipclock/flipclock.js#L354-L367 | |
29,898 | grasshopper-cms/grasshopper-core-nodejs | docs/js/vendor/flipclock/flipclock.js | function(callback) {
this.face.stop();
this.timer.stop(callback);
for(var x in this.lists) {
this.lists[x].stop();
}
} | javascript | function(callback) {
this.face.stop();
this.timer.stop(callback);
for(var x in this.lists) {
this.lists[x].stop();
}
} | [
"function",
"(",
"callback",
")",
"{",
"this",
".",
"face",
".",
"stop",
"(",
")",
";",
"this",
".",
"timer",
".",
"stop",
"(",
"callback",
")",
";",
"for",
"(",
"var",
"x",
"in",
"this",
".",
"lists",
")",
"{",
"this",
".",
"lists",
"[",
"x",
... | Stops the clock | [
"Stops",
"the",
"clock"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/docs/js/vendor/flipclock/flipclock.js#L396-L403 | |
29,899 | grasshopper-cms/grasshopper-core-nodejs | docs/js/vendor/flipclock/flipclock.js | function(label, css, excludeDots) {
if(typeof css == "boolean" || !css) {
excludeDots = css;
css = label;
}
var dots = [
'<span class="'+this.factory.classes.dot+' top"></span>',
'<span class="'+this.factory.classes.dot+' bottom"></span>'
].join('');
if(excludeDots) {
dots = ''; ... | javascript | function(label, css, excludeDots) {
if(typeof css == "boolean" || !css) {
excludeDots = css;
css = label;
}
var dots = [
'<span class="'+this.factory.classes.dot+' top"></span>',
'<span class="'+this.factory.classes.dot+' bottom"></span>'
].join('');
if(excludeDots) {
dots = ''; ... | [
"function",
"(",
"label",
",",
"css",
",",
"excludeDots",
")",
"{",
"if",
"(",
"typeof",
"css",
"==",
"\"boolean\"",
"||",
"!",
"css",
")",
"{",
"excludeDots",
"=",
"css",
";",
"css",
"=",
"label",
";",
"}",
"var",
"dots",
"=",
"[",
"'<span class=\"'... | Creates a jQuery object used for the digit divider
@param mixed The divider label text
@param mixed Set true to exclude the dots in the divider.
If not set, is false. | [
"Creates",
"a",
"jQuery",
"object",
"used",
"for",
"the",
"digit",
"divider"
] | 8fabc3bfc5b18855ead443db0644608a277d0ea0 | https://github.com/grasshopper-cms/grasshopper-core-nodejs/blob/8fabc3bfc5b18855ead443db0644608a277d0ea0/docs/js/vendor/flipclock/flipclock.js#L514-L540 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.