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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
15,200 | postmanlabs/postman-collection | lib/collection/response.js | function () {
var sizeInfo = {
body: 0,
header: 0,
total: 0
},
contentEncoding = this.headers.get(CONTENT_ENCODING),
contentLength = this.headers.get(CONTENT_LENGTH),
isCompressed = false,
byteLength;
... | javascript | function () {
var sizeInfo = {
body: 0,
header: 0,
total: 0
},
contentEncoding = this.headers.get(CONTENT_ENCODING),
contentLength = this.headers.get(CONTENT_LENGTH),
isCompressed = false,
byteLength;
... | [
"function",
"(",
")",
"{",
"var",
"sizeInfo",
"=",
"{",
"body",
":",
"0",
",",
"header",
":",
"0",
",",
"total",
":",
"0",
"}",
",",
"contentEncoding",
"=",
"this",
".",
"headers",
".",
"get",
"(",
"CONTENT_ENCODING",
")",
",",
"contentLength",
"=",
... | Get the response size by computing the same from content length header or using the actual response body.
@returns {Number}
@todo write unit tests | [
"Get",
"the",
"response",
"size",
"by",
"computing",
"the",
"same",
"from",
"content",
"length",
"header",
"or",
"using",
"the",
"actual",
"response",
"body",
"."
] | 1cacd38a98c82f86d3f6c61d16a57465bbd78b63 | https://github.com/postmanlabs/postman-collection/blob/1cacd38a98c82f86d3f6c61d16a57465bbd78b63/lib/collection/response.js#L439-L487 | |
15,201 | postmanlabs/postman-collection | lib/collection/response.js | function () {
var contentEncoding = this.headers.get(CONTENT_ENCODING),
body = this.stream || this.body,
source;
if (contentEncoding) {
source = HEADER;
}
// if the encoding is not found, we check
else if (body) { // @todo add detection for d... | javascript | function () {
var contentEncoding = this.headers.get(CONTENT_ENCODING),
body = this.stream || this.body,
source;
if (contentEncoding) {
source = HEADER;
}
// if the encoding is not found, we check
else if (body) { // @todo add detection for d... | [
"function",
"(",
")",
"{",
"var",
"contentEncoding",
"=",
"this",
".",
"headers",
".",
"get",
"(",
"CONTENT_ENCODING",
")",
",",
"body",
"=",
"this",
".",
"stream",
"||",
"this",
".",
"body",
",",
"source",
";",
"if",
"(",
"contentEncoding",
")",
"{",
... | Returns the response encoding defined as header or detected from body.
@private
@returns {Object} - {format: string, source: string} | [
"Returns",
"the",
"response",
"encoding",
"defined",
"as",
"header",
"or",
"detected",
"from",
"body",
"."
] | 1cacd38a98c82f86d3f6c61d16a57465bbd78b63 | https://github.com/postmanlabs/postman-collection/blob/1cacd38a98c82f86d3f6c61d16a57465bbd78b63/lib/collection/response.js#L495-L520 | |
15,202 | postmanlabs/postman-collection | lib/collection/response.js | function (response, cookies) {
return new Response({
cookie: cookies,
body: response.body.toString(),
stream: response.body,
header: response.headers,
code: response.statusCode,
status: response.statusMessage,
responseTime: resp... | javascript | function (response, cookies) {
return new Response({
cookie: cookies,
body: response.body.toString(),
stream: response.body,
header: response.headers,
code: response.statusCode,
status: response.statusMessage,
responseTime: resp... | [
"function",
"(",
"response",
",",
"cookies",
")",
"{",
"return",
"new",
"Response",
"(",
"{",
"cookie",
":",
"cookies",
",",
"body",
":",
"response",
".",
"body",
".",
"toString",
"(",
")",
",",
"stream",
":",
"response",
".",
"body",
",",
"header",
... | Converts the response object from the request module to the postman responseBody format
@param {Object} response The response object, as received from the request module
@param {Object} cookies
@returns {Object} The transformed responseBody
@todo Add a key: `originalRequest` to the returned object as well, referring t... | [
"Converts",
"the",
"response",
"object",
"from",
"the",
"request",
"module",
"to",
"the",
"postman",
"responseBody",
"format"
] | 1cacd38a98c82f86d3f6c61d16a57465bbd78b63 | https://github.com/postmanlabs/postman-collection/blob/1cacd38a98c82f86d3f6c61d16a57465bbd78b63/lib/collection/response.js#L551-L561 | |
15,203 | postmanlabs/postman-collection | lib/collection/response.js | function (timings) {
// bail out if timing information is not provided
if (!(timings && timings.offset)) {
return;
}
var phases,
offset = timings.offset;
// REFER: https://github.com/postmanlabs/postman-request/blob/v2.88.1-postman.5/request.js#L996
... | javascript | function (timings) {
// bail out if timing information is not provided
if (!(timings && timings.offset)) {
return;
}
var phases,
offset = timings.offset;
// REFER: https://github.com/postmanlabs/postman-request/blob/v2.88.1-postman.5/request.js#L996
... | [
"function",
"(",
"timings",
")",
"{",
"// bail out if timing information is not provided",
"if",
"(",
"!",
"(",
"timings",
"&&",
"timings",
".",
"offset",
")",
")",
"{",
"return",
";",
"}",
"var",
"phases",
",",
"offset",
"=",
"timings",
".",
"offset",
";",
... | Returns the durations of each request phase in milliseconds
@typedef Response~timings
@property {Number} start - timestamp of the request sent from the client (in Unix Epoch milliseconds)
@property {Object} offset - event timestamps in millisecond resolution relative to start
@property {Number} offset.request - timest... | [
"Returns",
"the",
"durations",
"of",
"each",
"request",
"phase",
"in",
"milliseconds"
] | 1cacd38a98c82f86d3f6c61d16a57465bbd78b63 | https://github.com/postmanlabs/postman-collection/blob/1cacd38a98c82f86d3f6c61d16a57465bbd78b63/lib/collection/response.js#L640-L667 | |
15,204 | evanw/node-source-map-support | source-map-support.js | getErrorSource | function getErrorSource(error) {
var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
if (match) {
var source = match[1];
var line = +match[2];
var column = +match[3];
// Support the inline sourceContents inside the source map
var contents = fileContentsCache[source];
// Su... | javascript | function getErrorSource(error) {
var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack);
if (match) {
var source = match[1];
var line = +match[2];
var column = +match[3];
// Support the inline sourceContents inside the source map
var contents = fileContentsCache[source];
// Su... | [
"function",
"getErrorSource",
"(",
"error",
")",
"{",
"var",
"match",
"=",
"/",
"\\n at [^(]+ \\((.*):(\\d+):(\\d+)\\)",
"/",
".",
"exec",
"(",
"error",
".",
"stack",
")",
";",
"if",
"(",
"match",
")",
"{",
"var",
"source",
"=",
"match",
"[",
"1",
"]"... | Generate position and snippet of original source with pointer | [
"Generate",
"position",
"and",
"snippet",
"of",
"original",
"source",
"with",
"pointer"
] | 208d1df2865143dd74ae83f42db2fdab584dc0bd | https://github.com/evanw/node-source-map-support/blob/208d1df2865143dd74ae83f42db2fdab584dc0bd/source-map-support.js#L404-L433 |
15,205 | dturing/node-gstreamer-superficial | examples/m-jpeg-streamer/server.js | function() {
appsink.pull(function(buf, caps) {
if (caps) {
//console.log("CAPS", caps);
mimeType = caps['name'];
}
if (buf) {
//console.log("BUFFER size",buf.length);
for( c in clients ) {
// write header contained in caps
clients[c].write('--'+boundary+'\... | javascript | function() {
appsink.pull(function(buf, caps) {
if (caps) {
//console.log("CAPS", caps);
mimeType = caps['name'];
}
if (buf) {
//console.log("BUFFER size",buf.length);
for( c in clients ) {
// write header contained in caps
clients[c].write('--'+boundary+'\... | [
"function",
"(",
")",
"{",
"appsink",
".",
"pull",
"(",
"function",
"(",
"buf",
",",
"caps",
")",
"{",
"if",
"(",
"caps",
")",
"{",
"//console.log(\"CAPS\", caps);",
"mimeType",
"=",
"caps",
"[",
"'name'",
"]",
";",
"}",
"if",
"(",
"buf",
")",
"{",
... | var bOnce = 1; | [
"var",
"bOnce",
"=",
"1",
";"
] | 0b569e89acf67160720563e8da88fb4562c3a253 | https://github.com/dturing/node-gstreamer-superficial/blob/0b569e89acf67160720563e8da88fb4562c3a253/examples/m-jpeg-streamer/server.js#L20-L49 | |
15,206 | fontello/ttf2eot | index.js | strbuf | function strbuf(str) {
var b = new ByteBuffer(str.length + 4);
b.setUint16 (0, str.length, true);
for (var i = 0; i < str.length; i += 2) {
b.setUint16 (i + 2, str.getUint16 (i), true);
}
b.setUint16 (b.length - 2, 0, true);
return b;
} | javascript | function strbuf(str) {
var b = new ByteBuffer(str.length + 4);
b.setUint16 (0, str.length, true);
for (var i = 0; i < str.length; i += 2) {
b.setUint16 (i + 2, str.getUint16 (i), true);
}
b.setUint16 (b.length - 2, 0, true);
return b;
} | [
"function",
"strbuf",
"(",
"str",
")",
"{",
"var",
"b",
"=",
"new",
"ByteBuffer",
"(",
"str",
".",
"length",
"+",
"4",
")",
";",
"b",
".",
"setUint16",
"(",
"0",
",",
"str",
".",
"length",
",",
"true",
")",
";",
"for",
"(",
"var",
"i",
"=",
"... | Utility function to convert buffer of utf16be chars to buffer of utf16le
chars prefixed with length and suffixed with zero | [
"Utility",
"function",
"to",
"convert",
"buffer",
"of",
"utf16be",
"chars",
"to",
"buffer",
"of",
"utf16le",
"chars",
"prefixed",
"with",
"length",
"and",
"suffixed",
"with",
"zero"
] | 6ad3ea45567eda77ba3b5986e356ab970d887203 | https://github.com/fontello/ttf2eot/blob/6ad3ea45567eda77ba3b5986e356ab970d887203/index.js#L89-L101 |
15,207 | trivago/parallel-webpack | src/watchModeIPC.js | startWatchIPCServer | function startWatchIPCServer(callback, configIndices) {
ipc.config.id = serverName;
ipc.config.retry = 3;
ipc.config.silent = true;
ipc.serve(
function() {
ipc.server.on(
'done',
watchDoneHandler.bind(this, callback, ip... | javascript | function startWatchIPCServer(callback, configIndices) {
ipc.config.id = serverName;
ipc.config.retry = 3;
ipc.config.silent = true;
ipc.serve(
function() {
ipc.server.on(
'done',
watchDoneHandler.bind(this, callback, ip... | [
"function",
"startWatchIPCServer",
"(",
"callback",
",",
"configIndices",
")",
"{",
"ipc",
".",
"config",
".",
"id",
"=",
"serverName",
";",
"ipc",
".",
"config",
".",
"retry",
"=",
"3",
";",
"ipc",
".",
"config",
".",
"silent",
"=",
"true",
";",
"ipc"... | Start IPC server and listens for 'done' message from child processes
@param {any} callback - callback invoked once 'done' has been emitted by each confugration
@param {any} configIndices - array indices of configuration | [
"Start",
"IPC",
"server",
"and",
"listens",
"for",
"done",
"message",
"from",
"child",
"processes"
] | 66da53e44a04795ab8ea705c28f9848ae5e7c7d7 | https://github.com/trivago/parallel-webpack/blob/66da53e44a04795ab8ea705c28f9848ae5e7c7d7/src/watchModeIPC.js#L12-L26 |
15,208 | trivago/parallel-webpack | index.js | run | function run(configPath, options, callback) {
var config,
argvBackup = process.argv,
farmOptions = assign({}, options);
options = options || {};
if(options.colors === undefined) {
options.colors = chalk.supportsColor;
}
if(!options.argv) {
options.argv = [];
}
... | javascript | function run(configPath, options, callback) {
var config,
argvBackup = process.argv,
farmOptions = assign({}, options);
options = options || {};
if(options.colors === undefined) {
options.colors = chalk.supportsColor;
}
if(!options.argv) {
options.argv = [];
}
... | [
"function",
"run",
"(",
"configPath",
",",
"options",
",",
"callback",
")",
"{",
"var",
"config",
",",
"argvBackup",
"=",
"process",
".",
"argv",
",",
"farmOptions",
"=",
"assign",
"(",
"{",
"}",
",",
"options",
")",
";",
"options",
"=",
"options",
"||... | Runs the specified webpack configuration in parallel.
@param {String} configPath The path to the webpack.config.js
@param {Object} options
@param {Boolean} [options.watch=false] If `true`, Webpack will run in
`watch-mode`.
@param {Number} [options.maxCallsPerWorker=Infinity] The maximum amount of calls
per parallel wor... | [
"Runs",
"the",
"specified",
"webpack",
"configuration",
"in",
"parallel",
"."
] | 66da53e44a04795ab8ea705c28f9848ae5e7c7d7 | https://github.com/trivago/parallel-webpack/blob/66da53e44a04795ab8ea705c28f9848ae5e7c7d7/index.js#L75-L162 |
15,209 | RafaelVidaurre/angular-permission | src/permission-ui/authorization/StatePermissionMap.js | StatePermissionMap | function StatePermissionMap(state) {
var toStateObject = state.$$permissionState();
var toStatePath = toStateObject.path;
angular.forEach(toStatePath, function (state) {
if (areSetStatePermissions(state)) {
var permissionMap = new PermPermissionMap(state.data.permissions);
this.extend... | javascript | function StatePermissionMap(state) {
var toStateObject = state.$$permissionState();
var toStatePath = toStateObject.path;
angular.forEach(toStatePath, function (state) {
if (areSetStatePermissions(state)) {
var permissionMap = new PermPermissionMap(state.data.permissions);
this.extend... | [
"function",
"StatePermissionMap",
"(",
"state",
")",
"{",
"var",
"toStateObject",
"=",
"state",
".",
"$$permissionState",
"(",
")",
";",
"var",
"toStatePath",
"=",
"toStateObject",
".",
"path",
";",
"angular",
".",
"forEach",
"(",
"toStatePath",
",",
"function... | Constructs map instructing authorization service how to handle authorizing
@constructor permission.ui.PermStatePermissionMap
@extends permission.PermPermissionMap | [
"Constructs",
"map",
"instructing",
"authorization",
"service",
"how",
"to",
"handle",
"authorizing"
] | 6c9762060617de02226b8ec14aaa95f434f13638 | https://github.com/RafaelVidaurre/angular-permission/blob/6c9762060617de02226b8ec14aaa95f434f13638/src/permission-ui/authorization/StatePermissionMap.js#L22-L32 |
15,210 | RafaelVidaurre/angular-permission | dist/angular-permission-ui.js | handleOnBeforeWebHook | function handleOnBeforeWebHook(transition) {
setTransitionProperties(transition);
var statePermissionMap = new PermStatePermissionMap(PermTransitionProperties.toState);
return PermStateAuthorization
.authorizeByPermissionMap(statePermissionMap)
.catch(function (rejectedPermission) {
... | javascript | function handleOnBeforeWebHook(transition) {
setTransitionProperties(transition);
var statePermissionMap = new PermStatePermissionMap(PermTransitionProperties.toState);
return PermStateAuthorization
.authorizeByPermissionMap(statePermissionMap)
.catch(function (rejectedPermission) {
... | [
"function",
"handleOnBeforeWebHook",
"(",
"transition",
")",
"{",
"setTransitionProperties",
"(",
"transition",
")",
";",
"var",
"statePermissionMap",
"=",
"new",
"PermStatePermissionMap",
"(",
"PermTransitionProperties",
".",
"toState",
")",
";",
"return",
"PermStateAu... | State transition web hook
@param transition {Object} | [
"State",
"transition",
"web",
"hook"
] | 6c9762060617de02226b8ec14aaa95f434f13638 | https://github.com/RafaelVidaurre/angular-permission/blob/6c9762060617de02226b8ec14aaa95f434f13638/dist/angular-permission-ui.js#L74-L100 |
15,211 | RafaelVidaurre/angular-permission | dist/angular-permission-ui.js | handleAuthorizedState | function handleAuthorizedState() {
PermTransitionEvents.broadcastPermissionAcceptedEvent();
// Overwrite notify option to broadcast it later
var transitionOptions = angular.extend({}, PermTransitionProperties.options, {
notify: false,
location: true
});
$sta... | javascript | function handleAuthorizedState() {
PermTransitionEvents.broadcastPermissionAcceptedEvent();
// Overwrite notify option to broadcast it later
var transitionOptions = angular.extend({}, PermTransitionProperties.options, {
notify: false,
location: true
});
$sta... | [
"function",
"handleAuthorizedState",
"(",
")",
"{",
"PermTransitionEvents",
".",
"broadcastPermissionAcceptedEvent",
"(",
")",
";",
"// Overwrite notify option to broadcast it later",
"var",
"transitionOptions",
"=",
"angular",
".",
"extend",
"(",
"{",
"}",
",",
"PermTran... | Handles redirection for authorized access
@method
@private | [
"Handles",
"redirection",
"for",
"authorized",
"access"
] | 6c9762060617de02226b8ec14aaa95f434f13638 | https://github.com/RafaelVidaurre/angular-permission/blob/6c9762060617de02226b8ec14aaa95f434f13638/dist/angular-permission-ui.js#L175-L189 |
15,212 | RafaelVidaurre/angular-permission | dist/angular-permission.js | $permission | function $permission() {
'ngInject';
var defaultOnAuthorizedMethod = 'showElement';
var defaultOnUnauthorizedMethod = 'hideElement';
var suppressUndefinedPermissionWarning = false;
/**
* Methods allowing to alter default directive onAuthorized behaviour in permission directive
* @methodO... | javascript | function $permission() {
'ngInject';
var defaultOnAuthorizedMethod = 'showElement';
var defaultOnUnauthorizedMethod = 'hideElement';
var suppressUndefinedPermissionWarning = false;
/**
* Methods allowing to alter default directive onAuthorized behaviour in permission directive
* @methodO... | [
"function",
"$permission",
"(",
")",
"{",
"'ngInject'",
";",
"var",
"defaultOnAuthorizedMethod",
"=",
"'showElement'",
";",
"var",
"defaultOnUnauthorizedMethod",
"=",
"'hideElement'",
";",
"var",
"suppressUndefinedPermissionWarning",
"=",
"false",
";",
"/**\n * Method... | Permission module configuration provider
@name permission.permissionProvider | [
"Permission",
"module",
"configuration",
"provider"
] | 6c9762060617de02226b8ec14aaa95f434f13638 | https://github.com/RafaelVidaurre/angular-permission/blob/6c9762060617de02226b8ec14aaa95f434f13638/dist/angular-permission.js#L37-L83 |
15,213 | RafaelVidaurre/angular-permission | dist/angular-permission.js | onAuthorizedAccess | function onAuthorizedAccess() {
if (angular.isFunction(permission.onAuthorized)) {
permission.onAuthorized()($element);
} else {
var onAuthorizedMethodName = $permission.defaultOnAuthorizedMethod;
PermPermissionStrategies[onAuthorizedMethodName]($element);
... | javascript | function onAuthorizedAccess() {
if (angular.isFunction(permission.onAuthorized)) {
permission.onAuthorized()($element);
} else {
var onAuthorizedMethodName = $permission.defaultOnAuthorizedMethod;
PermPermissionStrategies[onAuthorizedMethodName]($element);
... | [
"function",
"onAuthorizedAccess",
"(",
")",
"{",
"if",
"(",
"angular",
".",
"isFunction",
"(",
"permission",
".",
"onAuthorized",
")",
")",
"{",
"permission",
".",
"onAuthorized",
"(",
")",
"(",
"$element",
")",
";",
"}",
"else",
"{",
"var",
"onAuthorizedM... | Calls `onAuthorized` function if provided or show element
@private | [
"Calls",
"onAuthorized",
"function",
"if",
"provided",
"or",
"show",
"element"
] | 6c9762060617de02226b8ec14aaa95f434f13638 | https://github.com/RafaelVidaurre/angular-permission/blob/6c9762060617de02226b8ec14aaa95f434f13638/dist/angular-permission.js#L816-L823 |
15,214 | RafaelVidaurre/angular-permission | dist/angular-permission.js | onUnauthorizedAccess | function onUnauthorizedAccess() {
if (angular.isFunction(permission.onUnauthorized)) {
permission.onUnauthorized()($element);
} else {
var onUnauthorizedMethodName = $permission.defaultOnUnauthorizedMethod;
PermPermissionStrategies[onUnauthorizedMethodName]($eleme... | javascript | function onUnauthorizedAccess() {
if (angular.isFunction(permission.onUnauthorized)) {
permission.onUnauthorized()($element);
} else {
var onUnauthorizedMethodName = $permission.defaultOnUnauthorizedMethod;
PermPermissionStrategies[onUnauthorizedMethodName]($eleme... | [
"function",
"onUnauthorizedAccess",
"(",
")",
"{",
"if",
"(",
"angular",
".",
"isFunction",
"(",
"permission",
".",
"onUnauthorized",
")",
")",
"{",
"permission",
".",
"onUnauthorized",
"(",
")",
"(",
"$element",
")",
";",
"}",
"else",
"{",
"var",
"onUnaut... | Calls `onUnauthorized` function if provided or hide element
@private | [
"Calls",
"onUnauthorized",
"function",
"if",
"provided",
"or",
"hide",
"element"
] | 6c9762060617de02226b8ec14aaa95f434f13638 | https://github.com/RafaelVidaurre/angular-permission/blob/6c9762060617de02226b8ec14aaa95f434f13638/dist/angular-permission.js#L829-L836 |
15,215 | RafaelVidaurre/angular-permission | src/permission-ui/permission-ui.js | handleStateChangeStartEvent | function handleStateChangeStartEvent(event, toState, toParams, fromState, fromParams, options) {
if (!isAuthorizationFinished()) {
setStateAuthorizationStatus(true);
setTransitionProperties();
if (!PermTransitionEvents.areEventsDefaultPrevented()) {
PermTransitionEvents.broadcastPermissio... | javascript | function handleStateChangeStartEvent(event, toState, toParams, fromState, fromParams, options) {
if (!isAuthorizationFinished()) {
setStateAuthorizationStatus(true);
setTransitionProperties();
if (!PermTransitionEvents.areEventsDefaultPrevented()) {
PermTransitionEvents.broadcastPermissio... | [
"function",
"handleStateChangeStartEvent",
"(",
"event",
",",
"toState",
",",
"toParams",
",",
"fromState",
",",
"fromParams",
",",
"options",
")",
"{",
"if",
"(",
"!",
"isAuthorizationFinished",
"(",
")",
")",
"{",
"setStateAuthorizationStatus",
"(",
"true",
")... | State transition event interceptor | [
"State",
"transition",
"event",
"interceptor"
] | 6c9762060617de02226b8ec14aaa95f434f13638 | https://github.com/RafaelVidaurre/angular-permission/blob/6c9762060617de02226b8ec14aaa95f434f13638/src/permission-ui/permission-ui.js#L89-L187 |
15,216 | zachleat/BigText | demo/js/modernizr-1.6.js | set_prefixed_value_css | function set_prefixed_value_css(element, property, value, extra) {
property += ':';
element.style.cssText = (property + prefixes.join(value + ';' + property)).slice(0, -property.length) + (extra || '');
} | javascript | function set_prefixed_value_css(element, property, value, extra) {
property += ':';
element.style.cssText = (property + prefixes.join(value + ';' + property)).slice(0, -property.length) + (extra || '');
} | [
"function",
"set_prefixed_value_css",
"(",
"element",
",",
"property",
",",
"value",
",",
"extra",
")",
"{",
"property",
"+=",
"':'",
";",
"element",
".",
"style",
".",
"cssText",
"=",
"(",
"property",
"+",
"prefixes",
".",
"join",
"(",
"value",
"+",
"';... | set_prefixed_value_css sets the property of a specified element
adding vendor prefixes to the VALUE of the property.
@param {Element} element
@param {string} property The property name. This will not be prefixed.
@param {string} value The value of the property. This WILL be prefixed.
@param {string=} extra Additional C... | [
"set_prefixed_value_css",
"sets",
"the",
"property",
"of",
"a",
"specified",
"element",
"adding",
"vendor",
"prefixes",
"to",
"the",
"VALUE",
"of",
"the",
"property",
"."
] | 4649d726278fe4914e3255084ef92ce48cb14bb2 | https://github.com/zachleat/BigText/blob/4649d726278fe4914e3255084ef92ce48cb14bb2/demo/js/modernizr-1.6.js#L243-L246 |
15,217 | zachleat/BigText | demo/js/modernizr-1.6.js | set_prefixed_property_css | function set_prefixed_property_css(element, property, value, extra) {
element.style.cssText = prefixes.join(property + ':' + value + ';') + (extra || '');
} | javascript | function set_prefixed_property_css(element, property, value, extra) {
element.style.cssText = prefixes.join(property + ':' + value + ';') + (extra || '');
} | [
"function",
"set_prefixed_property_css",
"(",
"element",
",",
"property",
",",
"value",
",",
"extra",
")",
"{",
"element",
".",
"style",
".",
"cssText",
"=",
"prefixes",
".",
"join",
"(",
"property",
"+",
"':'",
"+",
"value",
"+",
"';'",
")",
"+",
"(",
... | set_prefixed_property_css sets the property of a specified element
adding vendor prefixes to the NAME of the property.
@param {Element} element
@param {string} property The property name. This WILL be prefixed.
@param {string} value The value of the property. This will not be prefixed.
@param {string=} extra Additional... | [
"set_prefixed_property_css",
"sets",
"the",
"property",
"of",
"a",
"specified",
"element",
"adding",
"vendor",
"prefixes",
"to",
"the",
"NAME",
"of",
"the",
"property",
"."
] | 4649d726278fe4914e3255084ef92ce48cb14bb2 | https://github.com/zachleat/BigText/blob/4649d726278fe4914e3255084ef92ce48cb14bb2/demo/js/modernizr-1.6.js#L257-L259 |
15,218 | zachleat/BigText | demo/js/modernizr-1.6.js | webforms | function webforms(){
// Run through HTML5's new input attributes to see if the UA understands any.
// We're using f which is the <input> element created early on
// Mike Taylr has created a comprehensive resource for testing these attributes
// when applied to all input types:
... | javascript | function webforms(){
// Run through HTML5's new input attributes to see if the UA understands any.
// We're using f which is the <input> element created early on
// Mike Taylr has created a comprehensive resource for testing these attributes
// when applied to all input types:
... | [
"function",
"webforms",
"(",
")",
"{",
"// Run through HTML5's new input attributes to see if the UA understands any.",
"// We're using f which is the <input> element created early on",
"// Mike Taylr has created a comprehensive resource for testing these attributes",
"// when applied to all input... | input features and input types go directly onto the ret object, bypassing the tests loop. Hold this guy to execute in a moment. | [
"input",
"features",
"and",
"input",
"types",
"go",
"directly",
"onto",
"the",
"ret",
"object",
"bypassing",
"the",
"tests",
"loop",
".",
"Hold",
"this",
"guy",
"to",
"execute",
"in",
"a",
"moment",
"."
] | 4649d726278fe4914e3255084ef92ce48cb14bb2 | https://github.com/zachleat/BigText/blob/4649d726278fe4914e3255084ef92ce48cb14bb2/demo/js/modernizr-1.6.js#L740-L811 |
15,219 | jeffbski/redux-logic | src/createLogicMiddleware.js | mw | function mw(store) {
if (savedStore && savedStore !== store) {
throw new Error('cannot assign logicMiddleware instance to multiple stores, create separate instance for each');
}
savedStore = store;
return next => {
savedNext = next;
const { action$, sub, logicCount: cnt } =
... | javascript | function mw(store) {
if (savedStore && savedStore !== store) {
throw new Error('cannot assign logicMiddleware instance to multiple stores, create separate instance for each');
}
savedStore = store;
return next => {
savedNext = next;
const { action$, sub, logicCount: cnt } =
... | [
"function",
"mw",
"(",
"store",
")",
"{",
"if",
"(",
"savedStore",
"&&",
"savedStore",
"!==",
"store",
")",
"{",
"throw",
"new",
"Error",
"(",
"'cannot assign logicMiddleware instance to multiple stores, create separate instance for each'",
")",
";",
"}",
"savedStore",
... | keep for uniqueness check | [
"keep",
"for",
"uniqueness",
"check"
] | 4b0951af03dbe3097e4bad5710fe274c2f3f1e6b | https://github.com/jeffbski/redux-logic/blob/4b0951af03dbe3097e4bad5710fe274c2f3f1e6b/src/createLogicMiddleware.js#L74-L97 |
15,220 | jeffbski/redux-logic | src/createLogicMiddleware.js | naming | function naming(logic, idx) {
if (logic.name) { return logic; }
return {
...logic,
name: `L(${stringifyType(logic.type)})-${idx}`
};
} | javascript | function naming(logic, idx) {
if (logic.name) { return logic; }
return {
...logic,
name: `L(${stringifyType(logic.type)})-${idx}`
};
} | [
"function",
"naming",
"(",
"logic",
",",
"idx",
")",
"{",
"if",
"(",
"logic",
".",
"name",
")",
"{",
"return",
"logic",
";",
"}",
"return",
"{",
"...",
"logic",
",",
"name",
":",
"`",
"${",
"stringifyType",
"(",
"logic",
".",
"type",
")",
"}",
"$... | Implement default names for logic using type and idx
@param {object} logic named or unnamed logic object
@param {number} idx index in the logic array
@return {object} namedLogic named logic | [
"Implement",
"default",
"names",
"for",
"logic",
"using",
"type",
"and",
"idx"
] | 4b0951af03dbe3097e4bad5710fe274c2f3f1e6b | https://github.com/jeffbski/redux-logic/blob/4b0951af03dbe3097e4bad5710fe274c2f3f1e6b/src/createLogicMiddleware.js#L244-L250 |
15,221 | jeffbski/redux-logic | src/createLogicMiddleware.js | findDuplicates | function findDuplicates(arrLogic) {
return arrLogic.reduce((acc, x1, idx1) => {
if (arrLogic.some((x2, idx2) => (idx1 !== idx2 && x1 === x2))) {
acc.push(idx1);
}
return acc;
}, []);
} | javascript | function findDuplicates(arrLogic) {
return arrLogic.reduce((acc, x1, idx1) => {
if (arrLogic.some((x2, idx2) => (idx1 !== idx2 && x1 === x2))) {
acc.push(idx1);
}
return acc;
}, []);
} | [
"function",
"findDuplicates",
"(",
"arrLogic",
")",
"{",
"return",
"arrLogic",
".",
"reduce",
"(",
"(",
"acc",
",",
"x1",
",",
"idx1",
")",
"=>",
"{",
"if",
"(",
"arrLogic",
".",
"some",
"(",
"(",
"x2",
",",
"idx2",
")",
"=>",
"(",
"idx1",
"!==",
... | Find duplicates in arrLogic by checking if ref to same logic object
@param {array} arrLogic array of logic to check
@return {array} array of indexes to duplicates, empty array if none | [
"Find",
"duplicates",
"in",
"arrLogic",
"by",
"checking",
"if",
"ref",
"to",
"same",
"logic",
"object"
] | 4b0951af03dbe3097e4bad5710fe274c2f3f1e6b | https://github.com/jeffbski/redux-logic/blob/4b0951af03dbe3097e4bad5710fe274c2f3f1e6b/src/createLogicMiddleware.js#L257-L264 |
15,222 | jeffbski/redux-logic | examples/async-await-proc-options/scripts/start.js | formatMessage | function formatMessage(message) {
return message
// Make some common errors shorter:
.replace(
// Babel syntax error
'Module build failed: SyntaxError:',
friendlySyntaxErrorLabel
)
.replace(
// Webpack file not found error
/Module not found: Error: Cannot resolve 'file' o... | javascript | function formatMessage(message) {
return message
// Make some common errors shorter:
.replace(
// Babel syntax error
'Module build failed: SyntaxError:',
friendlySyntaxErrorLabel
)
.replace(
// Webpack file not found error
/Module not found: Error: Cannot resolve 'file' o... | [
"function",
"formatMessage",
"(",
"message",
")",
"{",
"return",
"message",
"// Make some common errors shorter:",
".",
"replace",
"(",
"// Babel syntax error",
"'Module build failed: SyntaxError:'",
",",
"friendlySyntaxErrorLabel",
")",
".",
"replace",
"(",
"// Webpack file ... | This is a little hacky. It would be easier if webpack provided a rich error object. | [
"This",
"is",
"a",
"little",
"hacky",
".",
"It",
"would",
"be",
"easier",
"if",
"webpack",
"provided",
"a",
"rich",
"error",
"object",
"."
] | 4b0951af03dbe3097e4bad5710fe274c2f3f1e6b | https://github.com/jeffbski/redux-logic/blob/4b0951af03dbe3097e4bad5710fe274c2f3f1e6b/examples/async-await-proc-options/scripts/start.js#L40-L57 |
15,223 | formio/ngFormBuilder | src/components/select.js | function(components) {
var fields = [];
FormioUtils.eachComponent(components, function(component) {
if (component.key && component.input && (component.type !== 'button') && component.key !== $scope.component.key) {
var comp = _clone(component);
if (!... | javascript | function(components) {
var fields = [];
FormioUtils.eachComponent(components, function(component) {
if (component.key && component.input && (component.type !== 'button') && component.key !== $scope.component.key) {
var comp = _clone(component);
if (!... | [
"function",
"(",
"components",
")",
"{",
"var",
"fields",
"=",
"[",
"]",
";",
"FormioUtils",
".",
"eachComponent",
"(",
"components",
",",
"function",
"(",
"component",
")",
"{",
"if",
"(",
"component",
".",
"key",
"&&",
"component",
".",
"input",
"&&",
... | Returns only input fields we are interested in. | [
"Returns",
"only",
"input",
"fields",
"we",
"are",
"interested",
"in",
"."
] | ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8 | https://github.com/formio/ngFormBuilder/blob/ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8/src/components/select.js#L46-L58 | |
15,224 | formio/ngFormBuilder | src/components/select.js | function() {
if (!$scope.component.data.resource || ($scope.resources.length === 0)) {
return;
}
var selected = null;
$scope.resourceFields = [
{
property: '',
title: '{Entire Object}'
},
... | javascript | function() {
if (!$scope.component.data.resource || ($scope.resources.length === 0)) {
return;
}
var selected = null;
$scope.resourceFields = [
{
property: '',
title: '{Entire Object}'
},
... | [
"function",
"(",
")",
"{",
"if",
"(",
"!",
"$scope",
".",
"component",
".",
"data",
".",
"resource",
"||",
"(",
"$scope",
".",
"resources",
".",
"length",
"===",
"0",
")",
")",
"{",
"return",
";",
"}",
"var",
"selected",
"=",
"null",
";",
"$scope",... | Loads the selected fields. | [
"Loads",
"the",
"selected",
"fields",
"."
] | ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8 | https://github.com/formio/ngFormBuilder/blob/ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8/src/components/select.js#L63-L101 | |
15,225 | formio/ngFormBuilder | src/ngFormBuilder.js | function() {
jQuery(dropZone).removeClass('enabled');
dropZone.removeEventListener('dragover', dragOver, false);
dropZone.removeEventListener('drop', dragDrop, false);
} | javascript | function() {
jQuery(dropZone).removeClass('enabled');
dropZone.removeEventListener('dragover', dragOver, false);
dropZone.removeEventListener('drop', dragDrop, false);
} | [
"function",
"(",
")",
"{",
"jQuery",
"(",
"dropZone",
")",
".",
"removeClass",
"(",
"'enabled'",
")",
";",
"dropZone",
".",
"removeEventListener",
"(",
"'dragover'",
",",
"dragOver",
",",
"false",
")",
";",
"dropZone",
".",
"removeEventListener",
"(",
"'drop... | Drag end event handler. | [
"Drag",
"end",
"event",
"handler",
"."
] | ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8 | https://github.com/formio/ngFormBuilder/blob/ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8/src/ngFormBuilder.js#L43-L47 | |
15,226 | formio/ngFormBuilder | src/ngFormBuilder.js | function(event) {
if (event.preventDefault) {
event.preventDefault();
}
if (event.stopPropagation) {
event.stopPropagation();
}
var dropOffset = jQuery(dropZone).offset();
var dragData = angular.copy(scope.formBuilderDraggable);
dragData.fbDrop... | javascript | function(event) {
if (event.preventDefault) {
event.preventDefault();
}
if (event.stopPropagation) {
event.stopPropagation();
}
var dropOffset = jQuery(dropZone).offset();
var dragData = angular.copy(scope.formBuilderDraggable);
dragData.fbDrop... | [
"function",
"(",
"event",
")",
"{",
"if",
"(",
"event",
".",
"preventDefault",
")",
"{",
"event",
".",
"preventDefault",
"(",
")",
";",
"}",
"if",
"(",
"event",
".",
"stopPropagation",
")",
"{",
"event",
".",
"stopPropagation",
"(",
")",
";",
"}",
"v... | Drag drop event handler. | [
"Drag",
"drop",
"event",
"handler",
"."
] | ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8 | https://github.com/formio/ngFormBuilder/blob/ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8/src/ngFormBuilder.js#L50-L64 | |
15,227 | formio/ngFormBuilder | src/factories/BuilderUtils.js | function(components, input) {
// Prebuild a list of existing components.
var existingComponents = {};
FormioUtils.eachComponent(components, function(component) {
// If theres no key, we cant compare components.
if (!component.key) return;
// A component is pre-existing if the key is uniqu... | javascript | function(components, input) {
// Prebuild a list of existing components.
var existingComponents = {};
FormioUtils.eachComponent(components, function(component) {
// If theres no key, we cant compare components.
if (!component.key) return;
// A component is pre-existing if the key is uniqu... | [
"function",
"(",
"components",
",",
"input",
")",
"{",
"// Prebuild a list of existing components.",
"var",
"existingComponents",
"=",
"{",
"}",
";",
"FormioUtils",
".",
"eachComponent",
"(",
"components",
",",
"function",
"(",
"component",
")",
"{",
"// If theres n... | Memoize the given form components in a map, using the component keys.
@param {Array} components
An array of the form components.
@param {Object} input
The input component we're trying to uniquify.
@returns {Object}
The memoized form components. | [
"Memoize",
"the",
"given",
"form",
"components",
"in",
"a",
"map",
"using",
"the",
"component",
"keys",
"."
] | ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8 | https://github.com/formio/ngFormBuilder/blob/ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8/src/factories/BuilderUtils.js#L20-L37 | |
15,228 | formio/ngFormBuilder | src/factories/BuilderUtils.js | function(key) {
if (!key.match(suffixRegex)) {
return key + '2';
}
return key.replace(suffixRegex, function(suffix) {
return Number(suffix) + 1;
});
} | javascript | function(key) {
if (!key.match(suffixRegex)) {
return key + '2';
}
return key.replace(suffixRegex, function(suffix) {
return Number(suffix) + 1;
});
} | [
"function",
"(",
"key",
")",
"{",
"if",
"(",
"!",
"key",
".",
"match",
"(",
"suffixRegex",
")",
")",
"{",
"return",
"key",
"+",
"'2'",
";",
"}",
"return",
"key",
".",
"replace",
"(",
"suffixRegex",
",",
"function",
"(",
"suffix",
")",
"{",
"return"... | Iterate the given key to make it unique.
@param {String} key
Modify the component key to be unique.
@returns {String}
The new component key. | [
"Iterate",
"the",
"given",
"key",
"to",
"make",
"it",
"unique",
"."
] | ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8 | https://github.com/formio/ngFormBuilder/blob/ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8/src/factories/BuilderUtils.js#L66-L74 | |
15,229 | formio/ngFormBuilder | src/factories/BuilderUtils.js | function(form, component) {
var isNew = component.isNew || false;
// Recurse into all child components.
FormioUtils.eachComponent([component], function(component) {
// Force the component isNew to be the same as the parent.
component.isNew = isNew;
// Skip key uniquification if this comp... | javascript | function(form, component) {
var isNew = component.isNew || false;
// Recurse into all child components.
FormioUtils.eachComponent([component], function(component) {
// Force the component isNew to be the same as the parent.
component.isNew = isNew;
// Skip key uniquification if this comp... | [
"function",
"(",
"form",
",",
"component",
")",
"{",
"var",
"isNew",
"=",
"component",
".",
"isNew",
"||",
"false",
";",
"// Recurse into all child components.",
"FormioUtils",
".",
"eachComponent",
"(",
"[",
"component",
"]",
",",
"function",
"(",
"component",
... | Appends a number to a component.key to keep it unique
@param {Object} form
The components parent form.
@param {Object} component
The component to uniquify | [
"Appends",
"a",
"number",
"to",
"a",
"component",
".",
"key",
"to",
"keep",
"it",
"unique"
] | ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8 | https://github.com/formio/ngFormBuilder/blob/ba4de78ace60898e1ce25dd9a0d12d8b31f35ce8/src/factories/BuilderUtils.js#L84-L104 | |
15,230 | particle-iot/particle-cli | src/cmd/udev.js | systemSupportsUdev | function systemSupportsUdev() {
if (_systemSupportsUdev === undefined) {
try {
_systemSupportsUdev = fs.existsSync(UDEV_RULES_SYSTEM_PATH);
} catch (e) {
_systemSupportsUdev = false;
}
}
return _systemSupportsUdev;
} | javascript | function systemSupportsUdev() {
if (_systemSupportsUdev === undefined) {
try {
_systemSupportsUdev = fs.existsSync(UDEV_RULES_SYSTEM_PATH);
} catch (e) {
_systemSupportsUdev = false;
}
}
return _systemSupportsUdev;
} | [
"function",
"systemSupportsUdev",
"(",
")",
"{",
"if",
"(",
"_systemSupportsUdev",
"===",
"undefined",
")",
"{",
"try",
"{",
"_systemSupportsUdev",
"=",
"fs",
".",
"existsSync",
"(",
"UDEV_RULES_SYSTEM_PATH",
")",
";",
"}",
"catch",
"(",
"e",
")",
"{",
"_sys... | Check if the system uses udev.
@return {Boolean} | [
"Check",
"if",
"the",
"system",
"uses",
"udev",
"."
] | 50143bb34835f200b83b7eaf77cb8ab847f05a13 | https://github.com/particle-iot/particle-cli/blob/50143bb34835f200b83b7eaf77cb8ab847f05a13/src/cmd/udev.js#L23-L32 |
15,231 | particle-iot/particle-cli | src/cmd/udev.js | udevRulesInstalled | function udevRulesInstalled() {
if (_udevRulesInstalled !== undefined) {
return _udevRulesInstalled;
}
if (!systemSupportsUdev()) {
_udevRulesInstalled = false;
return false;
}
// Try to load the installed rules file
let current = null;
try {
current = fs.readFileSync(UDEV_RULES_SYSTEM_FILE);
} catch (e... | javascript | function udevRulesInstalled() {
if (_udevRulesInstalled !== undefined) {
return _udevRulesInstalled;
}
if (!systemSupportsUdev()) {
_udevRulesInstalled = false;
return false;
}
// Try to load the installed rules file
let current = null;
try {
current = fs.readFileSync(UDEV_RULES_SYSTEM_FILE);
} catch (e... | [
"function",
"udevRulesInstalled",
"(",
")",
"{",
"if",
"(",
"_udevRulesInstalled",
"!==",
"undefined",
")",
"{",
"return",
"_udevRulesInstalled",
";",
"}",
"if",
"(",
"!",
"systemSupportsUdev",
"(",
")",
")",
"{",
"_udevRulesInstalled",
"=",
"false",
";",
"ret... | Check if the system has the latest udev rules installed.
@return {Boolean} | [
"Check",
"if",
"the",
"system",
"has",
"the",
"latest",
"udev",
"rules",
"installed",
"."
] | 50143bb34835f200b83b7eaf77cb8ab847f05a13 | https://github.com/particle-iot/particle-cli/blob/50143bb34835f200b83b7eaf77cb8ab847f05a13/src/cmd/udev.js#L39-L59 |
15,232 | particle-iot/particle-cli | src/cmd/udev.js | installUdevRules | function installUdevRules() {
if (!systemSupportsUdev()) {
return when.reject(new Error('Not supported'));
}
return when.promise((resolve, reject) => {
const cmd = `sudo cp "${UDEV_RULES_ASSET_FILE}" "${UDEV_RULES_SYSTEM_FILE}"`;
console.log(cmd);
childProcess.exec(cmd, err => {
if (err) {
_udevRulesI... | javascript | function installUdevRules() {
if (!systemSupportsUdev()) {
return when.reject(new Error('Not supported'));
}
return when.promise((resolve, reject) => {
const cmd = `sudo cp "${UDEV_RULES_ASSET_FILE}" "${UDEV_RULES_SYSTEM_FILE}"`;
console.log(cmd);
childProcess.exec(cmd, err => {
if (err) {
_udevRulesI... | [
"function",
"installUdevRules",
"(",
")",
"{",
"if",
"(",
"!",
"systemSupportsUdev",
"(",
")",
")",
"{",
"return",
"when",
".",
"reject",
"(",
"new",
"Error",
"(",
"'Not supported'",
")",
")",
";",
"}",
"return",
"when",
".",
"promise",
"(",
"(",
"reso... | Install the udev rules.
@return {Promise} | [
"Install",
"the",
"udev",
"rules",
"."
] | 50143bb34835f200b83b7eaf77cb8ab847f05a13 | https://github.com/particle-iot/particle-cli/blob/50143bb34835f200b83b7eaf77cb8ab847f05a13/src/cmd/udev.js#L66-L82 |
15,233 | particle-iot/particle-cli | src/cmd/udev.js | promptAndInstallUdevRules | function promptAndInstallUdevRules(err = null) {
if (!systemSupportsUdev()) {
return when.reject(new Error('Not supported'));
}
if (udevRulesInstalled()) {
if (err) {
console.log(chalk.bold.red('Physically unplug and reconnect your Particle devices and try again.'));
return when.reject(err);
}
return w... | javascript | function promptAndInstallUdevRules(err = null) {
if (!systemSupportsUdev()) {
return when.reject(new Error('Not supported'));
}
if (udevRulesInstalled()) {
if (err) {
console.log(chalk.bold.red('Physically unplug and reconnect your Particle devices and try again.'));
return when.reject(err);
}
return w... | [
"function",
"promptAndInstallUdevRules",
"(",
"err",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"systemSupportsUdev",
"(",
")",
")",
"{",
"return",
"when",
".",
"reject",
"(",
"new",
"Error",
"(",
"'Not supported'",
")",
")",
";",
"}",
"if",
"(",
"udevRulesI... | Prompts the user to install the udev rules.
@param {Error} [err] Original error that led to this prompt.
@return {Promise} | [
"Prompts",
"the",
"user",
"to",
"install",
"the",
"udev",
"rules",
"."
] | 50143bb34835f200b83b7eaf77cb8ab847f05a13 | https://github.com/particle-iot/particle-cli/blob/50143bb34835f200b83b7eaf77cb8ab847f05a13/src/cmd/udev.js#L90-L124 |
15,234 | particle-iot/particle-cli | settings.js | matchKey | function matchKey(needle, obj, caseInsensitive) {
needle = (caseInsensitive) ? needle.toLowerCase() : needle;
for (let key in obj) {
let keyCopy = (caseInsensitive) ? key.toLowerCase() : key;
if (keyCopy === needle) {
//return the original
return key;
}
}
return null;
} | javascript | function matchKey(needle, obj, caseInsensitive) {
needle = (caseInsensitive) ? needle.toLowerCase() : needle;
for (let key in obj) {
let keyCopy = (caseInsensitive) ? key.toLowerCase() : key;
if (keyCopy === needle) {
//return the original
return key;
}
}
return null;
} | [
"function",
"matchKey",
"(",
"needle",
",",
"obj",
",",
"caseInsensitive",
")",
"{",
"needle",
"=",
"(",
"caseInsensitive",
")",
"?",
"needle",
".",
"toLowerCase",
"(",
")",
":",
"needle",
";",
"for",
"(",
"let",
"key",
"in",
"obj",
")",
"{",
"let",
... | this is here instead of utilities to prevent a require-loop when files that utilties requires need settings | [
"this",
"is",
"here",
"instead",
"of",
"utilities",
"to",
"prevent",
"a",
"require",
"-",
"loop",
"when",
"files",
"that",
"utilties",
"requires",
"need",
"settings"
] | 50143bb34835f200b83b7eaf77cb8ab847f05a13 | https://github.com/particle-iot/particle-cli/blob/50143bb34835f200b83b7eaf77cb8ab847f05a13/settings.js#L208-L220 |
15,235 | particle-iot/particle-cli | src/cmd/usb-util.js | openUsbDevice | function openUsbDevice(usbDevice, { dfuMode = false } = {}) {
if (!dfuMode && usbDevice.isInDfuMode) {
return when.reject(new Error('The device should not be in DFU mode'));
}
return when.resolve().then(() => usbDevice.open())
.catch(e => handleDeviceOpenError(e));
} | javascript | function openUsbDevice(usbDevice, { dfuMode = false } = {}) {
if (!dfuMode && usbDevice.isInDfuMode) {
return when.reject(new Error('The device should not be in DFU mode'));
}
return when.resolve().then(() => usbDevice.open())
.catch(e => handleDeviceOpenError(e));
} | [
"function",
"openUsbDevice",
"(",
"usbDevice",
",",
"{",
"dfuMode",
"=",
"false",
"}",
"=",
"{",
"}",
")",
"{",
"if",
"(",
"!",
"dfuMode",
"&&",
"usbDevice",
".",
"isInDfuMode",
")",
"{",
"return",
"when",
".",
"reject",
"(",
"new",
"Error",
"(",
"'T... | Open a USB device.
This function checks whether the user has necessary permissions to access the device.
Use this function instead of particle-usb's Device.open().
@param {Object} usbDevice USB device.
@param {Object} options Options.
@param {Boolean} [options.dfuMode] Set to `true` if the device can be in DFU mode.
... | [
"Open",
"a",
"USB",
"device",
"."
] | 50143bb34835f200b83b7eaf77cb8ab847f05a13 | https://github.com/particle-iot/particle-cli/blob/50143bb34835f200b83b7eaf77cb8ab847f05a13/src/cmd/usb-util.js#L38-L44 |
15,236 | particle-iot/particle-cli | src/cmd/usb-util.js | openUsbDeviceById | function openUsbDeviceById({ id, api, auth, dfuMode = false, displayName = null }) {
return when.resolve().then(() => {
if (isDeviceId(id)) {
// Try to open the device straight away
return openDeviceById(id).catch(e => {
if (!(e instanceof NotFoundError)) {
return handleDeviceOpenError(e);
}
})... | javascript | function openUsbDeviceById({ id, api, auth, dfuMode = false, displayName = null }) {
return when.resolve().then(() => {
if (isDeviceId(id)) {
// Try to open the device straight away
return openDeviceById(id).catch(e => {
if (!(e instanceof NotFoundError)) {
return handleDeviceOpenError(e);
}
})... | [
"function",
"openUsbDeviceById",
"(",
"{",
"id",
",",
"api",
",",
"auth",
",",
"dfuMode",
"=",
"false",
",",
"displayName",
"=",
"null",
"}",
")",
"{",
"return",
"when",
".",
"resolve",
"(",
")",
".",
"then",
"(",
"(",
")",
"=>",
"{",
"if",
"(",
... | Open a USB device with the specified device ID or name.
This function checks whether the user has necessary permissions to access the device.
Use this function instead of particle-usb's openDeviceById().
@param {Object} options Options.
@param {String} options.id Device ID or name.
@param {Object} options.api API cli... | [
"Open",
"a",
"USB",
"device",
"with",
"the",
"specified",
"device",
"ID",
"or",
"name",
"."
] | 50143bb34835f200b83b7eaf77cb8ab847f05a13 | https://github.com/particle-iot/particle-cli/blob/50143bb34835f200b83b7eaf77cb8ab847f05a13/src/cmd/usb-util.js#L60-L96 |
15,237 | particle-iot/particle-cli | src/app/command-processor.js | createErrorHandler | function createErrorHandler(yargs) {
if (!yargs) {
yargs = Yargs;
}
return consoleErrorLogger.bind(undefined, console, yargs, true);
} | javascript | function createErrorHandler(yargs) {
if (!yargs) {
yargs = Yargs;
}
return consoleErrorLogger.bind(undefined, console, yargs, true);
} | [
"function",
"createErrorHandler",
"(",
"yargs",
")",
"{",
"if",
"(",
"!",
"yargs",
")",
"{",
"yargs",
"=",
"Yargs",
";",
"}",
"return",
"consoleErrorLogger",
".",
"bind",
"(",
"undefined",
",",
"console",
",",
"yargs",
",",
"true",
")",
";",
"}"
] | Creates an error handler. The handler displays the error message if there is one,
or displays the help if there ie no error or it is a usage error.
@param {object} yargs
@returns {function(err)} the error handler function | [
"Creates",
"an",
"error",
"handler",
".",
"The",
"handler",
"displays",
"the",
"error",
"message",
"if",
"there",
"is",
"one",
"or",
"displays",
"the",
"help",
"if",
"there",
"ie",
"no",
"error",
"or",
"it",
"is",
"a",
"usage",
"error",
"."
] | 50143bb34835f200b83b7eaf77cb8ab847f05a13 | https://github.com/particle-iot/particle-cli/blob/50143bb34835f200b83b7eaf77cb8ab847f05a13/src/app/command-processor.js#L410-L415 |
15,238 | particle-iot/particle-cli | src/app/command-processor.js | parseParams | function parseParams(yargs, argv, path, params) {
let required = 0;
let optional = 0;
let variadic = false;
argv.params = {};
const extra = argv._.slice(path.length);
argv._ = argv._.slice(0, path.length);
params.replace(/(<[^>]+>|\[[^\]]+\])/g,
(match) => {
if (variadic) {
throw variadicParameterPo... | javascript | function parseParams(yargs, argv, path, params) {
let required = 0;
let optional = 0;
let variadic = false;
argv.params = {};
const extra = argv._.slice(path.length);
argv._ = argv._.slice(0, path.length);
params.replace(/(<[^>]+>|\[[^\]]+\])/g,
(match) => {
if (variadic) {
throw variadicParameterPo... | [
"function",
"parseParams",
"(",
"yargs",
",",
"argv",
",",
"path",
",",
"params",
")",
"{",
"let",
"required",
"=",
"0",
";",
"let",
"optional",
"=",
"0",
";",
"let",
"variadic",
"=",
"false",
";",
"argv",
".",
"params",
"=",
"{",
"}",
";",
"const"... | Parses parameters specified with the given command. The parsed params are stored as
`argv.params`.
@param {object} yargs The yargs command line parser
@param {Array<String>} argv The parsed command line
@param {Array<String>} path The command path the params apply to
@param {string} params The params to pa... | [
"Parses",
"parameters",
"specified",
"with",
"the",
"given",
"command",
".",
"The",
"parsed",
"params",
"are",
"stored",
"as",
"argv",
".",
"params",
"."
] | 50143bb34835f200b83b7eaf77cb8ab847f05a13 | https://github.com/particle-iot/particle-cli/blob/50143bb34835f200b83b7eaf77cb8ab847f05a13/src/app/command-processor.js#L493-L556 |
15,239 | particle-iot/particle-cli | src/app/command-processor.js | parse | function parse(command, args) {
Yargs.reset();
Yargs.wrap(Yargs.terminalWidth());
return command.parse(args, Yargs);
} | javascript | function parse(command, args) {
Yargs.reset();
Yargs.wrap(Yargs.terminalWidth());
return command.parse(args, Yargs);
} | [
"function",
"parse",
"(",
"command",
",",
"args",
")",
"{",
"Yargs",
".",
"reset",
"(",
")",
";",
"Yargs",
".",
"wrap",
"(",
"Yargs",
".",
"terminalWidth",
"(",
")",
")",
";",
"return",
"command",
".",
"parse",
"(",
"args",
",",
"Yargs",
")",
";",
... | Top-level invocation of the command processor.
@param {CLICommandItem} command
@param {Array} args
@returns {*} The argv from yargs parsing.
Options/booleans are attributes of the object. The property `clicommand` contains the command corresponding
to the requested command. `clierror` contains any error encountered dur... | [
"Top",
"-",
"level",
"invocation",
"of",
"the",
"command",
"processor",
"."
] | 50143bb34835f200b83b7eaf77cb8ab847f05a13 | https://github.com/particle-iot/particle-cli/blob/50143bb34835f200b83b7eaf77cb8ab847f05a13/src/app/command-processor.js#L602-L606 |
15,240 | particle-iot/particle-cli | src/cmd/device-util.js | getDevice | function getDevice({ id, api, auth, displayName = null, dontThrow = false }) {
const p = when.resolve().then(() => api.getDevice({ deviceId: id, auth }))
.then(r => r.body)
.catch(e => {
if (e.statusCode === 403 || e.statusCode === 404) {
if (dontThrow) {
return null;
}
throw new Error(`Device ... | javascript | function getDevice({ id, api, auth, displayName = null, dontThrow = false }) {
const p = when.resolve().then(() => api.getDevice({ deviceId: id, auth }))
.then(r => r.body)
.catch(e => {
if (e.statusCode === 403 || e.statusCode === 404) {
if (dontThrow) {
return null;
}
throw new Error(`Device ... | [
"function",
"getDevice",
"(",
"{",
"id",
",",
"api",
",",
"auth",
",",
"displayName",
"=",
"null",
",",
"dontThrow",
"=",
"false",
"}",
")",
"{",
"const",
"p",
"=",
"when",
".",
"resolve",
"(",
")",
".",
"then",
"(",
"(",
")",
"=>",
"api",
".",
... | Get device attributes.
@param {Object} options Options.
@param {String} options.id Device ID or name.
@param {Object} options.api API client.
@param {String} options.auth Access token.
@param {String} [options.displayName] Device name as shown to the user.
@param {Boolean} [options.dontThrow] Return 'null' instead of ... | [
"Get",
"device",
"attributes",
"."
] | 50143bb34835f200b83b7eaf77cb8ab847f05a13 | https://github.com/particle-iot/particle-cli/blob/50143bb34835f200b83b7eaf77cb8ab847f05a13/src/cmd/device-util.js#L39-L52 |
15,241 | byteball/ocore | proof_chain.js | buildProofChain | function buildProofChain(later_mci, earlier_mci, unit, arrBalls, onDone){
if (earlier_mci === null)
throw Error("earlier_mci=null, unit="+unit);
if (later_mci === earlier_mci)
return buildLastMileOfProofChain(earlier_mci, unit, arrBalls, onDone);
buildProofChainOnMc(later_mci, earlier_mci, arrBalls, function(){
... | javascript | function buildProofChain(later_mci, earlier_mci, unit, arrBalls, onDone){
if (earlier_mci === null)
throw Error("earlier_mci=null, unit="+unit);
if (later_mci === earlier_mci)
return buildLastMileOfProofChain(earlier_mci, unit, arrBalls, onDone);
buildProofChainOnMc(later_mci, earlier_mci, arrBalls, function(){
... | [
"function",
"buildProofChain",
"(",
"later_mci",
",",
"earlier_mci",
",",
"unit",
",",
"arrBalls",
",",
"onDone",
")",
"{",
"if",
"(",
"earlier_mci",
"===",
"null",
")",
"throw",
"Error",
"(",
"\"earlier_mci=null, unit=\"",
"+",
"unit",
")",
";",
"if",
"(",
... | unit's MC index is earlier_mci | [
"unit",
"s",
"MC",
"index",
"is",
"earlier_mci"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/proof_chain.js#L9-L17 |
15,242 | byteball/ocore | proof_chain.js | buildProofChainOnMc | function buildProofChainOnMc(later_mci, earlier_mci, arrBalls, onDone){
function addBall(mci){
if (mci < 0)
throw Error("mci<0, later_mci="+later_mci+", earlier_mci="+earlier_mci);
db.query("SELECT unit, ball, content_hash FROM units JOIN balls USING(unit) WHERE main_chain_index=? AND is_on_main_chain=1", [mc... | javascript | function buildProofChainOnMc(later_mci, earlier_mci, arrBalls, onDone){
function addBall(mci){
if (mci < 0)
throw Error("mci<0, later_mci="+later_mci+", earlier_mci="+earlier_mci);
db.query("SELECT unit, ball, content_hash FROM units JOIN balls USING(unit) WHERE main_chain_index=? AND is_on_main_chain=1", [mc... | [
"function",
"buildProofChainOnMc",
"(",
"later_mci",
",",
"earlier_mci",
",",
"arrBalls",
",",
"onDone",
")",
"{",
"function",
"addBall",
"(",
"mci",
")",
"{",
"if",
"(",
"mci",
"<",
"0",
")",
"throw",
"Error",
"(",
"\"mci<0, later_mci=\"",
"+",
"later_mci",... | later_mci is already known and not included in the chain | [
"later_mci",
"is",
"already",
"known",
"and",
"not",
"included",
"in",
"the",
"chain"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/proof_chain.js#L20-L74 |
15,243 | byteball/ocore | proof_chain.js | buildLastMileOfProofChain | function buildLastMileOfProofChain(mci, unit, arrBalls, onDone){
function addBall(_unit){
db.query("SELECT unit, ball, content_hash FROM units JOIN balls USING(unit) WHERE unit=?", [_unit], function(rows){
if (rows.length !== 1)
throw Error("no unit?");
var objBall = rows[0];
if (objBall.content_hash)
... | javascript | function buildLastMileOfProofChain(mci, unit, arrBalls, onDone){
function addBall(_unit){
db.query("SELECT unit, ball, content_hash FROM units JOIN balls USING(unit) WHERE unit=?", [_unit], function(rows){
if (rows.length !== 1)
throw Error("no unit?");
var objBall = rows[0];
if (objBall.content_hash)
... | [
"function",
"buildLastMileOfProofChain",
"(",
"mci",
",",
"unit",
",",
"arrBalls",
",",
"onDone",
")",
"{",
"function",
"addBall",
"(",
"_unit",
")",
"{",
"db",
".",
"query",
"(",
"\"SELECT unit, ball, content_hash FROM units JOIN balls USING(unit) WHERE unit=?\"",
",",... | unit's MC index is mci, find a path from mci unit to this unit | [
"unit",
"s",
"MC",
"index",
"is",
"mci",
"find",
"a",
"path",
"from",
"mci",
"unit",
"to",
"this",
"unit"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/proof_chain.js#L77-L149 |
15,244 | byteball/ocore | composer.js | composeTextJoint | function composeTextJoint(arrSigningAddresses, arrPayingAddresses, text, signer, callbacks){
composePaymentAndTextJoint(arrSigningAddresses, arrPayingAddresses, [{address: arrPayingAddresses[0], amount: 0}], text, signer, callbacks);
} | javascript | function composeTextJoint(arrSigningAddresses, arrPayingAddresses, text, signer, callbacks){
composePaymentAndTextJoint(arrSigningAddresses, arrPayingAddresses, [{address: arrPayingAddresses[0], amount: 0}], text, signer, callbacks);
} | [
"function",
"composeTextJoint",
"(",
"arrSigningAddresses",
",",
"arrPayingAddresses",
",",
"text",
",",
"signer",
",",
"callbacks",
")",
"{",
"composePaymentAndTextJoint",
"(",
"arrSigningAddresses",
",",
"arrPayingAddresses",
",",
"[",
"{",
"address",
":",
"arrPayin... | change goes back to the first paying address | [
"change",
"goes",
"back",
"to",
"the",
"first",
"paying",
"address"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/composer.js#L50-L52 |
15,245 | byteball/ocore | composer.js | function(cb){
if (!fnRetrieveMessages)
return cb();
console.log("will retrieve messages");
fnRetrieveMessages(conn, last_ball_mci, bMultiAuthored, arrPayingAddresses, function(err, arrMoreMessages, assocMorePrivatePayloads){
console.log("fnRetrieveMessages callback: err code = "+(err ? err.error_code :... | javascript | function(cb){
if (!fnRetrieveMessages)
return cb();
console.log("will retrieve messages");
fnRetrieveMessages(conn, last_ball_mci, bMultiAuthored, arrPayingAddresses, function(err, arrMoreMessages, assocMorePrivatePayloads){
console.log("fnRetrieveMessages callback: err code = "+(err ? err.error_code :... | [
"function",
"(",
"cb",
")",
"{",
"if",
"(",
"!",
"fnRetrieveMessages",
")",
"return",
"cb",
"(",
")",
";",
"console",
".",
"log",
"(",
"\"will retrieve messages\"",
")",
";",
"fnRetrieveMessages",
"(",
"conn",
",",
"last_ball_mci",
",",
"bMultiAuthored",
","... | messages retrieved via callback | [
"messages",
"retrieved",
"via",
"callback"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/composer.js#L385-L399 | |
15,246 | byteball/ocore | storage.js | readJointWithBall | function readJointWithBall(conn, unit, handleJoint) {
readJoint(conn, unit, {
ifNotFound: function(){
throw Error("joint not found, unit "+unit);
},
ifFound: function(objJoint){
if (objJoint.ball)
return handleJoint(objJoint);
conn.query("SELECT ball FROM balls WHERE unit=?", [unit], function(rows){... | javascript | function readJointWithBall(conn, unit, handleJoint) {
readJoint(conn, unit, {
ifNotFound: function(){
throw Error("joint not found, unit "+unit);
},
ifFound: function(objJoint){
if (objJoint.ball)
return handleJoint(objJoint);
conn.query("SELECT ball FROM balls WHERE unit=?", [unit], function(rows){... | [
"function",
"readJointWithBall",
"(",
"conn",
",",
"unit",
",",
"handleJoint",
")",
"{",
"readJoint",
"(",
"conn",
",",
"unit",
",",
"{",
"ifNotFound",
":",
"function",
"(",
")",
"{",
"throw",
"Error",
"(",
"\"joint not found, unit \"",
"+",
"unit",
")",
"... | add .ball even if it is not retrievable | [
"add",
".",
"ball",
"even",
"if",
"it",
"is",
"not",
"retrievable"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/storage.js#L524-L539 |
15,247 | byteball/ocore | storage.js | determineBestParent | function determineBestParent(conn, objUnit, arrWitnesses, handleBestParent){
// choose best parent among compatible parents only
conn.query(
"SELECT unit \n\
FROM units AS parent_units \n\
WHERE unit IN(?) \n\
AND (witness_list_unit=? OR ( \n\
SELECT COUNT(*) \n\
FROM unit_witnesses AS parent_witness... | javascript | function determineBestParent(conn, objUnit, arrWitnesses, handleBestParent){
// choose best parent among compatible parents only
conn.query(
"SELECT unit \n\
FROM units AS parent_units \n\
WHERE unit IN(?) \n\
AND (witness_list_unit=? OR ( \n\
SELECT COUNT(*) \n\
FROM unit_witnesses AS parent_witness... | [
"function",
"determineBestParent",
"(",
"conn",
",",
"objUnit",
",",
"arrWitnesses",
",",
"handleBestParent",
")",
"{",
"// choose best parent among compatible parents only",
"conn",
".",
"query",
"(",
"\"SELECT unit \\n\\\n\t\tFROM units AS parent_units \\n\\\n\t\tWHERE unit IN(?)... | for unit that is not saved to the db yet | [
"for",
"unit",
"that",
"is",
"not",
"saved",
"to",
"the",
"db",
"yet"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/storage.js#L1145-L1169 |
15,248 | byteball/ocore | storage.js | buildListOfMcUnitsWithPotentiallyDifferentWitnesslists | function buildListOfMcUnitsWithPotentiallyDifferentWitnesslists(conn, objUnit, last_ball_unit, arrWitnesses, handleList){
function addAndGoUp(unit){
readStaticUnitProps(conn, unit, function(props){
// the parent has the same witness list and the parent has already passed the MC compatibility test
if (objUnit.... | javascript | function buildListOfMcUnitsWithPotentiallyDifferentWitnesslists(conn, objUnit, last_ball_unit, arrWitnesses, handleList){
function addAndGoUp(unit){
readStaticUnitProps(conn, unit, function(props){
// the parent has the same witness list and the parent has already passed the MC compatibility test
if (objUnit.... | [
"function",
"buildListOfMcUnitsWithPotentiallyDifferentWitnesslists",
"(",
"conn",
",",
"objUnit",
",",
"last_ball_unit",
",",
"arrWitnesses",
",",
"handleList",
")",
"{",
"function",
"addAndGoUp",
"(",
"unit",
")",
"{",
"readStaticUnitProps",
"(",
"conn",
",",
"unit"... | the MC for this function is the MC built from this unit, not our current MC | [
"the",
"MC",
"for",
"this",
"function",
"is",
"the",
"MC",
"built",
"from",
"this",
"unit",
"not",
"our",
"current",
"MC"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/storage.js#L1198-L1221 |
15,249 | byteball/ocore | private_profile.js | savePrivateProfile | function savePrivateProfile(objPrivateProfile, address, attestor_address, onDone){
db.query(
"INSERT "+db.getIgnore()+" INTO private_profiles (unit, payload_hash, attestor_address, address, src_profile) VALUES(?,?,?,?,?)",
[objPrivateProfile.unit, objPrivateProfile.payload_hash, attestor_address, address, JSON.st... | javascript | function savePrivateProfile(objPrivateProfile, address, attestor_address, onDone){
db.query(
"INSERT "+db.getIgnore()+" INTO private_profiles (unit, payload_hash, attestor_address, address, src_profile) VALUES(?,?,?,?,?)",
[objPrivateProfile.unit, objPrivateProfile.payload_hash, attestor_address, address, JSON.st... | [
"function",
"savePrivateProfile",
"(",
"objPrivateProfile",
",",
"address",
",",
"attestor_address",
",",
"onDone",
")",
"{",
"db",
".",
"query",
"(",
"\"INSERT \"",
"+",
"db",
".",
"getIgnore",
"(",
")",
"+",
"\" INTO private_profiles (unit, payload_hash, attestor_ad... | the profile can be mine or peer's | [
"the",
"profile",
"can",
"be",
"mine",
"or",
"peer",
"s"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/private_profile.js#L97-L139 |
15,250 | byteball/ocore | writer.js | updateWitnessedLevelByWitnesslist | function updateWitnessedLevelByWitnesslist(arrWitnesses, cb){
var arrCollectedWitnesses = [];
function setWitnessedLevel(witnessed_level){
profiler.start();
if (witnessed_level !== objValidationState.witnessed_level)
throwError("different witnessed levels, validation: "+objValidationState.witness... | javascript | function updateWitnessedLevelByWitnesslist(arrWitnesses, cb){
var arrCollectedWitnesses = [];
function setWitnessedLevel(witnessed_level){
profiler.start();
if (witnessed_level !== objValidationState.witnessed_level)
throwError("different witnessed levels, validation: "+objValidationState.witness... | [
"function",
"updateWitnessedLevelByWitnesslist",
"(",
"arrWitnesses",
",",
"cb",
")",
"{",
"var",
"arrCollectedWitnesses",
"=",
"[",
"]",
";",
"function",
"setWitnessedLevel",
"(",
"witnessed_level",
")",
"{",
"profiler",
".",
"start",
"(",
")",
";",
"if",
"(",
... | The level at which we collect at least 7 distinct witnesses while walking up the main chain from our unit. The unit itself is not counted even if it is authored by a witness | [
"The",
"level",
"at",
"which",
"we",
"collect",
"at",
"least",
"7",
"distinct",
"witnesses",
"while",
"walking",
"up",
"the",
"main",
"chain",
"from",
"our",
"unit",
".",
"The",
"unit",
"itself",
"is",
"not",
"counted",
"even",
"if",
"it",
"is",
"authore... | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/writer.js#L453-L495 |
15,251 | byteball/ocore | wallet_defined_by_addresses.js | sendToPeerAllSharedAddressesHavingUnspentOutputs | function sendToPeerAllSharedAddressesHavingUnspentOutputs(device_address, asset, callbacks){
var asset_filter = !asset || asset == "base" ? " AND outputs.asset IS NULL " : " AND outputs.asset='"+asset+"'";
db.query(
"SELECT DISTINCT shared_address FROM shared_address_signing_paths CROSS JOIN outputs ON shared_addre... | javascript | function sendToPeerAllSharedAddressesHavingUnspentOutputs(device_address, asset, callbacks){
var asset_filter = !asset || asset == "base" ? " AND outputs.asset IS NULL " : " AND outputs.asset='"+asset+"'";
db.query(
"SELECT DISTINCT shared_address FROM shared_address_signing_paths CROSS JOIN outputs ON shared_addre... | [
"function",
"sendToPeerAllSharedAddressesHavingUnspentOutputs",
"(",
"device_address",
",",
"asset",
",",
"callbacks",
")",
"{",
"var",
"asset_filter",
"=",
"!",
"asset",
"||",
"asset",
"==",
"\"base\"",
"?",
"\" AND outputs.asset IS NULL \"",
":",
"\" AND outputs.asset='... | when a peer has lost shared address definitions after a wallet recovery, we can resend them | [
"when",
"a",
"peer",
"has",
"lost",
"shared",
"address",
"definitions",
"after",
"a",
"wallet",
"recovery",
"we",
"can",
"resend",
"them"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_defined_by_addresses.js#L52-L68 |
15,252 | byteball/ocore | wallet_defined_by_addresses.js | sendSharedAddressToPeer | function sendSharedAddressToPeer(device_address, shared_address, handle){
var arrDefinition;
var assocSignersByPath={};
async.series([
function(cb){
db.query("SELECT definition FROM shared_addresses WHERE shared_address=?", [shared_address], function(rows){
if (!rows[0])
return cb("Definition not found... | javascript | function sendSharedAddressToPeer(device_address, shared_address, handle){
var arrDefinition;
var assocSignersByPath={};
async.series([
function(cb){
db.query("SELECT definition FROM shared_addresses WHERE shared_address=?", [shared_address], function(rows){
if (!rows[0])
return cb("Definition not found... | [
"function",
"sendSharedAddressToPeer",
"(",
"device_address",
",",
"shared_address",
",",
"handle",
")",
"{",
"var",
"arrDefinition",
";",
"var",
"assocSignersByPath",
"=",
"{",
"}",
";",
"async",
".",
"series",
"(",
"[",
"function",
"(",
"cb",
")",
"{",
"db... | read shared address definition and signing paths then send them to peer | [
"read",
"shared",
"address",
"definition",
"and",
"signing",
"paths",
"then",
"send",
"them",
"to",
"peer"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_defined_by_addresses.js#L71-L100 |
15,253 | byteball/ocore | wallet_defined_by_addresses.js | addNewSharedAddress | function addNewSharedAddress(address, arrDefinition, assocSignersByPath, bForwarded, onDone){
// network.addWatchedAddress(address);
db.query(
"INSERT "+db.getIgnore()+" INTO shared_addresses (shared_address, definition) VALUES (?,?)",
[address, JSON.stringify(arrDefinition)],
function(){
var arrQueries = [... | javascript | function addNewSharedAddress(address, arrDefinition, assocSignersByPath, bForwarded, onDone){
// network.addWatchedAddress(address);
db.query(
"INSERT "+db.getIgnore()+" INTO shared_addresses (shared_address, definition) VALUES (?,?)",
[address, JSON.stringify(arrDefinition)],
function(){
var arrQueries = [... | [
"function",
"addNewSharedAddress",
"(",
"address",
",",
"arrDefinition",
",",
"assocSignersByPath",
",",
"bForwarded",
",",
"onDone",
")",
"{",
"//\tnetwork.addWatchedAddress(address);",
"db",
".",
"query",
"(",
"\"INSERT \"",
"+",
"db",
".",
"getIgnore",
"(",
")",
... | called from network after the initiator collects approvals from all members of the address and then sends the completed address to all members member_signing_path is now deprecated and unused shared_address_signing_paths.signing_path is now path to member-address, not full path to a signing key | [
"called",
"from",
"network",
"after",
"the",
"initiator",
"collects",
"approvals",
"from",
"all",
"members",
"of",
"the",
"address",
"and",
"then",
"sends",
"the",
"completed",
"address",
"to",
"all",
"members",
"member_signing_path",
"is",
"now",
"deprecated",
... | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_defined_by_addresses.js#L239-L265 |
15,254 | byteball/ocore | wallet_defined_by_addresses.js | readSharedAddressCosigners | function readSharedAddressCosigners(shared_address, handleCosigners){
db.query(
"SELECT DISTINCT shared_address_signing_paths.device_address, name, "+db.getUnixTimestamp("shared_addresses.creation_date")+" AS creation_ts \n\
FROM shared_address_signing_paths \n\
JOIN shared_addresses USING(shared_address) \n\
... | javascript | function readSharedAddressCosigners(shared_address, handleCosigners){
db.query(
"SELECT DISTINCT shared_address_signing_paths.device_address, name, "+db.getUnixTimestamp("shared_addresses.creation_date")+" AS creation_ts \n\
FROM shared_address_signing_paths \n\
JOIN shared_addresses USING(shared_address) \n\
... | [
"function",
"readSharedAddressCosigners",
"(",
"shared_address",
",",
"handleCosigners",
")",
"{",
"db",
".",
"query",
"(",
"\"SELECT DISTINCT shared_address_signing_paths.device_address, name, \"",
"+",
"db",
".",
"getUnixTimestamp",
"(",
"\"shared_addresses.creation_date\"",
... | returns information about cosigner devices | [
"returns",
"information",
"about",
"cosigner",
"devices"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_defined_by_addresses.js#L528-L542 |
15,255 | byteball/ocore | wallet_defined_by_addresses.js | readSharedAddressPeerAddresses | function readSharedAddressPeerAddresses(shared_address, handlePeerAddresses){
readSharedAddressPeers(shared_address, function(assocNamesByAddress){
handlePeerAddresses(Object.keys(assocNamesByAddress));
});
} | javascript | function readSharedAddressPeerAddresses(shared_address, handlePeerAddresses){
readSharedAddressPeers(shared_address, function(assocNamesByAddress){
handlePeerAddresses(Object.keys(assocNamesByAddress));
});
} | [
"function",
"readSharedAddressPeerAddresses",
"(",
"shared_address",
",",
"handlePeerAddresses",
")",
"{",
"readSharedAddressPeers",
"(",
"shared_address",
",",
"function",
"(",
"assocNamesByAddress",
")",
"{",
"handlePeerAddresses",
"(",
"Object",
".",
"keys",
"(",
"as... | returns list of payment addresses of peers | [
"returns",
"list",
"of",
"payment",
"addresses",
"of",
"peers"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_defined_by_addresses.js#L545-L549 |
15,256 | byteball/ocore | device.js | readMessageInChunksFromOutbox | function readMessageInChunksFromOutbox(message_hash, len, handleMessage){
var CHUNK_LEN = 1000000;
var start = 1;
var message = '';
function readChunk(){
db.query("SELECT SUBSTR(message, ?, ?) AS chunk FROM outbox WHERE message_hash=?", [start, CHUNK_LEN, message_hash], function(rows){
if (rows.length === 0)
... | javascript | function readMessageInChunksFromOutbox(message_hash, len, handleMessage){
var CHUNK_LEN = 1000000;
var start = 1;
var message = '';
function readChunk(){
db.query("SELECT SUBSTR(message, ?, ?) AS chunk FROM outbox WHERE message_hash=?", [start, CHUNK_LEN, message_hash], function(rows){
if (rows.length === 0)
... | [
"function",
"readMessageInChunksFromOutbox",
"(",
"message_hash",
",",
"len",
",",
"handleMessage",
")",
"{",
"var",
"CHUNK_LEN",
"=",
"1000000",
";",
"var",
"start",
"=",
"1",
";",
"var",
"message",
"=",
"''",
";",
"function",
"readChunk",
"(",
")",
"{",
... | a hack to read large text from cordova sqlite | [
"a",
"hack",
"to",
"read",
"large",
"text",
"from",
"cordova",
"sqlite"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/device.js#L355-L371 |
15,257 | byteball/ocore | device.js | sendPreparedMessageToConnectedHub | function sendPreparedMessageToConnectedHub(ws, recipient_device_pubkey, message_hash, json, callbacks){
network.sendRequest(ws, 'hub/get_temp_pubkey', recipient_device_pubkey, false, function(ws, request, response){
function handleError(error){
callbacks.ifError(error);
db.query("UPDATE outbox SET last_error=?... | javascript | function sendPreparedMessageToConnectedHub(ws, recipient_device_pubkey, message_hash, json, callbacks){
network.sendRequest(ws, 'hub/get_temp_pubkey', recipient_device_pubkey, false, function(ws, request, response){
function handleError(error){
callbacks.ifError(error);
db.query("UPDATE outbox SET last_error=?... | [
"function",
"sendPreparedMessageToConnectedHub",
"(",
"ws",
",",
"recipient_device_pubkey",
",",
"message_hash",
",",
"json",
",",
"callbacks",
")",
"{",
"network",
".",
"sendRequest",
"(",
"ws",
",",
"'hub/get_temp_pubkey'",
",",
"recipient_device_pubkey",
",",
"fals... | first param is WebSocket only | [
"first",
"param",
"is",
"WebSocket",
"only"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/device.js#L462-L495 |
15,258 | byteball/ocore | device.js | sendMessageToHub | function sendMessageToHub(ws, recipient_device_pubkey, subject, body, callbacks, conn){
// this content is hidden from the hub by encryption
var json = {
from: my_device_address, // presence of this field guarantees that you cannot strip off the signature and add your own signature instead
device_hub: my_device_h... | javascript | function sendMessageToHub(ws, recipient_device_pubkey, subject, body, callbacks, conn){
// this content is hidden from the hub by encryption
var json = {
from: my_device_address, // presence of this field guarantees that you cannot strip off the signature and add your own signature instead
device_hub: my_device_h... | [
"function",
"sendMessageToHub",
"(",
"ws",
",",
"recipient_device_pubkey",
",",
"subject",
",",
"body",
",",
"callbacks",
",",
"conn",
")",
"{",
"// this content is hidden from the hub by encryption",
"var",
"json",
"=",
"{",
"from",
":",
"my_device_address",
",",
"... | first param is either WebSocket or hostname of the hub or null | [
"first",
"param",
"is",
"either",
"WebSocket",
"or",
"hostname",
"of",
"the",
"hub",
"or",
"null"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/device.js#L536-L553 |
15,259 | byteball/ocore | witness_proof.js | validateUnit | function validateUnit(objUnit, bRequireDefinitionOrChange, cb2){
var bFound = false;
async.eachSeries(
objUnit.authors,
function(author, cb3){
var address = author.address;
// if (arrWitnesses.indexOf(address) === -1) // not a witness - skip it
// return cb3();
var definition_chash = assocDefin... | javascript | function validateUnit(objUnit, bRequireDefinitionOrChange, cb2){
var bFound = false;
async.eachSeries(
objUnit.authors,
function(author, cb3){
var address = author.address;
// if (arrWitnesses.indexOf(address) === -1) // not a witness - skip it
// return cb3();
var definition_chash = assocDefin... | [
"function",
"validateUnit",
"(",
"objUnit",
",",
"bRequireDefinitionOrChange",
",",
"cb2",
")",
"{",
"var",
"bFound",
"=",
"false",
";",
"async",
".",
"eachSeries",
"(",
"objUnit",
".",
"authors",
",",
"function",
"(",
"author",
",",
"cb3",
")",
"{",
"var"... | keyed by address checks signatures and updates definitions | [
"keyed",
"by",
"address",
"checks",
"signatures",
"and",
"updates",
"definitions"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/witness_proof.js#L180-L242 |
15,260 | byteball/ocore | joint_storage.js | readDependentJointsThatAreReady | function readDependentJointsThatAreReady(unit, handleDependentJoint){
//console.log("readDependentJointsThatAreReady "+unit);
var t=Date.now();
var from = unit ? "FROM dependencies AS src_deps JOIN dependencies USING(unit)" : "FROM dependencies";
var where = unit ? "WHERE src_deps.depends_on_unit="+db.escape(unit) ... | javascript | function readDependentJointsThatAreReady(unit, handleDependentJoint){
//console.log("readDependentJointsThatAreReady "+unit);
var t=Date.now();
var from = unit ? "FROM dependencies AS src_deps JOIN dependencies USING(unit)" : "FROM dependencies";
var where = unit ? "WHERE src_deps.depends_on_unit="+db.escape(unit) ... | [
"function",
"readDependentJointsThatAreReady",
"(",
"unit",
",",
"handleDependentJoint",
")",
"{",
"//console.log(\"readDependentJointsThatAreReady \"+unit);",
"var",
"t",
"=",
"Date",
".",
"now",
"(",
")",
";",
"var",
"from",
"=",
"unit",
"?",
"\"FROM dependencies AS s... | handleDependentJoint called for each dependent unit | [
"handleDependentJoint",
"called",
"for",
"each",
"dependent",
"unit"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/joint_storage.js#L88-L119 |
15,261 | byteball/ocore | joint_storage.js | readJointsSinceMci | function readJointsSinceMci(mci, handleJoint, onDone){
db.query(
"SELECT units.unit FROM units LEFT JOIN archived_joints USING(unit) \n\
WHERE (is_stable=0 AND main_chain_index>=? OR main_chain_index IS NULL OR is_free=1) AND archived_joints.unit IS NULL \n\
ORDER BY +level",
[mci],
function(rows){
asyn... | javascript | function readJointsSinceMci(mci, handleJoint, onDone){
db.query(
"SELECT units.unit FROM units LEFT JOIN archived_joints USING(unit) \n\
WHERE (is_stable=0 AND main_chain_index>=? OR main_chain_index IS NULL OR is_free=1) AND archived_joints.unit IS NULL \n\
ORDER BY +level",
[mci],
function(rows){
asyn... | [
"function",
"readJointsSinceMci",
"(",
"mci",
",",
"handleJoint",
",",
"onDone",
")",
"{",
"db",
".",
"query",
"(",
"\"SELECT units.unit FROM units LEFT JOIN archived_joints USING(unit) \\n\\\n\t\tWHERE (is_stable=0 AND main_chain_index>=? OR main_chain_index IS NULL OR is_free=1) AND ar... | handleJoint is called for every joint younger than mci | [
"handleJoint",
"is",
"called",
"for",
"every",
"joint",
"younger",
"than",
"mci"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/joint_storage.js#L294-L320 |
15,262 | byteball/ocore | validation_utils.js | hasFieldsExcept | function hasFieldsExcept(obj, arrFields){
for (var field in obj)
if (arrFields.indexOf(field) === -1)
return true;
return false;
} | javascript | function hasFieldsExcept(obj, arrFields){
for (var field in obj)
if (arrFields.indexOf(field) === -1)
return true;
return false;
} | [
"function",
"hasFieldsExcept",
"(",
"obj",
",",
"arrFields",
")",
"{",
"for",
"(",
"var",
"field",
"in",
"obj",
")",
"if",
"(",
"arrFields",
".",
"indexOf",
"(",
"field",
")",
"===",
"-",
"1",
")",
"return",
"true",
";",
"return",
"false",
";",
"}"
] | True if there is at least one field in obj that is not in arrFields. | [
"True",
"if",
"there",
"is",
"at",
"least",
"one",
"field",
"in",
"obj",
"that",
"is",
"not",
"in",
"arrFields",
"."
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/validation_utils.js#L8-L13 |
15,263 | byteball/ocore | inputs.js | addInput | function addInput(input){
total_amount += input.amount;
var objInputWithProof = {input: input};
if (objAsset && objAsset.is_private){ // for type=payment only
var spend_proof = objectHash.getBase64Hash({
asset: asset,
amount: input.amount,
address: input.address,
unit: input.unit,
message_i... | javascript | function addInput(input){
total_amount += input.amount;
var objInputWithProof = {input: input};
if (objAsset && objAsset.is_private){ // for type=payment only
var spend_proof = objectHash.getBase64Hash({
asset: asset,
amount: input.amount,
address: input.address,
unit: input.unit,
message_i... | [
"function",
"addInput",
"(",
"input",
")",
"{",
"total_amount",
"+=",
"input",
".",
"amount",
";",
"var",
"objInputWithProof",
"=",
"{",
"input",
":",
"input",
"}",
";",
"if",
"(",
"objAsset",
"&&",
"objAsset",
".",
"is_private",
")",
"{",
"// for type=pay... | adds element to arrInputsWithProofs | [
"adds",
"element",
"to",
"arrInputsWithProofs"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/inputs.js#L53-L76 |
15,264 | byteball/ocore | inputs.js | pickOneCoinJustBiggerAndContinue | function pickOneCoinJustBiggerAndContinue(){
if (amount === Infinity)
return pickMultipleCoinsAndContinue();
var more = is_base ? '>' : '>=';
conn.query(
"SELECT unit, message_index, output_index, amount, blinding, address \n\
FROM outputs \n\
CROSS JOIN units USING(unit) \n\
WHERE address IN(?) AN... | javascript | function pickOneCoinJustBiggerAndContinue(){
if (amount === Infinity)
return pickMultipleCoinsAndContinue();
var more = is_base ? '>' : '>=';
conn.query(
"SELECT unit, message_index, output_index, amount, blinding, address \n\
FROM outputs \n\
CROSS JOIN units USING(unit) \n\
WHERE address IN(?) AN... | [
"function",
"pickOneCoinJustBiggerAndContinue",
"(",
")",
"{",
"if",
"(",
"amount",
"===",
"Infinity",
")",
"return",
"pickMultipleCoinsAndContinue",
"(",
")",
";",
"var",
"more",
"=",
"is_base",
"?",
"'>'",
":",
"'>='",
";",
"conn",
".",
"query",
"(",
"\"SE... | first, try to find a coin just bigger than the required amount | [
"first",
"try",
"to",
"find",
"a",
"coin",
"just",
"bigger",
"than",
"the",
"required",
"amount"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/inputs.js#L79-L102 |
15,265 | byteball/ocore | inputs.js | pickMultipleCoinsAndContinue | function pickMultipleCoinsAndContinue(){
conn.query(
"SELECT unit, message_index, output_index, amount, address, blinding \n\
FROM outputs \n\
CROSS JOIN units USING(unit) \n\
WHERE address IN(?) AND asset"+(asset ? "="+conn.escape(asset) : " IS NULL")+" AND is_spent=0 \n\
AND sequence='good' "+confir... | javascript | function pickMultipleCoinsAndContinue(){
conn.query(
"SELECT unit, message_index, output_index, amount, address, blinding \n\
FROM outputs \n\
CROSS JOIN units USING(unit) \n\
WHERE address IN(?) AND asset"+(asset ? "="+conn.escape(asset) : " IS NULL")+" AND is_spent=0 \n\
AND sequence='good' "+confir... | [
"function",
"pickMultipleCoinsAndContinue",
"(",
")",
"{",
"conn",
".",
"query",
"(",
"\"SELECT unit, message_index, output_index, amount, address, blinding \\n\\\n\t\t\tFROM outputs \\n\\\n\t\t\tCROSS JOIN units USING(unit) \\n\\\n\t\t\tWHERE address IN(?) AND asset\"",
"+",
"(",
"asset",
... | then, try to add smaller coins until we accumulate the target amount | [
"then",
"try",
"to",
"add",
"smaller",
"coins",
"until",
"we",
"accumulate",
"the",
"target",
"amount"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/inputs.js#L105-L137 |
15,266 | byteball/ocore | inputs.js | addIssueInput | function addIssueInput(serial_number){
total_amount += issue_amount;
var input = {
type: "issue",
amount: issue_amount,
serial_number: serial_number
};
if (bMultiAuthored)
input.address = issuer_address;
var objInputWithProof = {input: input};
if (objAsset && objAsset.is_private){
... | javascript | function addIssueInput(serial_number){
total_amount += issue_amount;
var input = {
type: "issue",
amount: issue_amount,
serial_number: serial_number
};
if (bMultiAuthored)
input.address = issuer_address;
var objInputWithProof = {input: input};
if (objAsset && objAsset.is_private){
... | [
"function",
"addIssueInput",
"(",
"serial_number",
")",
"{",
"total_amount",
"+=",
"issue_amount",
";",
"var",
"input",
"=",
"{",
"type",
":",
"\"issue\"",
",",
"amount",
":",
"issue_amount",
",",
"serial_number",
":",
"serial_number",
"}",
";",
"if",
"(",
"... | 1 currency unit in case required_amount = total_amount | [
"1",
"currency",
"unit",
"in",
"case",
"required_amount",
"=",
"total_amount"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/inputs.js#L199-L225 |
15,267 | byteball/ocore | graph.js | goDown | function goDown(arrStartUnits){
conn.query(
"SELECT unit, level, latest_included_mc_index, main_chain_index, is_on_main_chain \n\
FROM parenthoods JOIN units ON child_unit=unit \n\
WHERE parent_unit IN(?) AND latest_included_mc_index<? AND level<=?",
[arrStartUnits, objEarlierUnitProps.main_chain_index, m... | javascript | function goDown(arrStartUnits){
conn.query(
"SELECT unit, level, latest_included_mc_index, main_chain_index, is_on_main_chain \n\
FROM parenthoods JOIN units ON child_unit=unit \n\
WHERE parent_unit IN(?) AND latest_included_mc_index<? AND level<=?",
[arrStartUnits, objEarlierUnitProps.main_chain_index, m... | [
"function",
"goDown",
"(",
"arrStartUnits",
")",
"{",
"conn",
".",
"query",
"(",
"\"SELECT unit, level, latest_included_mc_index, main_chain_index, is_on_main_chain \\n\\\n\t\t\tFROM parenthoods JOIN units ON child_unit=unit \\n\\\n\t\t\tWHERE parent_unit IN(?) AND latest_included_mc_index<? AND... | direct shoots to later units, without touching the MC | [
"direct",
"shoots",
"to",
"later",
"units",
"without",
"touching",
"the",
"MC"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/graph.js#L312-L335 |
15,268 | byteball/ocore | graph.js | readAscendantUnitsAfterTakingOffMc | function readAscendantUnitsAfterTakingOffMc(conn, objEarlierUnitProps, arrLaterUnitProps, handleUnits){
var arrLaterUnits = arrLaterUnitProps.map(function(objLaterUnitProps){ return objLaterUnitProps.unit; });
var max_later_limci = Math.max.apply(null, arrLaterUnitProps.map(function(objLaterUnitProps){ return objLate... | javascript | function readAscendantUnitsAfterTakingOffMc(conn, objEarlierUnitProps, arrLaterUnitProps, handleUnits){
var arrLaterUnits = arrLaterUnitProps.map(function(objLaterUnitProps){ return objLaterUnitProps.unit; });
var max_later_limci = Math.max.apply(null, arrLaterUnitProps.map(function(objLaterUnitProps){ return objLate... | [
"function",
"readAscendantUnitsAfterTakingOffMc",
"(",
"conn",
",",
"objEarlierUnitProps",
",",
"arrLaterUnitProps",
",",
"handleUnits",
")",
"{",
"var",
"arrLaterUnits",
"=",
"arrLaterUnitProps",
".",
"map",
"(",
"function",
"(",
"objLaterUnitProps",
")",
"{",
"retur... | includes later units | [
"includes",
"later",
"units"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/graph.js#L341-L380 |
15,269 | byteball/ocore | validation.js | validateSkiplist | function validateSkiplist(conn, arrSkiplistUnits, callback){
var prev = "";
async.eachSeries(
arrSkiplistUnits,
function(skiplist_unit, cb){
//if (skiplist_unit.charAt(0) !== "0")
// return cb("skiplist unit doesn't start with 0");
if (skiplist_unit <= prev)
return cb(createJointError("skiplist un... | javascript | function validateSkiplist(conn, arrSkiplistUnits, callback){
var prev = "";
async.eachSeries(
arrSkiplistUnits,
function(skiplist_unit, cb){
//if (skiplist_unit.charAt(0) !== "0")
// return cb("skiplist unit doesn't start with 0");
if (skiplist_unit <= prev)
return cb(createJointError("skiplist un... | [
"function",
"validateSkiplist",
"(",
"conn",
",",
"arrSkiplistUnits",
",",
"callback",
")",
"{",
"var",
"prev",
"=",
"\"\"",
";",
"async",
".",
"eachSeries",
"(",
"arrSkiplistUnits",
",",
"function",
"(",
"skiplist_unit",
",",
"cb",
")",
"{",
"//if (skiplist_u... | we cannot verify that skiplist units lie on MC if they are unstable yet, but if they don't, we'll get unmatching ball hash when the current unit reaches stability | [
"we",
"cannot",
"verify",
"that",
"skiplist",
"units",
"lie",
"on",
"MC",
"if",
"they",
"are",
"unstable",
"yet",
"but",
"if",
"they",
"don",
"t",
"we",
"ll",
"get",
"unmatching",
"ball",
"hash",
"when",
"the",
"current",
"unit",
"reaches",
"stability"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/validation.js#L372-L400 |
15,270 | byteball/ocore | validation.js | checkNoSameAddressInDifferentParents | function checkNoSameAddressInDifferentParents(){
if (objUnit.parent_units.length === 1)
return callback();
var assocAuthors = {};
var found_address;
async.eachSeries(
objUnit.parent_units,
function(parent_unit, cb){
storage.readUnitAuthors(conn, parent_unit, function(arrAuthors){
arrAuthors.fo... | javascript | function checkNoSameAddressInDifferentParents(){
if (objUnit.parent_units.length === 1)
return callback();
var assocAuthors = {};
var found_address;
async.eachSeries(
objUnit.parent_units,
function(parent_unit, cb){
storage.readUnitAuthors(conn, parent_unit, function(arrAuthors){
arrAuthors.fo... | [
"function",
"checkNoSameAddressInDifferentParents",
"(",
")",
"{",
"if",
"(",
"objUnit",
".",
"parent_units",
".",
"length",
"===",
"1",
")",
"return",
"callback",
"(",
")",
";",
"var",
"assocAuthors",
"=",
"{",
"}",
";",
"var",
"found_address",
";",
"async"... | avoid merging the obvious nonserials | [
"avoid",
"merging",
"the",
"obvious",
"nonserials"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/validation.js#L440-L463 |
15,271 | byteball/ocore | validation.js | checkNoPendingDefinition | function checkNoPendingDefinition(){
//var next = checkNoPendingOrRetrievableNonserialIncluded;
var next = validateDefinition;
//var filter = bNonserial ? "AND sequence='good'" : "";
// var cross = (objValidationState.max_known_mci - objValidationState.last_ball_mci < 1000) ? 'CROSS' : '';
conn.query( // _left... | javascript | function checkNoPendingDefinition(){
//var next = checkNoPendingOrRetrievableNonserialIncluded;
var next = validateDefinition;
//var filter = bNonserial ? "AND sequence='good'" : "";
// var cross = (objValidationState.max_known_mci - objValidationState.last_ball_mci < 1000) ? 'CROSS' : '';
conn.query( // _left... | [
"function",
"checkNoPendingDefinition",
"(",
")",
"{",
"//var next = checkNoPendingOrRetrievableNonserialIncluded;",
"var",
"next",
"=",
"validateDefinition",
";",
"//var filter = bNonserial ? \"AND sequence='good'\" : \"\";",
"//\tvar cross = (objValidationState.max_known_mci - objValidatio... | We don't trust pending definitions even when they are serial, as another unit may arrive and make them nonserial, then the definition will be removed | [
"We",
"don",
"t",
"trust",
"pending",
"definitions",
"even",
"when",
"they",
"are",
"serial",
"as",
"another",
"unit",
"may",
"arrive",
"and",
"make",
"them",
"nonserial",
"then",
"the",
"definition",
"will",
"be",
"removed"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/validation.js#L924-L960 |
15,272 | byteball/ocore | validation.js | validateIndivisibleIssue | function validateIndivisibleIssue(input, cb){
// if (objAsset)
// profiler2.start();
conn.query(
"SELECT count_coins FROM asset_denominations WHERE asset=? AND denomination=?",
[payload.asset, denomination],
function(rows){
if (rows.length === 0)
return cb("invalid denomination: "+denomination)... | javascript | function validateIndivisibleIssue(input, cb){
// if (objAsset)
// profiler2.start();
conn.query(
"SELECT count_coins FROM asset_denominations WHERE asset=? AND denomination=?",
[payload.asset, denomination],
function(rows){
if (rows.length === 0)
return cb("invalid denomination: "+denomination)... | [
"function",
"validateIndivisibleIssue",
"(",
"input",
",",
"cb",
")",
"{",
"//\tif (objAsset)",
"//\t\tprofiler2.start();",
"conn",
".",
"query",
"(",
"\"SELECT count_coins FROM asset_denominations WHERE asset=? AND denomination=?\"",
",",
"[",
"payload",
".",
"asset",
",",
... | same for both public and private | [
"same",
"for",
"both",
"public",
"and",
"private"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/validation.js#L1534-L1559 |
15,273 | byteball/ocore | validation.js | validateSignedMessageSync | function validateSignedMessageSync(objSignedMessage){
var err;
var bCalledBack = false;
validateSignedMessage(objSignedMessage, function(_err){
err = _err;
bCalledBack = true;
});
if (!bCalledBack)
throw Error("validateSignedMessage is not sync");
return err;
} | javascript | function validateSignedMessageSync(objSignedMessage){
var err;
var bCalledBack = false;
validateSignedMessage(objSignedMessage, function(_err){
err = _err;
bCalledBack = true;
});
if (!bCalledBack)
throw Error("validateSignedMessage is not sync");
return err;
} | [
"function",
"validateSignedMessageSync",
"(",
"objSignedMessage",
")",
"{",
"var",
"err",
";",
"var",
"bCalledBack",
"=",
"false",
";",
"validateSignedMessage",
"(",
"objSignedMessage",
",",
"function",
"(",
"_err",
")",
"{",
"err",
"=",
"_err",
";",
"bCalledBac... | inconsistent for multisig addresses | [
"inconsistent",
"for",
"multisig",
"addresses"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/validation.js#L2223-L2233 |
15,274 | byteball/ocore | main_chain.js | createListOfBestChildren | function createListOfBestChildren(arrParentUnits, handleBestChildrenList){
if (arrParentUnits.length === 0)
return handleBestChildrenList([]);
var arrBestChildren = arrParentUnits.slice();
function goDownAndCollectBestChildren(arrStartUnits, cb){
conn.query("SELECT unit, is_free FROM units WHERE best_par... | javascript | function createListOfBestChildren(arrParentUnits, handleBestChildrenList){
if (arrParentUnits.length === 0)
return handleBestChildrenList([]);
var arrBestChildren = arrParentUnits.slice();
function goDownAndCollectBestChildren(arrStartUnits, cb){
conn.query("SELECT unit, is_free FROM units WHERE best_par... | [
"function",
"createListOfBestChildren",
"(",
"arrParentUnits",
",",
"handleBestChildrenList",
")",
"{",
"if",
"(",
"arrParentUnits",
".",
"length",
"===",
"0",
")",
"return",
"handleBestChildrenList",
"(",
"[",
"]",
")",
";",
"var",
"arrBestChildren",
"=",
"arrPar... | also includes arrParentUnits | [
"also",
"includes",
"arrParentUnits"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/main_chain.js#L540-L567 |
15,275 | byteball/ocore | main_chain.js | filterAltBranchRootUnits | function filterAltBranchRootUnits(cb){
//console.log('===== before filtering:', arrAltBranchRootUnits);
var arrFilteredAltBranchRootUnits = [];
conn.query("SELECT unit, is_free, main_chain_index FROM units WHERE unit IN(?)", [arrAltBranchRootUnits], function(rows){
if (rows.length === 0)
... | javascript | function filterAltBranchRootUnits(cb){
//console.log('===== before filtering:', arrAltBranchRootUnits);
var arrFilteredAltBranchRootUnits = [];
conn.query("SELECT unit, is_free, main_chain_index FROM units WHERE unit IN(?)", [arrAltBranchRootUnits], function(rows){
if (rows.length === 0)
... | [
"function",
"filterAltBranchRootUnits",
"(",
"cb",
")",
"{",
"//console.log('===== before filtering:', arrAltBranchRootUnits);",
"var",
"arrFilteredAltBranchRootUnits",
"=",
"[",
"]",
";",
"conn",
".",
"query",
"(",
"\"SELECT unit, is_free, main_chain_index FROM units WHERE unit IN... | leaves only those roots that are included by later units | [
"leaves",
"only",
"those",
"roots",
"that",
"are",
"included",
"by",
"later",
"units"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/main_chain.js#L962-L1015 |
15,276 | byteball/ocore | main_chain.js | determineIfStableInLaterUnitsAndUpdateStableMcFlag | function determineIfStableInLaterUnitsAndUpdateStableMcFlag(conn, earlier_unit, arrLaterUnits, bStableInDb, handleResult){
determineIfStableInLaterUnits(conn, earlier_unit, arrLaterUnits, function(bStable){
console.log("determineIfStableInLaterUnits", earlier_unit, arrLaterUnits, bStable);
if (!bStable)
return ... | javascript | function determineIfStableInLaterUnitsAndUpdateStableMcFlag(conn, earlier_unit, arrLaterUnits, bStableInDb, handleResult){
determineIfStableInLaterUnits(conn, earlier_unit, arrLaterUnits, function(bStable){
console.log("determineIfStableInLaterUnits", earlier_unit, arrLaterUnits, bStable);
if (!bStable)
return ... | [
"function",
"determineIfStableInLaterUnitsAndUpdateStableMcFlag",
"(",
"conn",
",",
"earlier_unit",
",",
"arrLaterUnits",
",",
"bStableInDb",
",",
"handleResult",
")",
"{",
"determineIfStableInLaterUnits",
"(",
"conn",
",",
"earlier_unit",
",",
"arrLaterUnits",
",",
"func... | It is assumed earlier_unit is not marked as stable yet If it appears to be stable, its MC index will be marked as stable, as well as all preceeding MC indexes | [
"It",
"is",
"assumed",
"earlier_unit",
"is",
"not",
"marked",
"as",
"stable",
"yet",
"If",
"it",
"appears",
"to",
"be",
"stable",
"its",
"MC",
"index",
"will",
"be",
"marked",
"as",
"stable",
"as",
"well",
"as",
"all",
"preceeding",
"MC",
"indexes"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/main_chain.js#L1075-L1106 |
15,277 | byteball/ocore | main_chain.js | propagateFinalBad | function propagateFinalBad(arrFinalBadUnits, onPropagated){
if (arrFinalBadUnits.length === 0)
return onPropagated();
conn.query("SELECT DISTINCT unit FROM inputs WHERE src_unit IN(?)", [arrFinalBadUnits], function(rows){
if (rows.length === 0)
return onPropagated();
var arrSpendingUnits = rows.map(fun... | javascript | function propagateFinalBad(arrFinalBadUnits, onPropagated){
if (arrFinalBadUnits.length === 0)
return onPropagated();
conn.query("SELECT DISTINCT unit FROM inputs WHERE src_unit IN(?)", [arrFinalBadUnits], function(rows){
if (rows.length === 0)
return onPropagated();
var arrSpendingUnits = rows.map(fun... | [
"function",
"propagateFinalBad",
"(",
"arrFinalBadUnits",
",",
"onPropagated",
")",
"{",
"if",
"(",
"arrFinalBadUnits",
".",
"length",
"===",
"0",
")",
"return",
"onPropagated",
"(",
")",
";",
"conn",
".",
"query",
"(",
"\"SELECT DISTINCT unit FROM inputs WHERE src_... | all future units that spent these unconfirmed units become final-bad too | [
"all",
"future",
"units",
"that",
"spent",
"these",
"unconfirmed",
"units",
"become",
"final",
"-",
"bad",
"too"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/main_chain.js#L1206-L1220 |
15,278 | byteball/ocore | main_chain.js | getSimilarMcis | function getSimilarMcis(mci){
var arrSimilarMcis = [];
var divisor = 10;
while (true){
if (mci % divisor === 0){
arrSimilarMcis.push(mci - divisor);
divisor *= 10;
}
else
return arrSimilarMcis;
}
} | javascript | function getSimilarMcis(mci){
var arrSimilarMcis = [];
var divisor = 10;
while (true){
if (mci % divisor === 0){
arrSimilarMcis.push(mci - divisor);
divisor *= 10;
}
else
return arrSimilarMcis;
}
} | [
"function",
"getSimilarMcis",
"(",
"mci",
")",
"{",
"var",
"arrSimilarMcis",
"=",
"[",
"]",
";",
"var",
"divisor",
"=",
"10",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"mci",
"%",
"divisor",
"===",
"0",
")",
"{",
"arrSimilarMcis",
".",
"push",
... | returns list of past MC indices for skiplist | [
"returns",
"list",
"of",
"past",
"MC",
"indices",
"for",
"skiplist"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/main_chain.js#L1377-L1388 |
15,279 | byteball/ocore | indivisible_asset.js | parsePrivatePaymentChain | function parsePrivatePaymentChain(conn, arrPrivateElements, callbacks){
var bAllStable = true;
var issuePrivateElement = arrPrivateElements[arrPrivateElements.length-1];
if (!issuePrivateElement.payload || !issuePrivateElement.payload.inputs || !issuePrivateElement.payload.inputs[0])
return callbacks.ifError("inva... | javascript | function parsePrivatePaymentChain(conn, arrPrivateElements, callbacks){
var bAllStable = true;
var issuePrivateElement = arrPrivateElements[arrPrivateElements.length-1];
if (!issuePrivateElement.payload || !issuePrivateElement.payload.inputs || !issuePrivateElement.payload.inputs[0])
return callbacks.ifError("inva... | [
"function",
"parsePrivatePaymentChain",
"(",
"conn",
",",
"arrPrivateElements",
",",
"callbacks",
")",
"{",
"var",
"bAllStable",
"=",
"true",
";",
"var",
"issuePrivateElement",
"=",
"arrPrivateElements",
"[",
"arrPrivateElements",
".",
"length",
"-",
"1",
"]",
";"... | arrPrivateElements is ordered in reverse chronological order | [
"arrPrivateElements",
"is",
"ordered",
"in",
"reverse",
"chronological",
"order"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/indivisible_asset.js#L170-L219 |
15,280 | byteball/ocore | indivisible_asset.js | updateIndivisibleOutputsThatWereReceivedUnstable | function updateIndivisibleOutputsThatWereReceivedUnstable(conn, onDone){
function updateOutputProps(unit, is_serial, onUpdated){
// may update several outputs
conn.query(
"UPDATE outputs SET is_serial=? WHERE unit=?",
[is_serial, unit],
function(){
is_serial ? updateInputUniqueness(unit, onUpdated)... | javascript | function updateIndivisibleOutputsThatWereReceivedUnstable(conn, onDone){
function updateOutputProps(unit, is_serial, onUpdated){
// may update several outputs
conn.query(
"UPDATE outputs SET is_serial=? WHERE unit=?",
[is_serial, unit],
function(){
is_serial ? updateInputUniqueness(unit, onUpdated)... | [
"function",
"updateIndivisibleOutputsThatWereReceivedUnstable",
"(",
"conn",
",",
"onDone",
")",
"{",
"function",
"updateOutputProps",
"(",
"unit",
",",
"is_serial",
",",
"onUpdated",
")",
"{",
"// may update several outputs",
"conn",
".",
"query",
"(",
"\"UPDATE output... | must be executed within transaction | [
"must",
"be",
"executed",
"within",
"transaction"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/indivisible_asset.js#L284-L372 |
15,281 | byteball/ocore | indivisible_asset.js | buildPrivateElementsChain | function buildPrivateElementsChain(conn, unit, message_index, output_index, payload, handlePrivateElements){
var asset = payload.asset;
var denomination = payload.denomination;
var output = payload.outputs[output_index];
var hidden_payload = _.cloneDeep(payload);
hidden_payload.outputs.forEach(function(o){
delet... | javascript | function buildPrivateElementsChain(conn, unit, message_index, output_index, payload, handlePrivateElements){
var asset = payload.asset;
var denomination = payload.denomination;
var output = payload.outputs[output_index];
var hidden_payload = _.cloneDeep(payload);
hidden_payload.outputs.forEach(function(o){
delet... | [
"function",
"buildPrivateElementsChain",
"(",
"conn",
",",
"unit",
",",
"message_index",
",",
"output_index",
",",
"payload",
",",
"handlePrivateElements",
")",
"{",
"var",
"asset",
"=",
"payload",
".",
"asset",
";",
"var",
"denomination",
"=",
"payload",
".",
... | this function receives fully open payload | [
"this",
"function",
"receives",
"fully",
"open",
"payload"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/indivisible_asset.js#L602-L704 |
15,282 | byteball/ocore | sqlite_pool.js | query | function query(){
//console.log(arguments[0]);
var self = this;
var args = arguments;
var last_arg = args[args.length - 1];
var bHasCallback = (typeof last_arg === 'function');
if (!bHasCallback) // no callback
last_arg = function(){};
var count_arguments_without_callback = bHasCallback ? (args.length... | javascript | function query(){
//console.log(arguments[0]);
var self = this;
var args = arguments;
var last_arg = args[args.length - 1];
var bHasCallback = (typeof last_arg === 'function');
if (!bHasCallback) // no callback
last_arg = function(){};
var count_arguments_without_callback = bHasCallback ? (args.length... | [
"function",
"query",
"(",
")",
"{",
"//console.log(arguments[0]);",
"var",
"self",
"=",
"this",
";",
"var",
"args",
"=",
"arguments",
";",
"var",
"last_arg",
"=",
"args",
"[",
"args",
".",
"length",
"-",
"1",
"]",
";",
"var",
"bHasCallback",
"=",
"(",
... | takes a connection from the pool, executes the single query on this connection, and immediately releases the connection | [
"takes",
"a",
"connection",
"from",
"the",
"pool",
"executes",
"the",
"single",
"query",
"on",
"this",
"connection",
"and",
"immediately",
"releases",
"the",
"connection"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/sqlite_pool.js#L223-L250 |
15,283 | byteball/ocore | network.js | sendJoint | function sendJoint(ws, objJoint, tag) {
console.log('sending joint identified by unit ' + objJoint.unit.unit + ' to', ws.peer);
tag ? sendResponse(ws, tag, {joint: objJoint}) : sendJustsaying(ws, 'joint', objJoint);
} | javascript | function sendJoint(ws, objJoint, tag) {
console.log('sending joint identified by unit ' + objJoint.unit.unit + ' to', ws.peer);
tag ? sendResponse(ws, tag, {joint: objJoint}) : sendJustsaying(ws, 'joint', objJoint);
} | [
"function",
"sendJoint",
"(",
"ws",
",",
"objJoint",
",",
"tag",
")",
"{",
"console",
".",
"log",
"(",
"'sending joint identified by unit '",
"+",
"objJoint",
".",
"unit",
".",
"unit",
"+",
"' to'",
",",
"ws",
".",
"peer",
")",
";",
"tag",
"?",
"sendResp... | joints sent as justsaying or as response to a request | [
"joints",
"sent",
"as",
"justsaying",
"or",
"as",
"response",
"to",
"a",
"request"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/network.js#L714-L717 |
15,284 | byteball/ocore | network.js | postJointToLightVendor | function postJointToLightVendor(objJoint, handleResponse) {
console.log('posting joint identified by unit ' + objJoint.unit.unit + ' to light vendor');
requestFromLightVendor('post_joint', objJoint, function(ws, request, response){
handleResponse(response);
});
} | javascript | function postJointToLightVendor(objJoint, handleResponse) {
console.log('posting joint identified by unit ' + objJoint.unit.unit + ' to light vendor');
requestFromLightVendor('post_joint', objJoint, function(ws, request, response){
handleResponse(response);
});
} | [
"function",
"postJointToLightVendor",
"(",
"objJoint",
",",
"handleResponse",
")",
"{",
"console",
".",
"log",
"(",
"'posting joint identified by unit '",
"+",
"objJoint",
".",
"unit",
".",
"unit",
"+",
"' to light vendor'",
")",
";",
"requestFromLightVendor",
"(",
... | sent by light clients to their vendors | [
"sent",
"by",
"light",
"clients",
"to",
"their",
"vendors"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/network.js#L720-L725 |
15,285 | byteball/ocore | network.js | function(purged_unit, peer){
var ws = getPeerWebSocket(peer);
if (ws)
sendErrorResult(ws, purged_unit, "error on (indirect) parent unit "+objJoint.unit.unit+": "+error);
} | javascript | function(purged_unit, peer){
var ws = getPeerWebSocket(peer);
if (ws)
sendErrorResult(ws, purged_unit, "error on (indirect) parent unit "+objJoint.unit.unit+": "+error);
} | [
"function",
"(",
"purged_unit",
",",
"peer",
")",
"{",
"var",
"ws",
"=",
"getPeerWebSocket",
"(",
"peer",
")",
";",
"if",
"(",
"ws",
")",
"sendErrorResult",
"(",
"ws",
",",
"purged_unit",
",",
"\"error on (indirect) parent unit \"",
"+",
"objJoint",
".",
"un... | this callback is called for each dependent unit | [
"this",
"callback",
"is",
"called",
"for",
"each",
"dependent",
"unit"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/network.js#L906-L910 | |
15,286 | byteball/ocore | network.js | handlePostedJoint | function handlePostedJoint(ws, objJoint, onDone){
if (!objJoint || !objJoint.unit || !objJoint.unit.unit)
return onDone('no unit');
var unit = objJoint.unit.unit;
delete objJoint.unit.main_chain_index;
handleJoint(ws, objJoint, false, {
ifUnitInWork: function(){
onDone("already handling this unit");
... | javascript | function handlePostedJoint(ws, objJoint, onDone){
if (!objJoint || !objJoint.unit || !objJoint.unit.unit)
return onDone('no unit');
var unit = objJoint.unit.unit;
delete objJoint.unit.main_chain_index;
handleJoint(ws, objJoint, false, {
ifUnitInWork: function(){
onDone("already handling this unit");
... | [
"function",
"handlePostedJoint",
"(",
"ws",
",",
"objJoint",
",",
"onDone",
")",
"{",
"if",
"(",
"!",
"objJoint",
"||",
"!",
"objJoint",
".",
"unit",
"||",
"!",
"objJoint",
".",
"unit",
".",
"unit",
")",
"return",
"onDone",
"(",
"'no unit'",
")",
";",
... | handle joint posted to me by a light client | [
"handle",
"joint",
"posted",
"to",
"me",
"by",
"a",
"light",
"client"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/network.js#L1033-L1085 |
15,287 | byteball/ocore | network.js | handleOnlinePrivatePayment | function handleOnlinePrivatePayment(ws, arrPrivateElements, bViaHub, callbacks){
if (!ValidationUtils.isNonemptyArray(arrPrivateElements))
return callbacks.ifError("private_payment content must be non-empty array");
var unit = arrPrivateElements[0].unit;
var message_index = arrPrivateElements[0].message_index;
... | javascript | function handleOnlinePrivatePayment(ws, arrPrivateElements, bViaHub, callbacks){
if (!ValidationUtils.isNonemptyArray(arrPrivateElements))
return callbacks.ifError("private_payment content must be non-empty array");
var unit = arrPrivateElements[0].unit;
var message_index = arrPrivateElements[0].message_index;
... | [
"function",
"handleOnlinePrivatePayment",
"(",
"ws",
",",
"arrPrivateElements",
",",
"bViaHub",
",",
"callbacks",
")",
"{",
"if",
"(",
"!",
"ValidationUtils",
".",
"isNonemptyArray",
"(",
"arrPrivateElements",
")",
")",
"return",
"callbacks",
".",
"ifError",
"(",
... | handles one private payload and its chain | [
"handles",
"one",
"private",
"payload",
"and",
"its",
"chain"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/network.js#L1703-L1762 |
15,288 | byteball/ocore | network.js | checkThatEachChainElementIncludesThePrevious | function checkThatEachChainElementIncludesThePrevious(arrPrivateElements, handleResult){
if (arrPrivateElements.length === 1) // an issue
return handleResult(true);
var arrUnits = arrPrivateElements.map(function(objPrivateElement){ return objPrivateElement.unit; });
requestFromLightVendor('light/get_link_proofs', ... | javascript | function checkThatEachChainElementIncludesThePrevious(arrPrivateElements, handleResult){
if (arrPrivateElements.length === 1) // an issue
return handleResult(true);
var arrUnits = arrPrivateElements.map(function(objPrivateElement){ return objPrivateElement.unit; });
requestFromLightVendor('light/get_link_proofs', ... | [
"function",
"checkThatEachChainElementIncludesThePrevious",
"(",
"arrPrivateElements",
",",
"handleResult",
")",
"{",
"if",
"(",
"arrPrivateElements",
".",
"length",
"===",
"1",
")",
"// an issue",
"return",
"handleResult",
"(",
"true",
")",
";",
"var",
"arrUnits",
... | light only Note that we are leaking to light vendor information about the full chain. If the light vendor was a party to any previous transaction in this chain, he'll know how much we received. | [
"light",
"only",
"Note",
"that",
"we",
"are",
"leaking",
"to",
"light",
"vendor",
"information",
"about",
"the",
"full",
"chain",
".",
"If",
"the",
"light",
"vendor",
"was",
"a",
"party",
"to",
"any",
"previous",
"transaction",
"in",
"this",
"chain",
"he",... | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/network.js#L1960-L1982 |
15,289 | byteball/ocore | wallet_defined_by_keys.js | checkAndFinalizeWallet | function checkAndFinalizeWallet(wallet, onDone){
db.query("SELECT member_ready_date FROM wallets LEFT JOIN extended_pubkeys USING(wallet) WHERE wallets.wallet=?", [wallet], function(rows){
if (rows.length === 0){ // wallet not created yet or already deleted
// throw Error("no wallet in checkAndFinalizeWallet");
... | javascript | function checkAndFinalizeWallet(wallet, onDone){
db.query("SELECT member_ready_date FROM wallets LEFT JOIN extended_pubkeys USING(wallet) WHERE wallets.wallet=?", [wallet], function(rows){
if (rows.length === 0){ // wallet not created yet or already deleted
// throw Error("no wallet in checkAndFinalizeWallet");
... | [
"function",
"checkAndFinalizeWallet",
"(",
"wallet",
",",
"onDone",
")",
"{",
"db",
".",
"query",
"(",
"\"SELECT member_ready_date FROM wallets LEFT JOIN extended_pubkeys USING(wallet) WHERE wallets.wallet=?\"",
",",
"[",
"wallet",
"]",
",",
"function",
"(",
"rows",
")",
... | check that all members agree that the wallet is fully approved now | [
"check",
"that",
"all",
"members",
"agree",
"that",
"the",
"wallet",
"is",
"fully",
"approved",
"now"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_defined_by_keys.js#L120-L135 |
15,290 | byteball/ocore | wallet_defined_by_keys.js | createWallet | function createWallet(xPubKey, account, arrWalletDefinitionTemplate, walletName, isSingleAddress, handleWallet){
var wallet = crypto.createHash("sha256").update(xPubKey, "utf8").digest("base64");
console.log('will create wallet '+wallet);
var arrDeviceAddresses = getDeviceAddresses(arrWalletDefinitionTemplate);
add... | javascript | function createWallet(xPubKey, account, arrWalletDefinitionTemplate, walletName, isSingleAddress, handleWallet){
var wallet = crypto.createHash("sha256").update(xPubKey, "utf8").digest("base64");
console.log('will create wallet '+wallet);
var arrDeviceAddresses = getDeviceAddresses(arrWalletDefinitionTemplate);
add... | [
"function",
"createWallet",
"(",
"xPubKey",
",",
"account",
",",
"arrWalletDefinitionTemplate",
",",
"walletName",
",",
"isSingleAddress",
",",
"handleWallet",
")",
"{",
"var",
"wallet",
"=",
"crypto",
".",
"createHash",
"(",
"\"sha256\"",
")",
".",
"update",
"(... | initiator of the new wallet creates records about itself and sends requests to other devices | [
"initiator",
"of",
"the",
"new",
"wallet",
"creates",
"records",
"about",
"itself",
"and",
"sends",
"requests",
"to",
"other",
"devices"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_defined_by_keys.js#L231-L255 |
15,291 | byteball/ocore | wallet_defined_by_keys.js | approveWallet | function approveWallet(wallet, xPubKey, account, arrWalletDefinitionTemplate, arrOtherCosigners, onDone){
var arrDeviceAddresses = getDeviceAddresses(arrWalletDefinitionTemplate);
device.addIndirectCorrespondents(arrOtherCosigners, function(){
addWallet(wallet, xPubKey, account, arrWalletDefinitionTemplate, functio... | javascript | function approveWallet(wallet, xPubKey, account, arrWalletDefinitionTemplate, arrOtherCosigners, onDone){
var arrDeviceAddresses = getDeviceAddresses(arrWalletDefinitionTemplate);
device.addIndirectCorrespondents(arrOtherCosigners, function(){
addWallet(wallet, xPubKey, account, arrWalletDefinitionTemplate, functio... | [
"function",
"approveWallet",
"(",
"wallet",
",",
"xPubKey",
",",
"account",
",",
"arrWalletDefinitionTemplate",
",",
"arrOtherCosigners",
",",
"onDone",
")",
"{",
"var",
"arrDeviceAddresses",
"=",
"getDeviceAddresses",
"(",
"arrWalletDefinitionTemplate",
")",
";",
"de... | called from UI after user confirms creation of wallet initiated by another device | [
"called",
"from",
"UI",
"after",
"user",
"confirms",
"creation",
"of",
"wallet",
"initiated",
"by",
"another",
"device"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_defined_by_keys.js#L287-L299 |
15,292 | byteball/ocore | wallet_defined_by_keys.js | deleteWallet | function deleteWallet(wallet, rejector_device_address, onDone){
db.query("SELECT approval_date FROM extended_pubkeys WHERE wallet=? AND device_address=?", [wallet, rejector_device_address], function(rows){
if (rows.length === 0) // you are not a member device
return onDone();
if (rows[0].approval_date) // you'v... | javascript | function deleteWallet(wallet, rejector_device_address, onDone){
db.query("SELECT approval_date FROM extended_pubkeys WHERE wallet=? AND device_address=?", [wallet, rejector_device_address], function(rows){
if (rows.length === 0) // you are not a member device
return onDone();
if (rows[0].approval_date) // you'v... | [
"function",
"deleteWallet",
"(",
"wallet",
",",
"rejector_device_address",
",",
"onDone",
")",
"{",
"db",
".",
"query",
"(",
"\"SELECT approval_date FROM extended_pubkeys WHERE wallet=? AND device_address=?\"",
",",
"[",
"wallet",
",",
"rejector_device_address",
"]",
",",
... | called from network, without user interaction One of the proposed cosigners declined wallet creation | [
"called",
"from",
"network",
"without",
"user",
"interaction",
"One",
"of",
"the",
"proposed",
"cosigners",
"declined",
"wallet",
"creation"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_defined_by_keys.js#L329-L355 |
15,293 | byteball/ocore | wallet_defined_by_keys.js | addNewAddress | function addNewAddress(wallet, is_change, address_index, address, handleError){
breadcrumbs.add('addNewAddress is_change='+is_change+', index='+address_index+', address='+address);
db.query("SELECT 1 FROM wallets WHERE wallet=?", [wallet], function(rows){
if (rows.length === 0)
return handleError("wallet "+walle... | javascript | function addNewAddress(wallet, is_change, address_index, address, handleError){
breadcrumbs.add('addNewAddress is_change='+is_change+', index='+address_index+', address='+address);
db.query("SELECT 1 FROM wallets WHERE wallet=?", [wallet], function(rows){
if (rows.length === 0)
return handleError("wallet "+walle... | [
"function",
"addNewAddress",
"(",
"wallet",
",",
"is_change",
",",
"address_index",
",",
"address",
",",
"handleError",
")",
"{",
"breadcrumbs",
".",
"add",
"(",
"'addNewAddress is_change='",
"+",
"is_change",
"+",
"', index='",
"+",
"address_index",
"+",
"', addr... | silently adds new address upon receiving a network message | [
"silently",
"adds",
"new",
"address",
"upon",
"receiving",
"a",
"network",
"message"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_defined_by_keys.js#L413-L427 |
15,294 | byteball/ocore | wallet_defined_by_keys.js | issueOrSelectNextAddress | function issueOrSelectNextAddress(wallet, is_change, handleAddress){
readNextAddressIndex(wallet, is_change, function(next_index){
if (next_index < MAX_BIP44_GAP)
return issueAddress(wallet, is_change, next_index, handleAddress);
readLastUsedAddressIndex(wallet, is_change, function(last_used_index){
if (last... | javascript | function issueOrSelectNextAddress(wallet, is_change, handleAddress){
readNextAddressIndex(wallet, is_change, function(next_index){
if (next_index < MAX_BIP44_GAP)
return issueAddress(wallet, is_change, next_index, handleAddress);
readLastUsedAddressIndex(wallet, is_change, function(last_used_index){
if (last... | [
"function",
"issueOrSelectNextAddress",
"(",
"wallet",
",",
"is_change",
",",
"handleAddress",
")",
"{",
"readNextAddressIndex",
"(",
"wallet",
",",
"is_change",
",",
"function",
"(",
"next_index",
")",
"{",
"if",
"(",
"next_index",
"<",
"MAX_BIP44_GAP",
")",
"r... | selects one of recent addresses if the gap is too large, otherwise issues a new address | [
"selects",
"one",
"of",
"recent",
"addresses",
"if",
"the",
"gap",
"is",
"too",
"large",
"otherwise",
"issues",
"a",
"new",
"address"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_defined_by_keys.js#L643-L654 |
15,295 | byteball/ocore | wallet_defined_by_keys.js | readAddressInfo | function readAddressInfo(address, handleAddress){
db.query("SELECT address_index, is_change FROM my_addresses WHERE address=?", [address], function(rows){
if (rows.length === 0)
return handleAddress("address "+address+" not found");
handleAddress(null, rows[0]);
});
} | javascript | function readAddressInfo(address, handleAddress){
db.query("SELECT address_index, is_change FROM my_addresses WHERE address=?", [address], function(rows){
if (rows.length === 0)
return handleAddress("address "+address+" not found");
handleAddress(null, rows[0]);
});
} | [
"function",
"readAddressInfo",
"(",
"address",
",",
"handleAddress",
")",
"{",
"db",
".",
"query",
"(",
"\"SELECT address_index, is_change FROM my_addresses WHERE address=?\"",
",",
"[",
"address",
"]",
",",
"function",
"(",
"rows",
")",
"{",
"if",
"(",
"rows",
".... | unused so far | [
"unused",
"so",
"far"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_defined_by_keys.js#L788-L794 |
15,296 | byteball/ocore | wallet_general.js | sendPrivatePayments | function sendPrivatePayments(device_address, arrChains, bForwarded, conn, onSaved){
var body = {chains: arrChains};
if (bForwarded)
body.forwarded = true;
device.sendMessageToDevice(device_address, "private_payments", body, {
ifOk: function(){},
ifError: function(){},
onSaved: onSaved
}, conn);
} | javascript | function sendPrivatePayments(device_address, arrChains, bForwarded, conn, onSaved){
var body = {chains: arrChains};
if (bForwarded)
body.forwarded = true;
device.sendMessageToDevice(device_address, "private_payments", body, {
ifOk: function(){},
ifError: function(){},
onSaved: onSaved
}, conn);
} | [
"function",
"sendPrivatePayments",
"(",
"device_address",
",",
"arrChains",
",",
"bForwarded",
",",
"conn",
",",
"onSaved",
")",
"{",
"var",
"body",
"=",
"{",
"chains",
":",
"arrChains",
"}",
";",
"if",
"(",
"bForwarded",
")",
"body",
".",
"forwarded",
"="... | unlike similar function in network, this function sends multiple chains in a single package | [
"unlike",
"similar",
"function",
"in",
"network",
"this",
"function",
"sends",
"multiple",
"chains",
"in",
"a",
"single",
"package"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/wallet_general.js#L17-L26 |
15,297 | byteball/ocore | light.js | fixIsSpentFlag | function fixIsSpentFlag(onDone){
db.query(
"SELECT outputs.unit, outputs.message_index, outputs.output_index \n\
FROM outputs \n\
CROSS JOIN inputs ON outputs.unit=inputs.src_unit AND outputs.message_index=inputs.src_message_index AND outputs.output_index=inputs.src_output_index \n\
WHERE is_spent=0 AND type='... | javascript | function fixIsSpentFlag(onDone){
db.query(
"SELECT outputs.unit, outputs.message_index, outputs.output_index \n\
FROM outputs \n\
CROSS JOIN inputs ON outputs.unit=inputs.src_unit AND outputs.message_index=inputs.src_message_index AND outputs.output_index=inputs.src_output_index \n\
WHERE is_spent=0 AND type='... | [
"function",
"fixIsSpentFlag",
"(",
"onDone",
")",
"{",
"db",
".",
"query",
"(",
"\"SELECT outputs.unit, outputs.message_index, outputs.output_index \\n\\\n\t\tFROM outputs \\n\\\n\t\tCROSS JOIN inputs ON outputs.unit=inputs.src_unit AND outputs.message_index=inputs.src_message_index AND outputs.... | fixes is_spent in case units were received out of order | [
"fixes",
"is_spent",
"in",
"case",
"units",
"were",
"received",
"out",
"of",
"order"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/light.js#L273-L292 |
15,298 | byteball/ocore | light.js | createLinkProof | function createLinkProof(later_unit, earlier_unit, arrChain, cb){
storage.readJoint(db, later_unit, {
ifNotFound: function(){
cb("later unit not found");
},
ifFound: function(objLaterJoint){
var later_mci = objLaterJoint.unit.main_chain_index;
arrChain.push(objLaterJoint);
storage.readUnitProps(db, o... | javascript | function createLinkProof(later_unit, earlier_unit, arrChain, cb){
storage.readJoint(db, later_unit, {
ifNotFound: function(){
cb("later unit not found");
},
ifFound: function(objLaterJoint){
var later_mci = objLaterJoint.unit.main_chain_index;
arrChain.push(objLaterJoint);
storage.readUnitProps(db, o... | [
"function",
"createLinkProof",
"(",
"later_unit",
",",
"earlier_unit",
",",
"arrChain",
",",
"cb",
")",
"{",
"storage",
".",
"readJoint",
"(",
"db",
",",
"later_unit",
",",
"{",
"ifNotFound",
":",
"function",
"(",
")",
"{",
"cb",
"(",
"\"later unit not found... | adds later unit earlier unit is not included in the chain | [
"adds",
"later",
"unit",
"earlier",
"unit",
"is",
"not",
"included",
"in",
"the",
"chain"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/light.js#L441-L480 |
15,299 | byteball/ocore | desktop_app.js | getAppsDataDir | function getAppsDataDir(){
switch(process.platform){
case 'win32': return process.env.LOCALAPPDATA;
case 'linux': return process.env.HOME + '/.config';
case 'darwin': return process.env.HOME + '/Library/Application Support';
default: throw Error("unknown platform "+process.platform);
}
} | javascript | function getAppsDataDir(){
switch(process.platform){
case 'win32': return process.env.LOCALAPPDATA;
case 'linux': return process.env.HOME + '/.config';
case 'darwin': return process.env.HOME + '/Library/Application Support';
default: throw Error("unknown platform "+process.platform);
}
} | [
"function",
"getAppsDataDir",
"(",
")",
"{",
"switch",
"(",
"process",
".",
"platform",
")",
"{",
"case",
"'win32'",
":",
"return",
"process",
".",
"env",
".",
"LOCALAPPDATA",
";",
"case",
"'linux'",
":",
"return",
"process",
".",
"env",
".",
"HOME",
"+"... | make browserify skip it | [
"make",
"browserify",
"skip",
"it"
] | 17e82e31517d62c456c04d898423dc9ab01d96a6 | https://github.com/byteball/ocore/blob/17e82e31517d62c456c04d898423dc9ab01d96a6/desktop_app.js#L6-L13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.