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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
46,600 | looeee/npm-three-app | demo/module-import/js/vendor/three.module.js | function ( animation, bones ) {
if ( ! animation ) {
console.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );
return null;
}
var addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {
// only return track if there are actually keys.
if ( a... | javascript | function ( animation, bones ) {
if ( ! animation ) {
console.error( 'THREE.AnimationClip: No animation in JSONLoader data.' );
return null;
}
var addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {
// only return track if there are actually keys.
if ( a... | [
"function",
"(",
"animation",
",",
"bones",
")",
"{",
"if",
"(",
"!",
"animation",
")",
"{",
"console",
".",
"error",
"(",
"'THREE.AnimationClip: No animation in JSONLoader data.'",
")",
";",
"return",
"null",
";",
"}",
"var",
"addNonemptyTrack",
"=",
"function"... | parse the animation.hierarchy format | [
"parse",
"the",
"animation",
".",
"hierarchy",
"format"
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/three.module.js#L33468-L33589 | |
46,601 | looeee/npm-three-app | demo/module-import/js/vendor/three.module.js | function ( clip, optionalRoot ) {
var root = optionalRoot || this._root,
rootUuid = root.uuid,
clipObject = typeof clip === 'string' ?
AnimationClip.findByName( root, clip ) : clip,
clipUuid = clipObject ? clipObject.uuid : clip,
actionsForClip = this._actionsByClip[ clipUuid ];
if ( actionsFor... | javascript | function ( clip, optionalRoot ) {
var root = optionalRoot || this._root,
rootUuid = root.uuid,
clipObject = typeof clip === 'string' ?
AnimationClip.findByName( root, clip ) : clip,
clipUuid = clipObject ? clipObject.uuid : clip,
actionsForClip = this._actionsByClip[ clipUuid ];
if ( actionsFor... | [
"function",
"(",
"clip",
",",
"optionalRoot",
")",
"{",
"var",
"root",
"=",
"optionalRoot",
"||",
"this",
".",
"_root",
",",
"rootUuid",
"=",
"root",
".",
"uuid",
",",
"clipObject",
"=",
"typeof",
"clip",
"===",
"'string'",
"?",
"AnimationClip",
".",
"fi... | get an existing action | [
"get",
"an",
"existing",
"action"
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/three.module.js#L42945-L42965 | |
46,602 | looeee/npm-three-app | demo/module-import/js/vendor/three.module.js | function ( deltaTime ) {
deltaTime *= this.timeScale;
var actions = this._actions,
nActions = this._nActiveActions,
time = this.time += deltaTime,
timeDirection = Math.sign( deltaTime ),
accuIndex = this._accuIndex ^= 1;
// run active actions
for ( var i = 0; i !== nActions; ++ i ) {
var a... | javascript | function ( deltaTime ) {
deltaTime *= this.timeScale;
var actions = this._actions,
nActions = this._nActiveActions,
time = this.time += deltaTime,
timeDirection = Math.sign( deltaTime ),
accuIndex = this._accuIndex ^= 1;
// run active actions
for ( var i = 0; i !== nActions; ++ i ) {
var a... | [
"function",
"(",
"deltaTime",
")",
"{",
"deltaTime",
"*=",
"this",
".",
"timeScale",
";",
"var",
"actions",
"=",
"this",
".",
"_actions",
",",
"nActions",
"=",
"this",
".",
"_nActiveActions",
",",
"time",
"=",
"this",
".",
"time",
"+=",
"deltaTime",
",",... | advance the time and update apply the animation | [
"advance",
"the",
"time",
"and",
"update",
"apply",
"the",
"animation"
] | 439be8d3119bf0f00a7790f77a57ec76fc126580 | https://github.com/looeee/npm-three-app/blob/439be8d3119bf0f00a7790f77a57ec76fc126580/demo/module-import/js/vendor/three.module.js#L42995-L43030 | |
46,603 | ifraixedes/node-hmac-validator | src/hmac-validator.js | checkConfig | function checkConfig(config) {
let requiredProps = ['algorithm', 'format'];
const errMsg = `Configuration isn't an object with the required properties: ${requiredProps.join(', ')}`;
if ((!config) || (typeof config !== 'object')) {
throw new Error(errMsg);
}
requiredProps.forEach(p => {
if (!config[p... | javascript | function checkConfig(config) {
let requiredProps = ['algorithm', 'format'];
const errMsg = `Configuration isn't an object with the required properties: ${requiredProps.join(', ')}`;
if ((!config) || (typeof config !== 'object')) {
throw new Error(errMsg);
}
requiredProps.forEach(p => {
if (!config[p... | [
"function",
"checkConfig",
"(",
"config",
")",
"{",
"let",
"requiredProps",
"=",
"[",
"'algorithm'",
",",
"'format'",
"]",
";",
"const",
"errMsg",
"=",
"`",
"${",
"requiredProps",
".",
"join",
"(",
"', '",
")",
"}",
"`",
";",
"if",
"(",
"(",
"!",
"co... | Makes basic checks on Hmac validator configuration like required parameters.
@param {Object} config - The configuration used to create a new Hmac validator
@throws {Error} When one of the checks fails | [
"Makes",
"basic",
"checks",
"on",
"Hmac",
"validator",
"configuration",
"like",
"required",
"parameters",
"."
] | 995c0d17ca0acd2bfcad895b2dde9a6c833fb570 | https://github.com/ifraixedes/node-hmac-validator/blob/995c0d17ca0acd2bfcad895b2dde9a6c833fb570/src/hmac-validator.js#L79-L92 |
46,604 | iamso/u.js | dist/u.packed.js | function(arg) {
return /^f/.test(typeof arg) ? /c/.test(document.readyState) ? arg() : u._defInit.push(arg) : new Init(arg);
} | javascript | function(arg) {
return /^f/.test(typeof arg) ? /c/.test(document.readyState) ? arg() : u._defInit.push(arg) : new Init(arg);
} | [
"function",
"(",
"arg",
")",
"{",
"return",
"/",
"^f",
"/",
".",
"test",
"(",
"typeof",
"arg",
")",
"?",
"/",
"c",
"/",
".",
"test",
"(",
"document",
".",
"readyState",
")",
"?",
"arg",
"(",
")",
":",
"u",
".",
"_defInit",
".",
"push",
"(",
"... | u main function
@param {(string|object|function)} arg - selector, dom element or function
@return {(object|undefined)} instance or execute function on dom ready | [
"u",
"main",
"function"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L41-L43 | |
46,605 | iamso/u.js | dist/u.packed.js | function(event, selector, handler, fn) {
if (/^f/.test(typeof selector)) {
handler = selector;
fn = handler;
}
else if (/^s/.test(typeof selector)) {
fn = handler;
handler = function(e) {
var element;
if (u(e.target).is(selector)) {
eleme... | javascript | function(event, selector, handler, fn) {
if (/^f/.test(typeof selector)) {
handler = selector;
fn = handler;
}
else if (/^s/.test(typeof selector)) {
fn = handler;
handler = function(e) {
var element;
if (u(e.target).is(selector)) {
eleme... | [
"function",
"(",
"event",
",",
"selector",
",",
"handler",
",",
"fn",
")",
"{",
"if",
"(",
"/",
"^f",
"/",
".",
"test",
"(",
"typeof",
"selector",
")",
")",
"{",
"handler",
"=",
"selector",
";",
"fn",
"=",
"handler",
";",
"}",
"else",
"if",
"(",
... | one method
add one time event listeners to elements
@param {string} event - event type i.e 'click'
@param {function} handler - event handler function
@return {object} this | [
"one",
"method",
"add",
"one",
"time",
"event",
"listeners",
"to",
"elements"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L724-L755 | |
46,606 | iamso/u.js | dist/u.packed.js | function(event, selector, handler, fn) {
if (/^f/.test(typeof selector)) {
handler = selector;
}
fn = handler;
return this.each(function(index, el) {
var events = event.split(' ');
u.each(events, function(i, event, origEvent){
origEvent = u._events.remove(el, ev... | javascript | function(event, selector, handler, fn) {
if (/^f/.test(typeof selector)) {
handler = selector;
}
fn = handler;
return this.each(function(index, el) {
var events = event.split(' ');
u.each(events, function(i, event, origEvent){
origEvent = u._events.remove(el, ev... | [
"function",
"(",
"event",
",",
"selector",
",",
"handler",
",",
"fn",
")",
"{",
"if",
"(",
"/",
"^f",
"/",
".",
"test",
"(",
"typeof",
"selector",
")",
")",
"{",
"handler",
"=",
"selector",
";",
"}",
"fn",
"=",
"handler",
";",
"return",
"this",
"... | off method
remove event listeners from elements
@param {string} event - event type i.e 'click'
@param {function} handler - event handler function
@return {object} this | [
"off",
"method",
"remove",
"event",
"listeners",
"from",
"elements"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L765-L778 | |
46,607 | iamso/u.js | dist/u.packed.js | function(e, data, evt) {
if (/^f/.test(typeof CustomEvent)) {
evt = new CustomEvent(e, {
detail: data,
bubbles: true,
cancelable: false
});
}
else {
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(e, true, false, data);
... | javascript | function(e, data, evt) {
if (/^f/.test(typeof CustomEvent)) {
evt = new CustomEvent(e, {
detail: data,
bubbles: true,
cancelable: false
});
}
else {
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(e, true, false, data);
... | [
"function",
"(",
"e",
",",
"data",
",",
"evt",
")",
"{",
"if",
"(",
"/",
"^f",
"/",
".",
"test",
"(",
"typeof",
"CustomEvent",
")",
")",
"{",
"evt",
"=",
"new",
"CustomEvent",
"(",
"e",
",",
"{",
"detail",
":",
"data",
",",
"bubbles",
":",
"tru... | trigger method
trigger an event for an element
@param {string} e - event name
@param {string} [data] - custom data
@param {string} evt - placeholder for the event object
@return {object} this | [
"trigger",
"method",
"trigger",
"an",
"event",
"for",
"an",
"element"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L789-L806 | |
46,608 | iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? (this[0].scrollTop !== undefined ? this[0].scrollTop : (this[0].scrollY || this[0].pageYOffset)) : 0) : this.each(function(index, el) {
el.scrollTop === undefined || el.scrollTo !== undefined ? el.scrollTo(0, val) : el.scrollTop = val;
});
... | javascript | function(val) {
return val === undefined ? (this.length ? (this[0].scrollTop !== undefined ? this[0].scrollTop : (this[0].scrollY || this[0].pageYOffset)) : 0) : this.each(function(index, el) {
el.scrollTop === undefined || el.scrollTo !== undefined ? el.scrollTo(0, val) : el.scrollTop = val;
});
... | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"(",
"this",
"[",
"0",
"]",
".",
"scrollTop",
"!==",
"undefined",
"?",
"this",
"[",
"0",
"]",
".",
"scrollTop",
":",
"(",
"this",
"[",
"0... | scrollTop method
get or set element scrollTop
@param {number} [val] - new scrollTop
@return {number} scrollTop | [
"scrollTop",
"method",
"get",
"or",
"set",
"element",
"scrollTop"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L856-L860 | |
46,609 | iamso/u.js | dist/u.packed.js | function(to, duration, callback) {
return this.each(function(index, el) {
var _el = u(el),
start = _el.scrollTop(),
change = to - start,
currentTime = 0,
increment = 20;
duration = duration || 1500;
function easing(t, b, c, d) {
t ... | javascript | function(to, duration, callback) {
return this.each(function(index, el) {
var _el = u(el),
start = _el.scrollTop(),
change = to - start,
currentTime = 0,
increment = 20;
duration = duration || 1500;
function easing(t, b, c, d) {
t ... | [
"function",
"(",
"to",
",",
"duration",
",",
"callback",
")",
"{",
"return",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"el",
")",
"{",
"var",
"_el",
"=",
"u",
"(",
"el",
")",
",",
"start",
"=",
"_el",
".",
"scrollTop",
"(",
")",
... | scrollTo method
scroll to a certain position inside the element
@param {number} to - position to scroll to
@param {number} duration - duration for the animation
@param {function} callback - function to call when finished
@return {object} this | [
"scrollTo",
"method",
"scroll",
"to",
"a",
"certain",
"position",
"inside",
"the",
"element"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L871-L901 | |
46,610 | iamso/u.js | dist/u.packed.js | function(duration, callback) {
return this.each(function(index, el) {
u(el).scrollTo(0, duration, callback);
});
} | javascript | function(duration, callback) {
return this.each(function(index, el) {
u(el).scrollTo(0, duration, callback);
});
} | [
"function",
"(",
"duration",
",",
"callback",
")",
"{",
"return",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"el",
")",
"{",
"u",
"(",
"el",
")",
".",
"scrollTo",
"(",
"0",
",",
"duration",
",",
"callback",
")",
";",
"}",
")",
";",
... | scrollToTop method
shortcut for scroll to 0
@param {number} duration - duration for the animation
@param {function} callback - function to call when finished
@return {object} this | [
"scrollToTop",
"method",
"shortcut",
"for",
"scroll",
"to",
"0"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L911-L915 | |
46,611 | iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? this[0].clientWidth || this[0].innerWidth : 0) : this.each(function(index, el) {
el.style.width = val + 'px';
});
} | javascript | function(val) {
return val === undefined ? (this.length ? this[0].clientWidth || this[0].innerWidth : 0) : this.each(function(index, el) {
el.style.width = val + 'px';
});
} | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"clientWidth",
"||",
"this",
"[",
"0",
"]",
".",
"innerWidth",
":",
"0",
")",
":",
"this",
".",
"each",
"(",
... | width method
get or set element width
@param {number} [val] - new width
@return {number} width | [
"width",
"method",
"get",
"or",
"set",
"element",
"width"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L924-L928 | |
46,612 | iamso/u.js | dist/u.packed.js | function(margin) {
if (!this.length) {
return 0;
}
return margin ? this[0].offsetWidth + parseInt(getComputedStyle(this[0]).marginLeft) + parseInt(getComputedStyle(this[0]).marginRight) : this[0].offsetWidth;
} | javascript | function(margin) {
if (!this.length) {
return 0;
}
return margin ? this[0].offsetWidth + parseInt(getComputedStyle(this[0]).marginLeft) + parseInt(getComputedStyle(this[0]).marginRight) : this[0].offsetWidth;
} | [
"function",
"(",
"margin",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"0",
";",
"}",
"return",
"margin",
"?",
"this",
"[",
"0",
"]",
".",
"offsetWidth",
"+",
"parseInt",
"(",
"getComputedStyle",
"(",
"this",
"[",
"0",
"]",... | outerWidth method
get element outer width
@param {boolean} [margin] - if true, includes margin
@return {number} outerWidth | [
"outerWidth",
"method",
"get",
"element",
"outer",
"width"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L937-L942 | |
46,613 | iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? this[0].clientHeight || this[0].innerHeight : 0) : this.each(function(index, el) {
el.style.height = val + 'px';
});
} | javascript | function(val) {
return val === undefined ? (this.length ? this[0].clientHeight || this[0].innerHeight : 0) : this.each(function(index, el) {
el.style.height = val + 'px';
});
} | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"clientHeight",
"||",
"this",
"[",
"0",
"]",
".",
"innerHeight",
":",
"0",
")",
":",
"this",
".",
"each",
"("... | height method
get or set element height
@param {number} [val] - new height
@return {number} height | [
"height",
"method",
"get",
"or",
"set",
"element",
"height"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L951-L955 | |
46,614 | iamso/u.js | dist/u.packed.js | function(margin) {
if (!this.length) {
return 0;
}
return margin ? this[0].offsetHeight + parseInt(getComputedStyle(this[0]).marginTop) + parseInt(getComputedStyle(this[0]).marginBottom) : this[0].offsetHeight;
} | javascript | function(margin) {
if (!this.length) {
return 0;
}
return margin ? this[0].offsetHeight + parseInt(getComputedStyle(this[0]).marginTop) + parseInt(getComputedStyle(this[0]).marginBottom) : this[0].offsetHeight;
} | [
"function",
"(",
"margin",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"0",
";",
"}",
"return",
"margin",
"?",
"this",
"[",
"0",
"]",
".",
"offsetHeight",
"+",
"parseInt",
"(",
"getComputedStyle",
"(",
"this",
"[",
"0",
"]"... | outerHeight method
get element outer height
@param {boolean} [margin] - if true, includes margin
@return {number} outerHeight | [
"outerHeight",
"method",
"get",
"element",
"outer",
"height"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L964-L969 | |
46,615 | iamso/u.js | dist/u.packed.js | function(attr, val) {
return val === undefined ? (this.length ? this[0].getAttribute(attr) : null) : this.each(function(index, el) {
el.setAttribute(attr, val);
});
} | javascript | function(attr, val) {
return val === undefined ? (this.length ? this[0].getAttribute(attr) : null) : this.each(function(index, el) {
el.setAttribute(attr, val);
});
} | [
"function",
"(",
"attr",
",",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"getAttribute",
"(",
"attr",
")",
":",
"null",
")",
":",
"this",
".",
"each",
"(",
"function",
"... | attr method
get or set an attribute
@param {string} attr - attribute name
@param {string} [val] - attribute value
@return {(string|object)} attribute value or this | [
"attr",
"method",
"get",
"or",
"set",
"an",
"attribute"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1003-L1007 | |
46,616 | iamso/u.js | dist/u.packed.js | function(prop, val) {
return val === undefined ? (this.length ? this[0][prop] : null) : this.each(function(index, el) {
el[prop] = val;
});
} | javascript | function(prop, val) {
return val === undefined ? (this.length ? this[0][prop] : null) : this.each(function(index, el) {
el[prop] = val;
});
} | [
"function",
"(",
"prop",
",",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
"[",
"prop",
"]",
":",
"null",
")",
":",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"... | prop method
get or set a property of the underlying DOM object
@param {string} prop - property name
@param {string} [val] - property value
@return {(string|object)} property value or this | [
"prop",
"method",
"get",
"or",
"set",
"a",
"property",
"of",
"the",
"underlying",
"DOM",
"object"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1041-L1045 | |
46,617 | iamso/u.js | dist/u.packed.js | function(attr, val, el, index, obj, attrCamel) {
if (attr === undefined) {
if (!this.length) {
return {};
}
el = this[0];
obj = u.extend({}, el.dataset || {});
if ((index = el[u._id]) === undefined) {
el[u._id] = index = u._data.push(obj) - 1;
... | javascript | function(attr, val, el, index, obj, attrCamel) {
if (attr === undefined) {
if (!this.length) {
return {};
}
el = this[0];
obj = u.extend({}, el.dataset || {});
if ((index = el[u._id]) === undefined) {
el[u._id] = index = u._data.push(obj) - 1;
... | [
"function",
"(",
"attr",
",",
"val",
",",
"el",
",",
"index",
",",
"obj",
",",
"attrCamel",
")",
"{",
"if",
"(",
"attr",
"===",
"undefined",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"{",
"}",
";",
"}",
"el",
"=",
"... | data method
get or set a data attribute
@param {string} attr - attribute name
@param {string} [val] - attribute value
@param {undefined} [el] - element placeholder
@param {undefined} [index] - index placeholder
@param {undefined} [obj] - object plac... | [
"data",
"method",
"get",
"or",
"set",
"a",
"data",
"attribute"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1059-L1107 | |
46,618 | iamso/u.js | dist/u.packed.js | function(attr, index, attrCamel) {
return this.each(function(i, el) {
if (attr !== undefined) {
attrCamel = u.toCamel(u.toDash(attr));
if ((index = el[u._id]) !== undefined) {
el.dataset ? delete el.dataset[attrCamel] : el.removeAttribute('data-' + attr);
delete... | javascript | function(attr, index, attrCamel) {
return this.each(function(i, el) {
if (attr !== undefined) {
attrCamel = u.toCamel(u.toDash(attr));
if ((index = el[u._id]) !== undefined) {
el.dataset ? delete el.dataset[attrCamel] : el.removeAttribute('data-' + attr);
delete... | [
"function",
"(",
"attr",
",",
"index",
",",
"attrCamel",
")",
"{",
"return",
"this",
".",
"each",
"(",
"function",
"(",
"i",
",",
"el",
")",
"{",
"if",
"(",
"attr",
"!==",
"undefined",
")",
"{",
"attrCamel",
"=",
"u",
".",
"toCamel",
"(",
"u",
".... | removeData method
remove data attribute
@param {string} attr - attribute name
@param {undefined} [index] - index placeholder
@param {undefined} [attrCamel] - placeholder for attribute name in camelCase
@return {object} this | [
"removeData",
"method",
"remove",
"data",
"attribute"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1118-L1128 | |
46,619 | iamso/u.js | dist/u.packed.js | function(props, val) {
if (/^o/.test(typeof props)) {
for(var prop in props) {
var prefixed = u.prfx(prop);
if (props.hasOwnProperty(prop)) {
this.each(function(index, el) {
el.style[prefixed] = props[prop];
});
}
}
return... | javascript | function(props, val) {
if (/^o/.test(typeof props)) {
for(var prop in props) {
var prefixed = u.prfx(prop);
if (props.hasOwnProperty(prop)) {
this.each(function(index, el) {
el.style[prefixed] = props[prop];
});
}
}
return... | [
"function",
"(",
"props",
",",
"val",
")",
"{",
"if",
"(",
"/",
"^o",
"/",
".",
"test",
"(",
"typeof",
"props",
")",
")",
"{",
"for",
"(",
"var",
"prop",
"in",
"props",
")",
"{",
"var",
"prefixed",
"=",
"u",
".",
"prfx",
"(",
"prop",
")",
";"... | css method
get or set css properties
@param {(string|object)} props - property name or object with names and values
@param {string} [val] - property value
@return {(string|object)} property value or this | [
"css",
"method",
"get",
"or",
"set",
"css",
"properties"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1138-L1156 | |
46,620 | iamso/u.js | dist/u.packed.js | function(child) {
return this.length ? (/^o/.test(typeof child) ? this[0] !== child[0] && this[0].contains(child[0]) : this[0].querySelector(child) !== null) : false;
} | javascript | function(child) {
return this.length ? (/^o/.test(typeof child) ? this[0] !== child[0] && this[0].contains(child[0]) : this[0].querySelector(child) !== null) : false;
} | [
"function",
"(",
"child",
")",
"{",
"return",
"this",
".",
"length",
"?",
"(",
"/",
"^o",
"/",
".",
"test",
"(",
"typeof",
"child",
")",
"?",
"this",
"[",
"0",
"]",
"!==",
"child",
"[",
"0",
"]",
"&&",
"this",
"[",
"0",
"]",
".",
"contains",
... | contains method
check if child is contained in this element
@param {(string|object)} child - element or css selector
@return {boolean} | [
"contains",
"method",
"check",
"if",
"child",
"is",
"contained",
"in",
"this",
"element"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1278-L1280 | |
46,621 | iamso/u.js | dist/u.packed.js | function(filter) {
return u(array.filter.call(this, function(el, index) {
return /^f/.test(typeof filter) ? filter(index, el) : u(el).is(filter);
}));
} | javascript | function(filter) {
return u(array.filter.call(this, function(el, index) {
return /^f/.test(typeof filter) ? filter(index, el) : u(el).is(filter);
}));
} | [
"function",
"(",
"filter",
")",
"{",
"return",
"u",
"(",
"array",
".",
"filter",
".",
"call",
"(",
"this",
",",
"function",
"(",
"el",
",",
"index",
")",
"{",
"return",
"/",
"^f",
"/",
".",
"test",
"(",
"typeof",
"filter",
")",
"?",
"filter",
"("... | filter method
filter elements by selector or filter function
@param {string|function} filter - selector or filter function
@return {object} matching elements | [
"filter",
"method",
"filter",
"elements",
"by",
"selector",
"or",
"filter",
"function"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1300-L1304 | |
46,622 | iamso/u.js | dist/u.packed.js | function(sel) {
if (!this.length) {
return false;
}
var m = (this[0].matches || this[0].matchesSelector || this[0].msMatchesSelector || this[0].mozMatchesSelector || this[0].webkitMatchesSelector || this[0].oMatchesSelector || function(s) {
return [].indexOf.call(document.querySelector... | javascript | function(sel) {
if (!this.length) {
return false;
}
var m = (this[0].matches || this[0].matchesSelector || this[0].msMatchesSelector || this[0].mozMatchesSelector || this[0].webkitMatchesSelector || this[0].oMatchesSelector || function(s) {
return [].indexOf.call(document.querySelector... | [
"function",
"(",
"sel",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"var",
"m",
"=",
"(",
"this",
"[",
"0",
"]",
".",
"matches",
"||",
"this",
"[",
"0",
"]",
".",
"matchesSelector",
"||",
"this",
"[",... | is method
matches the element against a selector
@param {string} sel - selector to match
@return {boolean} | [
"is",
"method",
"matches",
"the",
"element",
"against",
"a",
"selector"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1313-L1321 | |
46,623 | iamso/u.js | dist/u.packed.js | function(el) {
if (!el) {
return this[0] ? this.first().prevAll().length : -1;
}
if (''+el === el) {
return u.toArray(u(el)).indexOf(this[0]);
}
el = el.ujs ? el[0] : el;
return u.toArray(this).indexOf(el);
} | javascript | function(el) {
if (!el) {
return this[0] ? this.first().prevAll().length : -1;
}
if (''+el === el) {
return u.toArray(u(el)).indexOf(this[0]);
}
el = el.ujs ? el[0] : el;
return u.toArray(this).indexOf(el);
} | [
"function",
"(",
"el",
")",
"{",
"if",
"(",
"!",
"el",
")",
"{",
"return",
"this",
"[",
"0",
"]",
"?",
"this",
".",
"first",
"(",
")",
".",
"prevAll",
"(",
")",
".",
"length",
":",
"-",
"1",
";",
"}",
"if",
"(",
"''",
"+",
"el",
"===",
"e... | index method
get the index of an element
@param {object|string} [el] - elements or css selector
@return {number} index | [
"index",
"method",
"get",
"the",
"index",
"of",
"an",
"element"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1340-L1349 | |
46,624 | iamso/u.js | dist/u.packed.js | function(sel) {
if (!this.length) {
return this;
}
var matched = [],
el = this[0];
while (el = el.previousElementSibling) {
sel ?
(u(el).is(sel) && matched.push(el)) :
matched.push(el);
}
return u(matched);
} | javascript | function(sel) {
if (!this.length) {
return this;
}
var matched = [],
el = this[0];
while (el = el.previousElementSibling) {
sel ?
(u(el).is(sel) && matched.push(el)) :
matched.push(el);
}
return u(matched);
} | [
"function",
"(",
"sel",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"this",
";",
"}",
"var",
"matched",
"=",
"[",
"]",
",",
"el",
"=",
"this",
"[",
"0",
"]",
";",
"while",
"(",
"el",
"=",
"el",
".",
"previousElementSibl... | prevAll method
get all previous element siblings
@param {string} [sel] - selector to filter siblings
@return {object} sibling elements | [
"prevAll",
"method",
"get",
"all",
"previous",
"element",
"siblings"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1369-L1382 | |
46,625 | iamso/u.js | dist/u.packed.js | function(sel) {
if (!this.length) {
return this;
}
var matched = [],
el = this[0];
while (el = el.nextElementSibling) {
sel ?
(u(el).is(sel) && matched.push(el)) :
matched.push(el);
}
return u(matched);
} | javascript | function(sel) {
if (!this.length) {
return this;
}
var matched = [],
el = this[0];
while (el = el.nextElementSibling) {
sel ?
(u(el).is(sel) && matched.push(el)) :
matched.push(el);
}
return u(matched);
} | [
"function",
"(",
"sel",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"this",
";",
"}",
"var",
"matched",
"=",
"[",
"]",
",",
"el",
"=",
"this",
"[",
"0",
"]",
";",
"while",
"(",
"el",
"=",
"el",
".",
"nextElementSibling"... | nextAll method
get all next element siblings
@param {string} [sel] - selector to filter siblings
@return {object} sibling elements | [
"nextAll",
"method",
"get",
"all",
"next",
"element",
"siblings"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1402-L1415 | |
46,626 | iamso/u.js | dist/u.packed.js | function(sel) {
if (!this.length) {
return this;
}
var el = this[0];
return u(array.filter.call(el.parentNode.children, function(child) {
return sel ? child !== el && u(child).is(sel) : child !== el;
}));
} | javascript | function(sel) {
if (!this.length) {
return this;
}
var el = this[0];
return u(array.filter.call(el.parentNode.children, function(child) {
return sel ? child !== el && u(child).is(sel) : child !== el;
}));
} | [
"function",
"(",
"sel",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"this",
";",
"}",
"var",
"el",
"=",
"this",
"[",
"0",
"]",
";",
"return",
"u",
"(",
"array",
".",
"filter",
".",
"call",
"(",
"el",
".",
"parentNode",
... | siblings method
get element siblings
@param {string} [sel] - selector to filter siblings
@return {object} sibling elements | [
"siblings",
"method",
"get",
"element",
"siblings"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1424-L1432 | |
46,627 | iamso/u.js | dist/u.packed.js | function(sel) {
if (!this.length) {
return this;
}
var parents = [],
finished = false,
currentElement = this[0];
while (!finished) {
currentElement = currentElement.parentNode;
if (currentElement) {
if (sel === undefined) {
paren... | javascript | function(sel) {
if (!this.length) {
return this;
}
var parents = [],
finished = false,
currentElement = this[0];
while (!finished) {
currentElement = currentElement.parentNode;
if (currentElement) {
if (sel === undefined) {
paren... | [
"function",
"(",
"sel",
")",
"{",
"if",
"(",
"!",
"this",
".",
"length",
")",
"{",
"return",
"this",
";",
"}",
"var",
"parents",
"=",
"[",
"]",
",",
"finished",
"=",
"false",
",",
"currentElement",
"=",
"this",
"[",
"0",
"]",
";",
"while",
"(",
... | parents method
get the parent elements
@return {object} element | [
"parents",
"method",
"get",
"the",
"parent",
"elements"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1450-L1473 | |
46,628 | iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? this[0].textContent : null) : this.each(function(index, el) {
el.textContent = val;
});
} | javascript | function(val) {
return val === undefined ? (this.length ? this[0].textContent : null) : this.each(function(index, el) {
el.textContent = val;
});
} | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"textContent",
":",
"null",
")",
":",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"el",
")",
"{"... | text method
get or set the textContent value
@param {string} [val] - text value
@return {(string|object)} text value or this | [
"text",
"method",
"get",
"or",
"set",
"the",
"textContent",
"value"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1482-L1486 | |
46,629 | iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? this[0].innerHTML : null) : this.each(function(index, el) {
el.innerHTML = val;
});
} | javascript | function(val) {
return val === undefined ? (this.length ? this[0].innerHTML : null) : this.each(function(index, el) {
el.innerHTML = val;
});
} | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"innerHTML",
":",
"null",
")",
":",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"el",
")",
"{",
... | html method
get or set innerHTML value
@param {string} [val] - html value
@return {(string|object)} html value or this | [
"html",
"method",
"get",
"or",
"set",
"innerHTML",
"value"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1495-L1499 | |
46,630 | iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? this[0].outerHTML : null) : this.each(function(index, el) {
el.outerHTML = val;
});
} | javascript | function(val) {
return val === undefined ? (this.length ? this[0].outerHTML : null) : this.each(function(index, el) {
el.outerHTML = val;
});
} | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"outerHTML",
":",
"null",
")",
":",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"el",
")",
"{",
... | outerHTML method
get or set outerHTML value
@param {string} [val] - html value
@return {(string|object)} html value or this | [
"outerHTML",
"method",
"get",
"or",
"set",
"outerHTML",
"value"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1508-L1512 | |
46,631 | iamso/u.js | dist/u.packed.js | function(val) {
return val === undefined ? (this.length ? this[0].value : null) : this.each(function(index, el) {
el.value = val;
});
} | javascript | function(val) {
return val === undefined ? (this.length ? this[0].value : null) : this.each(function(index, el) {
el.value = val;
});
} | [
"function",
"(",
"val",
")",
"{",
"return",
"val",
"===",
"undefined",
"?",
"(",
"this",
".",
"length",
"?",
"this",
"[",
"0",
"]",
".",
"value",
":",
"null",
")",
":",
"this",
".",
"each",
"(",
"function",
"(",
"index",
",",
"el",
")",
"{",
"e... | val method
get or set the value property of inputs and textareas
@param {string} [val] - text value
@return {(string|object)} text value or this | [
"val",
"method",
"get",
"or",
"set",
"the",
"value",
"property",
"of",
"inputs",
"and",
"textareas"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1521-L1525 | |
46,632 | iamso/u.js | dist/u.packed.js | function() {
var args = u.toArray(arguments);
args.unshift(u.fn);
return u.extend.apply(this, args);
} | javascript | function() {
var args = u.toArray(arguments);
args.unshift(u.fn);
return u.extend.apply(this, args);
} | [
"function",
"(",
")",
"{",
"var",
"args",
"=",
"u",
".",
"toArray",
"(",
"arguments",
")",
";",
"args",
".",
"unshift",
"(",
"u",
".",
"fn",
")",
";",
"return",
"u",
".",
"extend",
".",
"apply",
"(",
"this",
",",
"args",
")",
";",
"}"
] | extend method
extend the u.js prototype object
@return {object} u.js prototype | [
"extend",
"method",
"extend",
"the",
"u",
".",
"js",
"prototype",
"object"
] | e82362d337b439e28d223931a6d489969c7b379c | https://github.com/iamso/u.js/blob/e82362d337b439e28d223931a6d489969c7b379c/dist/u.packed.js#L1600-L1604 | |
46,633 | freakimkaefig/musicjson2abc | lib/abc_parser/data/Tune.js | function(params) {
This.lines[This.lineNum].staff[This.staffNum].voices[This.voiceNum] = [];
if (This.isFirstLine(This.lineNum)) {
if (params.name) {if (!This.lines[This.lineNum].staff[This.staffNum].title) This.lines[This.lineNum].staff[This.staffNum].title = [];This.lines[This.lineNum].staff[This.... | javascript | function(params) {
This.lines[This.lineNum].staff[This.staffNum].voices[This.voiceNum] = [];
if (This.isFirstLine(This.lineNum)) {
if (params.name) {if (!This.lines[This.lineNum].staff[This.staffNum].title) This.lines[This.lineNum].staff[This.staffNum].title = [];This.lines[This.lineNum].staff[This.... | [
"function",
"(",
"params",
")",
"{",
"This",
".",
"lines",
"[",
"This",
".",
"lineNum",
"]",
".",
"staff",
"[",
"This",
".",
"staffNum",
"]",
".",
"voices",
"[",
"This",
".",
"voiceNum",
"]",
"=",
"[",
"]",
";",
"if",
"(",
"This",
".",
"isFirstLi... | Close the previous line. | [
"Close",
"the",
"previous",
"line",
"."
] | c119c7927c3c9b6aa5f3558cc73990478472dfbb | https://github.com/freakimkaefig/musicjson2abc/blob/c119c7927c3c9b6aa5f3558cc73990478472dfbb/lib/abc_parser/data/Tune.js#L585-L612 | |
46,634 | Hugo-ter-Doest/chart-parsers | lib/TypedFeatureStructure.js | featureIsUnifiable | function featureIsUnifiable(feature) {
logger.debug('TypedFeatureStructure.unifiable: checking feature: ' + feature + fs2.features[feature]);
if (fs1.features[feature]) {
// If feature of fs2 is a back pointer we want it to overrule feature
// of the fs1.
if (newStackb.inde... | javascript | function featureIsUnifiable(feature) {
logger.debug('TypedFeatureStructure.unifiable: checking feature: ' + feature + fs2.features[feature]);
if (fs1.features[feature]) {
// If feature of fs2 is a back pointer we want it to overrule feature
// of the fs1.
if (newStackb.inde... | [
"function",
"featureIsUnifiable",
"(",
"feature",
")",
"{",
"logger",
".",
"debug",
"(",
"'TypedFeatureStructure.unifiable: checking feature: '",
"+",
"feature",
"+",
"fs2",
".",
"features",
"[",
"feature",
"]",
")",
";",
"if",
"(",
"fs1",
".",
"features",
"[",
... | Checks if a feature of two features structures can be unified | [
"Checks",
"if",
"a",
"feature",
"of",
"two",
"features",
"structures",
"can",
"be",
"unified"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/TypedFeatureStructure.js#L243-L268 |
46,635 | Hugo-ter-Doest/chart-parsers | lib/TypedFeatureStructure.js | prettyPrint0 | function prettyPrint0(fs, indent) {
logger.debug('prettyPrint0: ' + fs);
var result = '';
if (fs) {
if (Object.keys(fs.incoming).length > 1) {
if (fs.printed) {
// Return the label
return (fs.getLabel());
}
else {
// Print the label
resu... | javascript | function prettyPrint0(fs, indent) {
logger.debug('prettyPrint0: ' + fs);
var result = '';
if (fs) {
if (Object.keys(fs.incoming).length > 1) {
if (fs.printed) {
// Return the label
return (fs.getLabel());
}
else {
// Print the label
resu... | [
"function",
"prettyPrint0",
"(",
"fs",
",",
"indent",
")",
"{",
"logger",
".",
"debug",
"(",
"'prettyPrint0: '",
"+",
"fs",
")",
";",
"var",
"result",
"=",
"''",
";",
"if",
"(",
"fs",
")",
"{",
"if",
"(",
"Object",
".",
"keys",
"(",
"fs",
".",
"i... | Actual pretty printer | [
"Actual",
"pretty",
"printer"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/TypedFeatureStructure.js#L705-L816 |
46,636 | thealjey/webcompiler | lib/livereload.js | livereload | function livereload() {
if (!reloadFn) {
const lr = (0, _tinyLr2.default)();
lr.listen(LIVERELOAD_PORT);
reloadFn = (file = '*') => {
lr.changed({ body: { files: [file] } });
};
}
return reloadFn;
} | javascript | function livereload() {
if (!reloadFn) {
const lr = (0, _tinyLr2.default)();
lr.listen(LIVERELOAD_PORT);
reloadFn = (file = '*') => {
lr.changed({ body: { files: [file] } });
};
}
return reloadFn;
} | [
"function",
"livereload",
"(",
")",
"{",
"if",
"(",
"!",
"reloadFn",
")",
"{",
"const",
"lr",
"=",
"(",
"0",
",",
"_tinyLr2",
".",
"default",
")",
"(",
")",
";",
"lr",
".",
"listen",
"(",
"LIVERELOAD_PORT",
")",
";",
"reloadFn",
"=",
"(",
"file",
... | Starts a LiveReload server and returns a function that triggers the reload.
@function livereload
@return {LiveReloadTrigger} the trigger function
@example
<link rel="stylesheet" href="css/style.css">
@example
import {livereload} from 'webcompiler';
// or - import {livereload} from 'webcompiler/lib/livereload';
// or -... | [
"Starts",
"a",
"LiveReload",
"server",
"and",
"returns",
"a",
"function",
"that",
"triggers",
"the",
"reload",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/livereload.js#L40-L52 |
46,637 | Aigeec/mandrill-webhook-authenticator | src/mandrill-webhook-authenticator.js | function(fullUrl, body, key, signature) {
var data = fullUrl + sortPostParameters(body);
var expected = getHash(data, key);
return expected === signature;
} | javascript | function(fullUrl, body, key, signature) {
var data = fullUrl + sortPostParameters(body);
var expected = getHash(data, key);
return expected === signature;
} | [
"function",
"(",
"fullUrl",
",",
"body",
",",
"key",
",",
"signature",
")",
"{",
"var",
"data",
"=",
"fullUrl",
"+",
"sortPostParameters",
"(",
"body",
")",
";",
"var",
"expected",
"=",
"getHash",
"(",
"data",
",",
"key",
")",
";",
"return",
"expected"... | Generate the signature from the full url and sorted post data to compart to the one provided.
When mandrill is testing the existence of a url it can send a post request with no events and key set to 'test-webhook'.
@param { string } fullUrl - domain and url of request - should match exactly the url specified in the web... | [
"Generate",
"the",
"signature",
"from",
"the",
"full",
"url",
"and",
"sorted",
"post",
"data",
"to",
"compart",
"to",
"the",
"one",
"provided",
".",
"When",
"mandrill",
"is",
"testing",
"the",
"existence",
"of",
"a",
"url",
"it",
"can",
"send",
"a",
"pos... | d140241b5f274d4e951b1a294e35195a7e4177f9 | https://github.com/Aigeec/mandrill-webhook-authenticator/blob/d140241b5f274d4e951b1a294e35195a7e4177f9/src/mandrill-webhook-authenticator.js#L70-L74 | |
46,638 | Aigeec/mandrill-webhook-authenticator | src/mandrill-webhook-authenticator.js | function(body) {
body = Object(body);
var sortedKeys = Object.keys(body).sort();
return sortedKeys.reduce(function(signature, key) {
return signature + key + body[key];
}, '');
} | javascript | function(body) {
body = Object(body);
var sortedKeys = Object.keys(body).sort();
return sortedKeys.reduce(function(signature, key) {
return signature + key + body[key];
}, '');
} | [
"function",
"(",
"body",
")",
"{",
"body",
"=",
"Object",
"(",
"body",
")",
";",
"var",
"sortedKeys",
"=",
"Object",
".",
"keys",
"(",
"body",
")",
".",
"sort",
"(",
")",
";",
"return",
"sortedKeys",
".",
"reduce",
"(",
"function",
"(",
"signature",
... | Sort the post parameters alphabetically and append each POST variable's key and value with no delimiter.
@param { string } body - Post body
@returns { string } string of sorted key values with no delimiter | [
"Sort",
"the",
"post",
"parameters",
"alphabetically",
"and",
"append",
"each",
"POST",
"variable",
"s",
"key",
"and",
"value",
"with",
"no",
"delimiter",
"."
] | d140241b5f274d4e951b1a294e35195a7e4177f9 | https://github.com/Aigeec/mandrill-webhook-authenticator/blob/d140241b5f274d4e951b1a294e35195a7e4177f9/src/mandrill-webhook-authenticator.js#L81-L87 | |
46,639 | Aigeec/mandrill-webhook-authenticator | src/mandrill-webhook-authenticator.js | function(req, res, next) {
var signature = req.headers[MANDRILL_SIGNATURE_HEADER];
var fullUrl = options.domain + req.url;
var isValid = validator(fullUrl, req.body, signature);
var respondWith = responder(res);
if (!signature) {
respondWith(401, NOT_AUTHORIZED);
}else if (... | javascript | function(req, res, next) {
var signature = req.headers[MANDRILL_SIGNATURE_HEADER];
var fullUrl = options.domain + req.url;
var isValid = validator(fullUrl, req.body, signature);
var respondWith = responder(res);
if (!signature) {
respondWith(401, NOT_AUTHORIZED);
}else if (... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"signature",
"=",
"req",
".",
"headers",
"[",
"MANDRILL_SIGNATURE_HEADER",
"]",
";",
"var",
"fullUrl",
"=",
"options",
".",
"domain",
"+",
"req",
".",
"url",
";",
"var",
"isValid",
"=",
... | Express middleware compatible function to process requests and only continure if the signature is valid. Will return 200 if the request is a test request. It does not update the request.
@param { Request } req
@param { Response } res
@param { function } next | [
"Express",
"middleware",
"compatible",
"function",
"to",
"process",
"requests",
"and",
"only",
"continure",
"if",
"the",
"signature",
"is",
"valid",
".",
"Will",
"return",
"200",
"if",
"the",
"request",
"is",
"a",
"test",
"request",
".",
"It",
"does",
"not",... | d140241b5f274d4e951b1a294e35195a7e4177f9 | https://github.com/Aigeec/mandrill-webhook-authenticator/blob/d140241b5f274d4e951b1a294e35195a7e4177f9/src/mandrill-webhook-authenticator.js#L134-L150 | |
46,640 | souporserious/create-styled-element | example/index.js | Column | function Column({ size, ...props }) {
const staticStyles = {
display: 'flex',
flexDirection: 'column',
}
const dynamicStyles = {
flex: `0 0 ${size / 12 * 100}`,
}
return createStyledElement('div', props)(staticStyles, dynamicStyles)
} | javascript | function Column({ size, ...props }) {
const staticStyles = {
display: 'flex',
flexDirection: 'column',
}
const dynamicStyles = {
flex: `0 0 ${size / 12 * 100}`,
}
return createStyledElement('div', props)(staticStyles, dynamicStyles)
} | [
"function",
"Column",
"(",
"{",
"size",
",",
"...",
"props",
"}",
")",
"{",
"const",
"staticStyles",
"=",
"{",
"display",
":",
"'flex'",
",",
"flexDirection",
":",
"'column'",
",",
"}",
"const",
"dynamicStyles",
"=",
"{",
"flex",
":",
"`",
"${",
"size"... | Multiple Styled Components Example | [
"Multiple",
"Styled",
"Components",
"Example"
] | 3abe540520cc25a44e4cb9e157e0eceeacf8f08f | https://github.com/souporserious/create-styled-element/blob/3abe540520cc25a44e4cb9e157e0eceeacf8f08f/example/index.js#L19-L28 |
46,641 | meerkats/winston-slacker | index.js | Slack | function Slack(options) {
var suppliedOptions = options ? options : {};
if (!suppliedOptions.webhook || typeof suppliedOptions.webhook !== 'string') {
throw new Error('Invalid webhook parameter');
}
this.name = 'slack';
this.webhook = suppliedOptions.webhook;
this.customFormatter = suppliedOptions.custo... | javascript | function Slack(options) {
var suppliedOptions = options ? options : {};
if (!suppliedOptions.webhook || typeof suppliedOptions.webhook !== 'string') {
throw new Error('Invalid webhook parameter');
}
this.name = 'slack';
this.webhook = suppliedOptions.webhook;
this.customFormatter = suppliedOptions.custo... | [
"function",
"Slack",
"(",
"options",
")",
"{",
"var",
"suppliedOptions",
"=",
"options",
"?",
"options",
":",
"{",
"}",
";",
"if",
"(",
"!",
"suppliedOptions",
".",
"webhook",
"||",
"typeof",
"suppliedOptions",
".",
"webhook",
"!==",
"'string'",
")",
"{",
... | Slack integration for Winston
@param {object} Options parameter | [
"Slack",
"integration",
"for",
"Winston"
] | fdd4c3ff41b600749708f9d6b64f298e5c9beb30 | https://github.com/meerkats/winston-slacker/blob/fdd4c3ff41b600749708f9d6b64f298e5c9beb30/index.js#L19-L40 |
46,642 | meerkats/winston-slacker | index.js | send | function send(message, callback) {
const suppliedCallback = callback || function () {};
if (!message) {
return suppliedCallback(new Error('No message'));
}
const requestParams = {
url: this.webhook,
body: extend(this.options, { text: message }),
json: true
};
return request.post(requestParam... | javascript | function send(message, callback) {
const suppliedCallback = callback || function () {};
if (!message) {
return suppliedCallback(new Error('No message'));
}
const requestParams = {
url: this.webhook,
body: extend(this.options, { text: message }),
json: true
};
return request.post(requestParam... | [
"function",
"send",
"(",
"message",
",",
"callback",
")",
"{",
"const",
"suppliedCallback",
"=",
"callback",
"||",
"function",
"(",
")",
"{",
"}",
";",
"if",
"(",
"!",
"message",
")",
"{",
"return",
"suppliedCallback",
"(",
"new",
"Error",
"(",
"'No mess... | Handles the sending of a message to an Incoming webhook
@param {text} Message text
@param {function} Callback function for post execution | [
"Handles",
"the",
"sending",
"of",
"a",
"message",
"to",
"an",
"Incoming",
"webhook"
] | fdd4c3ff41b600749708f9d6b64f298e5c9beb30 | https://github.com/meerkats/winston-slacker/blob/fdd4c3ff41b600749708f9d6b64f298e5c9beb30/index.js#L47-L63 |
46,643 | Hugo-ter-Doest/chart-parsers | example/example_with_wordnet.js | tokenize_sentence | function tokenize_sentence(sentence) {
var tokenized = tokenizer.tokenize(sentence);
logger.info("tokenize_sentence: " + tokenized);
return(tokenized);
} | javascript | function tokenize_sentence(sentence) {
var tokenized = tokenizer.tokenize(sentence);
logger.info("tokenize_sentence: " + tokenized);
return(tokenized);
} | [
"function",
"tokenize_sentence",
"(",
"sentence",
")",
"{",
"var",
"tokenized",
"=",
"tokenizer",
".",
"tokenize",
"(",
"sentence",
")",
";",
"logger",
".",
"info",
"(",
"\"tokenize_sentence: \"",
"+",
"tokenized",
")",
";",
"return",
"(",
"tokenized",
")",
... | Split sentence in words and punctuation | [
"Split",
"sentence",
"in",
"words",
"and",
"punctuation"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/example/example_with_wordnet.js#L73-L77 |
46,644 | Hugo-ter-Doest/chart-parsers | example/example_with_wordnet.js | stem_sentence | function stem_sentence(sentence) {
for (var i = 0; i < sentence.length; i++) {
sentence[i] = natural.PorterStemmer.stem(sentence[i]);
}
logger.info("stem_sentence: " + sentence);
return(sentence);
} | javascript | function stem_sentence(sentence) {
for (var i = 0; i < sentence.length; i++) {
sentence[i] = natural.PorterStemmer.stem(sentence[i]);
}
logger.info("stem_sentence: " + sentence);
return(sentence);
} | [
"function",
"stem_sentence",
"(",
"sentence",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"sentence",
".",
"length",
";",
"i",
"++",
")",
"{",
"sentence",
"[",
"i",
"]",
"=",
"natural",
".",
"PorterStemmer",
".",
"stem",
"(",
"senten... | Stem the words of the sentence Not used in the example, because Wordnet cannot recognise all stems | [
"Stem",
"the",
"words",
"of",
"the",
"sentence",
"Not",
"used",
"in",
"the",
"example",
"because",
"Wordnet",
"cannot",
"recognise",
"all",
"stems"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/example/example_with_wordnet.js#L81-L87 |
46,645 | Hugo-ter-Doest/chart-parsers | lib/Type.js | Type | function Type(name, super_types, fs) {
this.super_types = [];
this.name = name;
if (super_types) {
this.super_types = super_types;
}
this.fs = fs;
} | javascript | function Type(name, super_types, fs) {
this.super_types = [];
this.name = name;
if (super_types) {
this.super_types = super_types;
}
this.fs = fs;
} | [
"function",
"Type",
"(",
"name",
",",
"super_types",
",",
"fs",
")",
"{",
"this",
".",
"super_types",
"=",
"[",
"]",
";",
"this",
".",
"name",
"=",
"name",
";",
"if",
"(",
"super_types",
")",
"{",
"this",
".",
"super_types",
"=",
"super_types",
";",
... | Constructor - name is a string - super_types is an array of types; it should be nonempty | [
"Constructor",
"-",
"name",
"is",
"a",
"string",
"-",
"super_types",
"is",
"an",
"array",
"of",
"types",
";",
"it",
"should",
"be",
"nonempty"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/Type.js#L28-L35 |
46,646 | svanderburg/nijs | lib/ast/NixFunction.js | NixFunction | function NixFunction(args) {
if(args.argSpec === null) {
throw "Cannot derivate function argument specification from a null reference";
} else if(typeof args.argSpec == "string" || typeof args.argSpec == "object") {
this.argSpec = args.argSpec;
this.body = args.body;
} else {
... | javascript | function NixFunction(args) {
if(args.argSpec === null) {
throw "Cannot derivate function argument specification from a null reference";
} else if(typeof args.argSpec == "string" || typeof args.argSpec == "object") {
this.argSpec = args.argSpec;
this.body = args.body;
} else {
... | [
"function",
"NixFunction",
"(",
"args",
")",
"{",
"if",
"(",
"args",
".",
"argSpec",
"===",
"null",
")",
"{",
"throw",
"\"Cannot derivate function argument specification from a null reference\"",
";",
"}",
"else",
"if",
"(",
"typeof",
"args",
".",
"argSpec",
"==",... | Creates a new NixFunction instance.
@class NixFunction
@extends NixBlock
@classdesc Captures the abstract syntax of a Nix function consisting of an
argument and function body.
@constructor
@param {Object} args Arguments to this function
@param {Mixed} args.argSpec Argument specification of the function. If a string i... | [
"Creates",
"a",
"new",
"NixFunction",
"instance",
"."
] | 4e2738cbff3a43aba9297315ca5120cecf8dae3e | https://github.com/svanderburg/nijs/blob/4e2738cbff3a43aba9297315ca5120cecf8dae3e/lib/ast/NixFunction.js#L23-L32 |
46,647 | cosmojs/loopback-satellizer | index.js | function(req, res, next) {
var requestTokenUrl = 'https://api.twitter.com/oauth/request_token';
var accessTokenUrl = 'https://api.twitter.com/oauth/access_token';
var authenticateUrl = 'https://api.twitter.com/oauth/authenticate';
// Step 2. Redirect to the authorization screen.
if (!req.query.oaut... | javascript | function(req, res, next) {
var requestTokenUrl = 'https://api.twitter.com/oauth/request_token';
var accessTokenUrl = 'https://api.twitter.com/oauth/access_token';
var authenticateUrl = 'https://api.twitter.com/oauth/authenticate';
// Step 2. Redirect to the authorization screen.
if (!req.query.oaut... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"requestTokenUrl",
"=",
"'https://api.twitter.com/oauth/request_token'",
";",
"var",
"accessTokenUrl",
"=",
"'https://api.twitter.com/oauth/access_token'",
";",
"var",
"authenticateUrl",
"=",
"'https://api.... | Step 1. Obtain request token for the authorization popup. | [
"Step",
"1",
".",
"Obtain",
"request",
"token",
"for",
"the",
"authorization",
"popup",
"."
] | 1c365d49eeb358f63c03b029fee4b16c50115fe1 | https://github.com/cosmojs/loopback-satellizer/blob/1c365d49eeb358f63c03b029fee4b16c50115fe1/index.js#L729-L767 | |
46,648 | cosmojs/loopback-satellizer | index.js | function (req, res, next) {
var prifile = req.profile;
var filter = { or: [{ twitter: profile.user_id }, { email: profile.email }] };
User.find({ where: filter }, function(err, users) {
var user = users[0];
if (user) {
if (!user.twitter) {
user.twitter = profile.user_id;
... | javascript | function (req, res, next) {
var prifile = req.profile;
var filter = { or: [{ twitter: profile.user_id }, { email: profile.email }] };
User.find({ where: filter }, function(err, users) {
var user = users[0];
if (user) {
if (!user.twitter) {
user.twitter = profile.user_id;
... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"prifile",
"=",
"req",
".",
"profile",
";",
"var",
"filter",
"=",
"{",
"or",
":",
"[",
"{",
"twitter",
":",
"profile",
".",
"user_id",
"}",
",",
"{",
"email",
":",
"profile",
".",
... | Step 4b. Create a new user account or return an existing one. | [
"Step",
"4b",
".",
"Create",
"a",
"new",
"user",
"account",
"or",
"return",
"an",
"existing",
"one",
"."
] | 1c365d49eeb358f63c03b029fee4b16c50115fe1 | https://github.com/cosmojs/loopback-satellizer/blob/1c365d49eeb358f63c03b029fee4b16c50115fe1/index.js#L802-L836 | |
46,649 | cosmojs/loopback-satellizer | index.js | function (req, res, next) {
var profileUrl = 'https://api.foursquare.com/v2/users/self';
var params = {
v: '20140806',
oauth_token: req.accessToken
};
request.get({ url: profileUrl, qs: params, json: true }, function(err, response, profile) {
if (err) {
res.status(500).send(er... | javascript | function (req, res, next) {
var profileUrl = 'https://api.foursquare.com/v2/users/self';
var params = {
v: '20140806',
oauth_token: req.accessToken
};
request.get({ url: profileUrl, qs: params, json: true }, function(err, response, profile) {
if (err) {
res.status(500).send(er... | [
"function",
"(",
"req",
",",
"res",
",",
"next",
")",
"{",
"var",
"profileUrl",
"=",
"'https://api.foursquare.com/v2/users/self'",
";",
"var",
"params",
"=",
"{",
"v",
":",
"'20140806'",
",",
"oauth_token",
":",
"req",
".",
"accessToken",
"}",
";",
"request"... | Step 2. Retrieve information about the current user. | [
"Step",
"2",
".",
"Retrieve",
"information",
"about",
"the",
"current",
"user",
"."
] | 1c365d49eeb358f63c03b029fee4b16c50115fe1 | https://github.com/cosmojs/loopback-satellizer/blob/1c365d49eeb358f63c03b029fee4b16c50115fe1/index.js#L862-L877 | |
46,650 | Jellyvision/lateralus | src/lateralus.mixins.js | getAugmentedOptionsObject | function getAugmentedOptionsObject (initialObject) {
// jshint validthis:true
const thisIsLateralus = isLateralus(this);
const augmentedOptions = _.extend(initialObject || {}, {
lateralus: thisIsLateralus ? this : this.lateralus
});
if (!thisIsLateralus) {
augmentedOptions.component = this.component ... | javascript | function getAugmentedOptionsObject (initialObject) {
// jshint validthis:true
const thisIsLateralus = isLateralus(this);
const augmentedOptions = _.extend(initialObject || {}, {
lateralus: thisIsLateralus ? this : this.lateralus
});
if (!thisIsLateralus) {
augmentedOptions.component = this.component ... | [
"function",
"getAugmentedOptionsObject",
"(",
"initialObject",
")",
"{",
"// jshint validthis:true",
"const",
"thisIsLateralus",
"=",
"isLateralus",
"(",
"this",
")",
";",
"const",
"augmentedOptions",
"=",
"_",
".",
"extend",
"(",
"initialObject",
"||",
"{",
"}",
... | Helper function for initModel and initCollection.
@param {Object} [initialObject]
@return {{ lateralus: Lateralus, component: Lateralus.Component= }}
`component` is not defined if `this` is the Lateralus instance.
@private | [
"Helper",
"function",
"for",
"initModel",
"and",
"initCollection",
"."
] | feaa3e27536de6d53cf9648529a4c61380535be8 | https://github.com/Jellyvision/lateralus/blob/feaa3e27536de6d53cf9648529a4c61380535be8/src/lateralus.mixins.js#L393-L405 |
46,651 | thealjey/webcompiler | lib/logger.js | formatLine | function formatLine(message, file, line, column) {
const { yellow, cyan, magenta } = consoleStyles;
return ['"', yellow(message), '" in ', cyan((0, _path.relative)('', file)), ' on ', magenta(line), ':', magenta(column)];
} | javascript | function formatLine(message, file, line, column) {
const { yellow, cyan, magenta } = consoleStyles;
return ['"', yellow(message), '" in ', cyan((0, _path.relative)('', file)), ' on ', magenta(line), ':', magenta(column)];
} | [
"function",
"formatLine",
"(",
"message",
",",
"file",
",",
"line",
",",
"column",
")",
"{",
"const",
"{",
"yellow",
",",
"cyan",
",",
"magenta",
"}",
"=",
"consoleStyles",
";",
"return",
"[",
"'\"'",
",",
"yellow",
"(",
"message",
")",
",",
"'\" in '"... | Formats an error line with colors.
@memberof module:logger
@private
@function formatLine
@param {string} message - error message
@param {string} file - offending file
@param {number | string} line - offending line
@param {number | string} column - offending column
@return {Array<string | modul... | [
"Formats",
"an",
"error",
"line",
"with",
"colors",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/logger.js#L284-L288 |
46,652 | thealjey/webcompiler | lib/logger.js | formatErrorMarker | function formatErrorMarker(message = 'Error') {
const { bold, bgRed, white } = consoleStyles;
return bgRed(bold(white(message)));
} | javascript | function formatErrorMarker(message = 'Error') {
const { bold, bgRed, white } = consoleStyles;
return bgRed(bold(white(message)));
} | [
"function",
"formatErrorMarker",
"(",
"message",
"=",
"'Error'",
")",
"{",
"const",
"{",
"bold",
",",
"bgRed",
",",
"white",
"}",
"=",
"consoleStyles",
";",
"return",
"bgRed",
"(",
"bold",
"(",
"white",
"(",
"message",
")",
")",
")",
";",
"}"
] | Returns a string "Error" styled as a bold white text on a red background, ready to be printed to the console.
@memberof module:logger
@private
@function formatErrorMarker
@param {string} [message="Error"] - a message to apply styles to
@return {module:logger.Message} a styled message | [
"Returns",
"a",
"string",
"Error",
"styled",
"as",
"a",
"bold",
"white",
"text",
"on",
"a",
"red",
"background",
"ready",
"to",
"be",
"printed",
"to",
"the",
"console",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/logger.js#L299-L303 |
46,653 | thealjey/webcompiler | lib/logger.js | log | function log(...messages) {
const { message, styles } = new Message({ ansi: ['', ''], css: '' }).addMessages(messages);
console.log(message, ...styles);
} | javascript | function log(...messages) {
const { message, styles } = new Message({ ansi: ['', ''], css: '' }).addMessages(messages);
console.log(message, ...styles);
} | [
"function",
"log",
"(",
"...",
"messages",
")",
"{",
"const",
"{",
"message",
",",
"styles",
"}",
"=",
"new",
"Message",
"(",
"{",
"ansi",
":",
"[",
"''",
",",
"''",
"]",
",",
"css",
":",
"''",
"}",
")",
".",
"addMessages",
"(",
"messages",
")",
... | Log colorful messages out to the console on Node.js as well as in a browser in the simplest and most composable way.
@memberof module:logger
@function log
@param {...(string | number | module:logger.Message)} messages - messages to log
@example
import {log, consoleStyles} from 'webcompiler';
// or - import {log, conso... | [
"Log",
"colorful",
"messages",
"out",
"to",
"the",
"console",
"on",
"Node",
".",
"js",
"as",
"well",
"as",
"in",
"a",
"browser",
"in",
"the",
"simplest",
"and",
"most",
"composable",
"way",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/logger.js#L325-L329 |
46,654 | thealjey/webcompiler | lib/logger.js | logPostCSSWarnings | function logPostCSSWarnings(warnings) {
(0, _forEach2.default)(warnings, ({ text, plugin, node: { source: { input: { file } } }, line, column }) => {
log(formatErrorMarker('Warning'), ': ', ...formatLine(`${text}(${plugin})`, file, line, column));
});
log('PostCSS warnings: ', warnings.length);
} | javascript | function logPostCSSWarnings(warnings) {
(0, _forEach2.default)(warnings, ({ text, plugin, node: { source: { input: { file } } }, line, column }) => {
log(formatErrorMarker('Warning'), ': ', ...formatLine(`${text}(${plugin})`, file, line, column));
});
log('PostCSS warnings: ', warnings.length);
} | [
"function",
"logPostCSSWarnings",
"(",
"warnings",
")",
"{",
"(",
"0",
",",
"_forEach2",
".",
"default",
")",
"(",
"warnings",
",",
"(",
"{",
"text",
",",
"plugin",
",",
"node",
":",
"{",
"source",
":",
"{",
"input",
":",
"{",
"file",
"}",
"}",
"}"... | Prints PostCSS Warning objects out to the console.
@memberof module:logger
@function logPostCSSWarnings
@param {Array<PostCSSWarning>} warnings - warning objects
@example
import {logPostCSSWarnings} from 'webcompiler';
// or - import {logPostCSSWarnings} from 'webcompiler/lib/logger';
// or - var logPostCSSWarnings = ... | [
"Prints",
"PostCSS",
"Warning",
"objects",
"out",
"to",
"the",
"console",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/logger.js#L382-L387 |
46,655 | thealjey/webcompiler | lib/logger.js | logSASSError | function logSASSError({ message, file, line, column }) {
log(formatErrorMarker('SASS error'), ': ', ...formatLine(message, file, line, column));
} | javascript | function logSASSError({ message, file, line, column }) {
log(formatErrorMarker('SASS error'), ': ', ...formatLine(message, file, line, column));
} | [
"function",
"logSASSError",
"(",
"{",
"message",
",",
"file",
",",
"line",
",",
"column",
"}",
")",
"{",
"log",
"(",
"formatErrorMarker",
"(",
"'SASS error'",
")",
",",
"': '",
",",
"...",
"formatLine",
"(",
"message",
",",
"file",
",",
"line",
",",
"c... | Prints a Node SASS error object out to the console.
@memberof module:logger
@function logSASSError
@param {NodeSassError} error - error object
@example
import {logSASSError} from 'webcompiler';
// or - import {logSASSError} from 'webcompiler/lib/logger';
// or - var logSASSError = require('webcompiler').logSASSError;
... | [
"Prints",
"a",
"Node",
"SASS",
"error",
"object",
"out",
"to",
"the",
"console",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/logger.js#L409-L411 |
46,656 | thealjey/webcompiler | lib/logger.js | logLintingErrors | function logLintingErrors(errors, prefix = null) {
(0, _forEach2.default)(errors, ({ message, rule, file, line, column }) => {
log(formatErrorMarker(), ': ', ...formatLine(`${message}${rule ? ` (${rule})` : ''}`, file, line, column));
});
log(prefix ? `${prefix} l` : 'L', 'inting errors: ', errors.length);
} | javascript | function logLintingErrors(errors, prefix = null) {
(0, _forEach2.default)(errors, ({ message, rule, file, line, column }) => {
log(formatErrorMarker(), ': ', ...formatLine(`${message}${rule ? ` (${rule})` : ''}`, file, line, column));
});
log(prefix ? `${prefix} l` : 'L', 'inting errors: ', errors.length);
} | [
"function",
"logLintingErrors",
"(",
"errors",
",",
"prefix",
"=",
"null",
")",
"{",
"(",
"0",
",",
"_forEach2",
".",
"default",
")",
"(",
"errors",
",",
"(",
"{",
"message",
",",
"rule",
",",
"file",
",",
"line",
",",
"column",
"}",
")",
"=>",
"{"... | Prints linting errors out to the console.
@memberof module:logger
@function logLintingErrors
@param {Array<LintError>} errors - error objects
@param {string} [prefix=null] - will be printed on the last line along with the total number of messages
@example
import {logLintingErrors} from 'webcompiler';
... | [
"Prints",
"linting",
"errors",
"out",
"to",
"the",
"console",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/logger.js#L426-L431 |
46,657 | Hugo-ter-Doest/chart-parsers | lib/ProductionRule.js | ProductionRule | function ProductionRule(lhs, rhs, head) {
this.lhs = lhs;
this.rhs = rhs;
this.head = head;
// feature structure of the constraints specified with the rule
this.fs = null;
} | javascript | function ProductionRule(lhs, rhs, head) {
this.lhs = lhs;
this.rhs = rhs;
this.head = head;
// feature structure of the constraints specified with the rule
this.fs = null;
} | [
"function",
"ProductionRule",
"(",
"lhs",
",",
"rhs",
",",
"head",
")",
"{",
"this",
".",
"lhs",
"=",
"lhs",
";",
"this",
".",
"rhs",
"=",
"rhs",
";",
"this",
".",
"head",
"=",
"head",
";",
"// feature structure of the constraints specified with the rule",
"... | Constructor - lhs is a string - rhs is an array of strings - head is a number pointing to a rhs nonterminal | [
"Constructor",
"-",
"lhs",
"is",
"a",
"string",
"-",
"rhs",
"is",
"an",
"array",
"of",
"strings",
"-",
"head",
"is",
"a",
"number",
"pointing",
"to",
"a",
"rhs",
"nonterminal"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/ProductionRule.js#L33-L39 |
46,658 | paritytech/js-jsonrpc | scripts/helpers/parsed-rpc-traits.js | parseMethodsFromRust | function parseMethodsFromRust (source) {
// Matching the custom `rpc` attribute with it's doc comment
const attributePattern = /((?:\s*\/\/\/.*$)*)\s*#\[rpc\(([^)]+)\)]/gm;
const commentPattern = /\s*\/\/\/\s*/g;
const separatorPattern = /\s*,\s*/g;
const assignPattern = /([\S]+)\s*=\s*"([^"]*)"/;
const ign... | javascript | function parseMethodsFromRust (source) {
// Matching the custom `rpc` attribute with it's doc comment
const attributePattern = /((?:\s*\/\/\/.*$)*)\s*#\[rpc\(([^)]+)\)]/gm;
const commentPattern = /\s*\/\/\/\s*/g;
const separatorPattern = /\s*,\s*/g;
const assignPattern = /([\S]+)\s*=\s*"([^"]*)"/;
const ign... | [
"function",
"parseMethodsFromRust",
"(",
"source",
")",
"{",
"// Matching the custom `rpc` attribute with it's doc comment",
"const",
"attributePattern",
"=",
"/",
"((?:\\s*\\/\\/\\/.*$)*)\\s*#\\[rpc\\(([^)]+)\\)]",
"/",
"gm",
";",
"const",
"commentPattern",
"=",
"/",
"\\s*\\/\... | Get a list of JSON-RPC from Rust trait source code | [
"Get",
"a",
"list",
"of",
"JSON",
"-",
"RPC",
"from",
"Rust",
"trait",
"source",
"code"
] | 045b8953926cbc0f663de328954f1ca4ba8a4e7c | https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/scripts/helpers/parsed-rpc-traits.js#L26-L56 |
46,659 | paritytech/js-jsonrpc | scripts/helpers/parsed-rpc-traits.js | getMethodsFromRustTraits | function getMethodsFromRustTraits () {
const traitsDir = path.join(__dirname, '../../.parity/rpc/src/v1/traits');
return fs
.readdirSync(traitsDir)
.filter((name) => name !== 'mod.rs' && /\.rs$/.test(name))
.map((name) => fs.readFileSync(path.join(traitsDir, name)))
.map(parseMethodsFromRust)
.... | javascript | function getMethodsFromRustTraits () {
const traitsDir = path.join(__dirname, '../../.parity/rpc/src/v1/traits');
return fs
.readdirSync(traitsDir)
.filter((name) => name !== 'mod.rs' && /\.rs$/.test(name))
.map((name) => fs.readFileSync(path.join(traitsDir, name)))
.map(parseMethodsFromRust)
.... | [
"function",
"getMethodsFromRustTraits",
"(",
")",
"{",
"const",
"traitsDir",
"=",
"path",
".",
"join",
"(",
"__dirname",
",",
"'../../.parity/rpc/src/v1/traits'",
")",
";",
"return",
"fs",
".",
"readdirSync",
"(",
"traitsDir",
")",
".",
"filter",
"(",
"(",
"na... | Get a list of all JSON-RPC methods from all defined traits | [
"Get",
"a",
"list",
"of",
"all",
"JSON",
"-",
"RPC",
"methods",
"from",
"all",
"defined",
"traits"
] | 045b8953926cbc0f663de328954f1ca4ba8a4e7c | https://github.com/paritytech/js-jsonrpc/blob/045b8953926cbc0f663de328954f1ca4ba8a4e7c/scripts/helpers/parsed-rpc-traits.js#L59-L68 |
46,660 | d-oliveros/isomorphine | src/util.js | firstFunction | function firstFunction(args) {
for (var i = 0, len = args.length; i < len; i++) {
if (typeof args[i] === 'function') {
return args[i];
}
}
return null;
} | javascript | function firstFunction(args) {
for (var i = 0, len = args.length; i < len; i++) {
if (typeof args[i] === 'function') {
return args[i];
}
}
return null;
} | [
"function",
"firstFunction",
"(",
"args",
")",
"{",
"for",
"(",
"var",
"i",
"=",
"0",
",",
"len",
"=",
"args",
".",
"length",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"typeof",
"args",
"[",
"i",
"]",
"===",
"'function'",
")",
... | Returns the first function in an array.
@param {Array} args The array to take the function from.
@return {Function} The resulting function, or null. | [
"Returns",
"the",
"first",
"function",
"in",
"an",
"array",
"."
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/util.js#L31-L39 |
46,661 | d-oliveros/isomorphine | src/util.js | serializeCallback | function serializeCallback(args) {
var callback;
debug('Transforming callback in ', args);
return args.map(function(arg) {
if (typeof arg !== 'function') return arg;
// It shouldn't be an argument after the callback function
invariant(!callback, 'Only one callback function is allowed.');
callb... | javascript | function serializeCallback(args) {
var callback;
debug('Transforming callback in ', args);
return args.map(function(arg) {
if (typeof arg !== 'function') return arg;
// It shouldn't be an argument after the callback function
invariant(!callback, 'Only one callback function is allowed.');
callb... | [
"function",
"serializeCallback",
"(",
"args",
")",
"{",
"var",
"callback",
";",
"debug",
"(",
"'Transforming callback in '",
",",
"args",
")",
";",
"return",
"args",
".",
"map",
"(",
"function",
"(",
"arg",
")",
"{",
"if",
"(",
"typeof",
"arg",
"!==",
"'... | Transforms the client's callback function to a callback notice string.
@param {Array} args Array of arguments to transform.
@return {Array} The transformed arguments array. | [
"Transforms",
"the",
"client",
"s",
"callback",
"function",
"to",
"a",
"callback",
"notice",
"string",
"."
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/util.js#L47-L62 |
46,662 | d-oliveros/isomorphine | src/util.js | promisify | function promisify(func) {
return function promisified() {
var args = Array.prototype.slice.call(arguments);
var context = this;
return new Promise(function(resolve, reject) {
try {
func.apply(context, args.concat(function(err, data) {
if (err) {
return reject(err);
... | javascript | function promisify(func) {
return function promisified() {
var args = Array.prototype.slice.call(arguments);
var context = this;
return new Promise(function(resolve, reject) {
try {
func.apply(context, args.concat(function(err, data) {
if (err) {
return reject(err);
... | [
"function",
"promisify",
"(",
"func",
")",
"{",
"return",
"function",
"promisified",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"var",
"context",
"=",
"this",
";",
"return",
"new... | Transforms a callback-based function flow to a promise-based flow | [
"Transforms",
"a",
"callback",
"-",
"based",
"function",
"flow",
"to",
"a",
"promise",
"-",
"based",
"flow"
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/util.js#L67-L86 |
46,663 | d-oliveros/isomorphine | src/util.js | changeConfig | function changeConfig(oldConfig, newConfig) {
invariant(isObject(oldConfig), 'Old config is not valid');
invariant(isObject(newConfig), 'Config is not valid');
if (newConfig.host) {
var host = newConfig.host;
var prefix = '';
if (host.indexOf('http://') < 0 && host.indexOf('https://') < 0) {
p... | javascript | function changeConfig(oldConfig, newConfig) {
invariant(isObject(oldConfig), 'Old config is not valid');
invariant(isObject(newConfig), 'Config is not valid');
if (newConfig.host) {
var host = newConfig.host;
var prefix = '';
if (host.indexOf('http://') < 0 && host.indexOf('https://') < 0) {
p... | [
"function",
"changeConfig",
"(",
"oldConfig",
",",
"newConfig",
")",
"{",
"invariant",
"(",
"isObject",
"(",
"oldConfig",
")",
",",
"'Old config is not valid'",
")",
";",
"invariant",
"(",
"isObject",
"(",
"newConfig",
")",
",",
"'Config is not valid'",
")",
";"... | Updates a config object
@param {Object} oldConfig Old configuration object
@param {Object} newConfig New configuration object
@return {Undefined} | [
"Updates",
"a",
"config",
"object"
] | cb123d16b4be3bb7ec57758bd0b2e43767e91864 | https://github.com/d-oliveros/isomorphine/blob/cb123d16b4be3bb7ec57758bd0b2e43767e91864/src/util.js#L155-L173 |
46,664 | phadej/ljs | lib/literate.js | appendCode | function appendCode() {
if (state === "code") {
state = "text";
if (!isWhitespace(codeBuffer)) {
content += codeOpen + codeBuffer.replace(/^(?:\s*\n)+/, "").replace(/[\s\n]*$/, "") + codeClose;
}
codeBuffer = "";
}
} | javascript | function appendCode() {
if (state === "code") {
state = "text";
if (!isWhitespace(codeBuffer)) {
content += codeOpen + codeBuffer.replace(/^(?:\s*\n)+/, "").replace(/[\s\n]*$/, "") + codeClose;
}
codeBuffer = "";
}
} | [
"function",
"appendCode",
"(",
")",
"{",
"if",
"(",
"state",
"===",
"\"code\"",
")",
"{",
"state",
"=",
"\"text\"",
";",
"if",
"(",
"!",
"isWhitespace",
"(",
"codeBuffer",
")",
")",
"{",
"content",
"+=",
"codeOpen",
"+",
"codeBuffer",
".",
"replace",
"... | buffer for code output | [
"buffer",
"for",
"code",
"output"
] | 2ef94df30174a0aa12a65dbe0a66128b3c2726bb | https://github.com/phadej/ljs/blob/2ef94df30174a0aa12a65dbe0a66128b3c2726bb/lib/literate.js#L127-L135 |
46,665 | camme/plugwisejs | plugwise.js | sendCommand | function sendCommand(command, mac, params, callback, scope) {
var commandParts = [];
// check for callback instead of params
if (typeof params == 'function') {
callback = params;
params = '';
scope = callback;
}
var completeCommand = '';
... | javascript | function sendCommand(command, mac, params, callback, scope) {
var commandParts = [];
// check for callback instead of params
if (typeof params == 'function') {
callback = params;
params = '';
scope = callback;
}
var completeCommand = '';
... | [
"function",
"sendCommand",
"(",
"command",
",",
"mac",
",",
"params",
",",
"callback",
",",
"scope",
")",
"{",
"var",
"commandParts",
"=",
"[",
"]",
";",
"// check for callback instead of params",
"if",
"(",
"typeof",
"params",
"==",
"'function'",
")",
"{",
... | builds the command string and sends it | [
"builds",
"the",
"command",
"string",
"and",
"sends",
"it"
] | 04bc02a8f734e6833cc2bf03d6e8d5b88863ea9e | https://github.com/camme/plugwisejs/blob/04bc02a8f734e6833cc2bf03d6e8d5b88863ea9e/plugwise.js#L243-L295 |
46,666 | Zerg00s/spforms | src/Templates/App/services/spFormFactory.js | addFileToFolder | function addFileToFolder(arrayBuffer) {
// Construct the endpoint.
var fileCollectionEndpoint = String.format(spFormFactory.getFileEndpointUri(_spPageContextInfo.webAbsoluteUrl, doclibname, foldername) + "/add(overwrite=true, url='{0}')", fileuniquename);
// Send the request and ret... | javascript | function addFileToFolder(arrayBuffer) {
// Construct the endpoint.
var fileCollectionEndpoint = String.format(spFormFactory.getFileEndpointUri(_spPageContextInfo.webAbsoluteUrl, doclibname, foldername) + "/add(overwrite=true, url='{0}')", fileuniquename);
// Send the request and ret... | [
"function",
"addFileToFolder",
"(",
"arrayBuffer",
")",
"{",
"// Construct the endpoint.",
"var",
"fileCollectionEndpoint",
"=",
"String",
".",
"format",
"(",
"spFormFactory",
".",
"getFileEndpointUri",
"(",
"_spPageContextInfo",
".",
"webAbsoluteUrl",
",",
"doclibname",
... | }, onError); Add the file to the file collection in the Shared Documents folder. | [
"}",
"onError",
")",
";",
"Add",
"the",
"file",
"to",
"the",
"file",
"collection",
"in",
"the",
"Shared",
"Documents",
"folder",
"."
] | f8eaa19eeefa6ca7a3664138b76744f9c1d9ecec | https://github.com/Zerg00s/spforms/blob/f8eaa19eeefa6ca7a3664138b76744f9c1d9ecec/src/Templates/App/services/spFormFactory.js#L373-L391 |
46,667 | Zerg00s/spforms | src/Templates/App/services/spFormFactory.js | updateListItem | function updateListItem(itemMetadata, customFileMetadata) {
// Define the list item changes. Use the FileLeafRef property to change the display name.
// Assemble the file update metadata
var metadata = {
__metadata: {
type: itemMetadata.type
... | javascript | function updateListItem(itemMetadata, customFileMetadata) {
// Define the list item changes. Use the FileLeafRef property to change the display name.
// Assemble the file update metadata
var metadata = {
__metadata: {
type: itemMetadata.type
... | [
"function",
"updateListItem",
"(",
"itemMetadata",
",",
"customFileMetadata",
")",
"{",
"// Define the list item changes. Use the FileLeafRef property to change the display name. ",
"// Assemble the file update metadata ",
"var",
"metadata",
"=",
"{",
"__metadata",
":",
"{",
"type"... | Change the display name and title of the list item. | [
"Change",
"the",
"display",
"name",
"and",
"title",
"of",
"the",
"list",
"item",
"."
] | f8eaa19eeefa6ca7a3664138b76744f9c1d9ecec | https://github.com/Zerg00s/spforms/blob/f8eaa19eeefa6ca7a3664138b76744f9c1d9ecec/src/Templates/App/services/spFormFactory.js#L403-L429 |
46,668 | anseki/process-bridge | process-bridge.js | parseIpcMessage | function parseIpcMessage(message, cb) {
var requestId;
if (message._requestId == null) { // eslint-disable-line eqeqeq
throw new Error('Invalid message: ' + JSON.stringify(message));
}
requestId = message._requestId;
delete message._requestId;
return cb(+requestId, message);
} | javascript | function parseIpcMessage(message, cb) {
var requestId;
if (message._requestId == null) { // eslint-disable-line eqeqeq
throw new Error('Invalid message: ' + JSON.stringify(message));
}
requestId = message._requestId;
delete message._requestId;
return cb(+requestId, message);
} | [
"function",
"parseIpcMessage",
"(",
"message",
",",
"cb",
")",
"{",
"var",
"requestId",
";",
"if",
"(",
"message",
".",
"_requestId",
"==",
"null",
")",
"{",
"// eslint-disable-line eqeqeq",
"throw",
"new",
"Error",
"(",
"'Invalid message: '",
"+",
"JSON",
"."... | Callback that handles the parsed message object.
@callback procMessage
@param {string} requestId - ID of the message.
@param {Object} message - The message object.
Normalize an IPC message.
@param {Object} message - IPC message.
@param {procMessage} cb - Callback function that is called.
@returns {any} Something that... | [
"Callback",
"that",
"handles",
"the",
"parsed",
"message",
"object",
"."
] | 3621bda208e1a94527636dacd0a8f4b9e42c9cd0 | https://github.com/anseki/process-bridge/blob/3621bda208e1a94527636dacd0a8f4b9e42c9cd0/process-bridge.js#L39-L47 |
46,669 | anseki/process-bridge | process-bridge.js | parseMessageLines | function parseMessageLines(lines, getLine, cb) {
var matches, line, lineParts;
if (arguments.length < 3) {
cb = getLine;
getLine = false;
}
RE_MESSAGE_LINE.lastIndex = 0;
while ((matches = RE_MESSAGE_LINE.exec(lines))) {
line = matches[1];
lines = matches[2];
if (line === '') {
con... | javascript | function parseMessageLines(lines, getLine, cb) {
var matches, line, lineParts;
if (arguments.length < 3) {
cb = getLine;
getLine = false;
}
RE_MESSAGE_LINE.lastIndex = 0;
while ((matches = RE_MESSAGE_LINE.exec(lines))) {
line = matches[1];
lines = matches[2];
if (line === '') {
con... | [
"function",
"parseMessageLines",
"(",
"lines",
",",
"getLine",
",",
"cb",
")",
"{",
"var",
"matches",
",",
"line",
",",
"lineParts",
";",
"if",
"(",
"arguments",
".",
"length",
"<",
"3",
")",
"{",
"cb",
"=",
"getLine",
";",
"getLine",
"=",
"false",
"... | Extract & normalize an IPC message from current input stream lines, and return remaining data.
@param {string} lines - current input stream.
@param {boolean} [getLine] - Get a line as plain string.
@param {procMessage|Function} cb - Callback function that is called. It is called with a line if `getLine` is `true`.
@ret... | [
"Extract",
"&",
"normalize",
"an",
"IPC",
"message",
"from",
"current",
"input",
"stream",
"lines",
"and",
"return",
"remaining",
"data",
"."
] | 3621bda208e1a94527636dacd0a8f4b9e42c9cd0 | https://github.com/anseki/process-bridge/blob/3621bda208e1a94527636dacd0a8f4b9e42c9cd0/process-bridge.js#L56-L81 |
46,670 | anseki/process-bridge | process-bridge.js | sendIpc | function sendIpc(message) {
var requestIds;
clearTimeout(retryTimer);
if (message) { tranRequests[message._requestId] = message; }
if ((requestIds = Object.keys(tranRequests)).length) {
if (!childProc) { throw new Error('Child process already exited.'); }
requestIds.forEach(function(requestI... | javascript | function sendIpc(message) {
var requestIds;
clearTimeout(retryTimer);
if (message) { tranRequests[message._requestId] = message; }
if ((requestIds = Object.keys(tranRequests)).length) {
if (!childProc) { throw new Error('Child process already exited.'); }
requestIds.forEach(function(requestI... | [
"function",
"sendIpc",
"(",
"message",
")",
"{",
"var",
"requestIds",
";",
"clearTimeout",
"(",
"retryTimer",
")",
";",
"if",
"(",
"message",
")",
"{",
"tranRequests",
"[",
"message",
".",
"_requestId",
"]",
"=",
"message",
";",
"}",
"if",
"(",
"(",
"r... | Recover failed IPC-sending. In some environment, IPC message does not reach to child, with no error and return value. | [
"Recover",
"failed",
"IPC",
"-",
"sending",
".",
"In",
"some",
"environment",
"IPC",
"message",
"does",
"not",
"reach",
"to",
"child",
"with",
"no",
"error",
"and",
"return",
"value",
"."
] | 3621bda208e1a94527636dacd0a8f4b9e42c9cd0 | https://github.com/anseki/process-bridge/blob/3621bda208e1a94527636dacd0a8f4b9e42c9cd0/process-bridge.js#L410-L422 |
46,671 | anandthakker/geojson-clip-polygon | index.js | isOutside | function isOutside (feature, poly) {
var a = feature.bbox = feature.bbox || extent(feature)
var b = poly.bbox = poly.bbox || extent(poly)
return a[2] < b[0] || a[0] > b[2] || a[3] < b[1] || a[1] > b[3]
} | javascript | function isOutside (feature, poly) {
var a = feature.bbox = feature.bbox || extent(feature)
var b = poly.bbox = poly.bbox || extent(poly)
return a[2] < b[0] || a[0] > b[2] || a[3] < b[1] || a[1] > b[3]
} | [
"function",
"isOutside",
"(",
"feature",
",",
"poly",
")",
"{",
"var",
"a",
"=",
"feature",
".",
"bbox",
"=",
"feature",
".",
"bbox",
"||",
"extent",
"(",
"feature",
")",
"var",
"b",
"=",
"poly",
".",
"bbox",
"=",
"poly",
".",
"bbox",
"||",
"extent... | no false positives, some false negatives | [
"no",
"false",
"positives",
"some",
"false",
"negatives"
] | dde74a362f2817f7553a6dd4ee133ad06a27463b | https://github.com/anandthakker/geojson-clip-polygon/blob/dde74a362f2817f7553a6dd4ee133ad06a27463b/index.js#L66-L70 |
46,672 | thealjey/webcompiler | lib/highlight.js | highlight | function highlight(value) {
const el = document.createElement('div');
cm(el, { value, mode: { name: 'jsx', typescript: true }, scrollbarStyle: 'null', inputStyle: 'contenteditable' });
const dom = (0, _cheerio.load)(el.innerHTML),
lines = dom('.CodeMirror-line');
// eslint-disable-next-line lodash/pr... | javascript | function highlight(value) {
const el = document.createElement('div');
cm(el, { value, mode: { name: 'jsx', typescript: true }, scrollbarStyle: 'null', inputStyle: 'contenteditable' });
const dom = (0, _cheerio.load)(el.innerHTML),
lines = dom('.CodeMirror-line');
// eslint-disable-next-line lodash/pr... | [
"function",
"highlight",
"(",
"value",
")",
"{",
"const",
"el",
"=",
"document",
".",
"createElement",
"(",
"'div'",
")",
";",
"cm",
"(",
"el",
",",
"{",
"value",
",",
"mode",
":",
"{",
"name",
":",
"'jsx'",
",",
"typescript",
":",
"true",
"}",
","... | Using the CodeMirror editor highlights a string of text representing JavaScript program code.
@memberof module:highlight
@private
@method highlight
@param {string} value - any valid ES2015, TypeScript, JSX, Flow code
@return {Object} an object containing a CheerioDOM object and a CheerioCollection of the `pre.CodeMirr... | [
"Using",
"the",
"CodeMirror",
"editor",
"highlights",
"a",
"string",
"of",
"text",
"representing",
"JavaScript",
"program",
"code",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/highlight.js#L63-L75 |
46,673 | thealjey/webcompiler | lib/highlight.js | highlightHTML | function highlightHTML(code = '') {
if (!code) {
return '';
}
const { dom, lines } = highlight(code);
return dom.html(lines);
} | javascript | function highlightHTML(code = '') {
if (!code) {
return '';
}
const { dom, lines } = highlight(code);
return dom.html(lines);
} | [
"function",
"highlightHTML",
"(",
"code",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"code",
")",
"{",
"return",
"''",
";",
"}",
"const",
"{",
"dom",
",",
"lines",
"}",
"=",
"highlight",
"(",
"code",
")",
";",
"return",
"dom",
".",
"html",
"(",
"lines"... | Using the CodeMirror editor highlights a string of text representing JavaScript program code and returns an HTML
string.
@memberof module:highlight
@method highlightHTML
@param {string} [code=""] - any valid ES2015, TypeScript, JSX, Flow code
@return {string} an HTML string of the `pre.CodeMirror-line` elements
@examp... | [
"Using",
"the",
"CodeMirror",
"editor",
"highlights",
"a",
"string",
"of",
"text",
"representing",
"JavaScript",
"program",
"code",
"and",
"returns",
"an",
"HTML",
"string",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/highlight.js#L93-L100 |
46,674 | svanderburg/nijs | bin/nijs-build/operations.js | evaluatePackage | function evaluatePackage(filename, attr, format) {
var pkgs = require(path.resolve(filename)).pkgs;
var pkg = pkgs[attr]();
var expr = nijs.jsToNix(pkg, format);
return expr;
} | javascript | function evaluatePackage(filename, attr, format) {
var pkgs = require(path.resolve(filename)).pkgs;
var pkg = pkgs[attr]();
var expr = nijs.jsToNix(pkg, format);
return expr;
} | [
"function",
"evaluatePackage",
"(",
"filename",
",",
"attr",
",",
"format",
")",
"{",
"var",
"pkgs",
"=",
"require",
"(",
"path",
".",
"resolve",
"(",
"filename",
")",
")",
".",
"pkgs",
";",
"var",
"pkg",
"=",
"pkgs",
"[",
"attr",
"]",
"(",
")",
";... | Imports the given package composition CommonJS module and evaluates the
specified package.
@param {String} filename Path to the package composition CommonJS module
@param {String} attr Name of the package to evaluate
@param {Boolean} format Indicates whether to nicely format to expression (i.e. generating whitespaces)... | [
"Imports",
"the",
"given",
"package",
"composition",
"CommonJS",
"module",
"and",
"evaluates",
"the",
"specified",
"package",
"."
] | 4e2738cbff3a43aba9297315ca5120cecf8dae3e | https://github.com/svanderburg/nijs/blob/4e2738cbff3a43aba9297315ca5120cecf8dae3e/bin/nijs-build/operations.js#L17-L22 |
46,675 | svanderburg/nijs | bin/nijs-build/operations.js | evaluatePackageAsync | function evaluatePackageAsync(filename, attr, format, callback) {
var pkgs = require(path.resolve(filename)).pkgs;
slasp.sequence([
function(callback) {
pkgs[attr](callback);
},
function(callback, pkg) {
var expr = nijs.jsToNix(pkg, format);
... | javascript | function evaluatePackageAsync(filename, attr, format, callback) {
var pkgs = require(path.resolve(filename)).pkgs;
slasp.sequence([
function(callback) {
pkgs[attr](callback);
},
function(callback, pkg) {
var expr = nijs.jsToNix(pkg, format);
... | [
"function",
"evaluatePackageAsync",
"(",
"filename",
",",
"attr",
",",
"format",
",",
"callback",
")",
"{",
"var",
"pkgs",
"=",
"require",
"(",
"path",
".",
"resolve",
"(",
"filename",
")",
")",
".",
"pkgs",
";",
"slasp",
".",
"sequence",
"(",
"[",
"fu... | Imports the given package composition CommonJS module and asynchronously
evaluates the specified package.
@param {String} filename Path to the package composition CommonJS module
@param {String} attr Name of the package to evaluate
@param {Boolean} format Indicates whether to nicely format to expression (i.e. generati... | [
"Imports",
"the",
"given",
"package",
"composition",
"CommonJS",
"module",
"and",
"asynchronously",
"evaluates",
"the",
"specified",
"package",
"."
] | 4e2738cbff3a43aba9297315ca5120cecf8dae3e | https://github.com/svanderburg/nijs/blob/4e2738cbff3a43aba9297315ca5120cecf8dae3e/bin/nijs-build/operations.js#L33-L46 |
46,676 | manuelodelain/screen-navigator | examples/basic/index.js | onScreenBtnClick | function onScreenBtnClick (event) {
const screenId = event.currentTarget.getAttribute('data-screen');
// if the current screen is the same as the clicked one
if (screenId === screenNavigator.currentItemId) return;
// display the new screen
screenNavigator.showScreen(screenId);
} | javascript | function onScreenBtnClick (event) {
const screenId = event.currentTarget.getAttribute('data-screen');
// if the current screen is the same as the clicked one
if (screenId === screenNavigator.currentItemId) return;
// display the new screen
screenNavigator.showScreen(screenId);
} | [
"function",
"onScreenBtnClick",
"(",
"event",
")",
"{",
"const",
"screenId",
"=",
"event",
".",
"currentTarget",
".",
"getAttribute",
"(",
"'data-screen'",
")",
";",
"// if the current screen is the same as the clicked one",
"if",
"(",
"screenId",
"===",
"screenNavigato... | screenNavigator.transitionType = Transitions.OutAndIn; button click handler | [
"screenNavigator",
".",
"transitionType",
"=",
"Transitions",
".",
"OutAndIn",
";",
"button",
"click",
"handler"
] | 73281a47e04bc0e8f146a5fe3d80f354a21febcf | https://github.com/manuelodelain/screen-navigator/blob/73281a47e04bc0e8f146a5fe3d80f354a21febcf/examples/basic/index.js#L39-L47 |
46,677 | igorski/zMIDI | src/zMIDI.js | function( aPortNumber )
{
var listener = zMIDI._listenerMap[ aPortNumber], inChannel;
if ( listener )
{
inChannel = zMIDI.getInChannels()[ aPortNumber ];
inChannel.close();
inChannel.removeEventListener( "midimessage", listener... | javascript | function( aPortNumber )
{
var listener = zMIDI._listenerMap[ aPortNumber], inChannel;
if ( listener )
{
inChannel = zMIDI.getInChannels()[ aPortNumber ];
inChannel.close();
inChannel.removeEventListener( "midimessage", listener... | [
"function",
"(",
"aPortNumber",
")",
"{",
"var",
"listener",
"=",
"zMIDI",
".",
"_listenerMap",
"[",
"aPortNumber",
"]",
",",
"inChannel",
";",
"if",
"(",
"listener",
")",
"{",
"inChannel",
"=",
"zMIDI",
".",
"getInChannels",
"(",
")",
"[",
"aPortNumber",
... | detach a method to listen to MIDI message in events
@public
@param {number} aPortNumber index of the MIDI port stop listening on | [
"detach",
"a",
"method",
"to",
"listen",
"to",
"MIDI",
"message",
"in",
"events"
] | 671bb154fda0ce13269d624464a2dfc95e2a9b34 | https://github.com/igorski/zMIDI/blob/671bb154fda0ce13269d624464a2dfc95e2a9b34/src/zMIDI.js#L279-L290 | |
46,678 | igorski/zMIDI | src/zMIDI.js | function()
{
if ( zMIDI.isConnected() )
{
var inputs = /** @type {Array.<MIDIInput>} */ ( [] );
var iface = zMIDI._interface;
if ( typeof iface.inputs === "function" )
{
inputs = iface.inputs();
... | javascript | function()
{
if ( zMIDI.isConnected() )
{
var inputs = /** @type {Array.<MIDIInput>} */ ( [] );
var iface = zMIDI._interface;
if ( typeof iface.inputs === "function" )
{
inputs = iface.inputs();
... | [
"function",
"(",
")",
"{",
"if",
"(",
"zMIDI",
".",
"isConnected",
"(",
")",
")",
"{",
"var",
"inputs",
"=",
"/** @type {Array.<MIDIInput>} */",
"(",
"[",
"]",
")",
";",
"var",
"iface",
"=",
"zMIDI",
".",
"_interface",
";",
"if",
"(",
"typeof",
"iface"... | retrieve all available MIDI inputs
@public
@return {Array.<MIDIInput>} | [
"retrieve",
"all",
"available",
"MIDI",
"inputs"
] | 671bb154fda0ce13269d624464a2dfc95e2a9b34 | https://github.com/igorski/zMIDI/blob/671bb154fda0ce13269d624464a2dfc95e2a9b34/src/zMIDI.js#L314-L337 | |
46,679 | igorski/zMIDI | src/zMIDI.js | function()
{
if ( zMIDI.isConnected() )
{
var outputs = /** @type {Array.<MIDIOutput>} */ ( [] );
var iface = zMIDI._interface;
if ( typeof iface.outputs === "function" )
{
outputs = iface.outputs();
... | javascript | function()
{
if ( zMIDI.isConnected() )
{
var outputs = /** @type {Array.<MIDIOutput>} */ ( [] );
var iface = zMIDI._interface;
if ( typeof iface.outputs === "function" )
{
outputs = iface.outputs();
... | [
"function",
"(",
")",
"{",
"if",
"(",
"zMIDI",
".",
"isConnected",
"(",
")",
")",
"{",
"var",
"outputs",
"=",
"/** @type {Array.<MIDIOutput>} */",
"(",
"[",
"]",
")",
";",
"var",
"iface",
"=",
"zMIDI",
".",
"_interface",
";",
"if",
"(",
"typeof",
"ifac... | retrieve all available MIDI output ports
@public
@return {Array.<MIDIOutput>} | [
"retrieve",
"all",
"available",
"MIDI",
"output",
"ports"
] | 671bb154fda0ce13269d624464a2dfc95e2a9b34 | https://github.com/igorski/zMIDI/blob/671bb154fda0ce13269d624464a2dfc95e2a9b34/src/zMIDI.js#L345-L368 | |
46,680 | serg-io/dyndb | dyndb.js | sendRequest | function sendRequest(operationName, body, callback, context) {
if (_.isFunction(body)) {
context = callback;
callback = body;
body = undefined;
}
body || (body = {});
body = new Buffer(_.isString(body) ? body : JSON.stringify(body));
var httpOpts = {
host: SERVICE_NAME.toLowerCase() + '.' + regio... | javascript | function sendRequest(operationName, body, callback, context) {
if (_.isFunction(body)) {
context = callback;
callback = body;
body = undefined;
}
body || (body = {});
body = new Buffer(_.isString(body) ? body : JSON.stringify(body));
var httpOpts = {
host: SERVICE_NAME.toLowerCase() + '.' + regio... | [
"function",
"sendRequest",
"(",
"operationName",
",",
"body",
",",
"callback",
",",
"context",
")",
"{",
"if",
"(",
"_",
".",
"isFunction",
"(",
"body",
")",
")",
"{",
"context",
"=",
"callback",
";",
"callback",
"=",
"body",
";",
"body",
"=",
"undefin... | Underlying method that builds the request before sending it and relays the response to the callback.
@method sendRequest
@private
@param {String} operationName Name of the DynamoDB operation to request.
@param {Object|String} [body='{}'] Body of the request.
@param {Function} [callback] Callback function to call after... | [
"Underlying",
"method",
"that",
"builds",
"the",
"request",
"before",
"sending",
"it",
"and",
"relays",
"the",
"response",
"to",
"the",
"callback",
"."
] | 6f916347aec6678a855c0fa2205e8c84cabce65c | https://github.com/serg-io/dyndb/blob/6f916347aec6678a855c0fa2205e8c84cabce65c/dyndb.js#L272-L304 |
46,681 | purtuga/dom-data-bind | src/Template.js | getTextBindingForToken | function getTextBindingForToken(Directive, tokenText) {
tokenText = tokenText.trim();
let directiveInstances = PRIVATE.get(Directive);
if (!directiveInstances) {
directiveInstances = {};
PRIVATE.set(Directive, directiveInstances);
}
if (!directiveInstances[tokenText]) {
di... | javascript | function getTextBindingForToken(Directive, tokenText) {
tokenText = tokenText.trim();
let directiveInstances = PRIVATE.get(Directive);
if (!directiveInstances) {
directiveInstances = {};
PRIVATE.set(Directive, directiveInstances);
}
if (!directiveInstances[tokenText]) {
di... | [
"function",
"getTextBindingForToken",
"(",
"Directive",
",",
"tokenText",
")",
"{",
"tokenText",
"=",
"tokenText",
".",
"trim",
"(",
")",
";",
"let",
"directiveInstances",
"=",
"PRIVATE",
".",
"get",
"(",
"Directive",
")",
";",
"if",
"(",
"!",
"directiveInst... | Returns a node handlers for the given directive
@param {Directive} Directive
@param {String} tokenText
The token text (no curly braces)
@returns {Directive}
Returns a Directive instance. Call `.getNodeHandler` to get a handler for a given node | [
"Returns",
"a",
"node",
"handlers",
"for",
"the",
"given",
"directive"
] | 0935941568ee5b48dd62a8a0baf982028adce15a | https://github.com/purtuga/dom-data-bind/blob/0935941568ee5b48dd62a8a0baf982028adce15a/src/Template.js#L338-L353 |
46,682 | nicjansma/saltthepass.js | dist/saltthepass.js | DomainNameRule | function DomainNameRule(data) {
if (typeof (data) === "undefined") {
return;
}
//
// matches
//
this.domain = data.domain;
if (data.aliases instanceof Array) {
this.aliases = data.aliases.slice();
} else {
this.aliases... | javascript | function DomainNameRule(data) {
if (typeof (data) === "undefined") {
return;
}
//
// matches
//
this.domain = data.domain;
if (data.aliases instanceof Array) {
this.aliases = data.aliases.slice();
} else {
this.aliases... | [
"function",
"DomainNameRule",
"(",
"data",
")",
"{",
"if",
"(",
"typeof",
"(",
"data",
")",
"===",
"\"undefined\"",
")",
"{",
"return",
";",
"}",
"//",
"// matches",
"//",
"this",
".",
"domain",
"=",
"data",
".",
"domain",
";",
"if",
"(",
"data",
"."... | Constructor
Creates a new DomainNameRule
@param {object} data Parameters | [
"Constructor",
"Creates",
"a",
"new",
"DomainNameRule"
] | 11a3bc652a239d7d505b0debd16adc6d338d19f0 | https://github.com/nicjansma/saltthepass.js/blob/11a3bc652a239d7d505b0debd16adc6d338d19f0/dist/saltthepass.js#L107-L136 |
46,683 | rocketedaway/node-flickr-image-downloader | flickr-image-downloader.js | FlickrImageDownloader | function FlickrImageDownloader () {
var that = this;
that.url = '';
that.delay = 500;
that.downloadFolder = '';
that.paths = {};
that.paths.base = 'https://www.flickr.com';
that.paths.photostream = 'photos/!username';
that.paths.set = that.paths.photostream + '/sets';
that.paths.favorites = that.paths.photo... | javascript | function FlickrImageDownloader () {
var that = this;
that.url = '';
that.delay = 500;
that.downloadFolder = '';
that.paths = {};
that.paths.base = 'https://www.flickr.com';
that.paths.photostream = 'photos/!username';
that.paths.set = that.paths.photostream + '/sets';
that.paths.favorites = that.paths.photo... | [
"function",
"FlickrImageDownloader",
"(",
")",
"{",
"var",
"that",
"=",
"this",
";",
"that",
".",
"url",
"=",
"''",
";",
"that",
".",
"delay",
"=",
"500",
";",
"that",
".",
"downloadFolder",
"=",
"''",
";",
"that",
".",
"paths",
"=",
"{",
"}",
";",... | Module to export | [
"Module",
"to",
"export"
] | 220e93eebd652d0abce944f1c774604aa86baab7 | https://github.com/rocketedaway/node-flickr-image-downloader/blob/220e93eebd652d0abce944f1c774604aa86baab7/flickr-image-downloader.js#L12-L54 |
46,684 | af83/node-serializer | serializer.js | signStr | function signStr(str, key) {
var hmac = crypto.createHmac('sha1', key);
hmac.update(str);
return hmac.digest('base64').replace(/\+/g, '-').replace(/\//g, '_');
} | javascript | function signStr(str, key) {
var hmac = crypto.createHmac('sha1', key);
hmac.update(str);
return hmac.digest('base64').replace(/\+/g, '-').replace(/\//g, '_');
} | [
"function",
"signStr",
"(",
"str",
",",
"key",
")",
"{",
"var",
"hmac",
"=",
"crypto",
".",
"createHmac",
"(",
"'sha1'",
",",
"key",
")",
";",
"hmac",
".",
"update",
"(",
"str",
")",
";",
"return",
"hmac",
".",
"digest",
"(",
"'base64'",
")",
".",
... | Return base64url signed sha1 hash of str using key | [
"Return",
"base64url",
"signed",
"sha1",
"hash",
"of",
"str",
"using",
"key"
] | c7cb3a075fa4b979b2bcb90fe1e457f013c7777b | https://github.com/af83/node-serializer/blob/c7cb3a075fa4b979b2bcb90fe1e457f013c7777b/serializer.js#L59-L63 |
46,685 | anywhichway/chrome-proxy | index.js | function (changeset) {
changeset.forEach(function(change) {
if(change.name!=="__target__") {
if(change.type==="delete") {
delete proxy[change.name];
} else if(change.type==="update") { // update handler if target key value changes from function to non-function or from a non-function to ... | javascript | function (changeset) {
changeset.forEach(function(change) {
if(change.name!=="__target__") {
if(change.type==="delete") {
delete proxy[change.name];
} else if(change.type==="update") { // update handler if target key value changes from function to non-function or from a non-function to ... | [
"function",
"(",
"changeset",
")",
"{",
"changeset",
".",
"forEach",
"(",
"function",
"(",
"change",
")",
"{",
"if",
"(",
"change",
".",
"name",
"!==",
"\"__target__\"",
")",
"{",
"if",
"(",
"change",
".",
"type",
"===",
"\"delete\"",
")",
"{",
"delete... | Observe the target for changes and update the handlers accordingly | [
"Observe",
"the",
"target",
"for",
"changes",
"and",
"update",
"the",
"handlers",
"accordingly"
] | 41dde561732d27e98651beffe48b5cd389e7975b | https://github.com/anywhichway/chrome-proxy/blob/41dde561732d27e98651beffe48b5cd389e7975b/index.js#L101-L114 | |
46,686 | aldeed/node-mongo-object | lib/mongo-object.js | traverse | function traverse(obj) {
each(obj, (val, indexOrProp) => {
// Move deeper into the object
const next = obj[indexOrProp];
// If we can go no further, then quit
if (MongoObject.isBasicObject(next)) {
traverse(next);
} else if (Array.isArray(next)) {
obj[i... | javascript | function traverse(obj) {
each(obj, (val, indexOrProp) => {
// Move deeper into the object
const next = obj[indexOrProp];
// If we can go no further, then quit
if (MongoObject.isBasicObject(next)) {
traverse(next);
} else if (Array.isArray(next)) {
obj[i... | [
"function",
"traverse",
"(",
"obj",
")",
"{",
"each",
"(",
"obj",
",",
"(",
"val",
",",
"indexOrProp",
")",
"=>",
"{",
"// Move deeper into the object",
"const",
"next",
"=",
"obj",
"[",
"indexOrProp",
"]",
";",
"// If we can go no further, then quit",
"if",
"... | Traverse and pull out removed array items at this point | [
"Traverse",
"and",
"pull",
"out",
"removed",
"array",
"items",
"at",
"this",
"point"
] | 040fbbdeeea4d1f8c6da17ecca2d203b8a20c048 | https://github.com/aldeed/node-mongo-object/blob/040fbbdeeea4d1f8c6da17ecca2d203b8a20c048/lib/mongo-object.js#L558-L571 |
46,687 | aldeed/node-mongo-object | lib/mongo-object.js | extractOp | function extractOp(position) {
const firstPositionPiece = position.slice(0, position.indexOf('['));
return (firstPositionPiece.substring(0, 1) === '$') ? firstPositionPiece : null;
} | javascript | function extractOp(position) {
const firstPositionPiece = position.slice(0, position.indexOf('['));
return (firstPositionPiece.substring(0, 1) === '$') ? firstPositionPiece : null;
} | [
"function",
"extractOp",
"(",
"position",
")",
"{",
"const",
"firstPositionPiece",
"=",
"position",
".",
"slice",
"(",
"0",
",",
"position",
".",
"indexOf",
"(",
"'['",
")",
")",
";",
"return",
"(",
"firstPositionPiece",
".",
"substring",
"(",
"0",
",",
... | Extracts operator piece, if present, from position string | [
"Extracts",
"operator",
"piece",
"if",
"present",
"from",
"position",
"string"
] | 040fbbdeeea4d1f8c6da17ecca2d203b8a20c048 | https://github.com/aldeed/node-mongo-object/blob/040fbbdeeea4d1f8c6da17ecca2d203b8a20c048/lib/mongo-object.js#L929-L932 |
46,688 | ithinkihaveacat/node-fishback | lib/helper.js | isFreshEnough | function isFreshEnough(entry, req)
{
// If no cache-control header in request, then entry is fresh
// if it hasn't expired.
if (!("cache-control" in req.headers)) {
return new Date().getTime() < entry.expires;
}
var headers = parseHeader(req.headers["cache-control"]);
if ("must-revalid... | javascript | function isFreshEnough(entry, req)
{
// If no cache-control header in request, then entry is fresh
// if it hasn't expired.
if (!("cache-control" in req.headers)) {
return new Date().getTime() < entry.expires;
}
var headers = parseHeader(req.headers["cache-control"]);
if ("must-revalid... | [
"function",
"isFreshEnough",
"(",
"entry",
",",
"req",
")",
"{",
"// If no cache-control header in request, then entry is fresh",
"// if it hasn't expired.",
"if",
"(",
"!",
"(",
"\"cache-control\"",
"in",
"req",
".",
"headers",
")",
")",
"{",
"return",
"new",
"Date",... | true if the candidate reponse satisfies the request in terms of freshness, otherwise false. | [
"true",
"if",
"the",
"candidate",
"reponse",
"satisfies",
"the",
"request",
"in",
"terms",
"of",
"freshness",
"otherwise",
"false",
"."
] | dbf21d1dcc87cd0bfe19af673157a1869090934f | https://github.com/ithinkihaveacat/node-fishback/blob/dbf21d1dcc87cd0bfe19af673157a1869090934f/lib/helper.js#L70-L93 |
46,689 | thealjey/webcompiler | lib/yaml.js | yaml | function yaml(filename, callback) {
try {
const yamlString = (0, _fs.readFileSync)(filename, 'utf8');
callback(null, (0, _jsYaml.safeLoad)(yamlString, { filename }));
} catch (e) {
callback(e, {});
}
} | javascript | function yaml(filename, callback) {
try {
const yamlString = (0, _fs.readFileSync)(filename, 'utf8');
callback(null, (0, _jsYaml.safeLoad)(yamlString, { filename }));
} catch (e) {
callback(e, {});
}
} | [
"function",
"yaml",
"(",
"filename",
",",
"callback",
")",
"{",
"try",
"{",
"const",
"yamlString",
"=",
"(",
"0",
",",
"_fs",
".",
"readFileSync",
")",
"(",
"filename",
",",
"'utf8'",
")",
";",
"callback",
"(",
"null",
",",
"(",
"0",
",",
"_jsYaml",
... | Read the contents of a YAML file
@function yaml
@param {string} filename - the full system path to a YAML file
@param {ObjectOrErrorCallback} callback - a callback function
@example
import {yaml} from 'webcompiler';
// or - import {yaml} from 'webcompiler/lib/yaml';
// or - var yaml = require('webcompil... | [
"Read",
"the",
"contents",
"of",
"a",
"YAML",
"file"
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/yaml.js#L31-L39 |
46,690 | reklatsmasters/ip2buf | lib/pton6.js | pton6 | function pton6(addr, dest, index = 0) {
if (typeof addr !== 'string') {
throw new TypeError('Argument 1 should be a string.')
}
if (addr.length <= 0) {
einval()
}
const isbuffer = Buffer.isBuffer(dest)
const endp = index + IPV6_OCTETS
if (isbuffer) {
if (endp > dest.length) {
throw ne... | javascript | function pton6(addr, dest, index = 0) {
if (typeof addr !== 'string') {
throw new TypeError('Argument 1 should be a string.')
}
if (addr.length <= 0) {
einval()
}
const isbuffer = Buffer.isBuffer(dest)
const endp = index + IPV6_OCTETS
if (isbuffer) {
if (endp > dest.length) {
throw ne... | [
"function",
"pton6",
"(",
"addr",
",",
"dest",
",",
"index",
"=",
"0",
")",
"{",
"if",
"(",
"typeof",
"addr",
"!==",
"'string'",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"'Argument 1 should be a string.'",
")",
"}",
"if",
"(",
"addr",
".",
"length",
... | Convert IPv6 to the Buffer.
@param {string} addr
@param {Buffer} [dest]
@return {Buffer} | [
"Convert",
"IPv6",
"to",
"the",
"Buffer",
"."
] | 439c55cc7605423929808d42a29b9cd284914cd6 | https://github.com/reklatsmasters/ip2buf/blob/439c55cc7605423929808d42a29b9cd284914cd6/lib/pton6.js#L47-L156 |
46,691 | thealjey/webcompiler | lib/markdown.js | markdownToUnwrappedHTML | function markdownToUnwrappedHTML(markdown) {
const html = (0, _trim2.default)(md.render(markdown)),
{ dom, children } = (0, _jsx.parseHTML)(html);
if (1 !== children.length) {
return html;
}
const [child] = children,
{ type, name } = child;
return 'tag' === type && 'p' === name ? dom(chi... | javascript | function markdownToUnwrappedHTML(markdown) {
const html = (0, _trim2.default)(md.render(markdown)),
{ dom, children } = (0, _jsx.parseHTML)(html);
if (1 !== children.length) {
return html;
}
const [child] = children,
{ type, name } = child;
return 'tag' === type && 'p' === name ? dom(chi... | [
"function",
"markdownToUnwrappedHTML",
"(",
"markdown",
")",
"{",
"const",
"html",
"=",
"(",
"0",
",",
"_trim2",
".",
"default",
")",
"(",
"md",
".",
"render",
"(",
"markdown",
")",
")",
",",
"{",
"dom",
",",
"children",
"}",
"=",
"(",
"0",
",",
"_... | Useful utilities for working with Markdown.
@module markdown
If a simple single line string is passed to the Markdown parser it thinks that it's a paragraph (it sort of
technically is) and unnecessarily wraps it into `<p></p>`, which most often is not the desired behavior.
This function converts Markdown to HTML an... | [
"Useful",
"utilities",
"for",
"working",
"with",
"Markdown",
"."
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/markdown.js#L44-L55 |
46,692 | thealjey/webcompiler | lib/markdown.js | markdownToJSX | function markdownToJSX(markdown = '') {
markdown = (0, _trim2.default)(markdown);
return markdown ? (0, _jsx.htmlToJSX)(markdownToUnwrappedHTML(markdown)) : [];
} | javascript | function markdownToJSX(markdown = '') {
markdown = (0, _trim2.default)(markdown);
return markdown ? (0, _jsx.htmlToJSX)(markdownToUnwrappedHTML(markdown)) : [];
} | [
"function",
"markdownToJSX",
"(",
"markdown",
"=",
"''",
")",
"{",
"markdown",
"=",
"(",
"0",
",",
"_trim2",
".",
"default",
")",
"(",
"markdown",
")",
";",
"return",
"markdown",
"?",
"(",
"0",
",",
"_jsx",
".",
"htmlToJSX",
")",
"(",
"markdownToUnwrap... | Converts an arbitrary Markdown string to an array of React Elements
@memberof module:markdown
@method markdownToJSX
@param {string} [markdown=""] - an arbitrary Markdown string
@return {Array<ReactElement>} an array of React Elements
@example
import {markdownToJSX} from 'webcompiler';
// or - import {markdownToJSX} fr... | [
"Converts",
"an",
"arbitrary",
"Markdown",
"string",
"to",
"an",
"array",
"of",
"React",
"Elements"
] | eb094f1632e5313ed0c5391a303150f1416b9629 | https://github.com/thealjey/webcompiler/blob/eb094f1632e5313ed0c5391a303150f1416b9629/lib/markdown.js#L94-L98 |
46,693 | jclulow/node-ansiterm | examples/scrol.js | _listbox | function _listbox()
{
at.write(VT_SAVE_CURSOR); // save
at.write(CSI + (LAST + 2) + ';' + (AGAIN - 2) + 'r');
at.moveto(1, LAST + 2);
//at.write(CSI + 'J'); // erase down
KEYS.forEach(function(line, idx) {
if (selected === idx) at.reverse();
var ll = line.substr(0, process.stdout.columns - 2);
a... | javascript | function _listbox()
{
at.write(VT_SAVE_CURSOR); // save
at.write(CSI + (LAST + 2) + ';' + (AGAIN - 2) + 'r');
at.moveto(1, LAST + 2);
//at.write(CSI + 'J'); // erase down
KEYS.forEach(function(line, idx) {
if (selected === idx) at.reverse();
var ll = line.substr(0, process.stdout.columns - 2);
a... | [
"function",
"_listbox",
"(",
")",
"{",
"at",
".",
"write",
"(",
"VT_SAVE_CURSOR",
")",
";",
"// save",
"at",
".",
"write",
"(",
"CSI",
"+",
"(",
"LAST",
"+",
"2",
")",
"+",
"';'",
"+",
"(",
"AGAIN",
"-",
"2",
")",
"+",
"'r'",
")",
";",
"at",
... | which index into KEYS is presently selected? | [
"which",
"index",
"into",
"KEYS",
"is",
"presently",
"selected?"
] | cf5223e692e1e1f20c452c9f21060df2cb5bd90e | https://github.com/jclulow/node-ansiterm/blob/cf5223e692e1e1f20c452c9f21060df2cb5bd90e/examples/scrol.js#L173-L191 |
46,694 | Hugo-ter-Doest/chart-parsers | lib/Chart.js | Chart | function Chart(N) {
logger.debug("Chart: " + N);
this.N = N;
this.outgoing_edges = new Array(N+1);
this.incoming_edges = new Array(N+1);
var i;
for (i = 0; i <= N; i++) {
this.outgoing_edges[i] = {};
this.incoming_edges[i] = {};
}
} | javascript | function Chart(N) {
logger.debug("Chart: " + N);
this.N = N;
this.outgoing_edges = new Array(N+1);
this.incoming_edges = new Array(N+1);
var i;
for (i = 0; i <= N; i++) {
this.outgoing_edges[i] = {};
this.incoming_edges[i] = {};
}
} | [
"function",
"Chart",
"(",
"N",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Chart: \"",
"+",
"N",
")",
";",
"this",
".",
"N",
"=",
"N",
";",
"this",
".",
"outgoing_edges",
"=",
"new",
"Array",
"(",
"N",
"+",
"1",
")",
";",
"this",
".",
"incoming_edg... | Creates a chart for recognition of a sentence of length N | [
"Creates",
"a",
"chart",
"for",
"recognition",
"of",
"a",
"sentence",
"of",
"length",
"N"
] | 81be32f897f6dceeffebd2009ad865964da12c4b | https://github.com/Hugo-ter-Doest/chart-parsers/blob/81be32f897f6dceeffebd2009ad865964da12c4b/lib/Chart.js#L31-L43 |
46,695 | quantmind/d3-visualize | src/core/visual.js | visualManager | function visualManager (records) {
let nodes, node;
records.forEach(record => {
nodes = record.removedNodes;
if (!nodes || !nodes.length) return;
for (let i=0; i<nodes.length; ++i) {
node = nodes[i];
if (node.querySelectorAll) {
if (!node.__visua... | javascript | function visualManager (records) {
let nodes, node;
records.forEach(record => {
nodes = record.removedNodes;
if (!nodes || !nodes.length) return;
for (let i=0; i<nodes.length; ++i) {
node = nodes[i];
if (node.querySelectorAll) {
if (!node.__visua... | [
"function",
"visualManager",
"(",
"records",
")",
"{",
"let",
"nodes",
",",
"node",
";",
"records",
".",
"forEach",
"(",
"record",
"=>",
"{",
"nodes",
"=",
"record",
".",
"removedNodes",
";",
"if",
"(",
"!",
"nodes",
"||",
"!",
"nodes",
".",
"length",
... | Clears visualisation going out of scope | [
"Clears",
"visualisation",
"going",
"out",
"of",
"scope"
] | 67dac5a3ea5146eb70eb975667b49cf3827a5df7 | https://github.com/quantmind/d3-visualize/blob/67dac5a3ea5146eb70eb975667b49cf3827a5df7/src/core/visual.js#L190-L207 |
46,696 | Gi60s/cli-format | bin/format.js | maximizeLargeWord | function maximizeLargeWord(word, hardBreakStr, maxWidth) {
var availableWidth;
var ch;
var chWidth;
var i;
availableWidth = maxWidth - Format.width(hardBreakStr);
for (i = 0; i < word.length; i++) {
ch = word.charAt(i);
chWidth = Format.width(ch);
if (availableWidth >= ... | javascript | function maximizeLargeWord(word, hardBreakStr, maxWidth) {
var availableWidth;
var ch;
var chWidth;
var i;
availableWidth = maxWidth - Format.width(hardBreakStr);
for (i = 0; i < word.length; i++) {
ch = word.charAt(i);
chWidth = Format.width(ch);
if (availableWidth >= ... | [
"function",
"maximizeLargeWord",
"(",
"word",
",",
"hardBreakStr",
",",
"maxWidth",
")",
"{",
"var",
"availableWidth",
";",
"var",
"ch",
";",
"var",
"chWidth",
";",
"var",
"i",
";",
"availableWidth",
"=",
"maxWidth",
"-",
"Format",
".",
"width",
"(",
"hard... | If a word is too large for a line then find out how much will
fit on one line and return the result.
@param {string} word
@param {string} hardBreakStr
@param {number} maxWidth
@returns {object} | [
"If",
"a",
"word",
"is",
"too",
"large",
"for",
"a",
"line",
"then",
"find",
"out",
"how",
"much",
"will",
"fit",
"on",
"one",
"line",
"and",
"return",
"the",
"result",
"."
] | fe74d976cd3cb3bbbaec7d966ffd9bc41bda150d | https://github.com/Gi60s/cli-format/blob/fe74d976cd3cb3bbbaec7d966ffd9bc41bda150d/bin/format.js#L500-L522 |
46,697 | sammysaglam/axe-prop-types | index.js | function (propType, values) {
propType.info = Object.assign(
propType.info ? propType.info : {},
values
);
if (propType.isRequired) {
propType.isRequired.info = Object.assign(
propType.isRequired && propType.isRequired.info ? propType.isRequired.info : {},
values
);
propType.isRequired.info.isRequ... | javascript | function (propType, values) {
propType.info = Object.assign(
propType.info ? propType.info : {},
values
);
if (propType.isRequired) {
propType.isRequired.info = Object.assign(
propType.isRequired && propType.isRequired.info ? propType.isRequired.info : {},
values
);
propType.isRequired.info.isRequ... | [
"function",
"(",
"propType",
",",
"values",
")",
"{",
"propType",
".",
"info",
"=",
"Object",
".",
"assign",
"(",
"propType",
".",
"info",
"?",
"propType",
".",
"info",
":",
"{",
"}",
",",
"values",
")",
";",
"if",
"(",
"propType",
".",
"isRequired",... | function to add key value pair to proptype | [
"function",
"to",
"add",
"key",
"value",
"pair",
"to",
"proptype"
] | 4f836232c75556ff510bc1ccff2656a4fb88315b | https://github.com/sammysaglam/axe-prop-types/blob/4f836232c75556ff510bc1ccff2656a4fb88315b/index.js#L23-L41 | |
46,698 | tamtakoe/node-arjs-builder | index.js | copy | function copy(copiesMap, projectsPath, buildPath) {
return _.map(copiesMap, function(dstPath, srcPath) {
if (/\/$/.test(dstPath)) {
//copy directory
return gulp.src(path.join(projectsPath, srcPath))
.pipe(gulp.dest(path.join(bui... | javascript | function copy(copiesMap, projectsPath, buildPath) {
return _.map(copiesMap, function(dstPath, srcPath) {
if (/\/$/.test(dstPath)) {
//copy directory
return gulp.src(path.join(projectsPath, srcPath))
.pipe(gulp.dest(path.join(bui... | [
"function",
"copy",
"(",
"copiesMap",
",",
"projectsPath",
",",
"buildPath",
")",
"{",
"return",
"_",
".",
"map",
"(",
"copiesMap",
",",
"function",
"(",
"dstPath",
",",
"srcPath",
")",
"{",
"if",
"(",
"/",
"\\/$",
"/",
".",
"test",
"(",
"dstPath",
"... | copying for other projects | [
"copying",
"for",
"other",
"projects"
] | 9fb6ff399fe09b860f1a4673b643d291834ec632 | https://github.com/tamtakoe/node-arjs-builder/blob/9fb6ff399fe09b860f1a4673b643d291834ec632/index.js#L211-L224 |
46,699 | waigo/waigo | src/support/middleware/errorHandler.js | function() {
let args = Array.prototype.slice.call(arguments),
ErrorClass = args[0];
if (_.isObject(ErrorClass)) {
args.shift();
} else {
ErrorClass = errors.RuntimeError;
}
args.unshift(null); // the this arg for the .bind() call
throw new (Function.prototype.bind.apply(ErrorClass, args));... | javascript | function() {
let args = Array.prototype.slice.call(arguments),
ErrorClass = args[0];
if (_.isObject(ErrorClass)) {
args.shift();
} else {
ErrorClass = errors.RuntimeError;
}
args.unshift(null); // the this arg for the .bind() call
throw new (Function.prototype.bind.apply(ErrorClass, args));... | [
"function",
"(",
")",
"{",
"let",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
",",
"ErrorClass",
"=",
"args",
"[",
"0",
"]",
";",
"if",
"(",
"_",
".",
"isObject",
"(",
"ErrorClass",
")",
")",
"{",
"ar... | Throw an error
@param {Class} [errorClass] Error class. Default is `RuntimeError`.
@param {Any} ... Additional arguments get passed to error class constructor.
@throws Error | [
"Throw",
"an",
"error"
] | b2f50cd66b8b19016e2c7de75733330c791c76ff | https://github.com/waigo/waigo/blob/b2f50cd66b8b19016e2c7de75733330c791c76ff/src/support/middleware/errorHandler.js#L83-L96 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.