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
30,600
gjtorikian/panino-docs
lib/panino/plugins/parsers/javascript/jsd/ast_esprima.js
detect_class_members_from_array
function detect_class_members_from_array(cls, ast) { cls["members"] = []; return _.each(ast["elements"], function(el) { detect_method_or_property(cls, key_value(el), el, el); }); }
javascript
function detect_class_members_from_array(cls, ast) { cls["members"] = []; return _.each(ast["elements"], function(el) { detect_method_or_property(cls, key_value(el), el, el); }); }
[ "function", "detect_class_members_from_array", "(", "cls", ",", "ast", ")", "{", "cls", "[", "\"members\"", "]", "=", "[", "]", ";", "return", "_", ".", "each", "(", "ast", "[", "\"elements\"", "]", ",", "function", "(", "el", ")", "{", "detect_method_or...
Detects class members from array literal
[ "Detects", "class", "members", "from", "array", "literal" ]
23ea0355d42875a59f14a065ac3c06d096112ced
https://github.com/gjtorikian/panino-docs/blob/23ea0355d42875a59f14a065ac3c06d096112ced/lib/panino/plugins/parsers/javascript/jsd/ast_esprima.js#L311-L316
30,601
gjtorikian/panino-docs
lib/panino/plugins/parsers/javascript/jsd/ast_esprima.js
detect_method_or_property
function detect_method_or_property(cls, key, value, pair) { if (isFn(value)) { var m = make_method(key, value); if (apply_autodetected(m, pair)) return cls["members"].push(m); } else { var p = make_property(key, value); if (apply_autodetected(p, pair)) return cls["members"].push(p); ...
javascript
function detect_method_or_property(cls, key, value, pair) { if (isFn(value)) { var m = make_method(key, value); if (apply_autodetected(m, pair)) return cls["members"].push(m); } else { var p = make_property(key, value); if (apply_autodetected(p, pair)) return cls["members"].push(p); ...
[ "function", "detect_method_or_property", "(", "cls", ",", "key", ",", "value", ",", "pair", ")", "{", "if", "(", "isFn", "(", "value", ")", ")", "{", "var", "m", "=", "make_method", "(", "key", ",", "value", ")", ";", "if", "(", "apply_autodetected", ...
Detects item in object literal either as method or property
[ "Detects", "item", "in", "object", "literal", "either", "as", "method", "or", "property" ]
23ea0355d42875a59f14a065ac3c06d096112ced
https://github.com/gjtorikian/panino-docs/blob/23ea0355d42875a59f14a065ac3c06d096112ced/lib/panino/plugins/parsers/javascript/jsd/ast_esprima.js#L319-L330
30,602
gjtorikian/panino-docs
lib/panino/plugins/parsers/javascript/jsd/ast_esprima.js
apply_autodetected
function apply_autodetected(m, ast, inheritable) { docset = find_docset(ast); var inheritable = inheritable || true; if (!docset || docset["type"] != "doc_comment") { if (inheritable) m["inheritdoc"] = {}; else m["private"] = true; m["autodetected"] = true; } if (docset) { ...
javascript
function apply_autodetected(m, ast, inheritable) { docset = find_docset(ast); var inheritable = inheritable || true; if (!docset || docset["type"] != "doc_comment") { if (inheritable) m["inheritdoc"] = {}; else m["private"] = true; m["autodetected"] = true; } if (docset) { ...
[ "function", "apply_autodetected", "(", "m", ",", "ast", ",", "inheritable", ")", "{", "docset", "=", "find_docset", "(", "ast", ")", ";", "var", "inheritable", "=", "inheritable", "||", "true", ";", "if", "(", "!", "docset", "||", "docset", "[", "\"type\...
When member has a comment, adds code to the related docset and returns false. Otherwise detects the line number of member and returns true.
[ "When", "member", "has", "a", "comment", "adds", "code", "to", "the", "related", "docset", "and", "returns", "false", ".", "Otherwise", "detects", "the", "line", "number", "of", "member", "and", "returns", "true", "." ]
23ea0355d42875a59f14a065ac3c06d096112ced
https://github.com/gjtorikian/panino-docs/blob/23ea0355d42875a59f14a065ac3c06d096112ced/lib/panino/plugins/parsers/javascript/jsd/ast_esprima.js#L413-L437
30,603
gjtorikian/panino-docs
lib/panino/plugins/parsers/javascript/jsd/ast_esprima.js
each_pair_in_object_expression
function each_pair_in_object_expression(ast, func) { if (! (ast && ast["type"] == "ObjectExpression")) { return; } return _.each(ast["properties"], function(p) { isFn(key_value(p["key"]), p["value"], p); }); }
javascript
function each_pair_in_object_expression(ast, func) { if (! (ast && ast["type"] == "ObjectExpression")) { return; } return _.each(ast["properties"], function(p) { isFn(key_value(p["key"]), p["value"], p); }); }
[ "function", "each_pair_in_object_expression", "(", "ast", ",", "func", ")", "{", "if", "(", "!", "(", "ast", "&&", "ast", "[", "\"type\"", "]", "==", "\"ObjectExpression\"", ")", ")", "{", "return", ";", "}", "return", "_", ".", "each", "(", "ast", "["...
Iterates over keys and values in ObjectExpression. The keys are turned into strings, but values are left as is for further processing.
[ "Iterates", "over", "keys", "and", "values", "in", "ObjectExpression", ".", "The", "keys", "are", "turned", "into", "strings", "but", "values", "are", "left", "as", "is", "for", "further", "processing", "." ]
23ea0355d42875a59f14a065ac3c06d096112ced
https://github.com/gjtorikian/panino-docs/blob/23ea0355d42875a59f14a065ac3c06d096112ced/lib/panino/plugins/parsers/javascript/jsd/ast_esprima.js#L512-L520
30,604
weepower/wee-core
scripts/wee-fetch.js
createFetchInstance
function createFetchInstance(defaultConfig) { const context = fetchFactory(defaultConfig); const instance = bind(context.request, context); // Copy properties from context extend(instance, context, context); return instance; }
javascript
function createFetchInstance(defaultConfig) { const context = fetchFactory(defaultConfig); const instance = bind(context.request, context); // Copy properties from context extend(instance, context, context); return instance; }
[ "function", "createFetchInstance", "(", "defaultConfig", ")", "{", "const", "context", "=", "fetchFactory", "(", "defaultConfig", ")", ";", "const", "instance", "=", "bind", "(", "context", ".", "request", ",", "context", ")", ";", "// Copy properties from context...
Create a new instance of fetch @param defaultConfig @returns {wrap}
[ "Create", "a", "new", "instance", "of", "fetch" ]
3ffbb38ce0c9d21b0c5f4aad6b31295d7a2750f4
https://github.com/weepower/wee-core/blob/3ffbb38ce0c9d21b0c5f4aad6b31295d7a2750f4/scripts/wee-fetch.js#L13-L21
30,605
gjtorikian/panino-docs
lib/panino/plugins/parsers/javascript/jsd/js_parser.js
line_number
function line_number(index, source) { // To speed things up, remember the index until which we counted, // then next time just begin counting from there. This way we // only count each line once. var i = start_index; var count = 0; while (i < index) { if (source[i] === "\n") { count++; } ...
javascript
function line_number(index, source) { // To speed things up, remember the index until which we counted, // then next time just begin counting from there. This way we // only count each line once. var i = start_index; var count = 0; while (i < index) { if (source[i] === "\n") { count++; } ...
[ "function", "line_number", "(", "index", ",", "source", ")", "{", "// To speed things up, remember the index until which we counted,", "// then next time just begin counting from there. This way we", "// only count each line once.", "var", "i", "=", "start_index", ";", "var", "cou...
Given index inside input string, returns the corresponding line number
[ "Given", "index", "inside", "input", "string", "returns", "the", "corresponding", "line", "number" ]
23ea0355d42875a59f14a065ac3c06d096112ced
https://github.com/gjtorikian/panino-docs/blob/23ea0355d42875a59f14a065ac3c06d096112ced/lib/panino/plugins/parsers/javascript/jsd/js_parser.js#L124-L141
30,606
gjtorikian/panino-docs
lib/panino/plugins/parsers/javascript/jsd/js_parser.js
stuff_after
function stuff_after(comment, ast) { var code = code_after(comment["range"], ast); if (code && comment["next"]) return code["range"][0] < comment["next"]["range"][0] ? code : ""; else return code; }
javascript
function stuff_after(comment, ast) { var code = code_after(comment["range"], ast); if (code && comment["next"]) return code["range"][0] < comment["next"]["range"][0] ? code : ""; else return code; }
[ "function", "stuff_after", "(", "comment", ",", "ast", ")", "{", "var", "code", "=", "code_after", "(", "comment", "[", "\"range\"", "]", ",", "ast", ")", ";", "if", "(", "code", "&&", "comment", "[", "\"next\"", "]", ")", "return", "code", "[", "\"r...
Sees if there is some code following the comment. Returns the code found. But if the comment is instead followed by another comment, returns an empty string.
[ "Sees", "if", "there", "is", "some", "code", "following", "the", "comment", ".", "Returns", "the", "code", "found", ".", "But", "if", "the", "comment", "is", "instead", "followed", "by", "another", "comment", "returns", "an", "empty", "string", "." ]
23ea0355d42875a59f14a065ac3c06d096112ced
https://github.com/gjtorikian/panino-docs/blob/23ea0355d42875a59f14a065ac3c06d096112ced/lib/panino/plugins/parsers/javascript/jsd/js_parser.js#L146-L153
30,607
gjtorikian/panino-docs
lib/panino/plugins/parsers/javascript/jsd/js_parser.js
code_after
function code_after(range, parent) { // Look through all child nodes of parent... var children = child_nodes(parent); for (var i = 0; i < children.length; i++) { if (less(range, children[i]["range"])) { // If node is after our range, then that's it. There could // be comments in our way, but that...
javascript
function code_after(range, parent) { // Look through all child nodes of parent... var children = child_nodes(parent); for (var i = 0; i < children.length; i++) { if (less(range, children[i]["range"])) { // If node is after our range, then that's it. There could // be comments in our way, but that...
[ "function", "code_after", "(", "range", ",", "parent", ")", "{", "// Look through all child nodes of parent...", "var", "children", "=", "child_nodes", "(", "parent", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "children", ".", "length", ";", ...
Looks for code following the given range. The second argument is the parent node within which we perform our search.
[ "Looks", "for", "code", "following", "the", "given", "range", ".", "The", "second", "argument", "is", "the", "parent", "node", "within", "which", "we", "perform", "our", "search", "." ]
23ea0355d42875a59f14a065ac3c06d096112ced
https://github.com/gjtorikian/panino-docs/blob/23ea0355d42875a59f14a065ac3c06d096112ced/lib/panino/plugins/parsers/javascript/jsd/js_parser.js#L160-L176
30,608
gjtorikian/panino-docs
lib/panino/plugins/parsers/javascript/jsd/js_parser.js
child_nodes
function child_nodes(node) { var properties = NODE_TYPES[node["type"]]; if (properties === undefined) { console.error("FATAL".red + ": Unknown node type: " + node["type"]); console.trace(); process.exit(1); } var x = properties.map(function(p) { return node[p]; }); return _.flatten(_....
javascript
function child_nodes(node) { var properties = NODE_TYPES[node["type"]]; if (properties === undefined) { console.error("FATAL".red + ": Unknown node type: " + node["type"]); console.trace(); process.exit(1); } var x = properties.map(function(p) { return node[p]; }); return _.flatten(_....
[ "function", "child_nodes", "(", "node", ")", "{", "var", "properties", "=", "NODE_TYPES", "[", "node", "[", "\"type\"", "]", "]", ";", "if", "(", "properties", "===", "undefined", ")", "{", "console", ".", "error", "(", "\"FATAL\"", ".", "red", "+", "\...
Returns array of child nodes of given node
[ "Returns", "array", "of", "child", "nodes", "of", "given", "node" ]
23ea0355d42875a59f14a065ac3c06d096112ced
https://github.com/gjtorikian/panino-docs/blob/23ea0355d42875a59f14a065ac3c06d096112ced/lib/panino/plugins/parsers/javascript/jsd/js_parser.js#L194-L208
30,609
apostrophecms-legacy/apostrophe-schemas
index.js
function(req, data, name, snippet, field, callback) { var manager = self._pages.getManager(field.withType); if (!manager) { return callback(new Error('join with type ' + field.withType + ' unrecognized')); } var titleOrId = self._apos.sanitizeString(data[name]); var criteria = { $o...
javascript
function(req, data, name, snippet, field, callback) { var manager = self._pages.getManager(field.withType); if (!manager) { return callback(new Error('join with type ' + field.withType + ' unrecognized')); } var titleOrId = self._apos.sanitizeString(data[name]); var criteria = { $o...
[ "function", "(", "req", ",", "data", ",", "name", ",", "snippet", ",", "field", ",", "callback", ")", "{", "var", "manager", "=", "self", ".", "_pages", ".", "getManager", "(", "field", ".", "withType", ")", ";", "if", "(", "!", "manager", ")", "{"...
Support for one-to-one joins in CSV imports, by title or id of item joined with. Title match is tolerant
[ "Support", "for", "one", "-", "to", "-", "one", "joins", "in", "CSV", "imports", "by", "title", "or", "id", "of", "item", "joined", "with", ".", "Title", "match", "is", "tolerant" ]
702e30657a38b31fa1005532f2aa487fd153aac7
https://github.com/apostrophecms-legacy/apostrophe-schemas/blob/702e30657a38b31fa1005532f2aa487fd153aac7/index.js#L426-L444
30,610
apostrophecms-legacy/apostrophe-schemas
index.js
function(req, data, name, snippet, field, callback) { var manager = self._pages.getManager(field.withType); if (!manager) { return callback(new Error('join with type ' + field.withType + ' unrecognized')); } var titlesOrIds = self._apos.sanitizeString(data[name]).split(/\s*,\s*/); ...
javascript
function(req, data, name, snippet, field, callback) { var manager = self._pages.getManager(field.withType); if (!manager) { return callback(new Error('join with type ' + field.withType + ' unrecognized')); } var titlesOrIds = self._apos.sanitizeString(data[name]).split(/\s*,\s*/); ...
[ "function", "(", "req", ",", "data", ",", "name", ",", "snippet", ",", "field", ",", "callback", ")", "{", "var", "manager", "=", "self", ".", "_pages", ".", "getManager", "(", "field", ".", "withType", ")", ";", "if", "(", "!", "manager", ")", "{"...
Support for array joins in CSV imports, by title or id of items joined with, in a comma-separated list. Title match is tolerant, but you must NOT supply any commas that may appear in the titles of the individual items, since commas are reserved for separating items in the list
[ "Support", "for", "array", "joins", "in", "CSV", "imports", "by", "title", "or", "id", "of", "items", "joined", "with", "in", "a", "comma", "-", "separated", "list", ".", "Title", "match", "is", "tolerant", "but", "you", "must", "NOT", "supply", "any", ...
702e30657a38b31fa1005532f2aa487fd153aac7
https://github.com/apostrophecms-legacy/apostrophe-schemas/blob/702e30657a38b31fa1005532f2aa487fd153aac7/index.js#L450-L475
30,611
artifishional/air-m2
src/view/fullscreen_api.js
error
function error() { reject(new TypeError()); doc.removeEventListener(api.events.error, error, false); }
javascript
function error() { reject(new TypeError()); doc.removeEventListener(api.events.error, error, false); }
[ "function", "error", "(", ")", "{", "reject", "(", "new", "TypeError", "(", ")", ")", ";", "doc", ".", "removeEventListener", "(", "api", ".", "events", ".", "error", ",", "error", ",", "false", ")", ";", "}" ]
When receiving an internal fullscreenerror event, reject the promise
[ "When", "receiving", "an", "internal", "fullscreenerror", "event", "reject", "the", "promise" ]
554203dcc835e4877481f53efc92e04aff79ce4c
https://github.com/artifishional/air-m2/blob/554203dcc835e4877481f53efc92e04aff79ce4c/src/view/fullscreen_api.js#L112-L115
30,612
shapesecurity/shift-scope-js
src/annotate-source.js
insertInto
function insertInto(annotations, index, text, afterExisting) { for (let i = 0; i < annotations.length; ++i) { if (annotations[i].index >= index) { if (afterExisting) { while (i < annotations.length && annotations[i].index === index) { ++i; } } annotations.splice(i, 0, ...
javascript
function insertInto(annotations, index, text, afterExisting) { for (let i = 0; i < annotations.length; ++i) { if (annotations[i].index >= index) { if (afterExisting) { while (i < annotations.length && annotations[i].index === index) { ++i; } } annotations.splice(i, 0, ...
[ "function", "insertInto", "(", "annotations", ",", "index", ",", "text", ",", "afterExisting", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "annotations", ".", "length", ";", "++", "i", ")", "{", "if", "(", "annotations", "[", "i", "]...
Copyright 2017 Shape Security, Inc. Licensed under the Apache License, Version 2.0 (the "License") you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software di...
[ "Copyright", "2017", "Shape", "Security", "Inc", "." ]
2a467754fec0e8f0149a08d0a366c2663f0670fd
https://github.com/shapesecurity/shift-scope-js/blob/2a467754fec0e8f0149a08d0a366c2663f0670fd/src/annotate-source.js#L17-L31
30,613
maxrumsey/hookcord
src/external/discord.js
DiscordJS
function DiscordJS(embed) { if (embed.file) { console.log('Files in embeds will not be sent.'); embed.file = undefined; } return { 'embeds': [ embed, ], }; }
javascript
function DiscordJS(embed) { if (embed.file) { console.log('Files in embeds will not be sent.'); embed.file = undefined; } return { 'embeds': [ embed, ], }; }
[ "function", "DiscordJS", "(", "embed", ")", "{", "if", "(", "embed", ".", "file", ")", "{", "console", ".", "log", "(", "'Files in embeds will not be sent.'", ")", ";", "embed", ".", "file", "=", "undefined", ";", "}", "return", "{", "'embeds'", ":", "["...
Parses Discord.JS embeds and turns them into webhooks. @returns {WebhookJSON} @param {Object} DiscordJSEmbed The {@link https://discord.js.org/#/docs/main/stable/class/RichEmbed|Discord.JS Embed} to pass into the parser. @example var embed = new require('discord.js').RichEmbed(); embed.setTitle('Hello!') let hook = new...
[ "Parses", "Discord", ".", "JS", "embeds", "and", "turns", "them", "into", "webhooks", "." ]
ca3cee6b482178a7624a906431a717089748bd49
https://github.com/maxrumsey/hookcord/blob/ca3cee6b482178a7624a906431a717089748bd49/src/external/discord.js#L13-L23
30,614
gjtorikian/panino-docs
lib/panino.js
parse_files
function parse_files(files, options, callback) { var nodes = { // root section node '': { id: '', type: 'section', children: [], description: '', short_description: '', href: '#', root: true, file: '', line: 0 } }; var reportObject = { }; asy...
javascript
function parse_files(files, options, callback) { var nodes = { // root section node '': { id: '', type: 'section', children: [], description: '', short_description: '', href: '#', root: true, file: '', line: 0 } }; var reportObject = { }; asy...
[ "function", "parse_files", "(", "files", ",", "options", ",", "callback", ")", "{", "var", "nodes", "=", "{", "// root section node", "''", ":", "{", "id", ":", "''", ",", "type", ":", "'section'", ",", "children", ":", "[", "]", ",", "description", ":...
parse all files and prepare a "raw list of nodes
[ "parse", "all", "files", "and", "prepare", "a", "raw", "list", "of", "nodes" ]
23ea0355d42875a59f14a065ac3c06d096112ced
https://github.com/gjtorikian/panino-docs/blob/23ea0355d42875a59f14a065ac3c06d096112ced/lib/panino.js#L38-L75
30,615
duniter/duniter-ui
index.js
isPortTaken
function isPortTaken(port, fn) { const net = require('net') const tester = net.createServer() .once('error', function (err) { if (err.code != 'EADDRINUSE') return fn(err) fn(null, true) }) .once('listening', function() { tester.once('close', function() { fn(null, false) }) .clo...
javascript
function isPortTaken(port, fn) { const net = require('net') const tester = net.createServer() .once('error', function (err) { if (err.code != 'EADDRINUSE') return fn(err) fn(null, true) }) .once('listening', function() { tester.once('close', function() { fn(null, false) }) .clo...
[ "function", "isPortTaken", "(", "port", ",", "fn", ")", "{", "const", "net", "=", "require", "(", "'net'", ")", "const", "tester", "=", "net", ".", "createServer", "(", ")", ".", "once", "(", "'error'", ",", "function", "(", "err", ")", "{", "if", ...
Checks if a port is already taken by another app. Source: https://gist.github.com/timoxley/1689041 @param port @param fn
[ "Checks", "if", "a", "port", "is", "already", "taken", "by", "another", "app", "." ]
de5c73aa4fe9add95711f3efba2f883645f315d1
https://github.com/duniter/duniter-ui/blob/de5c73aa4fe9add95711f3efba2f883645f315d1/index.js#L145-L157
30,616
ciena-frost/ember-frost-demo-components
broccoli-raw.js
readDirectory
function readDirectory (srcDir) { let srcTree = {} const entries = fs.readdirSync(srcDir) entries.forEach(function (entry) { const filePath = path.join(srcDir, entry) if (fs.lstatSync(filePath).isDirectory()) { srcTree[entry] = readDirectory(filePath) } else { srcTree[entry] = fs.readFile...
javascript
function readDirectory (srcDir) { let srcTree = {} const entries = fs.readdirSync(srcDir) entries.forEach(function (entry) { const filePath = path.join(srcDir, entry) if (fs.lstatSync(filePath).isDirectory()) { srcTree[entry] = readDirectory(filePath) } else { srcTree[entry] = fs.readFile...
[ "function", "readDirectory", "(", "srcDir", ")", "{", "let", "srcTree", "=", "{", "}", "const", "entries", "=", "fs", ".", "readdirSync", "(", "srcDir", ")", "entries", ".", "forEach", "(", "function", "(", "entry", ")", "{", "const", "filePath", "=", ...
reads a directory into an object @param {String} srcDir - source directory @returns {Object} an object containing the directory file contents
[ "reads", "a", "directory", "into", "an", "object" ]
152466e82fb7e2a880cd166140b32f8912309e36
https://github.com/ciena-frost/ember-frost-demo-components/blob/152466e82fb7e2a880cd166140b32f8912309e36/broccoli-raw.js#L15-L31
30,617
NatLibFi/marc-record-serializers
src/iso2709.js
parseDirectory
function parseDirectory(dataStr) { let currChar = ''; let directory = ''; let pos = 24; while (currChar !== '\x1E') { currChar = dataStr.charAt(pos); if (currChar !== 'x1E') { directory += currChar; } pos++; if (pos > dataStr.length) { throw new Error('Invalid record'); } } ret...
javascript
function parseDirectory(dataStr) { let currChar = ''; let directory = ''; let pos = 24; while (currChar !== '\x1E') { currChar = dataStr.charAt(pos); if (currChar !== 'x1E') { directory += currChar; } pos++; if (pos > dataStr.length) { throw new Error('Invalid record'); } } ret...
[ "function", "parseDirectory", "(", "dataStr", ")", "{", "let", "currChar", "=", "''", ";", "let", "directory", "=", "''", ";", "let", "pos", "=", "24", ";", "while", "(", "currChar", "!==", "'\\x1E'", ")", "{", "currChar", "=", "dataStr", ".", "charAt"...
Returns the entire directory starting at position 24. Control character '\x1E' marks the end of directory.
[ "Returns", "the", "entire", "directory", "starting", "at", "position", "24", ".", "Control", "character", "\\", "x1E", "marks", "the", "end", "of", "directory", "." ]
cb1f2cb43d90c596c52c350de1e3798ecc2c90b5
https://github.com/NatLibFi/marc-record-serializers/blob/cb1f2cb43d90c596c52c350de1e3798ecc2c90b5/src/iso2709.js#L143-L162
30,618
NatLibFi/marc-record-serializers
src/iso2709.js
parseDirectoryEntries
function parseDirectoryEntries(directoryStr) { const directoryEntries = []; let pos = 0; let count = 0; while (directoryStr.length - pos >= 12) { directoryEntries[count] = directoryStr.substring(pos, pos + 12); pos += 12; count++; } return directoryEntries; }
javascript
function parseDirectoryEntries(directoryStr) { const directoryEntries = []; let pos = 0; let count = 0; while (directoryStr.length - pos >= 12) { directoryEntries[count] = directoryStr.substring(pos, pos + 12); pos += 12; count++; } return directoryEntries; }
[ "function", "parseDirectoryEntries", "(", "directoryStr", ")", "{", "const", "directoryEntries", "=", "[", "]", ";", "let", "pos", "=", "0", ";", "let", "count", "=", "0", ";", "while", "(", "directoryStr", ".", "length", "-", "pos", ">=", "12", ")", "...
Returns an array of 12-character directory entries.
[ "Returns", "an", "array", "of", "12", "-", "character", "directory", "entries", "." ]
cb1f2cb43d90c596c52c350de1e3798ecc2c90b5
https://github.com/NatLibFi/marc-record-serializers/blob/cb1f2cb43d90c596c52c350de1e3798ecc2c90b5/src/iso2709.js#L165-L177
30,619
NatLibFi/marc-record-serializers
src/iso2709.js
trimNumericField
function trimNumericField(input) { while (input.length > 1 && input.charAt(0) === '0') { input = input.substring(1); } return input; }
javascript
function trimNumericField(input) { while (input.length > 1 && input.charAt(0) === '0') { input = input.substring(1); } return input; }
[ "function", "trimNumericField", "(", "input", ")", "{", "while", "(", "input", ".", "length", ">", "1", "&&", "input", ".", "charAt", "(", "0", ")", "===", "'0'", ")", "{", "input", "=", "input", ".", "substring", "(", "1", ")", ";", "}", "return",...
Removes leading zeros from a numeric data field.
[ "Removes", "leading", "zeros", "from", "a", "numeric", "data", "field", "." ]
cb1f2cb43d90c596c52c350de1e3798ecc2c90b5
https://github.com/NatLibFi/marc-record-serializers/blob/cb1f2cb43d90c596c52c350de1e3798ecc2c90b5/src/iso2709.js#L180-L186
30,620
NatLibFi/marc-record-serializers
src/iso2709.js
addLeadingZeros
function addLeadingZeros(numField, length) { while (numField.toString().length < length) { numField = '0' + numField.toString(); } return numField; }
javascript
function addLeadingZeros(numField, length) { while (numField.toString().length < length) { numField = '0' + numField.toString(); } return numField; }
[ "function", "addLeadingZeros", "(", "numField", ",", "length", ")", "{", "while", "(", "numField", ".", "toString", "(", ")", ".", "length", "<", "length", ")", "{", "numField", "=", "'0'", "+", "numField", ".", "toString", "(", ")", ";", "}", "return"...
Adds leading zeros to the specified numeric field.
[ "Adds", "leading", "zeros", "to", "the", "specified", "numeric", "field", "." ]
cb1f2cb43d90c596c52c350de1e3798ecc2c90b5
https://github.com/NatLibFi/marc-record-serializers/blob/cb1f2cb43d90c596c52c350de1e3798ecc2c90b5/src/iso2709.js#L289-L295
30,621
NatLibFi/marc-record-serializers
src/iso2709.js
lengthInUtf8Bytes
function lengthInUtf8Bytes(str) { const m = encodeURIComponent(str).match(/%[89ABab]/g); return str.length + (m ? m.length : 0); }
javascript
function lengthInUtf8Bytes(str) { const m = encodeURIComponent(str).match(/%[89ABab]/g); return str.length + (m ? m.length : 0); }
[ "function", "lengthInUtf8Bytes", "(", "str", ")", "{", "const", "m", "=", "encodeURIComponent", "(", "str", ")", ".", "match", "(", "/", "%[89ABab]", "/", "g", ")", ";", "return", "str", ".", "length", "+", "(", "m", "?", "m", ".", "length", ":", "...
Returns the length of the input string in UTF8 bytes.
[ "Returns", "the", "length", "of", "the", "input", "string", "in", "UTF8", "bytes", "." ]
cb1f2cb43d90c596c52c350de1e3798ecc2c90b5
https://github.com/NatLibFi/marc-record-serializers/blob/cb1f2cb43d90c596c52c350de1e3798ecc2c90b5/src/iso2709.js#L298-L301
30,622
NatLibFi/marc-record-serializers
src/iso2709.js
utf8Substr
function utf8Substr(str, startInBytes, lengthInBytes) { const strBytes = stringToByteArray(str); const subStrBytes = []; let count = 0; for (let i = startInBytes; count < lengthInBytes; i++) { subStrBytes.push(strBytes[i]); count++; } return byteArrayToString(subStrBytes); // Converts the byte array to a ...
javascript
function utf8Substr(str, startInBytes, lengthInBytes) { const strBytes = stringToByteArray(str); const subStrBytes = []; let count = 0; for (let i = startInBytes; count < lengthInBytes; i++) { subStrBytes.push(strBytes[i]); count++; } return byteArrayToString(subStrBytes); // Converts the byte array to a ...
[ "function", "utf8Substr", "(", "str", ",", "startInBytes", ",", "lengthInBytes", ")", "{", "const", "strBytes", "=", "stringToByteArray", "(", "str", ")", ";", "const", "subStrBytes", "=", "[", "]", ";", "let", "count", "=", "0", ";", "for", "(", "let", ...
Returns a UTF-8 substring.
[ "Returns", "a", "UTF", "-", "8", "substring", "." ]
cb1f2cb43d90c596c52c350de1e3798ecc2c90b5
https://github.com/NatLibFi/marc-record-serializers/blob/cb1f2cb43d90c596c52c350de1e3798ecc2c90b5/src/iso2709.js#L305-L328
30,623
IcarusWorks/ember-cli-deploy-bugsnag
index.js
fetchFilePathsByType
function fetchFilePathsByType(distFiles, basePath, type) { return distFiles .filter(function(filePath) { return new RegExp('assets/.*\\.' + type + '$').test(filePath); }) .map(function(filePath) { return path.join(basePath, filePath); }); }
javascript
function fetchFilePathsByType(distFiles, basePath, type) { return distFiles .filter(function(filePath) { return new RegExp('assets/.*\\.' + type + '$').test(filePath); }) .map(function(filePath) { return path.join(basePath, filePath); }); }
[ "function", "fetchFilePathsByType", "(", "distFiles", ",", "basePath", ",", "type", ")", "{", "return", "distFiles", ".", "filter", "(", "function", "(", "filePath", ")", "{", "return", "new", "RegExp", "(", "'assets/.*\\\\.'", "+", "type", "+", "'$'", ")", ...
This function finds all files of a given type inside the `assets` folder of a given build and returns them with a new basePath prepended
[ "This", "function", "finds", "all", "files", "of", "a", "given", "type", "inside", "the", "assets", "folder", "of", "a", "given", "build", "and", "returns", "them", "with", "a", "new", "basePath", "prepended" ]
1153069f19480833808536b7756166b83ff8d275
https://github.com/IcarusWorks/ember-cli-deploy-bugsnag/blob/1153069f19480833808536b7756166b83ff8d275/index.js#L208-L216
30,624
fanout/node-pubcontrol
etc/browser-demo/src/index.js
main
async function main() { const { window } = webContext(); if (window) { await windowReadiness(window); render(window); bootWebWorker(window); } else { console.warn("No web window. Can't run browser-demo."); } }
javascript
async function main() { const { window } = webContext(); if (window) { await windowReadiness(window); render(window); bootWebWorker(window); } else { console.warn("No web window. Can't run browser-demo."); } }
[ "async", "function", "main", "(", ")", "{", "const", "{", "window", "}", "=", "webContext", "(", ")", ";", "if", "(", "window", ")", "{", "await", "windowReadiness", "(", "window", ")", ";", "render", "(", "window", ")", ";", "bootWebWorker", "(", "w...
Main browser-demo. Render a message and boot the web worker.
[ "Main", "browser", "-", "demo", ".", "Render", "a", "message", "and", "boot", "the", "web", "worker", "." ]
e3543553a09e5f62ffedf17bb9b28216c3a987b1
https://github.com/fanout/node-pubcontrol/blob/e3543553a09e5f62ffedf17bb9b28216c3a987b1/etc/browser-demo/src/index.js#L14-L23
30,625
fanout/node-pubcontrol
etc/browser-demo/src/index.js
render
function render({ document }) { console.debug("rendering"); document.querySelectorAll(".replace-with-pubcontrol").forEach(el => { el.innerHTML = ` <div> <h2>pubcontrol default export</h2> <pre>${JSON.stringify(objectSchema(PubControl), null, 2)}</pre> </div> `; }); }
javascript
function render({ document }) { console.debug("rendering"); document.querySelectorAll(".replace-with-pubcontrol").forEach(el => { el.innerHTML = ` <div> <h2>pubcontrol default export</h2> <pre>${JSON.stringify(objectSchema(PubControl), null, 2)}</pre> </div> `; }); }
[ "function", "render", "(", "{", "document", "}", ")", "{", "console", ".", "debug", "(", "\"rendering\"", ")", ";", "document", ".", "querySelectorAll", "(", "\".replace-with-pubcontrol\"", ")", ".", "forEach", "(", "el", "=>", "{", "el", ".", "innerHTML", ...
Render a message showing off pubcontrol. Show it wherever the html has opted into replacement.
[ "Render", "a", "message", "showing", "off", "pubcontrol", ".", "Show", "it", "wherever", "the", "html", "has", "opted", "into", "replacement", "." ]
e3543553a09e5f62ffedf17bb9b28216c3a987b1
https://github.com/fanout/node-pubcontrol/blob/e3543553a09e5f62ffedf17bb9b28216c3a987b1/etc/browser-demo/src/index.js#L29-L39
30,626
fanout/node-pubcontrol
etc/browser-demo/src/index.js
windowReadiness
function windowReadiness({ document }) { if (document.readyState === "loading") { // Loading hasn't finished yet return new Promise((resolve, reject) => document.addEventListener("DOMContentLoaded", resolve) ); } // it's ready }
javascript
function windowReadiness({ document }) { if (document.readyState === "loading") { // Loading hasn't finished yet return new Promise((resolve, reject) => document.addEventListener("DOMContentLoaded", resolve) ); } // it's ready }
[ "function", "windowReadiness", "(", "{", "document", "}", ")", "{", "if", "(", "document", ".", "readyState", "===", "\"loading\"", ")", "{", "// Loading hasn't finished yet", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "document...
Promise of DOM ready event in the provided document
[ "Promise", "of", "DOM", "ready", "event", "in", "the", "provided", "document" ]
e3543553a09e5f62ffedf17bb9b28216c3a987b1
https://github.com/fanout/node-pubcontrol/blob/e3543553a09e5f62ffedf17bb9b28216c3a987b1/etc/browser-demo/src/index.js#L42-L50
30,627
fanout/node-pubcontrol
etc/browser-demo/src/index.js
objectSchema
function objectSchema(obj) { const props = Object.entries(obj).reduce( (reduced, [key, val]) => Object.assign(reduced, { [key]: typeof val }), {} ); return props; }
javascript
function objectSchema(obj) { const props = Object.entries(obj).reduce( (reduced, [key, val]) => Object.assign(reduced, { [key]: typeof val }), {} ); return props; }
[ "function", "objectSchema", "(", "obj", ")", "{", "const", "props", "=", "Object", ".", "entries", "(", "obj", ")", ".", "reduce", "(", "(", "reduced", ",", "[", "key", ",", "val", "]", ")", "=>", "Object", ".", "assign", "(", "reduced", ",", "{", ...
given an object, return some JSON that describes its structure
[ "given", "an", "object", "return", "some", "JSON", "that", "describes", "its", "structure" ]
e3543553a09e5f62ffedf17bb9b28216c3a987b1
https://github.com/fanout/node-pubcontrol/blob/e3543553a09e5f62ffedf17bb9b28216c3a987b1/etc/browser-demo/src/index.js#L53-L59
30,628
fanout/node-pubcontrol
etc/browser-demo/src/index.js
bootWebWorker
function bootWebWorker({ Worker }) { const webWorker = Object.assign( new Worker("pubcontrol-browser-demo.webworker.js"), { onmessage: event => { console.debug("Message received from worker", event.data.type, event); } } ); webWorker.postMessage({ type: "Hello", from: "brow...
javascript
function bootWebWorker({ Worker }) { const webWorker = Object.assign( new Worker("pubcontrol-browser-demo.webworker.js"), { onmessage: event => { console.debug("Message received from worker", event.data.type, event); } } ); webWorker.postMessage({ type: "Hello", from: "brow...
[ "function", "bootWebWorker", "(", "{", "Worker", "}", ")", "{", "const", "webWorker", "=", "Object", ".", "assign", "(", "new", "Worker", "(", "\"pubcontrol-browser-demo.webworker.js\"", ")", ",", "{", "onmessage", ":", "event", "=>", "{", "console", ".", "d...
Create and initialize the browser-demo web worker in a DOM Worker. Send the worker some configuration from this url's query params.
[ "Create", "and", "initialize", "the", "browser", "-", "demo", "web", "worker", "in", "a", "DOM", "Worker", ".", "Send", "the", "worker", "some", "configuration", "from", "this", "url", "s", "query", "params", "." ]
e3543553a09e5f62ffedf17bb9b28216c3a987b1
https://github.com/fanout/node-pubcontrol/blob/e3543553a09e5f62ffedf17bb9b28216c3a987b1/etc/browser-demo/src/index.js#L78-L106
30,629
gjtorikian/panino-docs
lib/panino/plugins/parsers/javascript/jsd/serializer.js
func
function func(ast) { var params = list(ast["params"]) var id = ast["id"] ? to_s(ast["id"]) : "" return "function " + id + "(" + params + ") " + to_s(ast["body"]) }
javascript
function func(ast) { var params = list(ast["params"]) var id = ast["id"] ? to_s(ast["id"]) : "" return "function " + id + "(" + params + ") " + to_s(ast["body"]) }
[ "function", "func", "(", "ast", ")", "{", "var", "params", "=", "list", "(", "ast", "[", "\"params\"", "]", ")", "var", "id", "=", "ast", "[", "\"id\"", "]", "?", "to_s", "(", "ast", "[", "\"id\"", "]", ")", ":", "\"\"", "return", "\"function \"", ...
serializes function declaration or expression
[ "serializes", "function", "declaration", "or", "expression" ]
23ea0355d42875a59f14a065ac3c06d096112ced
https://github.com/gjtorikian/panino-docs/blob/23ea0355d42875a59f14a065ac3c06d096112ced/lib/panino/plugins/parsers/javascript/jsd/serializer.js#L164-L168
30,630
gjtorikian/panino-docs
lib/panino/plugins/parsers/javascript/jsd/serializer.js
parens
function parens(parent, child) { if (precedence(parent) >= precedence(child)) return to_s(child); else return "(" + to_s(child) + ")"; }
javascript
function parens(parent, child) { if (precedence(parent) >= precedence(child)) return to_s(child); else return "(" + to_s(child) + ")"; }
[ "function", "parens", "(", "parent", ",", "child", ")", "{", "if", "(", "precedence", "(", "parent", ")", ">=", "precedence", "(", "child", ")", ")", "return", "to_s", "(", "child", ")", ";", "else", "return", "\"(\"", "+", "to_s", "(", "child", ")",...
serializes child node and wraps it inside parenthesis if the precedence rules compared to parent node would require so.
[ "serializes", "child", "node", "and", "wraps", "it", "inside", "parenthesis", "if", "the", "precedence", "rules", "compared", "to", "parent", "node", "would", "require", "so", "." ]
23ea0355d42875a59f14a065ac3c06d096112ced
https://github.com/gjtorikian/panino-docs/blob/23ea0355d42875a59f14a065ac3c06d096112ced/lib/panino/plugins/parsers/javascript/jsd/serializer.js#L187-L192
30,631
gjtorikian/panino-docs
lib/panino/plugins/parsers/javascript/jsd/serializer.js
precedence
function precedence(ast) { var p = PRECEDENCE[ast["type"]]; if ( _.isNumber(p) ) // represents Fixnum? I'm so sorry. return p; else if ( p && p.constructor === Object ) // p is a {} object return p[ast["operator"]]; else return 0; }
javascript
function precedence(ast) { var p = PRECEDENCE[ast["type"]]; if ( _.isNumber(p) ) // represents Fixnum? I'm so sorry. return p; else if ( p && p.constructor === Object ) // p is a {} object return p[ast["operator"]]; else return 0; }
[ "function", "precedence", "(", "ast", ")", "{", "var", "p", "=", "PRECEDENCE", "[", "ast", "[", "\"type\"", "]", "]", ";", "if", "(", "_", ".", "isNumber", "(", "p", ")", ")", "// represents Fixnum? I'm so sorry.", "return", "p", ";", "else", "if", "("...
Returns the precedence of operator represented by given AST node
[ "Returns", "the", "precedence", "of", "operator", "represented", "by", "given", "AST", "node" ]
23ea0355d42875a59f14a065ac3c06d096112ced
https://github.com/gjtorikian/panino-docs/blob/23ea0355d42875a59f14a065ac3c06d096112ced/lib/panino/plugins/parsers/javascript/jsd/serializer.js#L195-L203
30,632
kaelzhang/neuron.js
lib/module.js
generate_exports
function generate_exports (module) { // # 85 // Before module factory being invoked, mark the module as `loaded` // so we will not execute the factory function again. // `mod.loaded` indicates that a module has already been `require()`d // When there are cyclic dependencies, neuron will not fail. module.lo...
javascript
function generate_exports (module) { // # 85 // Before module factory being invoked, mark the module as `loaded` // so we will not execute the factory function again. // `mod.loaded` indicates that a module has already been `require()`d // When there are cyclic dependencies, neuron will not fail. module.lo...
[ "function", "generate_exports", "(", "module", ")", "{", "// # 85", "// Before module factory being invoked, mark the module as `loaded`", "// so we will not execute the factory function again.", "// `mod.loaded` indicates that a module has already been `require()`d", "// When there are cyclic d...
Generate the exports of the module
[ "Generate", "the", "exports", "of", "the", "module" ]
3e1eed28f08ab14f289f476f886ac7f095036e66
https://github.com/kaelzhang/neuron.js/blob/3e1eed28f08ab14f289f476f886ac7f095036e66/lib/module.js#L135-L164
30,633
kaelzhang/neuron.js
lib/module.js
get_mod
function get_mod (parsed) { var id = parsed.id; // id -> '@kael/a@1.1.0/b' return mods[id] || (mods[id] = { // package scope: s: parsed.s, // package name: 'a' n: parsed.n, // package version: '1.1.0' v: parsed.v, // module path: '/b' p: parsed.p, // module id: 'a@1.1.0/b' ...
javascript
function get_mod (parsed) { var id = parsed.id; // id -> '@kael/a@1.1.0/b' return mods[id] || (mods[id] = { // package scope: s: parsed.s, // package name: 'a' n: parsed.n, // package version: '1.1.0' v: parsed.v, // module path: '/b' p: parsed.p, // module id: 'a@1.1.0/b' ...
[ "function", "get_mod", "(", "parsed", ")", "{", "var", "id", "=", "parsed", ".", "id", ";", "// id -> '@kael/a@1.1.0/b'", "return", "mods", "[", "id", "]", "||", "(", "mods", "[", "id", "]", "=", "{", "// package scope:", "s", ":", "parsed", ".", "s", ...
Create a mod
[ "Create", "a", "mod" ]
3e1eed28f08ab14f289f476f886ac7f095036e66
https://github.com/kaelzhang/neuron.js/blob/3e1eed28f08ab14f289f476f886ac7f095036e66/lib/module.js#L207-L236
30,634
kaelzhang/neuron.js
lib/module.js
create_require
function create_require (env) { function require (id) { // `require('a@0.0.0')` is prohibited. prohibit_require_id_with_version(id); // When `require()` another module inside the factory, // the module of depdendencies must already been created var module = get_module(id, env, true); return g...
javascript
function create_require (env) { function require (id) { // `require('a@0.0.0')` is prohibited. prohibit_require_id_with_version(id); // When `require()` another module inside the factory, // the module of depdendencies must already been created var module = get_module(id, env, true); return g...
[ "function", "create_require", "(", "env", ")", "{", "function", "require", "(", "id", ")", "{", "// `require('a@0.0.0')` is prohibited.", "prohibit_require_id_with_version", "(", "id", ")", ";", "// When `require()` another module inside the factory,", "// the module of depdend...
use the sandbox to specify the environment for every id that required in the current module @param {Object} env The object of the current module. @return {function}
[ "use", "the", "sandbox", "to", "specify", "the", "environment", "for", "every", "id", "that", "required", "in", "the", "current", "module" ]
3e1eed28f08ab14f289f476f886ac7f095036e66
https://github.com/kaelzhang/neuron.js/blob/3e1eed28f08ab14f289f476f886ac7f095036e66/lib/module.js#L261-L301
30,635
observing/devnull
index.js
type
function type (prop) { var rs = Object.prototype.toString.call(prop); return rs.slice(8, rs.length - 1).toLowerCase(); }
javascript
function type (prop) { var rs = Object.prototype.toString.call(prop); return rs.slice(8, rs.length - 1).toLowerCase(); }
[ "function", "type", "(", "prop", ")", "{", "var", "rs", "=", "Object", ".", "prototype", ".", "toString", ".", "call", "(", "prop", ")", ";", "return", "rs", ".", "slice", "(", "8", ",", "rs", ".", "length", "-", "1", ")", ".", "toLowerCase", "("...
Strict type checking. @param {Mixed} prop @returns {String} @api private
[ "Strict", "type", "checking", "." ]
ff99281602feca0cf3bdf0e6d36fedbf1b566523
https://github.com/observing/devnull/blob/ff99281602feca0cf3bdf0e6d36fedbf1b566523/index.js#L21-L24
30,636
attester/attester
lib/util/child-processes.js
function () { if (processes && processes.length > 0) { for (var i = processes.length - 1; i >= 0; i--) { processes[i].kill(); } } }
javascript
function () { if (processes && processes.length > 0) { for (var i = processes.length - 1; i >= 0; i--) { processes[i].kill(); } } }
[ "function", "(", ")", "{", "if", "(", "processes", "&&", "processes", ".", "length", ">", "0", ")", "{", "for", "(", "var", "i", "=", "processes", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "processes", "[", "i", ...
Q defer resolving when all processes are closed
[ "Q", "defer", "resolving", "when", "all", "processes", "are", "closed" ]
4ed16ca2e8c1af577b47b6bcfc9575589fc87f83
https://github.com/attester/attester/blob/4ed16ca2e8c1af577b47b6bcfc9575589fc87f83/lib/util/child-processes.js#L21-L27
30,637
deskpro/apps-dpat
src/main/javascript/Installer/buildStrategies.js
defaultStrategy
function defaultStrategy(projectDir, builder, cb) { const pkg = fs.realpathSync(INSTALLER_PACKAGE); builder.buildFromPackage(pkg, projectDir, cb); }
javascript
function defaultStrategy(projectDir, builder, cb) { const pkg = fs.realpathSync(INSTALLER_PACKAGE); builder.buildFromPackage(pkg, projectDir, cb); }
[ "function", "defaultStrategy", "(", "projectDir", ",", "builder", ",", "cb", ")", "{", "const", "pkg", "=", "fs", ".", "realpathSync", "(", "INSTALLER_PACKAGE", ")", ";", "builder", ".", "buildFromPackage", "(", "pkg", ",", "projectDir", ",", "cb", ")", ";...
Builds the installer from a tgz package that comes with dpat. This is the default cause when the app does not have its own installer @param {String} projectDir @param {InstallerBuilder} builder @param {Function} cb
[ "Builds", "the", "installer", "from", "a", "tgz", "package", "that", "comes", "with", "dpat", ".", "This", "is", "the", "default", "cause", "when", "the", "app", "does", "not", "have", "its", "own", "installer" ]
18801791ed5873d511adaa1d91a65ae8cdad2281
https://github.com/deskpro/apps-dpat/blob/18801791ed5873d511adaa1d91a65ae8cdad2281/src/main/javascript/Installer/buildStrategies.js#L17-L21
30,638
deskpro/apps-dpat
src/main/javascript/Installer/buildStrategies.js
customStrategyInPlace
function customStrategyInPlace(projectDir, builder, cb) { const installerDir = path.resolve(projectDir, "node_modules", "@deskpro", INSTALLER_PACKAGE_NAME); const customInstallerTarget = path.resolve(installerDir, "src", "settings"); shelljs.rm('-rf', customInstallerTarget); const copyOptions = { overwrite: tr...
javascript
function customStrategyInPlace(projectDir, builder, cb) { const installerDir = path.resolve(projectDir, "node_modules", "@deskpro", INSTALLER_PACKAGE_NAME); const customInstallerTarget = path.resolve(installerDir, "src", "settings"); shelljs.rm('-rf', customInstallerTarget); const copyOptions = { overwrite: tr...
[ "function", "customStrategyInPlace", "(", "projectDir", ",", "builder", ",", "cb", ")", "{", "const", "installerDir", "=", "path", ".", "resolve", "(", "projectDir", ",", "\"node_modules\"", ",", "\"@deskpro\"", ",", "INSTALLER_PACKAGE_NAME", ")", ";", "const", ...
Builds the installer in its own dist folder, useful in dev mode because it does not copy all 4k packages @param {String} projectDir @param {InstallerBuilder} builder @param {Function} cb
[ "Builds", "the", "installer", "in", "its", "own", "dist", "folder", "useful", "in", "dev", "mode", "because", "it", "does", "not", "copy", "all", "4k", "packages" ]
18801791ed5873d511adaa1d91a65ae8cdad2281
https://github.com/deskpro/apps-dpat/blob/18801791ed5873d511adaa1d91a65ae8cdad2281/src/main/javascript/Installer/buildStrategies.js#L30-L47
30,639
deskpro/apps-dpat
src/main/javascript/Installer/buildStrategies.js
customStrategy
function customStrategy(projectDir, builder, cb) { const dest = builder.getTargetDestination(projectDir); shelljs.rm('-rf', dest); const copyOptions = { overwrite: true, expand: true, dot: true }; const onCustomInstallerFilesReady = function (err) { builder.buildFromSource(dest, projectDir); cb(); }...
javascript
function customStrategy(projectDir, builder, cb) { const dest = builder.getTargetDestination(projectDir); shelljs.rm('-rf', dest); const copyOptions = { overwrite: true, expand: true, dot: true }; const onCustomInstallerFilesReady = function (err) { builder.buildFromSource(dest, projectDir); cb(); }...
[ "function", "customStrategy", "(", "projectDir", ",", "builder", ",", "cb", ")", "{", "const", "dest", "=", "builder", ".", "getTargetDestination", "(", "projectDir", ")", ";", "shelljs", ".", "rm", "(", "'-rf'", ",", "dest", ")", ";", "const", "copyOption...
Builds the installer under the app's own target folder @param {String} projectDir @param {InstallerBuilder} builder @param {Function} cb
[ "Builds", "the", "installer", "under", "the", "app", "s", "own", "target", "folder" ]
18801791ed5873d511adaa1d91a65ae8cdad2281
https://github.com/deskpro/apps-dpat/blob/18801791ed5873d511adaa1d91a65ae8cdad2281/src/main/javascript/Installer/buildStrategies.js#L57-L85
30,640
deskpro/apps-dpat
src/main/javascript/Build/BuildUtils.js
function (projectDir) { "use strict"; const packageJson = readPackageJson(projectDir); const extracted = extractVendors(packageJson); return extracted.filter(function (packageName) { return startsWith(packageName, '@deskpro/'); }); }
javascript
function (projectDir) { "use strict"; const packageJson = readPackageJson(projectDir); const extracted = extractVendors(packageJson); return extracted.filter(function (packageName) { return startsWith(packageName, '@deskpro/'); }); }
[ "function", "(", "projectDir", ")", "{", "\"use strict\"", ";", "const", "packageJson", "=", "readPackageJson", "(", "projectDir", ")", ";", "const", "extracted", "=", "extractVendors", "(", "packageJson", ")", ";", "return", "extracted", ".", "filter", "(", "...
Scans the package.json manifest for deskpro packages and returns their names @param projectDir @return {Array<String>}
[ "Scans", "the", "package", ".", "json", "manifest", "for", "deskpro", "packages", "and", "returns", "their", "names" ]
18801791ed5873d511adaa1d91a65ae8cdad2281
https://github.com/deskpro/apps-dpat/blob/18801791ed5873d511adaa1d91a65ae8cdad2281/src/main/javascript/Build/BuildUtils.js#L87-L94
30,641
canjs/can-kefir
can-kefir.js
getCurrentValue
function getCurrentValue(stream, key) { if (stream._currentEvent && stream._currentEvent.type === key) { return stream._currentEvent.value; } else { var names = keyNames[key]; if (!names) { return stream[key]; } var VALUE, valueHandler = function(value) { VALUE = value; }; stream[names.on](va...
javascript
function getCurrentValue(stream, key) { if (stream._currentEvent && stream._currentEvent.type === key) { return stream._currentEvent.value; } else { var names = keyNames[key]; if (!names) { return stream[key]; } var VALUE, valueHandler = function(value) { VALUE = value; }; stream[names.on](va...
[ "function", "getCurrentValue", "(", "stream", ",", "key", ")", "{", "if", "(", "stream", ".", "_currentEvent", "&&", "stream", ".", "_currentEvent", ".", "type", "===", "key", ")", "{", "return", "stream", ".", "_currentEvent", ".", "value", ";", "}", "e...
get the current value from a stream
[ "get", "the", "current", "value", "from", "a", "stream" ]
918dd1c0bc2ad9255bdf456c384392c55a80086e
https://github.com/canjs/can-kefir/blob/918dd1c0bc2ad9255bdf456c384392c55a80086e/can-kefir.js#L39-L55
30,642
attester/attester
lib/util/browser-detection.js
function (version) { var splitDots = version.split("."); var nbDots = splitDots.length - 1; if (nbDots === 0) { return version + ".0.0"; } else if (nbDots === 1) { return version + ".0"; } else if (nbDots === 2) { return version; } else { return splitDots.slice(0,...
javascript
function (version) { var splitDots = version.split("."); var nbDots = splitDots.length - 1; if (nbDots === 0) { return version + ".0.0"; } else if (nbDots === 1) { return version + ".0"; } else if (nbDots === 2) { return version; } else { return splitDots.slice(0,...
[ "function", "(", "version", ")", "{", "var", "splitDots", "=", "version", ".", "split", "(", "\".\"", ")", ";", "var", "nbDots", "=", "splitDots", ".", "length", "-", "1", ";", "if", "(", "nbDots", "===", "0", ")", "{", "return", "version", "+", "\...
semver-compliant version must be x.y.z
[ "semver", "-", "compliant", "version", "must", "be", "x", ".", "y", ".", "z" ]
4ed16ca2e8c1af577b47b6bcfc9575589fc87f83
https://github.com/attester/attester/blob/4ed16ca2e8c1af577b47b6bcfc9575589fc87f83/lib/util/browser-detection.js#L20-L32
30,643
attester/attester
lib/launchers/browser-launcher.js
onLauncherConnect
function onLauncherConnect(slaveURL) { var browsers = attester.config["run-browser"]; if (browsers) { if (!Array.isArray(browsers)) { browsers = [browsers]; } var args = [slaveURL]; for (var i = 0, l = browsers.length; i < l; i++) { var curProcess = spawn(...
javascript
function onLauncherConnect(slaveURL) { var browsers = attester.config["run-browser"]; if (browsers) { if (!Array.isArray(browsers)) { browsers = [browsers]; } var args = [slaveURL]; for (var i = 0, l = browsers.length; i < l; i++) { var curProcess = spawn(...
[ "function", "onLauncherConnect", "(", "slaveURL", ")", "{", "var", "browsers", "=", "attester", ".", "config", "[", "\"run-browser\"", "]", ";", "if", "(", "browsers", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "browsers", ")", ")", "{", "...
Generic launcher for browsers specified on the command line. It spawns a child process for each path in the configuration
[ "Generic", "launcher", "for", "browsers", "specified", "on", "the", "command", "line", ".", "It", "spawns", "a", "child", "process", "for", "each", "path", "in", "the", "configuration" ]
4ed16ca2e8c1af577b47b6bcfc9575589fc87f83
https://github.com/attester/attester/blob/4ed16ca2e8c1af577b47b6bcfc9575589fc87f83/lib/launchers/browser-launcher.js#L24-L39
30,644
deskpro/apps-dpat
src/main/javascript/Build/Babel.js
function (options, overrides) { let resolved = null; if (typeof options === 'string') { //we've been give a path to a project dir or babelrc let babelrcPath; const stats = fs.statSync(options); if (stats.isDirectory()) { babelrcPath = path.join(options, '.babelrc'); } else if (s...
javascript
function (options, overrides) { let resolved = null; if (typeof options === 'string') { //we've been give a path to a project dir or babelrc let babelrcPath; const stats = fs.statSync(options); if (stats.isDirectory()) { babelrcPath = path.join(options, '.babelrc'); } else if (s...
[ "function", "(", "options", ",", "overrides", ")", "{", "let", "resolved", "=", "null", ";", "if", "(", "typeof", "options", "===", "'string'", ")", "{", "//we've been give a path to a project dir or babelrc", "let", "babelrcPath", ";", "const", "stats", "=", "f...
Replaces plugin and presets short names with absolute paths @param {{}|String} options @param {{}} overrides @return {*}
[ "Replaces", "plugin", "and", "presets", "short", "names", "with", "absolute", "paths" ]
18801791ed5873d511adaa1d91a65ae8cdad2281
https://github.com/deskpro/apps-dpat/blob/18801791ed5873d511adaa1d91a65ae8cdad2281/src/main/javascript/Build/Babel.js#L40-L73
30,645
attester/attester
lib/launchers/phantom-launcher.js
function (cfg, state, n) { cfg.args = cfg.args || {}; var phantomPath = cfg.phantomPath; var controlScript = pathUtil.join(__dirname, '../browsers/phantomjs-control-script.js'); var args = []; args.push(controlScript); args.push("--auto-exit"); if (cfg.args.autoE...
javascript
function (cfg, state, n) { cfg.args = cfg.args || {}; var phantomPath = cfg.phantomPath; var controlScript = pathUtil.join(__dirname, '../browsers/phantomjs-control-script.js'); var args = []; args.push(controlScript); args.push("--auto-exit"); if (cfg.args.autoE...
[ "function", "(", "cfg", ",", "state", ",", "n", ")", "{", "cfg", ".", "args", "=", "cfg", ".", "args", "||", "{", "}", ";", "var", "phantomPath", "=", "cfg", ".", "phantomPath", ";", "var", "controlScript", "=", "pathUtil", ".", "join", "(", "__dir...
Starts PhantomJS child process with instance number `n` using `cfg.path` as PhantomJS path and connects it to `cfg.slaveURL` @param {Object} cfg @param {Object} state @param {Integer} n
[ "Starts", "PhantomJS", "child", "process", "with", "instance", "number", "n", "using", "cfg", ".", "path", "as", "PhantomJS", "path", "and", "connects", "it", "to", "cfg", ".", "slaveURL" ]
4ed16ca2e8c1af577b47b6bcfc9575589fc87f83
https://github.com/attester/attester/blob/4ed16ca2e8c1af577b47b6bcfc9575589fc87f83/lib/launchers/phantom-launcher.js#L68-L98
30,646
attester/attester
lib/launchers/phantom-launcher.js
function (cfg, state, n) { // Node 0.8 and 0.10 differently handle spawning errors ('exit' vs 'error'), but errors that happened after // launching the command are both handled in 'exit' callback return function (code, signal) { // See http://tldp.org/LDP/abs/html/exitcodes.html and ...
javascript
function (cfg, state, n) { // Node 0.8 and 0.10 differently handle spawning errors ('exit' vs 'error'), but errors that happened after // launching the command are both handled in 'exit' callback return function (code, signal) { // See http://tldp.org/LDP/abs/html/exitcodes.html and ...
[ "function", "(", "cfg", ",", "state", ",", "n", ")", "{", "// Node 0.8 and 0.10 differently handle spawning errors ('exit' vs 'error'), but errors that happened after", "// launching the command are both handled in 'exit' callback", "return", "function", "(", "code", ",", "signal", ...
Factory of callback functions to be used as 'exit' listener by PhantomJS processes. @param {Object} cfg @param {Object} state @param {Integer} n @return {Function}
[ "Factory", "of", "callback", "functions", "to", "be", "used", "as", "exit", "listener", "by", "PhantomJS", "processes", "." ]
4ed16ca2e8c1af577b47b6bcfc9575589fc87f83
https://github.com/attester/attester/blob/4ed16ca2e8c1af577b47b6bcfc9575589fc87f83/lib/launchers/phantom-launcher.js#L107-L156
30,647
attester/attester
lib/launchers/phantom-launcher.js
function (cfg, state, n) { return function (err) { if (err.code == "ENOENT") { logger.logError("Spawn: exited with code ENOENT. PhantomJS executable not found. Make sure to download PhantomJS and add its folder to your system's PATH, or pass the full path directly to Attester via --p...
javascript
function (cfg, state, n) { return function (err) { if (err.code == "ENOENT") { logger.logError("Spawn: exited with code ENOENT. PhantomJS executable not found. Make sure to download PhantomJS and add its folder to your system's PATH, or pass the full path directly to Attester via --p...
[ "function", "(", "cfg", ",", "state", ",", "n", ")", "{", "return", "function", "(", "err", ")", "{", "if", "(", "err", ".", "code", "==", "\"ENOENT\"", ")", "{", "logger", ".", "logError", "(", "\"Spawn: exited with code ENOENT. PhantomJS executable not found...
Factory of callback functions to be used as 'error' listener by PhantomJS processes. @param {Object} cfg @param {Object} state @param {Integer} n @return {Function}
[ "Factory", "of", "callback", "functions", "to", "be", "used", "as", "error", "listener", "by", "PhantomJS", "processes", "." ]
4ed16ca2e8c1af577b47b6bcfc9575589fc87f83
https://github.com/attester/attester/blob/4ed16ca2e8c1af577b47b6bcfc9575589fc87f83/lib/launchers/phantom-launcher.js#L165-L173
30,648
attester/attester
spec/server/middleware.spec.js
function () { this.addResult = function (event) { var fullUrl = event.homeURL + url; http.get(fullUrl, function (response) { var content = ""; response.on("data", function (chunk) { content += chunk; }); ...
javascript
function () { this.addResult = function (event) { var fullUrl = event.homeURL + url; http.get(fullUrl, function (response) { var content = ""; response.on("data", function (chunk) { content += chunk; }); ...
[ "function", "(", ")", "{", "this", ".", "addResult", "=", "function", "(", "event", ")", "{", "var", "fullUrl", "=", "event", ".", "homeURL", "+", "url", ";", "http", ".", "get", "(", "fullUrl", ",", "function", "(", "response", ")", "{", "var", "c...
Add a fake campaign to get the slave URL
[ "Add", "a", "fake", "campaign", "to", "get", "the", "slave", "URL" ]
4ed16ca2e8c1af577b47b6bcfc9575589fc87f83
https://github.com/attester/attester/blob/4ed16ca2e8c1af577b47b6bcfc9575589fc87f83/spec/server/middleware.spec.js#L73-L90
30,649
deskpro/apps-dpat
src/main/javascript/webpack/resolvers.js
resolvePath
function resolvePath (moduleName, relativePath) { if (! moduleName) { return null; } if (! relativePath) { return null; } const mainPath = require.resolve(moduleName); if (! mainPath) { return null; } const rootLocations = []; const dirs = mainPath.split(path.sep); let lastSegment = d...
javascript
function resolvePath (moduleName, relativePath) { if (! moduleName) { return null; } if (! relativePath) { return null; } const mainPath = require.resolve(moduleName); if (! mainPath) { return null; } const rootLocations = []; const dirs = mainPath.split(path.sep); let lastSegment = d...
[ "function", "resolvePath", "(", "moduleName", ",", "relativePath", ")", "{", "if", "(", "!", "moduleName", ")", "{", "return", "null", ";", "}", "if", "(", "!", "relativePath", ")", "{", "return", "null", ";", "}", "const", "mainPath", "=", "require", ...
Resolves a relative path in the context of a module into an absolute path @param {string} moduleName @param {string} relativePath the relative path inside the module @returns {string|null}
[ "Resolves", "a", "relative", "path", "in", "the", "context", "of", "a", "module", "into", "an", "absolute", "path" ]
18801791ed5873d511adaa1d91a65ae8cdad2281
https://github.com/deskpro/apps-dpat/blob/18801791ed5873d511adaa1d91a65ae8cdad2281/src/main/javascript/webpack/resolvers.js#L11-L45
30,650
bigeasy/arguable
arguable.js
Arguable
function Arguable (usage, argv, options) { this._usage = usage // These are the merged defintion and invocation options provided by the // user. this.options = options.options // The key used to create the `Destructible`. this.identifier = options.identifier // We'll use this for an exit ...
javascript
function Arguable (usage, argv, options) { this._usage = usage // These are the merged defintion and invocation options provided by the // user. this.options = options.options // The key used to create the `Destructible`. this.identifier = options.identifier // We'll use this for an exit ...
[ "function", "Arguable", "(", "usage", ",", "argv", ",", "options", ")", "{", "this", ".", "_usage", "=", "usage", "// These are the merged defintion and invocation options provided by the", "// user.", "this", ".", "options", "=", "options", ".", "options", "// The ke...
This will never be pretty. Let it be ugly. Let it swallow all the sins before they enter your program, so that your program can be a garden of pure ideology.
[ "This", "will", "never", "be", "pretty", ".", "Let", "it", "be", "ugly", ".", "Let", "it", "swallow", "all", "the", "sins", "before", "they", "enter", "your", "program", "so", "that", "your", "program", "can", "be", "a", "garden", "of", "pure", "ideolo...
368e86513f03d3eac2a401377dcc033a94e721d4
https://github.com/bigeasy/arguable/blob/368e86513f03d3eac2a401377dcc033a94e721d4/arguable.js#L17-L77
30,651
attester/attester
lib/util/page-generator.js
normalizePage
function normalizePage(content) { var data = { "head-start": [], "head": [], "head-end": [], body: [] }; if (typeof content === "string") { data.body.push(content); } else { ["head-start", "head", "head-end", "body"].forEach(function (section) { ...
javascript
function normalizePage(content) { var data = { "head-start": [], "head": [], "head-end": [], body: [] }; if (typeof content === "string") { data.body.push(content); } else { ["head-start", "head", "head-end", "body"].forEach(function (section) { ...
[ "function", "normalizePage", "(", "content", ")", "{", "var", "data", "=", "{", "\"head-start\"", ":", "[", "]", ",", "\"head\"", ":", "[", "]", ",", "\"head-end\"", ":", "[", "]", ",", "body", ":", "[", "]", "}", ";", "if", "(", "typeof", "content...
Given any acceptable page description, generate an object with head and body as arrays. Normalized pages can be merged easily
[ "Given", "any", "acceptable", "page", "description", "generate", "an", "object", "with", "head", "and", "body", "as", "arrays", ".", "Normalized", "pages", "can", "be", "merged", "easily" ]
4ed16ca2e8c1af577b47b6bcfc9575589fc87f83
https://github.com/attester/attester/blob/4ed16ca2e8c1af577b47b6bcfc9575589fc87f83/lib/util/page-generator.js#L167-L193
30,652
attester/attester
lib/util/page-generator.js
flattenHead
function flattenHead(obj) { var newHead = []; _arrayCopy(newHead, obj["head-start"]); _arrayCopy(newHead, obj["head"]); _arrayCopy(newHead, obj["head-end"]); delete obj["head-start"]; delete obj["head-end"]; obj.head = newHead; return obj; }
javascript
function flattenHead(obj) { var newHead = []; _arrayCopy(newHead, obj["head-start"]); _arrayCopy(newHead, obj["head"]); _arrayCopy(newHead, obj["head-end"]); delete obj["head-start"]; delete obj["head-end"]; obj.head = newHead; return obj; }
[ "function", "flattenHead", "(", "obj", ")", "{", "var", "newHead", "=", "[", "]", ";", "_arrayCopy", "(", "newHead", ",", "obj", "[", "\"head-start\"", "]", ")", ";", "_arrayCopy", "(", "newHead", ",", "obj", "[", "\"head\"", "]", ")", ";", "_arrayCopy...
Merges `head-start`, `head`, and `head-end` subnodes of the input object into a one `head` subnode and removes the other two subnodes. @param {Object} obj Object to be manipulated @return {Object} the input param object with its `head` node flattened
[ "Merges", "head", "-", "start", "head", "and", "head", "-", "end", "subnodes", "of", "the", "input", "object", "into", "a", "one", "head", "subnode", "and", "removes", "the", "other", "two", "subnodes", "." ]
4ed16ca2e8c1af577b47b6bcfc9575589fc87f83
https://github.com/attester/attester/blob/4ed16ca2e8c1af577b47b6bcfc9575589fc87f83/lib/util/page-generator.js#L202-L214
30,653
attester/attester
lib/util/page-generator.js
_arrayCopy
function _arrayCopy(dest, src) { if (Array.isArray(src)) { src.forEach(function (item) { dest.push(item); }); } }
javascript
function _arrayCopy(dest, src) { if (Array.isArray(src)) { src.forEach(function (item) { dest.push(item); }); } }
[ "function", "_arrayCopy", "(", "dest", ",", "src", ")", "{", "if", "(", "Array", ".", "isArray", "(", "src", ")", ")", "{", "src", ".", "forEach", "(", "function", "(", "item", ")", "{", "dest", ".", "push", "(", "item", ")", ";", "}", ")", ";"...
Push all elements from one array to another, in-place. @param {Array} dest @param {Array} src
[ "Push", "all", "elements", "from", "one", "array", "to", "another", "in", "-", "place", "." ]
4ed16ca2e8c1af577b47b6bcfc9575589fc87f83
https://github.com/attester/attester/blob/4ed16ca2e8c1af577b47b6bcfc9575589fc87f83/lib/util/page-generator.js#L222-L228
30,654
CodeTanzania/majifix-service-group
docs/vendor/path-to-regexp/index.js
replacePath
function replacePath (path, keys) { var index = 0; function replace (_, escaped, prefix, key, capture, group, suffix, escape) { if (escaped) { return escaped; } if (escape) { return '\\' + escape; } var repeat = suffix === '+' || suffix === '*'; var optional = suffix === '?'...
javascript
function replacePath (path, keys) { var index = 0; function replace (_, escaped, prefix, key, capture, group, suffix, escape) { if (escaped) { return escaped; } if (escape) { return '\\' + escape; } var repeat = suffix === '+' || suffix === '*'; var optional = suffix === '?'...
[ "function", "replacePath", "(", "path", ",", "keys", ")", "{", "var", "index", "=", "0", ";", "function", "replace", "(", "_", ",", "escaped", ",", "prefix", ",", "key", ",", "capture", ",", "group", ",", "suffix", ",", "escape", ")", "{", "if", "(...
Replace the specific tags with regexp strings. @param {String} path @param {Array} keys @return {String}
[ "Replace", "the", "specific", "tags", "with", "regexp", "strings", "." ]
bce41249dd31e57cf19fd9df5cbd2c3e141b0cf8
https://github.com/CodeTanzania/majifix-service-group/blob/bce41249dd31e57cf19fd9df5cbd2c3e141b0cf8/docs/vendor/path-to-regexp/index.js#L112-L150
30,655
benne/gulp-mongodb-data
index.js
function (cb) { if (opts.dropCollection) { db.listCollections({name: collectionName}) .toArray(function (err, items) { if (err) return cb(err) if (items.length) return coll.drop(cb) cb() }) } else cb() }
javascript
function (cb) { if (opts.dropCollection) { db.listCollections({name: collectionName}) .toArray(function (err, items) { if (err) return cb(err) if (items.length) return coll.drop(cb) cb() }) } else cb() }
[ "function", "(", "cb", ")", "{", "if", "(", "opts", ".", "dropCollection", ")", "{", "db", ".", "listCollections", "(", "{", "name", ":", "collectionName", "}", ")", ".", "toArray", "(", "function", "(", "err", ",", "items", ")", "{", "if", "(", "e...
Drop collection if option is set and collection exists
[ "Drop", "collection", "if", "option", "is", "set", "and", "collection", "exists" ]
05a0be34b84ab8879590e44a6a8b9d012572a30e
https://github.com/benne/gulp-mongodb-data/blob/05a0be34b84ab8879590e44a6a8b9d012572a30e/index.js#L100-L109
30,656
jwerle/shamirs-secret-sharing
split.js
split
function split(secret, opts) { if (!secret || (secret && 0 === secret.length)) { throw new TypeError('Secret cannot be empty.') } if ('string' === typeof secret) { secret = Buffer.from(secret) } if (false === Buffer.isBuffer(secret)) { throw new TypeError('Expecting secret to be a buffer.') } ...
javascript
function split(secret, opts) { if (!secret || (secret && 0 === secret.length)) { throw new TypeError('Secret cannot be empty.') } if ('string' === typeof secret) { secret = Buffer.from(secret) } if (false === Buffer.isBuffer(secret)) { throw new TypeError('Expecting secret to be a buffer.') } ...
[ "function", "split", "(", "secret", ",", "opts", ")", "{", "if", "(", "!", "secret", "||", "(", "secret", "&&", "0", "===", "secret", ".", "length", ")", ")", "{", "throw", "new", "TypeError", "(", "'Secret cannot be empty.'", ")", "}", "if", "(", "'...
Split a secret into a set of distinct shares with a configured threshold of shares needed for construction. @public @param {String|Buffer} secret @param {Object} opts @param {Object} opts.shares @param {Object} opts.threshold @param {?(Function)} opts.random @returns {Array<Buffer>} @throws TypeError @throws RangeError
[ "Split", "a", "secret", "into", "a", "set", "of", "distinct", "shares", "with", "a", "configured", "threshold", "of", "shares", "needed", "for", "construction", "." ]
1d7f2166854462c711c2f074f560e19ce8cf507c
https://github.com/jwerle/shamirs-secret-sharing/blob/1d7f2166854462c711c2f074f560e19ce8cf507c/split.js#L31-L99
30,657
jwerle/shamirs-secret-sharing
combine.js
combine
function combine(shares) { const chunks = [] const x = [] const y = [] const t = shares.length for (let i = 0; i < t; ++i) { const share = parse(shares[i]) if (-1 === x.indexOf(share.id)) { x.push(share.id) const bin = codec.bin(share.data, 16) const parts = codec.split(bin, 0, 2)...
javascript
function combine(shares) { const chunks = [] const x = [] const y = [] const t = shares.length for (let i = 0; i < t; ++i) { const share = parse(shares[i]) if (-1 === x.indexOf(share.id)) { x.push(share.id) const bin = codec.bin(share.data, 16) const parts = codec.split(bin, 0, 2)...
[ "function", "combine", "(", "shares", ")", "{", "const", "chunks", "=", "[", "]", "const", "x", "=", "[", "]", "const", "y", "=", "[", "]", "const", "t", "=", "shares", ".", "length", "for", "(", "let", "i", "=", "0", ";", "i", "<", "t", ";",...
Reconstruct a secret from a distinct set of shares. @public @param {Array<String|Buffer>} shares @return {Buffer}
[ "Reconstruct", "a", "secret", "from", "a", "distinct", "set", "of", "shares", "." ]
1d7f2166854462c711c2f074f560e19ce8cf507c
https://github.com/jwerle/shamirs-secret-sharing/blob/1d7f2166854462c711c2f074f560e19ce8cf507c/combine.js#L12-L45
30,658
Redsmin/proxy
lib/Endpoint.js
function(sourceWasAnError, shouldNotReconnect) { log.error("[Endpoint] Connection closed " + (sourceWasAnError ? 'because of an error:' + sourceWasAnError : '')); this.connected = false; this.handshaken = false; this.connecting = false; if (!shouldNotReconnect) { log.debug('onClo...
javascript
function(sourceWasAnError, shouldNotReconnect) { log.error("[Endpoint] Connection closed " + (sourceWasAnError ? 'because of an error:' + sourceWasAnError : '')); this.connected = false; this.handshaken = false; this.connecting = false; if (!shouldNotReconnect) { log.debug('onClo...
[ "function", "(", "sourceWasAnError", ",", "shouldNotReconnect", ")", "{", "log", ".", "error", "(", "\"[Endpoint] Connection closed \"", "+", "(", "sourceWasAnError", "?", "'because of an error:'", "+", "sourceWasAnError", ":", "''", ")", ")", ";", "this", ".", "c...
If the connection to redsmin just closed, try to reconnect @param {Error} err @param {Boolean} true if after the on close the Endpoint should not reconnect
[ "If", "the", "connection", "to", "redsmin", "just", "closed", "try", "to", "reconnect" ]
5f652d5382f0a38921679027e82053676d5fd89e
https://github.com/Redsmin/proxy/blob/5f652d5382f0a38921679027e82053676d5fd89e/lib/Endpoint.js#L238-L256
30,659
Redsmin/proxy
lib/RedisClient.js
function (err) { log.error("Redis client closed " + (err ? err.message : '')); this.connected = false; this.emit('close', err); this.backoff.reset(); this.backoff.backoff(); }
javascript
function (err) { log.error("Redis client closed " + (err ? err.message : '')); this.connected = false; this.emit('close', err); this.backoff.reset(); this.backoff.backoff(); }
[ "function", "(", "err", ")", "{", "log", ".", "error", "(", "\"Redis client closed \"", "+", "(", "err", "?", "err", ".", "message", ":", "''", ")", ")", ";", "this", ".", "connected", "=", "false", ";", "this", ".", "emit", "(", "'close'", ",", "e...
If the connection to redis just closed, try to reconnect @param {Error} err
[ "If", "the", "connection", "to", "redis", "just", "closed", "try", "to", "reconnect" ]
5f652d5382f0a38921679027e82053676d5fd89e
https://github.com/Redsmin/proxy/blob/5f652d5382f0a38921679027e82053676d5fd89e/lib/RedisClient.js#L148-L154
30,660
jugglinmike/srcdoc-polyfill
srcdoc-polyfill.js
function( iframe, options ) { var sandbox = iframe.getAttribute("sandbox"); if (typeof sandbox === "string" && !sandboxAllow.test(sandbox)) { if (options && options.force) { iframe.removeAttribute("sandbox"); } else if (!options || options.force !== false) { logError(sandboxMsg); iframe.setAttribu...
javascript
function( iframe, options ) { var sandbox = iframe.getAttribute("sandbox"); if (typeof sandbox === "string" && !sandboxAllow.test(sandbox)) { if (options && options.force) { iframe.removeAttribute("sandbox"); } else if (!options || options.force !== false) { logError(sandboxMsg); iframe.setAttribu...
[ "function", "(", "iframe", ",", "options", ")", "{", "var", "sandbox", "=", "iframe", ".", "getAttribute", "(", "\"sandbox\"", ")", ";", "if", "(", "typeof", "sandbox", "===", "\"string\"", "&&", "!", "sandboxAllow", ".", "test", "(", "sandbox", ")", ")"...
Determine if the operation may be blocked by the `sandbox` attribute in some environments, and optionally issue a warning or remove the attribute.
[ "Determine", "if", "the", "operation", "may", "be", "blocked", "by", "the", "sandbox", "attribute", "in", "some", "environments", "and", "optionally", "issue", "a", "warning", "or", "remove", "the", "attribute", "." ]
af5a41ca819ceeb77bf6ee7aaf152d987b8aab92
https://github.com/jugglinmike/srcdoc-polyfill/blob/af5a41ca819ceeb77bf6ee7aaf152d987b8aab92/srcdoc-polyfill.js#L28-L38
30,661
dfsq/json-server-init
src/create/add-another.js
addAnother
function addAnother(schema) { var config = { properties: { another: { description: 'Add another collection? (y/n)'.magenta } } }; prompt.start(); prompt.message = ' > '; prompt.delimiter = ''; return new Promise(function(resolve, reject)...
javascript
function addAnother(schema) { var config = { properties: { another: { description: 'Add another collection? (y/n)'.magenta } } }; prompt.start(); prompt.message = ' > '; prompt.delimiter = ''; return new Promise(function(resolve, reject)...
[ "function", "addAnother", "(", "schema", ")", "{", "var", "config", "=", "{", "properties", ":", "{", "another", ":", "{", "description", ":", "'Add another collection? (y/n)'", ".", "magenta", "}", "}", "}", ";", "prompt", ".", "start", "(", ")", ";", "...
Prompt to ask if another collection should be added to schema. @return {Promise}
[ "Prompt", "to", "ask", "if", "another", "collection", "should", "be", "added", "to", "schema", "." ]
1daf20c9014794fb2c6e9f16759946367078b55f
https://github.com/dfsq/json-server-init/blob/1daf20c9014794fb2c6e9f16759946367078b55f/src/create/add-another.js#L8-L42
30,662
dfsq/json-server-init
src/create/add-collection.js
getCollection
function getCollection() { var config = { properties: { collection: { description: 'Collection name and number of rows, 5 if omitted (ex: posts 10): '.magenta, type: 'string', required: true } } }; prompt.start(); ...
javascript
function getCollection() { var config = { properties: { collection: { description: 'Collection name and number of rows, 5 if omitted (ex: posts 10): '.magenta, type: 'string', required: true } } }; prompt.start(); ...
[ "function", "getCollection", "(", ")", "{", "var", "config", "=", "{", "properties", ":", "{", "collection", ":", "{", "description", ":", "'Collection name and number of rows, 5 if omitted (ex: posts 10): '", ".", "magenta", ",", "type", ":", "'string'", ",", "requ...
Prompt for collection name. @return {Promise}
[ "Prompt", "for", "collection", "name", "." ]
1daf20c9014794fb2c6e9f16759946367078b55f
https://github.com/dfsq/json-server-init/blob/1daf20c9014794fb2c6e9f16759946367078b55f/src/create/add-collection.js#L10-L32
30,663
dfsq/json-server-init
src/create/add-collection.js
getFields
function getFields(collection) { var message = 'What fields should "' + collection + '" have?\n', config; config = { properties: { fields: { description: message.magenta + ' Comma-separated fieldname:fieldtype pairs (ex: id:index, username:username...
javascript
function getFields(collection) { var message = 'What fields should "' + collection + '" have?\n', config; config = { properties: { fields: { description: message.magenta + ' Comma-separated fieldname:fieldtype pairs (ex: id:index, username:username...
[ "function", "getFields", "(", "collection", ")", "{", "var", "message", "=", "'What fields should \"'", "+", "collection", "+", "'\" have?\\n'", ",", "config", ";", "config", "=", "{", "properties", ":", "{", "fields", ":", "{", "description", ":", "message", ...
Prompt for collection fields. @return {Promise}
[ "Prompt", "for", "collection", "fields", "." ]
1daf20c9014794fb2c6e9f16759946367078b55f
https://github.com/dfsq/json-server-init/blob/1daf20c9014794fb2c6e9f16759946367078b55f/src/create/add-collection.js#L38-L71
30,664
dfsq/json-server-init
src/create/write-json.js
writeJSON
function writeJSON(dbName, schema) { var baseUrl = 'http://www.filltext.com/?', promises = [], collection; for (collection in schema) { var meta = schema[collection].meta, fields = meta.fields, url; url = Object.keys(fields).map(function(key) { ...
javascript
function writeJSON(dbName, schema) { var baseUrl = 'http://www.filltext.com/?', promises = [], collection; for (collection in schema) { var meta = schema[collection].meta, fields = meta.fields, url; url = Object.keys(fields).map(function(key) { ...
[ "function", "writeJSON", "(", "dbName", ",", "schema", ")", "{", "var", "baseUrl", "=", "'http://www.filltext.com/?'", ",", "promises", "=", "[", "]", ",", "collection", ";", "for", "(", "collection", "in", "schema", ")", "{", "var", "meta", "=", "schema",...
Writes generated JSON into file. @param dbName {String} Name of the file to create. @param schema {Object} Populated object of collections. @return {Promise}
[ "Writes", "generated", "JSON", "into", "file", "." ]
1daf20c9014794fb2c6e9f16759946367078b55f
https://github.com/dfsq/json-server-init/blob/1daf20c9014794fb2c6e9f16759946367078b55f/src/create/write-json.js#L15-L53
30,665
teambition/merge2
index.js
pauseStreams
function pauseStreams (streams, options) { if (!Array.isArray(streams)) { // Backwards-compat with old-style streams if (!streams._readableState && streams.pipe) streams = streams.pipe(PassThrough(options)) if (!streams._readableState || !streams.pause || !streams.pipe) { throw new Error('Only reada...
javascript
function pauseStreams (streams, options) { if (!Array.isArray(streams)) { // Backwards-compat with old-style streams if (!streams._readableState && streams.pipe) streams = streams.pipe(PassThrough(options)) if (!streams._readableState || !streams.pause || !streams.pipe) { throw new Error('Only reada...
[ "function", "pauseStreams", "(", "streams", ",", "options", ")", "{", "if", "(", "!", "Array", ".", "isArray", "(", "streams", ")", ")", "{", "// Backwards-compat with old-style streams", "if", "(", "!", "streams", ".", "_readableState", "&&", "streams", ".", ...
check and pause streams for pipe.
[ "check", "and", "pause", "streams", "for", "pipe", "." ]
d2f21832a16c8eb24c853b3e7cb133040688c898
https://github.com/teambition/merge2/blob/d2f21832a16c8eb24c853b3e7cb133040688c898/index.js#L95-L107
30,666
reelyactive/advlib
lib/reelyactive/data/index.js
process
function process(payload) { var batteryRaw = parseInt(payload.substr(2,2),16) % 64; var temperatureRaw = (parseInt(payload.substr(0,3),16) >> 2) % 256; var battery = ((batteryRaw / 34) + 1.8).toFixed(2) + "V"; var temperature = ((temperatureRaw - 80) / 2).toFixed(1) + "C"; return { battery: battery, t...
javascript
function process(payload) { var batteryRaw = parseInt(payload.substr(2,2),16) % 64; var temperatureRaw = (parseInt(payload.substr(0,3),16) >> 2) % 256; var battery = ((batteryRaw / 34) + 1.8).toFixed(2) + "V"; var temperature = ((temperatureRaw - 80) / 2).toFixed(1) + "C"; return { battery: battery, t...
[ "function", "process", "(", "payload", ")", "{", "var", "batteryRaw", "=", "parseInt", "(", "payload", ".", "substr", "(", "2", ",", "2", ")", ",", "16", ")", "%", "64", ";", "var", "temperatureRaw", "=", "(", "parseInt", "(", "payload", ".", "substr...
Convert a raw radio sensor data payload. @param {string} payload The raw payload as a hexadecimal-string. @return {object} Sensor data.
[ "Convert", "a", "raw", "radio", "sensor", "data", "payload", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/reelyactive/data/index.js#L6-L15
30,667
reelyactive/advlib
lib/ble/index.js
process
function process(payload) { payload = payload.toLowerCase(); var advA48 = address.process(payload.substr(4,12)); advA48.advHeader = header.process(payload.substr(0,4)); advA48.advData = data.process(payload.substr(16)); return advA48; }
javascript
function process(payload) { payload = payload.toLowerCase(); var advA48 = address.process(payload.substr(4,12)); advA48.advHeader = header.process(payload.substr(0,4)); advA48.advData = data.process(payload.substr(16)); return advA48; }
[ "function", "process", "(", "payload", ")", "{", "payload", "=", "payload", ".", "toLowerCase", "(", ")", ";", "var", "advA48", "=", "address", ".", "process", "(", "payload", ".", "substr", "(", "4", ",", "12", ")", ")", ";", "advA48", ".", "advHead...
Process a raw Bluetooth Low Energy radio payload into semantically meaningful information. address. Note that the payload is LSB first. @param {string} payload The raw payload as a hexadecimal-string. @return {AdvA48} Advertiser address identifier.
[ "Process", "a", "raw", "Bluetooth", "Low", "Energy", "radio", "payload", "into", "semantically", "meaningful", "information", ".", "address", ".", "Note", "that", "the", "payload", "is", "LSB", "first", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/index.js#L21-L28
30,668
reelyactive/advlib
lib/ble/data/gap/servicedata.js
process
function process(data) { var uuid = data.substr(2,2) + data.substr(0,2); // NOTE: this is for legacy compatibility var advertiserData = { serviceData: { uuid: uuid, data: data.substr(4) } }; gattservices.process(advertiserData); return advertiserData.serviceData; }
javascript
function process(data) { var uuid = data.substr(2,2) + data.substr(0,2); // NOTE: this is for legacy compatibility var advertiserData = { serviceData: { uuid: uuid, data: data.substr(4) } }; gattservices.process(advertiserData); return advertiserData.serviceData; }
[ "function", "process", "(", "data", ")", "{", "var", "uuid", "=", "data", ".", "substr", "(", "2", ",", "2", ")", "+", "data", ".", "substr", "(", "0", ",", "2", ")", ";", "// NOTE: this is for legacy compatibility", "var", "advertiserData", "=", "{", ...
Parse BLE advertiser service data. @param {string} data The raw service data as a hexadecimal-string.
[ "Parse", "BLE", "advertiser", "service", "data", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/data/gap/servicedata.js#L14-L28
30,669
reelyactive/advlib
lib/ble/common/manufacturers/apple/index.js
process
function process(advertiserData) { var data = advertiserData.manufacturerSpecificData.data; var cursor = 0; // Apple sometimes includes more than one service data while(cursor < data.length) { var appleType = data.substr(cursor,2); switch(appleType) { case '01': return; // TODO: decipher...
javascript
function process(advertiserData) { var data = advertiserData.manufacturerSpecificData.data; var cursor = 0; // Apple sometimes includes more than one service data while(cursor < data.length) { var appleType = data.substr(cursor,2); switch(appleType) { case '01': return; // TODO: decipher...
[ "function", "process", "(", "advertiserData", ")", "{", "var", "data", "=", "advertiserData", ".", "manufacturerSpecificData", ".", "data", ";", "var", "cursor", "=", "0", ";", "// Apple sometimes includes more than one service data", "while", "(", "cursor", "<", "d...
Parse BLE advertiser manufacturer specific data for Apple. @param {Object} advertiserData The object containing all parsed data.
[ "Parse", "BLE", "advertiser", "manufacturer", "specific", "data", "for", "Apple", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/common/manufacturers/apple/index.js#L19-L61
30,670
reelyactive/advlib
lib/ble/header/index.js
process
function process(payload) { var addressType = parseInt(payload.substr(0,1),16); var typeCode = payload.substr(1,1); var length = parseInt(payload.substr(2,2),16) % 64; var rxAdd = "public"; var txAdd = "public"; if(addressType & 0x8) { rxAdd = "random"; } if(addressType & 0x4) { txAdd = "random"...
javascript
function process(payload) { var addressType = parseInt(payload.substr(0,1),16); var typeCode = payload.substr(1,1); var length = parseInt(payload.substr(2,2),16) % 64; var rxAdd = "public"; var txAdd = "public"; if(addressType & 0x8) { rxAdd = "random"; } if(addressType & 0x4) { txAdd = "random"...
[ "function", "process", "(", "payload", ")", "{", "var", "addressType", "=", "parseInt", "(", "payload", ".", "substr", "(", "0", ",", "1", ")", ",", "16", ")", ";", "var", "typeCode", "=", "payload", ".", "substr", "(", "1", ",", "1", ")", ";", "...
Convert a raw Bluetooth Low Energy advertiser header into its meaningful parts. @param {string} payload The raw payload as a hexadecimal-string. @return {Object} Semantically meaningful advertiser header.
[ "Convert", "a", "raw", "Bluetooth", "Low", "Energy", "advertiser", "header", "into", "its", "meaningful", "parts", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/header/index.js#L23-L66
30,671
reelyactive/advlib
lib/ble/data/gatt/services/members/google.js
processEddystone
function processEddystone(advertiserData) { var data = advertiserData.serviceData.data; var eddystone = {}; var frameType = data.substr(0,2); switch(frameType) { // UID case '00': eddystone.type = 'UID'; eddystone.txPower = pdu.convertTxPower(data.substr(2,2)); eddystone.uid = {}; ...
javascript
function processEddystone(advertiserData) { var data = advertiserData.serviceData.data; var eddystone = {}; var frameType = data.substr(0,2); switch(frameType) { // UID case '00': eddystone.type = 'UID'; eddystone.txPower = pdu.convertTxPower(data.substr(2,2)); eddystone.uid = {}; ...
[ "function", "processEddystone", "(", "advertiserData", ")", "{", "var", "data", "=", "advertiserData", ".", "serviceData", ".", "data", ";", "var", "eddystone", "=", "{", "}", ";", "var", "frameType", "=", "data", ".", "substr", "(", "0", ",", "2", ")", ...
Parse BLE advertiser Eddystone data. @param {Object} advertiserData The object containing all parsed data.
[ "Parse", "BLE", "advertiser", "Eddystone", "data", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/data/gatt/services/members/google.js#L57-L113
30,672
reelyactive/advlib
lib/ble/data/gatt/services/members/google.js
parseEncodedUrl
function parseEncodedUrl(encodedUrl) { var url = ''; for(var cChar = 0; cChar < (encodedUrl.length / 2); cChar++) { var charCode = parseInt(encodedUrl.substr(cChar*2,2),16); switch(charCode) { case 0x00: url += ".com/"; break; case 0x01: url += ".org/"; break; ...
javascript
function parseEncodedUrl(encodedUrl) { var url = ''; for(var cChar = 0; cChar < (encodedUrl.length / 2); cChar++) { var charCode = parseInt(encodedUrl.substr(cChar*2,2),16); switch(charCode) { case 0x00: url += ".com/"; break; case 0x01: url += ".org/"; break; ...
[ "function", "parseEncodedUrl", "(", "encodedUrl", ")", "{", "var", "url", "=", "''", ";", "for", "(", "var", "cChar", "=", "0", ";", "cChar", "<", "(", "encodedUrl", ".", "length", "/", "2", ")", ";", "cChar", "++", ")", "{", "var", "charCode", "="...
Parse encoded URL. @param {String} encodedUrl The encoded URL as a hexadecimal string. @return {String} The suffix of the URL.
[ "Parse", "encoded", "URL", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/data/gatt/services/members/google.js#L149-L203
30,673
reelyactive/advlib
lib/reelyactive/common/util/identifier.js
Identifier
function Identifier(type, value) { var isValue = (value != null); // Constructor for EUI-64 if((type == TYPE_EUI64) && isValue) { this.type = TYPE_EUI64; this.value = value; } // Constructor for RA-28 else if((type == TYPE_RA28) && isValue) { this.type = TYPE_RA28; this.value = value.subst...
javascript
function Identifier(type, value) { var isValue = (value != null); // Constructor for EUI-64 if((type == TYPE_EUI64) && isValue) { this.type = TYPE_EUI64; this.value = value; } // Constructor for RA-28 else if((type == TYPE_RA28) && isValue) { this.type = TYPE_RA28; this.value = value.subst...
[ "function", "Identifier", "(", "type", ",", "value", ")", "{", "var", "isValue", "=", "(", "value", "!=", "null", ")", ";", "// Constructor for EUI-64", "if", "(", "(", "type", "==", "TYPE_EUI64", ")", "&&", "isValue", ")", "{", "this", ".", "type", "=...
Identifier Class Represents an identifier @param {string} type Type of identifier. @param {Object} value The value of the given identifier. @constructor
[ "Identifier", "Class", "Represents", "an", "identifier" ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/reelyactive/common/util/identifier.js#L25-L58
30,674
reelyactive/advlib
lib/ble/data/gap/manufacturerspecificdata.js
process
function process(data) { var companyIdentifierCode = data.substr(2,2); companyIdentifierCode += data.substr(0,2); var companyName = companyIdentifierCodes.companyNames[companyIdentifierCode]; if(typeof companyName === 'undefined') { companyName = 'Unknown'; } // NOTE: this is for legacy compatibility ...
javascript
function process(data) { var companyIdentifierCode = data.substr(2,2); companyIdentifierCode += data.substr(0,2); var companyName = companyIdentifierCodes.companyNames[companyIdentifierCode]; if(typeof companyName === 'undefined') { companyName = 'Unknown'; } // NOTE: this is for legacy compatibility ...
[ "function", "process", "(", "data", ")", "{", "var", "companyIdentifierCode", "=", "data", ".", "substr", "(", "2", ",", "2", ")", ";", "companyIdentifierCode", "+=", "data", ".", "substr", "(", "0", ",", "2", ")", ";", "var", "companyName", "=", "comp...
Parse BLE advertiser data manufacturer specific data. @param {string} data The raw manufacturer data as a hexadecimal-string. @param {number} cursor The start index within the payload. @param {Object} advertiserData The object containing all parsed data.
[ "Parse", "BLE", "advertiser", "data", "manufacturer", "specific", "data", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/data/gap/manufacturerspecificdata.js#L25-L70
30,675
reelyactive/advlib
lib/ble/address/index.js
process
function process(payload) { var advAString = payload.substr(10,2); advAString += payload.substr(8,2); advAString += payload.substr(6,2); advAString += payload.substr(4,2); advAString += payload.substr(2,2); advAString += payload.substr(0,2); return new identifier(identifier.ADVA48, advAString); }
javascript
function process(payload) { var advAString = payload.substr(10,2); advAString += payload.substr(8,2); advAString += payload.substr(6,2); advAString += payload.substr(4,2); advAString += payload.substr(2,2); advAString += payload.substr(0,2); return new identifier(identifier.ADVA48, advAString); }
[ "function", "process", "(", "payload", ")", "{", "var", "advAString", "=", "payload", ".", "substr", "(", "10", ",", "2", ")", ";", "advAString", "+=", "payload", ".", "substr", "(", "8", ",", "2", ")", ";", "advAString", "+=", "payload", ".", "subst...
Convert a raw Bluetooth Low Energy advertiser address. @param {string} payload The raw payload as a hexadecimal-string. @return {Object} 48-bit advertiser address.
[ "Convert", "a", "raw", "Bluetooth", "Low", "Energy", "advertiser", "address", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/address/index.js#L13-L21
30,676
reelyactive/advlib
lib/ble/data/gap/flags.js
process
function process(data) { var flags = parseInt(data, 16); var result = []; if(flags & 0x01) { result.push(BIT0_NAME); } if(flags & 0x02) { result.push(BIT1_NAME); } if(flags & 0x04) { result.push(BIT2_NAME); } if(flags & 0x08) { result.push(BIT3_NAME); } if(flags & 0x10) { resul...
javascript
function process(data) { var flags = parseInt(data, 16); var result = []; if(flags & 0x01) { result.push(BIT0_NAME); } if(flags & 0x02) { result.push(BIT1_NAME); } if(flags & 0x04) { result.push(BIT2_NAME); } if(flags & 0x08) { result.push(BIT3_NAME); } if(flags & 0x10) { resul...
[ "function", "process", "(", "data", ")", "{", "var", "flags", "=", "parseInt", "(", "data", ",", "16", ")", ";", "var", "result", "=", "[", "]", ";", "if", "(", "flags", "&", "0x01", ")", "{", "result", ".", "push", "(", "BIT0_NAME", ")", ";", ...
Parse BLE advertiser data flags. @param {string} data The raw flag data as a hexadecimal-string.
[ "Parse", "BLE", "advertiser", "data", "flags", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/data/gap/flags.js#L19-L41
30,677
reelyactive/advlib
lib/ble/common/manufacturers/sticknfind/index.js
process
function process(advertiserData) { var data = advertiserData.manufacturerSpecificData.data; var packetType = data.substr(0,2); switch(packetType) { case '01': snfsingle.process(advertiserData); break; case '42': snsmotion.process(advertiserData); break; default: } }
javascript
function process(advertiserData) { var data = advertiserData.manufacturerSpecificData.data; var packetType = data.substr(0,2); switch(packetType) { case '01': snfsingle.process(advertiserData); break; case '42': snsmotion.process(advertiserData); break; default: } }
[ "function", "process", "(", "advertiserData", ")", "{", "var", "data", "=", "advertiserData", ".", "manufacturerSpecificData", ".", "data", ";", "var", "packetType", "=", "data", ".", "substr", "(", "0", ",", "2", ")", ";", "switch", "(", "packetType", ")"...
Parse BLE advertiser manufacturer specific data for StickNFind. @param {Object} advertiserData The object containing all parsed data.
[ "Parse", "BLE", "advertiser", "manufacturer", "specific", "data", "for", "StickNFind", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/common/manufacturers/sticknfind/index.js#L14-L27
30,678
reelyactive/advlib
lib/ble/common/manufacturers/apple/ibeacon.js
process
function process(advertiserData, cursor) { var iBeacon = {}; var data = advertiserData.manufacturerSpecificData.data; iBeacon.uuid = data.substr(4,32); iBeacon.major = data.substr(36,4); iBeacon.minor = data.substr(40,4); iBeacon.txPower = pdu.convertTxPower(data.substr(44,2)); var licenseeName = licens...
javascript
function process(advertiserData, cursor) { var iBeacon = {}; var data = advertiserData.manufacturerSpecificData.data; iBeacon.uuid = data.substr(4,32); iBeacon.major = data.substr(36,4); iBeacon.minor = data.substr(40,4); iBeacon.txPower = pdu.convertTxPower(data.substr(44,2)); var licenseeName = licens...
[ "function", "process", "(", "advertiserData", ",", "cursor", ")", "{", "var", "iBeacon", "=", "{", "}", ";", "var", "data", "=", "advertiserData", ".", "manufacturerSpecificData", ".", "data", ";", "iBeacon", ".", "uuid", "=", "data", ".", "substr", "(", ...
Parse Apple iBeacon manufacturer specific data. @param {Object} advertiserData The object containing all parsed data. @param {Number} cursor The current index into the raw data.
[ "Parse", "Apple", "iBeacon", "manufacturer", "specific", "data", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/common/manufacturers/apple/ibeacon.js#L39-L57
30,679
reelyactive/advlib
lib/ble/common/manufacturers/radiusnetworks/altbeacon.js
process
function process(advertiserData) { var altBeacon = {}; var data = advertiserData.manufacturerSpecificData.data; altBeacon.id = data.substr(4,40); altBeacon.refRSSI = pdu.convertTxPower(data.substr(44,2)); altBeacon.mfgReserved = data.substr(46,2); advertiserData.manufacturerSpecificData.altBeacon = altBea...
javascript
function process(advertiserData) { var altBeacon = {}; var data = advertiserData.manufacturerSpecificData.data; altBeacon.id = data.substr(4,40); altBeacon.refRSSI = pdu.convertTxPower(data.substr(44,2)); altBeacon.mfgReserved = data.substr(46,2); advertiserData.manufacturerSpecificData.altBeacon = altBea...
[ "function", "process", "(", "advertiserData", ")", "{", "var", "altBeacon", "=", "{", "}", ";", "var", "data", "=", "advertiserData", ".", "manufacturerSpecificData", ".", "data", ";", "altBeacon", ".", "id", "=", "data", ".", "substr", "(", "4", ",", "4...
Parse AltBeacon manufacturer specific data. @param {Object} advertiserData The object containing all parsed data.
[ "Parse", "AltBeacon", "manufacturer", "specific", "data", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/common/manufacturers/radiusnetworks/altbeacon.js#L18-L27
30,680
reelyactive/advlib
lib/ble/common/manufacturers/radiusnetworks/altbeacon.js
isAltBeacon
function isAltBeacon(advertiserData) { var data = advertiserData.manufacturerSpecificData.data; var isCorrectLength = ((data.length + 6) === (LENGTH * 2)); var isCorrectCode = (data.substr(0,4) === CODE); return isCorrectLength && isCorrectCode; }
javascript
function isAltBeacon(advertiserData) { var data = advertiserData.manufacturerSpecificData.data; var isCorrectLength = ((data.length + 6) === (LENGTH * 2)); var isCorrectCode = (data.substr(0,4) === CODE); return isCorrectLength && isCorrectCode; }
[ "function", "isAltBeacon", "(", "advertiserData", ")", "{", "var", "data", "=", "advertiserData", ".", "manufacturerSpecificData", ".", "data", ";", "var", "isCorrectLength", "=", "(", "(", "data", ".", "length", "+", "6", ")", "===", "(", "LENGTH", "*", "...
Verify if the given manufacturerSpecificData represents an AltBeacon. @param {Object} advertiserData The object containing all parsed data.
[ "Verify", "if", "the", "given", "manufacturerSpecificData", "represents", "an", "AltBeacon", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/common/manufacturers/radiusnetworks/altbeacon.js#L34-L40
30,681
reelyactive/advlib
lib/ble/data/gap/localname.js
process
function process(data) { var result = ''; for(var cChar = 0; cChar < data.length; cChar += 2) { result += String.fromCharCode(parseInt(data.substr(cChar,2),16)); } return result; }
javascript
function process(data) { var result = ''; for(var cChar = 0; cChar < data.length; cChar += 2) { result += String.fromCharCode(parseInt(data.substr(cChar,2),16)); } return result; }
[ "function", "process", "(", "data", ")", "{", "var", "result", "=", "''", ";", "for", "(", "var", "cChar", "=", "0", ";", "cChar", "<", "data", ".", "length", ";", "cChar", "+=", "2", ")", "{", "result", "+=", "String", ".", "fromCharCode", "(", ...
Parse BLE advertiser data non-complete shortened local name. @param {string} data The raw name data as a hexadecimal-string.
[ "Parse", "BLE", "advertiser", "data", "non", "-", "complete", "shortened", "local", "name", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/data/gap/localname.js#L14-L20
30,682
reelyactive/advlib
lib/ble/common/manufacturers/sticknfind/snsmotion.js
process
function process(advertiserData) { var snfBeacon = {}; var data = advertiserData.manufacturerSpecificData.data; snfBeacon.type = 'SnS Motion'; snfBeacon.timestamp = parseInt(pdu.reverseBytes(data.substr(2,8)),16); snfBeacon.temperature = parseInt(data.substr(10,2),16); if(snfBeacon.temperature > 127) { ...
javascript
function process(advertiserData) { var snfBeacon = {}; var data = advertiserData.manufacturerSpecificData.data; snfBeacon.type = 'SnS Motion'; snfBeacon.timestamp = parseInt(pdu.reverseBytes(data.substr(2,8)),16); snfBeacon.temperature = parseInt(data.substr(10,2),16); if(snfBeacon.temperature > 127) { ...
[ "function", "process", "(", "advertiserData", ")", "{", "var", "snfBeacon", "=", "{", "}", ";", "var", "data", "=", "advertiserData", ".", "manufacturerSpecificData", ".", "data", ";", "snfBeacon", ".", "type", "=", "'SnS Motion'", ";", "snfBeacon", ".", "ti...
Parse StickNSense 'motion' manufacturer specific data. @param {Object} advertiserData The object containing all parsed data.
[ "Parse", "StickNSense", "motion", "manufacturer", "specific", "data", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/common/manufacturers/sticknfind/snsmotion.js#L14-L46
30,683
reelyactive/advlib
lib/ble/common/manufacturers/sticknfind/snfsingle.js
process
function process(advertiserData) { var snfBeacon = {}; var data = advertiserData.manufacturerSpecificData.data; snfBeacon.type = 'V2 Single Payload'; snfBeacon.id = pdu.reverseBytes(data.substr(2,16)); snfBeacon.time = parseInt(pdu.reverseBytes(data.substr(18,8)),16); snfBeacon.scanCount = parseInt(data.su...
javascript
function process(advertiserData) { var snfBeacon = {}; var data = advertiserData.manufacturerSpecificData.data; snfBeacon.type = 'V2 Single Payload'; snfBeacon.id = pdu.reverseBytes(data.substr(2,16)); snfBeacon.time = parseInt(pdu.reverseBytes(data.substr(18,8)),16); snfBeacon.scanCount = parseInt(data.su...
[ "function", "process", "(", "advertiserData", ")", "{", "var", "snfBeacon", "=", "{", "}", ";", "var", "data", "=", "advertiserData", ".", "manufacturerSpecificData", ".", "data", ";", "snfBeacon", ".", "type", "=", "'V2 Single Payload'", ";", "snfBeacon", "."...
Parse StickNFind 'single payload' manufacturer specific data. @param {Object} advertiserData The object containing all parsed data.
[ "Parse", "StickNFind", "single", "payload", "manufacturer", "specific", "data", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/common/manufacturers/sticknfind/snfsingle.js#L14-L32
30,684
reelyactive/advlib
lib/reelyactive/index.js
process
function process(payload) { payload = payload.toLowerCase(); var ra28 = new identifier(identifier.RA28, payload.substr(0, 7)); var eui64 = ra28.toType(identifier.EUI64); eui64.flags = flags.process(payload.substr(7, 1)); if (payload.length === 12) { eui64.data = data.process(payload.substr(8, 4)); } ...
javascript
function process(payload) { payload = payload.toLowerCase(); var ra28 = new identifier(identifier.RA28, payload.substr(0, 7)); var eui64 = ra28.toType(identifier.EUI64); eui64.flags = flags.process(payload.substr(7, 1)); if (payload.length === 12) { eui64.data = data.process(payload.substr(8, 4)); } ...
[ "function", "process", "(", "payload", ")", "{", "payload", "=", "payload", ".", "toLowerCase", "(", ")", ";", "var", "ra28", "=", "new", "identifier", "(", "identifier", ".", "RA28", ",", "payload", ".", "substr", "(", "0", ",", "7", ")", ")", ";", ...
Process a raw reelyActive radio payload into semantically meaningful information. @param {string} payload The raw payload as a hexadecimal-string. @return {EUI64} EUI-64 identifier.
[ "Process", "a", "raw", "reelyActive", "radio", "payload", "into", "semantically", "meaningful", "information", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/reelyactive/index.js#L18-L28
30,685
reelyactive/advlib
lib/ble/common/manufacturers/estimote/index.js
process
function process(advertiserData) { var data = advertiserData.manufacturerSpecificData.data; var packetType = data.substr(0,2); switch(packetType) { // Update when we have manufacturer documentation case '01': default: nearable.process(advertiserData); } }
javascript
function process(advertiserData) { var data = advertiserData.manufacturerSpecificData.data; var packetType = data.substr(0,2); switch(packetType) { // Update when we have manufacturer documentation case '01': default: nearable.process(advertiserData); } }
[ "function", "process", "(", "advertiserData", ")", "{", "var", "data", "=", "advertiserData", ".", "manufacturerSpecificData", ".", "data", ";", "var", "packetType", "=", "data", ".", "substr", "(", "0", ",", "2", ")", ";", "switch", "(", "packetType", ")"...
Parse BLE advertiser manufacturer specific data for Estimote. @param {Object} advertiserData The object containing all parsed data.
[ "Parse", "BLE", "advertiser", "manufacturer", "specific", "data", "for", "Estimote", "." ]
4c8eeb8bdb9c465536b257b51a908da20d6fff27
https://github.com/reelyactive/advlib/blob/4c8eeb8bdb9c465536b257b51a908da20d6fff27/lib/ble/common/manufacturers/estimote/index.js#L13-L22
30,686
santilland/plotty
src/plotty.js
addColorScale
function addColorScale(name, colors, positions) { if (colors.length !== positions.length) { throw new Error('Invalid color scale.'); } colorscales[name] = { colors, positions }; }
javascript
function addColorScale(name, colors, positions) { if (colors.length !== positions.length) { throw new Error('Invalid color scale.'); } colorscales[name] = { colors, positions }; }
[ "function", "addColorScale", "(", "name", ",", "colors", ",", "positions", ")", "{", "if", "(", "colors", ".", "length", "!==", "positions", ".", "length", ")", "{", "throw", "new", "Error", "(", "'Invalid color scale.'", ")", ";", "}", "colorscales", "[",...
Add a new colorscale to the list of available colorscales. @memberof module:plotty @param {String} name the name of the newly defined color scale @param {String[]} colors the array containing the colors. Each entry shall adhere to the CSS color definitions. @param {Number[]} positions the value position for each of the...
[ "Add", "a", "new", "colorscale", "to", "the", "list", "of", "available", "colorscales", "." ]
342f5f34a7053d17b6ca8ef2ae7646e716bffd1b
https://github.com/santilland/plotty/blob/342f5f34a7053d17b6ca8ef2ae7646e716bffd1b/src/plotty.js#L110-L115
30,687
santilland/plotty
src/plotty.js
renderColorScaleToCanvas
function renderColorScaleToCanvas(name, canvas) { /* eslint-disable no-param-reassign */ const csDef = colorscales[name]; canvas.height = 1; const ctx = canvas.getContext('2d'); if (Object.prototype.toString.call(csDef) === '[object Object]') { canvas.width = 256; const gradient = ctx.createLinearGra...
javascript
function renderColorScaleToCanvas(name, canvas) { /* eslint-disable no-param-reassign */ const csDef = colorscales[name]; canvas.height = 1; const ctx = canvas.getContext('2d'); if (Object.prototype.toString.call(csDef) === '[object Object]') { canvas.width = 256; const gradient = ctx.createLinearGra...
[ "function", "renderColorScaleToCanvas", "(", "name", ",", "canvas", ")", "{", "/* eslint-disable no-param-reassign */", "const", "csDef", "=", "colorscales", "[", "name", "]", ";", "canvas", ".", "height", "=", "1", ";", "const", "ctx", "=", "canvas", ".", "ge...
Render the colorscale to the specified canvas. @memberof module:plotty @param {String} name the name of the color scale to render @param {HTMLCanvasElement} canvas the canvas to render to
[ "Render", "the", "colorscale", "to", "the", "specified", "canvas", "." ]
342f5f34a7053d17b6ca8ef2ae7646e716bffd1b
https://github.com/santilland/plotty/blob/342f5f34a7053d17b6ca8ef2ae7646e716bffd1b/src/plotty.js#L123-L147
30,688
sentanos/roblox-js
examples/copacetic.js
clear
function clear () { var str = ''; for (var i = 0; i < 20; i++) { if (Math.random() < 0.5) { str += '\u200B'; } else { str += ' '; } } return str; }
javascript
function clear () { var str = ''; for (var i = 0; i < 20; i++) { if (Math.random() < 0.5) { str += '\u200B'; } else { str += ' '; } } return str; }
[ "function", "clear", "(", ")", "{", "var", "str", "=", "''", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "20", ";", "i", "++", ")", "{", "if", "(", "Math", ".", "random", "(", ")", "<", "0.5", ")", "{", "str", "+=", "'\\u200B'", ...
Bypass duplicate post blocking
[ "Bypass", "duplicate", "post", "blocking" ]
ded0d976e0691cf7bb771d06fee196e621633e29
https://github.com/sentanos/roblox-js/blob/ded0d976e0691cf7bb771d06fee196e621633e29/examples/copacetic.js#L13-L23
30,689
curran/model
examples/d3LinkedViews/main.js
setSizes
function setSizes(){ // Put the scatter plot on the left. scatterPlot.box = { x: 0, y: 0, width: div.clientWidth / 2, height: div.clientHeight }; // Put the bar chart on the right. barChart.box = { x: div.clientWidth / 2, y: 0, width: div.clientWidth / 2...
javascript
function setSizes(){ // Put the scatter plot on the left. scatterPlot.box = { x: 0, y: 0, width: div.clientWidth / 2, height: div.clientHeight }; // Put the bar chart on the right. barChart.box = { x: div.clientWidth / 2, y: 0, width: div.clientWidth / 2...
[ "function", "setSizes", "(", ")", "{", "// Put the scatter plot on the left.", "scatterPlot", ".", "box", "=", "{", "x", ":", "0", ",", "y", ":", "0", ",", "width", ":", "div", ".", "clientWidth", "/", "2", ",", "height", ":", "div", ".", "clientHeight",...
Sets the `box` property on each visualization to arrange them within the container div.
[ "Sets", "the", "box", "property", "on", "each", "visualization", "to", "arrange", "them", "within", "the", "container", "div", "." ]
ad971f0d912e6f31cca33c467629c0c6f5279f9a
https://github.com/curran/model/blob/ad971f0d912e6f31cca33c467629c0c6f5279f9a/examples/d3LinkedViews/main.js#L74-L91
30,690
curran/model
examples/d3ParallelCoordinates/parallelCoordinates.js
path
function path(d) { return line(dimensions.map(function(p) { return [position(p), y[p](d[p])]; })); }
javascript
function path(d) { return line(dimensions.map(function(p) { return [position(p), y[p](d[p])]; })); }
[ "function", "path", "(", "d", ")", "{", "return", "line", "(", "dimensions", ".", "map", "(", "function", "(", "p", ")", "{", "return", "[", "position", "(", "p", ")", ",", "y", "[", "p", "]", "(", "d", "[", "p", "]", ")", "]", ";", "}", ")...
Returns the path for a given data point.
[ "Returns", "the", "path", "for", "a", "given", "data", "point", "." ]
ad971f0d912e6f31cca33c467629c0c6f5279f9a
https://github.com/curran/model/blob/ad971f0d912e6f31cca33c467629c0c6f5279f9a/examples/d3ParallelCoordinates/parallelCoordinates.js#L138-L140
30,691
curran/model
examples/d3ParallelCoordinates/parallelCoordinates.js
brush
function brush() { var actives = dimensions.filter(function(p) { return !y[p].brush.empty(); }), extents = actives.map(function(p) { return y[p].brush.extent(); }), selectedPaths = foregroundPaths.filter(function(d) { return actives.every(function(p, i) { return exten...
javascript
function brush() { var actives = dimensions.filter(function(p) { return !y[p].brush.empty(); }), extents = actives.map(function(p) { return y[p].brush.extent(); }), selectedPaths = foregroundPaths.filter(function(d) { return actives.every(function(p, i) { return exten...
[ "function", "brush", "(", ")", "{", "var", "actives", "=", "dimensions", ".", "filter", "(", "function", "(", "p", ")", "{", "return", "!", "y", "[", "p", "]", ".", "brush", ".", "empty", "(", ")", ";", "}", ")", ",", "extents", "=", "actives", ...
Handles a brush event, toggling the display of foreground lines.
[ "Handles", "a", "brush", "event", "toggling", "the", "display", "of", "foreground", "lines", "." ]
ad971f0d912e6f31cca33c467629c0c6f5279f9a
https://github.com/curran/model/blob/ad971f0d912e6f31cca33c467629c0c6f5279f9a/examples/d3ParallelCoordinates/parallelCoordinates.js#L143-L154
30,692
curran/model
examples/d3Bootstrap/main.js
type
function type(d) { // The '+' notation parses the string as a Number. d.sepalLength = +d.sepalLength; d.sepalWidth = +d.sepalWidth; return d; }
javascript
function type(d) { // The '+' notation parses the string as a Number. d.sepalLength = +d.sepalLength; d.sepalWidth = +d.sepalWidth; return d; }
[ "function", "type", "(", "d", ")", "{", "// The '+' notation parses the string as a Number.", "d", ".", "sepalLength", "=", "+", "d", ".", "sepalLength", ";", "d", ".", "sepalWidth", "=", "+", "d", ".", "sepalWidth", ";", "return", "d", ";", "}" ]
Called on each data element from the original table.
[ "Called", "on", "each", "data", "element", "from", "the", "original", "table", "." ]
ad971f0d912e6f31cca33c467629c0c6f5279f9a
https://github.com/curran/model/blob/ad971f0d912e6f31cca33c467629c0c6f5279f9a/examples/d3Bootstrap/main.js#L35-L40
30,693
curran/model
examples/bootstrapTable/main.js
setRandomData
function setRandomData(data){ // Include each key with a small chance var randomKeys = Object.keys(data[0]).filter(function(d){ return Math.random() < 0.5; }), // Make a copy of the objects with only the // random keys included. dataWithRandomKeys = data.map(function ...
javascript
function setRandomData(data){ // Include each key with a small chance var randomKeys = Object.keys(data[0]).filter(function(d){ return Math.random() < 0.5; }), // Make a copy of the objects with only the // random keys included. dataWithRandomKeys = data.map(function ...
[ "function", "setRandomData", "(", "data", ")", "{", "// Include each key with a small chance", "var", "randomKeys", "=", "Object", ".", "keys", "(", "data", "[", "0", "]", ")", ".", "filter", "(", "function", "(", "d", ")", "{", "return", "Math", ".", "ran...
Sets a random sample of rows and columns on the table, for checking that the table responds properly.
[ "Sets", "a", "random", "sample", "of", "rows", "and", "columns", "on", "the", "table", "for", "checking", "that", "the", "table", "responds", "properly", "." ]
ad971f0d912e6f31cca33c467629c0c6f5279f9a
https://github.com/curran/model/blob/ad971f0d912e6f31cca33c467629c0c6f5279f9a/examples/bootstrapTable/main.js#L22-L54
30,694
curran/model
examples/d3LineChart/main.js
randomString
function randomString() { var possibilities = ['Frequency', 'Population', 'Alpha', 'Beta'], i = Math.round(Math.random() * possibilities.length); return possibilities[i]; }
javascript
function randomString() { var possibilities = ['Frequency', 'Population', 'Alpha', 'Beta'], i = Math.round(Math.random() * possibilities.length); return possibilities[i]; }
[ "function", "randomString", "(", ")", "{", "var", "possibilities", "=", "[", "'Frequency'", ",", "'Population'", ",", "'Alpha'", ",", "'Beta'", "]", ",", "i", "=", "Math", ".", "round", "(", "Math", ".", "random", "(", ")", "*", "possibilities", ".", "...
Change the Y axis label every 600 ms.
[ "Change", "the", "Y", "axis", "label", "every", "600", "ms", "." ]
ad971f0d912e6f31cca33c467629c0c6f5279f9a
https://github.com/curran/model/blob/ad971f0d912e6f31cca33c467629c0c6f5279f9a/examples/d3LineChart/main.js#L58-L62
30,695
curran/model
src/model.js
track
function track(property, thisArg){ if(!(property in trackedProperties)){ trackedProperties[property] = true; values[property] = model[property]; Object.defineProperty(model, property, { get: function () { return values[property]; }, set: function(newValue) { var oldValue ...
javascript
function track(property, thisArg){ if(!(property in trackedProperties)){ trackedProperties[property] = true; values[property] = model[property]; Object.defineProperty(model, property, { get: function () { return values[property]; }, set: function(newValue) { var oldValue ...
[ "function", "track", "(", "property", ",", "thisArg", ")", "{", "if", "(", "!", "(", "property", "in", "trackedProperties", ")", ")", "{", "trackedProperties", "[", "property", "]", "=", "true", ";", "values", "[", "property", "]", "=", "model", "[", "...
Tracks a property if it is not already tracked.
[ "Tracks", "a", "property", "if", "it", "is", "not", "already", "tracked", "." ]
ad971f0d912e6f31cca33c467629c0c6f5279f9a
https://github.com/curran/model/blob/ad971f0d912e6f31cca33c467629c0c6f5279f9a/src/model.js#L112-L127
30,696
curran/model
src/model.js
off
function off(property, callback){ listeners[property] = listeners[property].filter(function (listener) { return listener !== callback; }); }
javascript
function off(property, callback){ listeners[property] = listeners[property].filter(function (listener) { return listener !== callback; }); }
[ "function", "off", "(", "property", ",", "callback", ")", "{", "listeners", "[", "property", "]", "=", "listeners", "[", "property", "]", ".", "filter", "(", "function", "(", "listener", ")", "{", "return", "listener", "!==", "callback", ";", "}", ")", ...
Removes a change listener added using `on`.
[ "Removes", "a", "change", "listener", "added", "using", "on", "." ]
ad971f0d912e6f31cca33c467629c0c6f5279f9a
https://github.com/curran/model/blob/ad971f0d912e6f31cca33c467629c0c6f5279f9a/src/model.js#L137-L141
30,697
curran/model
cdn/model-v0.2.4.js
Model
function Model(defaults){ // Make sure "new" is always used, // so we can use "instanceof" to check if something is a Model. if (!(this instanceof Model)) { return new Model(defaults); } // `model` is the public API object returned from invoking `new Model()`. var model = this, ...
javascript
function Model(defaults){ // Make sure "new" is always used, // so we can use "instanceof" to check if something is a Model. if (!(this instanceof Model)) { return new Model(defaults); } // `model` is the public API object returned from invoking `new Model()`. var model = this, ...
[ "function", "Model", "(", "defaults", ")", "{", "// Make sure \"new\" is always used,", "// so we can use \"instanceof\" to check if something is a Model.", "if", "(", "!", "(", "this", "instanceof", "Model", ")", ")", "{", "return", "new", "Model", "(", "defaults", ")"...
The constructor function, accepting default values.
[ "The", "constructor", "function", "accepting", "default", "values", "." ]
ad971f0d912e6f31cca33c467629c0c6f5279f9a
https://github.com/curran/model/blob/ad971f0d912e6f31cca33c467629c0c6f5279f9a/cdn/model-v0.2.4.js#L41-L164
30,698
resonance-audio/resonance-audio-web-sdk
examples/resources/js/benchmark.js
selectDimensionsAndMaterials
function selectDimensionsAndMaterials() { let reverbLength = document.getElementById('reverbLengthSelect').value; switch (reverbLength) { case 'none': default: { return { dimensions: { width: 0, height: 0, depth: 0, }, materials: { le...
javascript
function selectDimensionsAndMaterials() { let reverbLength = document.getElementById('reverbLengthSelect').value; switch (reverbLength) { case 'none': default: { return { dimensions: { width: 0, height: 0, depth: 0, }, materials: { le...
[ "function", "selectDimensionsAndMaterials", "(", ")", "{", "let", "reverbLength", "=", "document", ".", "getElementById", "(", "'reverbLengthSelect'", ")", ".", "value", ";", "switch", "(", "reverbLength", ")", "{", "case", "'none'", ":", "default", ":", "{", ...
Select appropriate dimensions and materials. @return {Object} @private
[ "Select", "appropriate", "dimensions", "and", "materials", "." ]
c69e41dae836aea5b41cf4e9e51efcd96e5d0bb6
https://github.com/resonance-audio/resonance-audio-web-sdk/blob/c69e41dae836aea5b41cf4e9e51efcd96e5d0bb6/examples/resources/js/benchmark.js#L12-L93
30,699
resonance-audio/resonance-audio-web-sdk
src/resonance-audio.js
ResonanceAudio
function ResonanceAudio(context, options) { // Public variables. /** * Binaurally-rendered stereo (2-channel) output {@link * https://developer.mozilla.org/en-US/docs/Web/API/AudioNode AudioNode}. * @member {AudioNode} output * @memberof ResonanceAudio * @instance */ /** * Ambisonic (multicha...
javascript
function ResonanceAudio(context, options) { // Public variables. /** * Binaurally-rendered stereo (2-channel) output {@link * https://developer.mozilla.org/en-US/docs/Web/API/AudioNode AudioNode}. * @member {AudioNode} output * @memberof ResonanceAudio * @instance */ /** * Ambisonic (multicha...
[ "function", "ResonanceAudio", "(", "context", ",", "options", ")", "{", "// Public variables.", "/**\n * Binaurally-rendered stereo (2-channel) output {@link\n * https://developer.mozilla.org/en-US/docs/Web/API/AudioNode AudioNode}.\n * @member {AudioNode} output\n * @memberof ResonanceAud...
Options for constructing a new ResonanceAudio scene. @typedef {Object} ResonanceAudio~ResonanceAudioOptions @property {Number} ambisonicOrder Desired ambisonic Order. Defaults to {@linkcode Utils.DEFAULT_AMBISONIC_ORDER DEFAULT_AMBISONIC_ORDER}. @property {Float32Array} listenerPosition The listener's initial position ...
[ "Options", "for", "constructing", "a", "new", "ResonanceAudio", "scene", "." ]
c69e41dae836aea5b41cf4e9e51efcd96e5d0bb6
https://github.com/resonance-audio/resonance-audio-web-sdk/blob/c69e41dae836aea5b41cf4e9e51efcd96e5d0bb6/src/resonance-audio.js#L67-L147