id int32 0 58k | repo stringlengths 5 67 | path stringlengths 4 116 | func_name stringlengths 0 58 | original_string stringlengths 52 373k | language stringclasses 1
value | code stringlengths 52 373k | code_tokens list | docstring stringlengths 4 11.8k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 86 226 |
|---|---|---|---|---|---|---|---|---|---|---|---|
47,900 | mikesamuel/module-keys | index.js | unboxStrict | function unboxStrict(box, ifFrom) { // eslint-disable-line no-shadow
const result = unbox(box, ifFrom, neverBoxed);
if (result === neverBoxed) {
throw new Error('Could not unbox');
}
return result;
} | javascript | function unboxStrict(box, ifFrom) { // eslint-disable-line no-shadow
const result = unbox(box, ifFrom, neverBoxed);
if (result === neverBoxed) {
throw new Error('Could not unbox');
}
return result;
} | [
"function",
"unboxStrict",
"(",
"box",
",",
"ifFrom",
")",
"{",
"// eslint-disable-line no-shadow",
"const",
"result",
"=",
"unbox",
"(",
"box",
",",
"ifFrom",
",",
"neverBoxed",
")",
";",
"if",
"(",
"result",
"===",
"neverBoxed",
")",
"{",
"throw",
"new",
... | Like unbox but raises an exception if unboxing fails.
@param {*} box the box to unbox.
@param {?function(function():boolean):boolean} ifFrom
if the box may be opened by this unboxer's owner,
then ifFrom receives the publicKey of the box creator.
It should return true to allow unboxing to proceed.
@return {*} the value ... | [
"Like",
"unbox",
"but",
"raises",
"an",
"exception",
"if",
"unboxing",
"fails",
"."
] | 39100b07d143af3f77a0bec519a92634d5173dd6 | https://github.com/mikesamuel/module-keys/blob/39100b07d143af3f77a0bec519a92634d5173dd6/index.js#L243-L249 |
47,901 | niallo/gumshoe | index.js | result | function result(rule) {
var r = {}
var reserved = ['filename', 'exists', 'grep', 'jsonKeyExists']
Object.keys(rule).forEach(function(key) {
if (reserved.indexOf(key) !== -1) return
r[key] = rule[key]
})
return r
} | javascript | function result(rule) {
var r = {}
var reserved = ['filename', 'exists', 'grep', 'jsonKeyExists']
Object.keys(rule).forEach(function(key) {
if (reserved.indexOf(key) !== -1) return
r[key] = rule[key]
})
return r
} | [
"function",
"result",
"(",
"rule",
")",
"{",
"var",
"r",
"=",
"{",
"}",
"var",
"reserved",
"=",
"[",
"'filename'",
",",
"'exists'",
",",
"'grep'",
",",
"'jsonKeyExists'",
"]",
"Object",
".",
"keys",
"(",
"rule",
")",
".",
"forEach",
"(",
"function",
... | Return an object created by removing all special properties from a rules object. | [
"Return",
"an",
"object",
"created",
"by",
"removing",
"all",
"special",
"properties",
"from",
"a",
"rules",
"object",
"."
] | eff4a8a59bd580536889c4771bb70ca4db2ed96d | https://github.com/niallo/gumshoe/blob/eff4a8a59bd580536889c4771bb70ca4db2ed96d/index.js#L10-L21 |
47,902 | nicktindall/cyclon.p2p-rtc-client | lib/RedundantSignallingSocket.js | scheduleServerConnectivityChecks | function scheduleServerConnectivityChecks() {
if (connectivityIntervalId === null) {
connectivityIntervalId = asyncExecService.setInterval(function () {
updateRegistrations();
connectToServers();
}, INTERVAL_BETWEEN_SERVER_CONNECTIVITY_CHECKS);
}
... | javascript | function scheduleServerConnectivityChecks() {
if (connectivityIntervalId === null) {
connectivityIntervalId = asyncExecService.setInterval(function () {
updateRegistrations();
connectToServers();
}, INTERVAL_BETWEEN_SERVER_CONNECTIVITY_CHECKS);
}
... | [
"function",
"scheduleServerConnectivityChecks",
"(",
")",
"{",
"if",
"(",
"connectivityIntervalId",
"===",
"null",
")",
"{",
"connectivityIntervalId",
"=",
"asyncExecService",
".",
"setInterval",
"(",
"function",
"(",
")",
"{",
"updateRegistrations",
"(",
")",
";",
... | Schedule periodic server connectivity checks | [
"Schedule",
"periodic",
"server",
"connectivity",
"checks"
] | eb586ce288a6ad7e1b221280825037e855b03904 | https://github.com/nicktindall/cyclon.p2p-rtc-client/blob/eb586ce288a6ad7e1b221280825037e855b03904/lib/RedundantSignallingSocket.js#L54-L64 |
47,903 | nicktindall/cyclon.p2p-rtc-client | lib/RedundantSignallingSocket.js | connectToServers | function connectToServers() {
var knownServers = signallingServerSelector.getServerSpecsInPriorityOrder();
for (var i = 0; i < knownServers.length; i++) {
var connectionsRemaining = signallingServerService.getPreferredNumberOfSockets() - Object.keys(connectedSockets).length;
//... | javascript | function connectToServers() {
var knownServers = signallingServerSelector.getServerSpecsInPriorityOrder();
for (var i = 0; i < knownServers.length; i++) {
var connectionsRemaining = signallingServerService.getPreferredNumberOfSockets() - Object.keys(connectedSockets).length;
//... | [
"function",
"connectToServers",
"(",
")",
"{",
"var",
"knownServers",
"=",
"signallingServerSelector",
".",
"getServerSpecsInPriorityOrder",
"(",
")",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"knownServers",
".",
"length",
";",
"i",
"++",
")",
... | Connect to servers if we're not connected to enough | [
"Connect",
"to",
"servers",
"if",
"we",
"re",
"not",
"connected",
"to",
"enough"
] | eb586ce288a6ad7e1b221280825037e855b03904 | https://github.com/nicktindall/cyclon.p2p-rtc-client/blob/eb586ce288a6ad7e1b221280825037e855b03904/lib/RedundantSignallingSocket.js#L105-L141 |
47,904 | nicktindall/cyclon.p2p-rtc-client | lib/RedundantSignallingSocket.js | storeSocket | function storeSocket(spec, socket) {
connectedSpecs[spec.signallingApiBase] = spec;
connectedSockets[spec.signallingApiBase] = socket;
} | javascript | function storeSocket(spec, socket) {
connectedSpecs[spec.signallingApiBase] = spec;
connectedSockets[spec.signallingApiBase] = socket;
} | [
"function",
"storeSocket",
"(",
"spec",
",",
"socket",
")",
"{",
"connectedSpecs",
"[",
"spec",
".",
"signallingApiBase",
"]",
"=",
"spec",
";",
"connectedSockets",
"[",
"spec",
".",
"signallingApiBase",
"]",
"=",
"socket",
";",
"}"
] | Delete a socket from the local store
@param spec
@param socket | [
"Delete",
"a",
"socket",
"from",
"the",
"local",
"store"
] | eb586ce288a6ad7e1b221280825037e855b03904 | https://github.com/nicktindall/cyclon.p2p-rtc-client/blob/eb586ce288a6ad7e1b221280825037e855b03904/lib/RedundantSignallingSocket.js#L169-L172 |
47,905 | nicktindall/cyclon.p2p-rtc-client | lib/RedundantSignallingSocket.js | addListeners | function addListeners(socket, serverSpec) {
var apiBase = serverSpec.signallingApiBase;
var disposeFunction = disposeOfSocket(apiBase);
var registerFunction = register(socket);
// Register if we connect
socket.on("connect", registerFunction);
// Dispose if we disconnect... | javascript | function addListeners(socket, serverSpec) {
var apiBase = serverSpec.signallingApiBase;
var disposeFunction = disposeOfSocket(apiBase);
var registerFunction = register(socket);
// Register if we connect
socket.on("connect", registerFunction);
// Dispose if we disconnect... | [
"function",
"addListeners",
"(",
"socket",
",",
"serverSpec",
")",
"{",
"var",
"apiBase",
"=",
"serverSpec",
".",
"signallingApiBase",
";",
"var",
"disposeFunction",
"=",
"disposeOfSocket",
"(",
"apiBase",
")",
";",
"var",
"registerFunction",
"=",
"register",
"(... | Add listeners for a socket
@param socket
@param serverSpec | [
"Add",
"listeners",
"for",
"a",
"socket"
] | eb586ce288a6ad7e1b221280825037e855b03904 | https://github.com/nicktindall/cyclon.p2p-rtc-client/blob/eb586ce288a6ad7e1b221280825037e855b03904/lib/RedundantSignallingSocket.js#L191-L210 |
47,906 | nicktindall/cyclon.p2p-rtc-client | lib/RedundantSignallingSocket.js | disposeOfSocket | function disposeOfSocket(apiBase) {
return function (error) {
loggingService.warn("Got disconnected from signalling server (" + apiBase + ")", error);
var socket = connectedSockets[apiBase];
if (socket) {
stopConnectivityChecks();
socket.remov... | javascript | function disposeOfSocket(apiBase) {
return function (error) {
loggingService.warn("Got disconnected from signalling server (" + apiBase + ")", error);
var socket = connectedSockets[apiBase];
if (socket) {
stopConnectivityChecks();
socket.remov... | [
"function",
"disposeOfSocket",
"(",
"apiBase",
")",
"{",
"return",
"function",
"(",
"error",
")",
"{",
"loggingService",
".",
"warn",
"(",
"\"Got disconnected from signalling server (\"",
"+",
"apiBase",
"+",
"\")\"",
",",
"error",
")",
";",
"var",
"socket",
"="... | Return a closure that will dispose of a socket
@param apiBase
@returns {Function} | [
"Return",
"a",
"closure",
"that",
"will",
"dispose",
"of",
"a",
"socket"
] | eb586ce288a6ad7e1b221280825037e855b03904 | https://github.com/nicktindall/cyclon.p2p-rtc-client/blob/eb586ce288a6ad7e1b221280825037e855b03904/lib/RedundantSignallingSocket.js#L218-L242 |
47,907 | YuhangGe/node-freetype | lib/parse/glyf.js | parseGlyphCoordinate | function parseGlyphCoordinate(p, flag, previousValue, shortVectorBitMask, sameBitMask) {
var v;
if ((flag & shortVectorBitMask) > 0) {
// The coordinate is 1 byte long.
v = p.parseByte();
// The `same` bit is re-used for short values to signify the sign of the value.
if ((flag & ... | javascript | function parseGlyphCoordinate(p, flag, previousValue, shortVectorBitMask, sameBitMask) {
var v;
if ((flag & shortVectorBitMask) > 0) {
// The coordinate is 1 byte long.
v = p.parseByte();
// The `same` bit is re-used for short values to signify the sign of the value.
if ((flag & ... | [
"function",
"parseGlyphCoordinate",
"(",
"p",
",",
"flag",
",",
"previousValue",
",",
"shortVectorBitMask",
",",
"sameBitMask",
")",
"{",
"var",
"v",
";",
"if",
"(",
"(",
"flag",
"&",
"shortVectorBitMask",
")",
">",
"0",
")",
"{",
"// The coordinate is 1 byte ... | Parse the coordinate data for a glyph. | [
"Parse",
"the",
"coordinate",
"data",
"for",
"a",
"glyph",
"."
] | 4c8d2e2503f088ffbd61e613a23b9ff2e64d3489 | https://github.com/YuhangGe/node-freetype/blob/4c8d2e2503f088ffbd61e613a23b9ff2e64d3489/lib/parse/glyf.js#L10-L31 |
47,908 | YuhangGe/node-freetype | lib/parse/glyf.js | transformPoints | function transformPoints(points, transform) {
var newPoints, i, pt, newPt;
newPoints = [];
for (i = 0; i < points.length; i += 1) {
pt = points[i];
newPt = {
x: transform.xScale * pt.x + transform.scale01 * pt.y + transform.dx,
y: transform.scale10 * pt.x + transform.... | javascript | function transformPoints(points, transform) {
var newPoints, i, pt, newPt;
newPoints = [];
for (i = 0; i < points.length; i += 1) {
pt = points[i];
newPt = {
x: transform.xScale * pt.x + transform.scale01 * pt.y + transform.dx,
y: transform.scale10 * pt.x + transform.... | [
"function",
"transformPoints",
"(",
"points",
",",
"transform",
")",
"{",
"var",
"newPoints",
",",
"i",
",",
"pt",
",",
"newPt",
";",
"newPoints",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"points",
".",
"length",
";",
"i",
"+... | Transform an array of points and return a new array. | [
"Transform",
"an",
"array",
"of",
"points",
"and",
"return",
"a",
"new",
"array",
"."
] | 4c8d2e2503f088ffbd61e613a23b9ff2e64d3489 | https://github.com/YuhangGe/node-freetype/blob/4c8d2e2503f088ffbd61e613a23b9ff2e64d3489/lib/parse/glyf.js#L160-L174 |
47,909 | YuhangGe/node-freetype | lib/parse/glyf.js | getPath | function getPath(points) {
var p, contours, i, realFirstPoint, j, contour, pt, firstPt,
prevPt, midPt, curvePt, lastPt;
p = new path.Path();
if (!points) {
return p;
}
contours = getContours(points);
for (i = 0; i < contours.length; i += 1) {
contour = contours[i];
... | javascript | function getPath(points) {
var p, contours, i, realFirstPoint, j, contour, pt, firstPt,
prevPt, midPt, curvePt, lastPt;
p = new path.Path();
if (!points) {
return p;
}
contours = getContours(points);
for (i = 0; i < contours.length; i += 1) {
contour = contours[i];
... | [
"function",
"getPath",
"(",
"points",
")",
"{",
"var",
"p",
",",
"contours",
",",
"i",
",",
"realFirstPoint",
",",
"j",
",",
"contour",
",",
"pt",
",",
"firstPt",
",",
"prevPt",
",",
"midPt",
",",
"curvePt",
",",
"lastPt",
";",
"p",
"=",
"new",
"pa... | Convert the TrueType glyph outline to a Path. | [
"Convert",
"the",
"TrueType",
"glyph",
"outline",
"to",
"a",
"Path",
"."
] | 4c8d2e2503f088ffbd61e613a23b9ff2e64d3489 | https://github.com/YuhangGe/node-freetype/blob/4c8d2e2503f088ffbd61e613a23b9ff2e64d3489/lib/parse/glyf.js#L194-L257 |
47,910 | YuhangGe/node-freetype | lib/parse/glyf.js | parseGlyfTable | function parseGlyfTable(data, start, loca) {
var glyphs, i, j, offset, nextOffset, glyph,
component, componentGlyph, transformedPoints;
glyphs = [];
// The last element of the loca table is invalid.
for (i = 0; i < loca.length - 1; i += 1) {
offset = loca[i];
nextOffset = loca[i ... | javascript | function parseGlyfTable(data, start, loca) {
var glyphs, i, j, offset, nextOffset, glyph,
component, componentGlyph, transformedPoints;
glyphs = [];
// The last element of the loca table is invalid.
for (i = 0; i < loca.length - 1; i += 1) {
offset = loca[i];
nextOffset = loca[i ... | [
"function",
"parseGlyfTable",
"(",
"data",
",",
"start",
",",
"loca",
")",
"{",
"var",
"glyphs",
",",
"i",
",",
"j",
",",
"offset",
",",
"nextOffset",
",",
"glyph",
",",
"component",
",",
"componentGlyph",
",",
"transformedPoints",
";",
"glyphs",
"=",
"[... | Parse all the glyphs according to the offsets from the `loca` table. | [
"Parse",
"all",
"the",
"glyphs",
"according",
"to",
"the",
"offsets",
"from",
"the",
"loca",
"table",
"."
] | 4c8d2e2503f088ffbd61e613a23b9ff2e64d3489 | https://github.com/YuhangGe/node-freetype/blob/4c8d2e2503f088ffbd61e613a23b9ff2e64d3489/lib/parse/glyf.js#L273-L305 |
47,911 | oegea/soap_salesforce | salesforce.js | Salesforce | function Salesforce(username, password, token, wsdl) {
//Required NodeJS libraries
this.q = require("q");
this.soap = require("soap");
//Salesforce access data
this.username = username;
this.password = password;
this.token = token;
this.wsdl = wsdl || "./node_modules/soap_salesforce/ws... | javascript | function Salesforce(username, password, token, wsdl) {
//Required NodeJS libraries
this.q = require("q");
this.soap = require("soap");
//Salesforce access data
this.username = username;
this.password = password;
this.token = token;
this.wsdl = wsdl || "./node_modules/soap_salesforce/ws... | [
"function",
"Salesforce",
"(",
"username",
",",
"password",
",",
"token",
",",
"wsdl",
")",
"{",
"//Required NodeJS libraries",
"this",
".",
"q",
"=",
"require",
"(",
"\"q\"",
")",
";",
"this",
".",
"soap",
"=",
"require",
"(",
"\"soap\"",
")",
";",
"//S... | Salesforce connection library constructor. | [
"Salesforce",
"connection",
"library",
"constructor",
"."
] | 2cfe10234f6d86c404faf61b730e6ec03d79bce5 | https://github.com/oegea/soap_salesforce/blob/2cfe10234f6d86c404faf61b730e6ec03d79bce5/salesforce.js#L4-L19 |
47,912 | digitalwm/cloudjs | modules/callbacks.js | AddCallback | function AddCallback(mesgId, callbackFunction, callbackTimeout) {
var callbackElement, now;
now = new Date().getTime();
callbackElement = {
id : mesgId,
func : callbackFunction,
timeout : now + callbackTimeout
};
callbackList.push(callbackElement);
} | javascript | function AddCallback(mesgId, callbackFunction, callbackTimeout) {
var callbackElement, now;
now = new Date().getTime();
callbackElement = {
id : mesgId,
func : callbackFunction,
timeout : now + callbackTimeout
};
callbackList.push(callbackElement);
} | [
"function",
"AddCallback",
"(",
"mesgId",
",",
"callbackFunction",
",",
"callbackTimeout",
")",
"{",
"var",
"callbackElement",
",",
"now",
";",
"now",
"=",
"new",
"Date",
"(",
")",
".",
"getTime",
"(",
")",
";",
"callbackElement",
"=",
"{",
"id",
":",
"m... | Add a callback for a specific message ID
@param string mesgId
@param function callbackFunction
@param number callbackTimeout | [
"Add",
"a",
"callback",
"for",
"a",
"specific",
"message",
"ID"
] | 96f9394d939f8369c7a1acc03815f43e882adba2 | https://github.com/digitalwm/cloudjs/blob/96f9394d939f8369c7a1acc03815f43e882adba2/modules/callbacks.js#L47-L59 |
47,913 | digitalwm/cloudjs | modules/callbacks.js | ParseReply | function ParseReply(mesgId, data, sid) {
var i;
for(i = 0 ; i < callbackList.length ; i++) {
if(callbackList[i].id.toString() === mesgId.toString() ) {
callbackList[i].func(data, sid);
}
}
} | javascript | function ParseReply(mesgId, data, sid) {
var i;
for(i = 0 ; i < callbackList.length ; i++) {
if(callbackList[i].id.toString() === mesgId.toString() ) {
callbackList[i].func(data, sid);
}
}
} | [
"function",
"ParseReply",
"(",
"mesgId",
",",
"data",
",",
"sid",
")",
"{",
"var",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"callbackList",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"callbackList",
"[",
"i",
"]",
".",
"id",... | Calls all the saved callbacks for a specific message ID
@param string mesgId
@param object data | [
"Calls",
"all",
"the",
"saved",
"callbacks",
"for",
"a",
"specific",
"message",
"ID"
] | 96f9394d939f8369c7a1acc03815f43e882adba2 | https://github.com/digitalwm/cloudjs/blob/96f9394d939f8369c7a1acc03815f43e882adba2/modules/callbacks.js#L66-L74 |
47,914 | digitalwm/cloudjs | modules/callbacks.js | GetOnEvent | function GetOnEvent(title) {
var retList, i;
retList = [];
for(i = 0 ; i < onList.length ; i++) {
if(onList[i].event.toString() === title.toString()) {
retList.push(onList[i].callback);
}
}
return retList;
} | javascript | function GetOnEvent(title) {
var retList, i;
retList = [];
for(i = 0 ; i < onList.length ; i++) {
if(onList[i].event.toString() === title.toString()) {
retList.push(onList[i].callback);
}
}
return retList;
} | [
"function",
"GetOnEvent",
"(",
"title",
")",
"{",
"var",
"retList",
",",
"i",
";",
"retList",
"=",
"[",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"onList",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"onList",
"[",
"i",
"]",... | Gets a list of callbacks for a requested event
@param string title
@return array | [
"Gets",
"a",
"list",
"of",
"callbacks",
"for",
"a",
"requested",
"event"
] | 96f9394d939f8369c7a1acc03815f43e882adba2 | https://github.com/digitalwm/cloudjs/blob/96f9394d939f8369c7a1acc03815f43e882adba2/modules/callbacks.js#L93-L103 |
47,915 | BladeRunnerJS/topiarist | src/msg.js | msg | function msg(str) {
if (str == null) {
return null;
}
for (var i = 1, len = arguments.length; i < len; ++i) {
str = str.replace('{' + (i - 1) + '}', String(arguments[i]));
}
return str;
} | javascript | function msg(str) {
if (str == null) {
return null;
}
for (var i = 1, len = arguments.length; i < len; ++i) {
str = str.replace('{' + (i - 1) + '}', String(arguments[i]));
}
return str;
} | [
"function",
"msg",
"(",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"var",
"i",
"=",
"1",
",",
"len",
"=",
"arguments",
".",
"length",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"s... | Interpolates a string with the arguments, used for error messages.
@private | [
"Interpolates",
"a",
"string",
"with",
"the",
"arguments",
"used",
"for",
"error",
"messages",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/msg.js#L7-L17 |
47,916 | i5ting/tpl_apply | index.js | tpl_apply_with_register_helper | function tpl_apply_with_register_helper(Handlebars, template_path, data_obj, dest_file_path) {
var rs = fs.createReadStream(template_path, {bufferSize: 11});
var bufferHelper = new BufferHelper();
rs.on("data", function (trunk){
bufferHelper.concat(trunk);
});
rs.on("end", function () {
var source = buffer... | javascript | function tpl_apply_with_register_helper(Handlebars, template_path, data_obj, dest_file_path) {
var rs = fs.createReadStream(template_path, {bufferSize: 11});
var bufferHelper = new BufferHelper();
rs.on("data", function (trunk){
bufferHelper.concat(trunk);
});
rs.on("end", function () {
var source = buffer... | [
"function",
"tpl_apply_with_register_helper",
"(",
"Handlebars",
",",
"template_path",
",",
"data_obj",
",",
"dest_file_path",
")",
"{",
"var",
"rs",
"=",
"fs",
".",
"createReadStream",
"(",
"template_path",
",",
"{",
"bufferSize",
":",
"11",
"}",
")",
";",
"v... | Custom with helpers | [
"Custom",
"with",
"helpers"
] | eb2e0f91035f68a94e5fe049058f13d94b35710e | https://github.com/i5ting/tpl_apply/blob/eb2e0f91035f68a94e5fe049058f13d94b35710e/index.js#L22-L44 |
47,917 | reelyactive/chickadee | lib/associationmanager.js | AssociationManager | function AssociationManager(options) {
var self = this;
self.associationsRootUrl = options.associationsRootUrl ||
SNIFFYPEDIA_ROOT_URL;
var datafolder = options.persistentDataFolder || DEFAULT_DATA_FOLDER;
var filename = ASSOCIATION_DB;
if(options.persistentDataFolder !== '') {
... | javascript | function AssociationManager(options) {
var self = this;
self.associationsRootUrl = options.associationsRootUrl ||
SNIFFYPEDIA_ROOT_URL;
var datafolder = options.persistentDataFolder || DEFAULT_DATA_FOLDER;
var filename = ASSOCIATION_DB;
if(options.persistentDataFolder !== '') {
... | [
"function",
"AssociationManager",
"(",
"options",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"associationsRootUrl",
"=",
"options",
".",
"associationsRootUrl",
"||",
"SNIFFYPEDIA_ROOT_URL",
";",
"var",
"datafolder",
"=",
"options",
".",
"persistentDat... | AssociationManager Class
Manages the association of identifiers with URLs
@param {Object} options The options as a JSON object.
@constructor | [
"AssociationManager",
"Class",
"Manages",
"the",
"association",
"of",
"identifiers",
"with",
"URLs"
] | 1f65c2d369694d93796aae63318fa76326275120 | https://github.com/reelyactive/chickadee/blob/1f65c2d369694d93796aae63318fa76326275120/lib/associationmanager.js#L36-L53 |
47,918 | reelyactive/chickadee | lib/associationmanager.js | getAssociations | function getAssociations(instance, ids, callback) {
instance.db.find({ _id: { $in: ids } }, function(err, associations) {
for(var cAssociation = 0; cAssociation < associations.length;
cAssociation++) {
associations[cAssociation].deviceId = associations[cAssociation]._id;
}
callback(err, asso... | javascript | function getAssociations(instance, ids, callback) {
instance.db.find({ _id: { $in: ids } }, function(err, associations) {
for(var cAssociation = 0; cAssociation < associations.length;
cAssociation++) {
associations[cAssociation].deviceId = associations[cAssociation]._id;
}
callback(err, asso... | [
"function",
"getAssociations",
"(",
"instance",
",",
"ids",
",",
"callback",
")",
"{",
"instance",
".",
"db",
".",
"find",
"(",
"{",
"_id",
":",
"{",
"$in",
":",
"ids",
"}",
"}",
",",
"function",
"(",
"err",
",",
"associations",
")",
"{",
"for",
"(... | Retrieve from the database the associations of the given ids
@param {Object} instance The given Chickadee instance.
@param {Array} ids The given ids.
@param {function} callback Function to call on completion. | [
"Retrieve",
"from",
"the",
"database",
"the",
"associations",
"of",
"the",
"given",
"ids"
] | 1f65c2d369694d93796aae63318fa76326275120 | https://github.com/reelyactive/chickadee/blob/1f65c2d369694d93796aae63318fa76326275120/lib/associationmanager.js#L91-L99 |
47,919 | reelyactive/chickadee | lib/associationmanager.js | extractRadioDecoders | function extractRadioDecoders(devices) {
var radioDecoders = {};
for(var deviceId in devices) {
var radioDecodings = devices[deviceId].radioDecodings || [];
for(var cDecoding = 0; cDecoding < radioDecodings.length; cDecoding++) {
var radioDecoder = radioDecodings[cDecoding].identifier;
var radi... | javascript | function extractRadioDecoders(devices) {
var radioDecoders = {};
for(var deviceId in devices) {
var radioDecodings = devices[deviceId].radioDecodings || [];
for(var cDecoding = 0; cDecoding < radioDecodings.length; cDecoding++) {
var radioDecoder = radioDecodings[cDecoding].identifier;
var radi... | [
"function",
"extractRadioDecoders",
"(",
"devices",
")",
"{",
"var",
"radioDecoders",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"deviceId",
"in",
"devices",
")",
"{",
"var",
"radioDecodings",
"=",
"devices",
"[",
"deviceId",
"]",
".",
"radioDecodings",
"||",
... | Extract the radio decoders from the given list of devices.
@param {Object} devices The given devices. | [
"Extract",
"the",
"radio",
"decoders",
"from",
"the",
"given",
"list",
"of",
"devices",
"."
] | 1f65c2d369694d93796aae63318fa76326275120 | https://github.com/reelyactive/chickadee/blob/1f65c2d369694d93796aae63318fa76326275120/lib/associationmanager.js#L502-L515 |
47,920 | reelyactive/chickadee | lib/associationmanager.js | extractAssociationIds | function extractAssociationIds(devices) {
var associationIds = [];
for(var deviceId in devices) {
var device = devices[deviceId];
var hasAssociationIds = device.hasOwnProperty("associationIds");
if(!hasAssociationIds) {
device.associationIds = reelib.tiraid.getAssociationIds(device);
}
fo... | javascript | function extractAssociationIds(devices) {
var associationIds = [];
for(var deviceId in devices) {
var device = devices[deviceId];
var hasAssociationIds = device.hasOwnProperty("associationIds");
if(!hasAssociationIds) {
device.associationIds = reelib.tiraid.getAssociationIds(device);
}
fo... | [
"function",
"extractAssociationIds",
"(",
"devices",
")",
"{",
"var",
"associationIds",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"deviceId",
"in",
"devices",
")",
"{",
"var",
"device",
"=",
"devices",
"[",
"deviceId",
"]",
";",
"var",
"hasAssociationIds",
"=... | Extract all non-duplicate association ids from the given list of devices,
adding an assocationIds field to each device when absent.
@param {Object} devices The given devices.
@return {Array} Non-duplicate association identifiers. | [
"Extract",
"all",
"non",
"-",
"duplicate",
"association",
"ids",
"from",
"the",
"given",
"list",
"of",
"devices",
"adding",
"an",
"assocationIds",
"field",
"to",
"each",
"device",
"when",
"absent",
"."
] | 1f65c2d369694d93796aae63318fa76326275120 | https://github.com/reelyactive/chickadee/blob/1f65c2d369694d93796aae63318fa76326275120/lib/associationmanager.js#L524-L541 |
47,921 | fibo/laplace-determinant | laplace-determinant.js | subMatrix | function subMatrix (data, numRows, numCols, row, col) {
var sub = []
for (var i = 0; i < numRows; i++) {
for (var j = 0; j < numCols; j++) {
if ((i !== row) && (j !== col)) {
sub.push(data[matrixToArrayIndex(i, j, numCols)])
}
}
}
return sub
} | javascript | function subMatrix (data, numRows, numCols, row, col) {
var sub = []
for (var i = 0; i < numRows; i++) {
for (var j = 0; j < numCols; j++) {
if ((i !== row) && (j !== col)) {
sub.push(data[matrixToArrayIndex(i, j, numCols)])
}
}
}
return sub
} | [
"function",
"subMatrix",
"(",
"data",
",",
"numRows",
",",
"numCols",
",",
"row",
",",
"col",
")",
"{",
"var",
"sub",
"=",
"[",
"]",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"numRows",
";",
"i",
"++",
")",
"{",
"for",
"(",
"var",
"j",... | Compute the sub-matrix formed by deleting the i-th row and j-th column
@function
@param {Array} data set
@param {Number} numRows
@param {Number} numCols
@param {Number} row index deleted
@param {Number} col index deleted
@returns {Array} sub data-set | [
"Compute",
"the",
"sub",
"-",
"matrix",
"formed",
"by",
"deleting",
"the",
"i",
"-",
"th",
"row",
"and",
"j",
"-",
"th",
"column"
] | b66ff70e932a7131639f8d6a57eaeb8c7eaf1d6f | https://github.com/fibo/laplace-determinant/blob/b66ff70e932a7131639f8d6a57eaeb8c7eaf1d6f/laplace-determinant.js#L32-L44 |
47,922 | fibo/laplace-determinant | laplace-determinant.js | determinant | function determinant (data, scalar, order) {
// Recursion will stop here:
// the determinant of a 1x1 matrix is its only element.
if (data.length === 1) return data[0]
if (no(order)) order = Math.sqrt(data.length)
if (order % 1 !== 0) {
throw new TypeError('data.lenght must be a square')
}
// Defau... | javascript | function determinant (data, scalar, order) {
// Recursion will stop here:
// the determinant of a 1x1 matrix is its only element.
if (data.length === 1) return data[0]
if (no(order)) order = Math.sqrt(data.length)
if (order % 1 !== 0) {
throw new TypeError('data.lenght must be a square')
}
// Defau... | [
"function",
"determinant",
"(",
"data",
",",
"scalar",
",",
"order",
")",
"{",
"// Recursion will stop here:",
"// the determinant of a 1x1 matrix is its only element.",
"if",
"(",
"data",
".",
"length",
"===",
"1",
")",
"return",
"data",
"[",
"0",
"]",
"if",
"(",... | Computes the determinant of a matrix using Laplace's formula
See https://en.wikipedia.org/wiki/Laplace_expansion
@function
@param {Array} data, lenght must be a square.
@param {Object} [scalar]
@param {Function} [scalar.addition = (a, b) -> a + b ]
@param {Function} [scalar.multiplication = (a, b) -> a * b ]
@... | [
"Computes",
"the",
"determinant",
"of",
"a",
"matrix",
"using",
"Laplace",
"s",
"formula"
] | b66ff70e932a7131639f8d6a57eaeb8c7eaf1d6f | https://github.com/fibo/laplace-determinant/blob/b66ff70e932a7131639f8d6a57eaeb8c7eaf1d6f/laplace-determinant.js#L63-L113 |
47,923 | rtm/upward | src/Acc.js | notifyAccess | function notifyAccess({object, name}) {
// Create an observer for changes in properties accessed during execution of this function.
function makeAccessedObserver() {
return Observer(object, function(changes) {
changes.forEach(({type, name}) => {
var {names} = accessEntry;
if (... | javascript | function notifyAccess({object, name}) {
// Create an observer for changes in properties accessed during execution of this function.
function makeAccessedObserver() {
return Observer(object, function(changes) {
changes.forEach(({type, name}) => {
var {names} = accessEntry;
if (... | [
"function",
"notifyAccess",
"(",
"{",
"object",
",",
"name",
"}",
")",
"{",
"// Create an observer for changes in properties accessed during execution of this function.",
"function",
"makeAccessedObserver",
"(",
")",
"{",
"return",
"Observer",
"(",
"object",
",",
"function"... | `notifyAccess` is the callback invoked by upwardables when a property is accessed. It records the access in the `accesses` map. | [
"notifyAccess",
"is",
"the",
"callback",
"invoked",
"by",
"upwardables",
"when",
"a",
"property",
"is",
"accessed",
".",
"It",
"records",
"the",
"access",
"in",
"the",
"accesses",
"map",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Acc.js#L68-L100 |
47,924 | rtm/upward | src/Acc.js | makeAccessedObserver | function makeAccessedObserver() {
return Observer(object, function(changes) {
changes.forEach(({type, name}) => {
var {names} = accessEntry;
if (!names || type === 'update' && names.indexOf(name) !== -1)
rerun();
});
});
} | javascript | function makeAccessedObserver() {
return Observer(object, function(changes) {
changes.forEach(({type, name}) => {
var {names} = accessEntry;
if (!names || type === 'update' && names.indexOf(name) !== -1)
rerun();
});
});
} | [
"function",
"makeAccessedObserver",
"(",
")",
"{",
"return",
"Observer",
"(",
"object",
",",
"function",
"(",
"changes",
")",
"{",
"changes",
".",
"forEach",
"(",
"(",
"{",
"type",
",",
"name",
"}",
")",
"=>",
"{",
"var",
"{",
"names",
"}",
"=",
"acc... | Create an observer for changes in properties accessed during execution of this function. | [
"Create",
"an",
"observer",
"for",
"changes",
"in",
"properties",
"accessed",
"during",
"execution",
"of",
"this",
"function",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Acc.js#L71-L79 |
47,925 | rtm/upward | src/Acc.js | makeAccessEntry | function makeAccessEntry() {
accesses.set(object, {
names: name ? [name] : null,
observer: makeAccessedObserver()
});
} | javascript | function makeAccessEntry() {
accesses.set(object, {
names: name ? [name] : null,
observer: makeAccessedObserver()
});
} | [
"function",
"makeAccessEntry",
"(",
")",
"{",
"accesses",
".",
"set",
"(",
"object",
",",
"{",
"names",
":",
"name",
"?",
"[",
"name",
"]",
":",
"null",
",",
"observer",
":",
"makeAccessedObserver",
"(",
")",
"}",
")",
";",
"}"
] | Make a new entry in the access table, containing initial property name if any and observer for properties accessed on the object. | [
"Make",
"a",
"new",
"entry",
"in",
"the",
"access",
"table",
"containing",
"initial",
"property",
"name",
"if",
"any",
"and",
"observer",
"for",
"properties",
"accessed",
"on",
"the",
"object",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Acc.js#L83-L88 |
47,926 | rtm/upward | src/Acc.js | setAccessEntry | function setAccessEntry() {
if (name && accessEntry.names) accessEntry.names.push(name);
else accessEntry.names = null;
} | javascript | function setAccessEntry() {
if (name && accessEntry.names) accessEntry.names.push(name);
else accessEntry.names = null;
} | [
"function",
"setAccessEntry",
"(",
")",
"{",
"if",
"(",
"name",
"&&",
"accessEntry",
".",
"names",
")",
"accessEntry",
".",
"names",
".",
"push",
"(",
"name",
")",
";",
"else",
"accessEntry",
".",
"names",
"=",
"null",
";",
"}"
] | If properties on this object are already being watched, there is already an entry in the access table for it. Add a new property name to the existing entry. | [
"If",
"properties",
"on",
"this",
"object",
"are",
"already",
"being",
"watched",
"there",
"is",
"already",
"an",
"entry",
"in",
"the",
"access",
"table",
"for",
"it",
".",
"Add",
"a",
"new",
"property",
"name",
"to",
"the",
"existing",
"entry",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Acc.js#L92-L95 |
47,927 | smartface/sf-component-calendar | scripts/services/StyleContext.js | fromSFComponent | function fromSFComponent(component, name, initialClassNameMap) {
var hooksList = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
var flatted = {};
function collect(component, name, initialClassNameMap) {
var newComp = makeStylable(component, initialClassNameMap(name), name, hooks(ho... | javascript | function fromSFComponent(component, name, initialClassNameMap) {
var hooksList = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
var flatted = {};
function collect(component, name, initialClassNameMap) {
var newComp = makeStylable(component, initialClassNameMap(name), name, hooks(ho... | [
"function",
"fromSFComponent",
"(",
"component",
",",
"name",
",",
"initialClassNameMap",
")",
"{",
"var",
"hooksList",
"=",
"arguments",
".",
"length",
">",
"3",
"&&",
"arguments",
"[",
"3",
"]",
"!==",
"undefined",
"?",
"arguments",
"[",
"3",
"]",
":",
... | Create styleContext tree from a SF Component and flat component tree to create actors
@param {Object} component - A sf-core component
@param {string} name - component name
@param {function} initialClassNameMap - classNames mapping with specified component and children
@param {?function} hookList - callback function to... | [
"Create",
"styleContext",
"tree",
"from",
"a",
"SF",
"Component",
"and",
"flat",
"component",
"tree",
"to",
"create",
"actors"
] | d6c8310564ff551b9424ac6955efa5e8cf5f8dff | https://github.com/smartface/sf-component-calendar/blob/d6c8310564ff551b9424ac6955efa5e8cf5f8dff/scripts/services/StyleContext.js#L43-L61 |
47,928 | lpinca/sauce-browsers | index.js | filterByVersion | function filterByVersion(browsers, version) {
version = String(version);
if (version === 'latest' || version === 'oldest') {
const filtered = numericVersions(browsers);
const i = version === 'latest' ? filtered.length - 1 : 0;
const value = filtered[i].short_version;
return filtered.filter((el) => ... | javascript | function filterByVersion(browsers, version) {
version = String(version);
if (version === 'latest' || version === 'oldest') {
const filtered = numericVersions(browsers);
const i = version === 'latest' ? filtered.length - 1 : 0;
const value = filtered[i].short_version;
return filtered.filter((el) => ... | [
"function",
"filterByVersion",
"(",
"browsers",
",",
"version",
")",
"{",
"version",
"=",
"String",
"(",
"version",
")",
";",
"if",
"(",
"version",
"===",
"'latest'",
"||",
"version",
"===",
"'oldest'",
")",
"{",
"const",
"filtered",
"=",
"numericVersions",
... | Filter out entries whose version does not match a given version from a
list of objects describing the OS and browser platforms on Sauce Labs.
@param {Array} browsers The array to filter
@param {(Number|String)} version The version to test against
@return {Array} The filtered array
@private | [
"Filter",
"out",
"entries",
"whose",
"version",
"does",
"not",
"match",
"a",
"given",
"version",
"from",
"a",
"list",
"of",
"objects",
"describing",
"the",
"OS",
"and",
"browser",
"platforms",
"on",
"Sauce",
"Labs",
"."
] | 3fe31c326971dd6cf025030664bbfb83ff9c9a3a | https://github.com/lpinca/sauce-browsers/blob/3fe31c326971dd6cf025030664bbfb83ff9c9a3a/index.js#L41-L78 |
47,929 | lpinca/sauce-browsers | index.js | transform | function transform(wanted, available) {
const browsers = new Set();
wanted.forEach((browser) => {
const name = browser.name.toLowerCase();
if (!available.has(name)) {
throw new Error(`Browser ${name} is not available`);
}
let list = available.get(name).slice().sort(compare);
let platfor... | javascript | function transform(wanted, available) {
const browsers = new Set();
wanted.forEach((browser) => {
const name = browser.name.toLowerCase();
if (!available.has(name)) {
throw new Error(`Browser ${name} is not available`);
}
let list = available.get(name).slice().sort(compare);
let platfor... | [
"function",
"transform",
"(",
"wanted",
",",
"available",
")",
"{",
"const",
"browsers",
"=",
"new",
"Set",
"(",
")",
";",
"wanted",
".",
"forEach",
"(",
"(",
"browser",
")",
"=>",
"{",
"const",
"name",
"=",
"browser",
".",
"name",
".",
"toLowerCase",
... | Convert a list of platforms in "zuul" format to a list of platforms in
the same format returned by Sauce Labs REST API.
@param {Array} available The list of all supported platforms on Sauce Labs
@param {Array} wanted The list of platforms in "zuul" format
@return {Array} The transformed list
@private | [
"Convert",
"a",
"list",
"of",
"platforms",
"in",
"zuul",
"format",
"to",
"a",
"list",
"of",
"platforms",
"in",
"the",
"same",
"format",
"returned",
"by",
"Sauce",
"Labs",
"REST",
"API",
"."
] | 3fe31c326971dd6cf025030664bbfb83ff9c9a3a | https://github.com/lpinca/sauce-browsers/blob/3fe31c326971dd6cf025030664bbfb83ff9c9a3a/index.js#L89-L137 |
47,930 | lpinca/sauce-browsers | index.js | aggregate | function aggregate(browsers) {
const map = new Map();
browsers.forEach((browser) => {
const name = browser.api_name.toLowerCase();
let value = map.get(name);
if (value === undefined) {
value = [];
map.set(name, value);
}
value.push(browser);
});
const ie = map.get('internet e... | javascript | function aggregate(browsers) {
const map = new Map();
browsers.forEach((browser) => {
const name = browser.api_name.toLowerCase();
let value = map.get(name);
if (value === undefined) {
value = [];
map.set(name, value);
}
value.push(browser);
});
const ie = map.get('internet e... | [
"function",
"aggregate",
"(",
"browsers",
")",
"{",
"const",
"map",
"=",
"new",
"Map",
"(",
")",
";",
"browsers",
".",
"forEach",
"(",
"(",
"browser",
")",
"=>",
"{",
"const",
"name",
"=",
"browser",
".",
"api_name",
".",
"toLowerCase",
"(",
")",
";"... | Aggregate a list of platforms by `api_name`.
@param {Array} browsers The list of platforms supported on Sauce Labs
@return {Map} Aggregated list
@private | [
"Aggregate",
"a",
"list",
"of",
"platforms",
"by",
"api_name",
"."
] | 3fe31c326971dd6cf025030664bbfb83ff9c9a3a | https://github.com/lpinca/sauce-browsers/blob/3fe31c326971dd6cf025030664bbfb83ff9c9a3a/index.js#L146-L167 |
47,931 | lpinca/sauce-browsers | index.js | sauceBrowsers | function sauceBrowsers(wanted) {
return got({
path: '/rest/v1/info/platforms/webdriver',
hostname: 'saucelabs.com',
protocol: 'https:',
json: true
}).then((res) => {
if (wanted === undefined) return res.body;
return transform(wanted, aggregate(res.body));
});
} | javascript | function sauceBrowsers(wanted) {
return got({
path: '/rest/v1/info/platforms/webdriver',
hostname: 'saucelabs.com',
protocol: 'https:',
json: true
}).then((res) => {
if (wanted === undefined) return res.body;
return transform(wanted, aggregate(res.body));
});
} | [
"function",
"sauceBrowsers",
"(",
"wanted",
")",
"{",
"return",
"got",
"(",
"{",
"path",
":",
"'/rest/v1/info/platforms/webdriver'",
",",
"hostname",
":",
"'saucelabs.com'",
",",
"protocol",
":",
"'https:'",
",",
"json",
":",
"true",
"}",
")",
".",
"then",
"... | Get a list of objects describing the OS and browser platforms on Sauce Labs
using the "zuul" format.
@param {Array} wanted The list of wanted platforms in "zuul" format
@return {Promise} Promise which is fulfilled with the list
@public | [
"Get",
"a",
"list",
"of",
"objects",
"describing",
"the",
"OS",
"and",
"browser",
"platforms",
"on",
"Sauce",
"Labs",
"using",
"the",
"zuul",
"format",
"."
] | 3fe31c326971dd6cf025030664bbfb83ff9c9a3a | https://github.com/lpinca/sauce-browsers/blob/3fe31c326971dd6cf025030664bbfb83ff9c9a3a/index.js#L177-L188 |
47,932 | oliversalzburg/absync | dist/development/absync.concat.js | AbsyncProvider | function AbsyncProvider( $provide, absyncCache ) {
var self = this;
// Store a reference to the provide provider.
self.__provide = $provide;
// Store a reference to the cache service constructor.
self.__absyncCache = absyncCache;
// A reference to the socket.io instance we're using to receive updates from t... | javascript | function AbsyncProvider( $provide, absyncCache ) {
var self = this;
// Store a reference to the provide provider.
self.__provide = $provide;
// Store a reference to the cache service constructor.
self.__absyncCache = absyncCache;
// A reference to the socket.io instance we're using to receive updates from t... | [
"function",
"AbsyncProvider",
"(",
"$provide",
",",
"absyncCache",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Store a reference to the provide provider.",
"self",
".",
"__provide",
"=",
"$provide",
";",
"// Store a reference to the cache service constructor.",
"self",
... | Retrieves the absync provider.
@param {angular.auto.IProvideService|Object} $provide The $provide provider.
@param {Function} absyncCache The AbsyncCache service constructor.
@constructor | [
"Retrieves",
"the",
"absync",
"provider",
"."
] | 13807648d513c77008951446cfa1b334a2ab2ccf | https://github.com/oliversalzburg/absync/blob/13807648d513c77008951446cfa1b334a2ab2ccf/dist/development/absync.concat.js#L42-L71 |
47,933 | oliversalzburg/absync | dist/development/absync.concat.js | onCollectionReceived | function onCollectionReceived( serverResponse ) {
if( !serverResponse.data[ configuration.collectionName ] ) {
throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.collectionName + "'." );
}
self.__entityCacheRaw = serverResponse.d... | javascript | function onCollectionReceived( serverResponse ) {
if( !serverResponse.data[ configuration.collectionName ] ) {
throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.collectionName + "'." );
}
self.__entityCacheRaw = serverResponse.d... | [
"function",
"onCollectionReceived",
"(",
"serverResponse",
")",
"{",
"if",
"(",
"!",
"serverResponse",
".",
"data",
"[",
"configuration",
".",
"collectionName",
"]",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"The response from the server was not in the expected format. ... | Invoked when the collection was received from the server.
@param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server. | [
"Invoked",
"when",
"the",
"collection",
"was",
"received",
"from",
"the",
"server",
"."
] | 13807648d513c77008951446cfa1b334a2ab2ccf | https://github.com/oliversalzburg/absync/blob/13807648d513c77008951446cfa1b334a2ab2ccf/dist/development/absync.concat.js#L699-L707 |
47,934 | oliversalzburg/absync | dist/development/absync.concat.js | onCollectionRetrievalFailure | function onCollectionRetrievalFailure( serverResponse ) {
self.logInterface.error( self.logPrefix + "Unable to retrieve the collection from the server.",
serverResponse );
self.__entityCacheRaw = null;
self.scope.$emit( "absyncError", serverResponse );
if( self.throwFailures ) {
throw serverRespon... | javascript | function onCollectionRetrievalFailure( serverResponse ) {
self.logInterface.error( self.logPrefix + "Unable to retrieve the collection from the server.",
serverResponse );
self.__entityCacheRaw = null;
self.scope.$emit( "absyncError", serverResponse );
if( self.throwFailures ) {
throw serverRespon... | [
"function",
"onCollectionRetrievalFailure",
"(",
"serverResponse",
")",
"{",
"self",
".",
"logInterface",
".",
"error",
"(",
"self",
".",
"logPrefix",
"+",
"\"Unable to retrieve the collection from the server.\"",
",",
"serverResponse",
")",
";",
"self",
".",
"__entityC... | Invoked when there was an error while trying to retrieve the collection from the server.
@param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server. | [
"Invoked",
"when",
"there",
"was",
"an",
"error",
"while",
"trying",
"to",
"retrieve",
"the",
"collection",
"from",
"the",
"server",
"."
] | 13807648d513c77008951446cfa1b334a2ab2ccf | https://github.com/oliversalzburg/absync/blob/13807648d513c77008951446cfa1b334a2ab2ccf/dist/development/absync.concat.js#L713-L723 |
47,935 | oliversalzburg/absync | dist/development/absync.concat.js | onSingleEntityReceived | function onSingleEntityReceived( serverResponse ) {
if( !serverResponse.data[ configuration.entityName ] ) {
throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.entityName + "'." );
}
self.__entityCacheRaw = serverResponse.data;
... | javascript | function onSingleEntityReceived( serverResponse ) {
if( !serverResponse.data[ configuration.entityName ] ) {
throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.entityName + "'." );
}
self.__entityCacheRaw = serverResponse.data;
... | [
"function",
"onSingleEntityReceived",
"(",
"serverResponse",
")",
"{",
"if",
"(",
"!",
"serverResponse",
".",
"data",
"[",
"configuration",
".",
"entityName",
"]",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"The response from the server was not in the expected format. It... | Invoked when the entity was received from the server.
@param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server. | [
"Invoked",
"when",
"the",
"entity",
"was",
"received",
"from",
"the",
"server",
"."
] | 13807648d513c77008951446cfa1b334a2ab2ccf | https://github.com/oliversalzburg/absync/blob/13807648d513c77008951446cfa1b334a2ab2ccf/dist/development/absync.concat.js#L729-L736 |
47,936 | oliversalzburg/absync | dist/development/absync.concat.js | onEntityRetrieved | function onEntityRetrieved( serverResponse ) {
if( !serverResponse.data[ configuration.entityName ] ) {
throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.entityName + "'." );
}
var rawEntity = serverResponse.data[ configuration.... | javascript | function onEntityRetrieved( serverResponse ) {
if( !serverResponse.data[ configuration.entityName ] ) {
throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.entityName + "'." );
}
var rawEntity = serverResponse.data[ configuration.... | [
"function",
"onEntityRetrieved",
"(",
"serverResponse",
")",
"{",
"if",
"(",
"!",
"serverResponse",
".",
"data",
"[",
"configuration",
".",
"entityName",
"]",
")",
"{",
"throw",
"new",
"Error",
"(",
"\"The response from the server was not in the expected format. It shou... | Invoked when the entity was retrieved from the server.
@param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server. | [
"Invoked",
"when",
"the",
"entity",
"was",
"retrieved",
"from",
"the",
"server",
"."
] | 13807648d513c77008951446cfa1b334a2ab2ccf | https://github.com/oliversalzburg/absync/blob/13807648d513c77008951446cfa1b334a2ab2ccf/dist/development/absync.concat.js#L889-L910 |
47,937 | oliversalzburg/absync | dist/development/absync.concat.js | onEntityRetrievalFailure | function onEntityRetrievalFailure( serverResponse ) {
self.logInterface.error( self.logPrefix + "Unable to retrieve entity with ID '" + id + "' from the server.",
serverResponse );
self.scope.$emit( "absyncError", serverResponse );
if( self.throwFailures ) {
throw serverResponse;
}
} | javascript | function onEntityRetrievalFailure( serverResponse ) {
self.logInterface.error( self.logPrefix + "Unable to retrieve entity with ID '" + id + "' from the server.",
serverResponse );
self.scope.$emit( "absyncError", serverResponse );
if( self.throwFailures ) {
throw serverResponse;
}
} | [
"function",
"onEntityRetrievalFailure",
"(",
"serverResponse",
")",
"{",
"self",
".",
"logInterface",
".",
"error",
"(",
"self",
".",
"logPrefix",
"+",
"\"Unable to retrieve entity with ID '\"",
"+",
"id",
"+",
"\"' from the server.\"",
",",
"serverResponse",
")",
";"... | Invoked when there was an error while trying to retrieve the entity from the server.
@param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server. | [
"Invoked",
"when",
"there",
"was",
"an",
"error",
"while",
"trying",
"to",
"retrieve",
"the",
"entity",
"from",
"the",
"server",
"."
] | 13807648d513c77008951446cfa1b334a2ab2ccf | https://github.com/oliversalzburg/absync/blob/13807648d513c77008951446cfa1b334a2ab2ccf/dist/development/absync.concat.js#L916-L924 |
47,938 | oliversalzburg/absync | dist/development/absync.concat.js | afterEntityStored | function afterEntityStored( returnResult, serverResponse ) {
var self = this;
// Writing an entity to the backend will usually invoke an update event to be
// broadcast over websockets, where we would also retrieve the updated record.
// We still put the updated record we receive here into the cache to ensure ... | javascript | function afterEntityStored( returnResult, serverResponse ) {
var self = this;
// Writing an entity to the backend will usually invoke an update event to be
// broadcast over websockets, where we would also retrieve the updated record.
// We still put the updated record we receive here into the cache to ensure ... | [
"function",
"afterEntityStored",
"(",
"returnResult",
",",
"serverResponse",
")",
"{",
"var",
"self",
"=",
"this",
";",
"// Writing an entity to the backend will usually invoke an update event to be",
"// broadcast over websockets, where we would also retrieve the updated record.",
"//... | Invoked when the entity was stored on the server.
@param {Boolean} returnResult Should we return the parsed entity that is contained in the response?
@param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server. | [
"Invoked",
"when",
"the",
"entity",
"was",
"stored",
"on",
"the",
"server",
"."
] | 13807648d513c77008951446cfa1b334a2ab2ccf | https://github.com/oliversalzburg/absync/blob/13807648d513c77008951446cfa1b334a2ab2ccf/dist/development/absync.concat.js#L1033-L1058 |
47,939 | oliversalzburg/absync | dist/development/absync.concat.js | onEntityStorageFailure | function onEntityStorageFailure( serverResponse ) {
var self = this;
self.logInterface.error( self.logPrefix + "Unable to store entity on the server.",
serverResponse );
self.logInterface.error( serverResponse );
self.scope.$emit( "absyncError", serverResponse );
if( self.throwFailures ) {
throw serve... | javascript | function onEntityStorageFailure( serverResponse ) {
var self = this;
self.logInterface.error( self.logPrefix + "Unable to store entity on the server.",
serverResponse );
self.logInterface.error( serverResponse );
self.scope.$emit( "absyncError", serverResponse );
if( self.throwFailures ) {
throw serve... | [
"function",
"onEntityStorageFailure",
"(",
"serverResponse",
")",
"{",
"var",
"self",
"=",
"this",
";",
"self",
".",
"logInterface",
".",
"error",
"(",
"self",
".",
"logPrefix",
"+",
"\"Unable to store entity on the server.\"",
",",
"serverResponse",
")",
";",
"se... | Invoked when there was an error while trying to store the entity on the server.
@param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server. | [
"Invoked",
"when",
"there",
"was",
"an",
"error",
"while",
"trying",
"to",
"store",
"the",
"entity",
"on",
"the",
"server",
"."
] | 13807648d513c77008951446cfa1b334a2ab2ccf | https://github.com/oliversalzburg/absync/blob/13807648d513c77008951446cfa1b334a2ab2ccf/dist/development/absync.concat.js#L1064-L1075 |
47,940 | oliversalzburg/absync | dist/development/absync.concat.js | onEntityDeleted | function onEntityDeleted( serverResponse ) {
self.__cacheMaintain( self.__entityCacheRaw[ configuration.collectionName || configuration.entityName ],
entity,
"delete",
false );
return self.__removeEntityFromCache( entityId );
} | javascript | function onEntityDeleted( serverResponse ) {
self.__cacheMaintain( self.__entityCacheRaw[ configuration.collectionName || configuration.entityName ],
entity,
"delete",
false );
return self.__removeEntityFromCache( entityId );
} | [
"function",
"onEntityDeleted",
"(",
"serverResponse",
")",
"{",
"self",
".",
"__cacheMaintain",
"(",
"self",
".",
"__entityCacheRaw",
"[",
"configuration",
".",
"collectionName",
"||",
"configuration",
".",
"entityName",
"]",
",",
"entity",
",",
"\"delete\"",
",",... | Invoked when the entity was successfully deleted from the server.
@param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server. | [
"Invoked",
"when",
"the",
"entity",
"was",
"successfully",
"deleted",
"from",
"the",
"server",
"."
] | 13807648d513c77008951446cfa1b334a2ab2ccf | https://github.com/oliversalzburg/absync/blob/13807648d513c77008951446cfa1b334a2ab2ccf/dist/development/absync.concat.js#L1094-L1101 |
47,941 | oliversalzburg/absync | dist/development/absync.concat.js | onEntityDeletionFailed | function onEntityDeletionFailed( serverResponse ) {
self.logInterface.error( serverResponse.data );
self.scope.$emit( "absyncError", serverResponse );
if( self.throwFailures ) {
throw serverResponse;
}
} | javascript | function onEntityDeletionFailed( serverResponse ) {
self.logInterface.error( serverResponse.data );
self.scope.$emit( "absyncError", serverResponse );
if( self.throwFailures ) {
throw serverResponse;
}
} | [
"function",
"onEntityDeletionFailed",
"(",
"serverResponse",
")",
"{",
"self",
".",
"logInterface",
".",
"error",
"(",
"serverResponse",
".",
"data",
")",
";",
"self",
".",
"scope",
".",
"$emit",
"(",
"\"absyncError\"",
",",
"serverResponse",
")",
";",
"if",
... | Invoked when there was an error while trying to delete the entity from the server.
@param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server. | [
"Invoked",
"when",
"there",
"was",
"an",
"error",
"while",
"trying",
"to",
"delete",
"the",
"entity",
"from",
"the",
"server",
"."
] | 13807648d513c77008951446cfa1b334a2ab2ccf | https://github.com/oliversalzburg/absync/blob/13807648d513c77008951446cfa1b334a2ab2ccf/dist/development/absync.concat.js#L1107-L1114 |
47,942 | jhermsmeier/node-apple-data-compression | lib/decompress.js | decompress | function decompress( buffer ) {
var chunks = []
var chunkType = ADC.CHUNK_UNKNOWN
var position = 0
var length = 0
windowOffset = 0
while( position < buffer.length ) {
chunkType = ADC.getChunkType( buffer[ position ] )
length = ADC.getSequenceLength( buffer[ position ] )
switch( chunkType ) {
... | javascript | function decompress( buffer ) {
var chunks = []
var chunkType = ADC.CHUNK_UNKNOWN
var position = 0
var length = 0
windowOffset = 0
while( position < buffer.length ) {
chunkType = ADC.getChunkType( buffer[ position ] )
length = ADC.getSequenceLength( buffer[ position ] )
switch( chunkType ) {
... | [
"function",
"decompress",
"(",
"buffer",
")",
"{",
"var",
"chunks",
"=",
"[",
"]",
"var",
"chunkType",
"=",
"ADC",
".",
"CHUNK_UNKNOWN",
"var",
"position",
"=",
"0",
"var",
"length",
"=",
"0",
"windowOffset",
"=",
"0",
"while",
"(",
"position",
"<",
"b... | Decompress an ADC compressed buffer
@param {Buffer} buffer
@returns {Buffer} | [
"Decompress",
"an",
"ADC",
"compressed",
"buffer"
] | 914ad4625754d1c77b76345845b24227c8a55181 | https://github.com/jhermsmeier/node-apple-data-compression/blob/914ad4625754d1c77b76345845b24227c8a55181/lib/decompress.js#L65-L95 |
47,943 | scttnlsn/mongoose-denormalize | lib/index.js | function(schema, from) {
return function(next) {
var self = this;
var funcs = [];
for (var key in from) {
var items = from[key];
var model = mongoose.model(schema.path(key).options.ref);
funcs.push(function(callback) {
model.f... | javascript | function(schema, from) {
return function(next) {
var self = this;
var funcs = [];
for (var key in from) {
var items = from[key];
var model = mongoose.model(schema.path(key).options.ref);
funcs.push(function(callback) {
model.f... | [
"function",
"(",
"schema",
",",
"from",
")",
"{",
"return",
"function",
"(",
"next",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"funcs",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"key",
"in",
"from",
")",
"{",
"var",
"items",
"=",
"from",
"... | Denormalize values from foreign refs into local model | [
"Denormalize",
"values",
"from",
"foreign",
"refs",
"into",
"local",
"model"
] | 81b7bf73412aff119bfc49020cf63be9933df547 | https://github.com/scttnlsn/mongoose-denormalize/blob/81b7bf73412aff119bfc49020cf63be9933df547/lib/index.js#L5-L32 | |
47,944 | archilogic-com/instant-api | lib/json-rpc2-server.js | function (result) {
// don't send a second response
if (responseHasBeenSent) {
console.warn('JSON-RPC2 response has already been sent.')
return
}
// notifications should not send error responses (JSON-RPC2 specs)
if (!isMethodCall) {
logNotificationResponseWarning(... | javascript | function (result) {
// don't send a second response
if (responseHasBeenSent) {
console.warn('JSON-RPC2 response has already been sent.')
return
}
// notifications should not send error responses (JSON-RPC2 specs)
if (!isMethodCall) {
logNotificationResponseWarning(... | [
"function",
"(",
"result",
")",
"{",
"// don't send a second response",
"if",
"(",
"responseHasBeenSent",
")",
"{",
"console",
".",
"warn",
"(",
"'JSON-RPC2 response has already been sent.'",
")",
"return",
"}",
"// notifications should not send error responses (JSON-RPC2 specs... | create send result handler | [
"create",
"send",
"result",
"handler"
] | a47728312e283136a24933f250aabb0be867cb2f | https://github.com/archilogic-com/instant-api/blob/a47728312e283136a24933f250aabb0be867cb2f/lib/json-rpc2-server.js#L198-L227 | |
47,945 | archilogic-com/instant-api | lib/json-rpc2-server.js | function (method, result) {
// result should not be undefined
if (result === undefined) {
console.warn('JSON-RPC2 response from method ' + methodName + ' should return a result. (JSON-RPC2 spec)')
result = ''
}
var rpcMessage = {
jsonrpc: '2.0',
result: result,
... | javascript | function (method, result) {
// result should not be undefined
if (result === undefined) {
console.warn('JSON-RPC2 response from method ' + methodName + ' should return a result. (JSON-RPC2 spec)')
result = ''
}
var rpcMessage = {
jsonrpc: '2.0',
result: result,
... | [
"function",
"(",
"method",
",",
"result",
")",
"{",
"// result should not be undefined",
"if",
"(",
"result",
"===",
"undefined",
")",
"{",
"console",
".",
"warn",
"(",
"'JSON-RPC2 response from method '",
"+",
"methodName",
"+",
"' should return a result. (JSON-RPC2 sp... | create send message method | [
"create",
"send",
"message",
"method"
] | a47728312e283136a24933f250aabb0be867cb2f | https://github.com/archilogic-com/instant-api/blob/a47728312e283136a24933f250aabb0be867cb2f/lib/json-rpc2-server.js#L230-L247 | |
47,946 | archilogic-com/instant-api | lib/json-rpc2-server.js | function (error, type) {
// don't send a second response
if (responseHasBeenSent) {
console.warn('JSON-RPC2 response has already been sent.')
return
}
// notifications should not send error responses (JSON-RPC2 specs)
if (!isMethodCall) {
var message = (error && er... | javascript | function (error, type) {
// don't send a second response
if (responseHasBeenSent) {
console.warn('JSON-RPC2 response has already been sent.')
return
}
// notifications should not send error responses (JSON-RPC2 specs)
if (!isMethodCall) {
var message = (error && er... | [
"function",
"(",
"error",
",",
"type",
")",
"{",
"// don't send a second response",
"if",
"(",
"responseHasBeenSent",
")",
"{",
"console",
".",
"warn",
"(",
"'JSON-RPC2 response has already been sent.'",
")",
"return",
"}",
"// notifications should not send error responses ... | create send error handler | [
"create",
"send",
"error",
"handler"
] | a47728312e283136a24933f250aabb0be867cb2f | https://github.com/archilogic-com/instant-api/blob/a47728312e283136a24933f250aabb0be867cb2f/lib/json-rpc2-server.js#L250-L322 | |
47,947 | e-picas/grunt-nunjucks-render | lib/lib.js | merge | function merge(obj1, obj2)
{
var obj3 = {}, index;
for (index in obj1) {
obj3[index] = obj1[index];
}
for (index in obj2) {
obj3[index] = obj2[index];
}
return obj3;
} | javascript | function merge(obj1, obj2)
{
var obj3 = {}, index;
for (index in obj1) {
obj3[index] = obj1[index];
}
for (index in obj2) {
obj3[index] = obj2[index];
}
return obj3;
} | [
"function",
"merge",
"(",
"obj1",
",",
"obj2",
")",
"{",
"var",
"obj3",
"=",
"{",
"}",
",",
"index",
";",
"for",
"(",
"index",
"in",
"obj1",
")",
"{",
"obj3",
"[",
"index",
"]",
"=",
"obj1",
"[",
"index",
"]",
";",
"}",
"for",
"(",
"index",
"... | merge two objects with priority on second | [
"merge",
"two",
"objects",
"with",
"priority",
"on",
"second"
] | eab88e5ef943755853c2250f4df68398401ed0ab | https://github.com/e-picas/grunt-nunjucks-render/blob/eab88e5ef943755853c2250f4df68398401ed0ab/lib/lib.js#L27-L37 |
47,948 | e-picas/grunt-nunjucks-render | lib/lib.js | parseData | function parseData(data)
{
var tmp_data = {};
if (nlib.isString(data)) {
if (data.match(/\.json/i) && grunt.file.exists(data)) {
tmp_data = grunt.file.readJSON(data);
} else if (data.match(/\.ya?ml/i) && grunt.file.exists(data)) {
tmp_data = grunt.file.readYAML(data);
... | javascript | function parseData(data)
{
var tmp_data = {};
if (nlib.isString(data)) {
if (data.match(/\.json/i) && grunt.file.exists(data)) {
tmp_data = grunt.file.readJSON(data);
} else if (data.match(/\.ya?ml/i) && grunt.file.exists(data)) {
tmp_data = grunt.file.readYAML(data);
... | [
"function",
"parseData",
"(",
"data",
")",
"{",
"var",
"tmp_data",
"=",
"{",
"}",
";",
"if",
"(",
"nlib",
".",
"isString",
"(",
"data",
")",
")",
"{",
"if",
"(",
"data",
".",
"match",
"(",
"/",
"\\.json",
"/",
"i",
")",
"&&",
"grunt",
".",
"fil... | prepare data parsing JSON or YAML file if so | [
"prepare",
"data",
"parsing",
"JSON",
"or",
"YAML",
"file",
"if",
"so"
] | eab88e5ef943755853c2250f4df68398401ed0ab | https://github.com/e-picas/grunt-nunjucks-render/blob/eab88e5ef943755853c2250f4df68398401ed0ab/lib/lib.js#L41-L67 |
47,949 | joneit/filter-tree | js/Conditionals.js | inOp | function inOp(a, b) {
return b
.trim() // remove leading and trailing space chars
.replace(/\s*,\s*/g, ',') // remove any white-space chars from around commas
.split(',') // put in an array
.indexOf((a + '')); // search array whole matches
} | javascript | function inOp(a, b) {
return b
.trim() // remove leading and trailing space chars
.replace(/\s*,\s*/g, ',') // remove any white-space chars from around commas
.split(',') // put in an array
.indexOf((a + '')); // search array whole matches
} | [
"function",
"inOp",
"(",
"a",
",",
"b",
")",
"{",
"return",
"b",
".",
"trim",
"(",
")",
"// remove leading and trailing space chars",
".",
"replace",
"(",
"/",
"\\s*,\\s*",
"/",
"g",
",",
"','",
")",
"// remove any white-space chars from around commas",
".",
"sp... | UNICODE 'NOT EQUAL TO' | [
"UNICODE",
"NOT",
"EQUAL",
"TO"
] | c070a4045fced3e4ab20ed2e0c706c9a5fd07d1e | https://github.com/joneit/filter-tree/blob/c070a4045fced3e4ab20ed2e0c706c9a5fd07d1e/js/Conditionals.js#L238-L244 |
47,950 | adplabs/PigeonKeeper | lib/genericService.js | GenericService | function GenericService(serviceId)
{
var self = this;
var id = serviceId;
var data = {};
/**
* Method called by PK
*
* @param {Object} sharedData - Data object that gets passed-around by PK
*/
this.doStuff = function (sharedData)
{
console.log("In service #" + id + "... | javascript | function GenericService(serviceId)
{
var self = this;
var id = serviceId;
var data = {};
/**
* Method called by PK
*
* @param {Object} sharedData - Data object that gets passed-around by PK
*/
this.doStuff = function (sharedData)
{
console.log("In service #" + id + "... | [
"function",
"GenericService",
"(",
"serviceId",
")",
"{",
"var",
"self",
"=",
"this",
";",
"var",
"id",
"=",
"serviceId",
";",
"var",
"data",
"=",
"{",
"}",
";",
"/**\n * Method called by PK\n *\n * @param {Object} sharedData - Data object that gets passed-aro... | "3"
Event emitter; this code is to be used as a sample of how to implement an event emitter for use with PigeonKeeper
@constructor
@param {string} serviceId - ID of the service
@fires "success"
@fires "error" | [
"3",
"Event",
"emitter",
";",
"this",
"code",
"is",
"to",
"be",
"used",
"as",
"a",
"sample",
"of",
"how",
"to",
"implement",
"an",
"event",
"emitter",
"for",
"use",
"with",
"PigeonKeeper"
] | c0a92d2032415617c2b6f6bd49d00a2c59bfaa41 | https://github.com/adplabs/PigeonKeeper/blob/c0a92d2032415617c2b6f6bd49d00a2c59bfaa41/lib/genericService.js#L13-L73 |
47,951 | Kurento/kurento-module-crowddetector-js | lib/complexTypes/RegionOfInterestConfig.js | RegionOfInterestConfig | function RegionOfInterestConfig(regionOfInterestConfigDict){
if(!(this instanceof RegionOfInterestConfig))
return new RegionOfInterestConfig(regionOfInterestConfigDict)
regionOfInterestConfigDict = regionOfInterestConfigDict || {}
// Check regionOfInterestConfigDict has the required fields
//
// checkT... | javascript | function RegionOfInterestConfig(regionOfInterestConfigDict){
if(!(this instanceof RegionOfInterestConfig))
return new RegionOfInterestConfig(regionOfInterestConfigDict)
regionOfInterestConfigDict = regionOfInterestConfigDict || {}
// Check regionOfInterestConfigDict has the required fields
//
// checkT... | [
"function",
"RegionOfInterestConfig",
"(",
"regionOfInterestConfigDict",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"RegionOfInterestConfig",
")",
")",
"return",
"new",
"RegionOfInterestConfig",
"(",
"regionOfInterestConfigDict",
")",
"regionOfInterestConfigDict",... | data structure for configuration of CrowdDetector regions of interest
@constructor module:crowddetector/complexTypes.RegionOfInterestConfig
@property {external:Integer} occupancyLevelMin
minimun occupancy percentage in the ROI to send occupancy events
@property {external:Integer} occupancyLevelMed
send occupancy leve... | [
"data",
"structure",
"for",
"configuration",
"of",
"CrowdDetector",
"regions",
"of",
"interest"
] | ae0a03c5d6bbc07a23d083fe8916017cb4a63855 | https://github.com/Kurento/kurento-module-crowddetector-js/blob/ae0a03c5d6bbc07a23d083fe8916017cb4a63855/lib/complexTypes/RegionOfInterestConfig.js#L74-L173 |
47,952 | smartface/sf-component-calendar | scripts/components/CalendarCore.js | getInitialState | function getInitialState() {
return {
month: {},
day: {},
rangeSelection: null,
rangeSelectionMode: RangeSelection.IDLE,
selectedDays: [],
selectedDaysByIndex: [],
weekIndex: 0
};
} | javascript | function getInitialState() {
return {
month: {},
day: {},
rangeSelection: null,
rangeSelectionMode: RangeSelection.IDLE,
selectedDays: [],
selectedDaysByIndex: [],
weekIndex: 0
};
} | [
"function",
"getInitialState",
"(",
")",
"{",
"return",
"{",
"month",
":",
"{",
"}",
",",
"day",
":",
"{",
"}",
",",
"rangeSelection",
":",
"null",
",",
"rangeSelectionMode",
":",
"RangeSelection",
".",
"IDLE",
",",
"selectedDays",
":",
"[",
"]",
",",
... | Returns initial state
@returns {object} | [
"Returns",
"initial",
"state"
] | d6c8310564ff551b9424ac6955efa5e8cf5f8dff | https://github.com/smartface/sf-component-calendar/blob/d6c8310564ff551b9424ac6955efa5e8cf5f8dff/scripts/components/CalendarCore.js#L16-L26 |
47,953 | smartface/sf-component-calendar | scripts/components/CalendarCore.js | calculateDatePos | function calculateDatePos(startDayOfMonth, day) {
const start = startDayOfMonth - 1;
day = day - 1;
const weekDayIndex = (start + day) % WEEKDAYS;
const weekIndex = Math.ceil((start + day + 1) / WEEKDAYS) - 1;
return {
weekIndex,
weekDayIndex
};
} | javascript | function calculateDatePos(startDayOfMonth, day) {
const start = startDayOfMonth - 1;
day = day - 1;
const weekDayIndex = (start + day) % WEEKDAYS;
const weekIndex = Math.ceil((start + day + 1) / WEEKDAYS) - 1;
return {
weekIndex,
weekDayIndex
};
} | [
"function",
"calculateDatePos",
"(",
"startDayOfMonth",
",",
"day",
")",
"{",
"const",
"start",
"=",
"startDayOfMonth",
"-",
"1",
";",
"day",
"=",
"day",
"-",
"1",
";",
"const",
"weekDayIndex",
"=",
"(",
"start",
"+",
"day",
")",
"%",
"WEEKDAYS",
";",
... | Calcucalte given day's week and weekday index
@param {number} startDayOfMonth
@param {number} day | [
"Calcucalte",
"given",
"day",
"s",
"week",
"and",
"weekday",
"index"
] | d6c8310564ff551b9424ac6955efa5e8cf5f8dff | https://github.com/smartface/sf-component-calendar/blob/d6c8310564ff551b9424ac6955efa5e8cf5f8dff/scripts/components/CalendarCore.js#L59-L68 |
47,954 | smartface/sf-component-calendar | scripts/components/CalendarCore.js | getDateData | function getDateData(date, month) {
const pos = getDatePos(date, month);
if (pos === null) {
throw new TypeError(JSON.stringify(date) + " is invalid format.");
}
return getDayData(pos.weekIndex, pos.weekDayIndex, month);
} | javascript | function getDateData(date, month) {
const pos = getDatePos(date, month);
if (pos === null) {
throw new TypeError(JSON.stringify(date) + " is invalid format.");
}
return getDayData(pos.weekIndex, pos.weekDayIndex, month);
} | [
"function",
"getDateData",
"(",
"date",
",",
"month",
")",
"{",
"const",
"pos",
"=",
"getDatePos",
"(",
"date",
",",
"month",
")",
";",
"if",
"(",
"pos",
"===",
"null",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"JSON",
".",
"stringify",
"(",
"date"... | Gets specified date's info data in specified month.
@param {object} date
@param {object} month
@throw {TypeError}
@returns {Calendar~DateInfo} | [
"Gets",
"specified",
"date",
"s",
"info",
"data",
"in",
"specified",
"month",
"."
] | d6c8310564ff551b9424ac6955efa5e8cf5f8dff | https://github.com/smartface/sf-component-calendar/blob/d6c8310564ff551b9424ac6955efa5e8cf5f8dff/scripts/components/CalendarCore.js#L107-L115 |
47,955 | smartface/sf-component-calendar | scripts/components/CalendarCore.js | getDayData | function getDayData(weekIndex, weekDayIndex, currentMonth) {
const dayData = {};
if (!currentMonth || !currentMonth.days || currentMonth.days[weekIndex] === undefined) {
throw new TypeError("WeekIndex : " + weekIndex + ", weekDayIndex " + weekDayIndex + " selected day cannot be undefined");
}
const selectedDay ... | javascript | function getDayData(weekIndex, weekDayIndex, currentMonth) {
const dayData = {};
if (!currentMonth || !currentMonth.days || currentMonth.days[weekIndex] === undefined) {
throw new TypeError("WeekIndex : " + weekIndex + ", weekDayIndex " + weekDayIndex + " selected day cannot be undefined");
}
const selectedDay ... | [
"function",
"getDayData",
"(",
"weekIndex",
",",
"weekDayIndex",
",",
"currentMonth",
")",
"{",
"const",
"dayData",
"=",
"{",
"}",
";",
"if",
"(",
"!",
"currentMonth",
"||",
"!",
"currentMonth",
".",
"days",
"||",
"currentMonth",
".",
"days",
"[",
"weekInd... | Select specified day
@private | [
"Select",
"specified",
"day"
] | d6c8310564ff551b9424ac6955efa5e8cf5f8dff | https://github.com/smartface/sf-component-calendar/blob/d6c8310564ff551b9424ac6955efa5e8cf5f8dff/scripts/components/CalendarCore.js#L123-L191 |
47,956 | smartface/sf-component-calendar | scripts/components/CalendarCore.js | getDatePos | function getDatePos(date, month, notValue = null) {
const monthPos = (date.month === month.date.month && 'current') ||
(date.month === month.nextMonth.date.month && 'next') ||
(date.month === month.previousMonth.date.month && 'prev');
switch (monthPos) {
case 'current':
return calculateDatePos(month.start... | javascript | function getDatePos(date, month, notValue = null) {
const monthPos = (date.month === month.date.month && 'current') ||
(date.month === month.nextMonth.date.month && 'next') ||
(date.month === month.previousMonth.date.month && 'prev');
switch (monthPos) {
case 'current':
return calculateDatePos(month.start... | [
"function",
"getDatePos",
"(",
"date",
",",
"month",
",",
"notValue",
"=",
"null",
")",
"{",
"const",
"monthPos",
"=",
"(",
"date",
".",
"month",
"===",
"month",
".",
"date",
".",
"month",
"&&",
"'current'",
")",
"||",
"(",
"date",
".",
"month",
"===... | Calculates week and weekday indexes in the month
@param {object} date
@param {object} month
@param {object} notValue
@returns {({weekIndex:number, weekDayIndex:number}|*)} | [
"Calculates",
"week",
"and",
"weekday",
"indexes",
"in",
"the",
"month"
] | d6c8310564ff551b9424ac6955efa5e8cf5f8dff | https://github.com/smartface/sf-component-calendar/blob/d6c8310564ff551b9424ac6955efa5e8cf5f8dff/scripts/components/CalendarCore.js#L201-L227 |
47,957 | areslabs/babel-plugin-import-css | src/index.js | devHandler | function devHandler(curPath, importPath, jsFilename) {
var absPath = resolve(importPath, jsFilename)
var projectDir = path.resolve(require.resolve('./index.js'), '..', '..', '..', '..', '..')
absPath = absPath.replace(projectDir, '@areslabs/babel-plugin-import-css/rncsscache')
curPath.node.source.valu... | javascript | function devHandler(curPath, importPath, jsFilename) {
var absPath = resolve(importPath, jsFilename)
var projectDir = path.resolve(require.resolve('./index.js'), '..', '..', '..', '..', '..')
absPath = absPath.replace(projectDir, '@areslabs/babel-plugin-import-css/rncsscache')
curPath.node.source.valu... | [
"function",
"devHandler",
"(",
"curPath",
",",
"importPath",
",",
"jsFilename",
")",
"{",
"var",
"absPath",
"=",
"resolve",
"(",
"importPath",
",",
"jsFilename",
")",
"var",
"projectDir",
"=",
"path",
".",
"resolve",
"(",
"require",
".",
"resolve",
"(",
"'... | In development, we just modify the import path, target file will be generated by 'cssWatch'
@param curPath
@param importPath
@param jsFilename | [
"In",
"development",
"we",
"just",
"modify",
"the",
"import",
"path",
"target",
"file",
"will",
"be",
"generated",
"by",
"cssWatch"
] | b90d3a4ec3a644edcaa1c803314e2c39de1d29c9 | https://github.com/areslabs/babel-plugin-import-css/blob/b90d3a4ec3a644edcaa1c803314e2c39de1d29c9/src/index.js#L61-L68 |
47,958 | areslabs/babel-plugin-import-css | src/index.js | prodHandler | function prodHandler(curPath, opts, importPath, jsFilename, template, t){
var absPath = resolve(importPath, jsFilename)
const cssStr = fse.readFileSync(absPath).toString()
const {styles: obj} = createStylefromCode(cssStr, absPath)
const cssObj = convertStylesToRNCSS(obj)
var defautIdenti = curPath... | javascript | function prodHandler(curPath, opts, importPath, jsFilename, template, t){
var absPath = resolve(importPath, jsFilename)
const cssStr = fse.readFileSync(absPath).toString()
const {styles: obj} = createStylefromCode(cssStr, absPath)
const cssObj = convertStylesToRNCSS(obj)
var defautIdenti = curPath... | [
"function",
"prodHandler",
"(",
"curPath",
",",
"opts",
",",
"importPath",
",",
"jsFilename",
",",
"template",
",",
"t",
")",
"{",
"var",
"absPath",
"=",
"resolve",
"(",
"importPath",
",",
"jsFilename",
")",
"const",
"cssStr",
"=",
"fse",
".",
"readFileSyn... | In prod, the js's object which is generated by the ralated css file will write directly in the js file.
@param curPath
@param opts
@param importPath
@param jsFilename
@param template
@param t | [
"In",
"prod",
"the",
"js",
"s",
"object",
"which",
"is",
"generated",
"by",
"the",
"ralated",
"css",
"file",
"will",
"write",
"directly",
"in",
"the",
"js",
"file",
"."
] | b90d3a4ec3a644edcaa1c803314e2c39de1d29c9 | https://github.com/areslabs/babel-plugin-import-css/blob/b90d3a4ec3a644edcaa1c803314e2c39de1d29c9/src/index.js#L79-L94 |
47,959 | luminous-patterns/angular-environment-config | Gruntfile.js | gruntPrepareRelease | function gruntPrepareRelease () {
var bower = grunt.file.readJSON('bower.json');
var version = bower.version;
if (version !== grunt.config('pkg.version')) {
throw new Error('Version mismatch in bower.json');
}
function searchForExistingTag () {
return e... | javascript | function gruntPrepareRelease () {
var bower = grunt.file.readJSON('bower.json');
var version = bower.version;
if (version !== grunt.config('pkg.version')) {
throw new Error('Version mismatch in bower.json');
}
function searchForExistingTag () {
return e... | [
"function",
"gruntPrepareRelease",
"(",
")",
"{",
"var",
"bower",
"=",
"grunt",
".",
"file",
".",
"readJSON",
"(",
"'bower.json'",
")",
";",
"var",
"version",
"=",
"bower",
".",
"version",
";",
"if",
"(",
"version",
"!==",
"grunt",
".",
"config",
"(",
... | Grunt Task Functions | [
"Grunt",
"Task",
"Functions"
] | 081bda487e16da8f0991699031cd9297c2464bc6 | https://github.com/luminous-patterns/angular-environment-config/blob/081bda487e16da8f0991699031cd9297c2464bc6/Gruntfile.js#L213-L248 |
47,960 | tether/request-body | index.js | add | function add (obj, name, value) {
const previous = obj[name]
if (previous) {
const arr = [].concat(previous)
arr.push(value)
return arr
} else return value
} | javascript | function add (obj, name, value) {
const previous = obj[name]
if (previous) {
const arr = [].concat(previous)
arr.push(value)
return arr
} else return value
} | [
"function",
"add",
"(",
"obj",
",",
"name",
",",
"value",
")",
"{",
"const",
"previous",
"=",
"obj",
"[",
"name",
"]",
"if",
"(",
"previous",
")",
"{",
"const",
"arr",
"=",
"[",
"]",
".",
"concat",
"(",
"previous",
")",
"arr",
".",
"push",
"(",
... | Return value of array of values.
@param {Object} obj
@param {String} name
@param {Any} value
@return {Any|Array}
@api private | [
"Return",
"value",
"of",
"array",
"of",
"values",
"."
] | 825dfc130b728847dd1836b76383c17b3811ce93 | https://github.com/tether/request-body/blob/825dfc130b728847dd1836b76383c17b3811ce93/index.js#L89-L96 |
47,961 | reelyactive/chickadee | lib/routes/contextat.js | retrieveContextAtReceiver | function retrieveContextAtReceiver(req, res) {
if(redirect(req.params.id, '', '', res)) {
return;
}
switch(req.accepts(['json', 'html'])) {
case 'html':
res.sendFile(path.resolve(__dirname + '/../../web/response.html'));
break;
default:
var options = {
query: 'receivedStrong... | javascript | function retrieveContextAtReceiver(req, res) {
if(redirect(req.params.id, '', '', res)) {
return;
}
switch(req.accepts(['json', 'html'])) {
case 'html':
res.sendFile(path.resolve(__dirname + '/../../web/response.html'));
break;
default:
var options = {
query: 'receivedStrong... | [
"function",
"retrieveContextAtReceiver",
"(",
"req",
",",
"res",
")",
"{",
"if",
"(",
"redirect",
"(",
"req",
".",
"params",
".",
"id",
",",
"''",
",",
"''",
",",
"res",
")",
")",
"{",
"return",
";",
"}",
"switch",
"(",
"req",
".",
"accepts",
"(",
... | Retrieve the context at a given receiver device id.
@param {Object} req The HTTP request.
@param {Object} res The HTTP result. | [
"Retrieve",
"the",
"context",
"at",
"a",
"given",
"receiver",
"device",
"id",
"."
] | 1f65c2d369694d93796aae63318fa76326275120 | https://github.com/reelyactive/chickadee/blob/1f65c2d369694d93796aae63318fa76326275120/lib/routes/contextat.js#L37-L59 |
47,962 | fulmicoton/potato | doc/assets/CodeMirror-2.22/mode/xmlpure/xmlpure.js | popContext | function popContext(state) {
if (state.context) {
var oldContext = state.context;
state.context = oldContext.prev;
return oldContext;
}
// we shouldn't be here - it means we didn't have a context to pop
return null;
} | javascript | function popContext(state) {
if (state.context) {
var oldContext = state.context;
state.context = oldContext.prev;
return oldContext;
}
// we shouldn't be here - it means we didn't have a context to pop
return null;
} | [
"function",
"popContext",
"(",
"state",
")",
"{",
"if",
"(",
"state",
".",
"context",
")",
"{",
"var",
"oldContext",
"=",
"state",
".",
"context",
";",
"state",
".",
"context",
"=",
"oldContext",
".",
"prev",
";",
"return",
"oldContext",
";",
"}",
"// ... | go up a level in the document | [
"go",
"up",
"a",
"level",
"in",
"the",
"document"
] | 50f9506224b65f9f171ac52e5a9c8311f9f41c67 | https://github.com/fulmicoton/potato/blob/50f9506224b65f9f171ac52e5a9c8311f9f41c67/doc/assets/CodeMirror-2.22/mode/xmlpure/xmlpure.js#L75-L84 |
47,963 | fulmicoton/potato | doc/assets/CodeMirror-2.22/mode/xmlpure/xmlpure.js | isTokenSeparated | function isTokenSeparated(stream) {
return stream.sol() ||
stream.string.charAt(stream.start - 1) == " " ||
stream.string.charAt(stream.start - 1) == "\t";
} | javascript | function isTokenSeparated(stream) {
return stream.sol() ||
stream.string.charAt(stream.start - 1) == " " ||
stream.string.charAt(stream.start - 1) == "\t";
} | [
"function",
"isTokenSeparated",
"(",
"stream",
")",
"{",
"return",
"stream",
".",
"sol",
"(",
")",
"||",
"stream",
".",
"string",
".",
"charAt",
"(",
"stream",
".",
"start",
"-",
"1",
")",
"==",
"\" \"",
"||",
"stream",
".",
"string",
".",
"charAt",
... | return true if the current token is seperated from the tokens before it which means either this is the start of the line, or there is at least one space or tab character behind the token otherwise returns false | [
"return",
"true",
"if",
"the",
"current",
"token",
"is",
"seperated",
"from",
"the",
"tokens",
"before",
"it",
"which",
"means",
"either",
"this",
"is",
"the",
"start",
"of",
"the",
"line",
"or",
"there",
"is",
"at",
"least",
"one",
"space",
"or",
"tab",... | 50f9506224b65f9f171ac52e5a9c8311f9f41c67 | https://github.com/fulmicoton/potato/blob/50f9506224b65f9f171ac52e5a9c8311f9f41c67/doc/assets/CodeMirror-2.22/mode/xmlpure/xmlpure.js#L90-L94 |
47,964 | CodeOtter/bulkhead | lib/Plugin.js | loadPackage | function loadPackage(target, location, section, options, done) {
if(section == 'config') {
options.dirname = path.resolve(location + '/' + section);
} else {
options.dirname = path.resolve(location + '/api/' + section);
}
buildDictionary.optional(options, function(err, modules) {
if(err) return done(err);
... | javascript | function loadPackage(target, location, section, options, done) {
if(section == 'config') {
options.dirname = path.resolve(location + '/' + section);
} else {
options.dirname = path.resolve(location + '/api/' + section);
}
buildDictionary.optional(options, function(err, modules) {
if(err) return done(err);
... | [
"function",
"loadPackage",
"(",
"target",
",",
"location",
",",
"section",
",",
"options",
",",
"done",
")",
"{",
"if",
"(",
"section",
"==",
"'config'",
")",
"{",
"options",
".",
"dirname",
"=",
"path",
".",
"resolve",
"(",
"location",
"+",
"'/'",
"+"... | This function will merge Sails-like components into an NPM package, forming a Bulkhead package.
@private
@param Object The NPM module instance
@param String The location of the package
@param String The category name of Sails-like components
@param Object Sails-build-directory configuration override
@param Functio... | [
"This",
"function",
"will",
"merge",
"Sails",
"-",
"like",
"components",
"into",
"an",
"NPM",
"package",
"forming",
"a",
"Bulkhead",
"package",
"."
] | 7a247ef30a600c83dce0dd3e8921e306e2895324 | https://github.com/CodeOtter/bulkhead/blob/7a247ef30a600c83dce0dd3e8921e306e2895324/lib/Plugin.js#L23-L42 |
47,965 | CodeOtter/bulkhead | lib/Plugin.js | function(sails, done) {
sails.log.silly('Initializing Bulkhead packages...');
// Detach models from the Sails instance
var bulkheads = Object.keys(Bulkhead),
i = 0,
detachedLoadModels = sails.modules.loadModels;
/**
* Reload event that loads each Bulkhead package's models
*/
var reloadedEvent = f... | javascript | function(sails, done) {
sails.log.silly('Initializing Bulkhead packages...');
// Detach models from the Sails instance
var bulkheads = Object.keys(Bulkhead),
i = 0,
detachedLoadModels = sails.modules.loadModels;
/**
* Reload event that loads each Bulkhead package's models
*/
var reloadedEvent = f... | [
"function",
"(",
"sails",
",",
"done",
")",
"{",
"sails",
".",
"log",
".",
"silly",
"(",
"'Initializing Bulkhead packages...'",
")",
";",
"// Detach models from the Sails instance",
"var",
"bulkheads",
"=",
"Object",
".",
"keys",
"(",
"Bulkhead",
")",
",",
"i",
... | Initializes all registered Bulkhead packages, grafts them to the Sails object, then moves them to their individual packages.
@param Object Sails instance
@param Function Callback to fire when initialization is finished | [
"Initializes",
"all",
"registered",
"Bulkhead",
"packages",
"grafts",
"them",
"to",
"the",
"Sails",
"object",
"then",
"moves",
"them",
"to",
"their",
"individual",
"packages",
"."
] | 7a247ef30a600c83dce0dd3e8921e306e2895324 | https://github.com/CodeOtter/bulkhead/blob/7a247ef30a600c83dce0dd3e8921e306e2895324/lib/Plugin.js#L70-L142 | |
47,966 | CodeOtter/bulkhead | lib/Plugin.js | function() {
_.each(Bulkhead, function(bulkhead, bulkheadName) {
// A registered Bulkhead package needs to be initiated, bound to the Sails instance, detached, and merged back into the Bulkhead
_.each(bulkhead.models, function(model, index) {
bulkhead.models[model.originalIdentity] = sails.models[model.... | javascript | function() {
_.each(Bulkhead, function(bulkhead, bulkheadName) {
// A registered Bulkhead package needs to be initiated, bound to the Sails instance, detached, and merged back into the Bulkhead
_.each(bulkhead.models, function(model, index) {
bulkhead.models[model.originalIdentity] = sails.models[model.... | [
"function",
"(",
")",
"{",
"_",
".",
"each",
"(",
"Bulkhead",
",",
"function",
"(",
"bulkhead",
",",
"bulkheadName",
")",
"{",
"// A registered Bulkhead package needs to be initiated, bound to the Sails instance, detached, and merged back into the Bulkhead",
"_",
".",
"each",... | Reload event that loads each Bulkhead package's models | [
"Reload",
"event",
"that",
"loads",
"each",
"Bulkhead",
"package",
"s",
"models"
] | 7a247ef30a600c83dce0dd3e8921e306e2895324 | https://github.com/CodeOtter/bulkhead/blob/7a247ef30a600c83dce0dd3e8921e306e2895324/lib/Plugin.js#L80-L104 | |
47,967 | rtm/upward | src/Upw.js | make | function make(x, options = {}) {
var {debug = DEBUG_ALL} = options;
var u;
debug = DEBUG && debug;
if (x === undefined) u = makeUndefined();
else if (x === null) u = makeNull();
else {
u = Object(x);
if (!is(u)) {
add(u, debug);
defineProperty(u, 'change', { value: change });
}
}... | javascript | function make(x, options = {}) {
var {debug = DEBUG_ALL} = options;
var u;
debug = DEBUG && debug;
if (x === undefined) u = makeUndefined();
else if (x === null) u = makeNull();
else {
u = Object(x);
if (!is(u)) {
add(u, debug);
defineProperty(u, 'change', { value: change });
}
}... | [
"function",
"make",
"(",
"x",
",",
"options",
"=",
"{",
"}",
")",
"{",
"var",
"{",
"debug",
"=",
"DEBUG_ALL",
"}",
"=",
"options",
";",
"var",
"u",
";",
"debug",
"=",
"DEBUG",
"&&",
"debug",
";",
"if",
"(",
"x",
"===",
"undefined",
")",
"u",
"=... | Make a new upwardable. Register it, and add a `change` method which notifies when it is to be replaced. | [
"Make",
"a",
"new",
"upwardable",
".",
"Register",
"it",
"and",
"add",
"a",
"change",
"method",
"which",
"notifies",
"when",
"it",
"is",
"to",
"be",
"replaced",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Upw.js#L47-L64 |
47,968 | rtm/upward | src/Upw.js | change | function change(x) {
var u = this;
var debug = u._upwardableDebug;
if (x !== this.valueOf()) {
u = make(x, { debug });
getNotifier(this).notify({object: this, newValue: u, type: 'upward'});
if (debug) {
console.debug(...channel.debug("Replaced upwardable", this._upwardableId, "with", u._upward... | javascript | function change(x) {
var u = this;
var debug = u._upwardableDebug;
if (x !== this.valueOf()) {
u = make(x, { debug });
getNotifier(this).notify({object: this, newValue: u, type: 'upward'});
if (debug) {
console.debug(...channel.debug("Replaced upwardable", this._upwardableId, "with", u._upward... | [
"function",
"change",
"(",
"x",
")",
"{",
"var",
"u",
"=",
"this",
";",
"var",
"debug",
"=",
"u",
".",
"_upwardableDebug",
";",
"if",
"(",
"x",
"!==",
"this",
".",
"valueOf",
"(",
")",
")",
"{",
"u",
"=",
"make",
"(",
"x",
",",
"{",
"debug",
... | Change an upwardable. Issue notification that it has changed. | [
"Change",
"an",
"upwardable",
".",
"Issue",
"notification",
"that",
"it",
"has",
"changed",
"."
] | 82495c34f70c9a4336a3b34cc6781e5662324c03 | https://github.com/rtm/upward/blob/82495c34f70c9a4336a3b34cc6781e5662324c03/src/Upw.js#L67-L80 |
47,969 | hexoul/metasdk-react | src/components/util.js | setQRstyle | function setQRstyle (dst, src, caller) {
dst['qrpopup'] = src.qrpopup ? src.qrpopup : false
dst['qrsize'] = src.qrsize > 0 ? src.qrsize : 128
dst['qrvoffset'] = src.qrvoffset >= 0 ? src.qrvoffset : 20
dst['qrpadding'] = src.qrpadding ? src.qrpadding : '1em'
dst['qrposition'] = POSITIONS.includes(src.qrpositio... | javascript | function setQRstyle (dst, src, caller) {
dst['qrpopup'] = src.qrpopup ? src.qrpopup : false
dst['qrsize'] = src.qrsize > 0 ? src.qrsize : 128
dst['qrvoffset'] = src.qrvoffset >= 0 ? src.qrvoffset : 20
dst['qrpadding'] = src.qrpadding ? src.qrpadding : '1em'
dst['qrposition'] = POSITIONS.includes(src.qrpositio... | [
"function",
"setQRstyle",
"(",
"dst",
",",
"src",
",",
"caller",
")",
"{",
"dst",
"[",
"'qrpopup'",
"]",
"=",
"src",
".",
"qrpopup",
"?",
"src",
".",
"qrpopup",
":",
"false",
"dst",
"[",
"'qrsize'",
"]",
"=",
"src",
".",
"qrsize",
">",
"0",
"?",
... | Set QRCode style to dst from src
@param {map} dst
@param {map} src props
@param {string} caller name | [
"Set",
"QRCode",
"style",
"to",
"dst",
"from",
"src"
] | 5aa275bf2e19336edc1f5f0d3b43afc979cc2f42 | https://github.com/hexoul/metasdk-react/blob/5aa275bf2e19336edc1f5f0d3b43afc979cc2f42/src/components/util.js#L25-L32 |
47,970 | hexoul/metasdk-react | src/components/util.js | convertData2Hexd | function convertData2Hexd (data) {
if (!isHexString(data)) {
var hex = ''
for (var i = 0; i < data.length; i++) {
hex += data.charCodeAt(i).toString(16)
}
return '0x' + hex
}
return data
} | javascript | function convertData2Hexd (data) {
if (!isHexString(data)) {
var hex = ''
for (var i = 0; i < data.length; i++) {
hex += data.charCodeAt(i).toString(16)
}
return '0x' + hex
}
return data
} | [
"function",
"convertData2Hexd",
"(",
"data",
")",
"{",
"if",
"(",
"!",
"isHexString",
"(",
"data",
")",
")",
"{",
"var",
"hex",
"=",
"''",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"hex",
... | Convert to hexadecimal for data property of SendTransaction
@param {*} data | [
"Convert",
"to",
"hexadecimal",
"for",
"data",
"property",
"of",
"SendTransaction"
] | 5aa275bf2e19336edc1f5f0d3b43afc979cc2f42 | https://github.com/hexoul/metasdk-react/blob/5aa275bf2e19336edc1f5f0d3b43afc979cc2f42/src/components/util.js#L66-L75 |
47,971 | alexindigo/batcher | lib/augmenter.js | augmenter | function augmenter(object, subject, hookCb)
{
var unaugment, originalCb = object[subject];
unaugment = function()
{
// return everything back to normal
object[subject] = originalCb;
};
object[subject] = function()
{
var args = Array.prototype.slice.call(arguments)
, result = originalCb... | javascript | function augmenter(object, subject, hookCb)
{
var unaugment, originalCb = object[subject];
unaugment = function()
{
// return everything back to normal
object[subject] = originalCb;
};
object[subject] = function()
{
var args = Array.prototype.slice.call(arguments)
, result = originalCb... | [
"function",
"augmenter",
"(",
"object",
",",
"subject",
",",
"hookCb",
")",
"{",
"var",
"unaugment",
",",
"originalCb",
"=",
"object",
"[",
"subject",
"]",
";",
"unaugment",
"=",
"function",
"(",
")",
"{",
"// return everything back to normal",
"object",
"[",
... | Augments provided callback to invoke custom hook after
original callback invocation but before passing control
@param {object} object - object to augment
@param {string} subject - name of the callback property
@param {function} hookCb - hook callback to add to the chain
@returns {function} - provide un-augment f... | [
"Augments",
"provided",
"callback",
"to",
"invoke",
"custom",
"hook",
"after",
"original",
"callback",
"invocation",
"but",
"before",
"passing",
"control"
] | 73d9c8c994f915688db0627ea3b4854ead771138 | https://github.com/alexindigo/batcher/blob/73d9c8c994f915688db0627ea3b4854ead771138/lib/augmenter.js#L13-L38 |
47,972 | richardschneider/table-master-parser | lib/parser.js | step | function step() {
var f = script.shift();
if(f) {
f(stack, step);
}
else {
return cb(null, stack.pop());
}
} | javascript | function step() {
var f = script.shift();
if(f) {
f(stack, step);
}
else {
return cb(null, stack.pop());
}
} | [
"function",
"step",
"(",
")",
"{",
"var",
"f",
"=",
"script",
".",
"shift",
"(",
")",
";",
"if",
"(",
"f",
")",
"{",
"f",
"(",
"stack",
",",
"step",
")",
";",
"}",
"else",
"{",
"return",
"cb",
"(",
"null",
",",
"stack",
".",
"pop",
"(",
")"... | Execute the functions asynchronously | [
"Execute",
"the",
"functions",
"asynchronously"
] | 4236d465ba209f1f00b3c09631d75a9ec607c9e8 | https://github.com/richardschneider/table-master-parser/blob/4236d465ba209f1f00b3c09631d75a9ec607c9e8/lib/parser.js#L23-L31 |
47,973 | stayradiated/onepasswordjs | src/crypto_browser.js | function(ciphertext, key, iv, encoding) {
var binary, bytes, hex;
if (encoding == null) {
encoding = "buffer";
}
iv = this.toBuffer(iv);
key = this.toBuffer(key);
ciphertext = this.toBuffer(ciphertext);
binary = Gibberish.rawDecrypt(ciphertext, key, iv, true);
hex... | javascript | function(ciphertext, key, iv, encoding) {
var binary, bytes, hex;
if (encoding == null) {
encoding = "buffer";
}
iv = this.toBuffer(iv);
key = this.toBuffer(key);
ciphertext = this.toBuffer(ciphertext);
binary = Gibberish.rawDecrypt(ciphertext, key, iv, true);
hex... | [
"function",
"(",
"ciphertext",
",",
"key",
",",
"iv",
",",
"encoding",
")",
"{",
"var",
"binary",
",",
"bytes",
",",
"hex",
";",
"if",
"(",
"encoding",
"==",
"null",
")",
"{",
"encoding",
"=",
"\"buffer\"",
";",
"}",
"iv",
"=",
"this",
".",
"toBuff... | Decipher encrypted data.
@param {String|Buffer} ciphertext The data to decipher. Must be a multiple of the blocksize.
@param {String|Buffer} key The key to decipher the data with.
@param {String|Buffer} iv The initialization vector to use.
@param {String} [encoding=buffer] The format to return the decrypted contents as... | [
"Decipher",
"encrypted",
"data",
"."
] | 6f37d31bd5e7e57489885e89ef9df88e8197a2c3 | https://github.com/stayradiated/onepasswordjs/blob/6f37d31bd5e7e57489885e89ef9df88e8197a2c3/src/crypto_browser.js#L59-L81 | |
47,974 | stayradiated/onepasswordjs | src/crypto_browser.js | function(password, salt, iterations, keysize) {
var bits, hmac, self;
if (iterations == null) {
iterations = 10000;
}
if (keysize == null) {
keysize = 512;
}
self = this;
hmac = (function() {
function hmac(key) {
this.key = sjcl.codec.bytes.fro... | javascript | function(password, salt, iterations, keysize) {
var bits, hmac, self;
if (iterations == null) {
iterations = 10000;
}
if (keysize == null) {
keysize = 512;
}
self = this;
hmac = (function() {
function hmac(key) {
this.key = sjcl.codec.bytes.fro... | [
"function",
"(",
"password",
",",
"salt",
",",
"iterations",
",",
"keysize",
")",
"{",
"var",
"bits",
",",
"hmac",
",",
"self",
";",
"if",
"(",
"iterations",
"==",
"null",
")",
"{",
"iterations",
"=",
"10000",
";",
"}",
"if",
"(",
"keysize",
"==",
... | Generate keys from password using PKDF2-HMAC-SHA512.
@param {String} password The password.
@param {String|Buffer} salt The salt.
@param {Number} [iterations=10000] The numbers of iterations.
@param {Numbers} [keysize=512] The length of the derived key in bits.
@return {String} Returns the derived key encoded as hex. | [
"Generate",
"keys",
"from",
"password",
"using",
"PKDF2",
"-",
"HMAC",
"-",
"SHA512",
"."
] | 6f37d31bd5e7e57489885e89ef9df88e8197a2c3 | https://github.com/stayradiated/onepasswordjs/blob/6f37d31bd5e7e57489885e89ef9df88e8197a2c3/src/crypto_browser.js#L91-L119 | |
47,975 | stayradiated/onepasswordjs | src/crypto_browser.js | function(data, key, keysize) {
var input, mode;
if (keysize == null) {
keysize = 512;
}
data = this.toHex(data);
key = this.toHex(key);
mode = "SHA-" + keysize;
input = new jsSHA(data, "HEX");
return input.getHMAC(key, "HEX", mode, "HEX");
} | javascript | function(data, key, keysize) {
var input, mode;
if (keysize == null) {
keysize = 512;
}
data = this.toHex(data);
key = this.toHex(key);
mode = "SHA-" + keysize;
input = new jsSHA(data, "HEX");
return input.getHMAC(key, "HEX", mode, "HEX");
} | [
"function",
"(",
"data",
",",
"key",
",",
"keysize",
")",
"{",
"var",
"input",
",",
"mode",
";",
"if",
"(",
"keysize",
"==",
"null",
")",
"{",
"keysize",
"=",
"512",
";",
"}",
"data",
"=",
"this",
".",
"toHex",
"(",
"data",
")",
";",
"key",
"="... | Cryptographically hash data using HMAC.
@param {String|Buffer} data The data to be hashed.
@param {String|Buffer} key The key to use with HMAC.
@param {Number} [keysize=512] The keysize for the hash function.
@return {String} The hmac digest encoded as hex. | [
"Cryptographically",
"hash",
"data",
"using",
"HMAC",
"."
] | 6f37d31bd5e7e57489885e89ef9df88e8197a2c3 | https://github.com/stayradiated/onepasswordjs/blob/6f37d31bd5e7e57489885e89ef9df88e8197a2c3/src/crypto_browser.js#L128-L138 | |
47,976 | stayradiated/onepasswordjs | src/crypto_browser.js | function(data, keysize) {
var input, mode;
if (keysize == null) {
keysize = 512;
}
data = this.toHex(data);
mode = "SHA-" + keysize;
input = new jsSHA(data, "HEX");
return input.getHash(mode, "HEX");
} | javascript | function(data, keysize) {
var input, mode;
if (keysize == null) {
keysize = 512;
}
data = this.toHex(data);
mode = "SHA-" + keysize;
input = new jsSHA(data, "HEX");
return input.getHash(mode, "HEX");
} | [
"function",
"(",
"data",
",",
"keysize",
")",
"{",
"var",
"input",
",",
"mode",
";",
"if",
"(",
"keysize",
"==",
"null",
")",
"{",
"keysize",
"=",
"512",
";",
"}",
"data",
"=",
"this",
".",
"toHex",
"(",
"data",
")",
";",
"mode",
"=",
"\"SHA-\"",... | Create a hash digest of data.
@param {String|Buffer} data The data to hash.
@param {Number} [keysize=512] The keysize for the hash function.
@return {String} The hash digest encoded as hex. | [
"Create",
"a",
"hash",
"digest",
"of",
"data",
"."
] | 6f37d31bd5e7e57489885e89ef9df88e8197a2c3 | https://github.com/stayradiated/onepasswordjs/blob/6f37d31bd5e7e57489885e89ef9df88e8197a2c3/src/crypto_browser.js#L146-L155 | |
47,977 | stayradiated/onepasswordjs | src/crypto_browser.js | function(data) {
var bytesToPad, padding;
bytesToPad = BLOCKSIZE - (data.length % BLOCKSIZE);
padding = this.randomBytes(bytesToPad);
return this.concat([padding, data]);
} | javascript | function(data) {
var bytesToPad, padding;
bytesToPad = BLOCKSIZE - (data.length % BLOCKSIZE);
padding = this.randomBytes(bytesToPad);
return this.concat([padding, data]);
} | [
"function",
"(",
"data",
")",
"{",
"var",
"bytesToPad",
",",
"padding",
";",
"bytesToPad",
"=",
"BLOCKSIZE",
"-",
"(",
"data",
".",
"length",
"%",
"BLOCKSIZE",
")",
";",
"padding",
"=",
"this",
".",
"randomBytes",
"(",
"bytesToPad",
")",
";",
"return",
... | Prepend padding to data to make it fill the blocksize.
@param {Buffer} data The data to pad.
@return {Buffer} The data with padding added. | [
"Prepend",
"padding",
"to",
"data",
"to",
"make",
"it",
"fill",
"the",
"blocksize",
"."
] | 6f37d31bd5e7e57489885e89ef9df88e8197a2c3 | https://github.com/stayradiated/onepasswordjs/blob/6f37d31bd5e7e57489885e89ef9df88e8197a2c3/src/crypto_browser.js#L162-L167 | |
47,978 | stayradiated/onepasswordjs | src/crypto_browser.js | function(length) {
var array, byte, _i, _len, _results;
array = new Uint8Array(length);
window.crypto.getRandomValues(array);
_results = [];
for (_i = 0, _len = array.length; _i < _len; _i++) {
byte = array[_i];
_results.push(byte);
}
return _results;
} | javascript | function(length) {
var array, byte, _i, _len, _results;
array = new Uint8Array(length);
window.crypto.getRandomValues(array);
_results = [];
for (_i = 0, _len = array.length; _i < _len; _i++) {
byte = array[_i];
_results.push(byte);
}
return _results;
} | [
"function",
"(",
"length",
")",
"{",
"var",
"array",
",",
"byte",
",",
"_i",
",",
"_len",
",",
"_results",
";",
"array",
"=",
"new",
"Uint8Array",
"(",
"length",
")",
";",
"window",
".",
"crypto",
".",
"getRandomValues",
"(",
"array",
")",
";",
"_res... | Generates cryptographically strong pseudo-random data.
@param {Numbers} length How many bytes of data you want.
@return {Buffer} The random data as a Buffer. | [
"Generates",
"cryptographically",
"strong",
"pseudo",
"-",
"random",
"data",
"."
] | 6f37d31bd5e7e57489885e89ef9df88e8197a2c3 | https://github.com/stayradiated/onepasswordjs/blob/6f37d31bd5e7e57489885e89ef9df88e8197a2c3/src/crypto_browser.js#L186-L196 | |
47,979 | stayradiated/onepasswordjs | src/crypto_browser.js | function(data, encoding) {
if (encoding == null) {
encoding = 'hex';
}
if (Array.isArray(data)) {
return data;
}
switch (encoding) {
case 'base64':
return Gibberish.base64.decode(data);
case 'hex':
return Gibberish.h2a(data);
case... | javascript | function(data, encoding) {
if (encoding == null) {
encoding = 'hex';
}
if (Array.isArray(data)) {
return data;
}
switch (encoding) {
case 'base64':
return Gibberish.base64.decode(data);
case 'hex':
return Gibberish.h2a(data);
case... | [
"function",
"(",
"data",
",",
"encoding",
")",
"{",
"if",
"(",
"encoding",
"==",
"null",
")",
"{",
"encoding",
"=",
"'hex'",
";",
"}",
"if",
"(",
"Array",
".",
"isArray",
"(",
"data",
")",
")",
"{",
"return",
"data",
";",
"}",
"switch",
"(",
"enc... | Convert data to a Buffer
@param {String|Buffer} data The data to be converted. If a string, must be encoded as hex.
@param {String} [encoding=hex] The format of the data to convert.
@return {Buffer} The data as a Buffer | [
"Convert",
"data",
"to",
"a",
"Buffer"
] | 6f37d31bd5e7e57489885e89ef9df88e8197a2c3 | https://github.com/stayradiated/onepasswordjs/blob/6f37d31bd5e7e57489885e89ef9df88e8197a2c3/src/crypto_browser.js#L204-L221 | |
47,980 | stayradiated/onepasswordjs | src/crypto_browser.js | function(hex) {
var pow, result;
result = 0;
pow = 0;
while (hex.length > 0) {
result += parseInt(hex.substring(0, 2), 16) * Math.pow(2, pow);
hex = hex.substring(2, hex.length);
pow += 8;
}
return result;
} | javascript | function(hex) {
var pow, result;
result = 0;
pow = 0;
while (hex.length > 0) {
result += parseInt(hex.substring(0, 2), 16) * Math.pow(2, pow);
hex = hex.substring(2, hex.length);
pow += 8;
}
return result;
} | [
"function",
"(",
"hex",
")",
"{",
"var",
"pow",
",",
"result",
";",
"result",
"=",
"0",
";",
"pow",
"=",
"0",
";",
"while",
"(",
"hex",
".",
"length",
">",
"0",
")",
"{",
"result",
"+=",
"parseInt",
"(",
"hex",
".",
"substring",
"(",
"0",
",",
... | Parse a litte endian number.
@author Jim Rogers {@link http://www.jimandkatrin.com/CodeBlog/post/Parse-a-little-endian.aspx}
@param {String} hex The little endian number.
@return {Number} The little endian converted to a number. | [
"Parse",
"a",
"litte",
"endian",
"number",
"."
] | 6f37d31bd5e7e57489885e89ef9df88e8197a2c3 | https://github.com/stayradiated/onepasswordjs/blob/6f37d31bd5e7e57489885e89ef9df88e8197a2c3/src/crypto_browser.js#L259-L269 | |
47,981 | stayradiated/onepasswordjs | src/crypto_browser.js | function(number, pad) {
var endian, i, multiplier, padding, power, remainder, value, _i;
if (pad == null) {
pad = true;
}
power = Math.floor((Math.log(number) / Math.LN2) / 8) * 8;
multiplier = Math.pow(2, power);
value = Math.floor(number / multiplier);
remainder = num... | javascript | function(number, pad) {
var endian, i, multiplier, padding, power, remainder, value, _i;
if (pad == null) {
pad = true;
}
power = Math.floor((Math.log(number) / Math.LN2) / 8) * 8;
multiplier = Math.pow(2, power);
value = Math.floor(number / multiplier);
remainder = num... | [
"function",
"(",
"number",
",",
"pad",
")",
"{",
"var",
"endian",
",",
"i",
",",
"multiplier",
",",
"padding",
",",
"power",
",",
"remainder",
",",
"value",
",",
"_i",
";",
"if",
"(",
"pad",
"==",
"null",
")",
"{",
"pad",
"=",
"true",
";",
"}",
... | Convert an integer into a little endian.
@param {Number} number The integer you want to convert.
@param {Boolean} [pad=true] Pad the little endian with zeroes.
@return {String} The little endian. | [
"Convert",
"an",
"integer",
"into",
"a",
"little",
"endian",
"."
] | 6f37d31bd5e7e57489885e89ef9df88e8197a2c3 | https://github.com/stayradiated/onepasswordjs/blob/6f37d31bd5e7e57489885e89ef9df88e8197a2c3/src/crypto_browser.js#L277-L300 | |
47,982 | stayradiated/onepasswordjs | src/crypto_browser.js | function(dec) {
var hex;
hex = dec.toString(16);
if (hex.length < 2) {
hex = "0" + hex;
}
return hex;
} | javascript | function(dec) {
var hex;
hex = dec.toString(16);
if (hex.length < 2) {
hex = "0" + hex;
}
return hex;
} | [
"function",
"(",
"dec",
")",
"{",
"var",
"hex",
";",
"hex",
"=",
"dec",
".",
"toString",
"(",
"16",
")",
";",
"if",
"(",
"hex",
".",
"length",
"<",
"2",
")",
"{",
"hex",
"=",
"\"0\"",
"+",
"hex",
";",
"}",
"return",
"hex",
";",
"}"
] | Turn a decimal into a hexadecimal.
@param {Number} dec The decimal.
@return {String} The hexadecimal. | [
"Turn",
"a",
"decimal",
"into",
"a",
"hexadecimal",
"."
] | 6f37d31bd5e7e57489885e89ef9df88e8197a2c3 | https://github.com/stayradiated/onepasswordjs/blob/6f37d31bd5e7e57489885e89ef9df88e8197a2c3/src/crypto_browser.js#L307-L314 | |
47,983 | stayradiated/onepasswordjs | src/crypto_browser.js | function(binary) {
var char, hex, _i, _len;
hex = "";
for (_i = 0, _len = binary.length; _i < _len; _i++) {
char = binary[_i];
hex += char.charCodeAt(0).toString(16).replace(/^([\dA-F])$/i, "0$1");
}
return hex;
} | javascript | function(binary) {
var char, hex, _i, _len;
hex = "";
for (_i = 0, _len = binary.length; _i < _len; _i++) {
char = binary[_i];
hex += char.charCodeAt(0).toString(16).replace(/^([\dA-F])$/i, "0$1");
}
return hex;
} | [
"function",
"(",
"binary",
")",
"{",
"var",
"char",
",",
"hex",
",",
"_i",
",",
"_len",
";",
"hex",
"=",
"\"\"",
";",
"for",
"(",
"_i",
"=",
"0",
",",
"_len",
"=",
"binary",
".",
"length",
";",
"_i",
"<",
"_len",
";",
"_i",
"++",
")",
"{",
... | Convert a binary string into a hex string.
@param {String} binary The binary encoded string.
@return {String} The hex encoded string. | [
"Convert",
"a",
"binary",
"string",
"into",
"a",
"hex",
"string",
"."
] | 6f37d31bd5e7e57489885e89ef9df88e8197a2c3 | https://github.com/stayradiated/onepasswordjs/blob/6f37d31bd5e7e57489885e89ef9df88e8197a2c3/src/crypto_browser.js#L321-L329 | |
47,984 | stayradiated/onepasswordjs | src/crypto_browser.js | function(length) {
var bytes, hex;
if (length == null) {
length = 32;
}
length /= 2;
bytes = this.randomBytes(length);
return hex = this.toHex(bytes).toUpperCase();
} | javascript | function(length) {
var bytes, hex;
if (length == null) {
length = 32;
}
length /= 2;
bytes = this.randomBytes(length);
return hex = this.toHex(bytes).toUpperCase();
} | [
"function",
"(",
"length",
")",
"{",
"var",
"bytes",
",",
"hex",
";",
"if",
"(",
"length",
"==",
"null",
")",
"{",
"length",
"=",
"32",
";",
"}",
"length",
"/=",
"2",
";",
"bytes",
"=",
"this",
".",
"randomBytes",
"(",
"length",
")",
";",
"return... | Generate a uuid.
@param {Number} [length=32] The length of the UUID.
@return {String} The UUID. | [
"Generate",
"a",
"uuid",
"."
] | 6f37d31bd5e7e57489885e89ef9df88e8197a2c3 | https://github.com/stayradiated/onepasswordjs/blob/6f37d31bd5e7e57489885e89ef9df88e8197a2c3/src/crypto_browser.js#L336-L344 | |
47,985 | ghinda/durruti | src/durruti.js | decorate | function decorate (Comp) {
var component
// instantiate classes
if (typeof Comp === 'function') {
component = new Comp()
} else {
// make sure we don't change the id on a cached component
component = Object.create(Comp)
}
// components get a new id on render,
// so we can clear the previous ... | javascript | function decorate (Comp) {
var component
// instantiate classes
if (typeof Comp === 'function') {
component = new Comp()
} else {
// make sure we don't change the id on a cached component
component = Object.create(Comp)
}
// components get a new id on render,
// so we can clear the previous ... | [
"function",
"decorate",
"(",
"Comp",
")",
"{",
"var",
"component",
"// instantiate classes",
"if",
"(",
"typeof",
"Comp",
"===",
"'function'",
")",
"{",
"component",
"=",
"new",
"Comp",
"(",
")",
"}",
"else",
"{",
"// make sure we don't change the id on a cached c... | decorate a basic class with durruti specific properties | [
"decorate",
"a",
"basic",
"class",
"with",
"durruti",
"specific",
"properties"
] | a67a95e9a636367b43afffdbede1ba083be00ebe | https://github.com/ghinda/durruti/blob/a67a95e9a636367b43afffdbede1ba083be00ebe/src/durruti.js#L14-L36 |
47,986 | ghinda/durruti | src/durruti.js | cleanAttrNodes | function cleanAttrNodes ($container, includeParent) {
var nodes = [].slice.call($container.querySelectorAll(durrutiElemSelector))
if (includeParent) {
nodes.push($container)
}
nodes.forEach(($node) => {
// cache component in node
$node._durruti = getCachedComponent($node)
// clean-up data att... | javascript | function cleanAttrNodes ($container, includeParent) {
var nodes = [].slice.call($container.querySelectorAll(durrutiElemSelector))
if (includeParent) {
nodes.push($container)
}
nodes.forEach(($node) => {
// cache component in node
$node._durruti = getCachedComponent($node)
// clean-up data att... | [
"function",
"cleanAttrNodes",
"(",
"$container",
",",
"includeParent",
")",
"{",
"var",
"nodes",
"=",
"[",
"]",
".",
"slice",
".",
"call",
"(",
"$container",
".",
"querySelectorAll",
"(",
"durrutiElemSelector",
")",
")",
"if",
"(",
"includeParent",
")",
"{",... | remove custom data attributes, and cache the component on the DOM node. | [
"remove",
"custom",
"data",
"attributes",
"and",
"cache",
"the",
"component",
"on",
"the",
"DOM",
"node",
"."
] | a67a95e9a636367b43afffdbede1ba083be00ebe | https://github.com/ghinda/durruti/blob/a67a95e9a636367b43afffdbede1ba083be00ebe/src/durruti.js#L55-L71 |
47,987 | ghinda/durruti | src/durruti.js | getComponentNodes | function getComponentNodes ($container, traverse = true, arr = []) {
if ($container._durruti) {
arr.push($container)
}
if (traverse && $container.children) {
for (let i = 0; i < $container.children.length; i++) {
getComponentNodes($container.children[i], traverse, arr)
}
}
return arr
} | javascript | function getComponentNodes ($container, traverse = true, arr = []) {
if ($container._durruti) {
arr.push($container)
}
if (traverse && $container.children) {
for (let i = 0; i < $container.children.length; i++) {
getComponentNodes($container.children[i], traverse, arr)
}
}
return arr
} | [
"function",
"getComponentNodes",
"(",
"$container",
",",
"traverse",
"=",
"true",
",",
"arr",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$container",
".",
"_durruti",
")",
"{",
"arr",
".",
"push",
"(",
"$container",
")",
"}",
"if",
"(",
"traverse",
"&&",
"... | traverse and find durruti nodes | [
"traverse",
"and",
"find",
"durruti",
"nodes"
] | a67a95e9a636367b43afffdbede1ba083be00ebe | https://github.com/ghinda/durruti/blob/a67a95e9a636367b43afffdbede1ba083be00ebe/src/durruti.js#L149-L161 |
47,988 | BladeRunnerJS/topiarist | src/topiarist.js | extend | function extend(classDefinition, superclass, extraProperties) {
var subclassName = className(classDefinition, 'Subclass');
// Find the right classDefinition - either the one provided, a new one or the one from extraProperties.
var extraPropertiesHasConstructor = typeof extraProperties !== 'undefined' &&
extraProp... | javascript | function extend(classDefinition, superclass, extraProperties) {
var subclassName = className(classDefinition, 'Subclass');
// Find the right classDefinition - either the one provided, a new one or the one from extraProperties.
var extraPropertiesHasConstructor = typeof extraProperties !== 'undefined' &&
extraProp... | [
"function",
"extend",
"(",
"classDefinition",
",",
"superclass",
",",
"extraProperties",
")",
"{",
"var",
"subclassName",
"=",
"className",
"(",
"classDefinition",
",",
"'Subclass'",
")",
";",
"// Find the right classDefinition - either the one provided, a new one or the one ... | Sets up the prototype chain for inheritance.
<p>As well as setting up the prototype chain, this also copies so called 'class' definitions from the superclass
to the subclass and makes sure that constructor will return the correct thing.</p>
@throws Error if the prototype has been modified before extend is called.
@m... | [
"Sets",
"up",
"the",
"prototype",
"chain",
"for",
"inheritance",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/topiarist.js#L25-L89 |
47,989 | BladeRunnerJS/topiarist | src/topiarist.js | mixin | function mixin(target, Mix) {
assertArgumentOfType('function', target, ERROR_MESSAGES.NOT_CONSTRUCTOR, 'Target', 'mixin');
Mix = toFunction(
Mix,
new TypeError(
msg(
ERROR_MESSAGES.WRONG_TYPE,
'Mix',
'mixin',
'non-null object or function',
Mix === null ? 'null' : typeof Mix
)
)
);
... | javascript | function mixin(target, Mix) {
assertArgumentOfType('function', target, ERROR_MESSAGES.NOT_CONSTRUCTOR, 'Target', 'mixin');
Mix = toFunction(
Mix,
new TypeError(
msg(
ERROR_MESSAGES.WRONG_TYPE,
'Mix',
'mixin',
'non-null object or function',
Mix === null ? 'null' : typeof Mix
)
)
);
... | [
"function",
"mixin",
"(",
"target",
",",
"Mix",
")",
"{",
"assertArgumentOfType",
"(",
"'function'",
",",
"target",
",",
"ERROR_MESSAGES",
".",
"NOT_CONSTRUCTOR",
",",
"'Target'",
",",
"'mixin'",
")",
";",
"Mix",
"=",
"toFunction",
"(",
"Mix",
",",
"new",
... | Mixes functionality in to a class.
<p>Only functions are mixed in.</p>
<p>Code in the mixin is sandboxed and only has access to a 'mixin instance' rather than the real instance.</p>
@memberOf topiarist
@param {function} target
@param {function|Object} Mix | [
"Mixes",
"functionality",
"in",
"to",
"a",
"class",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/topiarist.js#L102-L146 |
47,990 | BladeRunnerJS/topiarist | src/topiarist.js | inherit | function inherit(target, parent) {
assertArgumentOfType('function', target, ERROR_MESSAGES.NOT_CONSTRUCTOR, 'Target', 'inherit');
parent = toFunction(
parent,
new TypeError(
msg(
ERROR_MESSAGES.WRONG_TYPE,
'Parent',
'inherit',
'non-null object or function',
parent === null ? 'null' : typeof... | javascript | function inherit(target, parent) {
assertArgumentOfType('function', target, ERROR_MESSAGES.NOT_CONSTRUCTOR, 'Target', 'inherit');
parent = toFunction(
parent,
new TypeError(
msg(
ERROR_MESSAGES.WRONG_TYPE,
'Parent',
'inherit',
'non-null object or function',
parent === null ? 'null' : typeof... | [
"function",
"inherit",
"(",
"target",
",",
"parent",
")",
"{",
"assertArgumentOfType",
"(",
"'function'",
",",
"target",
",",
"ERROR_MESSAGES",
".",
"NOT_CONSTRUCTOR",
",",
"'Target'",
",",
"'inherit'",
")",
";",
"parent",
"=",
"toFunction",
"(",
"parent",
","... | Provides multiple inheritance through copying.
<p>This is discouraged; you should prefer to use aggregation first, single inheritance (extends) second, mixins
third and this as a last resort.</p>
@memberOf topiarist
@param {function} target the class that should receive the functionality.
@param {function|Object} par... | [
"Provides",
"multiple",
"inheritance",
"through",
"copying",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/topiarist.js#L158-L214 |
47,991 | BladeRunnerJS/topiarist | src/topiarist.js | implement | function implement(classDefinition, protocol) {
doImplement(classDefinition, protocol);
setTimeout(function() {
assertHasImplemented(classDefinition, protocol);
}, 0);
return classDefinition;
} | javascript | function implement(classDefinition, protocol) {
doImplement(classDefinition, protocol);
setTimeout(function() {
assertHasImplemented(classDefinition, protocol);
}, 0);
return classDefinition;
} | [
"function",
"implement",
"(",
"classDefinition",
",",
"protocol",
")",
"{",
"doImplement",
"(",
"classDefinition",
",",
"protocol",
")",
";",
"setTimeout",
"(",
"function",
"(",
")",
"{",
"assertHasImplemented",
"(",
"classDefinition",
",",
"protocol",
")",
";",... | Declares that the provided class will implement the provided protocol.
<p>This involves immediately updating an internal list of interfaces attached to the class definition,
and after a <code>setTimeout(0)</code> verifying that it does in fact implement the protocol.</p>
<p>It can be called before the implementations... | [
"Declares",
"that",
"the",
"provided",
"class",
"will",
"implement",
"the",
"provided",
"protocol",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/topiarist.js#L230-L238 |
47,992 | BladeRunnerJS/topiarist | src/topiarist.js | hasImplemented | function hasImplemented(classDefinition, protocol) {
doImplement(classDefinition, protocol);
assertHasImplemented(classDefinition, protocol);
return classDefinition;
} | javascript | function hasImplemented(classDefinition, protocol) {
doImplement(classDefinition, protocol);
assertHasImplemented(classDefinition, protocol);
return classDefinition;
} | [
"function",
"hasImplemented",
"(",
"classDefinition",
",",
"protocol",
")",
"{",
"doImplement",
"(",
"classDefinition",
",",
"protocol",
")",
";",
"assertHasImplemented",
"(",
"classDefinition",
",",
"protocol",
")",
";",
"return",
"classDefinition",
";",
"}"
] | Declares that the provided class implements the provided protocol.
<p>This involves checking that it does in fact implement the protocol and updating an internal list of
interfaces attached to the class definition.</p>
<p>It should be called after implementations are provided, i.e. at the end of the class definition.... | [
"Declares",
"that",
"the",
"provided",
"class",
"implements",
"the",
"provided",
"protocol",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/topiarist.js#L254-L259 |
47,993 | BladeRunnerJS/topiarist | src/topiarist.js | isA | function isA(instance, parent) {
if(instance == null) {
assertArgumentNotNullOrUndefined(instance, ERROR_MESSAGES.NULL, 'Object', 'isA');
}
// sneaky edge case where we're checking against an object literal we've mixed in or against a prototype of
// something.
if (typeof parent === 'object' && parent.hasOwnPr... | javascript | function isA(instance, parent) {
if(instance == null) {
assertArgumentNotNullOrUndefined(instance, ERROR_MESSAGES.NULL, 'Object', 'isA');
}
// sneaky edge case where we're checking against an object literal we've mixed in or against a prototype of
// something.
if (typeof parent === 'object' && parent.hasOwnPr... | [
"function",
"isA",
"(",
"instance",
",",
"parent",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"{",
"assertArgumentNotNullOrUndefined",
"(",
"instance",
",",
"ERROR_MESSAGES",
".",
"NULL",
",",
"'Object'",
",",
"'isA'",
")",
";",
"}",
"// sneaky edge... | Checks to see if an instance is defined to be a child of a parent.
@memberOf topiarist
@param {Object} instance An instance object to check.
@param {function} parent A potential parent (see classIsA).
@returns {boolean} true if this instance has been constructed from something that is assignable from the parent
or is ... | [
"Checks",
"to",
"see",
"if",
"an",
"instance",
"is",
"defined",
"to",
"be",
"a",
"child",
"of",
"a",
"parent",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/topiarist.js#L367-L383 |
47,994 | BladeRunnerJS/topiarist | src/topiarist.js | classFulfills | function classFulfills(classDefinition, protocol) {
assertArgumentNotNullOrUndefined(classDefinition, ERROR_MESSAGES.NULL, 'Class', 'classFulfills');
assertArgumentNotNullOrUndefined(protocol, ERROR_MESSAGES.NULL, 'Protocol', 'classFulfills');
return fulfills(classDefinition.prototype, protocol);
} | javascript | function classFulfills(classDefinition, protocol) {
assertArgumentNotNullOrUndefined(classDefinition, ERROR_MESSAGES.NULL, 'Class', 'classFulfills');
assertArgumentNotNullOrUndefined(protocol, ERROR_MESSAGES.NULL, 'Protocol', 'classFulfills');
return fulfills(classDefinition.prototype, protocol);
} | [
"function",
"classFulfills",
"(",
"classDefinition",
",",
"protocol",
")",
"{",
"assertArgumentNotNullOrUndefined",
"(",
"classDefinition",
",",
"ERROR_MESSAGES",
".",
"NULL",
",",
"'Class'",
",",
"'classFulfills'",
")",
";",
"assertArgumentNotNullOrUndefined",
"(",
"pr... | Checks that a class provides a prototype that will fulfil a protocol.
@memberOf topiarist
@param {function} classDefinition
@param {function|Object} protocol
@returns {boolean} | [
"Checks",
"that",
"a",
"class",
"provides",
"a",
"prototype",
"that",
"will",
"fulfil",
"a",
"protocol",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/topiarist.js#L446-L451 |
47,995 | BladeRunnerJS/topiarist | src/topiarist.js | nonenum | function nonenum(object, propertyName, defaultValue) {
var value = object[propertyName];
if (typeof value === 'undefined') {
value = defaultValue;
Object.defineProperty(object, propertyName, {
enumerable: false,
value: value
});
}
return value;
} | javascript | function nonenum(object, propertyName, defaultValue) {
var value = object[propertyName];
if (typeof value === 'undefined') {
value = defaultValue;
Object.defineProperty(object, propertyName, {
enumerable: false,
value: value
});
}
return value;
} | [
"function",
"nonenum",
"(",
"object",
",",
"propertyName",
",",
"defaultValue",
")",
"{",
"var",
"value",
"=",
"object",
"[",
"propertyName",
"]",
";",
"if",
"(",
"typeof",
"value",
"===",
"'undefined'",
")",
"{",
"value",
"=",
"defaultValue",
";",
"Object... | Returns a nonenumerable property if it exists, or creates one and returns that if it does not.
@private | [
"Returns",
"a",
"nonenumerable",
"property",
"if",
"it",
"exists",
"or",
"creates",
"one",
"and",
"returns",
"that",
"if",
"it",
"does",
"not",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/topiarist.js#L513-L525 |
47,996 | BladeRunnerJS/topiarist | src/topiarist.js | toFunction | function toFunction(obj, couldNotCastError) {
if (obj == null) {
throw couldNotCastError;
}
var result;
if (typeof obj === 'object') {
if (obj.hasOwnProperty('constructor')) {
if (obj.constructor.prototype !== obj) {
throw couldNotCastError;
}
result = obj.constructor;
} else {
var EmptyIniti... | javascript | function toFunction(obj, couldNotCastError) {
if (obj == null) {
throw couldNotCastError;
}
var result;
if (typeof obj === 'object') {
if (obj.hasOwnProperty('constructor')) {
if (obj.constructor.prototype !== obj) {
throw couldNotCastError;
}
result = obj.constructor;
} else {
var EmptyIniti... | [
"function",
"toFunction",
"(",
"obj",
",",
"couldNotCastError",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"throw",
"couldNotCastError",
";",
"}",
"var",
"result",
";",
"if",
"(",
"typeof",
"obj",
"===",
"'object'",
")",
"{",
"if",
"(",
"obj",... | Easier for us if we treat everything as functions with prototypes. This function makes plain objects behave that
way.
@private | [
"Easier",
"for",
"us",
"if",
"we",
"treat",
"everything",
"as",
"functions",
"with",
"prototypes",
".",
"This",
"function",
"makes",
"plain",
"objects",
"behave",
"that",
"way",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/topiarist.js#L532-L558 |
47,997 | BladeRunnerJS/topiarist | src/topiarist.js | missingAttributes | function missingAttributes(classdef, protocol) {
var result = [], obj = classdef.prototype, requirement = protocol.prototype;
var item;
for (item in requirement) {
if (typeof obj[item] !== typeof requirement[item]) {
result.push(item);
}
}
for (item in protocol) {
var protocolItemType = typeof protocol[i... | javascript | function missingAttributes(classdef, protocol) {
var result = [], obj = classdef.prototype, requirement = protocol.prototype;
var item;
for (item in requirement) {
if (typeof obj[item] !== typeof requirement[item]) {
result.push(item);
}
}
for (item in protocol) {
var protocolItemType = typeof protocol[i... | [
"function",
"missingAttributes",
"(",
"classdef",
",",
"protocol",
")",
"{",
"var",
"result",
"=",
"[",
"]",
",",
"obj",
"=",
"classdef",
".",
"prototype",
",",
"requirement",
"=",
"protocol",
".",
"prototype",
";",
"var",
"item",
";",
"for",
"(",
"item"... | Returns an array of all of the properties on a protocol that are not on classdef or are of a different type on
classdef.
@private | [
"Returns",
"an",
"array",
"of",
"all",
"of",
"the",
"properties",
"on",
"a",
"protocol",
"that",
"are",
"not",
"on",
"classdef",
"or",
"are",
"of",
"a",
"different",
"type",
"on",
"classdef",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/topiarist.js#L610-L630 |
47,998 | BladeRunnerJS/topiarist | src/topiarist.js | makeMethod | function makeMethod(func) {
return function() {
var args = [this].concat(slice.call(arguments));
return func.apply(null, args);
};
} | javascript | function makeMethod(func) {
return function() {
var args = [this].concat(slice.call(arguments));
return func.apply(null, args);
};
} | [
"function",
"makeMethod",
"(",
"func",
")",
"{",
"return",
"function",
"(",
")",
"{",
"var",
"args",
"=",
"[",
"this",
"]",
".",
"concat",
"(",
"slice",
".",
"call",
"(",
"arguments",
")",
")",
";",
"return",
"func",
".",
"apply",
"(",
"null",
",",... | Turns a function into a method by using 'this' as the first argument.
@private | [
"Turns",
"a",
"function",
"into",
"a",
"method",
"by",
"using",
"this",
"as",
"the",
"first",
"argument",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/topiarist.js#L653-L658 |
47,999 | BladeRunnerJS/topiarist | src/topiarist.js | getSandboxedFunction | function getSandboxedFunction(myMixId, Mix, func) {
var result = function() {
var mixInstances = nonenum(this, '__multiparentInstances__', []);
var mixInstance = mixInstances[myMixId];
if (mixInstance == null) {
if (typeof Mix === 'function') {
mixInstance = new Mix();
} else {
mixInstance = Object... | javascript | function getSandboxedFunction(myMixId, Mix, func) {
var result = function() {
var mixInstances = nonenum(this, '__multiparentInstances__', []);
var mixInstance = mixInstances[myMixId];
if (mixInstance == null) {
if (typeof Mix === 'function') {
mixInstance = new Mix();
} else {
mixInstance = Object... | [
"function",
"getSandboxedFunction",
"(",
"myMixId",
",",
"Mix",
",",
"func",
")",
"{",
"var",
"result",
"=",
"function",
"(",
")",
"{",
"var",
"mixInstances",
"=",
"nonenum",
"(",
"this",
",",
"'__multiparentInstances__'",
",",
"[",
"]",
")",
";",
"var",
... | Mixin functions are sandboxed into their own instance.
@private | [
"Mixin",
"functions",
"are",
"sandboxed",
"into",
"their",
"own",
"instance",
"."
] | b21636953c602f969adde2c3bd342c4b17e91968 | https://github.com/BladeRunnerJS/topiarist/blob/b21636953c602f969adde2c3bd342c4b17e91968/src/topiarist.js#L664-L684 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.