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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
31,900 | cmap/morpheus.js | js/jquery.event.drag-2.3.0.js | function( elem, dd ){
var offset = (elem && elem.ownerDocument)
? $( elem )[ dd.relative ? "position" : "offset" ]() || { top:0, left:0 }
: { top: 0, left: 0 };
return {
drag: elem,
callback: new drag.callba... | javascript | function( elem, dd ){
var offset = (elem && elem.ownerDocument)
? $( elem )[ dd.relative ? "position" : "offset" ]() || { top:0, left:0 }
: { top: 0, left: 0 };
return {
drag: elem,
callback: new drag.callba... | [
"function",
"(",
"elem",
",",
"dd",
")",
"{",
"var",
"offset",
"=",
"(",
"elem",
"&&",
"elem",
".",
"ownerDocument",
")",
"?",
"$",
"(",
"elem",
")",
"[",
"dd",
".",
"relative",
"?",
"\"position\"",
":",
"\"offset\"",
"]",
"(",
")",
"||",
"{",
"t... | returns an interaction object | [
"returns",
"an",
"interaction",
"object"
] | 566784e9d77dea811c43b39dd6ed6a156d28c751 | https://github.com/cmap/morpheus.js/blob/566784e9d77dea811c43b39dd6ed6a156d28c751/js/jquery.event.drag-2.3.0.js#L162-L172 | |
31,901 | cmap/morpheus.js | js/jquery.event.drag-2.3.0.js | function( event, type, dd, x, elem ){
// not configured
if ( !dd )
return;
// remember the original event and type
var orig = { event:event.originalEvent, type:event.type },
// is the event drag related or drog relat... | javascript | function( event, type, dd, x, elem ){
// not configured
if ( !dd )
return;
// remember the original event and type
var orig = { event:event.originalEvent, type:event.type },
// is the event drag related or drog relat... | [
"function",
"(",
"event",
",",
"type",
",",
"dd",
",",
"x",
",",
"elem",
")",
"{",
"// not configured",
"if",
"(",
"!",
"dd",
")",
"return",
";",
"// remember the original event and type",
"var",
"orig",
"=",
"{",
"event",
":",
"event",
".",
"originalEvent... | re-use event object for custom events | [
"re",
"-",
"use",
"event",
"object",
"for",
"custom",
"events"
] | 566784e9d77dea811c43b39dd6ed6a156d28c751 | https://github.com/cmap/morpheus.js/blob/566784e9d77dea811c43b39dd6ed6a156d28c751/js/jquery.event.drag-2.3.0.js#L229-L307 | |
31,902 | cmap/morpheus.js | js/jquery.event.drag-2.3.0.js | function( arr ){
return $.map( arr, function( member ){
return member && member.jquery ? $.makeArray( member ) :
member && member.length ? drag.flatten( member ) : member;
});
} | javascript | function( arr ){
return $.map( arr, function( member ){
return member && member.jquery ? $.makeArray( member ) :
member && member.length ? drag.flatten( member ) : member;
});
} | [
"function",
"(",
"arr",
")",
"{",
"return",
"$",
".",
"map",
"(",
"arr",
",",
"function",
"(",
"member",
")",
"{",
"return",
"member",
"&&",
"member",
".",
"jquery",
"?",
"$",
".",
"makeArray",
"(",
"member",
")",
":",
"member",
"&&",
"member",
"."... | flatten nested jquery objects and arrays into a single dimension array | [
"flatten",
"nested",
"jquery",
"objects",
"and",
"arrays",
"into",
"a",
"single",
"dimension",
"array"
] | 566784e9d77dea811c43b39dd6ed6a156d28c751 | https://github.com/cmap/morpheus.js/blob/566784e9d77dea811c43b39dd6ed6a156d28c751/js/jquery.event.drag-2.3.0.js#L340-L345 | |
31,903 | cmap/morpheus.js | js/tsne.js | function (n) {
if (typeof(n) === 'undefined' || isNaN(n)) {
return [];
}
if (typeof ArrayBuffer === 'undefined') {
// lacking browser support
var arr = new Array(n);
for (var i = 0; i < n; i++) {
arr[i] = 0;
}
return arr;
} else {
return new Float64Array(n); // typed arrays are faster
... | javascript | function (n) {
if (typeof(n) === 'undefined' || isNaN(n)) {
return [];
}
if (typeof ArrayBuffer === 'undefined') {
// lacking browser support
var arr = new Array(n);
for (var i = 0; i < n; i++) {
arr[i] = 0;
}
return arr;
} else {
return new Float64Array(n); // typed arrays are faster
... | [
"function",
"(",
"n",
")",
"{",
"if",
"(",
"typeof",
"(",
"n",
")",
"===",
"'undefined'",
"||",
"isNaN",
"(",
"n",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"if",
"(",
"typeof",
"ArrayBuffer",
"===",
"'undefined'",
")",
"{",
"// lacking browser su... | utilitity that creates contiguous vector of zeros of size n | [
"utilitity",
"that",
"creates",
"contiguous",
"vector",
"of",
"zeros",
"of",
"size",
"n"
] | 566784e9d77dea811c43b39dd6ed6a156d28c751 | https://github.com/cmap/morpheus.js/blob/566784e9d77dea811c43b39dd6ed6a156d28c751/js/tsne.js#L45-L59 | |
31,904 | cmap/morpheus.js | js/tsne.js | function (n, d, s) {
var uses = typeof s !== 'undefined';
var x = [];
for (var i = 0; i < n; i++) {
var xhere = [];
for (var j = 0; j < d; j++) {
if (uses) {
xhere.push(s);
} else {
xhere.push(randn(0.0, 1e-4));
}
}
x.push(xhere);
}
return x;
} | javascript | function (n, d, s) {
var uses = typeof s !== 'undefined';
var x = [];
for (var i = 0; i < n; i++) {
var xhere = [];
for (var j = 0; j < d; j++) {
if (uses) {
xhere.push(s);
} else {
xhere.push(randn(0.0, 1e-4));
}
}
x.push(xhere);
}
return x;
} | [
"function",
"(",
"n",
",",
"d",
",",
"s",
")",
"{",
"var",
"uses",
"=",
"typeof",
"s",
"!==",
"'undefined'",
";",
"var",
"x",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"var",
"xher... | utility that returns 2d array filled with random numbers or with value s, if provided | [
"utility",
"that",
"returns",
"2d",
"array",
"filled",
"with",
"random",
"numbers",
"or",
"with",
"value",
"s",
"if",
"provided"
] | 566784e9d77dea811c43b39dd6ed6a156d28c751 | https://github.com/cmap/morpheus.js/blob/566784e9d77dea811c43b39dd6ed6a156d28c751/js/tsne.js#L63-L78 | |
31,905 | cmap/morpheus.js | js/tsne.js | function (x1, x2) {
var D = x1.length;
var d = 0;
for (var i = 0; i < D; i++) {
var x1i = x1[i];
var x2i = x2[i];
d += (x1i - x2i) * (x1i - x2i);
}
return d;
} | javascript | function (x1, x2) {
var D = x1.length;
var d = 0;
for (var i = 0; i < D; i++) {
var x1i = x1[i];
var x2i = x2[i];
d += (x1i - x2i) * (x1i - x2i);
}
return d;
} | [
"function",
"(",
"x1",
",",
"x2",
")",
"{",
"var",
"D",
"=",
"x1",
".",
"length",
";",
"var",
"d",
"=",
"0",
";",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"D",
";",
"i",
"++",
")",
"{",
"var",
"x1i",
"=",
"x1",
"[",
"i",
"]",
... | compute L2 distance between two vectors | [
"compute",
"L2",
"distance",
"between",
"two",
"vectors"
] | 566784e9d77dea811c43b39dd6ed6a156d28c751 | https://github.com/cmap/morpheus.js/blob/566784e9d77dea811c43b39dd6ed6a156d28c751/js/tsne.js#L81-L90 | |
31,906 | cmap/morpheus.js | js/tsne.js | function (X) {
var N = X.length;
var dist = zeros(N * N); // allocate contiguous array
for (var i = 0; i < N; i++) {
for (var j = i + 1; j < N; j++) {
var d = L2(X[i], X[j]);
dist[i * N + j] = d;
dist[j * N + i] = d;
}
}
return dist;
} | javascript | function (X) {
var N = X.length;
var dist = zeros(N * N); // allocate contiguous array
for (var i = 0; i < N; i++) {
for (var j = i + 1; j < N; j++) {
var d = L2(X[i], X[j]);
dist[i * N + j] = d;
dist[j * N + i] = d;
}
}
return dist;
} | [
"function",
"(",
"X",
")",
"{",
"var",
"N",
"=",
"X",
".",
"length",
";",
"var",
"dist",
"=",
"zeros",
"(",
"N",
"*",
"N",
")",
";",
"// allocate contiguous array",
"for",
"(",
"var",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",
"i",
"++",
")",
"{... | compute pairwise distance in all vectors in X | [
"compute",
"pairwise",
"distance",
"in",
"all",
"vectors",
"in",
"X"
] | 566784e9d77dea811c43b39dd6ed6a156d28c751 | https://github.com/cmap/morpheus.js/blob/566784e9d77dea811c43b39dd6ed6a156d28c751/js/tsne.js#L93-L104 | |
31,907 | cmap/morpheus.js | js/tsne.js | function (X) {
var N = X.length;
var D = X[0].length;
assert(N > 0, " X is empty? You must have some data!");
assert(D > 0, " X[0] is empty? Where is the data?");
var dists = xtod(X); // convert X to distances using gaussian kernel
this.P = d2p(dists, this.perplexity, 1e-4); // attach to object
thi... | javascript | function (X) {
var N = X.length;
var D = X[0].length;
assert(N > 0, " X is empty? You must have some data!");
assert(D > 0, " X[0] is empty? Where is the data?");
var dists = xtod(X); // convert X to distances using gaussian kernel
this.P = d2p(dists, this.perplexity, 1e-4); // attach to object
thi... | [
"function",
"(",
"X",
")",
"{",
"var",
"N",
"=",
"X",
".",
"length",
";",
"var",
"D",
"=",
"X",
"[",
"0",
"]",
".",
"length",
";",
"assert",
"(",
"N",
">",
"0",
",",
"\" X is empty? You must have some data!\"",
")",
";",
"assert",
"(",
"D",
">",
... | this function takes a set of high-dimensional points and creates matrix P from them using gaussian kernel | [
"this",
"function",
"takes",
"a",
"set",
"of",
"high",
"-",
"dimensional",
"points",
"and",
"creates",
"matrix",
"P",
"from",
"them",
"using",
"gaussian",
"kernel"
] | 566784e9d77dea811c43b39dd6ed6a156d28c751 | https://github.com/cmap/morpheus.js/blob/566784e9d77dea811c43b39dd6ed6a156d28c751/js/tsne.js#L217-L226 | |
31,908 | cmap/morpheus.js | js/tsne.js | function (D) {
var N = D.length;
assert(N > 0, " X is empty? You must have some data!");
// convert D to a (fast) typed array version
var dists = zeros(N * N); // allocate contiguous array
for (var i = 0; i < N; i++) {
for (var j = i + 1; j < N; j++) {
var d = D[i][j];
dists[i * N + j] = d;... | javascript | function (D) {
var N = D.length;
assert(N > 0, " X is empty? You must have some data!");
// convert D to a (fast) typed array version
var dists = zeros(N * N); // allocate contiguous array
for (var i = 0; i < N; i++) {
for (var j = i + 1; j < N; j++) {
var d = D[i][j];
dists[i * N + j] = d;... | [
"function",
"(",
"D",
")",
"{",
"var",
"N",
"=",
"D",
".",
"length",
";",
"assert",
"(",
"N",
">",
"0",
",",
"\" X is empty? You must have some data!\"",
")",
";",
"// convert D to a (fast) typed array version",
"var",
"dists",
"=",
"zeros",
"(",
"N",
"*",
"... | this function takes a given distance matrix and creates matrix P from them. D is assumed to be provided as a list of lists, and should be symmetric | [
"this",
"function",
"takes",
"a",
"given",
"distance",
"matrix",
"and",
"creates",
"matrix",
"P",
"from",
"them",
".",
"D",
"is",
"assumed",
"to",
"be",
"provided",
"as",
"a",
"list",
"of",
"lists",
"and",
"should",
"be",
"symmetric"
] | 566784e9d77dea811c43b39dd6ed6a156d28c751 | https://github.com/cmap/morpheus.js/blob/566784e9d77dea811c43b39dd6ed6a156d28c751/js/tsne.js#L231-L246 | |
31,909 | cmap/morpheus.js | js/tsne.js | function () {
this.iter += 1;
var N = this.N;
var cg = this.costGrad(this.Y); // evaluate gradient
var cost = cg.cost;
var grad = cg.grad;
// perform gradient step
var ymean = zeros(this.dim);
for (var i = 0; i < N; i++) {
for (var d = 0; d < this.dim; d++) {
var gid = grad[i][d];
... | javascript | function () {
this.iter += 1;
var N = this.N;
var cg = this.costGrad(this.Y); // evaluate gradient
var cost = cg.cost;
var grad = cg.grad;
// perform gradient step
var ymean = zeros(this.dim);
for (var i = 0; i < N; i++) {
for (var d = 0; d < this.dim; d++) {
var gid = grad[i][d];
... | [
"function",
"(",
")",
"{",
"this",
".",
"iter",
"+=",
"1",
";",
"var",
"N",
"=",
"this",
".",
"N",
";",
"var",
"cg",
"=",
"this",
".",
"costGrad",
"(",
"this",
".",
"Y",
")",
";",
"// evaluate gradient",
"var",
"cost",
"=",
"cg",
".",
"cost",
"... | perform a single step of optimization to improve the embedding | [
"perform",
"a",
"single",
"step",
"of",
"optimization",
"to",
"improve",
"the",
"embedding"
] | 566784e9d77dea811c43b39dd6ed6a156d28c751 | https://github.com/cmap/morpheus.js/blob/566784e9d77dea811c43b39dd6ed6a156d28c751/js/tsne.js#L263-L305 | |
31,910 | cmap/morpheus.js | js/tsne.js | function (Y) {
var N = this.N;
var dim = this.dim; // dim of output space
var P = this.P;
var pmul = this.iter < 100 ? 4 : 1; // trick that helps with local optima
// compute current Q distribution, unnormalized first
var Qu = zeros(N * N);
var qsum = 0.0;
for (var i = 0; i < N; i++) {
for... | javascript | function (Y) {
var N = this.N;
var dim = this.dim; // dim of output space
var P = this.P;
var pmul = this.iter < 100 ? 4 : 1; // trick that helps with local optima
// compute current Q distribution, unnormalized first
var Qu = zeros(N * N);
var qsum = 0.0;
for (var i = 0; i < N; i++) {
for... | [
"function",
"(",
"Y",
")",
"{",
"var",
"N",
"=",
"this",
".",
"N",
";",
"var",
"dim",
"=",
"this",
".",
"dim",
";",
"// dim of output space",
"var",
"P",
"=",
"this",
".",
"P",
";",
"var",
"pmul",
"=",
"this",
".",
"iter",
"<",
"100",
"?",
"4",... | return cost and gradient, given an arrangement | [
"return",
"cost",
"and",
"gradient",
"given",
"an",
"arrangement"
] | 566784e9d77dea811c43b39dd6ed6a156d28c751 | https://github.com/cmap/morpheus.js/blob/566784e9d77dea811c43b39dd6ed6a156d28c751/js/tsne.js#L336-L387 | |
31,911 | forbesmyester/SyncIt | makeAsync.js | function() {
var args = Array.prototype.slice.call(arguments);
args.unshift(null);
var Factory = classFunc.bind.apply(
classFunc,
args
);
this._inst = new Factory();
} | javascript | function() {
var args = Array.prototype.slice.call(arguments);
args.unshift(null);
var Factory = classFunc.bind.apply(
classFunc,
args
);
this._inst = new Factory();
} | [
"function",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
")",
";",
"args",
".",
"unshift",
"(",
"null",
")",
";",
"var",
"Factory",
"=",
"classFunc",
".",
"bind",
".",
"apply",
"(",
"cla... | This will create the constructor | [
"This",
"will",
"create",
"the",
"constructor"
] | f1e8e7eda7552b11f083a779e01c4fab5f073167 | https://github.com/forbesmyester/SyncIt/blob/f1e8e7eda7552b11f083a779e01c4fab5f073167/makeAsync.js#L40-L48 | |
31,912 | rtc-io/rtc-screenshare | electron.js | simpleSelector | function simpleSelector(sources, callback) {
var options = crel('select', {
style: 'margin: 0.5rem'
}, sources.map(function(source) {
return crel('option', {id: source.id, value: source.id}, source.name);
}));
var selector = crel('div',
{
style: 'position: absolute; padding: 1rem; z-index: 9... | javascript | function simpleSelector(sources, callback) {
var options = crel('select', {
style: 'margin: 0.5rem'
}, sources.map(function(source) {
return crel('option', {id: source.id, value: source.id}, source.name);
}));
var selector = crel('div',
{
style: 'position: absolute; padding: 1rem; z-index: 9... | [
"function",
"simpleSelector",
"(",
"sources",
",",
"callback",
")",
"{",
"var",
"options",
"=",
"crel",
"(",
"'select'",
",",
"{",
"style",
":",
"'margin: 0.5rem'",
"}",
",",
"sources",
".",
"map",
"(",
"function",
"(",
"source",
")",
"{",
"return",
"cre... | This is just a simple default screen selector implementation | [
"This",
"is",
"just",
"a",
"simple",
"default",
"screen",
"selector",
"implementation"
] | 0a160e73031a8b0f43111c22f48db6dbde3be305 | https://github.com/rtc-io/rtc-screenshare/blob/0a160e73031a8b0f43111c22f48db6dbde3be305/electron.js#L84-L123 |
31,913 | InvokIT/js-untar | src/untar.js | untar | function untar(arrayBuffer) {
if (!(arrayBuffer instanceof ArrayBuffer)) {
throw new TypeError("arrayBuffer is not an instance of ArrayBuffer.");
}
if (!global.Worker) {
throw new Error("Worker implementation is not available in this environment.");
}
return new ProgressivePromise(function(resolve, reject, p... | javascript | function untar(arrayBuffer) {
if (!(arrayBuffer instanceof ArrayBuffer)) {
throw new TypeError("arrayBuffer is not an instance of ArrayBuffer.");
}
if (!global.Worker) {
throw new Error("Worker implementation is not available in this environment.");
}
return new ProgressivePromise(function(resolve, reject, p... | [
"function",
"untar",
"(",
"arrayBuffer",
")",
"{",
"if",
"(",
"!",
"(",
"arrayBuffer",
"instanceof",
"ArrayBuffer",
")",
")",
"{",
"throw",
"new",
"TypeError",
"(",
"\"arrayBuffer is not an instance of ArrayBuffer.\"",
")",
";",
"}",
"if",
"(",
"!",
"global",
... | Returns a ProgressivePromise. | [
"Returns",
"a",
"ProgressivePromise",
"."
] | 49e639cf82e8d58dccb3458cbd08768afee8b41c | https://github.com/InvokIT/js-untar/blob/49e639cf82e8d58dccb3458cbd08768afee8b41c/src/untar.js#L12-L61 |
31,914 | sidorares/hot-module-replacement | index.js | collectDependencies | function collectDependencies(module) {
let paths = [];
function pathsToAcceptingModules(path, root) {
const requiredMe = parents[root.filename];
if (module.hot._selfAccepted) {
paths.push(path.concat(root.filename));
return;
}
if (module.hot._selfDeclined) {
retur... | javascript | function collectDependencies(module) {
let paths = [];
function pathsToAcceptingModules(path, root) {
const requiredMe = parents[root.filename];
if (module.hot._selfAccepted) {
paths.push(path.concat(root.filename));
return;
}
if (module.hot._selfDeclined) {
retur... | [
"function",
"collectDependencies",
"(",
"module",
")",
"{",
"let",
"paths",
"=",
"[",
"]",
";",
"function",
"pathsToAcceptingModules",
"(",
"path",
",",
"root",
")",
"{",
"const",
"requiredMe",
"=",
"parents",
"[",
"root",
".",
"filename",
"]",
";",
"if",
... | module is changed, which dependency needs to be reloaded? | [
"module",
"is",
"changed",
"which",
"dependency",
"needs",
"to",
"be",
"reloaded?"
] | 2af226b9e8fd1ce75b40b96c0920f053e92db450 | https://github.com/sidorares/hot-module-replacement/blob/2af226b9e8fd1ce75b40b96c0920f053e92db450/index.js#L22-L47 |
31,915 | dstreet/dependsOn | src/dependency.js | getFieldState | function getFieldState($ele) {
var val = $ele.val()
// If dependency is a radio group, then filter by `:checked`
if ($ele.attr('type') === 'radio') {
val = $ele.filter(':checked').val()
}
return {
value: val,
checked: $ele.is(':checked'),
disabled: $ele.is(':disabled'),
selected: $ele.is(':selected')
... | javascript | function getFieldState($ele) {
var val = $ele.val()
// If dependency is a radio group, then filter by `:checked`
if ($ele.attr('type') === 'radio') {
val = $ele.filter(':checked').val()
}
return {
value: val,
checked: $ele.is(':checked'),
disabled: $ele.is(':disabled'),
selected: $ele.is(':selected')
... | [
"function",
"getFieldState",
"(",
"$ele",
")",
"{",
"var",
"val",
"=",
"$ele",
".",
"val",
"(",
")",
"// If dependency is a radio group, then filter by `:checked`",
"if",
"(",
"$ele",
".",
"attr",
"(",
"'type'",
")",
"===",
"'radio'",
")",
"{",
"val",
"=",
"... | Get the current state of a field
@param {jQuery} $ele The element
@return {Object}
@private | [
"Get",
"the",
"current",
"state",
"of",
"a",
"field"
] | a40100652aa6a6f7748bf3cd761578b34b82d547 | https://github.com/dstreet/dependsOn/blob/a40100652aa6a6f7748bf3cd761578b34b82d547/src/dependency.js#L311-L325 |
31,916 | smsapi/smsapi-javascript-client | lib/smsapi.js | SMSAPI | function SMSAPI(options) {
options = options || {};
if (options.proxy)
this.proxy(options.proxy);
else
this.proxy(new ProxyHttp({
server: options.server
}));
var moduleOptions = {
proxy: this.proxy()
};
// init authentication
if (options.oauth) ... | javascript | function SMSAPI(options) {
options = options || {};
if (options.proxy)
this.proxy(options.proxy);
else
this.proxy(new ProxyHttp({
server: options.server
}));
var moduleOptions = {
proxy: this.proxy()
};
// init authentication
if (options.oauth) ... | [
"function",
"SMSAPI",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"if",
"(",
"options",
".",
"proxy",
")",
"this",
".",
"proxy",
"(",
"options",
".",
"proxy",
")",
";",
"else",
"this",
".",
"proxy",
"(",
"new",
"ProxyH... | SMSAPI main class
@param {Object} [options]
@param {String} [options.server] url to the server
@param {Object} [options.oauth] if provided will use oauth, simple auth otherwise
@param {String} options.oauth.clientId
@param {String} options.oauth.clientSecret
@param {String} [... | [
"SMSAPI",
"main",
"class"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/smsapi.js#L28-L74 |
31,917 | smsapi/smsapi-javascript-client | lib/authentication-oauth.js | AuthenticationOAuth | function AuthenticationOAuth(options) {
AuthenticationAbstract.call(this, options);
options = options || {};
this._token = {
access: options.accessToken || null
};
} | javascript | function AuthenticationOAuth(options) {
AuthenticationAbstract.call(this, options);
options = options || {};
this._token = {
access: options.accessToken || null
};
} | [
"function",
"AuthenticationOAuth",
"(",
"options",
")",
"{",
"AuthenticationAbstract",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"_token",
"=",
"{",
"access",
":",
"options",
".",
"ac... | use oauth for authentication
@param {Object} options
@param {String} options.accessToken
@extends AuthenticationAbstract
@constructor | [
"use",
"oauth",
"for",
"authentication"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/authentication-oauth.js#L12-L18 |
31,918 | smsapi/smsapi-javascript-client | lib/contacts-groups-permissions-get.js | ContactsGroupsPermissionsGet | function ContactsGroupsPermissionsGet(options, groupId, username) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._username = username;
} | javascript | function ContactsGroupsPermissionsGet(options, groupId, username) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._username = username;
} | [
"function",
"ContactsGroupsPermissionsGet",
"(",
"options",
",",
"groupId",
",",
"username",
")",
"{",
"ActionAbstract",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"_groupId",
"=",
"groupId",
";",
"this",
".",
"_username",
"=",
"usernam... | get group permissions for user
@see http://dev.smsapi.pl/#!/contacts%2Fgroups/get_0
@param {Object} options
@param {String} groupId
@param {String} username
@extends ActionAbstract
@constructor | [
"get",
"group",
"permissions",
"for",
"user"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/contacts-groups-permissions-get.js#L13-L17 |
31,919 | smsapi/smsapi-javascript-client | lib/contacts-groups-assignments-get.js | ContactsGroupsAssignmentsGet | function ContactsGroupsAssignmentsGet(options, contactId, groupId) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._contactId = contactId;
} | javascript | function ContactsGroupsAssignmentsGet(options, contactId, groupId) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._contactId = contactId;
} | [
"function",
"ContactsGroupsAssignmentsGet",
"(",
"options",
",",
"contactId",
",",
"groupId",
")",
"{",
"ActionAbstract",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"_groupId",
"=",
"groupId",
";",
"this",
".",
"_contactId",
"=",
"conta... | get group related to contact
@see http://dev.smsapi.pl/#!/contacts/getGroup_0
@param {Object} options
@param {String} contactId
@param {String} groupId
@extends ActionAbstract
@constructor | [
"get",
"group",
"related",
"to",
"contact"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/contacts-groups-assignments-get.js#L13-L17 |
31,920 | smsapi/smsapi-javascript-client | lib/contacts-groups-assignments-delete.js | ContactsGroupsAssignmentsDelete | function ContactsGroupsAssignmentsDelete(options, contactId, groupId) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._contactId = contactId;
} | javascript | function ContactsGroupsAssignmentsDelete(options, contactId, groupId) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._contactId = contactId;
} | [
"function",
"ContactsGroupsAssignmentsDelete",
"(",
"options",
",",
"contactId",
",",
"groupId",
")",
"{",
"ActionAbstract",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"_groupId",
"=",
"groupId",
";",
"this",
".",
"_contactId",
"=",
"co... | unpin contact from group
@see http://dev.smsapi.pl/#!/contacts/unpinContactGroup
@param {Object} options
@param {String} contactId
@param {String} groupId
@extends ActionAbstract
@constructor | [
"unpin",
"contact",
"from",
"group"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/contacts-groups-assignments-delete.js#L13-L17 |
31,921 | smsapi/smsapi-javascript-client | lib/contacts-groups-members-get.js | ContactsGroupsMembersGet | function ContactsGroupsMembersGet(options, groupId, contactId) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._contactId = contactId;
} | javascript | function ContactsGroupsMembersGet(options, groupId, contactId) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._contactId = contactId;
} | [
"function",
"ContactsGroupsMembersGet",
"(",
"options",
",",
"groupId",
",",
"contactId",
")",
"{",
"ActionAbstract",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"_groupId",
"=",
"groupId",
";",
"this",
".",
"_contactId",
"=",
"contactId... | check whether contact is in group
@see http://dev.smsapi.pl/#!/contacts%2Fgroups/contactsGet
@param {Object} options
@param {String} groupId
@param {String} contactId
@extends ActionAbstract
@constructor | [
"check",
"whether",
"contact",
"is",
"in",
"group"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/contacts-groups-members-get.js#L13-L17 |
31,922 | smsapi/smsapi-javascript-client | lib/contacts-groups-members-delete.js | ContactsGroupsMembersDelete | function ContactsGroupsMembersDelete(options, groupId, contactId) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._contactId = contactId;
} | javascript | function ContactsGroupsMembersDelete(options, groupId, contactId) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._contactId = contactId;
} | [
"function",
"ContactsGroupsMembersDelete",
"(",
"options",
",",
"groupId",
",",
"contactId",
")",
"{",
"ActionAbstract",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"_groupId",
"=",
"groupId",
";",
"this",
".",
"_contactId",
"=",
"contac... | unpin contact from the group
@see http://dev.smsapi.pl/#!/contacts%2Fgroups/contactsDelete
@param {Object} options
@param {String} groupId
@param {String} contactId
@extends ActionAbstract
@constructor | [
"unpin",
"contact",
"from",
"the",
"group"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/contacts-groups-members-delete.js#L13-L17 |
31,923 | smsapi/smsapi-javascript-client | lib/contacts-groups-assignments-add.js | ContactsGroupsAssignmentsAdd | function ContactsGroupsAssignmentsAdd(options, contactId, groupId) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._contactId = contactId;
} | javascript | function ContactsGroupsAssignmentsAdd(options, contactId, groupId) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._contactId = contactId;
} | [
"function",
"ContactsGroupsAssignmentsAdd",
"(",
"options",
",",
"contactId",
",",
"groupId",
")",
"{",
"ActionAbstract",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"_groupId",
"=",
"groupId",
";",
"this",
".",
"_contactId",
"=",
"conta... | Assign contact to group
@see http://dev.smsapi.pl/#!/contacts/assignGroup
@param {Object} options
@param {String} contactId
@param {String} groupId
@extends ActionAbstract
@constructor | [
"Assign",
"contact",
"to",
"group"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/contacts-groups-assignments-add.js#L13-L17 |
31,924 | smsapi/smsapi-javascript-client | lib/contacts-groups-members-add.js | ContactsGroupsMembersAdd | function ContactsGroupsMembersAdd(options, groupId, contactId) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._contactId = contactId;
} | javascript | function ContactsGroupsMembersAdd(options, groupId, contactId) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._contactId = contactId;
} | [
"function",
"ContactsGroupsMembersAdd",
"(",
"options",
",",
"groupId",
",",
"contactId",
")",
"{",
"ActionAbstract",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"_groupId",
"=",
"groupId",
";",
"this",
".",
"_contactId",
"=",
"contactId... | pin contact to the group
@see http://dev.smsapi.pl/#!/contacts%2Fgroups/contactsPut
@param {Object} options
@param {String} groupId
@param {String} contactId
@extends ActionAbstract
@constructor | [
"pin",
"contact",
"to",
"the",
"group"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/contacts-groups-members-add.js#L13-L17 |
31,925 | smsapi/smsapi-javascript-client | lib/contacts-groups-permissions-delete.js | ContactsGroupsPermissionsDelete | function ContactsGroupsPermissionsDelete(options, groupId, username) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._username = username;
} | javascript | function ContactsGroupsPermissionsDelete(options, groupId, username) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._username = username;
} | [
"function",
"ContactsGroupsPermissionsDelete",
"(",
"options",
",",
"groupId",
",",
"username",
")",
"{",
"ActionAbstract",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"_groupId",
"=",
"groupId",
";",
"this",
".",
"_username",
"=",
"user... | delete group permissions for user
@see http://dev.smsapi.pl/#!/contacts%2Fgroups/delete_0
@param {Object} options
@param {String} groupId
@param {String} username
@extends ActionAbstract
@constructor | [
"delete",
"group",
"permissions",
"for",
"user"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/contacts-groups-permissions-delete.js#L13-L17 |
31,926 | smsapi/smsapi-javascript-client | lib/proxy-http.js | ProxyHttp | function ProxyHttp(options) {
ProxyAbstract.call(this, options);
this._server = options.server || 'https://api.smsapi.pl/';
this._auth = options.auth || null;
} | javascript | function ProxyHttp(options) {
ProxyAbstract.call(this, options);
this._server = options.server || 'https://api.smsapi.pl/';
this._auth = options.auth || null;
} | [
"function",
"ProxyHttp",
"(",
"options",
")",
"{",
"ProxyAbstract",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"_server",
"=",
"options",
".",
"server",
"||",
"'https://api.smsapi.pl/'",
";",
"this",
".",
"_auth",
"=",
"options",
".",... | proxy for http server
@param {Object} [options]
@param {String} [options.server] url to the server
@param {AuthenticationAbstract} [options.auth] authentication object | [
"proxy",
"for",
"http",
"server"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/proxy-http.js#L10-L14 |
31,927 | smsapi/smsapi-javascript-client | lib/request.js | Request | function Request(options) {
options = options || {};
this._server = options.server || '';
this._path = options.path || '';
this._json = options.json || false;
this._data = options.data || {};
this._auth = options.auth || null;
this._file = options.file || null;
this._method = options.met... | javascript | function Request(options) {
options = options || {};
this._server = options.server || '';
this._path = options.path || '';
this._json = options.json || false;
this._data = options.data || {};
this._auth = options.auth || null;
this._file = options.file || null;
this._method = options.met... | [
"function",
"Request",
"(",
"options",
")",
"{",
"options",
"=",
"options",
"||",
"{",
"}",
";",
"this",
".",
"_server",
"=",
"options",
".",
"server",
"||",
"''",
";",
"this",
".",
"_path",
"=",
"options",
".",
"path",
"||",
"''",
";",
"this",
"."... | single request to the server
@param {Object} [options]
@param {String} [options.server]
@param {String} [options.path]
@param {Boolean} [options.json]
@param {Object} [options.data]
@param {AuthenticationAbstract} [options.auth]
@param {Stri... | [
"single",
"request",
"to",
"the",
"server"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/request.js#L16-L25 |
31,928 | smsapi/smsapi-javascript-client | lib/contacts-groups-permissions-add.js | ContactsGroupsPermissionsAdd | function ContactsGroupsPermissionsAdd(options, groupId, username) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._username = username;
} | javascript | function ContactsGroupsPermissionsAdd(options, groupId, username) {
ActionAbstract.call(this, options);
this._groupId = groupId;
this._username = username;
} | [
"function",
"ContactsGroupsPermissionsAdd",
"(",
"options",
",",
"groupId",
",",
"username",
")",
"{",
"ActionAbstract",
".",
"call",
"(",
"this",
",",
"options",
")",
";",
"this",
".",
"_groupId",
"=",
"groupId",
";",
"this",
".",
"_username",
"=",
"usernam... | add permissions for the user
@see http://dev.smsapi.pl/#!/contacts%2Fgroups/edit_0
@param {Object} options
@param {String} groupId
@param {String} username
@extends ActionAbstract
@constructor | [
"add",
"permissions",
"for",
"the",
"user"
] | fe181a00e02fa4df874e02782e2e3813ab541803 | https://github.com/smsapi/smsapi-javascript-client/blob/fe181a00e02fa4df874e02782e2e3813ab541803/lib/contacts-groups-permissions-add.js#L13-L17 |
31,929 | amuramoto/messenger-node | lib/client/messages/message-creative/index.js | createMessageCreative | function createMessageCreative (message) {
return new Promise (async (resolve, reject) => {
if (!message) {
reject('Valid message object required');
}
let request_options = {
'api_version': 'v2.11',
'path': '/me/message_creatives',
'payload': {
'messages': [util.... | javascript | function createMessageCreative (message) {
return new Promise (async (resolve, reject) => {
if (!message) {
reject('Valid message object required');
}
let request_options = {
'api_version': 'v2.11',
'path': '/me/message_creatives',
'payload': {
'messages': [util.... | [
"function",
"createMessageCreative",
"(",
"message",
")",
"{",
"return",
"new",
"Promise",
"(",
"async",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"if",
"(",
"!",
"message",
")",
"{",
"reject",
"(",
"'Valid message object required'",
")",
";",
"}",
"l... | Creates a new message creative.
@param {Object} message An object that describes the message to send.
@return {Promise<Object>} The API response
@memberof Client#
@example <caption>Text Message</caption>
let message = {'text': 'my text message'};
Client.createMessageCreative(message)
.then(res => {
console.log(res... | [
"Creates",
"a",
"new",
"message",
"creative",
"."
] | d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4 | https://github.com/amuramoto/messenger-node/blob/d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4/lib/client/messages/message-creative/index.js#L45-L66 |
31,930 | amuramoto/messenger-node | lib/client/messages/custom-labels/index.js | createCustomLabel | function createCustomLabel (name) {
return new Promise (async (resolve, reject) => {
if (!name) {
reject('name required');
}
let options = {
'payload': {'name': name}
};
try {
let response = await this.callCustomLabelsApi(options);
resolve(response);
} catch (e) {
... | javascript | function createCustomLabel (name) {
return new Promise (async (resolve, reject) => {
if (!name) {
reject('name required');
}
let options = {
'payload': {'name': name}
};
try {
let response = await this.callCustomLabelsApi(options);
resolve(response);
} catch (e) {
... | [
"function",
"createCustomLabel",
"(",
"name",
")",
"{",
"return",
"new",
"Promise",
"(",
"async",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"if",
"(",
"!",
"name",
")",
"{",
"reject",
"(",
"'name required'",
")",
";",
"}",
"let",
"options",
"=",
... | Creates a new custom label.
@param {String} name The name of the custom label.
@return {Promise<Object>} The API response
@memberof Client#
@example
Client.createCustomLabel('my_custom_label')
.then(res => {
console.log(res); // {"id": "9485676932424"}
}); | [
"Creates",
"a",
"new",
"custom",
"label",
"."
] | d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4 | https://github.com/amuramoto/messenger-node/blob/d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4/lib/client/messages/custom-labels/index.js#L23-L38 |
31,931 | amuramoto/messenger-node | lib/client/messages/custom-labels/index.js | getAllCustomLabels | function getAllCustomLabels () {
return new Promise (async (resolve, reject) => {
let options = {
'qs': {'fields': 'id,name'}
};
try {
let response = await this.callCustomLabelsApi(options);
resolve(response);
} catch (e) {
reject(e);
}
});
} | javascript | function getAllCustomLabels () {
return new Promise (async (resolve, reject) => {
let options = {
'qs': {'fields': 'id,name'}
};
try {
let response = await this.callCustomLabelsApi(options);
resolve(response);
} catch (e) {
reject(e);
}
});
} | [
"function",
"getAllCustomLabels",
"(",
")",
"{",
"return",
"new",
"Promise",
"(",
"async",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"options",
"=",
"{",
"'qs'",
":",
"{",
"'fields'",
":",
"'id,name'",
"}",
"}",
";",
"try",
"{",
"let",
"r... | Retrieves the list of all custom labels.
@return {Promise<Object>} The API response
@memberof Client#
@example
let field = ['name', 'id']; //optional
Client.getAllCustomLabels(fields)
.then(res => {
console.log(res);
// {
// "data": [
// { "name": "myLabel", "id": "1001200005003"},
// { "name": "myOtherLabe... | [
"Retrieves",
"the",
"list",
"of",
"all",
"custom",
"labels",
"."
] | d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4 | https://github.com/amuramoto/messenger-node/blob/d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4/lib/client/messages/custom-labels/index.js#L138-L151 |
31,932 | amuramoto/messenger-node | lib/client/messages/custom-labels/index.js | deleteCustomLabel | function deleteCustomLabel (label_id) {
return new Promise (async (resolve, reject) => {
if (!label_id) {
reject('label_id required');
return;
}
let options = {
'method': 'DELETE',
'path': '/' + label_id
};
try {
let response = await this.callCustomLabelsApi(options... | javascript | function deleteCustomLabel (label_id) {
return new Promise (async (resolve, reject) => {
if (!label_id) {
reject('label_id required');
return;
}
let options = {
'method': 'DELETE',
'path': '/' + label_id
};
try {
let response = await this.callCustomLabelsApi(options... | [
"function",
"deleteCustomLabel",
"(",
"label_id",
")",
"{",
"return",
"new",
"Promise",
"(",
"async",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"if",
"(",
"!",
"label_id",
")",
"{",
"reject",
"(",
"'label_id required'",
")",
";",
"return",
";",
"}",... | Deletes a custom label.
@param {Integer} label_id The ID of the custom label to delete.
@return {Promise<Object>} The API response
@memberof Client#
@example
Client.deleteCustomLabel(094730967209673)
.then(res => {
console.log(res); // {"success": true}
}); | [
"Deletes",
"a",
"custom",
"label",
"."
] | d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4 | https://github.com/amuramoto/messenger-node/blob/d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4/lib/client/messages/custom-labels/index.js#L164-L182 |
31,933 | amuramoto/messenger-node | lib/client/messages/custom-labels/index.js | addPsidtoCustomLabel | function addPsidtoCustomLabel (psid, label_id) {
return new Promise (async (resolve, reject) => {
if (!psid || !label_id) {
reject('PSID and label_id required');
return;
}
let options = {
'path': `/${label_id}/label`,
'payload': {'user': psid}
};
try {
let response = ... | javascript | function addPsidtoCustomLabel (psid, label_id) {
return new Promise (async (resolve, reject) => {
if (!psid || !label_id) {
reject('PSID and label_id required');
return;
}
let options = {
'path': `/${label_id}/label`,
'payload': {'user': psid}
};
try {
let response = ... | [
"function",
"addPsidtoCustomLabel",
"(",
"psid",
",",
"label_id",
")",
"{",
"return",
"new",
"Promise",
"(",
"async",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"if",
"(",
"!",
"psid",
"||",
"!",
"label_id",
")",
"{",
"reject",
"(",
"'PSID and label_... | Associates a user's PSID to a custom label.
@param {Integer} psid PSID of the user to associate with the custom label.
@param {Integer} label_id The ID of a custom label. Created with {@link #createcustomlabel|createCustomLabel()}.
@return {Promise<Object>} The API response
@memberof Client#
@example
let psid =... | [
"Associates",
"a",
"user",
"s",
"PSID",
"to",
"a",
"custom",
"label",
"."
] | d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4 | https://github.com/amuramoto/messenger-node/blob/d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4/lib/client/messages/custom-labels/index.js#L198-L215 |
31,934 | amuramoto/messenger-node | lib/client/index.js | Client | function Client (options) {
let GraphRequest = new graphRequest(options);
Object.assign(
this,
GraphRequest,
new messages(GraphRequest),
new messengerProfile(GraphRequest),
new person(GraphRequest),
new messengerCode(GraphRequest),
new messagingInsights(GraphRequest),
new at... | javascript | function Client (options) {
let GraphRequest = new graphRequest(options);
Object.assign(
this,
GraphRequest,
new messages(GraphRequest),
new messengerProfile(GraphRequest),
new person(GraphRequest),
new messengerCode(GraphRequest),
new messagingInsights(GraphRequest),
new at... | [
"function",
"Client",
"(",
"options",
")",
"{",
"let",
"GraphRequest",
"=",
"new",
"graphRequest",
"(",
"options",
")",
";",
"Object",
".",
"assign",
"(",
"this",
",",
"GraphRequest",
",",
"new",
"messages",
"(",
"GraphRequest",
")",
",",
"new",
"messenger... | Creates an instance of `Client`, used for sending requests to the Messenger Platform APIs.
@constructor
@class Client
@param {Object} options An object that contains the configuration settings for the `Client`.
@param {String} options.page_token A valid Page-scoped access token.
@param {String} options.app_token _Op... | [
"Creates",
"an",
"instance",
"of",
"Client",
"used",
"for",
"sending",
"requests",
"to",
"the",
"Messenger",
"Platform",
"APIs",
"."
] | d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4 | https://github.com/amuramoto/messenger-node/blob/d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4/lib/client/index.js#L29-L45 |
31,935 | amuramoto/messenger-node | lib/client/messages/broadcast/index.js | startBroadcastReachEstimation | function startBroadcastReachEstimation (custom_label_id) {
return new Promise (async (resolve, reject) => {
let options = {
'custom_label_id': custom_label_id || true
};
try {
let response = await this.callBroadcastApi(options);
resolve(response);
} catch (e) {
reject(e);
... | javascript | function startBroadcastReachEstimation (custom_label_id) {
return new Promise (async (resolve, reject) => {
let options = {
'custom_label_id': custom_label_id || true
};
try {
let response = await this.callBroadcastApi(options);
resolve(response);
} catch (e) {
reject(e);
... | [
"function",
"startBroadcastReachEstimation",
"(",
"custom_label_id",
")",
"{",
"return",
"new",
"Promise",
"(",
"async",
"(",
"resolve",
",",
"reject",
")",
"=>",
"{",
"let",
"options",
"=",
"{",
"'custom_label_id'",
":",
"custom_label_id",
"||",
"true",
"}",
... | Start a reach estimation for the number of people that will be
reached by a broadcast to all users or to users associated with
a custom label.
@param {Integer} custom_label_id _Optional._ The ID of a custom label targeted by the broadcast. Created by calling {@link #createcustomlabel|Client.createCustomLabel()}.
@r... | [
"Start",
"a",
"reach",
"estimation",
"for",
"the",
"number",
"of",
"people",
"that",
"will",
"be",
"reached",
"by",
"a",
"broadcast",
"to",
"all",
"users",
"or",
"to",
"users",
"associated",
"with",
"a",
"custom",
"label",
"."
] | d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4 | https://github.com/amuramoto/messenger-node/blob/d6cee1bedeea0ce7a675edbdb0bee6f0f50f44d4/lib/client/messages/broadcast/index.js#L57-L69 |
31,936 | cdiggins/myna-parser | tools/myna_markdown_to_html.js | startTag | function startTag(tag, attr) {
let attrStr = "";
if (attr) {
attrStr = " " + Object.keys(attr).map(function(k) {
return k + ' = "' + attr[k] + '"';
}).join(" ");
}
return "<" + tag + attrStr + ">";
} | javascript | function startTag(tag, attr) {
let attrStr = "";
if (attr) {
attrStr = " " + Object.keys(attr).map(function(k) {
return k + ' = "' + attr[k] + '"';
}).join(" ");
}
return "<" + tag + attrStr + ">";
} | [
"function",
"startTag",
"(",
"tag",
",",
"attr",
")",
"{",
"let",
"attrStr",
"=",
"\"\"",
";",
"if",
"(",
"attr",
")",
"{",
"attrStr",
"=",
"\" \"",
"+",
"Object",
".",
"keys",
"(",
"attr",
")",
".",
"map",
"(",
"function",
"(",
"k",
")",
"{",
... | Returns the HTML for a start tag | [
"Returns",
"the",
"HTML",
"for",
"a",
"start",
"tag"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/tools/myna_markdown_to_html.js#L7-L15 |
31,937 | cdiggins/myna-parser | tools/myna_markdown_to_html.js | mdAstToHtml | function mdAstToHtml(ast, lines) {
if (lines == undefined)
lines = [];
// Adds each element of the array as markdown
function addArray(ast) {
for (let child of ast)
mdAstToHtml(child, lines);
return lines;
}
// Adds tagged content
function addTag(tag, ast,... | javascript | function mdAstToHtml(ast, lines) {
if (lines == undefined)
lines = [];
// Adds each element of the array as markdown
function addArray(ast) {
for (let child of ast)
mdAstToHtml(child, lines);
return lines;
}
// Adds tagged content
function addTag(tag, ast,... | [
"function",
"mdAstToHtml",
"(",
"ast",
",",
"lines",
")",
"{",
"if",
"(",
"lines",
"==",
"undefined",
")",
"lines",
"=",
"[",
"]",
";",
"// Adds each element of the array as markdown ",
"function",
"addArray",
"(",
"ast",
")",
"{",
"for",
"(",
"let",
"child"... | Returns HTML from a MarkDown AST | [
"Returns",
"HTML",
"from",
"a",
"MarkDown",
"AST"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/tools/myna_markdown_to_html.js#L23-L117 |
31,938 | cdiggins/myna-parser | tools/myna_markdown_to_html.js | addTag | function addTag(tag, ast, newLine) {
lines.push(startTag(tag));
if (ast instanceof Array)
addArray(ast);
else
mdAstToHtml(ast, lines);
lines.push(endTag(tag));
if (newLine)
lines.push('\r\n');
return lines;
} | javascript | function addTag(tag, ast, newLine) {
lines.push(startTag(tag));
if (ast instanceof Array)
addArray(ast);
else
mdAstToHtml(ast, lines);
lines.push(endTag(tag));
if (newLine)
lines.push('\r\n');
return lines;
} | [
"function",
"addTag",
"(",
"tag",
",",
"ast",
",",
"newLine",
")",
"{",
"lines",
".",
"push",
"(",
"startTag",
"(",
"tag",
")",
")",
";",
"if",
"(",
"ast",
"instanceof",
"Array",
")",
"addArray",
"(",
"ast",
")",
";",
"else",
"mdAstToHtml",
"(",
"a... | Adds tagged content | [
"Adds",
"tagged",
"content"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/tools/myna_markdown_to_html.js#L35-L45 |
31,939 | cdiggins/myna-parser | tools/myna_markdown_to_html.js | mdToHtml | function mdToHtml(input) {
let rule = myna.allRules['markdown.document'];
let ast = myna.parse(rule, input);
return mdAstToHtml(ast, []).join("");
} | javascript | function mdToHtml(input) {
let rule = myna.allRules['markdown.document'];
let ast = myna.parse(rule, input);
return mdAstToHtml(ast, []).join("");
} | [
"function",
"mdToHtml",
"(",
"input",
")",
"{",
"let",
"rule",
"=",
"myna",
".",
"allRules",
"[",
"'markdown.document'",
"]",
";",
"let",
"ast",
"=",
"myna",
".",
"parse",
"(",
"rule",
",",
"input",
")",
";",
"return",
"mdAstToHtml",
"(",
"ast",
",",
... | Converts Markdown text to HTML | [
"Converts",
"Markdown",
"text",
"to",
"HTML"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/tools/myna_markdown_to_html.js#L120-L124 |
31,940 | cdiggins/myna-parser | myna.js | function () {
var r = this.cloneImplementation();
if (typeof (r) !== typeof (this))
throw new Error("Error in implementation of cloneImplementation: not returning object of correct type");
r.name = this.name;
r.grammarName = this.gramma... | javascript | function () {
var r = this.cloneImplementation();
if (typeof (r) !== typeof (this))
throw new Error("Error in implementation of cloneImplementation: not returning object of correct type");
r.name = this.name;
r.grammarName = this.gramma... | [
"function",
"(",
")",
"{",
"var",
"r",
"=",
"this",
".",
"cloneImplementation",
"(",
")",
";",
"if",
"(",
"typeof",
"(",
"r",
")",
"!==",
"typeof",
"(",
"this",
")",
")",
"throw",
"new",
"Error",
"(",
"\"Error in implementation of cloneImplementation: not re... | Returns a copy of this rule with all fields copied. | [
"Returns",
"a",
"copy",
"of",
"this",
"rule",
"with",
"all",
"fields",
"copied",
"."
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L298-L306 | |
31,941 | cdiggins/myna-parser | myna.js | function () {
if (this.min == 0 && this.max == 1)
return this.firstChild.toString() + "?";
if (this.min == 0 && this.max == Infinity)
return this.firstChild.toString() + "*";
if (this.min == 1 && this.max == Infinity)
... | javascript | function () {
if (this.min == 0 && this.max == 1)
return this.firstChild.toString() + "?";
if (this.min == 0 && this.max == Infinity)
return this.firstChild.toString() + "*";
if (this.min == 1 && this.max == Infinity)
... | [
"function",
"(",
")",
"{",
"if",
"(",
"this",
".",
"min",
"==",
"0",
"&&",
"this",
".",
"max",
"==",
"1",
")",
"return",
"this",
".",
"firstChild",
".",
"toString",
"(",
")",
"+",
"\"?\"",
";",
"if",
"(",
"this",
".",
"min",
"==",
"0",
"&&",
... | Used for creating a human readable definition of the grammar. | [
"Used",
"for",
"creating",
"a",
"human",
"readable",
"definition",
"of",
"the",
"grammar",
"."
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L654-L662 | |
31,942 | cdiggins/myna-parser | myna.js | seq | function seq() {
var rules = [];
for (var _i = 0; _i < arguments.length; _i++) {
rules[_i - 0] = arguments[_i];
}
var rs = rules.map(RuleTypeToRule);
if (rs.length == 0)
throw new Error("At least one rule is expected when calling `seq`");
if (rs.le... | javascript | function seq() {
var rules = [];
for (var _i = 0; _i < arguments.length; _i++) {
rules[_i - 0] = arguments[_i];
}
var rs = rules.map(RuleTypeToRule);
if (rs.length == 0)
throw new Error("At least one rule is expected when calling `seq`");
if (rs.le... | [
"function",
"seq",
"(",
")",
"{",
"var",
"rules",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"0",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"rules",
"[",
"_i",
"-",
"0",
"]",
"=",
"arguments",
"[",
"_i",
... | Creates a rule that matches a series of rules in order, and succeeds if they all do | [
"Creates",
"a",
"rule",
"that",
"matches",
"a",
"series",
"of",
"rules",
"in",
"order",
"and",
"succeeds",
"if",
"they",
"all",
"do"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L1012-L1028 |
31,943 | cdiggins/myna-parser | myna.js | quantified | function quantified(rule, min, max) {
if (min === void 0) { min = 0; }
if (max === void 0) { max = Infinity; }
if (min === 0 && max === 1)
return new Optional(RuleTypeToRule(rule));
else
return new Quantified(RuleTypeToRule(rule), min, max);
} | javascript | function quantified(rule, min, max) {
if (min === void 0) { min = 0; }
if (max === void 0) { max = Infinity; }
if (min === 0 && max === 1)
return new Optional(RuleTypeToRule(rule));
else
return new Quantified(RuleTypeToRule(rule), min, max);
} | [
"function",
"quantified",
"(",
"rule",
",",
"min",
",",
"max",
")",
"{",
"if",
"(",
"min",
"===",
"void",
"0",
")",
"{",
"min",
"=",
"0",
";",
"}",
"if",
"(",
"max",
"===",
"void",
"0",
")",
"{",
"max",
"=",
"Infinity",
";",
"}",
"if",
"(",
... | Attempts to apply a rule between min and max number of times inclusive. If the maximum is set to Infinity, it will attempt to match as many times as it can, but throw an exception if the parser does not advance | [
"Attempts",
"to",
"apply",
"a",
"rule",
"between",
"min",
"and",
"max",
"number",
"of",
"times",
"inclusive",
".",
"If",
"the",
"maximum",
"is",
"set",
"to",
"Infinity",
"it",
"will",
"attempt",
"to",
"match",
"as",
"many",
"times",
"as",
"it",
"can",
... | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L1063-L1070 |
31,944 | cdiggins/myna-parser | myna.js | log | function log(msg) {
if (msg === void 0) { msg = ""; }
return action(function (p) { console.log(msg); }).setType("log");
} | javascript | function log(msg) {
if (msg === void 0) { msg = ""; }
return action(function (p) { console.log(msg); }).setType("log");
} | [
"function",
"log",
"(",
"msg",
")",
"{",
"if",
"(",
"msg",
"===",
"void",
"0",
")",
"{",
"msg",
"=",
"\"\"",
";",
"}",
"return",
"action",
"(",
"function",
"(",
"p",
")",
"{",
"console",
".",
"log",
"(",
"msg",
")",
";",
"}",
")",
".",
"setTy... | Logs a message as an action | [
"Logs",
"a",
"message",
"as",
"an",
"action"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L1147-L1150 |
31,945 | cdiggins/myna-parser | myna.js | guardedSeq | function guardedSeq(condition) {
var rules = [];
for (var _i = 1; _i < arguments.length; _i++) {
rules[_i - 1] = arguments[_i];
}
return seq(condition, seq.apply(void 0, rules.map(function (r) { return assert(r); }))).setType("guardedSeq");
} | javascript | function guardedSeq(condition) {
var rules = [];
for (var _i = 1; _i < arguments.length; _i++) {
rules[_i - 1] = arguments[_i];
}
return seq(condition, seq.apply(void 0, rules.map(function (r) { return assert(r); }))).setType("guardedSeq");
} | [
"function",
"guardedSeq",
"(",
"condition",
")",
"{",
"var",
"rules",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"1",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"rules",
"[",
"_i",
"-",
"1",
"]",
"=",
"argumen... | If first part of a guarded sequence passes then each subsequent rule must pass as well otherwise an exception occurs. This helps create parsers that fail fast, and thus provide better feedback for badly formed input. | [
"If",
"first",
"part",
"of",
"a",
"guarded",
"sequence",
"passes",
"then",
"each",
"subsequent",
"rule",
"must",
"pass",
"as",
"well",
"otherwise",
"an",
"exception",
"occurs",
".",
"This",
"helps",
"create",
"parsers",
"that",
"fail",
"fast",
"and",
"thus",... | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L1167-L1173 |
31,946 | cdiggins/myna-parser | myna.js | keywords | function keywords() {
var words = [];
for (var _i = 0; _i < arguments.length; _i++) {
words[_i - 0] = arguments[_i];
}
return choice.apply(void 0, words.map(keyword));
} | javascript | function keywords() {
var words = [];
for (var _i = 0; _i < arguments.length; _i++) {
words[_i - 0] = arguments[_i];
}
return choice.apply(void 0, words.map(keyword));
} | [
"function",
"keywords",
"(",
")",
"{",
"var",
"words",
"=",
"[",
"]",
";",
"for",
"(",
"var",
"_i",
"=",
"0",
";",
"_i",
"<",
"arguments",
".",
"length",
";",
"_i",
"++",
")",
"{",
"words",
"[",
"_i",
"-",
"0",
"]",
"=",
"arguments",
"[",
"_i... | Chooses one of a a list of identifiers | [
"Chooses",
"one",
"of",
"a",
"a",
"list",
"of",
"identifiers"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L1206-L1212 |
31,947 | cdiggins/myna-parser | myna.js | parse | function parse(r, s) {
var p = new ParseState(s, 0, []);
if (!(r instanceof AstRule))
r = r.ast;
if (!r.parser(p))
return null;
return p && p.nodes ? p.nodes[0] : null;
} | javascript | function parse(r, s) {
var p = new ParseState(s, 0, []);
if (!(r instanceof AstRule))
r = r.ast;
if (!r.parser(p))
return null;
return p && p.nodes ? p.nodes[0] : null;
} | [
"function",
"parse",
"(",
"r",
",",
"s",
")",
"{",
"var",
"p",
"=",
"new",
"ParseState",
"(",
"s",
",",
"0",
",",
"[",
"]",
")",
";",
"if",
"(",
"!",
"(",
"r",
"instanceof",
"AstRule",
")",
")",
"r",
"=",
"r",
".",
"ast",
";",
"if",
"(",
... | Returns the root node of the abstract syntax tree created by parsing the rule. | [
"Returns",
"the",
"root",
"node",
"of",
"the",
"abstract",
"syntax",
"tree",
"created",
"by",
"parsing",
"the",
"rule",
"."
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L1272-L1279 |
31,948 | cdiggins/myna-parser | myna.js | allGrammarRules | function allGrammarRules() {
return Object.keys(Myna.allRules).sort().map(function (k) { return Myna.allRules[k]; });
} | javascript | function allGrammarRules() {
return Object.keys(Myna.allRules).sort().map(function (k) { return Myna.allRules[k]; });
} | [
"function",
"allGrammarRules",
"(",
")",
"{",
"return",
"Object",
".",
"keys",
"(",
"Myna",
".",
"allRules",
")",
".",
"sort",
"(",
")",
".",
"map",
"(",
"function",
"(",
"k",
")",
"{",
"return",
"Myna",
".",
"allRules",
"[",
"k",
"]",
";",
"}",
... | Returns all rules as an array sorted by name. | [
"Returns",
"all",
"rules",
"as",
"an",
"array",
"sorted",
"by",
"name",
"."
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L1296-L1298 |
31,949 | cdiggins/myna-parser | myna.js | grammarToString | function grammarToString(grammarName) {
return grammarRules(grammarName).map(function (r) { return r.fullName + " <- " + r.definition; }).join('\n');
} | javascript | function grammarToString(grammarName) {
return grammarRules(grammarName).map(function (r) { return r.fullName + " <- " + r.definition; }).join('\n');
} | [
"function",
"grammarToString",
"(",
"grammarName",
")",
"{",
"return",
"grammarRules",
"(",
"grammarName",
")",
".",
"map",
"(",
"function",
"(",
"r",
")",
"{",
"return",
"r",
".",
"fullName",
"+",
"\" <- \"",
"+",
"r",
".",
"definition",
";",
"}",
")",
... | Creates a string representation of a grammar | [
"Creates",
"a",
"string",
"representation",
"of",
"a",
"grammar"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L1306-L1308 |
31,950 | cdiggins/myna-parser | myna.js | astSchemaToString | function astSchemaToString(grammarName) {
return grammarAstRules(grammarName).map(function (r) { return r.name + " <- " + r.astRuleDefn(); }).join('\n');
} | javascript | function astSchemaToString(grammarName) {
return grammarAstRules(grammarName).map(function (r) { return r.name + " <- " + r.astRuleDefn(); }).join('\n');
} | [
"function",
"astSchemaToString",
"(",
"grammarName",
")",
"{",
"return",
"grammarAstRules",
"(",
"grammarName",
")",
".",
"map",
"(",
"function",
"(",
"r",
")",
"{",
"return",
"r",
".",
"name",
"+",
"\" <- \"",
"+",
"r",
".",
"astRuleDefn",
"(",
")",
";"... | Creates a string representation of the AST schema generated by parsing the grammar | [
"Creates",
"a",
"string",
"representation",
"of",
"the",
"AST",
"schema",
"generated",
"by",
"parsing",
"the",
"grammar"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L1311-L1313 |
31,951 | cdiggins/myna-parser | myna.js | registerGrammar | function registerGrammar(grammarName, grammar, defaultRule) {
for (var k in grammar) {
if (grammar[k] instanceof Rule) {
var rule = grammar[k];
rule.setName(grammarName, k);
Myna.allRules[rule.fullName] = rule;
}
}
Myna.gram... | javascript | function registerGrammar(grammarName, grammar, defaultRule) {
for (var k in grammar) {
if (grammar[k] instanceof Rule) {
var rule = grammar[k];
rule.setName(grammarName, k);
Myna.allRules[rule.fullName] = rule;
}
}
Myna.gram... | [
"function",
"registerGrammar",
"(",
"grammarName",
",",
"grammar",
",",
"defaultRule",
")",
"{",
"for",
"(",
"var",
"k",
"in",
"grammar",
")",
"{",
"if",
"(",
"grammar",
"[",
"k",
"]",
"instanceof",
"Rule",
")",
"{",
"var",
"rule",
"=",
"grammar",
"[",... | Initializes and register a grammar object and all of the rules. Sets names for all of the rules from the name of the field it is associated with combined with the name of the grammar. Each rule is stored in Myna.rules and each grammar is stored in Myna.grammars. | [
"Initializes",
"and",
"register",
"a",
"grammar",
"object",
"and",
"all",
"of",
"the",
"rules",
".",
"Sets",
"names",
"for",
"all",
"of",
"the",
"rules",
"from",
"the",
"name",
"of",
"the",
"field",
"it",
"is",
"associated",
"with",
"combined",
"with",
"... | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L1318-L1331 |
31,952 | cdiggins/myna-parser | myna.js | RuleTypeToRule | function RuleTypeToRule(rule) {
if (rule instanceof Rule)
return rule;
if (typeof (rule) === "string")
return text(rule);
if (typeof (rule) === "boolean")
return rule ? Myna.truePredicate : Myna.falsePredicate;
throw new Error("Invalid rule type: " + r... | javascript | function RuleTypeToRule(rule) {
if (rule instanceof Rule)
return rule;
if (typeof (rule) === "string")
return text(rule);
if (typeof (rule) === "boolean")
return rule ? Myna.truePredicate : Myna.falsePredicate;
throw new Error("Invalid rule type: " + r... | [
"function",
"RuleTypeToRule",
"(",
"rule",
")",
"{",
"if",
"(",
"rule",
"instanceof",
"Rule",
")",
"return",
"rule",
";",
"if",
"(",
"typeof",
"(",
"rule",
")",
"===",
"\"string\"",
")",
"return",
"text",
"(",
"rule",
")",
";",
"if",
"(",
"typeof",
"... | Given a RuleType returns an instance of a Rule. | [
"Given",
"a",
"RuleType",
"returns",
"an",
"instance",
"of",
"a",
"Rule",
"."
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/myna.js#L1342-L1350 |
31,953 | cdiggins/myna-parser | grammars/grammar_arithmetic.js | CreateArithmeticGrammar | function CreateArithmeticGrammar(myna)
{
// Setup a shorthand for the Myna parsing library object
let m = myna;
// Construct a grammar
let g = new function()
{
// These are helper rules, they do not create nodes in the parse tree.
this.fraction = m.seq(".", m.digit.z... | javascript | function CreateArithmeticGrammar(myna)
{
// Setup a shorthand for the Myna parsing library object
let m = myna;
// Construct a grammar
let g = new function()
{
// These are helper rules, they do not create nodes in the parse tree.
this.fraction = m.seq(".", m.digit.z... | [
"function",
"CreateArithmeticGrammar",
"(",
"myna",
")",
"{",
"// Setup a shorthand for the Myna parsing library object",
"let",
"m",
"=",
"myna",
";",
"// Construct a grammar ",
"let",
"g",
"=",
"new",
"function",
"(",
")",
"{",
"// These are helper rules, they do not crea... | Defines a grammar for basic arithmetic | [
"Defines",
"a",
"grammar",
"for",
"basic",
"arithmetic"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/grammars/grammar_arithmetic.js#L4-L38 |
31,954 | cdiggins/myna-parser | tools/myna_mustache_expander.js | mergeObjects | function mergeObjects(a, b) {
var r = { };
for (var k in a)
r[k] = a[k];
for (var k in b)
r[k] = b[k];
return r;
} | javascript | function mergeObjects(a, b) {
var r = { };
for (var k in a)
r[k] = a[k];
for (var k in b)
r[k] = b[k];
return r;
} | [
"function",
"mergeObjects",
"(",
"a",
",",
"b",
")",
"{",
"var",
"r",
"=",
"{",
"}",
";",
"for",
"(",
"var",
"k",
"in",
"a",
")",
"r",
"[",
"k",
"]",
"=",
"a",
"[",
"k",
"]",
";",
"for",
"(",
"var",
"k",
"in",
"b",
")",
"r",
"[",
"k",
... | Creates a new object containing the properties of the first object and the second object. If any value has the same key in both values, the second object overrides the first. | [
"Creates",
"a",
"new",
"object",
"containing",
"the",
"properties",
"of",
"the",
"first",
"object",
"and",
"the",
"second",
"object",
".",
"If",
"any",
"value",
"has",
"the",
"same",
"key",
"in",
"both",
"values",
"the",
"second",
"object",
"overrides",
"t... | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/tools/myna_mustache_expander.js#L25-L32 |
31,955 | cdiggins/myna-parser | tools/myna_mustache_expander.js | expandAst | function expandAst(ast, data, lines) {
if (lines == undefined)
lines = [];
// If there is a child "key" get the value associated with it.
let keyNode = ast.child("key");
let key = keyNode ? keyNode.allText : "";
let val = data ? (key in data ? data[key] : "") : "";
// Functions ar... | javascript | function expandAst(ast, data, lines) {
if (lines == undefined)
lines = [];
// If there is a child "key" get the value associated with it.
let keyNode = ast.child("key");
let key = keyNode ? keyNode.allText : "";
let val = data ? (key in data ? data[key] : "") : "";
// Functions ar... | [
"function",
"expandAst",
"(",
"ast",
",",
"data",
",",
"lines",
")",
"{",
"if",
"(",
"lines",
"==",
"undefined",
")",
"lines",
"=",
"[",
"]",
";",
"// If there is a child \"key\" get the value associated with it. ",
"let",
"keyNode",
"=",
"ast",
".",
"child",
... | Given an AST node, a data object, and an optional array of string, converts the nodes expanding the reserved characters. | [
"Given",
"an",
"AST",
"node",
"a",
"data",
"object",
"and",
"an",
"optional",
"array",
"of",
"string",
"converts",
"the",
"nodes",
"expanding",
"the",
"reserved",
"characters",
"."
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/tools/myna_mustache_expander.js#L36-L98 |
31,956 | cdiggins/myna-parser | tools/myna_mustache_expander.js | expand | function expand(template, data) {
if (template.indexOf("{{") >= 0) {
let ast = myna.parsers.mustache(template);
let lines = expandAst(ast, data);
return lines.join("");
}
else {
return template;
}
} | javascript | function expand(template, data) {
if (template.indexOf("{{") >= 0) {
let ast = myna.parsers.mustache(template);
let lines = expandAst(ast, data);
return lines.join("");
}
else {
return template;
}
} | [
"function",
"expand",
"(",
"template",
",",
"data",
")",
"{",
"if",
"(",
"template",
".",
"indexOf",
"(",
"\"{{\"",
")",
">=",
"0",
")",
"{",
"let",
"ast",
"=",
"myna",
".",
"parsers",
".",
"mustache",
"(",
"template",
")",
";",
"let",
"lines",
"="... | Expands text containing CTemplate delimiters "{{" using the data object | [
"Expands",
"text",
"containing",
"CTemplate",
"delimiters",
"{{",
"using",
"the",
"data",
"object"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/tools/myna_mustache_expander.js#L101-L110 |
31,957 | cdiggins/myna-parser | tools/myna_escape_html_chars.js | escapeHtmlChars | function escapeHtmlChars(text)
{
let ast = myna.parsers.html_reserved_chars(text);
if (!ast.children)
return "";
return ast.children.map(astNodeToHtmlText).join('');
} | javascript | function escapeHtmlChars(text)
{
let ast = myna.parsers.html_reserved_chars(text);
if (!ast.children)
return "";
return ast.children.map(astNodeToHtmlText).join('');
} | [
"function",
"escapeHtmlChars",
"(",
"text",
")",
"{",
"let",
"ast",
"=",
"myna",
".",
"parsers",
".",
"html_reserved_chars",
"(",
"text",
")",
";",
"if",
"(",
"!",
"ast",
".",
"children",
")",
"return",
"\"\"",
";",
"return",
"ast",
".",
"children",
".... | Returns a string, replacing all of the reserved characters with entities | [
"Returns",
"a",
"string",
"replacing",
"all",
"of",
"the",
"reserved",
"characters",
"with",
"entities"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/tools/myna_escape_html_chars.js#L37-L43 |
31,958 | cdiggins/myna-parser | grammars/grammar_pithy.js | guardedSeq | function guardedSeq() {
var args = Array.prototype.slice.call(arguments, 1).map(function(r) { return m.seq(m.assert(r), _this.ws); });
return m.seq(arguments[0], _this.ws, m.seq.apply(m, args));
} | javascript | function guardedSeq() {
var args = Array.prototype.slice.call(arguments, 1).map(function(r) { return m.seq(m.assert(r), _this.ws); });
return m.seq(arguments[0], _this.ws, m.seq.apply(m, args));
} | [
"function",
"guardedSeq",
"(",
")",
"{",
"var",
"args",
"=",
"Array",
".",
"prototype",
".",
"slice",
".",
"call",
"(",
"arguments",
",",
"1",
")",
".",
"map",
"(",
"function",
"(",
"r",
")",
"{",
"return",
"m",
".",
"seq",
"(",
"m",
".",
"assert... | If the first rule argument passes, all subsequent rules must pass or an assert will throw | [
"If",
"the",
"first",
"rule",
"argument",
"passes",
"all",
"subsequent",
"rules",
"must",
"pass",
"or",
"an",
"assert",
"will",
"throw"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/grammars/grammar_pithy.js#L42-L45 |
31,959 | cdiggins/myna-parser | grammars/grammar_pithy.js | commaList | function commaList(r, trailing = true) {
var result = r.then(guardedSeq(_this.comma, r).zeroOrMore);
if (trailing) return result.then(_this.comma.opt);
else return result;
} | javascript | function commaList(r, trailing = true) {
var result = r.then(guardedSeq(_this.comma, r).zeroOrMore);
if (trailing) return result.then(_this.comma.opt);
else return result;
} | [
"function",
"commaList",
"(",
"r",
",",
"trailing",
"=",
"true",
")",
"{",
"var",
"result",
"=",
"r",
".",
"then",
"(",
"guardedSeq",
"(",
"_this",
".",
"comma",
",",
"r",
")",
".",
"zeroOrMore",
")",
";",
"if",
"(",
"trailing",
")",
"return",
"res... | Comma delimited list with a trailing comma | [
"Comma",
"delimited",
"list",
"with",
"a",
"trailing",
"comma"
] | 24e07fe107e3814b412d537aca365142844514ec | https://github.com/cdiggins/myna-parser/blob/24e07fe107e3814b412d537aca365142844514ec/grammars/grammar_pithy.js#L48-L52 |
31,960 | twolfson/layout | lib/layout.js | Layout | function Layout(algorithmName, options) {
// Save the algorithmName as our algorithm (assume function)
var algorithm = algorithmName || 'top-down';
// If the algorithm is a string, look it up
if (typeof algorithm === 'string') {
algorithm = algorithms[algorithmName];
// Assert that the algorithm was f... | javascript | function Layout(algorithmName, options) {
// Save the algorithmName as our algorithm (assume function)
var algorithm = algorithmName || 'top-down';
// If the algorithm is a string, look it up
if (typeof algorithm === 'string') {
algorithm = algorithms[algorithmName];
// Assert that the algorithm was f... | [
"function",
"Layout",
"(",
"algorithmName",
",",
"options",
")",
"{",
"// Save the algorithmName as our algorithm (assume function)",
"var",
"algorithm",
"=",
"algorithmName",
"||",
"'top-down'",
";",
"// If the algorithm is a string, look it up",
"if",
"(",
"typeof",
"algori... | Layout adds items in an algorithmic fashion
@constructor
@param {String|Object} [algorithm="top-down"] Name of algorithm or custom algorithm to use
@param {Mixed} [options] Options to provide for the algorithm | [
"Layout",
"adds",
"items",
"in",
"an",
"algorithmic",
"fashion"
] | eaf4c254dee37afbde0eec2c82b343869c6049db | https://github.com/twolfson/layout/blob/eaf4c254dee37afbde0eec2c82b343869c6049db/lib/layout.js#L12-L27 |
31,961 | doowb/github-content | index.js | GithubContent | function GithubContent(options) {
if (!(this instanceof GithubContent)) {
return new GithubContent(options);
}
// setup our specific options
var opts = extend({branch: 'master'}, options);
opts.json = false;
opts.apiurl = 'https://raw.githubusercontent.com';
GithubBase.call(this, opts);
this.option... | javascript | function GithubContent(options) {
if (!(this instanceof GithubContent)) {
return new GithubContent(options);
}
// setup our specific options
var opts = extend({branch: 'master'}, options);
opts.json = false;
opts.apiurl = 'https://raw.githubusercontent.com';
GithubBase.call(this, opts);
this.option... | [
"function",
"GithubContent",
"(",
"options",
")",
"{",
"if",
"(",
"!",
"(",
"this",
"instanceof",
"GithubContent",
")",
")",
"{",
"return",
"new",
"GithubContent",
"(",
"options",
")",
";",
"}",
"// setup our specific options",
"var",
"opts",
"=",
"extend",
... | Create an instance of GithubContent to setup downloading of files.
```js
var options = {
owner: 'doowb',
repo: 'github-content',
branch: 'master' // defaults to master
};
var gc = new GithubContent(options);
```
@param {Object} `options` Options to set on instance. Additional options passed to [github-base]
@param {S... | [
"Create",
"an",
"instance",
"of",
"GithubContent",
"to",
"setup",
"downloading",
"of",
"files",
"."
] | 1348f808083d14dde4f986ff9f93ee543183e1d3 | https://github.com/doowb/github-content/blob/1348f808083d14dde4f986ff9f93ee543183e1d3/index.js#L33-L44 |
31,962 | twolfson/layout | lib/smiths/packing.smith.js | function () {
// Grab the items
var items = this.items;
// Find the most negative x and y
var minX = Infinity,
minY = Infinity;
items.forEach(function (item) {
var coords = item;
minX = Math.min(minX, coords.x);
minY = Math.min(minY, coords.y);
});
// Offset each ... | javascript | function () {
// Grab the items
var items = this.items;
// Find the most negative x and y
var minX = Infinity,
minY = Infinity;
items.forEach(function (item) {
var coords = item;
minX = Math.min(minX, coords.x);
minY = Math.min(minY, coords.y);
});
// Offset each ... | [
"function",
"(",
")",
"{",
"// Grab the items",
"var",
"items",
"=",
"this",
".",
"items",
";",
"// Find the most negative x and y",
"var",
"minX",
"=",
"Infinity",
",",
"minY",
"=",
"Infinity",
";",
"items",
".",
"forEach",
"(",
"function",
"(",
"item",
")"... | Method to normalize coordinates to 0, 0 This is bad to do mid-addition since it messes up the algorithm | [
"Method",
"to",
"normalize",
"coordinates",
"to",
"0",
"0",
"This",
"is",
"bad",
"to",
"do",
"mid",
"-",
"addition",
"since",
"it",
"messes",
"up",
"the",
"algorithm"
] | eaf4c254dee37afbde0eec2c82b343869c6049db | https://github.com/twolfson/layout/blob/eaf4c254dee37afbde0eec2c82b343869c6049db/lib/smiths/packing.smith.js#L24-L43 | |
31,963 | giapnguyen74/nextql | samples/mongoose/index.js | normalizeFields | function normalizeFields(fields) {
const _fields = {};
Object.keys(fields).forEach(k => {
if (fields[k].constructor == Object && !fields[k].type) {
_fields[k] = normalizeFields(fields[k]);
} else {
_fields[k] = 1;
}
});
return _fields;
} | javascript | function normalizeFields(fields) {
const _fields = {};
Object.keys(fields).forEach(k => {
if (fields[k].constructor == Object && !fields[k].type) {
_fields[k] = normalizeFields(fields[k]);
} else {
_fields[k] = 1;
}
});
return _fields;
} | [
"function",
"normalizeFields",
"(",
"fields",
")",
"{",
"const",
"_fields",
"=",
"{",
"}",
";",
"Object",
".",
"keys",
"(",
"fields",
")",
".",
"forEach",
"(",
"k",
"=>",
"{",
"if",
"(",
"fields",
"[",
"k",
"]",
".",
"constructor",
"==",
"Object",
... | Simply convert mongoose schema to nextql fields | [
"Simply",
"convert",
"mongoose",
"schema",
"to",
"nextql",
"fields"
] | 92c7b908fe3abadd1a5a3b85ae470c5e6208ad4e | https://github.com/giapnguyen74/nextql/blob/92c7b908fe3abadd1a5a3b85ae470c5e6208ad4e/samples/mongoose/index.js#L4-L14 |
31,964 | giapnguyen74/nextql | src/resolvers.js | resolve_type_define | function resolve_type_define(nextql, fieldValue, fieldDefine, fieldPath) {
let fd = fieldDefine;
// First phrase resolve fieldDefine is auto or function into final fieldDefine
if (fd === 1) {
if (isPrimitive(fieldValue)) {
return "*";
} else {
fd = nextql.resolveType(fieldValue);
nextql.afterResolveType... | javascript | function resolve_type_define(nextql, fieldValue, fieldDefine, fieldPath) {
let fd = fieldDefine;
// First phrase resolve fieldDefine is auto or function into final fieldDefine
if (fd === 1) {
if (isPrimitive(fieldValue)) {
return "*";
} else {
fd = nextql.resolveType(fieldValue);
nextql.afterResolveType... | [
"function",
"resolve_type_define",
"(",
"nextql",
",",
"fieldValue",
",",
"fieldDefine",
",",
"fieldPath",
")",
"{",
"let",
"fd",
"=",
"fieldDefine",
";",
"// First phrase resolve fieldDefine is auto or function into final fieldDefine",
"if",
"(",
"fd",
"===",
"1",
")",... | Give field value and field define, resolve field model or error
field path provided for log
@param {*} nextql
@param {string} path
@param {*} value
@param {*} typeDef
@return {*} model | [
"Give",
"field",
"value",
"and",
"field",
"define",
"resolve",
"field",
"model",
"or",
"error",
"field",
"path",
"provided",
"for",
"log"
] | 92c7b908fe3abadd1a5a3b85ae470c5e6208ad4e | https://github.com/giapnguyen74/nextql/blob/92c7b908fe3abadd1a5a3b85ae470c5e6208ad4e/src/resolvers.js#L36-L81 |
31,965 | giapnguyen74/nextql | src/resolvers.js | resolve_scalar_value | function resolve_scalar_value(nextql, value, valueQuery, info) {
if (value == undefined) {
set(info.result, info.path, null);
return Promise.resolve();
}
if (valueQuery !== 1) {
const keylen = Object.keys(valueQuery).length;
const queryAsObject = valueQuery.$params ? keylen > 1 : keylen > 0;
if (queryAsOb... | javascript | function resolve_scalar_value(nextql, value, valueQuery, info) {
if (value == undefined) {
set(info.result, info.path, null);
return Promise.resolve();
}
if (valueQuery !== 1) {
const keylen = Object.keys(valueQuery).length;
const queryAsObject = valueQuery.$params ? keylen > 1 : keylen > 0;
if (queryAsOb... | [
"function",
"resolve_scalar_value",
"(",
"nextql",
",",
"value",
",",
"valueQuery",
",",
"info",
")",
"{",
"if",
"(",
"value",
"==",
"undefined",
")",
"{",
"set",
"(",
"info",
".",
"result",
",",
"info",
".",
"path",
",",
"null",
")",
";",
"return",
... | Given value and valueQuery; resolve value as a scalar
@param {*} nextql
@param {*} value
@param {*} valueQuery
@param {*} info | [
"Given",
"value",
"and",
"valueQuery",
";",
"resolve",
"value",
"as",
"a",
"scalar"
] | 92c7b908fe3abadd1a5a3b85ae470c5e6208ad4e | https://github.com/giapnguyen74/nextql/blob/92c7b908fe3abadd1a5a3b85ae470c5e6208ad4e/src/resolvers.js#L90-L120 |
31,966 | giapnguyen74/nextql | src/resolvers.js | execute_conditional | function execute_conditional(
nextql,
value,
valueModel,
conditional,
query,
info,
context
) {
let model;
const modelName = valueModel.check(
value,
conditional,
query.$params,
context,
info
);
if (modelName instanceof Error) {
return Promise.reject(modelName);
}
if (modelName === true) {
... | javascript | function execute_conditional(
nextql,
value,
valueModel,
conditional,
query,
info,
context
) {
let model;
const modelName = valueModel.check(
value,
conditional,
query.$params,
context,
info
);
if (modelName instanceof Error) {
return Promise.reject(modelName);
}
if (modelName === true) {
... | [
"function",
"execute_conditional",
"(",
"nextql",
",",
"value",
",",
"valueModel",
",",
"conditional",
",",
"query",
",",
"info",
",",
"context",
")",
"{",
"let",
"model",
";",
"const",
"modelName",
"=",
"valueModel",
".",
"check",
"(",
"value",
",",
"cond... | Given value, valueModel and conditional path; call conditional function and process result
@param {*} nextql
@param {*} value
@param {*} valueModel
@param {*} conditionalQuery
@param {*} info
@param {*} context | [
"Given",
"value",
"valueModel",
"and",
"conditional",
"path",
";",
"call",
"conditional",
"function",
"and",
"process",
"result"
] | 92c7b908fe3abadd1a5a3b85ae470c5e6208ad4e | https://github.com/giapnguyen74/nextql/blob/92c7b908fe3abadd1a5a3b85ae470c5e6208ad4e/src/resolvers.js#L131-L165 |
31,967 | giapnguyen74/nextql | src/resolvers.js | resolve_object_value | function resolve_object_value(
nextql,
value,
valueModel,
valueQuery,
info,
context
) {
if (value == undefined) {
set(info.result, info.path, null);
return Promise.resolve();
}
if (isPrimitive(value)) {
return Promise.reject(
new NextQLError("Cannot query scalar as " + valueModel.name, info)
);
}
... | javascript | function resolve_object_value(
nextql,
value,
valueModel,
valueQuery,
info,
context
) {
if (value == undefined) {
set(info.result, info.path, null);
return Promise.resolve();
}
if (isPrimitive(value)) {
return Promise.reject(
new NextQLError("Cannot query scalar as " + valueModel.name, info)
);
}
... | [
"function",
"resolve_object_value",
"(",
"nextql",
",",
"value",
",",
"valueModel",
",",
"valueQuery",
",",
"info",
",",
"context",
")",
"{",
"if",
"(",
"value",
"==",
"undefined",
")",
"{",
"set",
"(",
"info",
".",
"result",
",",
"info",
".",
"path",
... | Given value, valueModel, valueQuery; recursive resolve field value
@param {*} nextql
@param {*} value
@param {*} valueModel
@param {*} valueQuery
@param {*} info
@param {*} context | [
"Given",
"value",
"valueModel",
"valueQuery",
";",
"recursive",
"resolve",
"field",
"value"
] | 92c7b908fe3abadd1a5a3b85ae470c5e6208ad4e | https://github.com/giapnguyen74/nextql/blob/92c7b908fe3abadd1a5a3b85ae470c5e6208ad4e/src/resolvers.js#L176-L241 |
31,968 | frapontillo/node-rdp | lib/rdp-file.js | buildRdpFile | function buildRdpFile(config) {
var deferred = Q.defer();
var fileContent = getRdpFileContent(config);
var fileName = path.normalize(os.tmpdir() + '/' + sanitize(config.address) + '.rdp');
Q.nfcall(fs.writeFile, fileName, fileContent)
.then(function() {
deferred.resolve(fileName);
})
.fail(def... | javascript | function buildRdpFile(config) {
var deferred = Q.defer();
var fileContent = getRdpFileContent(config);
var fileName = path.normalize(os.tmpdir() + '/' + sanitize(config.address) + '.rdp');
Q.nfcall(fs.writeFile, fileName, fileContent)
.then(function() {
deferred.resolve(fileName);
})
.fail(def... | [
"function",
"buildRdpFile",
"(",
"config",
")",
"{",
"var",
"deferred",
"=",
"Q",
".",
"defer",
"(",
")",
";",
"var",
"fileContent",
"=",
"getRdpFileContent",
"(",
"config",
")",
";",
"var",
"fileName",
"=",
"path",
".",
"normalize",
"(",
"os",
".",
"t... | Returns a promise that will be resolved as soon as the file is created.
@param config
@returns {promise|*|Q.promise} | [
"Returns",
"a",
"promise",
"that",
"will",
"be",
"resolved",
"as",
"soon",
"as",
"the",
"file",
"is",
"created",
"."
] | 0d4e0acb15923aab29a86ee42c84af6bef8c50c1 | https://github.com/frapontillo/node-rdp/blob/0d4e0acb15923aab29a86ee42c84af6bef8c50c1/lib/rdp-file.js#L202-L212 |
31,969 | gchudnov/inkjet | build/lib/magic.js | magic | function magic(buf, cb) {
setTimeout(() => {
const sampleLength = 24;
const sample = buf.slice(0, sampleLength).toString('hex'); // lookup data
const found = Object.keys(_magicDb2.default).find(it => {
return sample.indexOf(it) != -1;
});
if (found) {
cb(null, _magicDb2.default[found... | javascript | function magic(buf, cb) {
setTimeout(() => {
const sampleLength = 24;
const sample = buf.slice(0, sampleLength).toString('hex'); // lookup data
const found = Object.keys(_magicDb2.default).find(it => {
return sample.indexOf(it) != -1;
});
if (found) {
cb(null, _magicDb2.default[found... | [
"function",
"magic",
"(",
"buf",
",",
"cb",
")",
"{",
"setTimeout",
"(",
"(",
")",
"=>",
"{",
"const",
"sampleLength",
"=",
"24",
";",
"const",
"sample",
"=",
"buf",
".",
"slice",
"(",
"0",
",",
"sampleLength",
")",
".",
"toString",
"(",
"'hex'",
"... | Lookup the magic number in magic-number DB
@param {Buffer} buf Data buffer
@param {function} cb Callback to invoke on completion | [
"Lookup",
"the",
"magic",
"number",
"in",
"magic",
"-",
"number",
"DB"
] | 7ee7e1a67562e083c60be93864fad86d1ac8eb30 | https://github.com/gchudnov/inkjet/blob/7ee7e1a67562e083c60be93864fad86d1ac8eb30/build/lib/magic.js#L19-L34 |
31,970 | gchudnov/inkjet | build/lib/encode.js | encode | function encode(buf, options, cb) {
try {
const imageData = {
data: buf,
width: options.width,
height: options.height
};
const data = (0, _encoder2.default)(imageData, options.quality);
cb(null, data);
} catch (err) {
cb(err);
}
} | javascript | function encode(buf, options, cb) {
try {
const imageData = {
data: buf,
width: options.width,
height: options.height
};
const data = (0, _encoder2.default)(imageData, options.quality);
cb(null, data);
} catch (err) {
cb(err);
}
} | [
"function",
"encode",
"(",
"buf",
",",
"options",
",",
"cb",
")",
"{",
"try",
"{",
"const",
"imageData",
"=",
"{",
"data",
":",
"buf",
",",
"width",
":",
"options",
".",
"width",
",",
"height",
":",
"options",
".",
"height",
"}",
";",
"const",
"dat... | Encode the data to JPEG format
@param buf Buffer|Uint8Array
@param options Object { width: number, height: number, quality: number }
@param cb Callback to invoke on completion
@callback { width: number, height: number, data: Uint8Array } | [
"Encode",
"the",
"data",
"to",
"JPEG",
"format"
] | 7ee7e1a67562e083c60be93864fad86d1ac8eb30 | https://github.com/gchudnov/inkjet/blob/7ee7e1a67562e083c60be93864fad86d1ac8eb30/build/lib/encode.js#L23-L35 |
31,971 | gchudnov/inkjet | build/lib/buffer-utils.js | toBuffer | function toBuffer(buf) {
if (buf instanceof ArrayBuffer) {
return arrayBufferToBuffer(buf);
} else if (Buffer.isBuffer(buf)) {
return buf;
} else if (buf instanceof Uint8Array) {
return new Buffer(buf);
} else {
return buf; // type unknown, trust the user
}
} | javascript | function toBuffer(buf) {
if (buf instanceof ArrayBuffer) {
return arrayBufferToBuffer(buf);
} else if (Buffer.isBuffer(buf)) {
return buf;
} else if (buf instanceof Uint8Array) {
return new Buffer(buf);
} else {
return buf; // type unknown, trust the user
}
} | [
"function",
"toBuffer",
"(",
"buf",
")",
"{",
"if",
"(",
"buf",
"instanceof",
"ArrayBuffer",
")",
"{",
"return",
"arrayBufferToBuffer",
"(",
"buf",
")",
";",
"}",
"else",
"if",
"(",
"Buffer",
".",
"isBuffer",
"(",
"buf",
")",
")",
"{",
"return",
"buf",... | Converts the buffer to Buffer
@param {Buffer|ArrayBuffer|Uint8Array} buf Input buffer
@returns {Buffer} | [
"Converts",
"the",
"buffer",
"to",
"Buffer"
] | 7ee7e1a67562e083c60be93864fad86d1ac8eb30 | https://github.com/gchudnov/inkjet/blob/7ee7e1a67562e083c60be93864fad86d1ac8eb30/build/lib/buffer-utils.js#L18-L28 |
31,972 | gchudnov/inkjet | build/lib/buffer-utils.js | toArrayBuffer | function toArrayBuffer(buf) {
if (buf instanceof ArrayBuffer) {
return buf;
} else if (Buffer.isBuffer(buf)) {
return bufferToArrayBuffer(buf);
} else if (buf instanceof Uint8Array) {
return bufferToArrayBuffer(buf);
} else {
return buf; // type unknown, trust the user
}
} | javascript | function toArrayBuffer(buf) {
if (buf instanceof ArrayBuffer) {
return buf;
} else if (Buffer.isBuffer(buf)) {
return bufferToArrayBuffer(buf);
} else if (buf instanceof Uint8Array) {
return bufferToArrayBuffer(buf);
} else {
return buf; // type unknown, trust the user
}
} | [
"function",
"toArrayBuffer",
"(",
"buf",
")",
"{",
"if",
"(",
"buf",
"instanceof",
"ArrayBuffer",
")",
"{",
"return",
"buf",
";",
"}",
"else",
"if",
"(",
"Buffer",
".",
"isBuffer",
"(",
"buf",
")",
")",
"{",
"return",
"bufferToArrayBuffer",
"(",
"buf",
... | Converts any buffer to ArrayBuffer
@param {Buffer|ArrayBuffer|Uint8Array} buf Input buffer
@returns {ArrayBuffer} | [
"Converts",
"any",
"buffer",
"to",
"ArrayBuffer"
] | 7ee7e1a67562e083c60be93864fad86d1ac8eb30 | https://github.com/gchudnov/inkjet/blob/7ee7e1a67562e083c60be93864fad86d1ac8eb30/build/lib/buffer-utils.js#L35-L45 |
31,973 | gchudnov/inkjet | build/lib/buffer-utils.js | toUint8Array | function toUint8Array(buf) {
if (buf instanceof Uint8Array) {
return buf;
} else if (buf instanceof ArrayBuffer) {
return new Uint8Array(buf);
} else if (Buffer.isBuffer(buf)) {
return new Uint8Array(buf);
} else {
return buf; // type unknown, trust the user
}
} | javascript | function toUint8Array(buf) {
if (buf instanceof Uint8Array) {
return buf;
} else if (buf instanceof ArrayBuffer) {
return new Uint8Array(buf);
} else if (Buffer.isBuffer(buf)) {
return new Uint8Array(buf);
} else {
return buf; // type unknown, trust the user
}
} | [
"function",
"toUint8Array",
"(",
"buf",
")",
"{",
"if",
"(",
"buf",
"instanceof",
"Uint8Array",
")",
"{",
"return",
"buf",
";",
"}",
"else",
"if",
"(",
"buf",
"instanceof",
"ArrayBuffer",
")",
"{",
"return",
"new",
"Uint8Array",
"(",
"buf",
")",
";",
"... | Converts any buffer to Uint8Array
@param {Buffer|ArrayBuffer|Uint8Array} buf Input buffer
@returns {Uint8Array} | [
"Converts",
"any",
"buffer",
"to",
"Uint8Array"
] | 7ee7e1a67562e083c60be93864fad86d1ac8eb30 | https://github.com/gchudnov/inkjet/blob/7ee7e1a67562e083c60be93864fad86d1ac8eb30/build/lib/buffer-utils.js#L52-L62 |
31,974 | gchudnov/inkjet | build/lib/buffer-utils.js | bufferToArrayBuffer | function bufferToArrayBuffer(buf) {
const arr = new ArrayBuffer(buf.length);
const view = new Uint8Array(arr);
for (let i = 0; i < buf.length; ++i) {
view[i] = buf[i];
}
return arr;
} | javascript | function bufferToArrayBuffer(buf) {
const arr = new ArrayBuffer(buf.length);
const view = new Uint8Array(arr);
for (let i = 0; i < buf.length; ++i) {
view[i] = buf[i];
}
return arr;
} | [
"function",
"bufferToArrayBuffer",
"(",
"buf",
")",
"{",
"const",
"arr",
"=",
"new",
"ArrayBuffer",
"(",
"buf",
".",
"length",
")",
";",
"const",
"view",
"=",
"new",
"Uint8Array",
"(",
"arr",
")",
";",
"for",
"(",
"let",
"i",
"=",
"0",
";",
"i",
"<... | Buffer -> ArrayBuffer
@param {Buffer|Uint8Array} buf
@returns {ArrayBuffer} | [
"Buffer",
"-",
">",
"ArrayBuffer"
] | 7ee7e1a67562e083c60be93864fad86d1ac8eb30 | https://github.com/gchudnov/inkjet/blob/7ee7e1a67562e083c60be93864fad86d1ac8eb30/build/lib/buffer-utils.js#L86-L93 |
31,975 | gchudnov/inkjet | build/lib/decode.js | decode | function decode(buf, options, cb) {
function getData(j, width, height) {
const dest = {
width: width,
height: height,
data: new Uint8Array(width * height * 4)
};
j.copyToImageData(dest);
return dest.data;
}
try {
const j = new _jpg.JpegImage();
j.parse(buf);
const w... | javascript | function decode(buf, options, cb) {
function getData(j, width, height) {
const dest = {
width: width,
height: height,
data: new Uint8Array(width * height * 4)
};
j.copyToImageData(dest);
return dest.data;
}
try {
const j = new _jpg.JpegImage();
j.parse(buf);
const w... | [
"function",
"decode",
"(",
"buf",
",",
"options",
",",
"cb",
")",
"{",
"function",
"getData",
"(",
"j",
",",
"width",
",",
"height",
")",
"{",
"const",
"dest",
"=",
"{",
"width",
":",
"width",
",",
"height",
":",
"height",
",",
"data",
":",
"new",
... | Decode the JPEG data
@param buf Uint8Array
@param options Object { width: number, height: number }
@param cb Callback to invoke on completion
@callback { width: number, height: number, data: Uint8Array } | [
"Decode",
"the",
"JPEG",
"data"
] | 7ee7e1a67562e083c60be93864fad86d1ac8eb30 | https://github.com/gchudnov/inkjet/blob/7ee7e1a67562e083c60be93864fad86d1ac8eb30/build/lib/decode.js#L19-L52 |
31,976 | gchudnov/inkjet | build/lib/exif.js | exif | function exif(buf, options, cb) {
try {
const exif = new _ExifReader.ExifReader();
exif.load(buf);
// The MakerNote tag can be really large. Remove it to lower memory usage.
if (!options.hasOwnProperty('hasMakerNote') || !options.hasMakerNote) {
exif.deleteTag('MakerNote');
}
const met... | javascript | function exif(buf, options, cb) {
try {
const exif = new _ExifReader.ExifReader();
exif.load(buf);
// The MakerNote tag can be really large. Remove it to lower memory usage.
if (!options.hasOwnProperty('hasMakerNote') || !options.hasMakerNote) {
exif.deleteTag('MakerNote');
}
const met... | [
"function",
"exif",
"(",
"buf",
",",
"options",
",",
"cb",
")",
"{",
"try",
"{",
"const",
"exif",
"=",
"new",
"_ExifReader",
".",
"ExifReader",
"(",
")",
";",
"exif",
".",
"load",
"(",
"buf",
")",
";",
"// The MakerNote tag can be really large. Remove it to ... | Read EXIF data from the provided buffer
@param buf ArrayBuffer
@param options Object { hasMakerNote: true|false }
@param cb Callback to invoke on completion
@callback Object { name: value, ... } | [
"Read",
"EXIF",
"data",
"from",
"the",
"provided",
"buffer"
] | 7ee7e1a67562e083c60be93864fad86d1ac8eb30 | https://github.com/gchudnov/inkjet/blob/7ee7e1a67562e083c60be93864fad86d1ac8eb30/build/lib/exif.js#L19-L39 |
31,977 | gchudnov/inkjet | build/lib/info.js | info | function info(buf, cb) {
setTimeout(() => {
const info = (0, _imageinfo2.default)(buf);
if (!info) {
cb(new Error('Cannot get image info'));
} else {
cb(null, {
type: info.type,
mimeType: info.mimeType,
extension: info.format.toLowerCase(),
width: info.width,
... | javascript | function info(buf, cb) {
setTimeout(() => {
const info = (0, _imageinfo2.default)(buf);
if (!info) {
cb(new Error('Cannot get image info'));
} else {
cb(null, {
type: info.type,
mimeType: info.mimeType,
extension: info.format.toLowerCase(),
width: info.width,
... | [
"function",
"info",
"(",
"buf",
",",
"cb",
")",
"{",
"setTimeout",
"(",
"(",
")",
"=>",
"{",
"const",
"info",
"=",
"(",
"0",
",",
"_imageinfo2",
".",
"default",
")",
"(",
"buf",
")",
";",
"if",
"(",
"!",
"info",
")",
"{",
"cb",
"(",
"new",
"E... | Get image information
@param {Buffer} buf Image or image part that contains image parameters
@param {function} cb Callback to invoke on completion | [
"Get",
"image",
"information"
] | 7ee7e1a67562e083c60be93864fad86d1ac8eb30 | https://github.com/gchudnov/inkjet/blob/7ee7e1a67562e083c60be93864fad86d1ac8eb30/build/lib/info.js#L19-L34 |
31,978 | hdnpt/geartrack | src/malaysiaPosTracker.js | obtainInfo | function obtainInfo(action, id, cb) {
request.post({
url: action,
form: {
trackingNo03: id
},
timeout: 20000
}, function (error, response, body) {
if (error || response.statusCode != 200) {
cb(utils.errorDown())
return
}
... | javascript | function obtainInfo(action, id, cb) {
request.post({
url: action,
form: {
trackingNo03: id
},
timeout: 20000
}, function (error, response, body) {
if (error || response.statusCode != 200) {
cb(utils.errorDown())
return
}
... | [
"function",
"obtainInfo",
"(",
"action",
",",
"id",
",",
"cb",
")",
"{",
"request",
".",
"post",
"(",
"{",
"url",
":",
"action",
",",
"form",
":",
"{",
"trackingNo03",
":",
"id",
"}",
",",
"timeout",
":",
"20000",
"}",
",",
"function",
"(",
"error"... | Get info from malaysiaPos page
@param action
@param id
@param postalcode
@param cb | [
"Get",
"info",
"from",
"malaysiaPos",
"page"
] | e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba | https://github.com/hdnpt/geartrack/blob/e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba/src/malaysiaPosTracker.js#L35-L63 |
31,979 | hdnpt/geartrack | src/malaysiaPosTracker.js | createMalaysiaPosEntity | function createMalaysiaPosEntity(html) {
let $ = parser.load(html)
let id = $('#trackingNo03').get(0).children[0].data.trim()
let init = html.indexOf("var strTD")
init = html.indexOf('"', init + 1)
let fin = html.indexOf('"', init + 1)
let strTD = html.substring(init, fin)
$ = parser.load(... | javascript | function createMalaysiaPosEntity(html) {
let $ = parser.load(html)
let id = $('#trackingNo03').get(0).children[0].data.trim()
let init = html.indexOf("var strTD")
init = html.indexOf('"', init + 1)
let fin = html.indexOf('"', init + 1)
let strTD = html.substring(init, fin)
$ = parser.load(... | [
"function",
"createMalaysiaPosEntity",
"(",
"html",
")",
"{",
"let",
"$",
"=",
"parser",
".",
"load",
"(",
"html",
")",
"let",
"id",
"=",
"$",
"(",
"'#trackingNo03'",
")",
".",
"get",
"(",
"0",
")",
".",
"children",
"[",
"0",
"]",
".",
"data",
".",... | Create malaysiaPos entity from html
@param html | [
"Create",
"malaysiaPos",
"entity",
"from",
"html"
] | e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba | https://github.com/hdnpt/geartrack/blob/e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba/src/malaysiaPosTracker.js#L69-L108 |
31,980 | hdnpt/geartrack | src/cttTracker.js | createCttEntity | function createCttEntity(id, html, cb) {
let state = null
let messages = []
try {
html = htmlBeautify(html)
let $ = parser.load(html)
let table = $('table.full-width tr').get(1).children.filter(e => e.type == 'tag')
let dayAndHours = table[2].children[0].data.trim() + ' '... | javascript | function createCttEntity(id, html, cb) {
let state = null
let messages = []
try {
html = htmlBeautify(html)
let $ = parser.load(html)
let table = $('table.full-width tr').get(1).children.filter(e => e.type == 'tag')
let dayAndHours = table[2].children[0].data.trim() + ' '... | [
"function",
"createCttEntity",
"(",
"id",
",",
"html",
",",
"cb",
")",
"{",
"let",
"state",
"=",
"null",
"let",
"messages",
"=",
"[",
"]",
"try",
"{",
"html",
"=",
"htmlBeautify",
"(",
"html",
")",
"let",
"$",
"=",
"parser",
".",
"load",
"(",
"html... | Create ctt entity from html
@param id
@param html
@param cb | [
"Create",
"ctt",
"entity",
"from",
"html"
] | e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba | https://github.com/hdnpt/geartrack/blob/e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba/src/cttTracker.js#L75-L140 |
31,981 | hdnpt/geartrack | src/pitneybowesTracker.js | obtainInfo | function obtainInfo(id, action, cb) {
request.get({
url: action,
timeout: 20000,
strictSSL: false
}, function (error, response, body) {
if (error || response.statusCode != 200) {
cb(utils.errorDown())
return
}
// Not found
if (body... | javascript | function obtainInfo(id, action, cb) {
request.get({
url: action,
timeout: 20000,
strictSSL: false
}, function (error, response, body) {
if (error || response.statusCode != 200) {
cb(utils.errorDown())
return
}
// Not found
if (body... | [
"function",
"obtainInfo",
"(",
"id",
",",
"action",
",",
"cb",
")",
"{",
"request",
".",
"get",
"(",
"{",
"url",
":",
"action",
",",
"timeout",
":",
"20000",
",",
"strictSSL",
":",
"false",
"}",
",",
"function",
"(",
"error",
",",
"response",
",",
... | Get info from parcel tracker request
@param action
@param id
@param cb | [
"Get",
"info",
"from",
"parcel",
"tracker",
"request"
] | e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba | https://github.com/hdnpt/geartrack/blob/e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba/src/pitneybowesTracker.js#L30-L56 |
31,982 | hdnpt/geartrack | src/pitneybowesTracker.js | createParcelTrackerEntity | function createParcelTrackerEntity(body) {
const data = JSON.parse(body)
const states = []
data.scanHistory.scanDetails.forEach((elem) => {
const state = {
state : elem.eventDescription,
date : elem.eventDate + "T" + elem.eventTime
}
if(elem.eventLocation &&... | javascript | function createParcelTrackerEntity(body) {
const data = JSON.parse(body)
const states = []
data.scanHistory.scanDetails.forEach((elem) => {
const state = {
state : elem.eventDescription,
date : elem.eventDate + "T" + elem.eventTime
}
if(elem.eventLocation &&... | [
"function",
"createParcelTrackerEntity",
"(",
"body",
")",
"{",
"const",
"data",
"=",
"JSON",
".",
"parse",
"(",
"body",
")",
"const",
"states",
"=",
"[",
"]",
"data",
".",
"scanHistory",
".",
"scanDetails",
".",
"forEach",
"(",
"(",
"elem",
")",
"=>",
... | Create parcel tracker entity from html
@param html | [
"Create",
"parcel",
"tracker",
"entity",
"from",
"html"
] | e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba | https://github.com/hdnpt/geartrack/blob/e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba/src/pitneybowesTracker.js#L62-L95 |
31,983 | hdnpt/geartrack | src/utils.js | function (type, error = null, id = null) {
type = type.toUpperCase()
let errors = {
'NO_DATA': 'No info for that id yet. Or maybe the data provided was wrong.',
'BUSY': 'The server providing the info is busy right now. Try again.',
'UNAVAILABLE': 'The server providing the info is unavail... | javascript | function (type, error = null, id = null) {
type = type.toUpperCase()
let errors = {
'NO_DATA': 'No info for that id yet. Or maybe the data provided was wrong.',
'BUSY': 'The server providing the info is busy right now. Try again.',
'UNAVAILABLE': 'The server providing the info is unavail... | [
"function",
"(",
"type",
",",
"error",
"=",
"null",
",",
"id",
"=",
"null",
")",
"{",
"type",
"=",
"type",
".",
"toUpperCase",
"(",
")",
"let",
"errors",
"=",
"{",
"'NO_DATA'",
":",
"'No info for that id yet. Or maybe the data provided was wrong.'",
",",
"'BUS... | Get the Error message by Type
@param type
@param error Error message
@returns {Error} | [
"Get",
"the",
"Error",
"message",
"by",
"Type"
] | e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba | https://github.com/hdnpt/geartrack/blob/e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba/src/utils.js#L10-L25 | |
31,984 | hdnpt/geartrack | src/correosESTracker.js | createCorreosEsEntity | function createCorreosEsEntity(id, html) {
let $ = parser.load(html)
let table2 = $('#Table2').get(0);
let states = []
const fields = ['date', 'info']
if (table2.children.length === 0 ||
(table2.children[1] !== undefined
&& table2.children[1].data !== undefined
&& table2.c... | javascript | function createCorreosEsEntity(id, html) {
let $ = parser.load(html)
let table2 = $('#Table2').get(0);
let states = []
const fields = ['date', 'info']
if (table2.children.length === 0 ||
(table2.children[1] !== undefined
&& table2.children[1].data !== undefined
&& table2.c... | [
"function",
"createCorreosEsEntity",
"(",
"id",
",",
"html",
")",
"{",
"let",
"$",
"=",
"parser",
".",
"load",
"(",
"html",
")",
"let",
"table2",
"=",
"$",
"(",
"'#Table2'",
")",
".",
"get",
"(",
"0",
")",
";",
"let",
"states",
"=",
"[",
"]",
"co... | Create correos.es entity from html
@param html | [
"Create",
"correos",
".",
"es",
"entity",
"from",
"html"
] | e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba | https://github.com/hdnpt/geartrack/blob/e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba/src/correosESTracker.js#L59-L103 |
31,985 | hdnpt/geartrack | src/cjahTracker.js | createCjahEntity | function createCjahEntity(id, html, cb) {
let entity = null
try {
let $ = parser.load(html)
let trs = $('table tbody tr')
// Not found
if (!trs || trs.length === 0) {
cb(utils.errorNoData())
return
}
let states = utils.tableParser(
... | javascript | function createCjahEntity(id, html, cb) {
let entity = null
try {
let $ = parser.load(html)
let trs = $('table tbody tr')
// Not found
if (!trs || trs.length === 0) {
cb(utils.errorNoData())
return
}
let states = utils.tableParser(
... | [
"function",
"createCjahEntity",
"(",
"id",
",",
"html",
",",
"cb",
")",
"{",
"let",
"entity",
"=",
"null",
"try",
"{",
"let",
"$",
"=",
"parser",
".",
"load",
"(",
"html",
")",
"let",
"trs",
"=",
"$",
"(",
"'table tbody tr'",
")",
"// Not found",
"if... | Create cjah entity from html
@param id
@param html
@param cb | [
"Create",
"cjah",
"entity",
"from",
"html"
] | e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba | https://github.com/hdnpt/geartrack/blob/e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba/src/cjahTracker.js#L44-L75 |
31,986 | hdnpt/geartrack | src/singpostTracker.js | createSingpostEntity | function createSingpostEntity(id, html) {
let $ = parser.load(html)
let date = []
$('span.tacking-date').each(function (i, elem) {
date.push($(this).text().trim())
})
let status = []
$('div.tacking-status').each(function (i, elem) {
status.push($(this).text().trim())
})
... | javascript | function createSingpostEntity(id, html) {
let $ = parser.load(html)
let date = []
$('span.tacking-date').each(function (i, elem) {
date.push($(this).text().trim())
})
let status = []
$('div.tacking-status').each(function (i, elem) {
status.push($(this).text().trim())
})
... | [
"function",
"createSingpostEntity",
"(",
"id",
",",
"html",
")",
"{",
"let",
"$",
"=",
"parser",
".",
"load",
"(",
"html",
")",
"let",
"date",
"=",
"[",
"]",
"$",
"(",
"'span.tacking-date'",
")",
".",
"each",
"(",
"function",
"(",
"i",
",",
"elem",
... | Create singpost entity from html
@param id
@param html | [
"Create",
"singpost",
"entity",
"from",
"html"
] | e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba | https://github.com/hdnpt/geartrack/blob/e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba/src/singpostTracker.js#L66-L88 |
31,987 | hdnpt/geartrack | src/panasiaTracker.js | createPanasiaEntity | function createPanasiaEntity(html, id) {
let $ = parser.load(html)
let td11 = $('.one-parcel .td11').contents()
let orderNumber = td11[1].data
let product = td11[3].data
let td22 = $('.one-parcel .td22').contents()
let trackingNumber = td22[1].data
let country = utils.removeChineseChars(td... | javascript | function createPanasiaEntity(html, id) {
let $ = parser.load(html)
let td11 = $('.one-parcel .td11').contents()
let orderNumber = td11[1].data
let product = td11[3].data
let td22 = $('.one-parcel .td22').contents()
let trackingNumber = td22[1].data
let country = utils.removeChineseChars(td... | [
"function",
"createPanasiaEntity",
"(",
"html",
",",
"id",
")",
"{",
"let",
"$",
"=",
"parser",
".",
"load",
"(",
"html",
")",
"let",
"td11",
"=",
"$",
"(",
"'.one-parcel .td11'",
")",
".",
"contents",
"(",
")",
"let",
"orderNumber",
"=",
"td11",
"[",
... | Create panasia entity from html
@param html
@param id | [
"Create",
"panasia",
"entity",
"from",
"html"
] | e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba | https://github.com/hdnpt/geartrack/blob/e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba/src/panasiaTracker.js#L53-L101 |
31,988 | hdnpt/geartrack | src/cainiaoTracker.js | createCainiaoEntity | function createCainiaoEntity(id, json) {
let section = json.data[0].section3 || json.data[0].section2;
let msgs = section.detailList.map(m => {
return {
state: fixStateName(m.desc),
date: moment.tz(m.time, "YYYY-MM-DD HH:mm:ss", zone).format()
}
})
let destinyId... | javascript | function createCainiaoEntity(id, json) {
let section = json.data[0].section3 || json.data[0].section2;
let msgs = section.detailList.map(m => {
return {
state: fixStateName(m.desc),
date: moment.tz(m.time, "YYYY-MM-DD HH:mm:ss", zone).format()
}
})
let destinyId... | [
"function",
"createCainiaoEntity",
"(",
"id",
",",
"json",
")",
"{",
"let",
"section",
"=",
"json",
".",
"data",
"[",
"0",
"]",
".",
"section3",
"||",
"json",
".",
"data",
"[",
"0",
"]",
".",
"section2",
";",
"let",
"msgs",
"=",
"section",
".",
"de... | Create cainiao entity from html
@param id
@param json | [
"Create",
"cainiao",
"entity",
"from",
"html"
] | e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba | https://github.com/hdnpt/geartrack/blob/e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba/src/cainiaoTracker.js#L68-L81 |
31,989 | hdnpt/geartrack | src/expresso24Tracker.js | createExpressoEntity | function createExpressoEntity(html) {
let $ = parser.load(html)
let data = []
$('table span').each(function (i, elem) {
if(i >= 10 )
data.push($(this).text().trim().replace(/\s\s+/g, ' '))
})
return new ExpressoInfo({
'guide': data[0],
'origin': data[1],
... | javascript | function createExpressoEntity(html) {
let $ = parser.load(html)
let data = []
$('table span').each(function (i, elem) {
if(i >= 10 )
data.push($(this).text().trim().replace(/\s\s+/g, ' '))
})
return new ExpressoInfo({
'guide': data[0],
'origin': data[1],
... | [
"function",
"createExpressoEntity",
"(",
"html",
")",
"{",
"let",
"$",
"=",
"parser",
".",
"load",
"(",
"html",
")",
"let",
"data",
"=",
"[",
"]",
"$",
"(",
"'table span'",
")",
".",
"each",
"(",
"function",
"(",
"i",
",",
"elem",
")",
"{",
"if",
... | Create expresso entity from html
@param html | [
"Create",
"expresso",
"entity",
"from",
"html"
] | e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba | https://github.com/hdnpt/geartrack/blob/e69c81f0084d7a5c60c63dcb2ca6a9e8dad5e0ba/src/expresso24Tracker.js#L59-L80 |
31,990 | amqp/node-red-contrib-rhea | rhea/rhea.js | amqpEndpointNode | function amqpEndpointNode(n) {
RED.nodes.createNode(this, n);
// save node parameters
this.host = n.host;
this.port = n.port;
this.username = n.username;
this.password = n.password;
this.container_id = n.container_id;
this.rejectUnauthorized = n.rejectUn... | javascript | function amqpEndpointNode(n) {
RED.nodes.createNode(this, n);
// save node parameters
this.host = n.host;
this.port = n.port;
this.username = n.username;
this.password = n.password;
this.container_id = n.container_id;
this.rejectUnauthorized = n.rejectUn... | [
"function",
"amqpEndpointNode",
"(",
"n",
")",
"{",
"RED",
".",
"nodes",
".",
"createNode",
"(",
"this",
",",
"n",
")",
";",
"// save node parameters",
"this",
".",
"host",
"=",
"n",
".",
"host",
";",
"this",
".",
"port",
"=",
"n",
".",
"port",
";",
... | Node for configuring an AMQP endpoint | [
"Node",
"for",
"configuring",
"an",
"AMQP",
"endpoint"
] | 69eebcdc494571030b222afeec98d8f947355a91 | https://github.com/amqp/node-red-contrib-rhea/blob/69eebcdc494571030b222afeec98d8f947355a91/rhea/rhea.js#L24-L112 |
31,991 | amqp/node-red-contrib-rhea | rhea/rhea.js | amqpSenderNode | function amqpSenderNode(config) {
RED.nodes.createNode(this, config);
// get endpoint configuration
this.endpoint = RED.nodes.getNode(config.endpoint);
// get all other configuration
this.address = config.address;
this.autosettle = config.autosettle;
this.dynami... | javascript | function amqpSenderNode(config) {
RED.nodes.createNode(this, config);
// get endpoint configuration
this.endpoint = RED.nodes.getNode(config.endpoint);
// get all other configuration
this.address = config.address;
this.autosettle = config.autosettle;
this.dynami... | [
"function",
"amqpSenderNode",
"(",
"config",
")",
"{",
"RED",
".",
"nodes",
".",
"createNode",
"(",
"this",
",",
"config",
")",
";",
"// get endpoint configuration",
"this",
".",
"endpoint",
"=",
"RED",
".",
"nodes",
".",
"getNode",
"(",
"config",
".",
"en... | Node for AMQP sender | [
"Node",
"for",
"AMQP",
"sender"
] | 69eebcdc494571030b222afeec98d8f947355a91 | https://github.com/amqp/node-red-contrib-rhea/blob/69eebcdc494571030b222afeec98d8f947355a91/rhea/rhea.js#L119-L205 |
31,992 | amqp/node-red-contrib-rhea | rhea/rhea.js | setup | function setup(connection) {
node.connection = connection;
// node connected
node.status({ fill: 'green', shape: 'dot', text: 'connected' });
// build sender options based on node configuration
var options = {
target:... | javascript | function setup(connection) {
node.connection = connection;
// node connected
node.status({ fill: 'green', shape: 'dot', text: 'connected' });
// build sender options based on node configuration
var options = {
target:... | [
"function",
"setup",
"(",
"connection",
")",
"{",
"node",
".",
"connection",
"=",
"connection",
";",
"// node connected",
"node",
".",
"status",
"(",
"{",
"fill",
":",
"'green'",
",",
"shape",
":",
"'dot'",
",",
"text",
":",
"'connected'",
"}",
")",
";",... | Node setup for creating sender link
@param connection Connection instance | [
"Node",
"setup",
"for",
"creating",
"sender",
"link"
] | 69eebcdc494571030b222afeec98d8f947355a91 | https://github.com/amqp/node-red-contrib-rhea/blob/69eebcdc494571030b222afeec98d8f947355a91/rhea/rhea.js#L149-L202 |
31,993 | amqp/node-red-contrib-rhea | rhea/rhea.js | amqpReceiverNode | function amqpReceiverNode(config) {
RED.nodes.createNode(this, config);
// get endpoint configuration
this.endpoint = RED.nodes.getNode(config.endpoint);
// get all other configuration
this.address = config.address;
this.autoaccept = config.autoaccept;
this.cred... | javascript | function amqpReceiverNode(config) {
RED.nodes.createNode(this, config);
// get endpoint configuration
this.endpoint = RED.nodes.getNode(config.endpoint);
// get all other configuration
this.address = config.address;
this.autoaccept = config.autoaccept;
this.cred... | [
"function",
"amqpReceiverNode",
"(",
"config",
")",
"{",
"RED",
".",
"nodes",
".",
"createNode",
"(",
"this",
",",
"config",
")",
";",
"// get endpoint configuration",
"this",
".",
"endpoint",
"=",
"RED",
".",
"nodes",
".",
"getNode",
"(",
"config",
".",
"... | Node for AMQP receiver | [
"Node",
"for",
"AMQP",
"receiver"
] | 69eebcdc494571030b222afeec98d8f947355a91 | https://github.com/amqp/node-red-contrib-rhea/blob/69eebcdc494571030b222afeec98d8f947355a91/rhea/rhea.js#L220-L304 |
31,994 | amqp/node-red-contrib-rhea | rhea/rhea.js | setup | function setup(connection) {
node.connection = connection;
// node connected
node.status({ fill: 'green', shape: 'dot', text: 'connected' });
// build receiver options based on node configuration
var options = {
sourc... | javascript | function setup(connection) {
node.connection = connection;
// node connected
node.status({ fill: 'green', shape: 'dot', text: 'connected' });
// build receiver options based on node configuration
var options = {
sourc... | [
"function",
"setup",
"(",
"connection",
")",
"{",
"node",
".",
"connection",
"=",
"connection",
";",
"// node connected",
"node",
".",
"status",
"(",
"{",
"fill",
":",
"'green'",
",",
"shape",
":",
"'dot'",
",",
"text",
":",
"'connected'",
"}",
")",
";",... | Node setup for creating receiver link
@param connection Connection instance | [
"Node",
"setup",
"for",
"creating",
"receiver",
"link"
] | 69eebcdc494571030b222afeec98d8f947355a91 | https://github.com/amqp/node-red-contrib-rhea/blob/69eebcdc494571030b222afeec98d8f947355a91/rhea/rhea.js#L254-L301 |
31,995 | amqp/node-red-contrib-rhea | rhea/rhea.js | amqpRequesterNode | function amqpRequesterNode(config) {
RED.nodes.createNode(this, config);
//var container = rhea.create_container();
// get endpoint configuration
this.endpoint = RED.nodes.getNode(config.endpoint);
// get all other configuration
this.address = config.address;
... | javascript | function amqpRequesterNode(config) {
RED.nodes.createNode(this, config);
//var container = rhea.create_container();
// get endpoint configuration
this.endpoint = RED.nodes.getNode(config.endpoint);
// get all other configuration
this.address = config.address;
... | [
"function",
"amqpRequesterNode",
"(",
"config",
")",
"{",
"RED",
".",
"nodes",
".",
"createNode",
"(",
"this",
",",
"config",
")",
";",
"//var container = rhea.create_container();",
"// get endpoint configuration",
"this",
".",
"endpoint",
"=",
"RED",
".",
"nodes",
... | Node for AMQP requester | [
"Node",
"for",
"AMQP",
"requester"
] | 69eebcdc494571030b222afeec98d8f947355a91 | https://github.com/amqp/node-red-contrib-rhea/blob/69eebcdc494571030b222afeec98d8f947355a91/rhea/rhea.js#L311-L410 |
31,996 | amqp/node-red-contrib-rhea | rhea/rhea.js | amqpResponderNode | function amqpResponderNode(config) {
RED.nodes.createNode(this, config);
// get endpoint configuration
this.endpoint = RED.nodes.getNode(config.endpoint);
// get all other configuration
this.address = config.address;
var node = this;
// node not yet connected
... | javascript | function amqpResponderNode(config) {
RED.nodes.createNode(this, config);
// get endpoint configuration
this.endpoint = RED.nodes.getNode(config.endpoint);
// get all other configuration
this.address = config.address;
var node = this;
// node not yet connected
... | [
"function",
"amqpResponderNode",
"(",
"config",
")",
"{",
"RED",
".",
"nodes",
".",
"createNode",
"(",
"this",
",",
"config",
")",
";",
"// get endpoint configuration",
"this",
".",
"endpoint",
"=",
"RED",
".",
"nodes",
".",
"getNode",
"(",
"config",
".",
... | Node for AMQP responder | [
"Node",
"for",
"AMQP",
"responder"
] | 69eebcdc494571030b222afeec98d8f947355a91 | https://github.com/amqp/node-red-contrib-rhea/blob/69eebcdc494571030b222afeec98d8f947355a91/rhea/rhea.js#L417-L508 |
31,997 | amqp/node-red-contrib-rhea | rhea/rhea.js | setup | function setup(connection) {
var request = undefined;
var reply_to = undefined;
var response = undefined;
node.connection = connection;
// node connected
node.status({ fill: 'green', shape: 'dot', text: 'connected' });
... | javascript | function setup(connection) {
var request = undefined;
var reply_to = undefined;
var response = undefined;
node.connection = connection;
// node connected
node.status({ fill: 'green', shape: 'dot', text: 'connected' });
... | [
"function",
"setup",
"(",
"connection",
")",
"{",
"var",
"request",
"=",
"undefined",
";",
"var",
"reply_to",
"=",
"undefined",
";",
"var",
"response",
"=",
"undefined",
";",
"node",
".",
"connection",
"=",
"connection",
";",
"// node connected",
"node",
"."... | Node setup for creating receiver link for receiving the request
and the sender for sending reply
@param connection Connection instance | [
"Node",
"setup",
"for",
"creating",
"receiver",
"link",
"for",
"receiving",
"the",
"request",
"and",
"the",
"sender",
"for",
"sending",
"reply"
] | 69eebcdc494571030b222afeec98d8f947355a91 | https://github.com/amqp/node-red-contrib-rhea/blob/69eebcdc494571030b222afeec98d8f947355a91/rhea/rhea.js#L442-L505 |
31,998 | hegemonic/requizzle | lib/requizzle.js | isNativeModule | function isNativeModule(targetPath, parentModule) {
const lookupPaths = Module._resolveLookupPaths(targetPath, parentModule, true);
/* istanbul ignore next */
return lookupPaths === null ||
(lookupPaths.length === 2 &&
lookupPaths[1].length === 0 &&
lookupPaths[0] === targetPath);
} | javascript | function isNativeModule(targetPath, parentModule) {
const lookupPaths = Module._resolveLookupPaths(targetPath, parentModule, true);
/* istanbul ignore next */
return lookupPaths === null ||
(lookupPaths.length === 2 &&
lookupPaths[1].length === 0 &&
lookupPaths[0] === targetPath);
} | [
"function",
"isNativeModule",
"(",
"targetPath",
",",
"parentModule",
")",
"{",
"const",
"lookupPaths",
"=",
"Module",
".",
"_resolveLookupPaths",
"(",
"targetPath",
",",
"parentModule",
",",
"true",
")",
";",
"/* istanbul ignore next */",
"return",
"lookupPaths",
"... | Function that returns text to swizzle into the module.
@typedef module:lib/requizzle~wrapperFunction
@type {function}
@param {string} targetPath - The path to the target module.
@param {string} parentModulePath - The path to the module that is requiring the target module.
@return {string} The text to insert before or ... | [
"Function",
"that",
"returns",
"text",
"to",
"swizzle",
"into",
"the",
"module",
"."
] | 3193e1bed6fdfe69fbde99496da6ed383a160680 | https://github.com/hegemonic/requizzle/blob/3193e1bed6fdfe69fbde99496da6ed383a160680/lib/requizzle.js#L38-L46 |
31,999 | oxyno-zeta/react-editable-json-tree | src/utils/objectTypes.js | isComponentWillChange | function isComponentWillChange(oldValue, newValue) {
const oldType = getObjectType(oldValue);
const newType = getObjectType(newValue);
return ((oldType === 'Function' || newType === 'Function') && newType !== oldType);
} | javascript | function isComponentWillChange(oldValue, newValue) {
const oldType = getObjectType(oldValue);
const newType = getObjectType(newValue);
return ((oldType === 'Function' || newType === 'Function') && newType !== oldType);
} | [
"function",
"isComponentWillChange",
"(",
"oldValue",
",",
"newValue",
")",
"{",
"const",
"oldType",
"=",
"getObjectType",
"(",
"oldValue",
")",
";",
"const",
"newType",
"=",
"getObjectType",
"(",
"newValue",
")",
";",
"return",
"(",
"(",
"oldType",
"===",
"... | Is Component will change ?
@param oldValue {*} old value
@param newValue {*} new value
@returns {boolean} result | [
"Is",
"Component",
"will",
"change",
"?"
] | 7f322b28c4da44098bc34cfd89b59308e26b20eb | https://github.com/oxyno-zeta/react-editable-json-tree/blob/7f322b28c4da44098bc34cfd89b59308e26b20eb/src/utils/objectTypes.js#L40-L44 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.