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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
19,900 | jsdoc2md/dmd | helpers/ddata.js | parentName | function parentName (options) {
function instantiate (input) {
if (/^[A-Z]{3}/.test(input)) {
return input.replace(/^([A-Z]+)([A-Z])/, function (str, p1, p2) {
return p1.toLowerCase() + p2
})
} else {
return input.charAt(0).toLowerCase() + input.slice(1)
}
}
/* don't bother ... | javascript | function parentName (options) {
function instantiate (input) {
if (/^[A-Z]{3}/.test(input)) {
return input.replace(/^([A-Z]+)([A-Z])/, function (str, p1, p2) {
return p1.toLowerCase() + p2
})
} else {
return input.charAt(0).toLowerCase() + input.slice(1)
}
}
/* don't bother ... | [
"function",
"parentName",
"(",
"options",
")",
"{",
"function",
"instantiate",
"(",
"input",
")",
"{",
"if",
"(",
"/",
"^[A-Z]{3}",
"/",
".",
"test",
"(",
"input",
")",
")",
"{",
"return",
"input",
".",
"replace",
"(",
"/",
"^([A-Z]+)([A-Z])",
"/",
","... | returns the parent name, instantiated if necessary
@this {identifier}
@returns {string}
@static | [
"returns",
"the",
"parent",
"name",
"instantiated",
"if",
"necessary"
] | a4b31ec41f3b3a523c354877ac488da33314fc1f | https://github.com/jsdoc2md/dmd/blob/a4b31ec41f3b3a523c354877ac488da33314fc1f/helpers/ddata.js#L670-L699 |
19,901 | tejacques/crosstab | src/crosstab.js | function (iters) {
var diff = util.now() - start;
if (!setupComplete) {
if (iters <= 0 && diff > PING_TIMEOUT) {
frozenTabEnvironmentDetected();
util.events.emit('setupComplete');
... | javascript | function (iters) {
var diff = util.now() - start;
if (!setupComplete) {
if (iters <= 0 && diff > PING_TIMEOUT) {
frozenTabEnvironmentDetected();
util.events.emit('setupComplete');
... | [
"function",
"(",
"iters",
")",
"{",
"var",
"diff",
"=",
"util",
".",
"now",
"(",
")",
"-",
"start",
";",
"if",
"(",
"!",
"setupComplete",
")",
"{",
"if",
"(",
"iters",
"<=",
"0",
"&&",
"diff",
">",
"PING_TIMEOUT",
")",
"{",
"frozenTabEnvironmentDetec... | There is a nested timeout here. We'll give it 100ms timeout, with iters "yields" to the event loop. So at least iters number of blocks of javascript will be able to run covering at least 100ms | [
"There",
"is",
"a",
"nested",
"timeout",
"here",
".",
"We",
"ll",
"give",
"it",
"100ms",
"timeout",
"with",
"iters",
"yields",
"to",
"the",
"event",
"loop",
".",
"So",
"at",
"least",
"iters",
"number",
"of",
"blocks",
"of",
"javascript",
"will",
"be",
... | ae48131e46cbae77e7003fa908c7fdafa205c00b | https://github.com/tejacques/crosstab/blob/ae48131e46cbae77e7003fa908c7fdafa205c00b/src/crosstab.js#L749-L762 | |
19,902 | mongodb-js/mongodb-schema | lib/stream.js | function(value) {
var T;
if (value && value._bsontype) {
T = value._bsontype;
} else {
T = Object.prototype.toString.call(value).replace(/\[object (\w+)\]/, '$1');
}
if (T === 'Object') {
T = 'Document';
}
return T;
} | javascript | function(value) {
var T;
if (value && value._bsontype) {
T = value._bsontype;
} else {
T = Object.prototype.toString.call(value).replace(/\[object (\w+)\]/, '$1');
}
if (T === 'Object') {
T = 'Document';
}
return T;
} | [
"function",
"(",
"value",
")",
"{",
"var",
"T",
";",
"if",
"(",
"value",
"&&",
"value",
".",
"_bsontype",
")",
"{",
"T",
"=",
"value",
".",
"_bsontype",
";",
"}",
"else",
"{",
"T",
"=",
"Object",
".",
"prototype",
".",
"toString",
".",
"call",
"(... | Returns the type of value as a string. BSON type aware. Replaces `Object`
with `Document` to avoid naming conflicts with javascript Objects.
@param {Any} value value for which to get the type
@param {Any} path path (in dot notation) for which to get the type
@return {String} type as string, e.g. `ObjectId`... | [
"Returns",
"the",
"type",
"of",
"value",
"as",
"a",
"string",
".",
"BSON",
"type",
"aware",
".",
"Replaces",
"Object",
"with",
"Document",
"to",
"avoid",
"naming",
"conflicts",
"with",
"javascript",
"Objects",
"."
] | 8a11d3816dae1b5799de7cbe8f577ea5256a015a | https://github.com/mongodb-js/mongodb-schema/blob/8a11d3816dae1b5799de7cbe8f577ea5256a015a/lib/stream.js#L193-L204 | |
19,903 | mongodb-js/mongodb-schema | lib/stream.js | function(type, value) {
if (type.name === 'String') {
// crop strings at 10k characters
if (value.length > 10000) {
value = value.slice(0, 10000);
}
}
type.values.pushSome(value);
} | javascript | function(type, value) {
if (type.name === 'String') {
// crop strings at 10k characters
if (value.length > 10000) {
value = value.slice(0, 10000);
}
}
type.values.pushSome(value);
} | [
"function",
"(",
"type",
",",
"value",
")",
"{",
"if",
"(",
"type",
".",
"name",
"===",
"'String'",
")",
"{",
"// crop strings at 10k characters",
"if",
"(",
"value",
".",
"length",
">",
"10000",
")",
"{",
"value",
"=",
"value",
".",
"slice",
"(",
"0",... | handles adding the value to the value reservoir. Will also crop
strings at 10,000 characters.
@param {Object} type the type object from `addToType`
@param {Any} value the value to be added to `type.values` | [
"handles",
"adding",
"the",
"value",
"to",
"the",
"value",
"reservoir",
".",
"Will",
"also",
"crop",
"strings",
"at",
"10",
"000",
"characters",
"."
] | 8a11d3816dae1b5799de7cbe8f577ea5256a015a | https://github.com/mongodb-js/mongodb-schema/blob/8a11d3816dae1b5799de7cbe8f577ea5256a015a/lib/stream.js#L220-L228 | |
19,904 | mongodb-js/mongodb-schema | lib/stream.js | function(path, value, schema) {
var bsonType = getBSONType(value);
// if semantic type detection is enabled, the type is the semantic type
// or the original bson type if no semantic type was detected. If disabled,
// it is always the bson type.
var typeName = (options.semanticTypes) ?
getSema... | javascript | function(path, value, schema) {
var bsonType = getBSONType(value);
// if semantic type detection is enabled, the type is the semantic type
// or the original bson type if no semantic type was detected. If disabled,
// it is always the bson type.
var typeName = (options.semanticTypes) ?
getSema... | [
"function",
"(",
"path",
",",
"value",
",",
"schema",
")",
"{",
"var",
"bsonType",
"=",
"getBSONType",
"(",
"value",
")",
";",
"// if semantic type detection is enabled, the type is the semantic type",
"// or the original bson type if no semantic type was detected. If disabled,",... | Takes a field value, determines the correct type, handles recursion into
nested arrays and documents, and passes the value down to `addToValue`.
@param {String} path field path in dot notation
@param {Any} value value of the field
@param {Object} schema the updated schema object | [
"Takes",
"a",
"field",
"value",
"determines",
"the",
"correct",
"type",
"handles",
"recursion",
"into",
"nested",
"arrays",
"and",
"documents",
"and",
"passes",
"the",
"value",
"down",
"to",
"addToValue",
"."
] | 8a11d3816dae1b5799de7cbe8f577ea5256a015a | https://github.com/mongodb-js/mongodb-schema/blob/8a11d3816dae1b5799de7cbe8f577ea5256a015a/lib/stream.js#L239-L275 | |
19,905 | cfpb/capital-framework | packages/cf-expandables/src/Expandable.js | initialize | function initialize() {
const transition = new ExpandableTransition(
this.ui.content
);
this.transition = transition.init();
if ( this.ui.content.classList.contains( ExpandableTransition.CLASSES.EXPANDED ) ) {
this.ui.target.classList.add( this.classes.targetExpanded );
} else {
this.ui.target.cl... | javascript | function initialize() {
const transition = new ExpandableTransition(
this.ui.content
);
this.transition = transition.init();
if ( this.ui.content.classList.contains( ExpandableTransition.CLASSES.EXPANDED ) ) {
this.ui.target.classList.add( this.classes.targetExpanded );
} else {
this.ui.target.cl... | [
"function",
"initialize",
"(",
")",
"{",
"const",
"transition",
"=",
"new",
"ExpandableTransition",
"(",
"this",
".",
"ui",
".",
"content",
")",
";",
"this",
".",
"transition",
"=",
"transition",
".",
"init",
"(",
")",
";",
"if",
"(",
"this",
".",
"ui"... | Initialize a new expandable. | [
"Initialize",
"a",
"new",
"expandable",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/packages/cf-expandables/src/Expandable.js#L45-L68 |
19,906 | cfpb/capital-framework | packages/cf-expandables/src/Expandable.js | expandableClickHandler | function expandableClickHandler() {
this.transition.toggleExpandable();
this.toggleTargetState( this.ui.target );
if ( this.isAccordionGroup ) {
if ( this.activeAccordion ) {
this.activeAccordion = false;
} else {
Events.trigger( 'accordionActivated', { target: this } );
this.activeAcco... | javascript | function expandableClickHandler() {
this.transition.toggleExpandable();
this.toggleTargetState( this.ui.target );
if ( this.isAccordionGroup ) {
if ( this.activeAccordion ) {
this.activeAccordion = false;
} else {
Events.trigger( 'accordionActivated', { target: this } );
this.activeAcco... | [
"function",
"expandableClickHandler",
"(",
")",
"{",
"this",
".",
"transition",
".",
"toggleExpandable",
"(",
")",
";",
"this",
".",
"toggleTargetState",
"(",
"this",
".",
"ui",
".",
"target",
")",
";",
"if",
"(",
"this",
".",
"isAccordionGroup",
")",
"{",... | Event handler for when an expandable is clicked. | [
"Event",
"handler",
"for",
"when",
"an",
"expandable",
"is",
"clicked",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/packages/cf-expandables/src/Expandable.js#L84-L96 |
19,907 | cfpb/capital-framework | packages/cf-expandables/src/Expandable.js | toggleTargetState | function toggleTargetState( element ) {
if ( element.classList.contains( this.classes.targetExpanded ) ) {
this.ui.target.classList.add( this.classes.targetCollapsed );
this.ui.target.classList.remove( this.classes.targetExpanded );
} else {
this.ui.target.classList.add( this.classes.targetExpanded );
... | javascript | function toggleTargetState( element ) {
if ( element.classList.contains( this.classes.targetExpanded ) ) {
this.ui.target.classList.add( this.classes.targetCollapsed );
this.ui.target.classList.remove( this.classes.targetExpanded );
} else {
this.ui.target.classList.add( this.classes.targetExpanded );
... | [
"function",
"toggleTargetState",
"(",
"element",
")",
"{",
"if",
"(",
"element",
".",
"classList",
".",
"contains",
"(",
"this",
".",
"classes",
".",
"targetExpanded",
")",
")",
"{",
"this",
".",
"ui",
".",
"target",
".",
"classList",
".",
"add",
"(",
... | Toggle an expandable to open or closed.
@param {HTMLNode} element - The expandable target HTML DOM element. | [
"Toggle",
"an",
"expandable",
"to",
"open",
"or",
"closed",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/packages/cf-expandables/src/Expandable.js#L102-L110 |
19,908 | cfpb/capital-framework | packages/cf-expandables/src/ExpandableTransition.js | expand | function expand() {
this.dispatchEvent( 'expandBegin', { target: this } );
if ( !previousHeight || element.scrollHeight > previousHeight ) {
previousHeight = element.scrollHeight;
}
element.style.maxHeight = previousHeight + 'px';
_baseTransition.applyClass( CLASSES.EXPANDED );
return t... | javascript | function expand() {
this.dispatchEvent( 'expandBegin', { target: this } );
if ( !previousHeight || element.scrollHeight > previousHeight ) {
previousHeight = element.scrollHeight;
}
element.style.maxHeight = previousHeight + 'px';
_baseTransition.applyClass( CLASSES.EXPANDED );
return t... | [
"function",
"expand",
"(",
")",
"{",
"this",
".",
"dispatchEvent",
"(",
"'expandBegin'",
",",
"{",
"target",
":",
"this",
"}",
")",
";",
"if",
"(",
"!",
"previousHeight",
"||",
"element",
".",
"scrollHeight",
">",
"previousHeight",
")",
"{",
"previousHeigh... | Expands the expandable content
@returns {ExpandableTransition} An instance. | [
"Expands",
"the",
"expandable",
"content"
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/packages/cf-expandables/src/ExpandableTransition.js#L93-L104 |
19,909 | cfpb/capital-framework | scripts/gulp/styles.js | stylesComponents | function stylesComponents() {
return gulp.src( 'packages/' + ( component || '*' ) + '/src/*.less' )
.pipe( gulpIgnore.exclude( vf => {
/* Exclude Less files that don't share the same name as the directory
they're in. This filters out things like cf-vars.less but still
includes cf-core.less... | javascript | function stylesComponents() {
return gulp.src( 'packages/' + ( component || '*' ) + '/src/*.less' )
.pipe( gulpIgnore.exclude( vf => {
/* Exclude Less files that don't share the same name as the directory
they're in. This filters out things like cf-vars.less but still
includes cf-core.less... | [
"function",
"stylesComponents",
"(",
")",
"{",
"return",
"gulp",
".",
"src",
"(",
"'packages/'",
"+",
"(",
"component",
"||",
"'*'",
")",
"+",
"'/src/*.less'",
")",
".",
"pipe",
"(",
"gulpIgnore",
".",
"exclude",
"(",
"vf",
"=>",
"{",
"/* Exclude Less file... | Compile all the individual component files so that users can `npm install`
a single component if they desire.
@returns {PassThrough} A source stream. | [
"Compile",
"all",
"the",
"individual",
"component",
"files",
"so",
"that",
"users",
"can",
"npm",
"install",
"a",
"single",
"component",
"if",
"they",
"desire",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/scripts/gulp/styles.js#L15-L40 |
19,910 | cfpb/capital-framework | scripts/gulp/styles.js | stylesGrid | function stylesGrid() {
return gulp.src( 'packages/cf-grid/src-generated/*.less' )
.pipe( gulpLess( {
paths: [ 'node_modules/cf-*/src/' ],
compress: true
} ) )
.pipe( gulpPostcss( [
autoprefixer( {
grid: true,
browsers: BROWSER_LIST.LAST_2_PLUS_IE_8_AND_UP
} )
]... | javascript | function stylesGrid() {
return gulp.src( 'packages/cf-grid/src-generated/*.less' )
.pipe( gulpLess( {
paths: [ 'node_modules/cf-*/src/' ],
compress: true
} ) )
.pipe( gulpPostcss( [
autoprefixer( {
grid: true,
browsers: BROWSER_LIST.LAST_2_PLUS_IE_8_AND_UP
} )
]... | [
"function",
"stylesGrid",
"(",
")",
"{",
"return",
"gulp",
".",
"src",
"(",
"'packages/cf-grid/src-generated/*.less'",
")",
".",
"pipe",
"(",
"gulpLess",
"(",
"{",
"paths",
":",
"[",
"'node_modules/cf-*/src/'",
"]",
",",
"compress",
":",
"true",
"}",
")",
")... | cf-grid needs to compile cf-grid-generated.less.
@returns {PassThrough} A source stream. | [
"cf",
"-",
"grid",
"needs",
"to",
"compile",
"cf",
"-",
"grid",
"-",
"generated",
".",
"less",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/scripts/gulp/styles.js#L46-L63 |
19,911 | cfpb/capital-framework | scripts/gulp/styles.js | stylesDocs | function stylesDocs() {
return gulp.src( 'docs/src/css/main.less' )
.pipe( gulpLess( {
paths: [ 'node_modules/cf-*/src/' ],
compress: true
} ) )
.pipe( gulpPostcss( [
autoprefixer( {
browsers: BROWSER_LIST.LAST_2_PLUS_IE_8_AND_UP
} )
] ) )
.pipe( gulp.dest( 'docs/di... | javascript | function stylesDocs() {
return gulp.src( 'docs/src/css/main.less' )
.pipe( gulpLess( {
paths: [ 'node_modules/cf-*/src/' ],
compress: true
} ) )
.pipe( gulpPostcss( [
autoprefixer( {
browsers: BROWSER_LIST.LAST_2_PLUS_IE_8_AND_UP
} )
] ) )
.pipe( gulp.dest( 'docs/di... | [
"function",
"stylesDocs",
"(",
")",
"{",
"return",
"gulp",
".",
"src",
"(",
"'docs/src/css/main.less'",
")",
".",
"pipe",
"(",
"gulpLess",
"(",
"{",
"paths",
":",
"[",
"'node_modules/cf-*/src/'",
"]",
",",
"compress",
":",
"true",
"}",
")",
")",
".",
"pi... | Process CSS for the docs.
@returns {PassThrough} A source stream. | [
"Process",
"CSS",
"for",
"the",
"docs",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/scripts/gulp/styles.js#L69-L81 |
19,912 | cfpb/capital-framework | scripts/gulp/lint.js | lintStyles | function lintStyles() {
// Pass all command line flags to Stylelint.
const options = minimist( process.argv.slice( 2 ) );
const willFix = options.fix || false;
return gulp.src( [
'packages/**/*.less',
'!packages/cf-*/node_modules/**/*.less',
'!packages/cf-grid/src-generated/*.less'
] )
.pipe( ... | javascript | function lintStyles() {
// Pass all command line flags to Stylelint.
const options = minimist( process.argv.slice( 2 ) );
const willFix = options.fix || false;
return gulp.src( [
'packages/**/*.less',
'!packages/cf-*/node_modules/**/*.less',
'!packages/cf-grid/src-generated/*.less'
] )
.pipe( ... | [
"function",
"lintStyles",
"(",
")",
"{",
"// Pass all command line flags to Stylelint.",
"const",
"options",
"=",
"minimist",
"(",
"process",
".",
"argv",
".",
"slice",
"(",
"2",
")",
")",
";",
"const",
"willFix",
"=",
"options",
".",
"fix",
"||",
"false",
"... | Lints the source LESS files for errors.
@returns {Object} An output stream from gulp. | [
"Lints",
"the",
"source",
"LESS",
"files",
"for",
"errors",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/scripts/gulp/lint.js#L67-L82 |
19,913 | cfpb/capital-framework | packages/cf-tables/src/TableSortable.js | initialize | function initialize() {
this.sortClass = UNDEFINED;
this.sortColumnIndex = UNDEFINED;
this.sortDirection = UNDEFINED;
this.tableData = [];
this.bindProperties();
if ( this.ui.sortButton ) {
this.sortColumnIndex = this.getColumnIndex();
this.sortDirection = DIRECTIONS.UP;
if ( this.ui.sortButton... | javascript | function initialize() {
this.sortClass = UNDEFINED;
this.sortColumnIndex = UNDEFINED;
this.sortDirection = UNDEFINED;
this.tableData = [];
this.bindProperties();
if ( this.ui.sortButton ) {
this.sortColumnIndex = this.getColumnIndex();
this.sortDirection = DIRECTIONS.UP;
if ( this.ui.sortButton... | [
"function",
"initialize",
"(",
")",
"{",
"this",
".",
"sortClass",
"=",
"UNDEFINED",
";",
"this",
".",
"sortColumnIndex",
"=",
"UNDEFINED",
";",
"this",
".",
"sortDirection",
"=",
"UNDEFINED",
";",
"this",
".",
"tableData",
"=",
"[",
"]",
";",
"this",
".... | Function used to create computed and triggered properties. | [
"Function",
"used",
"to",
"create",
"computed",
"and",
"triggered",
"properties",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/packages/cf-tables/src/TableSortable.js#L44-L60 |
19,914 | cfpb/capital-framework | packages/cf-tables/src/TableSortable.js | bindProperties | function bindProperties() {
let sortDirection;
Object.defineProperty( this, 'sortDirection', {
configurable: true,
get: function() {
return sortDirection;
},
set: function( value ) {
if ( value === DIRECTIONS.UP ) {
this.sortClass = this.classes.sortUp;
} else if ( value =... | javascript | function bindProperties() {
let sortDirection;
Object.defineProperty( this, 'sortDirection', {
configurable: true,
get: function() {
return sortDirection;
},
set: function( value ) {
if ( value === DIRECTIONS.UP ) {
this.sortClass = this.classes.sortUp;
} else if ( value =... | [
"function",
"bindProperties",
"(",
")",
"{",
"let",
"sortDirection",
";",
"Object",
".",
"defineProperty",
"(",
"this",
",",
"'sortDirection'",
",",
"{",
"configurable",
":",
"true",
",",
"get",
":",
"function",
"(",
")",
"{",
"return",
"sortDirection",
";",... | Function used to create computed and trigger properties. | [
"Function",
"used",
"to",
"create",
"computed",
"and",
"trigger",
"properties",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/packages/cf-tables/src/TableSortable.js#L65-L82 |
19,915 | cfpb/capital-framework | packages/cf-tables/src/TableSortable.js | updateTableData | function updateTableData( columnIndex ) {
let cell;
const rows = this.ui.tableBody.querySelectorAll( 'tr' );
this.tableData = [];
columnIndex = columnIndex || this.sortColumnIndex;
for ( let i = 0, len = rows.length; i < len; ++i ) {
cell = rows[i].cells[columnIndex];
if ( cell ) {
cell = cell.... | javascript | function updateTableData( columnIndex ) {
let cell;
const rows = this.ui.tableBody.querySelectorAll( 'tr' );
this.tableData = [];
columnIndex = columnIndex || this.sortColumnIndex;
for ( let i = 0, len = rows.length; i < len; ++i ) {
cell = rows[i].cells[columnIndex];
if ( cell ) {
cell = cell.... | [
"function",
"updateTableData",
"(",
"columnIndex",
")",
"{",
"let",
"cell",
";",
"const",
"rows",
"=",
"this",
".",
"ui",
".",
"tableBody",
".",
"querySelectorAll",
"(",
"'tr'",
")",
";",
"this",
".",
"tableData",
"=",
"[",
"]",
";",
"columnIndex",
"=",
... | Function used to get, sort, and update the table data array.
@param {number} columnIndex - The index of the column used for sorting.
@returns {Array} Multidimensional array of column's cell value
and corresponding row element. | [
"Function",
"used",
"to",
"get",
"sort",
"and",
"update",
"the",
"table",
"data",
"array",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/packages/cf-tables/src/TableSortable.js#L109-L127 |
19,916 | cfpb/capital-framework | packages/cf-tables/src/TableSortable.js | updateTableDom | function updateTableDom() {
const tableBody = this.ui.tableBody;
/* Empty the table body to prepare for sorting the rows
TODO: It might make sense to use innerHTML
from a performance and garbage collection standpoint. */
while ( tableBody.lastChild ) {
tableBody.removeChild( tableBody.lastChild );
... | javascript | function updateTableDom() {
const tableBody = this.ui.tableBody;
/* Empty the table body to prepare for sorting the rows
TODO: It might make sense to use innerHTML
from a performance and garbage collection standpoint. */
while ( tableBody.lastChild ) {
tableBody.removeChild( tableBody.lastChild );
... | [
"function",
"updateTableDom",
"(",
")",
"{",
"const",
"tableBody",
"=",
"this",
".",
"ui",
".",
"tableBody",
";",
"/* Empty the table body to prepare for sorting the rows\n TODO: It might make sense to use innerHTML\n from a performance and garbage collection standpoint. */",
"... | Function used to update the table DOM.
@returns {HTMLNode} The table's <tbody> element. | [
"Function",
"used",
"to",
"update",
"the",
"table",
"DOM",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/packages/cf-tables/src/TableSortable.js#L133-L152 |
19,917 | cfpb/capital-framework | packages/cf-tables/src/TableRowLinks.js | onRowLinkClick | function onRowLinkClick( event ) {
let target = event.target;
if ( target && target.tagName === 'A' ) {
return;
}
target = closest( event.target, 'tr' );
const link = target.querySelector( 'a' );
if ( link ) {
window.location = link.getAttribute( 'href' );
}
} | javascript | function onRowLinkClick( event ) {
let target = event.target;
if ( target && target.tagName === 'A' ) {
return;
}
target = closest( event.target, 'tr' );
const link = target.querySelector( 'a' );
if ( link ) {
window.location = link.getAttribute( 'href' );
}
} | [
"function",
"onRowLinkClick",
"(",
"event",
")",
"{",
"let",
"target",
"=",
"event",
".",
"target",
";",
"if",
"(",
"target",
"&&",
"target",
".",
"tagName",
"===",
"'A'",
")",
"{",
"return",
";",
"}",
"target",
"=",
"closest",
"(",
"event",
".",
"ta... | Handle a click of the table.
@param {MouseEvent} event - Mouse event for click on the table. | [
"Handle",
"a",
"click",
"of",
"the",
"table",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/packages/cf-tables/src/TableRowLinks.js#L29-L39 |
19,918 | cfpb/capital-framework | packages/cf-atomic-component/src/components/AtomicComponent.js | AtomicComponent | function AtomicComponent( element, attributes ) {
this.element = element;
this.initializers = [];
this.uId = this.uniqueId( 'ac' );
assign( this, attributes );
this.processModifiers();
this.ensureElement();
this.setCachedElements();
this.initializers.push( this.initialize );
this.initializers.forEach(... | javascript | function AtomicComponent( element, attributes ) {
this.element = element;
this.initializers = [];
this.uId = this.uniqueId( 'ac' );
assign( this, attributes );
this.processModifiers();
this.ensureElement();
this.setCachedElements();
this.initializers.push( this.initialize );
this.initializers.forEach(... | [
"function",
"AtomicComponent",
"(",
"element",
",",
"attributes",
")",
"{",
"this",
".",
"element",
"=",
"element",
";",
"this",
".",
"initializers",
"=",
"[",
"]",
";",
"this",
".",
"uId",
"=",
"this",
".",
"uniqueId",
"(",
"'ac'",
")",
";",
"assign",... | Function as the constrcutor for the AtomicComponent.
Sets up initial instance properties and calls
necessary methods to properly instantiatie component.
@param {HTMLElement} element - The element to set as the base element.
@param {Object} attributes - Hash of attributes to set on base element. | [
"Function",
"as",
"the",
"constrcutor",
"for",
"the",
"AtomicComponent",
".",
"Sets",
"up",
"initial",
"instance",
"properties",
"and",
"calls",
"necessary",
"methods",
"to",
"properly",
"instantiatie",
"component",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/packages/cf-atomic-component/src/components/AtomicComponent.js#L27-L40 |
19,919 | cfpb/capital-framework | packages/cf-atomic-component/src/components/AtomicComponent.js | function( attributes ) {
let property;
for ( property in attributes ) {
if ( attributes.hasOwnProperty( property ) ) {
this.element.setAttribute( property, attributes[property] );
}
}
} | javascript | function( attributes ) {
let property;
for ( property in attributes ) {
if ( attributes.hasOwnProperty( property ) ) {
this.element.setAttribute( property, attributes[property] );
}
}
} | [
"function",
"(",
"attributes",
")",
"{",
"let",
"property",
";",
"for",
"(",
"property",
"in",
"attributes",
")",
"{",
"if",
"(",
"attributes",
".",
"hasOwnProperty",
"(",
"property",
")",
")",
"{",
"this",
".",
"element",
".",
"setAttribute",
"(",
"prop... | Function used to set the attributes on an element.
@param {Object} attributes - Hash of attributes to set on base element. | [
"Function",
"used",
"to",
"set",
"the",
"attributes",
"on",
"an",
"element",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/packages/cf-atomic-component/src/components/AtomicComponent.js#L165-L173 | |
19,920 | cfpb/capital-framework | scripts/utils/fs-helper.js | getBinary | function getBinary( packageName, binaryName, binaryDir ) {
binaryName = binaryName || packageName;
binaryDir = binaryDir || 'bin';
const pkgPath = require.resolve( packageName );
binaryDir = path.resolve(
path.join( path.dirname( pkgPath ), binaryDir, '/' + binaryName )
);
return binaryDir;
} | javascript | function getBinary( packageName, binaryName, binaryDir ) {
binaryName = binaryName || packageName;
binaryDir = binaryDir || 'bin';
const pkgPath = require.resolve( packageName );
binaryDir = path.resolve(
path.join( path.dirname( pkgPath ), binaryDir, '/' + binaryName )
);
return binaryDir;
} | [
"function",
"getBinary",
"(",
"packageName",
",",
"binaryName",
",",
"binaryDir",
")",
"{",
"binaryName",
"=",
"binaryName",
"||",
"packageName",
";",
"binaryDir",
"=",
"binaryDir",
"||",
"'bin'",
";",
"const",
"pkgPath",
"=",
"require",
".",
"resolve",
"(",
... | Retrieve a reference path to a binary.
@param {string} packageName - The name of the software package.
@param {string} [binaryName] - The name of the binary to retrieve.
Same as the package name by default.
@param {string} [binaryDir] - The name of the binary directory to use.
`bin` by default.
@returns {string} Path t... | [
"Retrieve",
"a",
"reference",
"path",
"to",
"a",
"binary",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/scripts/utils/fs-helper.js#L12-L20 |
19,921 | cfpb/capital-framework | packages/cf-atomic-component/src/utilities/transition/MoveTransition.js | moveLeft | function moveLeft( count ) {
count = count || 1;
const moveClasses = [
CLASSES.MOVE_LEFT,
CLASSES.MOVE_LEFT_2X,
CLASSES.MOVE_LEFT_3X
];
if ( count < 1 || count > moveClasses.length ) {
throw new Error( 'MoveTransition: moveLeft count is out of range!' );
}
_baseTransiti... | javascript | function moveLeft( count ) {
count = count || 1;
const moveClasses = [
CLASSES.MOVE_LEFT,
CLASSES.MOVE_LEFT_2X,
CLASSES.MOVE_LEFT_3X
];
if ( count < 1 || count > moveClasses.length ) {
throw new Error( 'MoveTransition: moveLeft count is out of range!' );
}
_baseTransiti... | [
"function",
"moveLeft",
"(",
"count",
")",
"{",
"count",
"=",
"count",
"||",
"1",
";",
"const",
"moveClasses",
"=",
"[",
"CLASSES",
".",
"MOVE_LEFT",
",",
"CLASSES",
".",
"MOVE_LEFT_2X",
",",
"CLASSES",
".",
"MOVE_LEFT_3X",
"]",
";",
"if",
"(",
"count",
... | Move to the left by applying a utility move class.
@param {Number} count
How many times to move left as a multiplication of the element's width.
@returns {MoveTransition} An instance. | [
"Move",
"to",
"the",
"left",
"by",
"applying",
"a",
"utility",
"move",
"class",
"."
] | fe4bee9892c38ac925b02020e49322110eafdcd6 | https://github.com/cfpb/capital-framework/blob/fe4bee9892c38ac925b02020e49322110eafdcd6/packages/cf-atomic-component/src/utilities/transition/MoveTransition.js#L67-L82 |
19,922 | bootprint/bootprint | index.js | Bootprint | function Bootprint (withData, targetDir) {
/**
* Run Bootprint and write the result to the specified target directory
* @param options {object} options passed to Customize#run()
* @returns {Promise} a promise for the completion of the build
*/
this.generate = function generate (options) {
return wit... | javascript | function Bootprint (withData, targetDir) {
/**
* Run Bootprint and write the result to the specified target directory
* @param options {object} options passed to Customize#run()
* @returns {Promise} a promise for the completion of the build
*/
this.generate = function generate (options) {
return wit... | [
"function",
"Bootprint",
"(",
"withData",
",",
"targetDir",
")",
"{",
"/**\n * Run Bootprint and write the result to the specified target directory\n * @param options {object} options passed to Customize#run()\n * @returns {Promise} a promise for the completion of the build\n */",
"this",
... | The old Bootprint interface
@constructor | [
"The",
"old",
"Bootprint",
"interface"
] | 8fed46d0add665a9d70c4edb497b9d366762e864 | https://github.com/bootprint/bootprint/blob/8fed46d0add665a9d70c4edb497b9d366762e864/index.js#L35-L55 |
19,923 | bootprint/bootprint | index.js | loadFromFileOrHttp | function loadFromFileOrHttp (fileOrUrlOrData) {
// If this is not a string,
// it is probably already the raw data.
if (typeof fileOrUrlOrData !== 'string') {
return Q(fileOrUrlOrData)
}
// otherwise load data from url or file
if (fileOrUrlOrData.match(/^https?:\/\//)) {
// Use the "request" package... | javascript | function loadFromFileOrHttp (fileOrUrlOrData) {
// If this is not a string,
// it is probably already the raw data.
if (typeof fileOrUrlOrData !== 'string') {
return Q(fileOrUrlOrData)
}
// otherwise load data from url or file
if (fileOrUrlOrData.match(/^https?:\/\//)) {
// Use the "request" package... | [
"function",
"loadFromFileOrHttp",
"(",
"fileOrUrlOrData",
")",
"{",
"// If this is not a string,",
"// it is probably already the raw data.",
"if",
"(",
"typeof",
"fileOrUrlOrData",
"!==",
"'string'",
")",
"{",
"return",
"Q",
"(",
"fileOrUrlOrData",
")",
"}",
"// otherwis... | Helper method for loading the bootprint-data
@param fileOrUrlOrData
@returns {*}
@private | [
"Helper",
"method",
"for",
"loading",
"the",
"bootprint",
"-",
"data"
] | 8fed46d0add665a9d70c4edb497b9d366762e864 | https://github.com/bootprint/bootprint/blob/8fed46d0add665a9d70c4edb497b9d366762e864/index.js#L63-L96 |
19,924 | micromatch/nanomatch | index.js | nanomatch | function nanomatch(list, patterns, options) {
patterns = utils.arrayify(patterns);
list = utils.arrayify(list);
const len = patterns.length;
if (list.length === 0 || len === 0) {
return [];
}
if (len === 1) {
return nanomatch.match(list, patterns[0], options);
}
let negated = false;
const o... | javascript | function nanomatch(list, patterns, options) {
patterns = utils.arrayify(patterns);
list = utils.arrayify(list);
const len = patterns.length;
if (list.length === 0 || len === 0) {
return [];
}
if (len === 1) {
return nanomatch.match(list, patterns[0], options);
}
let negated = false;
const o... | [
"function",
"nanomatch",
"(",
"list",
",",
"patterns",
",",
"options",
")",
"{",
"patterns",
"=",
"utils",
".",
"arrayify",
"(",
"patterns",
")",
";",
"list",
"=",
"utils",
".",
"arrayify",
"(",
"list",
")",
";",
"const",
"len",
"=",
"patterns",
".",
... | The main function takes a list of strings and one or more
glob patterns to use for matching.
```js
const nm = require('nanomatch');
nm(list, patterns[, options]);
console.log(nm(['a.js', 'a.txt'], ['*.js']));
//=> [ 'a.js' ]
```
@param {Array} `list` A list of strings to match
@param {String|Array} `patterns` One or ... | [
"The",
"main",
"function",
"takes",
"a",
"list",
"of",
"strings",
"and",
"one",
"or",
"more",
"glob",
"patterns",
"to",
"use",
"for",
"matching",
"."
] | a983ca01207f0e01a5ef5368aa9bd60e882135e9 | https://github.com/micromatch/nanomatch/blob/a983ca01207f0e01a5ef5368aa9bd60e882135e9/index.js#L39-L86 |
19,925 | micromatch/nanomatch | index.js | compose | function compose(patterns, options, matcher) {
let matchers;
return memoize('compose', String(patterns), options, function() {
return function(file) {
// delay composition until it's invoked the first time,
// after that it won't be called again
if (!matchers) {
matchers = [];
... | javascript | function compose(patterns, options, matcher) {
let matchers;
return memoize('compose', String(patterns), options, function() {
return function(file) {
// delay composition until it's invoked the first time,
// after that it won't be called again
if (!matchers) {
matchers = [];
... | [
"function",
"compose",
"(",
"patterns",
",",
"options",
",",
"matcher",
")",
"{",
"let",
"matchers",
";",
"return",
"memoize",
"(",
"'compose'",
",",
"String",
"(",
"patterns",
")",
",",
"options",
",",
"function",
"(",
")",
"{",
"return",
"function",
"(... | Compose a matcher function with the given patterns.
This allows matcher functions to be compiled once and
called multiple times. | [
"Compose",
"a",
"matcher",
"function",
"with",
"the",
"given",
"patterns",
".",
"This",
"allows",
"matcher",
"functions",
"to",
"be",
"compiled",
"once",
"and",
"called",
"multiple",
"times",
"."
] | a983ca01207f0e01a5ef5368aa9bd60e882135e9 | https://github.com/micromatch/nanomatch/blob/a983ca01207f0e01a5ef5368aa9bd60e882135e9/index.js#L777-L800 |
19,926 | danielstjules/blankshield | blankshield.js | blankshield | function blankshield(target) {
if (typeof target.length === 'undefined') {
addEventListener(target, 'click', clickListener);
} else if (typeof target !== 'string' && !(target instanceof String)) {
for (var i = 0; i < target.length; i++) {
addEventListener(target[i], 'click', clickListener);
... | javascript | function blankshield(target) {
if (typeof target.length === 'undefined') {
addEventListener(target, 'click', clickListener);
} else if (typeof target !== 'string' && !(target instanceof String)) {
for (var i = 0; i < target.length; i++) {
addEventListener(target[i], 'click', clickListener);
... | [
"function",
"blankshield",
"(",
"target",
")",
"{",
"if",
"(",
"typeof",
"target",
".",
"length",
"===",
"'undefined'",
")",
"{",
"addEventListener",
"(",
"target",
",",
"'click'",
",",
"clickListener",
")",
";",
"}",
"else",
"if",
"(",
"typeof",
"target",... | blankshield is the main function exported by the library. It accepts an
anchor element or array of elements, adding an event listener to each to
help mitigate a potential reverse tabnabbing attack. For performance, any
supplied object with a length attribute is assumed to be an array.
@param {HTMLAnchorElement|HTMLAnc... | [
"blankshield",
"is",
"the",
"main",
"function",
"exported",
"by",
"the",
"library",
".",
"It",
"accepts",
"an",
"anchor",
"element",
"or",
"array",
"of",
"elements",
"adding",
"an",
"event",
"listener",
"to",
"each",
"to",
"help",
"mitigate",
"a",
"potential... | 6e208bf25a44bf50d1a5e85ae96fee0c015d05bc | https://github.com/danielstjules/blankshield/blob/6e208bf25a44bf50d1a5e85ae96fee0c015d05bc/blankshield.js#L32-L40 |
19,927 | danielstjules/blankshield | blankshield.js | clickListener | function clickListener(e) {
var target, targetName, href, usedModifier;
// Use global event object for IE8 and below to get target
e = e || window.event;
// Won't work for IE8 and below for cases when e.srcElement
// refers not to the anchor, but to the element inside it e.g. an image
target = ... | javascript | function clickListener(e) {
var target, targetName, href, usedModifier;
// Use global event object for IE8 and below to get target
e = e || window.event;
// Won't work for IE8 and below for cases when e.srcElement
// refers not to the anchor, but to the element inside it e.g. an image
target = ... | [
"function",
"clickListener",
"(",
"e",
")",
"{",
"var",
"target",
",",
"targetName",
",",
"href",
",",
"usedModifier",
";",
"// Use global event object for IE8 and below to get target",
"e",
"=",
"e",
"||",
"window",
".",
"event",
";",
"// Won't work for IE8 and below... | An event listener that can be attached to a click event to protect against
reverse tabnabbing. It retrieves the target anchors href, and if the link
was intended to open in a new tab or window, the browser's default
behavior is canceled. Instead, the destination url is opened using
"window.open" from an injected iframe... | [
"An",
"event",
"listener",
"that",
"can",
"be",
"attached",
"to",
"a",
"click",
"event",
"to",
"protect",
"against",
"reverse",
"tabnabbing",
".",
"It",
"retrieves",
"the",
"target",
"anchors",
"href",
"and",
"if",
"the",
"link",
"was",
"intended",
"to",
"... | 6e208bf25a44bf50d1a5e85ae96fee0c015d05bc | https://github.com/danielstjules/blankshield/blob/6e208bf25a44bf50d1a5e85ae96fee0c015d05bc/blankshield.js#L94-L124 |
19,928 | danielstjules/blankshield | blankshield.js | addEventListener | function addEventListener(target, type, listener) {
var onType, prevListener;
// Modern browsers
if (target.addEventListener) {
return target.addEventListener(type, listener, false);
}
// Older browsers
onType = 'on' + type;
if (target.attachEvent) {
target.attachEvent(onType, ... | javascript | function addEventListener(target, type, listener) {
var onType, prevListener;
// Modern browsers
if (target.addEventListener) {
return target.addEventListener(type, listener, false);
}
// Older browsers
onType = 'on' + type;
if (target.attachEvent) {
target.attachEvent(onType, ... | [
"function",
"addEventListener",
"(",
"target",
",",
"type",
",",
"listener",
")",
"{",
"var",
"onType",
",",
"prevListener",
";",
"// Modern browsers",
"if",
"(",
"target",
".",
"addEventListener",
")",
"{",
"return",
"target",
".",
"addEventListener",
"(",
"t... | A cross-browser addEventListener function that adds a listener for the
supplied event type to the specified target.
@param {object} target
@param {string} type
@param {function} listener | [
"A",
"cross",
"-",
"browser",
"addEventListener",
"function",
"that",
"adds",
"a",
"listener",
"for",
"the",
"supplied",
"event",
"type",
"to",
"the",
"specified",
"target",
"."
] | 6e208bf25a44bf50d1a5e85ae96fee0c015d05bc | https://github.com/danielstjules/blankshield/blob/6e208bf25a44bf50d1a5e85ae96fee0c015d05bc/blankshield.js#L134-L155 |
19,929 | bsiddiqui/bookshelf-paranoia | index.js | skipDeleted | function skipDeleted (model, attrs, options) {
if (!options.isEager || options.parentResponse) {
let softDelete = this.model
? this.model.prototype.softDelete
: this.softDelete
if (softDelete && !options.withDeleted) {
if (settings.nullValue === null) {
options.query.w... | javascript | function skipDeleted (model, attrs, options) {
if (!options.isEager || options.parentResponse) {
let softDelete = this.model
? this.model.prototype.softDelete
: this.softDelete
if (softDelete && !options.withDeleted) {
if (settings.nullValue === null) {
options.query.w... | [
"function",
"skipDeleted",
"(",
"model",
",",
"attrs",
",",
"options",
")",
"{",
"if",
"(",
"!",
"options",
".",
"isEager",
"||",
"options",
".",
"parentResponse",
")",
"{",
"let",
"softDelete",
"=",
"this",
".",
"model",
"?",
"this",
".",
"model",
"."... | Check if the operation needs to be patched for not retrieving
soft deleted rows
@param {Object} model An instantiated bookshelf model
@param {Object} attrs The attributes that's being queried
@param {Object} options The operation option
@param {Boolean} [options.withDeleted=false] Override the default behavior
and allo... | [
"Check",
"if",
"the",
"operation",
"needs",
"to",
"be",
"patched",
"for",
"not",
"retrieving",
"soft",
"deleted",
"rows"
] | 1e5185f4bc5b20de27cacb1117890bec72b364d2 | https://github.com/bsiddiqui/bookshelf-paranoia/blob/1e5185f4bc5b20de27cacb1117890bec72b364d2/index.js#L44-L58 |
19,930 | bsiddiqui/bookshelf-paranoia | index.js | function (options) {
options = options || {}
if (this.softDelete && !options.hardDelete) {
let query = this.query()
// Add default values to options
options = merge(
{
method: 'update',
patch: true,
softDelete: true,
query: qu... | javascript | function (options) {
options = options || {}
if (this.softDelete && !options.hardDelete) {
let query = this.query()
// Add default values to options
options = merge(
{
method: 'update',
patch: true,
softDelete: true,
query: qu... | [
"function",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
"if",
"(",
"this",
".",
"softDelete",
"&&",
"!",
"options",
".",
"hardDelete",
")",
"{",
"let",
"query",
"=",
"this",
".",
"query",
"(",
")",
"// Add default values to optio... | Override the default destroy method to provide soft deletion logic
@param {Object} [options] The default options parameters from Model.destroy
@param {Boolean} [options.hardDelete=false] Override the default soft
delete behavior and allow a model to be hard deleted
@param {Number|Date} [options.date=new Date()] Use a c... | [
"Override",
"the",
"default",
"destroy",
"method",
"to",
"provide",
"soft",
"deletion",
"logic"
] | 1e5185f4bc5b20de27cacb1117890bec72b364d2 | https://github.com/bsiddiqui/bookshelf-paranoia/blob/1e5185f4bc5b20de27cacb1117890bec72b364d2/index.js#L103-L211 | |
19,931 | timbuckley/redux-saga-test-engine | src/core.js | getNextVal | function getNextVal(searchVal, mapping) {
let value
if (isMap(mapping)) {
for (let [key, val] of mapping.entries()) {
if (deepEqual(key, searchVal)) {
value = val
break
}
}
} else {
value = (mapping.find(keyVal => deepEqual(keyVal[0], searchVal)) || [])[1]
}
if (typeof... | javascript | function getNextVal(searchVal, mapping) {
let value
if (isMap(mapping)) {
for (let [key, val] of mapping.entries()) {
if (deepEqual(key, searchVal)) {
value = val
break
}
}
} else {
value = (mapping.find(keyVal => deepEqual(keyVal[0], searchVal)) || [])[1]
}
if (typeof... | [
"function",
"getNextVal",
"(",
"searchVal",
",",
"mapping",
")",
"{",
"let",
"value",
"if",
"(",
"isMap",
"(",
"mapping",
")",
")",
"{",
"for",
"(",
"let",
"[",
"key",
",",
"val",
"]",
"of",
"mapping",
".",
"entries",
"(",
")",
")",
"{",
"if",
"(... | Returns value in mapping corresponding to matching searchVal key. | [
"Returns",
"value",
"in",
"mapping",
"corresponding",
"to",
"matching",
"searchVal",
"key",
"."
] | f75fe195c6b3c839cdd16ba01f75caf74ca49734 | https://github.com/timbuckley/redux-saga-test-engine/blob/f75fe195c6b3c839cdd16ba01f75caf74ca49734/src/core.js#L49-L66 |
19,932 | timbuckley/redux-saga-test-engine | src/core.js | stringifyVal | function stringifyVal(val) {
return JSON.stringify(
val,
(key, val) => {
if (typeof val === 'function') {
if (val.name) {
return `[Function: ${val.name}]: ${val.toString()}`
} else {
return `[Function]: ${val.toString()}`
}
}
return val
},
... | javascript | function stringifyVal(val) {
return JSON.stringify(
val,
(key, val) => {
if (typeof val === 'function') {
if (val.name) {
return `[Function: ${val.name}]: ${val.toString()}`
} else {
return `[Function]: ${val.toString()}`
}
}
return val
},
... | [
"function",
"stringifyVal",
"(",
"val",
")",
"{",
"return",
"JSON",
".",
"stringify",
"(",
"val",
",",
"(",
"key",
",",
"val",
")",
"=>",
"{",
"if",
"(",
"typeof",
"val",
"===",
"'function'",
")",
"{",
"if",
"(",
"val",
".",
"name",
")",
"{",
"re... | Used to stringify yielded values. Output includes functions | [
"Used",
"to",
"stringify",
"yielded",
"values",
".",
"Output",
"includes",
"functions"
] | f75fe195c6b3c839cdd16ba01f75caf74ca49734 | https://github.com/timbuckley/redux-saga-test-engine/blob/f75fe195c6b3c839cdd16ba01f75caf74ca49734/src/core.js#L69-L84 |
19,933 | groupon/cson-parser | lib/stringify.js | stringify | function stringify(data, visitor, indent) {
if (typeof data === 'function' || typeof data === 'undefined') {
// eslint-disable-next-line consistent-return
return undefined;
}
indent = parseIndent(indent);
const normalized = JSON.parse(JSON.stringify(data, visitor));
function visitNode(node, options... | javascript | function stringify(data, visitor, indent) {
if (typeof data === 'function' || typeof data === 'undefined') {
// eslint-disable-next-line consistent-return
return undefined;
}
indent = parseIndent(indent);
const normalized = JSON.parse(JSON.stringify(data, visitor));
function visitNode(node, options... | [
"function",
"stringify",
"(",
"data",
",",
"visitor",
",",
"indent",
")",
"{",
"if",
"(",
"typeof",
"data",
"===",
"'function'",
"||",
"typeof",
"data",
"===",
"'undefined'",
")",
"{",
"// eslint-disable-next-line consistent-return",
"return",
"undefined",
";",
... | disabling consistent return so cson parser handles undefined like JSON.stringify does | [
"disabling",
"consistent",
"return",
"so",
"cson",
"parser",
"handles",
"undefined",
"like",
"JSON",
".",
"stringify",
"does"
] | 4470da600b566bedec007d7d38881a4109ad4f03 | https://github.com/groupon/cson-parser/blob/4470da600b566bedec007d7d38881a4109ad4f03/lib/stringify.js#L155-L199 |
19,934 | matrix-org/matrix-appservice-node | lib/app-service-registration.js | AppServiceRegistration | function AppServiceRegistration(appServiceUrl) {
this.url = appServiceUrl;
this.id = null;
this.hs_token = null;
this.as_token = null;
this.sender_localpart = null;
this.rate_limited = true;
this.namespaces = {
users: [],
aliases: [],
rooms: []
};
this.protoco... | javascript | function AppServiceRegistration(appServiceUrl) {
this.url = appServiceUrl;
this.id = null;
this.hs_token = null;
this.as_token = null;
this.sender_localpart = null;
this.rate_limited = true;
this.namespaces = {
users: [],
aliases: [],
rooms: []
};
this.protoco... | [
"function",
"AppServiceRegistration",
"(",
"appServiceUrl",
")",
"{",
"this",
".",
"url",
"=",
"appServiceUrl",
";",
"this",
".",
"id",
"=",
"null",
";",
"this",
".",
"hs_token",
"=",
"null",
";",
"this",
".",
"as_token",
"=",
"null",
";",
"this",
".",
... | Construct a new application service registration.
@constructor
@param {string} appServiceUrl The base URL the AS can be reached via. | [
"Construct",
"a",
"new",
"application",
"service",
"registration",
"."
] | 5ced14feaf06228e3f3bde04857dc83b076cc81d | https://github.com/matrix-org/matrix-appservice-node/blob/5ced14feaf06228e3f3bde04857dc83b076cc81d/lib/app-service-registration.js#L11-L25 |
19,935 | EasyGraphQL/easygraphql-mock | util/customMock.js | fieldTypes | function fieldTypes (type) {
switch (type) {
case constants.ID:
case constants.string:
return 'string'
case constants.int:
case constants.float:
return 'number'
default:
}
} | javascript | function fieldTypes (type) {
switch (type) {
case constants.ID:
case constants.string:
return 'string'
case constants.int:
case constants.float:
return 'number'
default:
}
} | [
"function",
"fieldTypes",
"(",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"constants",
".",
"ID",
":",
"case",
"constants",
".",
"string",
":",
"return",
"'string'",
"case",
"constants",
".",
"int",
":",
"case",
"constants",
".",
"float",... | Convert the type of the field to return the type and check the typeof | [
"Convert",
"the",
"type",
"of",
"the",
"field",
"to",
"return",
"the",
"type",
"and",
"check",
"the",
"typeof"
] | 394620e0f53582c89db329cc8d61a2eae8800440 | https://github.com/EasyGraphQL/easygraphql-mock/blob/394620e0f53582c89db329cc8d61a2eae8800440/util/customMock.js#L5-L17 |
19,936 | fitraditya/node-pdf2img | lib/pdf2img.js | function (callback) {
gm(input).identify("%p ", function (err, value) {
var pageCount = String(value).split(' ');
if (!pageCount.length) {
callback({
result: 'error',
message: 'Invalid page number.'
... | javascript | function (callback) {
gm(input).identify("%p ", function (err, value) {
var pageCount = String(value).split(' ');
if (!pageCount.length) {
callback({
result: 'error',
message: 'Invalid page number.'
... | [
"function",
"(",
"callback",
")",
"{",
"gm",
"(",
"input",
")",
".",
"identify",
"(",
"\"%p \"",
",",
"function",
"(",
"err",
",",
"value",
")",
"{",
"var",
"pageCount",
"=",
"String",
"(",
"value",
")",
".",
"split",
"(",
"' '",
")",
";",
"if",
... | Get pages count | [
"Get",
"pages",
"count"
] | 1160ddfc5222701de5e1e0fc0b9c473b34ff131d | https://github.com/fitraditya/node-pdf2img/blob/1160ddfc5222701de5e1e0fc0b9c473b34ff131d/lib/pdf2img.js#L71-L98 | |
19,937 | fitraditya/node-pdf2img | lib/pdf2img.js | function(pages, callback) {
// Use eachSeries to make sure that conversion has done page by page
async.eachSeries(pages, function(page, callbackmap) {
var inputStream = fs.createReadStream(input);
var outputFile = options.outputdir + options.outputname + '_' + page + '.' + options.type;
... | javascript | function(pages, callback) {
// Use eachSeries to make sure that conversion has done page by page
async.eachSeries(pages, function(page, callbackmap) {
var inputStream = fs.createReadStream(input);
var outputFile = options.outputdir + options.outputname + '_' + page + '.' + options.type;
... | [
"function",
"(",
"pages",
",",
"callback",
")",
"{",
"// Use eachSeries to make sure that conversion has done page by page",
"async",
".",
"eachSeries",
"(",
"pages",
",",
"function",
"(",
"page",
",",
"callbackmap",
")",
"{",
"var",
"inputStream",
"=",
"fs",
".",
... | Convert pdf file | [
"Convert",
"pdf",
"file"
] | 1160ddfc5222701de5e1e0fc0b9c473b34ff131d | https://github.com/fitraditya/node-pdf2img/blob/1160ddfc5222701de5e1e0fc0b9c473b34ff131d/lib/pdf2img.js#L102-L124 | |
19,938 | turt2live/node-email-reply-parser | index.js | parse | function parse(text, visibleTextOnly) {
var parser = new Parser();
var email = parser.parse(text);
if (visibleTextOnly) {
if (!email) return '';
else return email.getVisibleText();
} else return email;
} | javascript | function parse(text, visibleTextOnly) {
var parser = new Parser();
var email = parser.parse(text);
if (visibleTextOnly) {
if (!email) return '';
else return email.getVisibleText();
} else return email;
} | [
"function",
"parse",
"(",
"text",
",",
"visibleTextOnly",
")",
"{",
"var",
"parser",
"=",
"new",
"Parser",
"(",
")",
";",
"var",
"email",
"=",
"parser",
".",
"parse",
"(",
"text",
")",
";",
"if",
"(",
"visibleTextOnly",
")",
"{",
"if",
"(",
"!",
"e... | Parses the given text into an email
@param {string} text the email text to parse
@param {boolean} [visibleTextOnly] if true, the visible text will be returned instead of an Email
@returns {Email|string} the parsed Email or visible text, depending on the second argument | [
"Parses",
"the",
"given",
"text",
"into",
"an",
"email"
] | 3afbe2ccf929e3b5f6bf2d5711e8be7d42245c65 | https://github.com/turt2live/node-email-reply-parser/blob/3afbe2ccf929e3b5f6bf2d5711e8be7d42245c65/index.js#L14-L22 |
19,939 | ember-engines/ember-asset-loader | lib/node-asset-manifest-generator.js | NodeAssetManifestGenerator | function NodeAssetManifestGenerator(inputTrees, options) {
options = options || {};
this.appName = options.appName;
Plugin.call(this, [ inputTrees ], {
annotation: options.annotation
});
} | javascript | function NodeAssetManifestGenerator(inputTrees, options) {
options = options || {};
this.appName = options.appName;
Plugin.call(this, [ inputTrees ], {
annotation: options.annotation
});
} | [
"function",
"NodeAssetManifestGenerator",
"(",
"inputTrees",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"appName",
"=",
"options",
".",
"appName",
";",
"Plugin",
".",
"call",
"(",
"this",
",",
"[",
"inputTrees",
... | A Broccoli plugin to generate a module to be used in Node for resolving the
asset manifest. Primary use case is for FastBoot like environments.
@class NodeAssetManifestGenerator
@extends BroccoliCachingWriter | [
"A",
"Broccoli",
"plugin",
"to",
"generate",
"a",
"module",
"to",
"be",
"used",
"in",
"Node",
"for",
"resolving",
"the",
"asset",
"manifest",
".",
"Primary",
"use",
"case",
"is",
"for",
"FastBoot",
"like",
"environments",
"."
] | 4d36e16cf3199b7bae5c16cf3b09f87da608ed3f | https://github.com/ember-engines/ember-asset-loader/blob/4d36e16cf3199b7bae5c16cf3b09f87da608ed3f/lib/node-asset-manifest-generator.js#L12-L20 |
19,940 | ember-engines/ember-asset-loader | lib/asset-manifest-generator.js | AssetManifestGenerator | function AssetManifestGenerator(inputTrees, options) {
options = options || {};
this.prepend = options.prepend || '';
this.filesToIgnore = options.filesToIgnore || [];
this.supportedTypes = options.supportedTypes || DEFAULT_SUPPORTED_TYPES;
this.generateURI = options.generateURI || function generateURI(fileP... | javascript | function AssetManifestGenerator(inputTrees, options) {
options = options || {};
this.prepend = options.prepend || '';
this.filesToIgnore = options.filesToIgnore || [];
this.supportedTypes = options.supportedTypes || DEFAULT_SUPPORTED_TYPES;
this.generateURI = options.generateURI || function generateURI(fileP... | [
"function",
"AssetManifestGenerator",
"(",
"inputTrees",
",",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"prepend",
"=",
"options",
".",
"prepend",
"||",
"''",
";",
"this",
".",
"filesToIgnore",
"=",
"options",
".",
... | A Broccoli plugin to generate an asset manifest from a given input tree.
You can also provide a second tree that is a tree containing an existing
`asset-manifest.json` file to merge with.
@class AssetManifestGenerator
@extends BroccoliCachingWriter | [
"A",
"Broccoli",
"plugin",
"to",
"generate",
"an",
"asset",
"manifest",
"from",
"a",
"given",
"input",
"tree",
".",
"You",
"can",
"also",
"provide",
"a",
"second",
"tree",
"that",
"is",
"a",
"tree",
"containing",
"an",
"existing",
"asset",
"-",
"manifest",... | 4d36e16cf3199b7bae5c16cf3b09f87da608ed3f | https://github.com/ember-engines/ember-asset-loader/blob/4d36e16cf3199b7bae5c16cf3b09f87da608ed3f/lib/asset-manifest-generator.js#L18-L31 |
19,941 | ember-engines/ember-asset-loader | addon/services/asset-loader.js | reduceManifestBundles | function reduceManifestBundles(input, manifest) {
// If manifest doesn't have any bundles, then no reducing to do
if (!manifest.bundles) {
return input;
}
// Merge the bundles together, checking for collisions
return Object.keys(manifest.bundles).reduce((output, bundle) => {
Ember.assert(`The bundle ... | javascript | function reduceManifestBundles(input, manifest) {
// If manifest doesn't have any bundles, then no reducing to do
if (!manifest.bundles) {
return input;
}
// Merge the bundles together, checking for collisions
return Object.keys(manifest.bundles).reduce((output, bundle) => {
Ember.assert(`The bundle ... | [
"function",
"reduceManifestBundles",
"(",
"input",
",",
"manifest",
")",
"{",
"// If manifest doesn't have any bundles, then no reducing to do",
"if",
"(",
"!",
"manifest",
".",
"bundles",
")",
"{",
"return",
"input",
";",
"}",
"// Merge the bundles together, checking for c... | Merges two manifests' bundles together and returns a new manifest.
@param {AssetManifest} input
@param {AssetManifest} manifest
@return {AssetManifest} output | [
"Merges",
"two",
"manifests",
"bundles",
"together",
"and",
"returns",
"a",
"new",
"manifest",
"."
] | 4d36e16cf3199b7bae5c16cf3b09f87da608ed3f | https://github.com/ember-engines/ember-asset-loader/blob/4d36e16cf3199b7bae5c16cf3b09f87da608ed3f/addon/services/asset-loader.js#L17-L29 |
19,942 | ember-engines/ember-asset-loader | index.js | function() {
var tree = this._super.treeForApp.apply(this, arguments);
var app = findHost(this);
if (app && app.options && app.options.assetLoader && app.options.assetLoader.noManifest) {
tree = new Funnel(tree, {
exclude: [
'config/asset-manifest.js',
'instance-initialize... | javascript | function() {
var tree = this._super.treeForApp.apply(this, arguments);
var app = findHost(this);
if (app && app.options && app.options.assetLoader && app.options.assetLoader.noManifest) {
tree = new Funnel(tree, {
exclude: [
'config/asset-manifest.js',
'instance-initialize... | [
"function",
"(",
")",
"{",
"var",
"tree",
"=",
"this",
".",
"_super",
".",
"treeForApp",
".",
"apply",
"(",
"this",
",",
"arguments",
")",
";",
"var",
"app",
"=",
"findHost",
"(",
"this",
")",
";",
"if",
"(",
"app",
"&&",
"app",
".",
"options",
"... | If the app has specified `noManifest` to be generated, then we don't
include the shim for the manifest and the service initializer.
@override | [
"If",
"the",
"app",
"has",
"specified",
"noManifest",
"to",
"be",
"generated",
"then",
"we",
"don",
"t",
"include",
"the",
"shim",
"for",
"the",
"manifest",
"and",
"the",
"service",
"initializer",
"."
] | 4d36e16cf3199b7bae5c16cf3b09f87da608ed3f | https://github.com/ember-engines/ember-asset-loader/blob/4d36e16cf3199b7bae5c16cf3b09f87da608ed3f/index.js#L16-L30 | |
19,943 | uber-web/ocular | modules/dev-tools/node/aliases.js | getSubmodules | function getSubmodules(packageRoot) {
const submodules = {};
const parentPath = resolve(packageRoot, './modules');
if (fs.existsSync(parentPath)) {
//monorepo
fs.readdirSync(parentPath)
.forEach(item => {
const itemPath = resolve(parentPath, item);
const moduleInfo = getModuleInfo(itemPat... | javascript | function getSubmodules(packageRoot) {
const submodules = {};
const parentPath = resolve(packageRoot, './modules');
if (fs.existsSync(parentPath)) {
//monorepo
fs.readdirSync(parentPath)
.forEach(item => {
const itemPath = resolve(parentPath, item);
const moduleInfo = getModuleInfo(itemPat... | [
"function",
"getSubmodules",
"(",
"packageRoot",
")",
"{",
"const",
"submodules",
"=",
"{",
"}",
";",
"const",
"parentPath",
"=",
"resolve",
"(",
"packageRoot",
",",
"'./modules'",
")",
";",
"if",
"(",
"fs",
".",
"existsSync",
"(",
"parentPath",
")",
")",
... | Get information of all submodules | [
"Get",
"information",
"of",
"all",
"submodules"
] | cceb9720b4cf5460c77ed05b7ea0985355031f9d | https://github.com/uber-web/ocular/blob/cceb9720b4cf5460c77ed05b7ea0985355031f9d/modules/dev-tools/node/aliases.js#L22-L42 |
19,944 | uber-web/ocular | modules/gatsby/src/utils/example-registry.js | getHeroExample | function getHeroExample() {
const EXAMPLES = getExamples();
const exampleNames = Object.keys(EXAMPLES);
let DefaultHeroExample = exampleNames.length && EXAMPLES[0];
// HACK/ib - Check if this is a dummy example injected to keep graphgl happy
// Set to null if undefined
if (!DefaultHeroExample || DefaultHero... | javascript | function getHeroExample() {
const EXAMPLES = getExamples();
const exampleNames = Object.keys(EXAMPLES);
let DefaultHeroExample = exampleNames.length && EXAMPLES[0];
// HACK/ib - Check if this is a dummy example injected to keep graphgl happy
// Set to null if undefined
if (!DefaultHeroExample || DefaultHero... | [
"function",
"getHeroExample",
"(",
")",
"{",
"const",
"EXAMPLES",
"=",
"getExamples",
"(",
")",
";",
"const",
"exampleNames",
"=",
"Object",
".",
"keys",
"(",
"EXAMPLES",
")",
";",
"let",
"DefaultHeroExample",
"=",
"exampleNames",
".",
"length",
"&&",
"EXAMP... | Get a hero example if provided, or the first of the listed examples | [
"Get",
"a",
"hero",
"example",
"if",
"provided",
"or",
"the",
"first",
"of",
"the",
"listed",
"examples"
] | cceb9720b4cf5460c77ed05b7ea0985355031f9d | https://github.com/uber-web/ocular/blob/cceb9720b4cf5460c77ed05b7ea0985355031f9d/modules/gatsby/src/utils/example-registry.js#L10-L25 |
19,945 | uber-web/ocular | modules/gatsby/src/gatsby-node/create-webpack-config.js | stringify | function stringify(key, value) {
if (value instanceof RegExp) {
return value.toString();
}
if (value instanceof Function) {
return '[function]';
}
return value;
} | javascript | function stringify(key, value) {
if (value instanceof RegExp) {
return value.toString();
}
if (value instanceof Function) {
return '[function]';
}
return value;
} | [
"function",
"stringify",
"(",
"key",
",",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"RegExp",
")",
"{",
"return",
"value",
".",
"toString",
"(",
")",
";",
"}",
"if",
"(",
"value",
"instanceof",
"Function",
")",
"{",
"return",
"'[function]'",
... | Makes JSON.stringify print regexps | [
"Makes",
"JSON",
".",
"stringify",
"print",
"regexps"
] | cceb9720b4cf5460c77ed05b7ea0985355031f9d | https://github.com/uber-web/ocular/blob/cceb9720b4cf5460c77ed05b7ea0985355031f9d/modules/gatsby/src/gatsby-node/create-webpack-config.js#L10-L18 |
19,946 | OSSIndex/auditjs | audit-package.js | function(pkgManagerName, pkgName, versionRange, callback) {
if (!myCache) {
myCache = cache({
base: require('os').homedir() + "/.auditjs",
name: 'auditjs3x',
duration: 1000 * 3600 * CACHE_DURATION_HOURS //one day
});
}
cleanCache();
auditPackagesImpl([{pm: pkgManagerName, name: pkgNam... | javascript | function(pkgManagerName, pkgName, versionRange, callback) {
if (!myCache) {
myCache = cache({
base: require('os').homedir() + "/.auditjs",
name: 'auditjs3x',
duration: 1000 * 3600 * CACHE_DURATION_HOURS //one day
});
}
cleanCache();
auditPackagesImpl([{pm: pkgManagerName, name: pkgNam... | [
"function",
"(",
"pkgManagerName",
",",
"pkgName",
",",
"versionRange",
",",
"callback",
")",
"{",
"if",
"(",
"!",
"myCache",
")",
"{",
"myCache",
"=",
"cache",
"(",
"{",
"base",
":",
"require",
"(",
"'os'",
")",
".",
"homedir",
"(",
")",
"+",
"\"/.a... | Audit a specific package
@param pkgManagerName Name of the package manager the package belongs to
@param pkgName Name of the package to audit
@param versionRange Semantic version range for the package
@param callback Function to call on completion of each dependency
analysis. This call back has 2 arguments:
(err, sing... | [
"Audit",
"a",
"specific",
"package"
] | 17ac261168645e2dfe58e439eea4ca2606b8f2af | https://github.com/OSSIndex/auditjs/blob/17ac261168645e2dfe58e439eea4ca2606b8f2af/audit-package.js#L101-L111 | |
19,947 | OSSIndex/auditjs | audit.js | getLockfileDependencies | function getLockfileDependencies(root) {
var deps = {};
if (root.name && root.version) {
deps[root.name + "@" + root.version] = {
"pm": "npm",
"name": root.name,
"version": root.version
};
}
if (root.dependencies) {
for (var name in root.dependencies) {
var dep = root.depend... | javascript | function getLockfileDependencies(root) {
var deps = {};
if (root.name && root.version) {
deps[root.name + "@" + root.version] = {
"pm": "npm",
"name": root.name,
"version": root.version
};
}
if (root.dependencies) {
for (var name in root.dependencies) {
var dep = root.depend... | [
"function",
"getLockfileDependencies",
"(",
"root",
")",
"{",
"var",
"deps",
"=",
"{",
"}",
";",
"if",
"(",
"root",
".",
"name",
"&&",
"root",
".",
"version",
")",
"{",
"deps",
"[",
"root",
".",
"name",
"+",
"\"@\"",
"+",
"root",
".",
"version",
"]... | Given packag-lock.json data, produce a list of dependencies | [
"Given",
"packag",
"-",
"lock",
".",
"json",
"data",
"produce",
"a",
"list",
"of",
"dependencies"
] | 17ac261168645e2dfe58e439eea4ca2606b8f2af | https://github.com/OSSIndex/auditjs/blob/17ac261168645e2dfe58e439eea4ca2606b8f2af/audit.js#L239-L268 |
19,948 | OSSIndex/auditjs | audit.js | exitHandler | function exitHandler(options, err) {
if (err) {
if (err.stack) {
console.error(err.stack);
} else {
console.error(err.toString());
}
}
if (whitelistedVulnerabilities.length > 0) {
logger.info(colors.bold.yellow("Filtering the following vulnerabilities"));
logger.info(colors.... | javascript | function exitHandler(options, err) {
if (err) {
if (err.stack) {
console.error(err.stack);
} else {
console.error(err.toString());
}
}
if (whitelistedVulnerabilities.length > 0) {
logger.info(colors.bold.yellow("Filtering the following vulnerabilities"));
logger.info(colors.... | [
"function",
"exitHandler",
"(",
"options",
",",
"err",
")",
"{",
"if",
"(",
"err",
")",
"{",
"if",
"(",
"err",
".",
"stack",
")",
"{",
"console",
".",
"error",
"(",
"err",
".",
"stack",
")",
";",
"}",
"else",
"{",
"console",
".",
"error",
"(",
... | Set the return value
@param options
@param err
@returns | [
"Set",
"the",
"return",
"value"
] | 17ac261168645e2dfe58e439eea4ca2606b8f2af | https://github.com/OSSIndex/auditjs/blob/17ac261168645e2dfe58e439eea4ca2606b8f2af/audit.js#L276-L331 |
19,949 | OSSIndex/auditjs | audit.js | checkProperties | function checkProperties(obj) {
for (var key in obj) {
if (obj[key] !== null && obj[key] != "")
return false;
}
return true;
} | javascript | function checkProperties(obj) {
for (var key in obj) {
if (obj[key] !== null && obj[key] != "")
return false;
}
return true;
} | [
"function",
"checkProperties",
"(",
"obj",
")",
"{",
"for",
"(",
"var",
"key",
"in",
"obj",
")",
"{",
"if",
"(",
"obj",
"[",
"key",
"]",
"!==",
"null",
"&&",
"obj",
"[",
"key",
"]",
"!=",
"\"\"",
")",
"return",
"false",
";",
"}",
"return",
"true"... | Check if all properties of an object are null and return true if they are | [
"Check",
"if",
"all",
"properties",
"of",
"an",
"object",
"are",
"null",
"and",
"return",
"true",
"if",
"they",
"are"
] | 17ac261168645e2dfe58e439eea4ca2606b8f2af | https://github.com/OSSIndex/auditjs/blob/17ac261168645e2dfe58e439eea4ca2606b8f2af/audit.js#L350-L356 |
19,950 | OSSIndex/auditjs | audit.js | buildDependencyObjectLookup | function buildDependencyObjectLookup(data, lookup, parentPath) {
if (lookup == undefined) {
lookup = {};
}
parentPath = parentPath || '';
for(var k in data.dependencies) {
var dep = data.dependencies[k];
depPath = parentPath + '/' + dep.name;
var lookupKey = 'UNKNOWN'; //If we can't find a ke... | javascript | function buildDependencyObjectLookup(data, lookup, parentPath) {
if (lookup == undefined) {
lookup = {};
}
parentPath = parentPath || '';
for(var k in data.dependencies) {
var dep = data.dependencies[k];
depPath = parentPath + '/' + dep.name;
var lookupKey = 'UNKNOWN'; //If we can't find a ke... | [
"function",
"buildDependencyObjectLookup",
"(",
"data",
",",
"lookup",
",",
"parentPath",
")",
"{",
"if",
"(",
"lookup",
"==",
"undefined",
")",
"{",
"lookup",
"=",
"{",
"}",
";",
"}",
"parentPath",
"=",
"parentPath",
"||",
"''",
";",
"for",
"(",
"var",
... | Each specific package@version is only represented with the complete
dependency definitions once in the tree, but might not be where we need it.
Therefore we make a special lookup table
of package@version = [Object] which will be referenced later. | [
"Each",
"specific",
"package"
] | 17ac261168645e2dfe58e439eea4ca2606b8f2af | https://github.com/OSSIndex/auditjs/blob/17ac261168645e2dfe58e439eea4ca2606b8f2af/audit.js#L363-L397 |
19,951 | OSSIndex/auditjs | audit.js | getDependencyList | function getDependencyList(depMap, depLookup) {
var results = [];
var lookup = {};
var keys = Object.keys(depMap);
for(var i = 0; i < keys.length; i++) {
var name = keys[i];
// The value of o depends on the type of structure we are passed
var o = depMap[name];
var spec = o.version ? name + "@... | javascript | function getDependencyList(depMap, depLookup) {
var results = [];
var lookup = {};
var keys = Object.keys(depMap);
for(var i = 0; i < keys.length; i++) {
var name = keys[i];
// The value of o depends on the type of structure we are passed
var o = depMap[name];
var spec = o.version ? name + "@... | [
"function",
"getDependencyList",
"(",
"depMap",
",",
"depLookup",
")",
"{",
"var",
"results",
"=",
"[",
"]",
";",
"var",
"lookup",
"=",
"{",
"}",
";",
"var",
"keys",
"=",
"Object",
".",
"keys",
"(",
"depMap",
")",
";",
"for",
"(",
"var",
"i",
"=",
... | Recursively get a flat list of dependency objects. This is simpler for
subsequent code to handle then a tree of dependencies.
Depending on the command line arguments, the dependencies may includes
a mix of production, development, optional, etc. dependencies. | [
"Recursively",
"get",
"a",
"flat",
"list",
"of",
"dependency",
"objects",
".",
"This",
"is",
"simpler",
"for",
"subsequent",
"code",
"to",
"handle",
"then",
"a",
"tree",
"of",
"dependencies",
"."
] | 17ac261168645e2dfe58e439eea4ca2606b8f2af | https://github.com/OSSIndex/auditjs/blob/17ac261168645e2dfe58e439eea4ca2606b8f2af/audit.js#L405-L445 |
19,952 | OSSIndex/auditjs | audit.js | lookupSpecMatch | function lookupSpecMatch(lookup, spec) {
// Direct match
if (lookup[spec]) {
return lookup[spec];
}
// Close match
var shortSpec = spec.replace(/@\D/g,'@');
if (lookup[shortSpec]) {
return lookup[shortSpec];
}
// Check for Semver valid match
var lastIndex = spec.lastIndexOf('@');
var myNam... | javascript | function lookupSpecMatch(lookup, spec) {
// Direct match
if (lookup[spec]) {
return lookup[spec];
}
// Close match
var shortSpec = spec.replace(/@\D/g,'@');
if (lookup[shortSpec]) {
return lookup[shortSpec];
}
// Check for Semver valid match
var lastIndex = spec.lastIndexOf('@');
var myNam... | [
"function",
"lookupSpecMatch",
"(",
"lookup",
",",
"spec",
")",
"{",
"// Direct match",
"if",
"(",
"lookup",
"[",
"spec",
"]",
")",
"{",
"return",
"lookup",
"[",
"spec",
"]",
";",
"}",
"// Close match",
"var",
"shortSpec",
"=",
"spec",
".",
"replace",
"(... | Given a lookup table, try and find the best specification match for the
provided name@version | [
"Given",
"a",
"lookup",
"table",
"try",
"and",
"find",
"the",
"best",
"specification",
"match",
"for",
"the",
"provided",
"name"
] | 17ac261168645e2dfe58e439eea4ca2606b8f2af | https://github.com/OSSIndex/auditjs/blob/17ac261168645e2dfe58e439eea4ca2606b8f2af/audit.js#L463-L488 |
19,953 | OSSIndex/auditjs | audit.js | getDepsFromDataObject | function getDepsFromDataObject(data, lookup) {
var results = {};
if (categories.length == 0) {
for(var k in data.dependencies) {
var dep = extractDep(data.dependencies[k]);
results[k]=dep;
}
}
if (lookup) {
for (var i = 0; i < categories.length; i++) {
var category = categories[i]... | javascript | function getDepsFromDataObject(data, lookup) {
var results = {};
if (categories.length == 0) {
for(var k in data.dependencies) {
var dep = extractDep(data.dependencies[k]);
results[k]=dep;
}
}
if (lookup) {
for (var i = 0; i < categories.length; i++) {
var category = categories[i]... | [
"function",
"getDepsFromDataObject",
"(",
"data",
",",
"lookup",
")",
"{",
"var",
"results",
"=",
"{",
"}",
";",
"if",
"(",
"categories",
".",
"length",
"==",
"0",
")",
"{",
"for",
"(",
"var",
"k",
"in",
"data",
".",
"dependencies",
")",
"{",
"var",
... | Get the dependencies from an npm object. The exact dependencies retrieved
depend on categories requested by the user. | [
"Get",
"the",
"dependencies",
"from",
"an",
"npm",
"object",
".",
"The",
"exact",
"dependencies",
"retrieved",
"depend",
"on",
"categories",
"requested",
"by",
"the",
"user",
"."
] | 17ac261168645e2dfe58e439eea4ca2606b8f2af | https://github.com/OSSIndex/auditjs/blob/17ac261168645e2dfe58e439eea4ca2606b8f2af/audit.js#L493-L518 |
19,954 | OSSIndex/auditjs | audit.js | getValidVulnerabilities | function getValidVulnerabilities(productRange, details, pkg, depPaths) {
var results = [];
if(details != undefined) {
for(var i = 0; i < details.length; i++) {
var detail = details[i];
detail.depPaths = depPaths;
// Do ... | javascript | function getValidVulnerabilities(productRange, details, pkg, depPaths) {
var results = [];
if(details != undefined) {
for(var i = 0; i < details.length; i++) {
var detail = details[i];
detail.depPaths = depPaths;
// Do ... | [
"function",
"getValidVulnerabilities",
"(",
"productRange",
",",
"details",
",",
"pkg",
",",
"depPaths",
")",
"{",
"var",
"results",
"=",
"[",
"]",
";",
"if",
"(",
"details",
"!=",
"undefined",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<... | Return list of vulnerabilities found to affect this version.
@param productRange A version range as defined by semantic versioning
@param details Vulnerability details
@returns | [
"Return",
"list",
"of",
"vulnerabilities",
"found",
"to",
"affect",
"this",
"version",
"."
] | 17ac261168645e2dfe58e439eea4ca2606b8f2af | https://github.com/OSSIndex/auditjs/blob/17ac261168645e2dfe58e439eea4ca2606b8f2af/audit.js#L704-L746 |
19,955 | OSSIndex/auditjs | config.js | simplifyWhitelist | function simplifyWhitelist(whitelist) {
var results = [];
if (Array.isArray(whitelist)) {
// whitelist is in Simplified format
for (var i = 0; i < whitelist.length; i++) {
results.push({
"id": whitelist[i]
});
}
} else {
// whitelist is in Verbose format
for (var project in whitelist... | javascript | function simplifyWhitelist(whitelist) {
var results = [];
if (Array.isArray(whitelist)) {
// whitelist is in Simplified format
for (var i = 0; i < whitelist.length; i++) {
results.push({
"id": whitelist[i]
});
}
} else {
// whitelist is in Verbose format
for (var project in whitelist... | [
"function",
"simplifyWhitelist",
"(",
"whitelist",
")",
"{",
"var",
"results",
"=",
"[",
"]",
";",
"if",
"(",
"Array",
".",
"isArray",
"(",
"whitelist",
")",
")",
"{",
"// whitelist is in Simplified format",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<... | Simplify the white-list into a list of issue IDs. | [
"Simplify",
"the",
"white",
"-",
"list",
"into",
"a",
"list",
"of",
"issue",
"IDs",
"."
] | 17ac261168645e2dfe58e439eea4ca2606b8f2af | https://github.com/OSSIndex/auditjs/blob/17ac261168645e2dfe58e439eea4ca2606b8f2af/config.js#L135-L160 |
19,956 | OSSIndex/auditjs | config.js | loadConfig | function loadConfig() {
underload('whitelist', 'whitelist.file');
if (!program['bower'] && config.has('packages.type') && config.get('packages.type') == 'bower') {
program['bower'] = true;
}
if (!program['noNode'] && config.has('packages.withNode') && config.get('packages.withNode') == false) {
progra... | javascript | function loadConfig() {
underload('whitelist', 'whitelist.file');
if (!program['bower'] && config.has('packages.type') && config.get('packages.type') == 'bower') {
program['bower'] = true;
}
if (!program['noNode'] && config.has('packages.withNode') && config.get('packages.withNode') == false) {
progra... | [
"function",
"loadConfig",
"(",
")",
"{",
"underload",
"(",
"'whitelist'",
",",
"'whitelist.file'",
")",
";",
"if",
"(",
"!",
"program",
"[",
"'bower'",
"]",
"&&",
"config",
".",
"has",
"(",
"'packages.type'",
")",
"&&",
"config",
".",
"get",
"(",
"'packa... | Load configuration information from the specified file. Command line
overrides all file configuration. | [
"Load",
"configuration",
"information",
"from",
"the",
"specified",
"file",
".",
"Command",
"line",
"overrides",
"all",
"file",
"configuration",
"."
] | 17ac261168645e2dfe58e439eea4ca2606b8f2af | https://github.com/OSSIndex/auditjs/blob/17ac261168645e2dfe58e439eea4ca2606b8f2af/config.js#L165-L192 |
19,957 | OSSIndex/auditjs | config.js | underload | function underload(cmdlineName, configName) {
if (!program[cmdlineName] && config.has(configName)) {
program[cmdlineName] = config.get(configName);
}
} | javascript | function underload(cmdlineName, configName) {
if (!program[cmdlineName] && config.has(configName)) {
program[cmdlineName] = config.get(configName);
}
} | [
"function",
"underload",
"(",
"cmdlineName",
",",
"configName",
")",
"{",
"if",
"(",
"!",
"program",
"[",
"cmdlineName",
"]",
"&&",
"config",
".",
"has",
"(",
"configName",
")",
")",
"{",
"program",
"[",
"cmdlineName",
"]",
"=",
"config",
".",
"get",
"... | Load the config file option if not overloaded by the command line.
@param cmdlineName: The command line option name
@param configName: The config file option name | [
"Load",
"the",
"config",
"file",
"option",
"if",
"not",
"overloaded",
"by",
"the",
"command",
"line",
"."
] | 17ac261168645e2dfe58e439eea4ca2606b8f2af | https://github.com/OSSIndex/auditjs/blob/17ac261168645e2dfe58e439eea4ca2606b8f2af/config.js#L199-L203 |
19,958 | nearform/node-clinic-flame | visualizer/no-data-node.js | getNoDataNode | function getNoDataNode () {
return {
category: 'none', // Used to distinguish fake nodes like this from real ones
children: [],
functionName: 'No data.',
fileName: 'Nothing to show currently.',
id: null, // Don't show any id in the url hash
name: '',
onStackTop: {
asViewed: 0,
... | javascript | function getNoDataNode () {
return {
category: 'none', // Used to distinguish fake nodes like this from real ones
children: [],
functionName: 'No data.',
fileName: 'Nothing to show currently.',
id: null, // Don't show any id in the url hash
name: '',
onStackTop: {
asViewed: 0,
... | [
"function",
"getNoDataNode",
"(",
")",
"{",
"return",
"{",
"category",
":",
"'none'",
",",
"// Used to distinguish fake nodes like this from real ones",
"children",
":",
"[",
"]",
",",
"functionName",
":",
"'No data.'",
",",
"fileName",
":",
"'Nothing to show currently.... | Recreate the object every time it is needed so the caller can change properties without mutating the original. | [
"Recreate",
"the",
"object",
"every",
"time",
"it",
"is",
"needed",
"so",
"the",
"caller",
"can",
"change",
"properties",
"without",
"mutating",
"the",
"original",
"."
] | 0d70eb42980c5bc536c9f7aff3058a6448b4627a | https://github.com/nearform/node-clinic-flame/blob/0d70eb42980c5bc536c9f7aff3058a6448b4627a/visualizer/no-data-node.js#L5-L30 |
19,959 | nearform/node-clinic-flame | analysis/code-areas.js | toCodeAreaChildren | function toCodeAreaChildren (set) {
return Array.from(set, (id) => {
return { id }
}).sort(sorter)
function sorter (a, b) {
return a.id.localeCompare(b.id)
}
} | javascript | function toCodeAreaChildren (set) {
return Array.from(set, (id) => {
return { id }
}).sort(sorter)
function sorter (a, b) {
return a.id.localeCompare(b.id)
}
} | [
"function",
"toCodeAreaChildren",
"(",
"set",
")",
"{",
"return",
"Array",
".",
"from",
"(",
"set",
",",
"(",
"id",
")",
"=>",
"{",
"return",
"{",
"id",
"}",
"}",
")",
".",
"sort",
"(",
"sorter",
")",
"function",
"sorter",
"(",
"a",
",",
"b",
")"... | Turn a Set of code area names into a sorted list of code area objects. This sorts by name right now, just to have a consistent output, but could use eg. the heat of the area in the future. | [
"Turn",
"a",
"Set",
"of",
"code",
"area",
"names",
"into",
"a",
"sorted",
"list",
"of",
"code",
"area",
"objects",
".",
"This",
"sorts",
"by",
"name",
"right",
"now",
"just",
"to",
"have",
"a",
"consistent",
"output",
"but",
"could",
"use",
"eg",
".",
... | 0d70eb42980c5bc536c9f7aff3058a6448b4627a | https://github.com/nearform/node-clinic-flame/blob/0d70eb42980c5bc536c9f7aff3058a6448b4627a/analysis/code-areas.js#L6-L14 |
19,960 | xkeshi/vue-barcode | dist/vue-barcode.common.js | autoSelectFromAB | function autoSelectFromAB(string, isA) {
var ranges = isA ? A_CHARS : B_CHARS;
var untilC = string.match(new RegExp('^(' + ranges + '+?)(([0-9]{2}){2,})([^0-9]|$)'));
if (untilC) {
return untilC[1] + String.fromCharCode(204) + autoSelectFromC(string.substring(untilC[1].length));
}
var chars = string.match(new ... | javascript | function autoSelectFromAB(string, isA) {
var ranges = isA ? A_CHARS : B_CHARS;
var untilC = string.match(new RegExp('^(' + ranges + '+?)(([0-9]{2}){2,})([^0-9]|$)'));
if (untilC) {
return untilC[1] + String.fromCharCode(204) + autoSelectFromC(string.substring(untilC[1].length));
}
var chars = string.match(new ... | [
"function",
"autoSelectFromAB",
"(",
"string",
",",
"isA",
")",
"{",
"var",
"ranges",
"=",
"isA",
"?",
"A_CHARS",
":",
"B_CHARS",
";",
"var",
"untilC",
"=",
"string",
".",
"match",
"(",
"new",
"RegExp",
"(",
"'^('",
"+",
"ranges",
"+",
"'+?)(([0-9]{2}){2... | CODE128A or CODE128B | [
"CODE128A",
"or",
"CODE128B"
] | c2b03914a9604df607edcfd72c4d77eaf41ff7f4 | https://github.com/xkeshi/vue-barcode/blob/c2b03914a9604df607edcfd72c4d77eaf41ff7f4/dist/vue-barcode.common.js#L415-L430 |
19,961 | xkeshi/vue-barcode | dist/vue-barcode.common.js | encode | function encode(data, structure, separator) {
var encoded = data.split('').map(function (val, idx) {
return BINARIES[structure[idx]];
}).map(function (val, idx) {
return val ? val[data[idx]] : '';
});
if (separator) {
var last = data.length - 1;
encoded = encoded.map(function (val, idx) {
return idx < l... | javascript | function encode(data, structure, separator) {
var encoded = data.split('').map(function (val, idx) {
return BINARIES[structure[idx]];
}).map(function (val, idx) {
return val ? val[data[idx]] : '';
});
if (separator) {
var last = data.length - 1;
encoded = encoded.map(function (val, idx) {
return idx < l... | [
"function",
"encode",
"(",
"data",
",",
"structure",
",",
"separator",
")",
"{",
"var",
"encoded",
"=",
"data",
".",
"split",
"(",
"''",
")",
".",
"map",
"(",
"function",
"(",
"val",
",",
"idx",
")",
"{",
"return",
"BINARIES",
"[",
"structure",
"[",
... | Encode data string | [
"Encode",
"data",
"string"
] | c2b03914a9604df607edcfd72c4d77eaf41ff7f4 | https://github.com/xkeshi/vue-barcode/blob/c2b03914a9604df607edcfd72c4d77eaf41ff7f4/dist/vue-barcode.common.js#L564-L579 |
19,962 | xkeshi/vue-barcode | dist/vue-barcode.common.js | checksum$4 | function checksum$4(data) {
var result = 0;
for (var i = 0; i < 13; i++) {
result += parseInt(data[i]) * (3 - i % 2 * 2);
}
return Math.ceil(result / 10) * 10 - result;
} | javascript | function checksum$4(data) {
var result = 0;
for (var i = 0; i < 13; i++) {
result += parseInt(data[i]) * (3 - i % 2 * 2);
}
return Math.ceil(result / 10) * 10 - result;
} | [
"function",
"checksum$4",
"(",
"data",
")",
"{",
"var",
"result",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"13",
";",
"i",
"++",
")",
"{",
"result",
"+=",
"parseInt",
"(",
"data",
"[",
"i",
"]",
")",
"*",
"(",
"3",
"-... | Calulate the checksum digit | [
"Calulate",
"the",
"checksum",
"digit"
] | c2b03914a9604df607edcfd72c4d77eaf41ff7f4 | https://github.com/xkeshi/vue-barcode/blob/c2b03914a9604df607edcfd72c4d77eaf41ff7f4/dist/vue-barcode.common.js#L1235-L1243 |
19,963 | xkeshi/vue-barcode | dist/vue-barcode.common.js | JsBarcode | function JsBarcode(element, text, options) {
var api = new API();
if (typeof element === "undefined") {
throw Error("No element to render on was provided.");
}
// Variables that will be pased through the API calls
api._renderProperties = getRenderProperties(element);
api._encodings = [];
api._options = defau... | javascript | function JsBarcode(element, text, options) {
var api = new API();
if (typeof element === "undefined") {
throw Error("No element to render on was provided.");
}
// Variables that will be pased through the API calls
api._renderProperties = getRenderProperties(element);
api._encodings = [];
api._options = defau... | [
"function",
"JsBarcode",
"(",
"element",
",",
"text",
",",
"options",
")",
"{",
"var",
"api",
"=",
"new",
"API",
"(",
")",
";",
"if",
"(",
"typeof",
"element",
"===",
"\"undefined\"",
")",
"{",
"throw",
"Error",
"(",
"\"No element to render on was provided.\... | The first call of the library API Will return an object with all barcodes calls and the data that is used by the renderers | [
"The",
"first",
"call",
"of",
"the",
"library",
"API",
"Will",
"return",
"an",
"object",
"with",
"all",
"barcodes",
"calls",
"and",
"the",
"data",
"that",
"is",
"used",
"by",
"the",
"renderers"
] | c2b03914a9604df607edcfd72c4d77eaf41ff7f4 | https://github.com/xkeshi/vue-barcode/blob/c2b03914a9604df607edcfd72c4d77eaf41ff7f4/dist/vue-barcode.common.js#L2297-L2322 |
19,964 | xkeshi/vue-barcode | dist/vue-barcode.common.js | render | function render(renderProperties, encodings, options) {
encodings = linearizeEncodings(encodings);
for (var i = 0; i < encodings.length; i++) {
encodings[i].options = merge(options, encodings[i].options);
fixOptions(encodings[i].options);
}
fixOptions(options);
var Renderer = renderProperties.renderer;
var... | javascript | function render(renderProperties, encodings, options) {
encodings = linearizeEncodings(encodings);
for (var i = 0; i < encodings.length; i++) {
encodings[i].options = merge(options, encodings[i].options);
fixOptions(encodings[i].options);
}
fixOptions(options);
var Renderer = renderProperties.renderer;
var... | [
"function",
"render",
"(",
"renderProperties",
",",
"encodings",
",",
"options",
")",
"{",
"encodings",
"=",
"linearizeEncodings",
"(",
"encodings",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"encodings",
".",
"length",
";",
"i",
"++",
... | Prepares the encodings and calls the renderer | [
"Prepares",
"the",
"encodings",
"and",
"calls",
"the",
"renderer"
] | c2b03914a9604df607edcfd72c4d77eaf41ff7f4 | https://github.com/xkeshi/vue-barcode/blob/c2b03914a9604df607edcfd72c4d77eaf41ff7f4/dist/vue-barcode.common.js#L2457-L2474 |
19,965 | thlorenz/cardinal | settings.js | resolveTheme | function resolveTheme(home_) {
var themePath
var settings = getSettings(home_)
if (!settings || !settings.theme) return undefined
try {
// allow specifying just the name of a built-in theme or a full path to a custom theme
themePath = utl.isPath(settings.theme) ? settings.theme : path.join(__dirname, ... | javascript | function resolveTheme(home_) {
var themePath
var settings = getSettings(home_)
if (!settings || !settings.theme) return undefined
try {
// allow specifying just the name of a built-in theme or a full path to a custom theme
themePath = utl.isPath(settings.theme) ? settings.theme : path.join(__dirname, ... | [
"function",
"resolveTheme",
"(",
"home_",
")",
"{",
"var",
"themePath",
"var",
"settings",
"=",
"getSettings",
"(",
"home_",
")",
"if",
"(",
"!",
"settings",
"||",
"!",
"settings",
".",
"theme",
")",
"return",
"undefined",
"try",
"{",
"// allow specifying ju... | home_ mainly to be used during tests Resolves the preferred theme from the .cardinalrc found in the HOME directory If it couldn't be resolved, undefined is returned | [
"home_",
"mainly",
"to",
"be",
"used",
"during",
"tests",
"Resolves",
"the",
"preferred",
"theme",
"from",
"the",
".",
"cardinalrc",
"found",
"in",
"the",
"HOME",
"directory",
"If",
"it",
"couldn",
"t",
"be",
"resolved",
"undefined",
"is",
"returned"
] | c407ebe9c16122025488313fb1b020e62c0046ef | https://github.com/thlorenz/cardinal/blob/c407ebe9c16122025488313fb1b020e62c0046ef/settings.js#L31-L47 |
19,966 | trayio/threadneedle | lib/addMethod/addMethodREST.js | afterHeadersResolve | function afterHeadersResolve (body, result) {
logger.info(methodName+': running `afterHeaders` hook');
globalize.afterHeaders.call(threadneedle, config, null, body, params, result.response)
.done(
function (headers) {
resolve(formatResponse(headers, body));
},
function (error) {
reject(... | javascript | function afterHeadersResolve (body, result) {
logger.info(methodName+': running `afterHeaders` hook');
globalize.afterHeaders.call(threadneedle, config, null, body, params, result.response)
.done(
function (headers) {
resolve(formatResponse(headers, body));
},
function (error) {
reject(... | [
"function",
"afterHeadersResolve",
"(",
"body",
",",
"result",
")",
"{",
"logger",
".",
"info",
"(",
"methodName",
"+",
"': running `afterHeaders` hook'",
")",
";",
"globalize",
".",
"afterHeaders",
".",
"call",
"(",
"threadneedle",
",",
"config",
",",
"null",
... | Handle afterHeader for resolving | [
"Handle",
"afterHeader",
"for",
"resolving"
] | 5deabeb5ee2f5df3d124d8f159207520bedb170c | https://github.com/trayio/threadneedle/blob/5deabeb5ee2f5df3d124d8f159207520bedb170c/lib/addMethod/addMethodREST.js#L59-L73 |
19,967 | trayio/threadneedle | lib/addMethod/addMethodREST.js | afterHeadersReject | function afterHeadersReject (error, payload, response) {
logger.info(methodName+': running `afterHeaders` hook');
globalize.afterHeaders.call(threadneedle, config, error, payload, params, response)
.done(
function (headers) {
reject(formatResponse(headers, error));
},
function (err) {
r... | javascript | function afterHeadersReject (error, payload, response) {
logger.info(methodName+': running `afterHeaders` hook');
globalize.afterHeaders.call(threadneedle, config, error, payload, params, response)
.done(
function (headers) {
reject(formatResponse(headers, error));
},
function (err) {
r... | [
"function",
"afterHeadersReject",
"(",
"error",
",",
"payload",
",",
"response",
")",
"{",
"logger",
".",
"info",
"(",
"methodName",
"+",
"': running `afterHeaders` hook'",
")",
";",
"globalize",
".",
"afterHeaders",
".",
"call",
"(",
"threadneedle",
",",
"confi... | Handle afterHeader for rejecting | [
"Handle",
"afterHeader",
"for",
"rejecting"
] | 5deabeb5ee2f5df3d124d8f159207520bedb170c | https://github.com/trayio/threadneedle/blob/5deabeb5ee2f5df3d124d8f159207520bedb170c/lib/addMethod/addMethodREST.js#L76-L90 |
19,968 | emberfeather/less.js-middleware | lib/middleware.js | function(path, next) {
var nodes = lessFiles[path].imports;
if (!nodes || !nodes.length) {
return next();
}
var pending = nodes.length;
var changed = [];
nodes.forEach(function(imported){
fs.stat(imported.path, function(err, stat) {
// error or newer mtime
if (err || !imported.mtime |... | javascript | function(path, next) {
var nodes = lessFiles[path].imports;
if (!nodes || !nodes.length) {
return next();
}
var pending = nodes.length;
var changed = [];
nodes.forEach(function(imported){
fs.stat(imported.path, function(err, stat) {
// error or newer mtime
if (err || !imported.mtime |... | [
"function",
"(",
"path",
",",
"next",
")",
"{",
"var",
"nodes",
"=",
"lessFiles",
"[",
"path",
"]",
".",
"imports",
";",
"if",
"(",
"!",
"nodes",
"||",
"!",
"nodes",
".",
"length",
")",
"{",
"return",
"next",
"(",
")",
";",
"}",
"var",
"pending",... | Check imports for changes. | [
"Check",
"imports",
"for",
"changes",
"."
] | a9e09472681c83df468effd6378b2d87e3e2c09b | https://github.com/emberfeather/less.js-middleware/blob/a9e09472681c83df468effd6378b2d87e3e2c09b/lib/middleware.js#L25-L45 | |
19,969 | css-modules/css-modulesify | index.js | getPlugins | function getPlugins (options) {
var plugins = options.use || options.u;
if (!plugins) {
plugins = getDefaultPlugins(options);
}
else {
if (typeof plugins === 'string') {
plugins = [plugins];
}
}
var postcssBefore = options.postcssBefore || options.before || [];
var postcssAfter = option... | javascript | function getPlugins (options) {
var plugins = options.use || options.u;
if (!plugins) {
plugins = getDefaultPlugins(options);
}
else {
if (typeof plugins === 'string') {
plugins = [plugins];
}
}
var postcssBefore = options.postcssBefore || options.before || [];
var postcssAfter = option... | [
"function",
"getPlugins",
"(",
"options",
")",
"{",
"var",
"plugins",
"=",
"options",
".",
"use",
"||",
"options",
".",
"u",
";",
"if",
"(",
"!",
"plugins",
")",
"{",
"plugins",
"=",
"getDefaultPlugins",
"(",
"options",
")",
";",
"}",
"else",
"{",
"i... | PostCSS plugins passed to FileSystemLoader | [
"PostCSS",
"plugins",
"passed",
"to",
"FileSystemLoader"
] | bf1fb9a60ba5c5cc38ba31dbcd18144ca0413bee | https://github.com/css-modules/css-modulesify/blob/bf1fb9a60ba5c5cc38ba31dbcd18144ca0413bee/index.js#L78-L119 |
19,970 | jacobrask/styledocco | share/docs.previews.js | function(el) {
var mirrorEl = document.createElement('div');
mirrorEl.className = 'preview-code';
mirrorEl.style.position = 'absolute';
mirrorEl.style.left = '-9999px';
bodyEl.appendChild(mirrorEl);
var maxHeight = parseInt(
window.getComputedStyle(el).getPropertyValue('max-height'),
10);
var code... | javascript | function(el) {
var mirrorEl = document.createElement('div');
mirrorEl.className = 'preview-code';
mirrorEl.style.position = 'absolute';
mirrorEl.style.left = '-9999px';
bodyEl.appendChild(mirrorEl);
var maxHeight = parseInt(
window.getComputedStyle(el).getPropertyValue('max-height'),
10);
var code... | [
"function",
"(",
"el",
")",
"{",
"var",
"mirrorEl",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"mirrorEl",
".",
"className",
"=",
"'preview-code'",
";",
"mirrorEl",
".",
"style",
".",
"position",
"=",
"'absolute'",
";",
"mirrorEl",
".",... | Add an element with the same styles and content as the textarea to calculate the height of the textarea content. | [
"Add",
"an",
"element",
"with",
"the",
"same",
"styles",
"and",
"content",
"as",
"the",
"textarea",
"to",
"calculate",
"the",
"height",
"of",
"the",
"textarea",
"content",
"."
] | 9f12e71a02c5193ed0427aecba7929b230cf0975 | https://github.com/jacobrask/styledocco/blob/9f12e71a02c5193ed0427aecba7929b230cf0975/share/docs.previews.js#L141-L163 | |
19,971 | jacobrask/styledocco | share/docs.previews.js | function(width) {
document.cookie = 'preview-width=' + width;
forEach(resizeableEls, function(el) {
if (width === 'auto') width = el.parentNode.offsetWidth;
el.style.width = width + 'px';
// TODO: Add CSS transitions and update height after `transitionend` event
postMessage(el.getElement... | javascript | function(width) {
document.cookie = 'preview-width=' + width;
forEach(resizeableEls, function(el) {
if (width === 'auto') width = el.parentNode.offsetWidth;
el.style.width = width + 'px';
// TODO: Add CSS transitions and update height after `transitionend` event
postMessage(el.getElement... | [
"function",
"(",
"width",
")",
"{",
"document",
".",
"cookie",
"=",
"'preview-width='",
"+",
"width",
";",
"forEach",
"(",
"resizeableEls",
",",
"function",
"(",
"el",
")",
"{",
"if",
"(",
"width",
"===",
"'auto'",
")",
"width",
"=",
"el",
".",
"parent... | `.resizeable` padding | [
".",
"resizeable",
"padding"
] | 9f12e71a02c5193ed0427aecba7929b230cf0975 | https://github.com/jacobrask/styledocco/blob/9f12e71a02c5193ed0427aecba7929b230cf0975/share/docs.previews.js#L169-L177 | |
19,972 | sffc/easy-no-password | lib/base62.js | encode | function encode(buf) {
if (buf.length != 8) {
throw new TypeError("Buffer must be length 8");
}
var num = new UInt64(buf.readUInt32BE(4), buf.readUInt32BE(0));
var str = "";
do {
num.div(SIXTY_TWO);
str = CHARS[num.remainder] + str;
} while (num.greaterThan(ZERO));
return str;
} | javascript | function encode(buf) {
if (buf.length != 8) {
throw new TypeError("Buffer must be length 8");
}
var num = new UInt64(buf.readUInt32BE(4), buf.readUInt32BE(0));
var str = "";
do {
num.div(SIXTY_TWO);
str = CHARS[num.remainder] + str;
} while (num.greaterThan(ZERO));
return str;
} | [
"function",
"encode",
"(",
"buf",
")",
"{",
"if",
"(",
"buf",
".",
"length",
"!=",
"8",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"Buffer must be length 8\"",
")",
";",
"}",
"var",
"num",
"=",
"new",
"UInt64",
"(",
"buf",
".",
"readUInt32BE",
"(",
... | Encodes an 8-byte buffer as base 62. | [
"Encodes",
"an",
"8",
"-",
"byte",
"buffer",
"as",
"base",
"62",
"."
] | 29ad932d0d8bd180736b232b87ad6b986a0311ec | https://github.com/sffc/easy-no-password/blob/29ad932d0d8bd180736b232b87ad6b986a0311ec/lib/base62.js#L13-L26 |
19,973 | l20n/l20n.js | src/gecko/l20n.js | requestBundles | function requestBundles(requestedLangs = navigator.languages) {
return L10nRegistry.getResources(requestedLangs, resIds).then(
({bundles}) => bundles.map(
bundle => new ChromeResourceBundle(bundle.locale, bundle.resources)
)
);
} | javascript | function requestBundles(requestedLangs = navigator.languages) {
return L10nRegistry.getResources(requestedLangs, resIds).then(
({bundles}) => bundles.map(
bundle => new ChromeResourceBundle(bundle.locale, bundle.resources)
)
);
} | [
"function",
"requestBundles",
"(",
"requestedLangs",
"=",
"navigator",
".",
"languages",
")",
"{",
"return",
"L10nRegistry",
".",
"getResources",
"(",
"requestedLangs",
",",
"resIds",
")",
".",
"then",
"(",
"(",
"{",
"bundles",
"}",
")",
"=>",
"bundles",
"."... | This function is called by `Localization` class to retrieve an array of `ResourceBundle`s. In chrome-privileged setup we use the `L10nRegistry` to get this array. | [
"This",
"function",
"is",
"called",
"by",
"Localization",
"class",
"to",
"retrieve",
"an",
"array",
"of",
"ResourceBundle",
"s",
".",
"In",
"chrome",
"-",
"privileged",
"setup",
"we",
"use",
"the",
"L10nRegistry",
"to",
"get",
"this",
"array",
"."
] | a56dc2ed980db87b45b11021e645009a439a90ec | https://github.com/l20n/l20n.js/blob/a56dc2ed980db87b45b11021e645009a439a90ec/src/gecko/l20n.js#L49-L55 |
19,974 | l20n/l20n.js | src/localization.js | createHeadContextWith | function createHeadContextWith(createContext, bundles) {
const [bundle] = bundles;
if (!bundle) {
return Promise.resolve(null);
}
return bundle.fetch().then(resources => {
const ctx = createContext(bundle.lang);
resources
// Filter out resources which failed to load correctly (e.g. 404).
... | javascript | function createHeadContextWith(createContext, bundles) {
const [bundle] = bundles;
if (!bundle) {
return Promise.resolve(null);
}
return bundle.fetch().then(resources => {
const ctx = createContext(bundle.lang);
resources
// Filter out resources which failed to load correctly (e.g. 404).
... | [
"function",
"createHeadContextWith",
"(",
"createContext",
",",
"bundles",
")",
"{",
"const",
"[",
"bundle",
"]",
"=",
"bundles",
";",
"if",
"(",
"!",
"bundle",
")",
"{",
"return",
"Promise",
".",
"resolve",
"(",
"null",
")",
";",
"}",
"return",
"bundle"... | Create a `MessageContext` for the first bundle in the fallback chain.
Fetches the bundle's resources and creates a context from them.
@param {Array<ResourceBundle>} bundle
@param {Function} createContext
@returns {Promise<MessageContext>}
@private | [
"Create",
"a",
"MessageContext",
"for",
"the",
"first",
"bundle",
"in",
"the",
"fallback",
"chain",
"."
] | a56dc2ed980db87b45b11021e645009a439a90ec | https://github.com/l20n/l20n.js/blob/a56dc2ed980db87b45b11021e645009a439a90ec/src/localization.js#L363-L380 |
19,975 | l20n/l20n.js | src/web/index.js | requestBundles | function requestBundles(requestedLangs = navigator.languages) {
const newLangs = negotiateLanguages(
requestedLangs, availableLangs, { defaultLocale }
);
const bundles = newLangs.map(
lang => new ResourceBundle(lang, resIds)
);
return Promise.resolve(bundles);
} | javascript | function requestBundles(requestedLangs = navigator.languages) {
const newLangs = negotiateLanguages(
requestedLangs, availableLangs, { defaultLocale }
);
const bundles = newLangs.map(
lang => new ResourceBundle(lang, resIds)
);
return Promise.resolve(bundles);
} | [
"function",
"requestBundles",
"(",
"requestedLangs",
"=",
"navigator",
".",
"languages",
")",
"{",
"const",
"newLangs",
"=",
"negotiateLanguages",
"(",
"requestedLangs",
",",
"availableLangs",
",",
"{",
"defaultLocale",
"}",
")",
";",
"const",
"bundles",
"=",
"n... | This function is called by `Localization` class to retrieve an array of `ResourceBundle`s. | [
"This",
"function",
"is",
"called",
"by",
"Localization",
"class",
"to",
"retrieve",
"an",
"array",
"of",
"ResourceBundle",
"s",
"."
] | a56dc2ed980db87b45b11021e645009a439a90ec | https://github.com/l20n/l20n.js/blob/a56dc2ed980db87b45b11021e645009a439a90ec/src/web/index.js#L24-L34 |
19,976 | l20n/l20n.js | src/overlay.js | isElementAllowed | function isElementAllowed(element) {
const allowed = ALLOWED_ELEMENTS[element.namespaceURI];
if (!allowed) {
return false;
}
return allowed.indexOf(element.tagName.toLowerCase()) !== -1;
} | javascript | function isElementAllowed(element) {
const allowed = ALLOWED_ELEMENTS[element.namespaceURI];
if (!allowed) {
return false;
}
return allowed.indexOf(element.tagName.toLowerCase()) !== -1;
} | [
"function",
"isElementAllowed",
"(",
"element",
")",
"{",
"const",
"allowed",
"=",
"ALLOWED_ELEMENTS",
"[",
"element",
".",
"namespaceURI",
"]",
";",
"if",
"(",
"!",
"allowed",
")",
"{",
"return",
"false",
";",
"}",
"return",
"allowed",
".",
"indexOf",
"("... | Check if element is allowed in the translation.
This method is used by the sanitizer when the translation markup contains
an element which is not present in the source code.
@param {Element} element
@returns {boolean}
@private | [
"Check",
"if",
"element",
"is",
"allowed",
"in",
"the",
"translation",
"."
] | a56dc2ed980db87b45b11021e645009a439a90ec | https://github.com/l20n/l20n.js/blob/a56dc2ed980db87b45b11021e645009a439a90ec/src/overlay.js#L154-L161 |
19,977 | l20n/l20n.js | src/overlay.js | isAttrAllowed | function isAttrAllowed(attr, element) {
const allowed = ALLOWED_ATTRIBUTES[element.namespaceURI];
if (!allowed) {
return false;
}
const attrName = attr.name.toLowerCase();
const elemName = element.tagName.toLowerCase();
// Is it a globally safe attribute?
if (allowed.global.indexOf(attrName) !== -1)... | javascript | function isAttrAllowed(attr, element) {
const allowed = ALLOWED_ATTRIBUTES[element.namespaceURI];
if (!allowed) {
return false;
}
const attrName = attr.name.toLowerCase();
const elemName = element.tagName.toLowerCase();
// Is it a globally safe attribute?
if (allowed.global.indexOf(attrName) !== -1)... | [
"function",
"isAttrAllowed",
"(",
"attr",
",",
"element",
")",
"{",
"const",
"allowed",
"=",
"ALLOWED_ATTRIBUTES",
"[",
"element",
".",
"namespaceURI",
"]",
";",
"if",
"(",
"!",
"allowed",
")",
"{",
"return",
"false",
";",
"}",
"const",
"attrName",
"=",
... | Check if attribute is allowed for the given element.
This method is used by the sanitizer when the translation markup contains
DOM attributes, or when the translation has traits which map to DOM
attributes.
@param {{name: string}} attr
@param {Element} element
@returns {boolean}
@private | [
"Check",
"if",
"attribute",
"is",
"allowed",
"for",
"the",
"given",
"element",
"."
] | a56dc2ed980db87b45b11021e645009a439a90ec | https://github.com/l20n/l20n.js/blob/a56dc2ed980db87b45b11021e645009a439a90ec/src/overlay.js#L175-L209 |
19,978 | l20n/l20n.js | src/overlay.js | getIndexOfType | function getIndexOfType(element) {
let index = 0;
let child;
while ((child = element.previousElementSibling)) {
if (child.tagName === element.tagName) {
index++;
}
}
return index;
} | javascript | function getIndexOfType(element) {
let index = 0;
let child;
while ((child = element.previousElementSibling)) {
if (child.tagName === element.tagName) {
index++;
}
}
return index;
} | [
"function",
"getIndexOfType",
"(",
"element",
")",
"{",
"let",
"index",
"=",
"0",
";",
"let",
"child",
";",
"while",
"(",
"(",
"child",
"=",
"element",
".",
"previousElementSibling",
")",
")",
"{",
"if",
"(",
"child",
".",
"tagName",
"===",
"element",
... | Get the index of the element among siblings of the same type. | [
"Get",
"the",
"index",
"of",
"the",
"element",
"among",
"siblings",
"of",
"the",
"same",
"type",
"."
] | a56dc2ed980db87b45b11021e645009a439a90ec | https://github.com/l20n/l20n.js/blob/a56dc2ed980db87b45b11021e645009a439a90ec/src/overlay.js#L230-L239 |
19,979 | syntax-tree/mdast-util-to-hast | lib/handlers/html.js | html | function html(h, node) {
return h.dangerous ? h.augment(node, u('raw', node.value)) : null
} | javascript | function html(h, node) {
return h.dangerous ? h.augment(node, u('raw', node.value)) : null
} | [
"function",
"html",
"(",
"h",
",",
"node",
")",
"{",
"return",
"h",
".",
"dangerous",
"?",
"h",
".",
"augment",
"(",
"node",
",",
"u",
"(",
"'raw'",
",",
"node",
".",
"value",
")",
")",
":",
"null",
"}"
] | Return either a `raw` node, in dangerous mode, or nothing. | [
"Return",
"either",
"a",
"raw",
"node",
"in",
"dangerous",
"mode",
"or",
"nothing",
"."
] | 751b54d3d5a0ebe03cc56290abfcbaeeeca3a326 | https://github.com/syntax-tree/mdast-util-to-hast/blob/751b54d3d5a0ebe03cc56290abfcbaeeeca3a326/lib/handlers/html.js#L8-L10 |
19,980 | syntax-tree/mdast-util-to-hast | lib/wrap.js | wrap | function wrap(nodes, loose) {
var result = []
var index = -1
var length = nodes.length
if (loose) {
result.push(u('text', '\n'))
}
while (++index < length) {
if (index) {
result.push(u('text', '\n'))
}
result.push(nodes[index])
}
if (loose && nodes.length !== 0) {
result.pu... | javascript | function wrap(nodes, loose) {
var result = []
var index = -1
var length = nodes.length
if (loose) {
result.push(u('text', '\n'))
}
while (++index < length) {
if (index) {
result.push(u('text', '\n'))
}
result.push(nodes[index])
}
if (loose && nodes.length !== 0) {
result.pu... | [
"function",
"wrap",
"(",
"nodes",
",",
"loose",
")",
"{",
"var",
"result",
"=",
"[",
"]",
"var",
"index",
"=",
"-",
"1",
"var",
"length",
"=",
"nodes",
".",
"length",
"if",
"(",
"loose",
")",
"{",
"result",
".",
"push",
"(",
"u",
"(",
"'text'",
... | Wrap `nodes` with newlines between each entry. Optionally adds newlines at the start and end. | [
"Wrap",
"nodes",
"with",
"newlines",
"between",
"each",
"entry",
".",
"Optionally",
"adds",
"newlines",
"at",
"the",
"start",
"and",
"end",
"."
] | 751b54d3d5a0ebe03cc56290abfcbaeeeca3a326 | https://github.com/syntax-tree/mdast-util-to-hast/blob/751b54d3d5a0ebe03cc56290abfcbaeeeca3a326/lib/wrap.js#L9-L31 |
19,981 | syntax-tree/mdast-util-to-hast | lib/one.js | unknown | function unknown(h, node) {
if (text(node)) {
return h.augment(node, u('text', node.value))
}
return h(node, 'div', all(h, node))
} | javascript | function unknown(h, node) {
if (text(node)) {
return h.augment(node, u('text', node.value))
}
return h(node, 'div', all(h, node))
} | [
"function",
"unknown",
"(",
"h",
",",
"node",
")",
"{",
"if",
"(",
"text",
"(",
"node",
")",
")",
"{",
"return",
"h",
".",
"augment",
"(",
"node",
",",
"u",
"(",
"'text'",
",",
"node",
".",
"value",
")",
")",
"}",
"return",
"h",
"(",
"node",
... | Transform an unknown node. | [
"Transform",
"an",
"unknown",
"node",
"."
] | 751b54d3d5a0ebe03cc56290abfcbaeeeca3a326 | https://github.com/syntax-tree/mdast-util-to-hast/blob/751b54d3d5a0ebe03cc56290abfcbaeeeca3a326/lib/one.js#L11-L17 |
19,982 | syntax-tree/mdast-util-to-hast | lib/one.js | one | function one(h, node, parent) {
var type = node && node.type
var fn = own.call(h.handlers, type) ? h.handlers[type] : null
// Fail on non-nodes.
if (!type) {
throw new Error('Expected node, got `' + node + '`')
}
return (typeof fn === 'function' ? fn : unknown)(h, node, parent)
} | javascript | function one(h, node, parent) {
var type = node && node.type
var fn = own.call(h.handlers, type) ? h.handlers[type] : null
// Fail on non-nodes.
if (!type) {
throw new Error('Expected node, got `' + node + '`')
}
return (typeof fn === 'function' ? fn : unknown)(h, node, parent)
} | [
"function",
"one",
"(",
"h",
",",
"node",
",",
"parent",
")",
"{",
"var",
"type",
"=",
"node",
"&&",
"node",
".",
"type",
"var",
"fn",
"=",
"own",
".",
"call",
"(",
"h",
".",
"handlers",
",",
"type",
")",
"?",
"h",
".",
"handlers",
"[",
"type",... | Visit a node. | [
"Visit",
"a",
"node",
"."
] | 751b54d3d5a0ebe03cc56290abfcbaeeeca3a326 | https://github.com/syntax-tree/mdast-util-to-hast/blob/751b54d3d5a0ebe03cc56290abfcbaeeeca3a326/lib/one.js#L20-L30 |
19,983 | syntax-tree/mdast-util-to-hast | lib/one.js | text | function text(node) {
var data = node.data || {}
if (
own.call(data, 'hName') ||
own.call(data, 'hProperties') ||
own.call(data, 'hChildren')
) {
return false
}
return 'value' in node
} | javascript | function text(node) {
var data = node.data || {}
if (
own.call(data, 'hName') ||
own.call(data, 'hProperties') ||
own.call(data, 'hChildren')
) {
return false
}
return 'value' in node
} | [
"function",
"text",
"(",
"node",
")",
"{",
"var",
"data",
"=",
"node",
".",
"data",
"||",
"{",
"}",
"if",
"(",
"own",
".",
"call",
"(",
"data",
",",
"'hName'",
")",
"||",
"own",
".",
"call",
"(",
"data",
",",
"'hProperties'",
")",
"||",
"own",
... | Check if the node should be renderered a text node. | [
"Check",
"if",
"the",
"node",
"should",
"be",
"renderered",
"a",
"text",
"node",
"."
] | 751b54d3d5a0ebe03cc56290abfcbaeeeca3a326 | https://github.com/syntax-tree/mdast-util-to-hast/blob/751b54d3d5a0ebe03cc56290abfcbaeeeca3a326/lib/one.js#L33-L45 |
19,984 | syntax-tree/mdast-util-to-hast | lib/index.js | factory | function factory(tree, options) {
var settings = options || {}
var dangerous = settings.allowDangerousHTML
h.dangerous = dangerous
h.definition = definitions(tree, settings)
h.footnotes = []
h.augment = augment
h.handlers = xtend(handlers, settings.handlers || {})
visit(tree, 'footnoteDefinition', vis... | javascript | function factory(tree, options) {
var settings = options || {}
var dangerous = settings.allowDangerousHTML
h.dangerous = dangerous
h.definition = definitions(tree, settings)
h.footnotes = []
h.augment = augment
h.handlers = xtend(handlers, settings.handlers || {})
visit(tree, 'footnoteDefinition', vis... | [
"function",
"factory",
"(",
"tree",
",",
"options",
")",
"{",
"var",
"settings",
"=",
"options",
"||",
"{",
"}",
"var",
"dangerous",
"=",
"settings",
".",
"allowDangerousHTML",
"h",
".",
"dangerous",
"=",
"dangerous",
"h",
".",
"definition",
"=",
"definiti... | Factory to transform. | [
"Factory",
"to",
"transform",
"."
] | 751b54d3d5a0ebe03cc56290abfcbaeeeca3a326 | https://github.com/syntax-tree/mdast-util-to-hast/blob/751b54d3d5a0ebe03cc56290abfcbaeeeca3a326/lib/index.js#L16-L86 |
19,985 | syntax-tree/mdast-util-to-hast | lib/index.js | augment | function augment(left, right) {
var data
var ctx
// Handle `data.hName`, `data.hProperties, `hChildren`.
if (left && 'data' in left) {
data = left.data
if (right.type === 'element' && data.hName) {
right.tagName = data.hName
}
if (right.type === 'element' && data.hProp... | javascript | function augment(left, right) {
var data
var ctx
// Handle `data.hName`, `data.hProperties, `hChildren`.
if (left && 'data' in left) {
data = left.data
if (right.type === 'element' && data.hName) {
right.tagName = data.hName
}
if (right.type === 'element' && data.hProp... | [
"function",
"augment",
"(",
"left",
",",
"right",
")",
"{",
"var",
"data",
"var",
"ctx",
"// Handle `data.hName`, `data.hProperties, `hChildren`.",
"if",
"(",
"left",
"&&",
"'data'",
"in",
"left",
")",
"{",
"data",
"=",
"left",
".",
"data",
"if",
"(",
"right... | Finalise the created `right`, a hast node, from `left`, an mdast node. | [
"Finalise",
"the",
"created",
"right",
"a",
"hast",
"node",
"from",
"left",
"an",
"mdast",
"node",
"."
] | 751b54d3d5a0ebe03cc56290abfcbaeeeca3a326 | https://github.com/syntax-tree/mdast-util-to-hast/blob/751b54d3d5a0ebe03cc56290abfcbaeeeca3a326/lib/index.js#L31-L62 |
19,986 | syntax-tree/mdast-util-to-hast | lib/index.js | h | function h(node, tagName, props, children) {
if (
(children === undefined || children === null) &&
typeof props === 'object' &&
'length' in props
) {
children = props
props = {}
}
return augment(node, {
type: 'element',
tagName: tagName,
properties: props... | javascript | function h(node, tagName, props, children) {
if (
(children === undefined || children === null) &&
typeof props === 'object' &&
'length' in props
) {
children = props
props = {}
}
return augment(node, {
type: 'element',
tagName: tagName,
properties: props... | [
"function",
"h",
"(",
"node",
",",
"tagName",
",",
"props",
",",
"children",
")",
"{",
"if",
"(",
"(",
"children",
"===",
"undefined",
"||",
"children",
"===",
"null",
")",
"&&",
"typeof",
"props",
"===",
"'object'",
"&&",
"'length'",
"in",
"props",
")... | Create an element for a `node`. | [
"Create",
"an",
"element",
"for",
"a",
"node",
"."
] | 751b54d3d5a0ebe03cc56290abfcbaeeeca3a326 | https://github.com/syntax-tree/mdast-util-to-hast/blob/751b54d3d5a0ebe03cc56290abfcbaeeeca3a326/lib/index.js#L65-L81 |
19,987 | syntax-tree/mdast-util-to-hast | lib/index.js | toHast | function toHast(tree, options) {
var h = factory(tree, options)
var node = one(h, tree)
var footnotes = footer(h)
if (node && node.children && footnotes) {
node.children = node.children.concat(u('text', '\n'), footnotes)
}
return node
} | javascript | function toHast(tree, options) {
var h = factory(tree, options)
var node = one(h, tree)
var footnotes = footer(h)
if (node && node.children && footnotes) {
node.children = node.children.concat(u('text', '\n'), footnotes)
}
return node
} | [
"function",
"toHast",
"(",
"tree",
",",
"options",
")",
"{",
"var",
"h",
"=",
"factory",
"(",
"tree",
",",
"options",
")",
"var",
"node",
"=",
"one",
"(",
"h",
",",
"tree",
")",
"var",
"footnotes",
"=",
"footer",
"(",
"h",
")",
"if",
"(",
"node",... | Transform `tree`, which is an mdast node, to a hast node. | [
"Transform",
"tree",
"which",
"is",
"an",
"mdast",
"node",
"to",
"a",
"hast",
"node",
"."
] | 751b54d3d5a0ebe03cc56290abfcbaeeeca3a326 | https://github.com/syntax-tree/mdast-util-to-hast/blob/751b54d3d5a0ebe03cc56290abfcbaeeeca3a326/lib/index.js#L89-L99 |
19,988 | octoblu/meshblu | docs/vendor/mixitup/mixitup.js | function(destination, source, deep, handleErrors) {
var sourceKeys = [],
key = '',
i = -1;
deep = deep || false;
handleErrors = handleErrors || false;
try {
if (Array.isArray(source)) {
... | javascript | function(destination, source, deep, handleErrors) {
var sourceKeys = [],
key = '',
i = -1;
deep = deep || false;
handleErrors = handleErrors || false;
try {
if (Array.isArray(source)) {
... | [
"function",
"(",
"destination",
",",
"source",
",",
"deep",
",",
"handleErrors",
")",
"{",
"var",
"sourceKeys",
"=",
"[",
"]",
",",
"key",
"=",
"''",
",",
"i",
"=",
"-",
"1",
";",
"deep",
"=",
"deep",
"||",
"false",
";",
"handleErrors",
"=",
"handl... | Merges the properties of the source object onto the
target object. Alters the target object.
@private
@param {object} destination
@param {object} source
@param {boolean} [deep=false]
@param {boolean} [handleErrors=false]
@return {void} | [
"Merges",
"the",
"properties",
"of",
"the",
"source",
"object",
"onto",
"the",
"target",
"object",
".",
"Alters",
"the",
"target",
"object",
"."
] | 4e7a5a0460b4eb097dfe9ff2db15853eccc779d7 | https://github.com/octoblu/meshblu/blob/4e7a5a0460b4eb097dfe9ff2db15853eccc779d7/docs/vendor/mixitup/mixitup.js#L559-L610 | |
19,989 | octoblu/meshblu | docs/vendor/mixitup/mixitup.js | function(box1, box2) {
var controlArea = box1.width * box1.height,
intersectionX = -1,
intersectionY = -1,
intersectionArea = -1,
ratio = -1;
intersectionX =
Math.max(0, Math.min... | javascript | function(box1, box2) {
var controlArea = box1.width * box1.height,
intersectionX = -1,
intersectionY = -1,
intersectionArea = -1,
ratio = -1;
intersectionX =
Math.max(0, Math.min... | [
"function",
"(",
"box1",
",",
"box2",
")",
"{",
"var",
"controlArea",
"=",
"box1",
".",
"width",
"*",
"box1",
".",
"height",
",",
"intersectionX",
"=",
"-",
"1",
",",
"intersectionY",
"=",
"-",
"1",
",",
"intersectionArea",
"=",
"-",
"1",
",",
"ratio... | Calcuates the area of intersection between two rectangles and expresses it as
a ratio in comparison to the area of the first rectangle.
@private
@param {Rect} box1
@param {Rect} box2
@return {number} | [
"Calcuates",
"the",
"area",
"of",
"intersection",
"between",
"two",
"rectangles",
"and",
"expresses",
"it",
"as",
"a",
"ratio",
"in",
"comparison",
"to",
"the",
"area",
"of",
"the",
"first",
"rectangle",
"."
] | 4e7a5a0460b4eb097dfe9ff2db15853eccc779d7 | https://github.com/octoblu/meshblu/blob/4e7a5a0460b4eb097dfe9ff2db15853eccc779d7/docs/vendor/mixitup/mixitup.js#L1096-L1114 | |
19,990 | octoblu/meshblu | docs/vendor/mixitup/mixitup.js | function(originalArray) {
var cleanArray = [],
i = -1;
for (i = 0; i < originalArray.length; i++) {
if (originalArray[i] !== '') {
cleanArray.push(originalArray[i]);
}
}
return cleanArray;
} | javascript | function(originalArray) {
var cleanArray = [],
i = -1;
for (i = 0; i < originalArray.length; i++) {
if (originalArray[i] !== '') {
cleanArray.push(originalArray[i]);
}
}
return cleanArray;
} | [
"function",
"(",
"originalArray",
")",
"{",
"var",
"cleanArray",
"=",
"[",
"]",
",",
"i",
"=",
"-",
"1",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"originalArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"originalArray",
"[",
"... | Creates a clone of a provided array, with any empty strings removed.
@private
@param {Array<*>} originalArray
@return {Array<*>} | [
"Creates",
"a",
"clone",
"of",
"a",
"provided",
"array",
"with",
"any",
"empty",
"strings",
"removed",
"."
] | 4e7a5a0460b4eb097dfe9ff2db15853eccc779d7 | https://github.com/octoblu/meshblu/blob/4e7a5a0460b4eb097dfe9ff2db15853eccc779d7/docs/vendor/mixitup/mixitup.js#L1186-L1197 | |
19,991 | octoblu/meshblu | docs/vendor/mixitup/mixitup.js | function(libraries) {
var deferred = null,
promiseWrapper = null,
$ = null;
promiseWrapper = new this.Deferred();
if (mixitup.features.has.promises) {
// ES6 native promise or polyfill
promiseWrappe... | javascript | function(libraries) {
var deferred = null,
promiseWrapper = null,
$ = null;
promiseWrapper = new this.Deferred();
if (mixitup.features.has.promises) {
// ES6 native promise or polyfill
promiseWrappe... | [
"function",
"(",
"libraries",
")",
"{",
"var",
"deferred",
"=",
"null",
",",
"promiseWrapper",
"=",
"null",
",",
"$",
"=",
"null",
";",
"promiseWrapper",
"=",
"new",
"this",
".",
"Deferred",
"(",
")",
";",
"if",
"(",
"mixitup",
".",
"features",
".",
... | Abstracts an ES6 promise into a q-like deferred interface for storage and deferred resolution.
@private
@param {object} libraries
@return {h.Deferred} | [
"Abstracts",
"an",
"ES6",
"promise",
"into",
"a",
"q",
"-",
"like",
"deferred",
"interface",
"for",
"storage",
"and",
"deferred",
"resolution",
"."
] | 4e7a5a0460b4eb097dfe9ff2db15853eccc779d7 | https://github.com/octoblu/meshblu/blob/4e7a5a0460b4eb097dfe9ff2db15853eccc779d7/docs/vendor/mixitup/mixitup.js#L1207-L1236 | |
19,992 | octoblu/meshblu | docs/vendor/mixitup/mixitup.js | function(obj, stringKey) {
var parts = stringKey.split('.'),
returnCurrent = null,
current = '',
i = 0;
if (!stringKey) {
return obj;
}
returnCurrent = function(obj) {
... | javascript | function(obj, stringKey) {
var parts = stringKey.split('.'),
returnCurrent = null,
current = '',
i = 0;
if (!stringKey) {
return obj;
}
returnCurrent = function(obj) {
... | [
"function",
"(",
"obj",
",",
"stringKey",
")",
"{",
"var",
"parts",
"=",
"stringKey",
".",
"split",
"(",
"'.'",
")",
",",
"returnCurrent",
"=",
"null",
",",
"current",
"=",
"''",
",",
"i",
"=",
"0",
";",
"if",
"(",
"!",
"stringKey",
")",
"{",
"re... | Returns the value of a property on a given object via its string key.
@param {object} obj
@param {string} stringKey
@return {*} value | [
"Returns",
"the",
"value",
"of",
"a",
"property",
"on",
"a",
"given",
"object",
"via",
"its",
"string",
"key",
"."
] | 4e7a5a0460b4eb097dfe9ff2db15853eccc779d7 | https://github.com/octoblu/meshblu/blob/4e7a5a0460b4eb097dfe9ff2db15853eccc779d7/docs/vendor/mixitup/mixitup.js#L1477-L1508 | |
19,993 | octoblu/meshblu | docs/vendor/mixitup/mixitup.js | function(actionName, args) {
var self = this,
hooks = self.constructor.actions[actionName],
extensionName = '';
if (!hooks || h.isEmptyObject(hooks)) return;
for (extensionName in hooks) {
hooks[extensionName].a... | javascript | function(actionName, args) {
var self = this,
hooks = self.constructor.actions[actionName],
extensionName = '';
if (!hooks || h.isEmptyObject(hooks)) return;
for (extensionName in hooks) {
hooks[extensionName].a... | [
"function",
"(",
"actionName",
",",
"args",
")",
"{",
"var",
"self",
"=",
"this",
",",
"hooks",
"=",
"self",
".",
"constructor",
".",
"actions",
"[",
"actionName",
"]",
",",
"extensionName",
"=",
"''",
";",
"if",
"(",
"!",
"hooks",
"||",
"h",
".",
... | Calls any registered hooks for the provided action.
@memberof mixitup.Base
@private
@instance
@since 2.0.0
@param {string} actionName
@param {Array<*>} args
@return {void} | [
"Calls",
"any",
"registered",
"hooks",
"for",
"the",
"provided",
"action",
"."
] | 4e7a5a0460b4eb097dfe9ff2db15853eccc779d7 | https://github.com/octoblu/meshblu/blob/4e7a5a0460b4eb097dfe9ff2db15853eccc779d7/docs/vendor/mixitup/mixitup.js#L1541-L1551 | |
19,994 | octoblu/meshblu | docs/vendor/mixitup/mixitup.js | function(filterName, input, args) {
var self = this,
hooks = self.constructor.filters[filterName],
output = input,
extensionName = '';
if (!hooks || h.isEmptyObject(hooks)) return output;
args = args ||... | javascript | function(filterName, input, args) {
var self = this,
hooks = self.constructor.filters[filterName],
output = input,
extensionName = '';
if (!hooks || h.isEmptyObject(hooks)) return output;
args = args ||... | [
"function",
"(",
"filterName",
",",
"input",
",",
"args",
")",
"{",
"var",
"self",
"=",
"this",
",",
"hooks",
"=",
"self",
".",
"constructor",
".",
"filters",
"[",
"filterName",
"]",
",",
"output",
"=",
"input",
",",
"extensionName",
"=",
"''",
";",
... | Calls any registered hooks for the provided filter.
@memberof mixitup.Base
@private
@instance
@since 2.0.0
@param {string} filterName
@param {*} input
@param {Array<*>} args
@return {*} | [
"Calls",
"any",
"registered",
"hooks",
"for",
"the",
"provided",
"filter",
"."
] | 4e7a5a0460b4eb097dfe9ff2db15853eccc779d7 | https://github.com/octoblu/meshblu/blob/4e7a5a0460b4eb097dfe9ff2db15853eccc779d7/docs/vendor/mixitup/mixitup.js#L1566-L1585 | |
19,995 | octoblu/meshblu | docs/vendor/mixitup/mixitup.js | function(el, document) {
var self = this;
self.callActions('beforeCacheDom', arguments);
self.dom.document = document;
self.dom.body = self.dom.document.querySelector('body');
self.dom.container = el;
self.dom.parent = el;
... | javascript | function(el, document) {
var self = this;
self.callActions('beforeCacheDom', arguments);
self.dom.document = document;
self.dom.body = self.dom.document.querySelector('body');
self.dom.container = el;
self.dom.parent = el;
... | [
"function",
"(",
"el",
",",
"document",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"callActions",
"(",
"'beforeCacheDom'",
",",
"arguments",
")",
";",
"self",
".",
"dom",
".",
"document",
"=",
"document",
";",
"self",
".",
"dom",
".",
"b... | Caches references of DOM elements neccessary for the mixer's functionality.
@private
@instance
@since 3.0.0
@param {HTMLElement} el
@param {HTMLHtmlElement} document
@return {void} | [
"Caches",
"references",
"of",
"DOM",
"elements",
"neccessary",
"for",
"the",
"mixer",
"s",
"functionality",
"."
] | 4e7a5a0460b4eb097dfe9ff2db15853eccc779d7 | https://github.com/octoblu/meshblu/blob/4e7a5a0460b4eb097dfe9ff2db15853eccc779d7/docs/vendor/mixitup/mixitup.js#L5138-L5149 | |
19,996 | octoblu/meshblu | docs/vendor/mixitup/mixitup.js | function() {
var self = this,
target = null,
el = null,
dataset = null,
i = -1;
self.callActions('beforeIndexTargets', arguments);
self.dom.targets = self.config.l... | javascript | function() {
var self = this,
target = null,
el = null,
dataset = null,
i = -1;
self.callActions('beforeIndexTargets', arguments);
self.dom.targets = self.config.l... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"target",
"=",
"null",
",",
"el",
"=",
"null",
",",
"dataset",
"=",
"null",
",",
"i",
"=",
"-",
"1",
";",
"self",
".",
"callActions",
"(",
"'beforeIndexTargets'",
",",
"arguments",
")",
";... | Indexes all child elements of the mixer matching the `selectors.target`
selector, instantiating a mixitup.Target for each one.
@private
@instance
@since 3.0.0
@return {void} | [
"Indexes",
"all",
"child",
"elements",
"of",
"the",
"mixer",
"matching",
"the",
"selectors",
".",
"target",
"selector",
"instantiating",
"a",
"mixitup",
".",
"Target",
"for",
"each",
"one",
"."
] | 4e7a5a0460b4eb097dfe9ff2db15853eccc779d7 | https://github.com/octoblu/meshblu/blob/4e7a5a0460b4eb097dfe9ff2db15853eccc779d7/docs/vendor/mixitup/mixitup.js#L5161-L5201 | |
19,997 | octoblu/meshblu | docs/vendor/mixitup/mixitup.js | function() {
var self = this,
delineator = self.config.controls.toggleLogic === 'or' ? ', ' : '',
toggleSelector = '';
self.callActions('beforeGetToggleSelector', arguments);
self.toggleArray = h.clean(self.toggleArray);
... | javascript | function() {
var self = this,
delineator = self.config.controls.toggleLogic === 'or' ? ', ' : '',
toggleSelector = '';
self.callActions('beforeGetToggleSelector', arguments);
self.toggleArray = h.clean(self.toggleArray);
... | [
"function",
"(",
")",
"{",
"var",
"self",
"=",
"this",
",",
"delineator",
"=",
"self",
".",
"config",
".",
"controls",
".",
"toggleLogic",
"===",
"'or'",
"?",
"', '",
":",
"''",
",",
"toggleSelector",
"=",
"''",
";",
"self",
".",
"callActions",
"(",
... | Creates a compound selector by joining the `toggleArray` value as per the
defined toggle logic.
@private
@instance
@since 3.0.0
@return {string} | [
"Creates",
"a",
"compound",
"selector",
"by",
"joining",
"the",
"toggleArray",
"value",
"as",
"per",
"the",
"defined",
"toggle",
"logic",
"."
] | 4e7a5a0460b4eb097dfe9ff2db15853eccc779d7 | https://github.com/octoblu/meshblu/blob/4e7a5a0460b4eb097dfe9ff2db15853eccc779d7/docs/vendor/mixitup/mixitup.js#L5329-L5345 | |
19,998 | octoblu/meshblu | docs/vendor/mixitup/mixitup.js | function(command, state) {
var self = this,
activeFilterSelector = '';
self.callActions('beforeBuildToggleArray', arguments);
if (command && command.filter) {
activeFilterSelector = command.filter.selector.replace(/\s/g, '');
... | javascript | function(command, state) {
var self = this,
activeFilterSelector = '';
self.callActions('beforeBuildToggleArray', arguments);
if (command && command.filter) {
activeFilterSelector = command.filter.selector.replace(/\s/g, '');
... | [
"function",
"(",
"command",
",",
"state",
")",
"{",
"var",
"self",
"=",
"this",
",",
"activeFilterSelector",
"=",
"''",
";",
"self",
".",
"callActions",
"(",
"'beforeBuildToggleArray'",
",",
"arguments",
")",
";",
"if",
"(",
"command",
"&&",
"command",
"."... | Breaks compound selector strings in an array of discreet selectors,
as per the active `controls.toggleLogic` configuration option. Accepts
either a dynamic command object, or a state object.
@private
@instance
@since 2.0.0
@param {object} [command]
@param {mixitup.State} [state]
@return {void} | [
"Breaks",
"compound",
"selector",
"strings",
"in",
"an",
"array",
"of",
"discreet",
"selectors",
"as",
"per",
"the",
"active",
"controls",
".",
"toggleLogic",
"configuration",
"option",
".",
"Accepts",
"either",
"a",
"dynamic",
"command",
"object",
"or",
"a",
... | 4e7a5a0460b4eb097dfe9ff2db15853eccc779d7 | https://github.com/octoblu/meshblu/blob/4e7a5a0460b4eb097dfe9ff2db15853eccc779d7/docs/vendor/mixitup/mixitup.js#L5360-L5387 | |
19,999 | octoblu/meshblu | docs/vendor/mixitup/mixitup.js | function(target, attribute) {
var self = this,
value = '';
value = target.dom.el.getAttribute('data-' + attribute);
if (value === null) {
if (self.config.debug.showWarnings) {
// Encourage users to assign values to all target... | javascript | function(target, attribute) {
var self = this,
value = '';
value = target.dom.el.getAttribute('data-' + attribute);
if (value === null) {
if (self.config.debug.showWarnings) {
// Encourage users to assign values to all target... | [
"function",
"(",
"target",
",",
"attribute",
")",
"{",
"var",
"self",
"=",
"this",
",",
"value",
"=",
"''",
";",
"value",
"=",
"target",
".",
"dom",
".",
"el",
".",
"getAttribute",
"(",
"'data-'",
"+",
"attribute",
")",
";",
"if",
"(",
"value",
"==... | Reads the values of any data attributes present the provided target element
which match the current sort command.
@private
@instance
@since 3.0.0
@param {mixitup.Target} target
@param {string} [attribute]
@return {(String|Number)} | [
"Reads",
"the",
"values",
"of",
"any",
"data",
"attributes",
"present",
"the",
"provided",
"target",
"element",
"which",
"match",
"the",
"current",
"sort",
"command",
"."
] | 4e7a5a0460b4eb097dfe9ff2db15853eccc779d7 | https://github.com/octoblu/meshblu/blob/4e7a5a0460b4eb097dfe9ff2db15853eccc779d7/docs/vendor/mixitup/mixitup.js#L5807-L5827 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.