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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
edertone/TurboCommons | TurboCommons-Java/.turboBuilder/Utils.js | echoWarningsAndErrors | function echoWarningsAndErrors(antWarnings, antErrors){
//Define the echo task to use for warnings and errors
var echo = project.createTask("echo");
var error = new org.apache.tools.ant.taskdefs.Echo.EchoLevel();
error.setValue("error");
echo.setLevel(error);
//Display all the detected warnings
for(v... | javascript | function echoWarningsAndErrors(antWarnings, antErrors){
//Define the echo task to use for warnings and errors
var echo = project.createTask("echo");
var error = new org.apache.tools.ant.taskdefs.Echo.EchoLevel();
error.setValue("error");
echo.setLevel(error);
//Display all the detected warnings
for(v... | [
"function",
"echoWarningsAndErrors",
"(",
"antWarnings",
",",
"antErrors",
")",
"{",
"//Define the echo task to use for warnings and errors\r",
"var",
"echo",
"=",
"project",
".",
"createTask",
"(",
"\"echo\"",
")",
";",
"var",
"error",
"=",
"new",
"org",
".",
"apac... | Output to ant console the warnings and errors if exist | [
"Output",
"to",
"ant",
"console",
"the",
"warnings",
"and",
"errors",
"if",
"exist"
] | 275d4971ec19d8632b92ac466d9ce5b7db50acfa | https://github.com/edertone/TurboCommons/blob/275d4971ec19d8632b92ac466d9ce5b7db50acfa/TurboCommons-Java/.turboBuilder/Utils.js#L83-L110 | train |
jslicense/spdx-satisfies.js | index.js | flatten | function flatten (expression) {
const expanded = Array.from(expandInner(expression))
const flattened = expanded.reduce(function (result, clause) {
return Object.assign(result, clause)
}, {})
return sort([flattened])[0]
} | javascript | function flatten (expression) {
const expanded = Array.from(expandInner(expression))
const flattened = expanded.reduce(function (result, clause) {
return Object.assign(result, clause)
}, {})
return sort([flattened])[0]
} | [
"function",
"flatten",
"(",
"expression",
")",
"{",
"const",
"expanded",
"=",
"Array",
".",
"from",
"(",
"expandInner",
"(",
"expression",
")",
")",
"const",
"flattened",
"=",
"expanded",
".",
"reduce",
"(",
"function",
"(",
"result",
",",
"clause",
")",
... | Flatten the given expression into an array of all licenses mentioned in the expression. | [
"Flatten",
"the",
"given",
"expression",
"into",
"an",
"array",
"of",
"all",
"licenses",
"mentioned",
"in",
"the",
"expression",
"."
] | a4d27d9711a333fecda4c9b83f0d549eb06d5dfc | https://github.com/jslicense/spdx-satisfies.js/blob/a4d27d9711a333fecda4c9b83f0d549eb06d5dfc/index.js#L96-L102 | train |
ArnaudBuchholz/gpf-js | src/factory.js | _gpfNewApply | function _gpfNewApply (Constructor, parameters) {
if (parameters.length > _gpfGenericFactory.length) {
_gpfGenericFactory = _gpfGenerateGenericFactory(parameters.length);
}
return _gpfGenericFactory.apply(Constructor, parameters);
} | javascript | function _gpfNewApply (Constructor, parameters) {
if (parameters.length > _gpfGenericFactory.length) {
_gpfGenericFactory = _gpfGenerateGenericFactory(parameters.length);
}
return _gpfGenericFactory.apply(Constructor, parameters);
} | [
"function",
"_gpfNewApply",
"(",
"Constructor",
",",
"parameters",
")",
"{",
"if",
"(",
"parameters",
".",
"length",
">",
"_gpfGenericFactory",
".",
"length",
")",
"{",
"_gpfGenericFactory",
"=",
"_gpfGenerateGenericFactory",
"(",
"parameters",
".",
"length",
")",... | Call a constructor with an array of parameters.
It is impossible to mix [new](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new)
and [apply](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply)
in the same call.
This helper workarounds this pro... | [
"Call",
"a",
"constructor",
"with",
"an",
"array",
"of",
"parameters",
"."
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/factory.js#L70-L75 | train |
ArnaudBuchholz/gpf-js | src/error.js | function (context) {
var replacements;
if (context) {
replacements = {};
_gpfObjectForEach(context, function (value, key) {
replacements["{" + key + "}"] = value.toString();
});
this.message = _gpfStringReplaceEx(this.message, replacements)... | javascript | function (context) {
var replacements;
if (context) {
replacements = {};
_gpfObjectForEach(context, function (value, key) {
replacements["{" + key + "}"] = value.toString();
});
this.message = _gpfStringReplaceEx(this.message, replacements)... | [
"function",
"(",
"context",
")",
"{",
"var",
"replacements",
";",
"if",
"(",
"context",
")",
"{",
"replacements",
"=",
"{",
"}",
";",
"_gpfObjectForEach",
"(",
"context",
",",
"function",
"(",
"value",
",",
"key",
")",
"{",
"replacements",
"[",
"\"{\"",
... | Build message by substituting context variables
@param {Object} context Dictionary of named keys
@since 0.1.5 | [
"Build",
"message",
"by",
"substituting",
"context",
"variables"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/error.js#L59-L68 | train | |
ArnaudBuchholz/gpf-js | src/error.js | _gpfGenenerateErrorFunction | function _gpfGenenerateErrorFunction (code, name, message) {
var result = _gpfErrorFactory(code, name, message);
result.CODE = code;
result.NAME = name;
result.MESSAGE = message;
return result;
} | javascript | function _gpfGenenerateErrorFunction (code, name, message) {
var result = _gpfErrorFactory(code, name, message);
result.CODE = code;
result.NAME = name;
result.MESSAGE = message;
return result;
} | [
"function",
"_gpfGenenerateErrorFunction",
"(",
"code",
",",
"name",
",",
"message",
")",
"{",
"var",
"result",
"=",
"_gpfErrorFactory",
"(",
"code",
",",
"name",
",",
"message",
")",
";",
"result",
".",
"CODE",
"=",
"code",
";",
"result",
".",
"NAME",
"... | Generates an error class
@param {Number} code Error code
@param {String} name Error name
@param {String} message Error message
@return {Function} New error class
@gpf:closure
@since 0.1.5 | [
"Generates",
"an",
"error",
"class"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/error.js#L103-L109 | train |
ArnaudBuchholz/gpf-js | src/error.js | _gpfErrorDeclare | function _gpfErrorDeclare (source, dictionary) {
_gpfIgnore(source);
_gpfObjectForEach(dictionary, function (message, name) {
var code = ++_gpfLastErrorCode;
gpf.Error["CODE_" + name.toUpperCase()] = code;
gpf.Error[name] = _gpfGenenerateErrorFunction(code, name, message);
});
} | javascript | function _gpfErrorDeclare (source, dictionary) {
_gpfIgnore(source);
_gpfObjectForEach(dictionary, function (message, name) {
var code = ++_gpfLastErrorCode;
gpf.Error["CODE_" + name.toUpperCase()] = code;
gpf.Error[name] = _gpfGenenerateErrorFunction(code, name, message);
});
} | [
"function",
"_gpfErrorDeclare",
"(",
"source",
",",
"dictionary",
")",
"{",
"_gpfIgnore",
"(",
"source",
")",
";",
"_gpfObjectForEach",
"(",
"dictionary",
",",
"function",
"(",
"message",
",",
"name",
")",
"{",
"var",
"code",
"=",
"++",
"_gpfLastErrorCode",
... | Declare error messages.
Each source declares its own errors.
@param {String} source Source name
@param {Object} dictionary Dictionary of error name to message
@since 0.1.5 | [
"Declare",
"error",
"messages",
".",
"Each",
"source",
"declares",
"its",
"own",
"errors",
"."
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/error.js#L122-L129 | train |
Esri/terraformer-geostore | src/helpers/browser/eventemitter.js | EventEmitter | function EventEmitter() {
this._events = { };
this._once = { };
// default to 10 max liseners
this._maxListeners = 10;
this._add = function (event, listener, once) {
var entry = { listener: listener };
if (once) {
entry.once = true;
}
if (this._events[event]) {
this._events[eve... | javascript | function EventEmitter() {
this._events = { };
this._once = { };
// default to 10 max liseners
this._maxListeners = 10;
this._add = function (event, listener, once) {
var entry = { listener: listener };
if (once) {
entry.once = true;
}
if (this._events[event]) {
this._events[eve... | [
"function",
"EventEmitter",
"(",
")",
"{",
"this",
".",
"_events",
"=",
"{",
"}",
";",
"this",
".",
"_once",
"=",
"{",
"}",
";",
"// default to 10 max liseners",
"this",
".",
"_maxListeners",
"=",
"10",
";",
"this",
".",
"_add",
"=",
"function",
"(",
"... | super light weight EventEmitter implementation | [
"super",
"light",
"weight",
"EventEmitter",
"implementation"
] | 0226a88e570dafcbf185d598eafd9de3f8f27213 | https://github.com/Esri/terraformer-geostore/blob/0226a88e570dafcbf185d598eafd9de3f8f27213/src/helpers/browser/eventemitter.js#L3-L87 | train |
ArnaudBuchholz/gpf-js | src/attributes/check.js | _gpfAttributesCheckAppliedOnBaseClass | function _gpfAttributesCheckAppliedOnBaseClass (classDefinition, ExpectedBaseClass) {
var Extend = classDefinition._extend;
if (Extend !== ExpectedBaseClass) {
_gpfAttributesCheckAppliedOnBaseClassIsInstanceOf(Extend.prototype, ExpectedBaseClass);
}
} | javascript | function _gpfAttributesCheckAppliedOnBaseClass (classDefinition, ExpectedBaseClass) {
var Extend = classDefinition._extend;
if (Extend !== ExpectedBaseClass) {
_gpfAttributesCheckAppliedOnBaseClassIsInstanceOf(Extend.prototype, ExpectedBaseClass);
}
} | [
"function",
"_gpfAttributesCheckAppliedOnBaseClass",
"(",
"classDefinition",
",",
"ExpectedBaseClass",
")",
"{",
"var",
"Extend",
"=",
"classDefinition",
".",
"_extend",
";",
"if",
"(",
"Extend",
"!==",
"ExpectedBaseClass",
")",
"{",
"_gpfAttributesCheckAppliedOnBaseClass... | Ensures attribute is applied on a specific base class
@param {_GpfClassDefinition} classDefinition Class definition
@param {Function} ExpectedBaseClass Expected base class
@throws {gpf.Error.RestrictedBaseClassAttribute}
@since 0.2.8 | [
"Ensures",
"attribute",
"is",
"applied",
"on",
"a",
"specific",
"base",
"class"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/attributes/check.js#L108-L113 | train |
ArnaudBuchholz/gpf-js | src/attributes/check.js | _gpfAttributesCheckAppliedOnlyOnce | function _gpfAttributesCheckAppliedOnlyOnce (member, classDefinition, AttributeClass) {
var attributes = _gpfAttributesCheckGetMemberAttributes(member, classDefinition, AttributeClass);
if (_gpfArrayTail(attributes).length) {
gpf.Error.uniqueAttributeUsedTwice();
}
} | javascript | function _gpfAttributesCheckAppliedOnlyOnce (member, classDefinition, AttributeClass) {
var attributes = _gpfAttributesCheckGetMemberAttributes(member, classDefinition, AttributeClass);
if (_gpfArrayTail(attributes).length) {
gpf.Error.uniqueAttributeUsedTwice();
}
} | [
"function",
"_gpfAttributesCheckAppliedOnlyOnce",
"(",
"member",
",",
"classDefinition",
",",
"AttributeClass",
")",
"{",
"var",
"attributes",
"=",
"_gpfAttributesCheckGetMemberAttributes",
"(",
"member",
",",
"classDefinition",
",",
"AttributeClass",
")",
";",
"if",
"(... | Ensures attribute is used only once
@param {String} member Member name or empty if global to the class
@param {_GpfClassDefinition} classDefinition Class definition
@param {Function} AttributeClass Attribute class
@throws {gpf.Error.UniqueAttributeUsedTwice}
@since 0.2.8 | [
"Ensures",
"attribute",
"is",
"used",
"only",
"once"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/attributes/check.js#L132-L137 | train |
ArnaudBuchholz/gpf-js | lost+found/src/define_/definition/member.js | _GpfClassDefMember | function _GpfClassDefMember (name, defaultValue, type) {
/*jshint validthis:true*/ // constructor
this._name = name;
this._setDefaultValue(defaultValue);
this._setType(type || "undefined");
} | javascript | function _GpfClassDefMember (name, defaultValue, type) {
/*jshint validthis:true*/ // constructor
this._name = name;
this._setDefaultValue(defaultValue);
this._setType(type || "undefined");
} | [
"function",
"_GpfClassDefMember",
"(",
"name",
",",
"defaultValue",
",",
"type",
")",
"{",
"/*jshint validthis:true*/",
"// constructor",
"this",
".",
"_name",
"=",
"name",
";",
"this",
".",
"_setDefaultValue",
"(",
"defaultValue",
")",
";",
"this",
".",
"_setTy... | Class member definition
- Contains a reference to the class definition where the member is defined
- Owns the name, the default value and a reference type
@param {String} name Member name
@param {*} defaultValue Member default / initial value
@param {String} [type=typeof defaultValue] type Member type
@class | [
"Class",
"member",
"definition",
"-",
"Contains",
"a",
"reference",
"to",
"the",
"class",
"definition",
"where",
"the",
"member",
"is",
"defined",
"-",
"Owns",
"the",
"name",
"the",
"default",
"value",
"and",
"a",
"reference",
"type"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/definition/member.js#L25-L30 | train |
ArnaudBuchholz/gpf-js | lost+found/src/define_/definition/class.js | function (member) {
_gpfAsserts({
"Expected a _GpfClassDefMember": member instanceof _GpfClassDefMember,
"Member is already assigned to a class": null === member._classDef
});
this._checkMemberBeforeAdd(member);
this._members[member.getName()] = member;
me... | javascript | function (member) {
_gpfAsserts({
"Expected a _GpfClassDefMember": member instanceof _GpfClassDefMember,
"Member is already assigned to a class": null === member._classDef
});
this._checkMemberBeforeAdd(member);
this._members[member.getName()] = member;
me... | [
"function",
"(",
"member",
")",
"{",
"_gpfAsserts",
"(",
"{",
"\"Expected a _GpfClassDefMember\"",
":",
"member",
"instanceof",
"_GpfClassDefMember",
",",
"\"Member is already assigned to a class\"",
":",
"null",
"===",
"member",
".",
"_classDef",
"}",
")",
";",
"this... | Add a member
@param {_GpfClassDefMember} member Member to add
@gpf:chainable | [
"Add",
"a",
"member"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/definition/class.js#L152-L161 | train | |
SockDrawer/SockBot | lib/utils.js | mergeInner | function mergeInner(base, mixin, mergeArrays) {
if (base === null || typeof base !== 'object' || Array.isArray(base)) {
throw new Error('base must be object');
}
if (mixin === null || typeof mixin !== 'object' || Array.isArray(mixin)) {
throw new Error('mixin must be object');
}
Obje... | javascript | function mergeInner(base, mixin, mergeArrays) {
if (base === null || typeof base !== 'object' || Array.isArray(base)) {
throw new Error('base must be object');
}
if (mixin === null || typeof mixin !== 'object' || Array.isArray(mixin)) {
throw new Error('mixin must be object');
}
Obje... | [
"function",
"mergeInner",
"(",
"base",
",",
"mixin",
",",
"mergeArrays",
")",
"{",
"if",
"(",
"base",
"===",
"null",
"||",
"typeof",
"base",
"!==",
"'object'",
"||",
"Array",
".",
"isArray",
"(",
"base",
")",
")",
"{",
"throw",
"new",
"Error",
"(",
"... | Recursively merge objects
@param {object} base Base object to merge `mixin` into
@param {object} mixin Mixin object to merge into `base`
@param {boolean} [mergeArrays] Merge arrays instead of concatenating them | [
"Recursively",
"merge",
"objects"
] | 043f7e9aa9ec12250889fd825ddcf86709b095a3 | https://github.com/SockDrawer/SockBot/blob/043f7e9aa9ec12250889fd825ddcf86709b095a3/lib/utils.js#L46-L56 | train |
SockDrawer/SockBot | lib/utils.js | mergeHelper | function mergeHelper(base, mixin, name, mergeArrays) {
if (Array.isArray(mixin[name])) {
if (!mergeArrays && base[name] && Array.isArray(base[name])) {
base[name] = base[name].concat(mixin[name]);
} else {
base[name] = mixin[name];
}
} else if (typeof mixin[name] ... | javascript | function mergeHelper(base, mixin, name, mergeArrays) {
if (Array.isArray(mixin[name])) {
if (!mergeArrays && base[name] && Array.isArray(base[name])) {
base[name] = base[name].concat(mixin[name]);
} else {
base[name] = mixin[name];
}
} else if (typeof mixin[name] ... | [
"function",
"mergeHelper",
"(",
"base",
",",
"mixin",
",",
"name",
",",
"mergeArrays",
")",
"{",
"if",
"(",
"Array",
".",
"isArray",
"(",
"mixin",
"[",
"name",
"]",
")",
")",
"{",
"if",
"(",
"!",
"mergeArrays",
"&&",
"base",
"[",
"name",
"]",
"&&",... | Merge helper - FOR INTERNAL USE ONLY
@param {object} base Base object to merge `mixin` into
@param {object} mixin Mixin object to merge into `base`
@param {string} name Name of property to merge
@param {boolean} [mergeArrays] Merge arrays instead of concatenating them | [
"Merge",
"helper",
"-",
"FOR",
"INTERNAL",
"USE",
"ONLY"
] | 043f7e9aa9ec12250889fd825ddcf86709b095a3 | https://github.com/SockDrawer/SockBot/blob/043f7e9aa9ec12250889fd825ddcf86709b095a3/lib/utils.js#L66-L83 | train |
SockDrawer/SockBot | plugins/summoner.js | handler | function handler(notification) {
debug('summoner received a mention notification!');
return notification.getUser()
.then((user) => {
debug(`summoner responding to summons by ${user.name}`);
const index = Math.floor(Math.random() * messages.length);
... | javascript | function handler(notification) {
debug('summoner received a mention notification!');
return notification.getUser()
.then((user) => {
debug(`summoner responding to summons by ${user.name}`);
const index = Math.floor(Math.random() * messages.length);
... | [
"function",
"handler",
"(",
"notification",
")",
"{",
"debug",
"(",
"'summoner received a mention notification!'",
")",
";",
"return",
"notification",
".",
"getUser",
"(",
")",
".",
"then",
"(",
"(",
"user",
")",
"=>",
"{",
"debug",
"(",
"`",
"${",
"user",
... | Handle a mention notification.
Choose a random message and reply with it
@param {Notification} notification Notification event to handle
@returns {Promise} Resolves when event is processed | [
"Handle",
"a",
"mention",
"notification",
"."
] | 043f7e9aa9ec12250889fd825ddcf86709b095a3 | https://github.com/SockDrawer/SockBot/blob/043f7e9aa9ec12250889fd825ddcf86709b095a3/plugins/summoner.js#L45-L68 | train |
SockDrawer/SockBot | providers/nodebb/chat.js | sendChat | function sendChat(roomId, content) {
return retryAction(() => forum._emit('modules.chats.send', {
roomId: roomId,
message: content
}), 5);
} | javascript | function sendChat(roomId, content) {
return retryAction(() => forum._emit('modules.chats.send', {
roomId: roomId,
message: content
}), 5);
} | [
"function",
"sendChat",
"(",
"roomId",
",",
"content",
")",
"{",
"return",
"retryAction",
"(",
"(",
")",
"=>",
"forum",
".",
"_emit",
"(",
"'modules.chats.send'",
",",
"{",
"roomId",
":",
"roomId",
",",
"message",
":",
"content",
"}",
")",
",",
"5",
")... | Send a message to the chatroom
@public
@param {number} roomId Chatroom to speak to
@param {string} content Message to send to the chatroom
@returns {Promise} Resolves when message has been sent | [
"Send",
"a",
"message",
"to",
"the",
"chatroom"
] | 043f7e9aa9ec12250889fd825ddcf86709b095a3 | https://github.com/SockDrawer/SockBot/blob/043f7e9aa9ec12250889fd825ddcf86709b095a3/providers/nodebb/chat.js#L22-L27 | train |
SockDrawer/SockBot | providers/nodebb/chat.js | handleChat | function handleChat(payload) {
if (!payload.message) {
return Promise.reject(new Error('Event payload did not include chat message'));
}
const message = ChatRoom.Message.parse(payload.message);
forum.emit('chatMessage', message);
const ids = {
post: -1,
... | javascript | function handleChat(payload) {
if (!payload.message) {
return Promise.reject(new Error('Event payload did not include chat message'));
}
const message = ChatRoom.Message.parse(payload.message);
forum.emit('chatMessage', message);
const ids = {
post: -1,
... | [
"function",
"handleChat",
"(",
"payload",
")",
"{",
"if",
"(",
"!",
"payload",
".",
"message",
")",
"{",
"return",
"Promise",
".",
"reject",
"(",
"new",
"Error",
"(",
"'Event payload did not include chat message'",
")",
")",
";",
"}",
"const",
"message",
"="... | Handle Chat events from websocket
@private
@param {*} payload websocket event payload
@returns {Promise} resolves when processing has been completed for event | [
"Handle",
"Chat",
"events",
"from",
"websocket"
] | 043f7e9aa9ec12250889fd825ddcf86709b095a3 | https://github.com/SockDrawer/SockBot/blob/043f7e9aa9ec12250889fd825ddcf86709b095a3/providers/nodebb/chat.js#L441-L457 | train |
ArnaudBuchholz/gpf-js | res/sources/source.js | function (dependencies) {
this._dependsOn = dependencies[this._name] || [];
this._dependencyOf = [];
Object.keys(dependencies).forEach(function (name) {
var nameDependencies = dependencies[name];
if (nameDependencies.indexOf(this._name) !== NOT_FOUND) ... | javascript | function (dependencies) {
this._dependsOn = dependencies[this._name] || [];
this._dependencyOf = [];
Object.keys(dependencies).forEach(function (name) {
var nameDependencies = dependencies[name];
if (nameDependencies.indexOf(this._name) !== NOT_FOUND) ... | [
"function",
"(",
"dependencies",
")",
"{",
"this",
".",
"_dependsOn",
"=",
"dependencies",
"[",
"this",
".",
"_name",
"]",
"||",
"[",
"]",
";",
"this",
".",
"_dependencyOf",
"=",
"[",
"]",
";",
"Object",
".",
"keys",
"(",
"dependencies",
")",
".",
"f... | Extract from the dependencies dictionary
@param {Object} dependencies dictionary | [
"Extract",
"from",
"the",
"dependencies",
"dictionary"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/res/sources/source.js#L98-L107 | train | |
ArnaudBuchholz/gpf-js | res/sources/source.js | function () {
var result = {
name: this._name
};
if (!this._test) {
result.test = false;
}
if (this._tags.length) {
result.tags = this._tags.join(" ");
}
return result;
} | javascript | function () {
var result = {
name: this._name
};
if (!this._test) {
result.test = false;
}
if (this._tags.length) {
result.tags = this._tags.join(" ");
}
return result;
} | [
"function",
"(",
")",
"{",
"var",
"result",
"=",
"{",
"name",
":",
"this",
".",
"_name",
"}",
";",
"if",
"(",
"!",
"this",
".",
"_test",
")",
"{",
"result",
".",
"test",
"=",
"false",
";",
"}",
"if",
"(",
"this",
".",
"_tags",
".",
"length",
... | Create the exported version of the source
@return {Object} Object to be converted to JSON and saved | [
"Create",
"the",
"exported",
"version",
"of",
"the",
"source"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/res/sources/source.js#L128-L139 | train | |
Esri/terraformer-geostore | src/geostore.js | function(primitive){
completed++;
if ( primitive ){
var geometry = new Terraformer.Primitive(primitive.geometry);
if (shapeGeometryTest(geometry, shape)){
if (self._stream) {
if (completed === found.length) {
if (operationName =... | javascript | function(primitive){
completed++;
if ( primitive ){
var geometry = new Terraformer.Primitive(primitive.geometry);
if (shapeGeometryTest(geometry, shape)){
if (self._stream) {
if (completed === found.length) {
if (operationName =... | [
"function",
"(",
"primitive",
")",
"{",
"completed",
"++",
";",
"if",
"(",
"primitive",
")",
"{",
"var",
"geometry",
"=",
"new",
"Terraformer",
".",
"Primitive",
"(",
"primitive",
".",
"geometry",
")",
";",
"if",
"(",
"shapeGeometryTest",
"(",
"geometry",
... | the function to evalute results from the index | [
"the",
"function",
"to",
"evalute",
"results",
"from",
"the",
"index"
] | 0226a88e570dafcbf185d598eafd9de3f8f27213 | https://github.com/Esri/terraformer-geostore/blob/0226a88e570dafcbf185d598eafd9de3f8f27213/src/geostore.js#L219-L254 | train | |
ArnaudBuchholz/gpf-js | src/define/check.js | function () {
var parts = new RegExp("(.*)\\.([^\\.]+)$").exec(this._name),
NAME_PART = 2,
NAMESPACE_PART = 1;
if (parts) {
this._name = parts[NAME_PART];
return parts[NAMESPACE_PART];
}
} | javascript | function () {
var parts = new RegExp("(.*)\\.([^\\.]+)$").exec(this._name),
NAME_PART = 2,
NAMESPACE_PART = 1;
if (parts) {
this._name = parts[NAME_PART];
return parts[NAMESPACE_PART];
}
} | [
"function",
"(",
")",
"{",
"var",
"parts",
"=",
"new",
"RegExp",
"(",
"\"(.*)\\\\.([^\\\\.]+)$\"",
")",
".",
"exec",
"(",
"this",
".",
"_name",
")",
",",
"NAME_PART",
"=",
"2",
",",
"NAMESPACE_PART",
"=",
"1",
";",
"if",
"(",
"parts",
")",
"{",
"this... | If the name is prefixed with a namespace, isolate it and update name property
@return {String|undefined} Namespace contained in the name or undefined if none
@since 0.1.6 | [
"If",
"the",
"name",
"is",
"prefixed",
"with",
"a",
"namespace",
"isolate",
"it",
"and",
"update",
"name",
"property"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/define/check.js#L260-L268 | train | |
ArnaudBuchholz/gpf-js | src/define/check.js | function () {
var namespaces = [
this._initialDefinition.$namespace,
this._extractRelativeNamespaceFromName()
].filter(function (namespacePart) {
return namespacePart;
});
if (namespaces.length) {
this._namespace = namespaces.join(".");
... | javascript | function () {
var namespaces = [
this._initialDefinition.$namespace,
this._extractRelativeNamespaceFromName()
].filter(function (namespacePart) {
return namespacePart;
});
if (namespaces.length) {
this._namespace = namespaces.join(".");
... | [
"function",
"(",
")",
"{",
"var",
"namespaces",
"=",
"[",
"this",
".",
"_initialDefinition",
".",
"$namespace",
",",
"this",
".",
"_extractRelativeNamespaceFromName",
"(",
")",
"]",
".",
"filter",
"(",
"function",
"(",
"namespacePart",
")",
"{",
"return",
"n... | Compute namespace property
@since 0.1.6 | [
"Compute",
"namespace",
"property"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/define/check.js#L274-L284 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/internal.js | _gpfCleanDefinition | function _gpfCleanDefinition (name, shortcut) {
/*jshint validthis:true*/ // Bound to the definition below
var shortcutValue = this[shortcut];
if (undefined !== shortcutValue) {
this[name] = shortcutValue;
delete this[shortcut];
}
} | javascript | function _gpfCleanDefinition (name, shortcut) {
/*jshint validthis:true*/ // Bound to the definition below
var shortcutValue = this[shortcut];
if (undefined !== shortcutValue) {
this[name] = shortcutValue;
delete this[shortcut];
}
} | [
"function",
"_gpfCleanDefinition",
"(",
"name",
",",
"shortcut",
")",
"{",
"/*jshint validthis:true*/",
"// Bound to the definition below",
"var",
"shortcutValue",
"=",
"this",
"[",
"shortcut",
"]",
";",
"if",
"(",
"undefined",
"!==",
"shortcutValue",
")",
"{",
"thi... | Replace the shortcut with the correct property name | [
"Replace",
"the",
"shortcut",
"with",
"the",
"correct",
"property",
"name"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/internal.js#L18-L25 | train |
popeindustries/buddy | lib/config/index.js | parsePlugins | function parsePlugins(config) {
let plugins = [];
function parse(plugins) {
return plugins.map(plugin => {
if ('string' == typeof plugin) plugin = path.resolve(plugin);
return plugin;
});
}
// Handle plugin paths defined in config file
if (config.plugins) {
plugins.push(...parse(conf... | javascript | function parsePlugins(config) {
let plugins = [];
function parse(plugins) {
return plugins.map(plugin => {
if ('string' == typeof plugin) plugin = path.resolve(plugin);
return plugin;
});
}
// Handle plugin paths defined in config file
if (config.plugins) {
plugins.push(...parse(conf... | [
"function",
"parsePlugins",
"(",
"config",
")",
"{",
"let",
"plugins",
"=",
"[",
"]",
";",
"function",
"parse",
"(",
"plugins",
")",
"{",
"return",
"plugins",
".",
"map",
"(",
"plugin",
"=>",
"{",
"if",
"(",
"'string'",
"==",
"typeof",
"plugin",
")",
... | Parse plugins defined in 'config'
@param {Config} config
@returns {Array} | [
"Parse",
"plugins",
"defined",
"in",
"config"
] | c38afc2e6915743eb6cfcf5aba59a8699142c7a5 | https://github.com/popeindustries/buddy/blob/c38afc2e6915743eb6cfcf5aba59a8699142c7a5/lib/config/index.js#L320-L342 | train |
ArnaudBuchholz/gpf-js | lost+found/src/define_/params.js | _gpfProcessDefineParamCheckIfRelativeName | function _gpfProcessDefineParamCheckIfRelativeName (rootNamespace, params) {
var name = params[_GPF_DEFINE_PARAM_NAME];
if (-1 === name.indexOf(".")) {
params[_GPF_DEFINE_PARAM_NAME] = rootNamespace + name;
}
} | javascript | function _gpfProcessDefineParamCheckIfRelativeName (rootNamespace, params) {
var name = params[_GPF_DEFINE_PARAM_NAME];
if (-1 === name.indexOf(".")) {
params[_GPF_DEFINE_PARAM_NAME] = rootNamespace + name;
}
} | [
"function",
"_gpfProcessDefineParamCheckIfRelativeName",
"(",
"rootNamespace",
",",
"params",
")",
"{",
"var",
"name",
"=",
"params",
"[",
"_GPF_DEFINE_PARAM_NAME",
"]",
";",
"if",
"(",
"-",
"1",
"===",
"name",
".",
"indexOf",
"(",
"\".\"",
")",
")",
"{",
"p... | Check if the name is relative, if so concatenate to the rootNamespace | [
"Check",
"if",
"the",
"name",
"is",
"relative",
"if",
"so",
"concatenate",
"to",
"the",
"rootNamespace"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/params.js#L26-L31 | train |
ArnaudBuchholz/gpf-js | lost+found/src/define_/params.js | _gpfProcessDefineParamResolveBase | function _gpfProcessDefineParamResolveBase (params) {
var Super = params[_GPF_DEFINE_PARAM_SUPER];
if (!(Super instanceof Function)) {
params[_GPF_DEFINE_PARAM_SUPER] = _gpfContext(Super.toString().split("."));
}
} | javascript | function _gpfProcessDefineParamResolveBase (params) {
var Super = params[_GPF_DEFINE_PARAM_SUPER];
if (!(Super instanceof Function)) {
params[_GPF_DEFINE_PARAM_SUPER] = _gpfContext(Super.toString().split("."));
}
} | [
"function",
"_gpfProcessDefineParamResolveBase",
"(",
"params",
")",
"{",
"var",
"Super",
"=",
"params",
"[",
"_GPF_DEFINE_PARAM_SUPER",
"]",
";",
"if",
"(",
"!",
"(",
"Super",
"instanceof",
"Function",
")",
")",
"{",
"params",
"[",
"_GPF_DEFINE_PARAM_SUPER",
"]... | Convert base parameter from string to contextual object | [
"Convert",
"base",
"parameter",
"from",
"string",
"to",
"contextual",
"object"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/params.js#L48-L53 | train |
ArnaudBuchholz/gpf-js | lost+found/src/define_/params.js | _gpfProcessDefineParamsCheck | function _gpfProcessDefineParamsCheck (params) {
_gpfAsserts({
"name is required (String)": "string" === typeof params[_GPF_DEFINE_PARAM_NAME],
"Super is required and must resolve to a Constructor": params[_GPF_DEFINE_PARAM_SUPER] instanceof Function,
"definition is required (Object)": "obje... | javascript | function _gpfProcessDefineParamsCheck (params) {
_gpfAsserts({
"name is required (String)": "string" === typeof params[_GPF_DEFINE_PARAM_NAME],
"Super is required and must resolve to a Constructor": params[_GPF_DEFINE_PARAM_SUPER] instanceof Function,
"definition is required (Object)": "obje... | [
"function",
"_gpfProcessDefineParamsCheck",
"(",
"params",
")",
"{",
"_gpfAsserts",
"(",
"{",
"\"name is required (String)\"",
":",
"\"string\"",
"===",
"typeof",
"params",
"[",
"_GPF_DEFINE_PARAM_NAME",
"]",
",",
"\"Super is required and must resolve to a Constructor\"",
":"... | Check that the parameters are correct | [
"Check",
"that",
"the",
"parameters",
"are",
"correct"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/params.js#L56-L62 | train |
ArnaudBuchholz/gpf-js | lost+found/src/define_/params.js | _gpfProcessDefineParams | function _gpfProcessDefineParams (rootNamespace, defaultSuper, params) {
_gpfProcessDefineParamNoSuperUsed(defaultSuper, params);
_gpfProcessDefineParamCheckIfRelativeName(rootNamespace, params);
_gpfProcessDefineParamDefaultSuper(defaultSuper, params);
_gpfProcessDefineParamDefaultDefinition(params);
... | javascript | function _gpfProcessDefineParams (rootNamespace, defaultSuper, params) {
_gpfProcessDefineParamNoSuperUsed(defaultSuper, params);
_gpfProcessDefineParamCheckIfRelativeName(rootNamespace, params);
_gpfProcessDefineParamDefaultSuper(defaultSuper, params);
_gpfProcessDefineParamDefaultDefinition(params);
... | [
"function",
"_gpfProcessDefineParams",
"(",
"rootNamespace",
",",
"defaultSuper",
",",
"params",
")",
"{",
"_gpfProcessDefineParamNoSuperUsed",
"(",
"defaultSuper",
",",
"params",
")",
";",
"_gpfProcessDefineParamCheckIfRelativeName",
"(",
"rootNamespace",
",",
"params",
... | Process define parameters to inject default values when needed
@param {String} rootNamespace
@param {Function|undefined|String} defaultSuper
@param {Array} params gpf.define parameters:
- {String} name New class contextual name
- {String} [base=undefined] base Base class contextual name
- {Object} [definition=undefine... | [
"Process",
"define",
"parameters",
"to",
"inject",
"default",
"values",
"when",
"needed"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/params.js#L74-L81 | train |
popeindustries/buddy | lib/resolver/resolve.js | find | function find(id, type, sourcedir, options) {
const { cache, fileExtensions, nativeModules } = options;
const pkgDetails = pkg.getDetails(sourcedir, options);
let filepath = isRelativeFilepath(id) ? path.join(sourcedir, id) : id;
filepath = alias.resolve(filepath, pkgDetails && pkgDetails.aliases);
if (filep... | javascript | function find(id, type, sourcedir, options) {
const { cache, fileExtensions, nativeModules } = options;
const pkgDetails = pkg.getDetails(sourcedir, options);
let filepath = isRelativeFilepath(id) ? path.join(sourcedir, id) : id;
filepath = alias.resolve(filepath, pkgDetails && pkgDetails.aliases);
if (filep... | [
"function",
"find",
"(",
"id",
",",
"type",
",",
"sourcedir",
",",
"options",
")",
"{",
"const",
"{",
"cache",
",",
"fileExtensions",
",",
"nativeModules",
"}",
"=",
"options",
";",
"const",
"pkgDetails",
"=",
"pkg",
".",
"getDetails",
"(",
"sourcedir",
... | Find filepath for 'id' in 'sourcedir' directory
@param {String} id
@param {String} type
@param {String} sourcedir
@param {Object} options
- {Boolean} browser
- {ResolverCache} cache
- {Object} fileExtensions
- {Array} nativeModules
- {Array} sources
@returns {String|Boolean} | [
"Find",
"filepath",
"for",
"id",
"in",
"sourcedir",
"directory"
] | c38afc2e6915743eb6cfcf5aba59a8699142c7a5 | https://github.com/popeindustries/buddy/blob/c38afc2e6915743eb6cfcf5aba59a8699142c7a5/lib/resolver/resolve.js#L53-L100 | train |
ArnaudBuchholz/gpf-js | src/web/tag.js | _gpfWebGetNamespace | function _gpfWebGetNamespace (prefix) {
var namespace = _gpfWebNamespacePrefix[prefix];
if (undefined === namespace) {
gpf.Error.unknownNamespacePrefix();
}
return namespace;
} | javascript | function _gpfWebGetNamespace (prefix) {
var namespace = _gpfWebNamespacePrefix[prefix];
if (undefined === namespace) {
gpf.Error.unknownNamespacePrefix();
}
return namespace;
} | [
"function",
"_gpfWebGetNamespace",
"(",
"prefix",
")",
"{",
"var",
"namespace",
"=",
"_gpfWebNamespacePrefix",
"[",
"prefix",
"]",
";",
"if",
"(",
"undefined",
"===",
"namespace",
")",
"{",
"gpf",
".",
"Error",
".",
"unknownNamespacePrefix",
"(",
")",
";",
"... | Retrieves namespace associated to the prefix or fail
@param {String} prefix Namespace prefix
@return {String} Namespace URI
@throws {gpf.Error.UnknownNamespacePrefix}
@since 0.2.2 | [
"Retrieves",
"namespace",
"associated",
"to",
"the",
"prefix",
"or",
"fail"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/web/tag.js#L146-L152 | train |
ArnaudBuchholz/gpf-js | src/web/tag.js | _gpfWebGetNamespaceAndName | function _gpfWebGetNamespaceAndName (name) {
var EXPECTED_PARTS_COUNT = 2,
NAMESPACE_PREFIX = 0,
NAME = 1,
parts = name.split(":");
if (parts.length === EXPECTED_PARTS_COUNT) {
return {
namespace: _gpfWebGetNamespace(parts[NAMESPACE_PREFIX]),
name: parts[N... | javascript | function _gpfWebGetNamespaceAndName (name) {
var EXPECTED_PARTS_COUNT = 2,
NAMESPACE_PREFIX = 0,
NAME = 1,
parts = name.split(":");
if (parts.length === EXPECTED_PARTS_COUNT) {
return {
namespace: _gpfWebGetNamespace(parts[NAMESPACE_PREFIX]),
name: parts[N... | [
"function",
"_gpfWebGetNamespaceAndName",
"(",
"name",
")",
"{",
"var",
"EXPECTED_PARTS_COUNT",
"=",
"2",
",",
"NAMESPACE_PREFIX",
"=",
"0",
",",
"NAME",
"=",
"1",
",",
"parts",
"=",
"name",
".",
"split",
"(",
"\":\"",
")",
";",
"if",
"(",
"parts",
".",
... | Resolves prefixed name to namespace and name
@param {String} name Attribute or node name
@return {{namespace, name}|undefined} Namespace and name in a structure if prefixed, undefined otherwise
@since 0.2.2 | [
"Resolves",
"prefixed",
"name",
"to",
"namespace",
"and",
"name"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/web/tag.js#L161-L172 | train |
ArnaudBuchholz/gpf-js | src/web/tag.js | _gpfWebTagFlattenChildren | function _gpfWebTagFlattenChildren (array, callback) {
array.forEach(function (item) {
if (_gpfIsArray(item)) {
_gpfWebTagFlattenChildren(item, callback);
} else {
callback(item);
}
});
} | javascript | function _gpfWebTagFlattenChildren (array, callback) {
array.forEach(function (item) {
if (_gpfIsArray(item)) {
_gpfWebTagFlattenChildren(item, callback);
} else {
callback(item);
}
});
} | [
"function",
"_gpfWebTagFlattenChildren",
"(",
"array",
",",
"callback",
")",
"{",
"array",
".",
"forEach",
"(",
"function",
"(",
"item",
")",
"{",
"if",
"(",
"_gpfIsArray",
"(",
"item",
")",
")",
"{",
"_gpfWebTagFlattenChildren",
"(",
"item",
",",
"callback"... | Apply the callback to each array item,
process recursively if the array item is an array
@param {Array} array array of items
@param {Function} callback Function to apply on each array item
@since 0.2.1 | [
"Apply",
"the",
"callback",
"to",
"each",
"array",
"item",
"process",
"recursively",
"if",
"the",
"array",
"item",
"is",
"an",
"array"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/web/tag.js#L206-L214 | train |
ArnaudBuchholz/gpf-js | src/web/tag.js | function () {
return Object.keys(this._attributes).map(function (name) {
_gpfWebCheckNamespaceSafe(name);
return " " + _gpfWebTagAttributeAlias(name)
+ "=\"" + _gpfStringEscapeForHtml(this._attributes[name]) + "\"";
}, this).join("");
} | javascript | function () {
return Object.keys(this._attributes).map(function (name) {
_gpfWebCheckNamespaceSafe(name);
return " " + _gpfWebTagAttributeAlias(name)
+ "=\"" + _gpfStringEscapeForHtml(this._attributes[name]) + "\"";
}, this).join("");
} | [
"function",
"(",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"this",
".",
"_attributes",
")",
".",
"map",
"(",
"function",
"(",
"name",
")",
"{",
"_gpfWebCheckNamespaceSafe",
"(",
"name",
")",
";",
"return",
"\" \"",
"+",
"_gpfWebTagAttributeAlias",
"(... | region toString implementation | [
"region",
"toString",
"implementation"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/web/tag.js#L256-L262 | train | |
ArnaudBuchholz/gpf-js | src/web/tag.js | function (node) {
var ownerDocument = node.ownerDocument,
qualified = _gpfWebGetNamespaceAndName(this._nodeName);
if (qualified) {
return ownerDocument.createElementNS(qualified.namespace, qualified.name);
}
return ownerDocument.createElement(this._nodeName);
... | javascript | function (node) {
var ownerDocument = node.ownerDocument,
qualified = _gpfWebGetNamespaceAndName(this._nodeName);
if (qualified) {
return ownerDocument.createElementNS(qualified.namespace, qualified.name);
}
return ownerDocument.createElement(this._nodeName);
... | [
"function",
"(",
"node",
")",
"{",
"var",
"ownerDocument",
"=",
"node",
".",
"ownerDocument",
",",
"qualified",
"=",
"_gpfWebGetNamespaceAndName",
"(",
"this",
".",
"_nodeName",
")",
";",
"if",
"(",
"qualified",
")",
"{",
"return",
"ownerDocument",
".",
"cre... | endregion region appendTo implementation | [
"endregion",
"region",
"appendTo",
"implementation"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/web/tag.js#L294-L301 | train | |
ArnaudBuchholz/gpf-js | src/web/tag.js | function (node) {
var element = this._createElement(node);
this._setAttributesTo(element);
this._appendChildrenTo(element);
return node.appendChild(element);
} | javascript | function (node) {
var element = this._createElement(node);
this._setAttributesTo(element);
this._appendChildrenTo(element);
return node.appendChild(element);
} | [
"function",
"(",
"node",
")",
"{",
"var",
"element",
"=",
"this",
".",
"_createElement",
"(",
"node",
")",
";",
"this",
".",
"_setAttributesTo",
"(",
"element",
")",
";",
"this",
".",
"_appendChildrenTo",
"(",
"element",
")",
";",
"return",
"node",
".",
... | Appends the tag to the provided node
@param {Object} node Expected to be a DOM node
@return {Object} Created node
@since 0.2.1 | [
"Appends",
"the",
"tag",
"to",
"the",
"provided",
"node"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/web/tag.js#L332-L337 | train | |
ArnaudBuchholz/gpf-js | src/web/tag.js | _gpfWebTagCreateFunction | function _gpfWebTagCreateFunction (nodeName) {
if (!nodeName) {
gpf.Error.missingNodeName();
}
return function (firstParam) {
var sliceFrom = 0,
attributes;
if (_gpfIsLiteralObject(firstParam)) {
attributes = firstParam;
++sliceFrom;
}
... | javascript | function _gpfWebTagCreateFunction (nodeName) {
if (!nodeName) {
gpf.Error.missingNodeName();
}
return function (firstParam) {
var sliceFrom = 0,
attributes;
if (_gpfIsLiteralObject(firstParam)) {
attributes = firstParam;
++sliceFrom;
}
... | [
"function",
"_gpfWebTagCreateFunction",
"(",
"nodeName",
")",
"{",
"if",
"(",
"!",
"nodeName",
")",
"{",
"gpf",
".",
"Error",
".",
"missingNodeName",
"(",
")",
";",
"}",
"return",
"function",
"(",
"firstParam",
")",
"{",
"var",
"sliceFrom",
"=",
"0",
","... | Create a tag generation function
@param {String} nodeName tag name.
May include the namespace prefix svg for [SVG elements](https://developer.mozilla.org/en-US/docs/Web/SVG)
@return {gpf.typedef.tagFunc} The tag generation function
@gpf:closure
@since 0.2.1 | [
"Create",
"a",
"tag",
"generation",
"function"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/web/tag.js#L352-L365 | train |
ArnaudBuchholz/gpf-js | lost+found/src/like.js | function (a, b) {
var done = this._done,
indexOfA,
comparedWith;
indexOfA = done.indexOf(a);
while (-1 < indexOfA) {
comparedWith = this._getPair(done, indexOfA);
if (comparedWith === b) {
return false; // Already compared
... | javascript | function (a, b) {
var done = this._done,
indexOfA,
comparedWith;
indexOfA = done.indexOf(a);
while (-1 < indexOfA) {
comparedWith = this._getPair(done, indexOfA);
if (comparedWith === b) {
return false; // Already compared
... | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"var",
"done",
"=",
"this",
".",
"_done",
",",
"indexOfA",
",",
"comparedWith",
";",
"indexOfA",
"=",
"done",
".",
"indexOf",
"(",
"a",
")",
";",
"while",
"(",
"-",
"1",
"<",
"indexOfA",
")",
"{",
"compar... | Check in the stack of done if parameters were never compared
@param {Object} a
@param {Object} b
@return {Boolean} | [
"Check",
"in",
"the",
"stack",
"of",
"done",
"if",
"parameters",
"were",
"never",
"compared"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/like.js#L54-L67 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/like.js | function (a, b) {
var pending;
if (this._neverCompared(a, b)) {
pending = this._pending;
pending.push(a);
pending.push(b);
}
} | javascript | function (a, b) {
var pending;
if (this._neverCompared(a, b)) {
pending = this._pending;
pending.push(a);
pending.push(b);
}
} | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"var",
"pending",
";",
"if",
"(",
"this",
".",
"_neverCompared",
"(",
"a",
",",
"b",
")",
")",
"{",
"pending",
"=",
"this",
".",
"_pending",
";",
"pending",
".",
"push",
"(",
"a",
")",
";",
"pending",
"... | If a was never compared with b, adds the pair to the pending list.
@param {Object} a
@param {Object} b | [
"If",
"a",
"was",
"never",
"compared",
"with",
"b",
"adds",
"the",
"pair",
"to",
"the",
"pending",
"list",
"."
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/like.js#L75-L82 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/like.js | function () {
var pending = this._pending,
done = this._done,
a,
b;
while (0 !== pending.length) {
b = pending.pop();
a = pending.pop();
done.push(a, b);
if (this._areDifferent(a, b)) {
return false;
... | javascript | function () {
var pending = this._pending,
done = this._done,
a,
b;
while (0 !== pending.length) {
b = pending.pop();
a = pending.pop();
done.push(a, b);
if (this._areDifferent(a, b)) {
return false;
... | [
"function",
"(",
")",
"{",
"var",
"pending",
"=",
"this",
".",
"_pending",
",",
"done",
"=",
"this",
".",
"_done",
",",
"a",
",",
"b",
";",
"while",
"(",
"0",
"!==",
"pending",
".",
"length",
")",
"{",
"b",
"=",
"pending",
".",
"pop",
"(",
")",... | Process the pending list
@return {Boolean} | [
"Process",
"the",
"pending",
"list"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/like.js#L105-L119 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/like.js | function (a, b) {
var me = this,
membersOfA = Object.keys(a);
// a members comparison with b
if (!membersOfA.every(function (member) {
return me.like(a[member], b[member]);
})) {
return true;
}
// Difference on members count?
re... | javascript | function (a, b) {
var me = this,
membersOfA = Object.keys(a);
// a members comparison with b
if (!membersOfA.every(function (member) {
return me.like(a[member], b[member]);
})) {
return true;
}
// Difference on members count?
re... | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"var",
"me",
"=",
"this",
",",
"membersOfA",
"=",
"Object",
".",
"keys",
"(",
"a",
")",
";",
"// a members comparison with b",
"if",
"(",
"!",
"membersOfA",
".",
"every",
"(",
"function",
"(",
"member",
")",
... | Check if members are different
@param {*} a
@param {*} b
@returns {Number} | [
"Check",
"if",
"members",
"are",
"different"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/like.js#L128-L139 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/like.js | function (a, b) {
if (null === a || null === b || "object" !== typeof a) {
return false; // Because we know that a !== b
}
this._stack(a, b);
return true;
} | javascript | function (a, b) {
if (null === a || null === b || "object" !== typeof a) {
return false; // Because we know that a !== b
}
this._stack(a, b);
return true;
} | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"null",
"===",
"a",
"||",
"null",
"===",
"b",
"||",
"\"object\"",
"!==",
"typeof",
"a",
")",
"{",
"return",
"false",
";",
"// Because we know that a !== b",
"}",
"this",
".",
"_stack",
"(",
"a",
",... | Check if objects are the same
@param {Object} a
@param {Object} b
@returns {boolean} | [
"Check",
"if",
"objects",
"are",
"the",
"same"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/like.js#L176-L182 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/like.js | function (a, b) {
if (a === b) {
return true;
}
if (typeof a !== typeof b) {
return this._alike(a, b);
}
return this._objectLike(a, b);
} | javascript | function (a, b) {
if (a === b) {
return true;
}
if (typeof a !== typeof b) {
return this._alike(a, b);
}
return this._objectLike(a, b);
} | [
"function",
"(",
"a",
",",
"b",
")",
"{",
"if",
"(",
"a",
"===",
"b",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"typeof",
"a",
"!==",
"typeof",
"b",
")",
"{",
"return",
"this",
".",
"_alike",
"(",
"a",
",",
"b",
")",
";",
"}",
"retur... | Internal version of gpf.like
@param {*} a
@param {*} b
@return {Boolean} | [
"Internal",
"version",
"of",
"gpf",
".",
"like"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/like.js#L191-L199 | train | |
ArnaudBuchholz/gpf-js | src/abstract.js | _gpfCreateAbstractFunction | function _gpfCreateAbstractFunction (numberOfParameters) {
return _gpfFunctionBuild({
parameters: _gpfBuildFunctionParameterList(numberOfParameters),
body: "_throw_();"
}, {
_throw_: gpf.Error.abstractMethod
});
} | javascript | function _gpfCreateAbstractFunction (numberOfParameters) {
return _gpfFunctionBuild({
parameters: _gpfBuildFunctionParameterList(numberOfParameters),
body: "_throw_();"
}, {
_throw_: gpf.Error.abstractMethod
});
} | [
"function",
"_gpfCreateAbstractFunction",
"(",
"numberOfParameters",
")",
"{",
"return",
"_gpfFunctionBuild",
"(",
"{",
"parameters",
":",
"_gpfBuildFunctionParameterList",
"(",
"numberOfParameters",
")",
",",
"body",
":",
"\"_throw_();\"",
"}",
",",
"{",
"_throw_",
"... | Build a function that throws the abstractMethod exception
@param {Number} numberOfParameters Defines the signature of the resulting function
@return {Function} Function that throws the abstractMethod exception
@since 0.1.8 | [
"Build",
"a",
"function",
"that",
"throws",
"the",
"abstractMethod",
"exception"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/abstract.js#L36-L43 | train |
ArnaudBuchholz/gpf-js | lost+found/src/dispatch.js | _gpfAddEventListener | function _gpfAddEventListener (event, eventsHandler) {
/*jshint validthis:true*/ // will be invoked as an object method
var listeners = _gpfAllocateEventDispatcherListeners(this);
if (undefined === listeners[event]) {
listeners[event] = [];
}
listeners[event].push(eventsHandler);
return ... | javascript | function _gpfAddEventListener (event, eventsHandler) {
/*jshint validthis:true*/ // will be invoked as an object method
var listeners = _gpfAllocateEventDispatcherListeners(this);
if (undefined === listeners[event]) {
listeners[event] = [];
}
listeners[event].push(eventsHandler);
return ... | [
"function",
"_gpfAddEventListener",
"(",
"event",
",",
"eventsHandler",
")",
"{",
"/*jshint validthis:true*/",
"// will be invoked as an object method",
"var",
"listeners",
"=",
"_gpfAllocateEventDispatcherListeners",
"(",
"this",
")",
";",
"if",
"(",
"undefined",
"===",
... | Add an event listener to the dispatcher
@param {String} event name
@param {gpf.events.Handler} eventsHandler
@gpf:chainable | [
"Add",
"an",
"event",
"listener",
"to",
"the",
"dispatcher"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/dispatch.js#L26-L34 | train |
ArnaudBuchholz/gpf-js | lost+found/src/dispatch.js | _gpfRemoveEventListener | function _gpfRemoveEventListener (event, eventsHandler) {
/*jshint validthis:true*/ // will be invoked as an object method
var listeners = this._eventDispatcherListeners,
eventListeners,
index;
if (listeners) {
eventListeners = listeners[event];
if (undefined !== eventListene... | javascript | function _gpfRemoveEventListener (event, eventsHandler) {
/*jshint validthis:true*/ // will be invoked as an object method
var listeners = this._eventDispatcherListeners,
eventListeners,
index;
if (listeners) {
eventListeners = listeners[event];
if (undefined !== eventListene... | [
"function",
"_gpfRemoveEventListener",
"(",
"event",
",",
"eventsHandler",
")",
"{",
"/*jshint validthis:true*/",
"// will be invoked as an object method",
"var",
"listeners",
"=",
"this",
".",
"_eventDispatcherListeners",
",",
"eventListeners",
",",
"index",
";",
"if",
"... | Remove an event listener from the dispatcher
@param {String} event name
@param {gpf.events.Handler} eventsHandler
@gpf:chainable | [
"Remove",
"an",
"event",
"listener",
"from",
"the",
"dispatcher"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/dispatch.js#L43-L58 | train |
ArnaudBuchholz/gpf-js | lost+found/src/dispatch.js | _gpfTriggerListeners | function _gpfTriggerListeners (eventObj, eventListeners) {
var index,
length = eventListeners.length;
for (index = 0; index < length; ++index) {
_gpfEventsFire.call(eventObj.scope, eventObj, {}, eventListeners[index]);
}
} | javascript | function _gpfTriggerListeners (eventObj, eventListeners) {
var index,
length = eventListeners.length;
for (index = 0; index < length; ++index) {
_gpfEventsFire.call(eventObj.scope, eventObj, {}, eventListeners[index]);
}
} | [
"function",
"_gpfTriggerListeners",
"(",
"eventObj",
",",
"eventListeners",
")",
"{",
"var",
"index",
",",
"length",
"=",
"eventListeners",
".",
"length",
";",
"for",
"(",
"index",
"=",
"0",
";",
"index",
"<",
"length",
";",
"++",
"index",
")",
"{",
"_gp... | Execute the listeners
@param {gpf.events.Event} eventObj
@param {gpf.events.Handler[]} eventListeners | [
"Execute",
"the",
"listeners"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/dispatch.js#L66-L72 | train |
ArnaudBuchholz/gpf-js | lost+found/src/dispatch.js | _gpfDispatchEvent | function _gpfDispatchEvent (event, params) {
/*jshint validthis:true*/ // will be invoked as an object method
var listeners = this._eventDispatcherListeners,
eventObj,
type,
eventListeners;
if (!listeners) {
return this; // No listeners at all
}
if (event instanceof _... | javascript | function _gpfDispatchEvent (event, params) {
/*jshint validthis:true*/ // will be invoked as an object method
var listeners = this._eventDispatcherListeners,
eventObj,
type,
eventListeners;
if (!listeners) {
return this; // No listeners at all
}
if (event instanceof _... | [
"function",
"_gpfDispatchEvent",
"(",
"event",
",",
"params",
")",
"{",
"/*jshint validthis:true*/",
"// will be invoked as an object method",
"var",
"listeners",
"=",
"this",
".",
"_eventDispatcherListeners",
",",
"eventObj",
",",
"type",
",",
"eventListeners",
";",
"i... | Broadcast the event
@param {String|gpf.events.Event} event name or object
@param {Object} [params={}] event parameters
@return {gpf.events.Event} | [
"Broadcast",
"the",
"event"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/dispatch.js#L81-L105 | train |
ArnaudBuchholz/gpf-js | make/ast.js | function (src) {
// https://github.com/Constellation/escodegen/issues/85
let ast = esprima.parse(src, {
range: true,
tokens: true,
comment: true
});
ast = escodegen.attachComments(ast, ast.comments, ast.tokens);
delete ast.tokens;
delet... | javascript | function (src) {
// https://github.com/Constellation/escodegen/issues/85
let ast = esprima.parse(src, {
range: true,
tokens: true,
comment: true
});
ast = escodegen.attachComments(ast, ast.comments, ast.tokens);
delete ast.tokens;
delet... | [
"function",
"(",
"src",
")",
"{",
"// https://github.com/Constellation/escodegen/issues/85",
"let",
"ast",
"=",
"esprima",
".",
"parse",
"(",
"src",
",",
"{",
"range",
":",
"true",
",",
"tokens",
":",
"true",
",",
"comment",
":",
"true",
"}",
")",
";",
"as... | Transform the source into an AST representation | [
"Transform",
"the",
"source",
"into",
"an",
"AST",
"representation"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/make/ast.js#L284-L295 | train | |
ArnaudBuchholz/gpf-js | make/ast.js | function (ast, setting, debug) {
let optimizer = new Optimizer(ast, setting, debug);
optimizer.analyze();
optimizer.optimize();
return ast;
} | javascript | function (ast, setting, debug) {
let optimizer = new Optimizer(ast, setting, debug);
optimizer.analyze();
optimizer.optimize();
return ast;
} | [
"function",
"(",
"ast",
",",
"setting",
",",
"debug",
")",
"{",
"let",
"optimizer",
"=",
"new",
"Optimizer",
"(",
"ast",
",",
"setting",
",",
"debug",
")",
";",
"optimizer",
".",
"analyze",
"(",
")",
";",
"optimizer",
".",
"optimize",
"(",
")",
";",
... | Detect & apply optimization patterns | [
"Detect",
"&",
"apply",
"optimization",
"patterns"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/make/ast.js#L298-L303 | train | |
makeup-js/makeup-expander | index.js | _onKeyDown | function _onKeyDown(e) {
var keyCode = e.keyCode;
if (keyCode === 13 || keyCode === 32) {
this.keyDownFlag = true; // if host element does not naturally trigger a click event on spacebar, we can force one to trigger here.
// careful! if host already triggers click events naturally, we end up with a "double... | javascript | function _onKeyDown(e) {
var keyCode = e.keyCode;
if (keyCode === 13 || keyCode === 32) {
this.keyDownFlag = true; // if host element does not naturally trigger a click event on spacebar, we can force one to trigger here.
// careful! if host already triggers click events naturally, we end up with a "double... | [
"function",
"_onKeyDown",
"(",
"e",
")",
"{",
"var",
"keyCode",
"=",
"e",
".",
"keyCode",
";",
"if",
"(",
"keyCode",
"===",
"13",
"||",
"keyCode",
"===",
"32",
")",
"{",
"this",
".",
"keyDownFlag",
"=",
"true",
";",
"// if host element does not naturally t... | when options.expandOnClick is true, we set a flag if spacebar or enter are pressed the idea being that this flag is set BEFORE the click event | [
"when",
"options",
".",
"expandOnClick",
"is",
"true",
"we",
"set",
"a",
"flag",
"if",
"spacebar",
"or",
"enter",
"are",
"pressed",
"the",
"idea",
"being",
"that",
"this",
"flag",
"is",
"set",
"BEFORE",
"the",
"click",
"event"
] | 9274abb14e4fd051ddcc609dbc9fe9ac6605631c | https://github.com/makeup-js/makeup-expander/blob/9274abb14e4fd051ddcc609dbc9fe9ac6605631c/index.js#L35-L46 | train |
popeindustries/buddy | lib/utils/string.js | commentStrip | function commentStrip(string) {
// Remove commented lines
string = string.replace(RE_COMMENT_SINGLE_LINE, '');
string = string.replace(RE_COMMENT_MULTI_LINES, '');
return string;
} | javascript | function commentStrip(string) {
// Remove commented lines
string = string.replace(RE_COMMENT_SINGLE_LINE, '');
string = string.replace(RE_COMMENT_MULTI_LINES, '');
return string;
} | [
"function",
"commentStrip",
"(",
"string",
")",
"{",
"// Remove commented lines",
"string",
"=",
"string",
".",
"replace",
"(",
"RE_COMMENT_SINGLE_LINE",
",",
"''",
")",
";",
"string",
"=",
"string",
".",
"replace",
"(",
"RE_COMMENT_MULTI_LINES",
",",
"''",
")",... | Strip comments from 'string'
@param {String} string
@returns {String} | [
"Strip",
"comments",
"from",
"string"
] | c38afc2e6915743eb6cfcf5aba59a8699142c7a5 | https://github.com/popeindustries/buddy/blob/c38afc2e6915743eb6cfcf5aba59a8699142c7a5/lib/utils/string.js#L31-L36 | train |
popeindustries/buddy | lib/utils/string.js | commentWrap | function commentWrap(string, type) {
let open, close;
if (type == 'html') {
open = '<!-- ';
close = ' -->';
} else {
open = '/* ';
close = ' */';
}
return open + string + close;
} | javascript | function commentWrap(string, type) {
let open, close;
if (type == 'html') {
open = '<!-- ';
close = ' -->';
} else {
open = '/* ';
close = ' */';
}
return open + string + close;
} | [
"function",
"commentWrap",
"(",
"string",
",",
"type",
")",
"{",
"let",
"open",
",",
"close",
";",
"if",
"(",
"type",
"==",
"'html'",
")",
"{",
"open",
"=",
"'<!-- '",
";",
"close",
"=",
"' -->'",
";",
"}",
"else",
"{",
"open",
"=",
"'/* '",
";",
... | Wrap 'string' in comment based on 'type'
@param {String} string
@param {String} type
@returns {String} | [
"Wrap",
"string",
"in",
"comment",
"based",
"on",
"type"
] | c38afc2e6915743eb6cfcf5aba59a8699142c7a5 | https://github.com/popeindustries/buddy/blob/c38afc2e6915743eb6cfcf5aba59a8699142c7a5/lib/utils/string.js#L53-L65 | train |
popeindustries/buddy | lib/utils/string.js | indent | function indent(string, column) {
const spaces = new Array(++column).join(COLUMN);
return string.replace(RE_LINE_BEGIN, spaces);
} | javascript | function indent(string, column) {
const spaces = new Array(++column).join(COLUMN);
return string.replace(RE_LINE_BEGIN, spaces);
} | [
"function",
"indent",
"(",
"string",
",",
"column",
")",
"{",
"const",
"spaces",
"=",
"new",
"Array",
"(",
"++",
"column",
")",
".",
"join",
"(",
"COLUMN",
")",
";",
"return",
"string",
".",
"replace",
"(",
"RE_LINE_BEGIN",
",",
"spaces",
")",
";",
"... | Indent the given 'string' a specific number of columns
@param {String} string
@param {Int} column
@returns {String} | [
"Indent",
"the",
"given",
"string",
"a",
"specific",
"number",
"of",
"columns"
] | c38afc2e6915743eb6cfcf5aba59a8699142c7a5 | https://github.com/popeindustries/buddy/blob/c38afc2e6915743eb6cfcf5aba59a8699142c7a5/lib/utils/string.js#L73-L77 | train |
popeindustries/buddy | lib/utils/string.js | uniqueMatch | function uniqueMatch(string, regexp) {
const results = [];
let match;
while ((match = regexp.exec(string))) {
results.push({
context: match[0],
match: match[1] || ''
});
}
// Filter duplicates
return unique(results, isEqual);
} | javascript | function uniqueMatch(string, regexp) {
const results = [];
let match;
while ((match = regexp.exec(string))) {
results.push({
context: match[0],
match: match[1] || ''
});
}
// Filter duplicates
return unique(results, isEqual);
} | [
"function",
"uniqueMatch",
"(",
"string",
",",
"regexp",
")",
"{",
"const",
"results",
"=",
"[",
"]",
";",
"let",
"match",
";",
"while",
"(",
"(",
"match",
"=",
"regexp",
".",
"exec",
"(",
"string",
")",
")",
")",
"{",
"results",
".",
"push",
"(",
... | Match unique occurrences in 'string'
@param {String} string
@param {RegExp} regexp
@returns {Array} | [
"Match",
"unique",
"occurrences",
"in",
"string"
] | c38afc2e6915743eb6cfcf5aba59a8699142c7a5 | https://github.com/popeindustries/buddy/blob/c38afc2e6915743eb6cfcf5aba59a8699142c7a5/lib/utils/string.js#L85-L98 | train |
ArnaudBuchholz/gpf-js | src/host/java.js | _gpfHostJava | function _gpfHostJava () {
_gpfDosPath = String(java.lang.System.getProperty("file.separator")) === "\\";
// Define console APIs
_gpfMainContext.console = _gpfConsoleGenerate(print);
/* istanbul ignore next */ // exit.1
_gpfExit = function (code) {
java.lang.System.exit(code);
};
} | javascript | function _gpfHostJava () {
_gpfDosPath = String(java.lang.System.getProperty("file.separator")) === "\\";
// Define console APIs
_gpfMainContext.console = _gpfConsoleGenerate(print);
/* istanbul ignore next */ // exit.1
_gpfExit = function (code) {
java.lang.System.exit(code);
};
} | [
"function",
"_gpfHostJava",
"(",
")",
"{",
"_gpfDosPath",
"=",
"String",
"(",
"java",
".",
"lang",
".",
"System",
".",
"getProperty",
"(",
"\"file.separator\"",
")",
")",
"===",
"\"\\\\\"",
";",
"// Define console APIs",
"_gpfMainContext",
".",
"console",
"=",
... | Common implementation for Java hosts
@since 0.2.4 | [
"Common",
"implementation",
"for",
"Java",
"hosts"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/host/java.js#L28-L40 | train |
ArnaudBuchholz/gpf-js | lost+found/src/xnode.js | function (name) {
var result, member, mappedName;
if (null === this._attributes) {
this._members();
}
if (undefined === name) {
result = {};
for (member in this._attributes) {
if (this._attributes.hasOwnP... | javascript | function (name) {
var result, member, mappedName;
if (null === this._attributes) {
this._members();
}
if (undefined === name) {
result = {};
for (member in this._attributes) {
if (this._attributes.hasOwnP... | [
"function",
"(",
"name",
")",
"{",
"var",
"result",
",",
"member",
",",
"mappedName",
";",
"if",
"(",
"null",
"===",
"this",
".",
"_attributes",
")",
"{",
"this",
".",
"_members",
"(",
")",
";",
"}",
"if",
"(",
"undefined",
"===",
"name",
")",
"{",... | region gpf.interfaces.IXmlConstNode
@implements gpf.interfaces.IXmlConstNode:attributes | [
"region",
"gpf",
".",
"interfaces",
".",
"IXmlConstNode"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/xnode.js#L232-L255 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/xnode.js | _nodeToXml | function _nodeToXml (node, wrapped) {
var
name = node.localName(),
attributes = node.attributes(),
children = node.children(),
text = node.textContent(),
idx;
wrapped.startElement({
uri: "",
localName: name,
... | javascript | function _nodeToXml (node, wrapped) {
var
name = node.localName(),
attributes = node.attributes(),
children = node.children(),
text = node.textContent(),
idx;
wrapped.startElement({
uri: "",
localName: name,
... | [
"function",
"_nodeToXml",
"(",
"node",
",",
"wrapped",
")",
"{",
"var",
"name",
"=",
"node",
".",
"localName",
"(",
")",
",",
"attributes",
"=",
"node",
".",
"attributes",
"(",
")",
",",
"children",
"=",
"node",
".",
"children",
"(",
")",
",",
"text"... | Serialize the node into an gpf.interfaces.IXmlContentHandler
@param {gpf.interfaces.IXmlConstNode} node Node to serialize
@param {gpf.interfaces.wrap(IXmlContentHandler)} wrapped XML Content | [
"Serialize",
"the",
"node",
"into",
"an",
"gpf",
".",
"interfaces",
".",
"IXmlContentHandler"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/xnode.js#L405-L426 | train |
ArnaudBuchholz/gpf-js | src/define/detect.js | _gpfDefineBuildTypedEntity | function _gpfDefineBuildTypedEntity (definition) {
var EntityBuilder = _gpfDefineRead$TypedProperties(definition),
entityDefinition;
if (!EntityBuilder) {
EntityBuilder = _gpfDefineCheck$TypeProperty(definition);
}
entityDefinition = new EntityBuilder(definition);
entityDefinition.ch... | javascript | function _gpfDefineBuildTypedEntity (definition) {
var EntityBuilder = _gpfDefineRead$TypedProperties(definition),
entityDefinition;
if (!EntityBuilder) {
EntityBuilder = _gpfDefineCheck$TypeProperty(definition);
}
entityDefinition = new EntityBuilder(definition);
entityDefinition.ch... | [
"function",
"_gpfDefineBuildTypedEntity",
"(",
"definition",
")",
"{",
"var",
"EntityBuilder",
"=",
"_gpfDefineRead$TypedProperties",
"(",
"definition",
")",
",",
"entityDefinition",
";",
"if",
"(",
"!",
"EntityBuilder",
")",
"{",
"EntityBuilder",
"=",
"_gpfDefineChec... | Factory to create the correct entity type
@param {Object} definition Entity definition literal object
@return {_GpfEntityDefinition} Entity definition instance
@throws {gpf.Error.InvalidEntityType}
@since 0.1.6 | [
"Factory",
"to",
"create",
"the",
"correct",
"entity",
"type"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/define/detect.js#L78-L87 | train |
ArnaudBuchholz/gpf-js | res/sources/array.js | function (callback, thisArg) {
var me = this;
this._sources.forEach(function (source, index) {
callback(me._update(source), index);
}, thisArg);
} | javascript | function (callback, thisArg) {
var me = this;
this._sources.forEach(function (source, index) {
callback(me._update(source), index);
}, thisArg);
} | [
"function",
"(",
"callback",
",",
"thisArg",
")",
"{",
"var",
"me",
"=",
"this",
";",
"this",
".",
"_sources",
".",
"forEach",
"(",
"function",
"(",
"source",
",",
"index",
")",
"{",
"callback",
"(",
"me",
".",
"_update",
"(",
"source",
")",
",",
"... | Enumerate all sources
@param {Function} callback Called on each source
@param {*} thisArg This context | [
"Enumerate",
"all",
"sources"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/res/sources/array.js#L56-L61 | train | |
ArnaudBuchholz/gpf-js | res/sources/array.js | function (name) {
var result;
this._sources.every(function (source) {
if (source.getName() === name) {
result = this._update(source);
return false;
}
return true;
}, this);
return resu... | javascript | function (name) {
var result;
this._sources.every(function (source) {
if (source.getName() === name) {
result = this._update(source);
return false;
}
return true;
}, this);
return resu... | [
"function",
"(",
"name",
")",
"{",
"var",
"result",
";",
"this",
".",
"_sources",
".",
"every",
"(",
"function",
"(",
"source",
")",
"{",
"if",
"(",
"source",
".",
"getName",
"(",
")",
"===",
"name",
")",
"{",
"result",
"=",
"this",
".",
"_update",... | Get the source by name
@param {String} name Name of the source name to retreive
@return {Source|undefined} Source which name matches the parameter | [
"Get",
"the",
"source",
"by",
"name"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/res/sources/array.js#L69-L79 | train | |
ArnaudBuchholz/gpf-js | res/sources/array.js | function (name) {
var dependencies = this.byName(name).getDependencies(),
names = this.getNames(),
minIndex = 1; // 0 being boot
dependencies.forEach(function (dependencyName) {
var index = names.indexOf(dependencyName);
++index;
... | javascript | function (name) {
var dependencies = this.byName(name).getDependencies(),
names = this.getNames(),
minIndex = 1; // 0 being boot
dependencies.forEach(function (dependencyName) {
var index = names.indexOf(dependencyName);
++index;
... | [
"function",
"(",
"name",
")",
"{",
"var",
"dependencies",
"=",
"this",
".",
"byName",
"(",
"name",
")",
".",
"getDependencies",
"(",
")",
",",
"names",
"=",
"this",
".",
"getNames",
"(",
")",
",",
"minIndex",
"=",
"1",
";",
"// 0 being boot",
"dependen... | Based on its dependencies, compute the minimum index of the module.
@param {String} name Source Name
@return {Number} Source index before which the source can't be moved | [
"Based",
"on",
"its",
"dependencies",
"compute",
"the",
"minimum",
"index",
"of",
"the",
"module",
"."
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/res/sources/array.js#L108-L120 | train | |
ArnaudBuchholz/gpf-js | res/sources/array.js | function (sourceName, referenceSourceName) {
var sourceToMove,
sourcePos,
referenceSourcePos;
if (!this._sources.every(function (source, index) {
var name = source.getName();
if (name === sourceName) {
sourceToMo... | javascript | function (sourceName, referenceSourceName) {
var sourceToMove,
sourcePos,
referenceSourcePos;
if (!this._sources.every(function (source, index) {
var name = source.getName();
if (name === sourceName) {
sourceToMo... | [
"function",
"(",
"sourceName",
",",
"referenceSourceName",
")",
"{",
"var",
"sourceToMove",
",",
"sourcePos",
",",
"referenceSourcePos",
";",
"if",
"(",
"!",
"this",
".",
"_sources",
".",
"every",
"(",
"function",
"(",
"source",
",",
"index",
")",
"{",
"va... | Moves source after the referenced one
@param {String} sourceName Name of the source to move
@param {String} referenceSourceName Name of the source to be used as a position reference | [
"Moves",
"source",
"after",
"the",
"referenced",
"one"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/res/sources/array.js#L150-L173 | train | |
ArnaudBuchholz/gpf-js | res/sources/array.js | function (checkDictionary) {
this._checkDictionary = checkDictionary;
var newSources = Object.keys(checkDictionary)
.filter(function (name) {
return checkDictionary[name] === "new";
})
.map(function (name) {
... | javascript | function (checkDictionary) {
this._checkDictionary = checkDictionary;
var newSources = Object.keys(checkDictionary)
.filter(function (name) {
return checkDictionary[name] === "new";
})
.map(function (name) {
... | [
"function",
"(",
"checkDictionary",
")",
"{",
"this",
".",
"_checkDictionary",
"=",
"checkDictionary",
";",
"var",
"newSources",
"=",
"Object",
".",
"keys",
"(",
"checkDictionary",
")",
".",
"filter",
"(",
"function",
"(",
"name",
")",
"{",
"return",
"checkD... | Provide information about sources
@param {Object} checkDictionary Result of the check mechanism | [
"Provide",
"information",
"about",
"sources"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/res/sources/array.js#L192-L208 | train | |
azerion/log4js-logstash | index.js | logstashLayout | function logstashLayout(logEvt, fields) {
var messageData = logEvt.data[0],
log = {
'@timestamp': (new Date()).toISOString(),
'@fields': {
category: logEvt.categoryName,
level: logEvt.level.levelStr
},
'@message' : (toType(mess... | javascript | function logstashLayout(logEvt, fields) {
var messageData = logEvt.data[0],
log = {
'@timestamp': (new Date()).toISOString(),
'@fields': {
category: logEvt.categoryName,
level: logEvt.level.levelStr
},
'@message' : (toType(mess... | [
"function",
"logstashLayout",
"(",
"logEvt",
",",
"fields",
")",
"{",
"var",
"messageData",
"=",
"logEvt",
".",
"data",
"[",
"0",
"]",
",",
"log",
"=",
"{",
"'@timestamp'",
":",
"(",
"new",
"Date",
"(",
")",
")",
".",
"toISOString",
"(",
")",
",",
... | Simple layout parser for logstash message.
If message type is not string, parser will convert message into string using JSON.stringify.
@param logEvt, fields
@returns {{@timestamp: string, @fields: {category: (categoryName|*), level: (levelStr|*)}}} | [
"Simple",
"layout",
"parser",
"for",
"logstash",
"message",
".",
"If",
"message",
"type",
"is",
"not",
"string",
"parser",
"will",
"convert",
"message",
"into",
"string",
"using",
"JSON",
".",
"stringify",
"."
] | 996e098337c334994d23fb62d0f5ef865fb03861 | https://github.com/azerion/log4js-logstash/blob/996e098337c334994d23fb62d0f5ef865fb03861/index.js#L17-L35 | train |
azerion/log4js-logstash | index.js | logStashAppender | function logStashAppender(config, fields, layout) {
var time = process.hrtime(),
messages = [],
timeOutId = 0;
layout = layout || logstashLayout;
//Setup the connection to logstash
function pushToStash(config, msg) {
var client = net.connect({host: config.host, port: config.por... | javascript | function logStashAppender(config, fields, layout) {
var time = process.hrtime(),
messages = [],
timeOutId = 0;
layout = layout || logstashLayout;
//Setup the connection to logstash
function pushToStash(config, msg) {
var client = net.connect({host: config.host, port: config.por... | [
"function",
"logStashAppender",
"(",
"config",
",",
"fields",
",",
"layout",
")",
"{",
"var",
"time",
"=",
"process",
".",
"hrtime",
"(",
")",
",",
"messages",
"=",
"[",
"]",
",",
"timeOutId",
"=",
"0",
";",
"layout",
"=",
"layout",
"||",
"logstashLayo... | The appender, Gives us the function used for log4js.
It Supports batching of commands, we use the json_lines codec for this library,
so the \n are mandatory
@param config
@param fields
@param layout
@returns {Function} | [
"The",
"appender",
"Gives",
"us",
"the",
"function",
"used",
"for",
"log4js",
".",
"It",
"Supports",
"batching",
"of",
"commands",
"we",
"use",
"the",
"json_lines",
"codec",
"for",
"this",
"library",
"so",
"the",
"\\",
"n",
"are",
"mandatory"
] | 996e098337c334994d23fb62d0f5ef865fb03861 | https://github.com/azerion/log4js-logstash/blob/996e098337c334994d23fb62d0f5ef865fb03861/index.js#L47-L90 | train |
azerion/log4js-logstash | index.js | pushToStash | function pushToStash(config, msg) {
var client = net.connect({host: config.host, port: config.port}, function () {
client.write(msg);
client.end();
});
//Fail silently
client.on('error', function (evt) {
if (true === config.debug) {
con... | javascript | function pushToStash(config, msg) {
var client = net.connect({host: config.host, port: config.port}, function () {
client.write(msg);
client.end();
});
//Fail silently
client.on('error', function (evt) {
if (true === config.debug) {
con... | [
"function",
"pushToStash",
"(",
"config",
",",
"msg",
")",
"{",
"var",
"client",
"=",
"net",
".",
"connect",
"(",
"{",
"host",
":",
"config",
".",
"host",
",",
"port",
":",
"config",
".",
"port",
"}",
",",
"function",
"(",
")",
"{",
"client",
".",
... | Setup the connection to logstash | [
"Setup",
"the",
"connection",
"to",
"logstash"
] | 996e098337c334994d23fb62d0f5ef865fb03861 | https://github.com/azerion/log4js-logstash/blob/996e098337c334994d23fb62d0f5ef865fb03861/index.js#L55-L66 | train |
azerion/log4js-logstash | index.js | configure | function configure(config) {
var key,
layout = null,
fields = {},
options = {
port: (typeof config.port === "number") ? config.port : 5959,
host: (typeof config.host === "string") ? config.host : 'localhost',
debug: config.debug || false
};
if... | javascript | function configure(config) {
var key,
layout = null,
fields = {},
options = {
port: (typeof config.port === "number") ? config.port : 5959,
host: (typeof config.host === "string") ? config.host : 'localhost',
debug: config.debug || false
};
if... | [
"function",
"configure",
"(",
"config",
")",
"{",
"var",
"key",
",",
"layout",
"=",
"null",
",",
"fields",
"=",
"{",
"}",
",",
"options",
"=",
"{",
"port",
":",
"(",
"typeof",
"config",
".",
"port",
"===",
"\"number\"",
")",
"?",
"config",
".",
"po... | Config method, calls logStashAppender to return the logging function
@param config
@returns {Function} | [
"Config",
"method",
"calls",
"logStashAppender",
"to",
"return",
"the",
"logging",
"function"
] | 996e098337c334994d23fb62d0f5ef865fb03861 | https://github.com/azerion/log4js-logstash/blob/996e098337c334994d23fb62d0f5ef865fb03861/index.js#L98-L122 | train |
ArnaudBuchholz/gpf-js | src/http/helpers.js | _gpfHttpParseHeaders | function _gpfHttpParseHeaders (headers) {
var result = {};
_gpfArrayForEach(_gpfRegExpForEach(_gpfHttpHeadersParserRE, headers), function (match) {
result[match[_GPF_HTTP_HELPERS_HEADER_NAME]] = match[_GPF_HTTP_HELPERS_HEADER_VALUE];
});
return result;
} | javascript | function _gpfHttpParseHeaders (headers) {
var result = {};
_gpfArrayForEach(_gpfRegExpForEach(_gpfHttpHeadersParserRE, headers), function (match) {
result[match[_GPF_HTTP_HELPERS_HEADER_NAME]] = match[_GPF_HTTP_HELPERS_HEADER_VALUE];
});
return result;
} | [
"function",
"_gpfHttpParseHeaders",
"(",
"headers",
")",
"{",
"var",
"result",
"=",
"{",
"}",
";",
"_gpfArrayForEach",
"(",
"_gpfRegExpForEach",
"(",
"_gpfHttpHeadersParserRE",
",",
"headers",
")",
",",
"function",
"(",
"match",
")",
"{",
"result",
"[",
"match... | Parse HTTP response headers
@param {String} headers Response headers
@return {Object} headers dictionary
@since 0.2.1 | [
"Parse",
"HTTP",
"response",
"headers"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/http/helpers.js#L47-L53 | train |
ArnaudBuchholz/gpf-js | src/http/helpers.js | _gpfHttpGenSetHeaders | function _gpfHttpGenSetHeaders (methodName) {
return function (httpObj, headers) {
if (headers) {
Object.keys(headers).forEach(function (headerName) {
httpObj[methodName](headerName, headers[headerName]);
});
}
};
} | javascript | function _gpfHttpGenSetHeaders (methodName) {
return function (httpObj, headers) {
if (headers) {
Object.keys(headers).forEach(function (headerName) {
httpObj[methodName](headerName, headers[headerName]);
});
}
};
} | [
"function",
"_gpfHttpGenSetHeaders",
"(",
"methodName",
")",
"{",
"return",
"function",
"(",
"httpObj",
",",
"headers",
")",
"{",
"if",
"(",
"headers",
")",
"{",
"Object",
".",
"keys",
"(",
"headers",
")",
".",
"forEach",
"(",
"function",
"(",
"headerName"... | Generates a function that transmit headers to the http object
@param {String} methodName Name of the method to call
@return {Function} Method to set the headers
@gpf:closure
@since 0.2.1 | [
"Generates",
"a",
"function",
"that",
"transmit",
"headers",
"to",
"the",
"http",
"object"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/http/helpers.js#L63-L71 | train |
ArnaudBuchholz/gpf-js | src/http/helpers.js | _gpfHttpGenSend | function _gpfHttpGenSend (methodName) {
return function (httpObj, data) {
if (data) {
httpObj[methodName](data);
} else {
httpObj[methodName]();
}
};
} | javascript | function _gpfHttpGenSend (methodName) {
return function (httpObj, data) {
if (data) {
httpObj[methodName](data);
} else {
httpObj[methodName]();
}
};
} | [
"function",
"_gpfHttpGenSend",
"(",
"methodName",
")",
"{",
"return",
"function",
"(",
"httpObj",
",",
"data",
")",
"{",
"if",
"(",
"data",
")",
"{",
"httpObj",
"[",
"methodName",
"]",
"(",
"data",
")",
";",
"}",
"else",
"{",
"httpObj",
"[",
"methodNam... | Generates a function that implements the http send logic
@param {String} methodName Name of the method to call
@return {Function} Method to trigger the send
@gpf:closure
@since 0.2.1 | [
"Generates",
"a",
"function",
"that",
"implements",
"the",
"http",
"send",
"logic"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/http/helpers.js#L81-L89 | train |
popeindustries/buddy | lib/utils/sourceMap.js | create | function create(content, url) {
url = url || '<source>';
const map = new SourceMapGenerator({ file: url });
const lines = content.split('\n');
for (let l = 1, n = lines.length; l <= n; l++) {
// Skip empty
if (lines[l - 1]) {
map.addMapping({
source: url,
original: { line: l, colu... | javascript | function create(content, url) {
url = url || '<source>';
const map = new SourceMapGenerator({ file: url });
const lines = content.split('\n');
for (let l = 1, n = lines.length; l <= n; l++) {
// Skip empty
if (lines[l - 1]) {
map.addMapping({
source: url,
original: { line: l, colu... | [
"function",
"create",
"(",
"content",
",",
"url",
")",
"{",
"url",
"=",
"url",
"||",
"'<source>'",
";",
"const",
"map",
"=",
"new",
"SourceMapGenerator",
"(",
"{",
"file",
":",
"url",
"}",
")",
";",
"const",
"lines",
"=",
"content",
".",
"split",
"("... | Create source map from 'content'
@param {String} content
@param {String} [url]
@returns {SourceMapGenerator} | [
"Create",
"source",
"map",
"from",
"content"
] | c38afc2e6915743eb6cfcf5aba59a8699142c7a5 | https://github.com/popeindustries/buddy/blob/c38afc2e6915743eb6cfcf5aba59a8699142c7a5/lib/utils/sourceMap.js#L20-L38 | train |
popeindustries/buddy | lib/utils/sourceMap.js | createFromMap | function createFromMap(mapObject, content, url) {
url = url || '<source>';
if ('string' == typeof mapObject) {
try {
mapObject = JSON.parse(mapObject);
} catch (err) {
mapObject = {
version: 3,
names: [],
mappings: '',
file: ''
};
}
}
if (emptySource... | javascript | function createFromMap(mapObject, content, url) {
url = url || '<source>';
if ('string' == typeof mapObject) {
try {
mapObject = JSON.parse(mapObject);
} catch (err) {
mapObject = {
version: 3,
names: [],
mappings: '',
file: ''
};
}
}
if (emptySource... | [
"function",
"createFromMap",
"(",
"mapObject",
",",
"content",
",",
"url",
")",
"{",
"url",
"=",
"url",
"||",
"'<source>'",
";",
"if",
"(",
"'string'",
"==",
"typeof",
"mapObject",
")",
"{",
"try",
"{",
"mapObject",
"=",
"JSON",
".",
"parse",
"(",
"map... | Create source map from 'mapObject' and 'content'
@param {Object} mapObject
@param {String} content
@param {String} [url]
@returns {SourceMapGenerator} | [
"Create",
"source",
"map",
"from",
"mapObject",
"and",
"content"
] | c38afc2e6915743eb6cfcf5aba59a8699142c7a5 | https://github.com/popeindustries/buddy/blob/c38afc2e6915743eb6cfcf5aba59a8699142c7a5/lib/utils/sourceMap.js#L47-L67 | train |
popeindustries/buddy | lib/utils/sourceMap.js | insert | function insert(outMap, inMap, length, index) {
// Move existing mappings
if (length) {
outMap._mappings.unsortedForEach(mapping => {
if (mapping.generatedLine > index) mapping.generatedLine += length;
});
}
// Add new mappings
if (inMap) {
const inConsumer = new SourceMapConsumer(inMap.toJ... | javascript | function insert(outMap, inMap, length, index) {
// Move existing mappings
if (length) {
outMap._mappings.unsortedForEach(mapping => {
if (mapping.generatedLine > index) mapping.generatedLine += length;
});
}
// Add new mappings
if (inMap) {
const inConsumer = new SourceMapConsumer(inMap.toJ... | [
"function",
"insert",
"(",
"outMap",
",",
"inMap",
",",
"length",
",",
"index",
")",
"{",
"// Move existing mappings",
"if",
"(",
"length",
")",
"{",
"outMap",
".",
"_mappings",
".",
"unsortedForEach",
"(",
"mapping",
"=>",
"{",
"if",
"(",
"mapping",
".",
... | Insert line in 'outMap' with 'inMap' at line 'index'
@param {SourceMapGenerator} outMap
@param {SourceMapGenerator} [inMap]
@param {Number} length
@param {Number} index | [
"Insert",
"line",
"in",
"outMap",
"with",
"inMap",
"at",
"line",
"index"
] | c38afc2e6915743eb6cfcf5aba59a8699142c7a5 | https://github.com/popeindustries/buddy/blob/c38afc2e6915743eb6cfcf5aba59a8699142c7a5/lib/utils/sourceMap.js#L156-L188 | train |
popeindustries/buddy | lib/utils/sourceMap.js | emptySources | function emptySources(map) {
return !map.sources ||
!map.sources.length ||
!map.sourcesContent ||
!map.sourcesContent.length ||
map.sources.length != map.sourcesContent.length;
} | javascript | function emptySources(map) {
return !map.sources ||
!map.sources.length ||
!map.sourcesContent ||
!map.sourcesContent.length ||
map.sources.length != map.sourcesContent.length;
} | [
"function",
"emptySources",
"(",
"map",
")",
"{",
"return",
"!",
"map",
".",
"sources",
"||",
"!",
"map",
".",
"sources",
".",
"length",
"||",
"!",
"map",
".",
"sourcesContent",
"||",
"!",
"map",
".",
"sourcesContent",
".",
"length",
"||",
"map",
".",
... | Determine if 'map' has empty sources
@param {Object} map
@returns {Boolean} | [
"Determine",
"if",
"map",
"has",
"empty",
"sources"
] | c38afc2e6915743eb6cfcf5aba59a8699142c7a5 | https://github.com/popeindustries/buddy/blob/c38afc2e6915743eb6cfcf5aba59a8699142c7a5/lib/utils/sourceMap.js#L195-L201 | train |
SockDrawer/SockBot | providers/nodebb/notification.js | notifyHandler | function notifyHandler(data) {
const notification = Notification.parse(data);
return evalBlacklist(notification)
.then(() => {
forum.emit('log', `Notification ${notification.id}: ${notification.label} received`);
const ids = {
post: no... | javascript | function notifyHandler(data) {
const notification = Notification.parse(data);
return evalBlacklist(notification)
.then(() => {
forum.emit('log', `Notification ${notification.id}: ${notification.label} received`);
const ids = {
post: no... | [
"function",
"notifyHandler",
"(",
"data",
")",
"{",
"const",
"notification",
"=",
"Notification",
".",
"parse",
"(",
"data",
")",
";",
"return",
"evalBlacklist",
"(",
"notification",
")",
".",
"then",
"(",
"(",
")",
"=>",
"{",
"forum",
".",
"emit",
"(",
... | Handle notifications that arrive
Parse notification from event and process any commands cound within
@private
@param {*} data Notification data
@returns {Promise} Resolved when any commands contained in notificaiton have been processed | [
"Handle",
"notifications",
"that",
"arrive"
] | 043f7e9aa9ec12250889fd825ddcf86709b095a3 | https://github.com/SockDrawer/SockBot/blob/043f7e9aa9ec12250889fd825ddcf86709b095a3/providers/nodebb/notification.js#L386-L418 | train |
SockDrawer/SockBot | providers/nodebb/notification.js | evalBlacklist | function evalBlacklist(notification) {
return new Promise((resolve, reject) => {
const ignoreCategories = forum.config.core.ignoreCategories || [];
//if there's no blacklist, we can ignore the hit for getting the category
if (ignoreCategories.length) {
if (ig... | javascript | function evalBlacklist(notification) {
return new Promise((resolve, reject) => {
const ignoreCategories = forum.config.core.ignoreCategories || [];
//if there's no blacklist, we can ignore the hit for getting the category
if (ignoreCategories.length) {
if (ig... | [
"function",
"evalBlacklist",
"(",
"notification",
")",
"{",
"return",
"new",
"Promise",
"(",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"const",
"ignoreCategories",
"=",
"forum",
".",
"config",
".",
"core",
".",
"ignoreCategories",
"||",
"[",
"]",
";",... | Evaluate the blacklist.
Determine if we want to process this notification or not based on config settings
@private
@param {*} notification Notification we are parsing
@returns {Promise} Rejects with "Ignoring notification" if we do not process this. Resolves with the notification
otherwise. | [
"Evaluate",
"the",
"blacklist",
"."
] | 043f7e9aa9ec12250889fd825ddcf86709b095a3 | https://github.com/SockDrawer/SockBot/blob/043f7e9aa9ec12250889fd825ddcf86709b095a3/providers/nodebb/notification.js#L431-L444 | train |
ghempton/ember-script | ember-runtime.js | normalizeTuple | function normalizeTuple(target, path) {
var hasThis = HAS_THIS.test(path),
isGlobal = !hasThis && IS_GLOBAL_PATH.test(path),
key;
if (!target || isGlobal) target = Ember.lookup;
if (hasThis) path = path.slice(5);
if (target === Ember.lookup) {
key = firstKey(path);
target = get(target, ke... | javascript | function normalizeTuple(target, path) {
var hasThis = HAS_THIS.test(path),
isGlobal = !hasThis && IS_GLOBAL_PATH.test(path),
key;
if (!target || isGlobal) target = Ember.lookup;
if (hasThis) path = path.slice(5);
if (target === Ember.lookup) {
key = firstKey(path);
target = get(target, ke... | [
"function",
"normalizeTuple",
"(",
"target",
",",
"path",
")",
"{",
"var",
"hasThis",
"=",
"HAS_THIS",
".",
"test",
"(",
"path",
")",
",",
"isGlobal",
"=",
"!",
"hasThis",
"&&",
"IS_GLOBAL_PATH",
".",
"test",
"(",
"path",
")",
",",
"key",
";",
"if",
... | assumes path is already normalized | [
"assumes",
"path",
"is",
"already",
"normalized"
] | af6596868bb84c2d43eca30ca0d90244ef3419fd | https://github.com/ghempton/ember-script/blob/af6596868bb84c2d43eca30ca0d90244ef3419fd/ember-runtime.js#L1957-L1975 | train |
ghempton/ember-script | ember-runtime.js | chainsFor | function chainsFor(obj) {
var m = metaFor(obj), ret = m.chains;
if (!ret) {
ret = m.chains = new ChainNode(null, null, obj);
} else if (ret.value() !== obj) {
ret = m.chains = ret.copy(obj);
}
return ret;
} | javascript | function chainsFor(obj) {
var m = metaFor(obj), ret = m.chains;
if (!ret) {
ret = m.chains = new ChainNode(null, null, obj);
} else if (ret.value() !== obj) {
ret = m.chains = ret.copy(obj);
}
return ret;
} | [
"function",
"chainsFor",
"(",
"obj",
")",
"{",
"var",
"m",
"=",
"metaFor",
"(",
"obj",
")",
",",
"ret",
"=",
"m",
".",
"chains",
";",
"if",
"(",
"!",
"ret",
")",
"{",
"ret",
"=",
"m",
".",
"chains",
"=",
"new",
"ChainNode",
"(",
"null",
",",
... | get the chains for the current object. If the current object has chains inherited from the proto they will be cloned and reconfigured for the current object. | [
"get",
"the",
"chains",
"for",
"the",
"current",
"object",
".",
"If",
"the",
"current",
"object",
"has",
"chains",
"inherited",
"from",
"the",
"proto",
"they",
"will",
"be",
"cloned",
"and",
"reconfigured",
"for",
"the",
"current",
"object",
"."
] | af6596868bb84c2d43eca30ca0d90244ef3419fd | https://github.com/ghempton/ember-script/blob/af6596868bb84c2d43eca30ca0d90244ef3419fd/ember-runtime.js#L3411-L3419 | train |
ghempton/ember-script | ember-runtime.js | function() {
var ret = Ember.A([]);
this.forEach(function(o, idx) { ret[idx] = o; });
return ret ;
} | javascript | function() {
var ret = Ember.A([]);
this.forEach(function(o, idx) { ret[idx] = o; });
return ret ;
} | [
"function",
"(",
")",
"{",
"var",
"ret",
"=",
"Ember",
".",
"A",
"(",
"[",
"]",
")",
";",
"this",
".",
"forEach",
"(",
"function",
"(",
"o",
",",
"idx",
")",
"{",
"ret",
"[",
"idx",
"]",
"=",
"o",
";",
"}",
")",
";",
"return",
"ret",
";",
... | Simply converts the enumerable into a genuine array. The order is not
guaranteed. Corresponds to the method implemented by Prototype.
@method toArray
@return {Array} the enumerable as an array. | [
"Simply",
"converts",
"the",
"enumerable",
"into",
"a",
"genuine",
"array",
".",
"The",
"order",
"is",
"not",
"guaranteed",
".",
"Corresponds",
"to",
"the",
"method",
"implemented",
"by",
"Prototype",
"."
] | af6596868bb84c2d43eca30ca0d90244ef3419fd | https://github.com/ghempton/ember-script/blob/af6596868bb84c2d43eca30ca0d90244ef3419fd/ember-runtime.js#L8340-L8344 | train | |
ghempton/ember-script | ember-runtime.js | function() {
if (Ember.Freezable && Ember.Freezable.detect(this)) {
return get(this, 'isFrozen') ? this : this.copy().freeze();
} else {
throw new Error(Ember.String.fmt("%@ does not support freezing", [this]));
}
} | javascript | function() {
if (Ember.Freezable && Ember.Freezable.detect(this)) {
return get(this, 'isFrozen') ? this : this.copy().freeze();
} else {
throw new Error(Ember.String.fmt("%@ does not support freezing", [this]));
}
} | [
"function",
"(",
")",
"{",
"if",
"(",
"Ember",
".",
"Freezable",
"&&",
"Ember",
".",
"Freezable",
".",
"detect",
"(",
"this",
")",
")",
"{",
"return",
"get",
"(",
"this",
",",
"'isFrozen'",
")",
"?",
"this",
":",
"this",
".",
"copy",
"(",
")",
".... | If the object implements `Ember.Freezable`, then this will return a new
copy if the object is not frozen and the receiver if the object is frozen.
Raises an exception if you try to call this method on a object that does
not support freezing.
You should use this method whenever you want a copy of a freezable object
si... | [
"If",
"the",
"object",
"implements",
"Ember",
".",
"Freezable",
"then",
"this",
"will",
"return",
"a",
"new",
"copy",
"if",
"the",
"object",
"is",
"not",
"frozen",
"and",
"the",
"receiver",
"if",
"the",
"object",
"is",
"frozen",
"."
] | af6596868bb84c2d43eca30ca0d90244ef3419fd | https://github.com/ghempton/ember-script/blob/af6596868bb84c2d43eca30ca0d90244ef3419fd/ember-runtime.js#L9082-L9088 | train | |
ghempton/ember-script | ember-runtime.js | function(keyName, increment) {
if (!increment) { increment = 1; }
set(this, keyName, (get(this, keyName) || 0)+increment);
return get(this, keyName);
} | javascript | function(keyName, increment) {
if (!increment) { increment = 1; }
set(this, keyName, (get(this, keyName) || 0)+increment);
return get(this, keyName);
} | [
"function",
"(",
"keyName",
",",
"increment",
")",
"{",
"if",
"(",
"!",
"increment",
")",
"{",
"increment",
"=",
"1",
";",
"}",
"set",
"(",
"this",
",",
"keyName",
",",
"(",
"get",
"(",
"this",
",",
"keyName",
")",
"||",
"0",
")",
"+",
"increment... | Set the value of a property to the current value plus some amount.
```javascript
person.incrementProperty('age');
team.incrementProperty('score', 2);
```
@method incrementProperty
@param {String} keyName The name of the property to increment
@param {Object} increment The amount to increment by. Defaults to 1
@return ... | [
"Set",
"the",
"value",
"of",
"a",
"property",
"to",
"the",
"current",
"value",
"plus",
"some",
"amount",
"."
] | af6596868bb84c2d43eca30ca0d90244ef3419fd | https://github.com/ghempton/ember-script/blob/af6596868bb84c2d43eca30ca0d90244ef3419fd/ember-runtime.js#L10072-L10076 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | _gpfGenSuperMember | function _gpfGenSuperMember (superMethod, method) {
return function GpfSuperableMethod () {
var previousSuper = this._super,
result;
// Add a new ._super() method pointing to the base class member
this._super = superMethod;
try {
// Execute the method
... | javascript | function _gpfGenSuperMember (superMethod, method) {
return function GpfSuperableMethod () {
var previousSuper = this._super,
result;
// Add a new ._super() method pointing to the base class member
this._super = superMethod;
try {
// Execute the method
... | [
"function",
"_gpfGenSuperMember",
"(",
"superMethod",
",",
"method",
")",
"{",
"return",
"function",
"GpfSuperableMethod",
"(",
")",
"{",
"var",
"previousSuper",
"=",
"this",
".",
"_super",
",",
"result",
";",
"// Add a new ._super() method pointing to the base class me... | Generates a closure in which this._super points to the base method of the overridden member
@param {Function} superMethod
@param {Function} method
@return {Function}
@gpf:closure | [
"Generates",
"a",
"closure",
"in",
"which",
"this",
".",
"_super",
"points",
"to",
"the",
"base",
"method",
"of",
"the",
"overridden",
"member"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L73-L92 | train |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | _GpfOldClassDefinition | function _GpfOldClassDefinition (name, Super, definition) {
/*jshint validthis:true*/ // constructor
this._uid = ++_gpfClassDefUID;
_gpfClassDefinitions[this._uid] = this;
this._Subs = [];
if ("function" === typeof name) {
this._name = name.compatibleName() || "anonymous";
// TODO ho... | javascript | function _GpfOldClassDefinition (name, Super, definition) {
/*jshint validthis:true*/ // constructor
this._uid = ++_gpfClassDefUID;
_gpfClassDefinitions[this._uid] = this;
this._Subs = [];
if ("function" === typeof name) {
this._name = name.compatibleName() || "anonymous";
// TODO ho... | [
"function",
"_GpfOldClassDefinition",
"(",
"name",
",",
"Super",
",",
"definition",
")",
"{",
"/*jshint validthis:true*/",
"// constructor",
"this",
".",
"_uid",
"=",
"++",
"_gpfClassDefUID",
";",
"_gpfClassDefinitions",
"[",
"this",
".",
"_uid",
"]",
"=",
"this",... | An helper to create class and store its information
@param {String|Function} name
@param {Function} Super
@param {Object} definition
@class gpf.ClassDefinition
@constructor | [
"An",
"helper",
"to",
"create",
"class",
"and",
"store",
"its",
"information"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L117-L132 | train |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | function (member, memberValue, visibility) {
if (undefined === visibility) {
visibility = _GPF_VISIBILITY_PUBLIC;
} else {
visibility = _gpfVisibilityKeywords.indexOf(visibility);
if (-1 === visibility) {
gpf.Error.classInvalidVisibility();
... | javascript | function (member, memberValue, visibility) {
if (undefined === visibility) {
visibility = _GPF_VISIBILITY_PUBLIC;
} else {
visibility = _gpfVisibilityKeywords.indexOf(visibility);
if (-1 === visibility) {
gpf.Error.classInvalidVisibility();
... | [
"function",
"(",
"member",
",",
"memberValue",
",",
"visibility",
")",
"{",
"if",
"(",
"undefined",
"===",
"visibility",
")",
"{",
"visibility",
"=",
"_GPF_VISIBILITY_PUBLIC",
";",
"}",
"else",
"{",
"visibility",
"=",
"_gpfVisibilityKeywords",
".",
"indexOf",
... | Adds a member to the class definition.
@param {String} member
@param {*} memberValue
@param {String|number} [visibility=_GPF_VISIBILITY_PUBLIC] visibility | [
"Adds",
"a",
"member",
"to",
"the",
"class",
"definition",
"."
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L201-L211 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | function (member, memberValue, visibility) {
if (_GPF_VISIBILITY_STATIC === visibility) {
_gpfAssert(undefined === this._Constructor[member], "Static members can't be overridden");
this._Constructor[member] = memberValue;
} else if ("constructor" === member) {
this._a... | javascript | function (member, memberValue, visibility) {
if (_GPF_VISIBILITY_STATIC === visibility) {
_gpfAssert(undefined === this._Constructor[member], "Static members can't be overridden");
this._Constructor[member] = memberValue;
} else if ("constructor" === member) {
this._a... | [
"function",
"(",
"member",
",",
"memberValue",
",",
"visibility",
")",
"{",
"if",
"(",
"_GPF_VISIBILITY_STATIC",
"===",
"visibility",
")",
"{",
"_gpfAssert",
"(",
"undefined",
"===",
"this",
".",
"_Constructor",
"[",
"member",
"]",
",",
"\"Static members can't b... | Adds a member to the class definition
@param {String} member
@param {*} memberValue
@param {number} visibility | [
"Adds",
"a",
"member",
"to",
"the",
"class",
"definition"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L220-L229 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | function (memberValue, visibility) {
_gpfAsserts({
"Constructor must be a function": "function" === typeof memberValue,
"Own constructor can't be overridden": null === this._definitionConstructor
});
if (_gpfUsesSuper(memberValue)) {
memberValue = _gpfGenSuper... | javascript | function (memberValue, visibility) {
_gpfAsserts({
"Constructor must be a function": "function" === typeof memberValue,
"Own constructor can't be overridden": null === this._definitionConstructor
});
if (_gpfUsesSuper(memberValue)) {
memberValue = _gpfGenSuper... | [
"function",
"(",
"memberValue",
",",
"visibility",
")",
"{",
"_gpfAsserts",
"(",
"{",
"\"Constructor must be a function\"",
":",
"\"function\"",
"===",
"typeof",
"memberValue",
",",
"\"Own constructor can't be overridden\"",
":",
"null",
"===",
"this",
".",
"_definition... | Adds a constructor the class definition
@param {*} memberValue Must be a function
@param {number} visibility
@gpf:closure | [
"Adds",
"a",
"constructor",
"the",
"class",
"definition"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L238-L248 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | function (member, memberValue, visibility) {
var newType = typeof memberValue,
baseMemberValue,
baseType,
prototype = this._Constructor.prototype;
_gpfAssert(!prototype.hasOwnProperty(member), "Existing own member can't be overridden");
baseMemberValue = this.... | javascript | function (member, memberValue, visibility) {
var newType = typeof memberValue,
baseMemberValue,
baseType,
prototype = this._Constructor.prototype;
_gpfAssert(!prototype.hasOwnProperty(member), "Existing own member can't be overridden");
baseMemberValue = this.... | [
"function",
"(",
"member",
",",
"memberValue",
",",
"visibility",
")",
"{",
"var",
"newType",
"=",
"typeof",
"memberValue",
",",
"baseMemberValue",
",",
"baseType",
",",
"prototype",
"=",
"this",
".",
"_Constructor",
".",
"prototype",
";",
"_gpfAssert",
"(",
... | Defines a new non-static member of the class
@param {String} member Name of the member to define
@param {*} memberValue
@param {Number} visibility Visibility of the members
@gpf:closure | [
"Defines",
"a",
"new",
"non",
"-",
"static",
"member",
"of",
"the",
"class"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L258-L276 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | function (member) {
if ("[" !== member.charAt(0) || "]" !== member.charAt(member.length - 1)) {
return "";
}
return _gpfEncodeAttributeMember(member.substr(1, member.length - 2)); // Extract & encode member name
} | javascript | function (member) {
if ("[" !== member.charAt(0) || "]" !== member.charAt(member.length - 1)) {
return "";
}
return _gpfEncodeAttributeMember(member.substr(1, member.length - 2)); // Extract & encode member name
} | [
"function",
"(",
"member",
")",
"{",
"if",
"(",
"\"[\"",
"!==",
"member",
".",
"charAt",
"(",
"0",
")",
"||",
"\"]\"",
"!==",
"member",
".",
"charAt",
"(",
"member",
".",
"length",
"-",
"1",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"return",
"_... | Check if the member represents an attribute and extracts the name | [
"Check",
"if",
"the",
"member",
"represents",
"an",
"attribute",
"and",
"extracts",
"the",
"name"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L279-L284 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | function (attributeName, attributeValue) {
var attributeArray;
if (this._definitionAttributes) {
attributeArray = this._definitionAttributes[attributeName];
} else {
this._definitionAttributes = {};
}
if (undefined === attributeArray) {
attribu... | javascript | function (attributeName, attributeValue) {
var attributeArray;
if (this._definitionAttributes) {
attributeArray = this._definitionAttributes[attributeName];
} else {
this._definitionAttributes = {};
}
if (undefined === attributeArray) {
attribu... | [
"function",
"(",
"attributeName",
",",
"attributeValue",
")",
"{",
"var",
"attributeArray",
";",
"if",
"(",
"this",
".",
"_definitionAttributes",
")",
"{",
"attributeArray",
"=",
"this",
".",
"_definitionAttributes",
"[",
"attributeName",
"]",
";",
"}",
"else",
... | store the attribute for later usage | [
"store",
"the",
"attribute",
"for",
"later",
"usage"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L287-L298 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | function (member, memberValue) {
var attributeName = this._extractAttributeName(member);
if (!attributeName) {
return false;
}
this._addToDefinitionAttributes(attributeName, memberValue);
return true;
} | javascript | function (member, memberValue) {
var attributeName = this._extractAttributeName(member);
if (!attributeName) {
return false;
}
this._addToDefinitionAttributes(attributeName, memberValue);
return true;
} | [
"function",
"(",
"member",
",",
"memberValue",
")",
"{",
"var",
"attributeName",
"=",
"this",
".",
"_extractAttributeName",
"(",
"member",
")",
";",
"if",
"(",
"!",
"attributeName",
")",
"{",
"return",
"false",
";",
"}",
"this",
".",
"_addToDefinitionAttribu... | Check if the current member is an attribute declaration.
If so, stores it into a temporary map that will be processed as the last step.
@param {String} member
@param {*} memberValue
@returns {Boolean} True when an attribute is detected | [
"Check",
"if",
"the",
"current",
"member",
"is",
"an",
"attribute",
"declaration",
".",
"If",
"so",
"stores",
"it",
"into",
"a",
"temporary",
"map",
"that",
"will",
"be",
"processed",
"as",
"the",
"last",
"step",
"."
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L308-L315 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | function (memberName) {
var visibility = this._defaultVisibility;
if (_GPF_VISIBILITY_UNKNOWN === visibility) {
if (memberName.charAt(0) === "_") {
visibility = _GPF_VISIBILITY_PROTECTED;
} else {
visibility = _GPF_VISIBILITY_PUBLIC;
}
... | javascript | function (memberName) {
var visibility = this._defaultVisibility;
if (_GPF_VISIBILITY_UNKNOWN === visibility) {
if (memberName.charAt(0) === "_") {
visibility = _GPF_VISIBILITY_PROTECTED;
} else {
visibility = _GPF_VISIBILITY_PUBLIC;
}
... | [
"function",
"(",
"memberName",
")",
"{",
"var",
"visibility",
"=",
"this",
".",
"_defaultVisibility",
";",
"if",
"(",
"_GPF_VISIBILITY_UNKNOWN",
"===",
"visibility",
")",
"{",
"if",
"(",
"memberName",
".",
"charAt",
"(",
"0",
")",
"===",
"\"_\"",
")",
"{",... | Compute member visibility from default visibility & member name | [
"Compute",
"member",
"visibility",
"from",
"default",
"visibility",
"&",
"member",
"name"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L321-L331 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | function (memberValue, memberName) {
if (this._filterAttribute(memberName, memberValue)) {
return;
}
var newVisibility = _gpfVisibilityKeywords.indexOf(memberName);
if (_GPF_VISIBILITY_UNKNOWN === newVisibility) {
return this._addMember(memberName, memberValue, th... | javascript | function (memberValue, memberName) {
if (this._filterAttribute(memberName, memberValue)) {
return;
}
var newVisibility = _gpfVisibilityKeywords.indexOf(memberName);
if (_GPF_VISIBILITY_UNKNOWN === newVisibility) {
return this._addMember(memberName, memberValue, th... | [
"function",
"(",
"memberValue",
",",
"memberName",
")",
"{",
"if",
"(",
"this",
".",
"_filterAttribute",
"(",
"memberName",
",",
"memberValue",
")",
")",
"{",
"return",
";",
"}",
"var",
"newVisibility",
"=",
"_gpfVisibilityKeywords",
".",
"indexOf",
"(",
"me... | Process definition member.
The member may be a visibility keyword, in that case _processDefinition is called recursively
@param {*} memberValue
@param {string} memberName | [
"Process",
"definition",
"member",
".",
"The",
"member",
"may",
"be",
"a",
"visibility",
"keyword",
"in",
"that",
"case",
"_processDefinition",
"is",
"called",
"recursively"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L340-L352 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | function (definition, visibility) {
var isWScript = _GPF_HOST.WSCRIPT === _gpfHost;
this._defaultVisibility = visibility;
_gpfObjectForEach(definition, this._processDefinitionMember, this);
if (isWScript && definition.hasOwnProperty("toString")) {
this._processDefinitionMembe... | javascript | function (definition, visibility) {
var isWScript = _GPF_HOST.WSCRIPT === _gpfHost;
this._defaultVisibility = visibility;
_gpfObjectForEach(definition, this._processDefinitionMember, this);
if (isWScript && definition.hasOwnProperty("toString")) {
this._processDefinitionMembe... | [
"function",
"(",
"definition",
",",
"visibility",
")",
"{",
"var",
"isWScript",
"=",
"_GPF_HOST",
".",
"WSCRIPT",
"===",
"_gpfHost",
";",
"this",
".",
"_defaultVisibility",
"=",
"visibility",
";",
"_gpfObjectForEach",
"(",
"definition",
",",
"this",
".",
"_pro... | Process class definition
@param {Object} definition
@param {Number} visibility | [
"Process",
"class",
"definition"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L360-L371 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | function () {
var
attributes = this._definitionAttributes,
Constructor,
newPrototype;
if (attributes) {
_gpfAssert("function" === typeof _gpfAttributesAdd, "Attributes can't be defined before they exist");
Constructor = this._Constructor;
... | javascript | function () {
var
attributes = this._definitionAttributes,
Constructor,
newPrototype;
if (attributes) {
_gpfAssert("function" === typeof _gpfAttributesAdd, "Attributes can't be defined before they exist");
Constructor = this._Constructor;
... | [
"function",
"(",
")",
"{",
"var",
"attributes",
"=",
"this",
".",
"_definitionAttributes",
",",
"Constructor",
",",
"newPrototype",
";",
"if",
"(",
"attributes",
")",
"{",
"_gpfAssert",
"(",
"\"function\"",
"===",
"typeof",
"_gpfAttributesAdd",
",",
"\"Attribute... | Process the attributes collected in the definition
NOTE: gpf.attributes._add is defined in attributes.js | [
"Process",
"the",
"attributes",
"collected",
"in",
"the",
"definition"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L378-L397 | train | |
ArnaudBuchholz/gpf-js | lost+found/src/define_/classdef.js | function () {
var
newClass,
newPrototype,
baseClassDef;
// The new class constructor
newClass = _getOldNewClassConstructor(this);
this._Constructor = newClass;
newClass[_GPF_CLASSDEF_MARKER] = this._uid;
// Basic JavaScript inheritanc... | javascript | function () {
var
newClass,
newPrototype,
baseClassDef;
// The new class constructor
newClass = _getOldNewClassConstructor(this);
this._Constructor = newClass;
newClass[_GPF_CLASSDEF_MARKER] = this._uid;
// Basic JavaScript inheritanc... | [
"function",
"(",
")",
"{",
"var",
"newClass",
",",
"newPrototype",
",",
"baseClassDef",
";",
"// The new class constructor",
"newClass",
"=",
"_getOldNewClassConstructor",
"(",
"this",
")",
";",
"this",
".",
"_Constructor",
"=",
"newClass",
";",
"newClass",
"[",
... | Create the new Class constructor | [
"Create",
"the",
"new",
"Class",
"constructor"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/lost+found/src/define_/classdef.js#L400-L436 | train | |
ArnaudBuchholz/gpf-js | src/http/mock.js | _gpfHttMockMatchRequest | function _gpfHttMockMatchRequest (mockedRequest, request) {
var url = mockedRequest.url,
match;
url.lastIndex = 0;
match = url.exec(request.url);
if (match) {
return mockedRequest.response.apply(mockedRequest, [request].concat(_gpfArrayTail(match)));
}
} | javascript | function _gpfHttMockMatchRequest (mockedRequest, request) {
var url = mockedRequest.url,
match;
url.lastIndex = 0;
match = url.exec(request.url);
if (match) {
return mockedRequest.response.apply(mockedRequest, [request].concat(_gpfArrayTail(match)));
}
} | [
"function",
"_gpfHttMockMatchRequest",
"(",
"mockedRequest",
",",
"request",
")",
"{",
"var",
"url",
"=",
"mockedRequest",
".",
"url",
",",
"match",
";",
"url",
".",
"lastIndex",
"=",
"0",
";",
"match",
"=",
"url",
".",
"exec",
"(",
"request",
".",
"url"... | Match the provided request with the mocked one
@param {gpf.typedef.mockedRequest} mockedRequest Mocked request to match
@param {gpf.typedef.httpRequestSettings} request Request to match
@return {Promise<gpf.typedef.httpRequestResponse>|undefined} undefined if not matching
@since 0.2.2 | [
"Match",
"the",
"provided",
"request",
"with",
"the",
"mocked",
"one"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/http/mock.js#L57-L65 | train |
ArnaudBuchholz/gpf-js | src/http/mock.js | _gpfHttMockMatch | function _gpfHttMockMatch (mockedRequests, request) {
var result;
mockedRequests.every(function (mockedRequest) {
result = _gpfHttMockMatchRequest(mockedRequest, request);
return result === undefined;
});
return result;
} | javascript | function _gpfHttMockMatch (mockedRequests, request) {
var result;
mockedRequests.every(function (mockedRequest) {
result = _gpfHttMockMatchRequest(mockedRequest, request);
return result === undefined;
});
return result;
} | [
"function",
"_gpfHttMockMatch",
"(",
"mockedRequests",
",",
"request",
")",
"{",
"var",
"result",
";",
"mockedRequests",
".",
"every",
"(",
"function",
"(",
"mockedRequest",
")",
"{",
"result",
"=",
"_gpfHttMockMatchRequest",
"(",
"mockedRequest",
",",
"request",
... | Match the provided request to the list of mocked ones
@param {gpf.typedef.mockedRequest[]} mockedRequests List of mocked requests for the given method
@param {gpf.typedef.httpRequestSettings} request Request to match
@return {Promise<gpf.typedef.httpRequestResponse>|undefined} undefined if no mocked request matches
@s... | [
"Match",
"the",
"provided",
"request",
"to",
"the",
"list",
"of",
"mocked",
"ones"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/http/mock.js#L75-L82 | train |
ArnaudBuchholz/gpf-js | src/http/mock.js | _gpfHttpMockAdd | function _gpfHttpMockAdd (definition) {
var method = definition.method.toUpperCase(),
id = method + "." + _gpfHttpMockLastId++;
_gpfHttpMockGetMockedRequests(method).unshift(Object.assign({
id: id
}, definition));
return id;
} | javascript | function _gpfHttpMockAdd (definition) {
var method = definition.method.toUpperCase(),
id = method + "." + _gpfHttpMockLastId++;
_gpfHttpMockGetMockedRequests(method).unshift(Object.assign({
id: id
}, definition));
return id;
} | [
"function",
"_gpfHttpMockAdd",
"(",
"definition",
")",
"{",
"var",
"method",
"=",
"definition",
".",
"method",
".",
"toUpperCase",
"(",
")",
",",
"id",
"=",
"method",
"+",
"\".\"",
"+",
"_gpfHttpMockLastId",
"++",
";",
"_gpfHttpMockGetMockedRequests",
"(",
"me... | Add a mocked request
@param {gpf.typedef.mockedRequest} definition Mocked request definition
@return {gpf.typedef.mockedRequestID} Mocked request identifier, to be used with {@link gpf.http.mock.remove}
@see gpf.http
@since 0.2.2 | [
"Add",
"a",
"mocked",
"request"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/http/mock.js#L112-L119 | train |
ArnaudBuchholz/gpf-js | src/http/mock.js | _gpfHttpMockRemove | function _gpfHttpMockRemove (id) {
var method = id.substring(_GPF_START, id.indexOf("."));
_gpfHttpMockedRequests[method] = _gpfHttpMockGetMockedRequests(method).filter(function (mockedRequest) {
return mockedRequest.id !== id;
});
} | javascript | function _gpfHttpMockRemove (id) {
var method = id.substring(_GPF_START, id.indexOf("."));
_gpfHttpMockedRequests[method] = _gpfHttpMockGetMockedRequests(method).filter(function (mockedRequest) {
return mockedRequest.id !== id;
});
} | [
"function",
"_gpfHttpMockRemove",
"(",
"id",
")",
"{",
"var",
"method",
"=",
"id",
".",
"substring",
"(",
"_GPF_START",
",",
"id",
".",
"indexOf",
"(",
"\".\"",
")",
")",
";",
"_gpfHttpMockedRequests",
"[",
"method",
"]",
"=",
"_gpfHttpMockGetMockedRequests",
... | Removes a mocked request
@param {gpf.typedef.mockedRequestID} id Mocked request identifier returned by {@link gpf.http.mock}
@since 0.2.2 | [
"Removes",
"a",
"mocked",
"request"
] | 0888295c99a1ff285ead60273cc7ef656e7fd812 | https://github.com/ArnaudBuchholz/gpf-js/blob/0888295c99a1ff285ead60273cc7ef656e7fd812/src/http/mock.js#L127-L132 | train |
popeindustries/buddy | lib/resolver/config.js | resolveEnvSources | function resolveEnvSources(env) {
let paths = [];
if (process.env[env]) {
paths = process.env[env].includes(path.delimiter) ? process.env[env].split(path.delimiter) : [process.env[env]];
}
return paths;
} | javascript | function resolveEnvSources(env) {
let paths = [];
if (process.env[env]) {
paths = process.env[env].includes(path.delimiter) ? process.env[env].split(path.delimiter) : [process.env[env]];
}
return paths;
} | [
"function",
"resolveEnvSources",
"(",
"env",
")",
"{",
"let",
"paths",
"=",
"[",
"]",
";",
"if",
"(",
"process",
".",
"env",
"[",
"env",
"]",
")",
"{",
"paths",
"=",
"process",
".",
"env",
"[",
"env",
"]",
".",
"includes",
"(",
"path",
".",
"deli... | Resolve environment variable sources for 'env'
@param {String} env
@returns {Array} | [
"Resolve",
"environment",
"variable",
"sources",
"for",
"env"
] | c38afc2e6915743eb6cfcf5aba59a8699142c7a5 | https://github.com/popeindustries/buddy/blob/c38afc2e6915743eb6cfcf5aba59a8699142c7a5/lib/resolver/config.js#L66-L74 | train |
makeup-js/makeup-expander | docs/static/bundle.js | function(target) {
// Only store the `module` in the local cache since `module.exports` may not be accurate
// if there was a circular dependency
var module = localCache[target] || (localCache[target] = requireModule(target, dirname));
return module.export... | javascript | function(target) {
// Only store the `module` in the local cache since `module.exports` may not be accurate
// if there was a circular dependency
var module = localCache[target] || (localCache[target] = requireModule(target, dirname));
return module.export... | [
"function",
"(",
"target",
")",
"{",
"// Only store the `module` in the local cache since `module.exports` may not be accurate",
"// if there was a circular dependency",
"var",
"module",
"=",
"localCache",
"[",
"target",
"]",
"||",
"(",
"localCache",
"[",
"target",
"]",
"=",
... | this is the require used by the module | [
"this",
"is",
"the",
"require",
"used",
"by",
"the",
"module"
] | 9274abb14e4fd051ddcc609dbc9fe9ac6605631c | https://github.com/makeup-js/makeup-expander/blob/9274abb14e4fd051ddcc609dbc9fe9ac6605631c/docs/static/bundle.js#L127-L132 | train |
Subsets and Splits
SQL Console for semeru/code-text-javascript
Retrieves 20,000 non-null code samples labeled as JavaScript, providing a basic overview of the dataset.