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
14,700
adrai/node-cqrs-domain
lib/aggregateModel.js
function (streamInfo) { if (!streamInfo) { return this.get('_revision'); } streamInfo.context = streamInfo.context || '_general'; return this.get('_revisions')[streamInfo.context + '_' + streamInfo.aggregate + '_' + streamInfo.aggregateId] || 0; }
javascript
function (streamInfo) { if (!streamInfo) { return this.get('_revision'); } streamInfo.context = streamInfo.context || '_general'; return this.get('_revisions')[streamInfo.context + '_' + streamInfo.aggregate + '_' + streamInfo.aggregateId] || 0; }
[ "function", "(", "streamInfo", ")", "{", "if", "(", "!", "streamInfo", ")", "{", "return", "this", ".", "get", "(", "'_revision'", ")", ";", "}", "streamInfo", ".", "context", "=", "streamInfo", ".", "context", "||", "'_general'", ";", "return", "this", ...
Returns the revision of this aggregate. @param {Object} streamInfo The stream info. @returns {Number}
[ "Returns", "the", "revision", "of", "this", "aggregate", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/aggregateModel.js#L68-L74
14,701
adrai/node-cqrs-domain
lib/aggregateModel.js
function (data) { if (arguments.length === 2) { dotty.put(this.attributes, arguments[0], arguments[1]); } else if (_.isObject(data)) { for (var m in data) { dotty.put(this.attributes, m, data[m]); } } }
javascript
function (data) { if (arguments.length === 2) { dotty.put(this.attributes, arguments[0], arguments[1]); } else if (_.isObject(data)) { for (var m in data) { dotty.put(this.attributes, m, data[m]); } } }
[ "function", "(", "data", ")", "{", "if", "(", "arguments", ".", "length", "===", "2", ")", "{", "dotty", ".", "put", "(", "this", ".", "attributes", ",", "arguments", "[", "0", "]", ",", "arguments", "[", "1", "]", ")", ";", "}", "else", "if", ...
Sets attributes for the aggregate. @example: aggregate.set('firstname', 'Jack'); // or aggregate.set({ firstname: 'Jack', lastname: 'X-Man' });
[ "Sets", "attributes", "for", "the", "aggregate", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/aggregateModel.js#L119-L127
14,702
adrai/node-cqrs-domain
lib/aggregateModel.js
function (data) { if (data instanceof AggregateModel) { this.attributes = data.toJSON(); } else { this.attributes = _.cloneDeep(data || {}); } this.attributes.id = this.id; this.attributes._destroyed = this.attributes._destroyed || false; this.attributes._revision = this.attributes....
javascript
function (data) { if (data instanceof AggregateModel) { this.attributes = data.toJSON(); } else { this.attributes = _.cloneDeep(data || {}); } this.attributes.id = this.id; this.attributes._destroyed = this.attributes._destroyed || false; this.attributes._revision = this.attributes....
[ "function", "(", "data", ")", "{", "if", "(", "data", "instanceof", "AggregateModel", ")", "{", "this", ".", "attributes", "=", "data", ".", "toJSON", "(", ")", ";", "}", "else", "{", "this", ".", "attributes", "=", "_", ".", "cloneDeep", "(", "data"...
Resets the attributes for the aggregate.
[ "Resets", "the", "attributes", "for", "the", "aggregate", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/aggregateModel.js#L157-L167
14,703
adrai/node-cqrs-domain
index.js
construct
function construct(klass, args) { function T() { klass.apply(this, arguments[0]); } T.prototype = klass.prototype; return new T(args); }
javascript
function construct(klass, args) { function T() { klass.apply(this, arguments[0]); } T.prototype = klass.prototype; return new T(args); }
[ "function", "construct", "(", "klass", ",", "args", ")", "{", "function", "T", "(", ")", "{", "klass", ".", "apply", "(", "this", ",", "arguments", "[", "0", "]", ")", ";", "}", "T", ".", "prototype", "=", "klass", ".", "prototype", ";", "return", ...
Calls the constructor. @param {Object} klass Constructor function. @param {Array} args Arguments for the constructor function. @return {Object} The new object.
[ "Calls", "the", "constructor", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/index.js#L22-L28
14,704
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
randomBetween
function randomBetween(min, max) { return Math.round(min + Math.random() * (max - min)); }
javascript
function randomBetween(min, max) { return Math.round(min + Math.random() * (max - min)); }
[ "function", "randomBetween", "(", "min", ",", "max", ")", "{", "return", "Math", ".", "round", "(", "min", "+", "Math", ".", "random", "(", ")", "*", "(", "max", "-", "min", ")", ")", ";", "}" ]
Returns a random number between passed values of min and max. @param {Number} min The minimum value of the resulting random number. @param {Number} max The maximum value of the resulting random number. @returns {Number}
[ "Returns", "a", "random", "number", "between", "passed", "values", "of", "min", "and", "max", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L19-L21
14,705
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggregate) { if (!aggregate || !_.isObject(aggregate)) { var err = new Error('Please pass a valid aggregate!'); debug(err); throw err; } this.aggregate = aggregate; }
javascript
function (aggregate) { if (!aggregate || !_.isObject(aggregate)) { var err = new Error('Please pass a valid aggregate!'); debug(err); throw err; } this.aggregate = aggregate; }
[ "function", "(", "aggregate", ")", "{", "if", "(", "!", "aggregate", "||", "!", "_", ".", "isObject", "(", "aggregate", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregate!'", ")", ";", "debug", "(", "err", ")", ";", ...
Injects the needed aggregate. @param {Aggregate} aggregate The aggregate object to inject.
[ "Injects", "the", "needed", "aggregate", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L43-L50
14,706
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (eventStore) { if (!eventStore || !_.isObject(eventStore)) { var err = new Error('Please pass a valid eventStore!'); debug(err); throw err; } this.eventStore = eventStore; }
javascript
function (eventStore) { if (!eventStore || !_.isObject(eventStore)) { var err = new Error('Please pass a valid eventStore!'); debug(err); throw err; } this.eventStore = eventStore; }
[ "function", "(", "eventStore", ")", "{", "if", "(", "!", "eventStore", "||", "!", "_", ".", "isObject", "(", "eventStore", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid eventStore!'", ")", ";", "debug", "(", "err", ")", "...
Injects the needed eventStore. @param {Object} eventStore The eventStore object to inject.
[ "Injects", "the", "needed", "eventStore", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L56-L63
14,707
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggregateLock) { if (!aggregateLock || !_.isObject(aggregateLock)) { var err = new Error('Please pass a valid aggregateLock!'); debug(err); throw err; } this.aggregateLock = aggregateLock; }
javascript
function (aggregateLock) { if (!aggregateLock || !_.isObject(aggregateLock)) { var err = new Error('Please pass a valid aggregateLock!'); debug(err); throw err; } this.aggregateLock = aggregateLock; }
[ "function", "(", "aggregateLock", ")", "{", "if", "(", "!", "aggregateLock", "||", "!", "_", ".", "isObject", "(", "aggregateLock", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregateLock!'", ")", ";", "debug", "(", "err"...
Injects the needed aggregateLock. @param {Object} aggregateLock The aggregateLock object to inject.
[ "Injects", "the", "needed", "aggregateLock", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L69-L76
14,708
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggId, cmd, clb) { if (!aggId || !_.isString(aggId)) { var err = new Error('Please pass a valid aggregate id!'); debug(err); throw err; } if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } if (!c...
javascript
function (aggId, cmd, clb) { if (!aggId || !_.isString(aggId)) { var err = new Error('Please pass a valid aggregate id!'); debug(err); throw err; } if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } if (!c...
[ "function", "(", "aggId", ",", "cmd", ",", "clb", ")", "{", "if", "(", "!", "aggId", "||", "!", "_", ".", "isString", "(", "aggId", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregate id!'", ")", ";", "debug", "(", ...
Queues the passed command and its callback. @param {String} aggId The passed aggregate id. @param {Object} cmd The command to be queued. @param {Function} clb The callback of this command.
[ "Queues", "the", "passed", "command", "and", "its", "callback", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L84-L103
14,709
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggId) { if (!aggId || !_.isString(aggId)) { var err = new Error('Please pass a valid aggregate id!'); debug(err); throw err; } if (this.queue[aggId] && this.queue[aggId].length > 0) { var nextCmd = this.queue[aggId][0]; return nextCmd; } return null; }
javascript
function (aggId) { if (!aggId || !_.isString(aggId)) { var err = new Error('Please pass a valid aggregate id!'); debug(err); throw err; } if (this.queue[aggId] && this.queue[aggId].length > 0) { var nextCmd = this.queue[aggId][0]; return nextCmd; } return null; }
[ "function", "(", "aggId", ")", "{", "if", "(", "!", "aggId", "||", "!", "_", ".", "isString", "(", "aggId", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregate id!'", ")", ";", "debug", "(", "err", ")", ";", "throw"...
Returns next command in the queue @param {String} aggId The passed aggregate id. @returns {Object}
[ "Returns", "next", "command", "in", "the", "queue" ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L110-L123
14,710
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggId, cmd) { if (!aggId || !_.isString(aggId)) { var err = new Error('Please pass a valid aggregate id!'); debug(err); throw err; } _.remove(this.queue[aggId], function (c) { return c.command === cmd; }); }
javascript
function (aggId, cmd) { if (!aggId || !_.isString(aggId)) { var err = new Error('Please pass a valid aggregate id!'); debug(err); throw err; } _.remove(this.queue[aggId], function (c) { return c.command === cmd; }); }
[ "function", "(", "aggId", ",", "cmd", ")", "{", "if", "(", "!", "aggId", "||", "!", "_", ".", "isString", "(", "aggId", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregate id!'", ")", ";", "debug", "(", "err", ")", ...
Removes the passed command from the queue. @param {String} aggId The passed aggregate id. @param {Object} cmd The command to be queued.
[ "Removes", "the", "passed", "command", "from", "the", "queue", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L130-L140
14,711
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggregateId, callback) { if (!aggregateId || !_.isString(aggregateId)) { var err = new Error('Please pass a valid aggregateId!'); debug(err); throw err; } if (!callback || !_.isFunction(callback)) { var err = new Error('Please pass a valid callback!'); debug(err); ...
javascript
function (aggregateId, callback) { if (!aggregateId || !_.isString(aggregateId)) { var err = new Error('Please pass a valid aggregateId!'); debug(err); throw err; } if (!callback || !_.isFunction(callback)) { var err = new Error('Please pass a valid callback!'); debug(err); ...
[ "function", "(", "aggregateId", ",", "callback", ")", "{", "if", "(", "!", "aggregateId", "||", "!", "_", ".", "isString", "(", "aggregateId", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregateId!'", ")", ";", "debug", ...
Locks the aggregate. @param {String} aggregateId The passed aggregateId. @param {Function} callback The function, that will be called when this action is completed. `function(err){}`
[ "Locks", "the", "aggregate", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L148-L160
14,712
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggregate, stream, callback) { if (!aggregate || !_.isObject(aggregate)) { var err = new Error('Please pass a valid aggregate!'); debug(err); throw err; } if (!stream || !_.isObject(stream)) { var err = new Error('Please pass a valid aggregate!'); debug(err); th...
javascript
function (aggregate, stream, callback) { if (!aggregate || !_.isObject(aggregate)) { var err = new Error('Please pass a valid aggregate!'); debug(err); throw err; } if (!stream || !_.isObject(stream)) { var err = new Error('Please pass a valid aggregate!'); debug(err); th...
[ "function", "(", "aggregate", ",", "stream", ",", "callback", ")", "{", "if", "(", "!", "aggregate", "||", "!", "_", ".", "isObject", "(", "aggregate", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregate!'", ")", ";", ...
Creates a new snapshot. @param {AggregateModel} aggregate The passed aggregate. @param {Object} stream The event stream. @param {Function} callback The function, that will be called when this action is completed. [optional] `function(err){}`
[ "Creates", "a", "new", "snapshot", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L500-L556
14,713
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggregate, cmd) { if (!aggregate || !_.isObject(aggregate)) { var err = new Error('Please pass a valid aggregate!'); debug(err); throw err; } if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } v...
javascript
function (aggregate, cmd) { if (!aggregate || !_.isObject(aggregate)) { var err = new Error('Please pass a valid aggregate!'); debug(err); throw err; } if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } v...
[ "function", "(", "aggregate", ",", "cmd", ")", "{", "if", "(", "!", "aggregate", "||", "!", "_", ".", "isObject", "(", "aggregate", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregate!'", ")", ";", "debug", "(", "err"...
Returns an error if the aggregate is destroyed. @param {AggregateModel} aggregate The passed aggregate. @param {Object} cmd The command. @returns {AggregateDestroyedError}
[ "Returns", "an", "error", "if", "the", "aggregate", "is", "destroyed", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L564-L604
14,714
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggregate, cmd) { if (!aggregate || !_.isObject(aggregate)) { var err = new Error('Please pass a valid aggregate!'); debug(err); throw err; } if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } v...
javascript
function (aggregate, cmd) { if (!aggregate || !_.isObject(aggregate)) { var err = new Error('Please pass a valid aggregate!'); debug(err); throw err; } if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } v...
[ "function", "(", "aggregate", ",", "cmd", ")", "{", "if", "(", "!", "aggregate", "||", "!", "_", ".", "isObject", "(", "aggregate", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregate!'", ")", ";", "debug", "(", "err"...
Returns an error if the revision does not match. @param {AggregateModel} aggregate The passed aggregate. @param {Object} cmd The command. @returns {AggregateConcurrencyError}
[ "Returns", "an", "error", "if", "the", "revision", "does", "not", "match", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L612-L664
14,715
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (cmd, callback) { if (!cmd || !_.isObject(cmd)) { debug(err); return callback(new Error('Please pass a valid command!'), null); } return this.aggregate.validateCommand(cmd, callback); }
javascript
function (cmd, callback) { if (!cmd || !_.isObject(cmd)) { debug(err); return callback(new Error('Please pass a valid command!'), null); } return this.aggregate.validateCommand(cmd, callback); }
[ "function", "(", "cmd", ",", "callback", ")", "{", "if", "(", "!", "cmd", "||", "!", "_", ".", "isObject", "(", "cmd", ")", ")", "{", "debug", "(", "err", ")", ";", "return", "callback", "(", "new", "Error", "(", "'Please pass a valid command!'", ")"...
Returns an error if the command is not valid. @param {Object} cmd The command. @returns {ValidationError}
[ "Returns", "an", "error", "if", "the", "command", "is", "not", "valid", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L671-L677
14,716
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggregate, cmd) { if (!aggregate || !_.isObject(aggregate)) { var err = new Error('Please pass a valid aggregate!'); debug(err); throw err; } if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } v...
javascript
function (aggregate, cmd) { if (!aggregate || !_.isObject(aggregate)) { var err = new Error('Please pass a valid aggregate!'); debug(err); throw err; } if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } v...
[ "function", "(", "aggregate", ",", "cmd", ")", "{", "if", "(", "!", "aggregate", "||", "!", "_", ".", "isObject", "(", "aggregate", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregate!'", ")", ";", "debug", "(", "err"...
Returns an error if verification fails. @param {AggregateModel} aggregate The passed aggregate. @param {Object} cmd The command. @returns {Error}
[ "Returns", "an", "error", "if", "verification", "fails", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L689-L712
14,717
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggregate, cmd, callback) { if (!aggregate || !_.isObject(aggregate)) { var err = new Error('Please pass a valid aggregate!'); debug(err); throw err; } if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; ...
javascript
function (aggregate, cmd, callback) { if (!aggregate || !_.isObject(aggregate)) { var err = new Error('Please pass a valid aggregate!'); debug(err); throw err; } if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; ...
[ "function", "(", "aggregate", ",", "cmd", ",", "callback", ")", "{", "if", "(", "!", "aggregate", "||", "!", "_", ".", "isObject", "(", "aggregate", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregate!'", ")", ";", "d...
Handles the command by passing it to the handle function of the aggregate. @param {AggregateModel} aggregate The passed aggregate. @param {Object} cmd The command. @param {Function} callback The function, that will be called when this action is completed. `function(err){}`
[ "Handles", "the", "command", "by", "passing", "it", "to", "the", "handle", "function", "of", "the", "aggregate", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L721-L739
14,718
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggregateId, callback) { if (!aggregateId || !_.isString(aggregateId)) { var err = new Error('Please pass a valid aggregateId!'); debug(err); throw err; } if (!callback || !_.isFunction(callback)) { var err = new Error('Please pass a valid callback!'); debug(err); ...
javascript
function (aggregateId, callback) { if (!aggregateId || !_.isString(aggregateId)) { var err = new Error('Please pass a valid aggregateId!'); debug(err); throw err; } if (!callback || !_.isFunction(callback)) { var err = new Error('Please pass a valid callback!'); debug(err); ...
[ "function", "(", "aggregateId", ",", "callback", ")", "{", "if", "(", "!", "aggregateId", "||", "!", "_", ".", "isString", "(", "aggregateId", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregateId!'", ")", ";", "debug", ...
Checks if the aggregate lock is ok. @param {String} aggregateId The passed aggregateId. @param {Function} callback The function, that will be called when this action is completed. `function(err){}`
[ "Checks", "if", "the", "aggregate", "lock", "is", "ok", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L747-L774
14,719
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggregateId, callback) { if (!aggregateId || !_.isString(aggregateId)) { var err = new Error('Please pass a valid aggregateId!'); debug(err); throw err; } if (!callback || !_.isFunction(callback)) { var err = new Error('Please pass a valid callback!'); debug(err); ...
javascript
function (aggregateId, callback) { if (!aggregateId || !_.isString(aggregateId)) { var err = new Error('Please pass a valid aggregateId!'); debug(err); throw err; } if (!callback || !_.isFunction(callback)) { var err = new Error('Please pass a valid callback!'); debug(err); ...
[ "function", "(", "aggregateId", ",", "callback", ")", "{", "if", "(", "!", "aggregateId", "||", "!", "_", ".", "isString", "(", "aggregateId", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid aggregateId!'", ")", ";", "debug", ...
Resolves if the aggregate lock. @param {String} aggregateId The passed aggregateId. @param {Function} callback The function, that will be called when this action is completed. `function(err){}`
[ "Resolves", "if", "the", "aggregate", "lock", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L782-L795
14,720
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggregate, streams, clb) { debug('handle command'); self.letHandleCommandByAggregate(aggregate, cmd, function (err) { // err is a business rule error if (err) { return clb(err); } clb(null, aggregate, streams); }); }
javascript
function (aggregate, streams, clb) { debug('handle command'); self.letHandleCommandByAggregate(aggregate, cmd, function (err) { // err is a business rule error if (err) { return clb(err); } clb(null, aggregate, streams); }); }
[ "function", "(", "aggregate", ",", "streams", ",", "clb", ")", "{", "debug", "(", "'handle command'", ")", ";", "self", ".", "letHandleCommandByAggregate", "(", "aggregate", ",", "cmd", ",", "function", "(", "err", ")", "{", "// err is a business rule error", ...
handle command and check business rules
[ "handle", "command", "and", "check", "business", "rules" ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L1015-L1023
14,721
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (aggregate, streams, clb) { if (hadNoAggregateId) return clb(null, aggregate, streams); debug('check aggregate lock'); self.checkAggregateLock(concatenatedId, function (err) { clb(err, aggregate, streams); }); }
javascript
function (aggregate, streams, clb) { if (hadNoAggregateId) return clb(null, aggregate, streams); debug('check aggregate lock'); self.checkAggregateLock(concatenatedId, function (err) { clb(err, aggregate, streams); }); }
[ "function", "(", "aggregate", ",", "streams", ",", "clb", ")", "{", "if", "(", "hadNoAggregateId", ")", "return", "clb", "(", "null", ",", "aggregate", ",", "streams", ")", ";", "debug", "(", "'check aggregate lock'", ")", ";", "self", ".", "checkAggregate...
check aggregate lock
[ "check", "aggregate", "lock" ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L1026-L1032
14,722
adrai/node-cqrs-domain
lib/defaultCommandHandler.js
function (cmd, callback) { var getNewIdFn = this.eventStore.getNewId.bind(this.eventStore); if (this.aggregate && this.aggregate.getNewAggregateId) { getNewIdFn = this.aggregate.getNewAggregateId.bind(this.aggregate); } else if (this.getNewAggregateIdFn) { getNewIdFn = this.getNewAggregateIdFn.b...
javascript
function (cmd, callback) { var getNewIdFn = this.eventStore.getNewId.bind(this.eventStore); if (this.aggregate && this.aggregate.getNewAggregateId) { getNewIdFn = this.aggregate.getNewAggregateId.bind(this.aggregate); } else if (this.getNewAggregateIdFn) { getNewIdFn = this.getNewAggregateIdFn.b...
[ "function", "(", "cmd", ",", "callback", ")", "{", "var", "getNewIdFn", "=", "this", ".", "eventStore", ".", "getNewId", ".", "bind", "(", "this", ".", "eventStore", ")", ";", "if", "(", "this", ".", "aggregate", "&&", "this", ".", "aggregate", ".", ...
IdGenerator function for aggregate id. @param {Function} callback The function, that will be called when this action is completed. `function(err, newId){}`
[ "IdGenerator", "function", "for", "aggregate", "id", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/defaultCommandHandler.js#L1200-L1213
14,723
adrai/node-cqrs-domain
lib/domain.js
function (fn) { if (!fn || !_.isFunction(fn)) { var err = new Error('Please pass a valid function!'); debug(err); throw err; } this.structureLoader = customLoader(fn); return this; }
javascript
function (fn) { if (!fn || !_.isFunction(fn)) { var err = new Error('Please pass a valid function!'); debug(err); throw err; } this.structureLoader = customLoader(fn); return this; }
[ "function", "(", "fn", ")", "{", "if", "(", "!", "fn", "||", "!", "_", ".", "isFunction", "(", "fn", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid function!'", ")", ";", "debug", "(", "err", ")", ";", "throw", "err", ...
Inject custom structure loader function @param {Function} fn The function to be injected. @returns {Domain} to be able to chain...
[ "Inject", "custom", "structure", "loader", "function" ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/domain.js#L285-L295
14,724
adrai/node-cqrs-domain
lib/domain.js
function (cmd, err) { if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } if (!err || !_.isObject(err)) { var err = new Error('Please pass a valid error!'); debug(err); throw err; } var evt = {}; if (...
javascript
function (cmd, err) { if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } if (!err || !_.isObject(err)) { var err = new Error('Please pass a valid error!'); debug(err); throw err; } var evt = {}; if (...
[ "function", "(", "cmd", ",", "err", ")", "{", "if", "(", "!", "cmd", "||", "!", "_", ".", "isObject", "(", "cmd", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid command!'", ")", ";", "debug", "(", "err", ")", ";", "t...
Converts an error to the commandRejected event @param {Object} cmd The command that was handled. @param {Error} err The error that occurs. @returns {Object} The resulting event.
[ "Converts", "an", "error", "to", "the", "commandRejected", "event" ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/domain.js#L328-L379
14,725
adrai/node-cqrs-domain
lib/domain.js
function (fn) { if (!fn || !_.isFunction(fn) || fn.length !== 1) { var err = new Error('Please pass a valid function!'); debug(err); throw err; } this.validatorExtension = fn; return this; }
javascript
function (fn) { if (!fn || !_.isFunction(fn) || fn.length !== 1) { var err = new Error('Please pass a valid function!'); debug(err); throw err; } this.validatorExtension = fn; return this; }
[ "function", "(", "fn", ")", "{", "if", "(", "!", "fn", "||", "!", "_", ".", "isFunction", "(", "fn", ")", "||", "fn", ".", "length", "!==", "1", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid function!'", ")", ";", "debug",...
Extends the validator instance. @param {Function} fn the function to be injected @returns {Domain} to be able to chain...
[ "Extends", "the", "validator", "instance", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/domain.js#L400-L410
14,726
adrai/node-cqrs-domain
lib/domain.js
function (callback) { debug('prepare eventStore...'); self.eventStore.on('connect', function () { self.emit('connect'); }); self.eventStore.on('disconnect', function () { self.emit('disconnect'); }); self.eventStore.i...
javascript
function (callback) { debug('prepare eventStore...'); self.eventStore.on('connect', function () { self.emit('connect'); }); self.eventStore.on('disconnect', function () { self.emit('disconnect'); }); self.eventStore.i...
[ "function", "(", "callback", ")", "{", "debug", "(", "'prepare eventStore...'", ")", ";", "self", ".", "eventStore", ".", "on", "(", "'connect'", ",", "function", "(", ")", "{", "self", ".", "emit", "(", "'connect'", ")", ";", "}", ")", ";", "self", ...
prepare eventStore...
[ "prepare", "eventStore", "..." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/domain.js#L447-L459
14,727
adrai/node-cqrs-domain
lib/domain.js
function (callback) { debug('prepare aggregateLock...'); self.aggregateLock.on('connect', function () { self.emit('connect'); }); self.aggregateLock.on('disconnect', function () { self.emit('disconnect'); }); self.agg...
javascript
function (callback) { debug('prepare aggregateLock...'); self.aggregateLock.on('connect', function () { self.emit('connect'); }); self.aggregateLock.on('disconnect', function () { self.emit('disconnect'); }); self.agg...
[ "function", "(", "callback", ")", "{", "debug", "(", "'prepare aggregateLock...'", ")", ";", "self", ".", "aggregateLock", ".", "on", "(", "'connect'", ",", "function", "(", ")", "{", "self", ".", "emit", "(", "'connect'", ")", ";", "}", ")", ";", "sel...
prepare aggregateLock...
[ "prepare", "aggregateLock", "..." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/domain.js#L462-L474
14,728
adrai/node-cqrs-domain
lib/domain.js
function (callback) { if (!self.commandBumper) { return callback(null); } debug('prepare commandBumper...'); self.commandBumper.on('connect', function () { self.emit('connect'); }); self.commandBumper.on('disconnect', ...
javascript
function (callback) { if (!self.commandBumper) { return callback(null); } debug('prepare commandBumper...'); self.commandBumper.on('connect', function () { self.emit('connect'); }); self.commandBumper.on('disconnect', ...
[ "function", "(", "callback", ")", "{", "if", "(", "!", "self", ".", "commandBumper", ")", "{", "return", "callback", "(", "null", ")", ";", "}", "debug", "(", "'prepare commandBumper...'", ")", ";", "self", ".", "commandBumper", ".", "on", "(", "'connect...
prepare commandBumper...
[ "prepare", "commandBumper", "..." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/domain.js#L477-L492
14,729
adrai/node-cqrs-domain
lib/domain.js
function (cmd, callback) { if (!cmd || !_.isObject(cmd) || !dotty.exists(cmd, this.definitions.command.name)) { var err = new Error('Please pass a valid command!'); debug(err); if (callback) callback(err); return; } var self = this; process.nextTick(function () { if (callb...
javascript
function (cmd, callback) { if (!cmd || !_.isObject(cmd) || !dotty.exists(cmd, this.definitions.command.name)) { var err = new Error('Please pass a valid command!'); debug(err); if (callback) callback(err); return; } var self = this; process.nextTick(function () { if (callb...
[ "function", "(", "cmd", ",", "callback", ")", "{", "if", "(", "!", "cmd", "||", "!", "_", ".", "isObject", "(", "cmd", ")", "||", "!", "dotty", ".", "exists", "(", "cmd", ",", "this", ".", "definitions", ".", "command", ".", "name", ")", ")", "...
Call this function to let the domain handle it. @param {Object} cmd the command object @param {Function} callback the function that will be called when this action has finished [optional] `function(err, evts, aggregateData, meta){}` evts is of type Array, aggregateData and meta are an object
[ "Call", "this", "function", "to", "let", "the", "domain", "handle", "it", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/domain.js#L654-L674
14,730
adrai/node-cqrs-domain
lib/definitions/event.js
function (evt, aggregateModel) { if (!this.evtFn) { return; } if (!this.payload || this.payload === '') { this.evtFn(evt, aggregateModel); return; } var payload = dotty.get(evt, this.payload); this.evtFn(payload, aggregateModel); }
javascript
function (evt, aggregateModel) { if (!this.evtFn) { return; } if (!this.payload || this.payload === '') { this.evtFn(evt, aggregateModel); return; } var payload = dotty.get(evt, this.payload); this.evtFn(payload, aggregateModel); }
[ "function", "(", "evt", ",", "aggregateModel", ")", "{", "if", "(", "!", "this", ".", "evtFn", ")", "{", "return", ";", "}", "if", "(", "!", "this", ".", "payload", "||", "this", ".", "payload", "===", "''", ")", "{", "this", ".", "evtFn", "(", ...
Apply an event. @param {Object} evt The event object. @param {AggregateModel} aggregateModel The aggregate object.
[ "Apply", "an", "event", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/event.js#L40-L52
14,731
adrai/node-cqrs-domain
lib/validator.js
getValidator
function getValidator (options, schema) { options = options || {}; options.schemas = options.schemas || {}; options.formats = options.formats || {}; if (!schema || !_.isObject(schema)) { var err = new Error('Please pass a valid schema!'); debug(err); throw err; } var tv4 = tv4Module.freshApi()...
javascript
function getValidator (options, schema) { options = options || {}; options.schemas = options.schemas || {}; options.formats = options.formats || {}; if (!schema || !_.isObject(schema)) { var err = new Error('Please pass a valid schema!'); debug(err); throw err; } var tv4 = tv4Module.freshApi()...
[ "function", "getValidator", "(", "options", ",", "schema", ")", "{", "options", "=", "options", "||", "{", "}", ";", "options", ".", "schemas", "=", "options", ".", "schemas", "||", "{", "}", ";", "options", ".", "formats", "=", "options", ".", "format...
Returns a validator function. @param {Object} options The options object. @param {Object} schema The schema object. @returns {Function}
[ "Returns", "a", "validator", "function", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/validator.js#L12-L58
14,732
adrai/node-cqrs-domain
lib/commandDispatcher.js
function (cmd) { if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } var aggregateId = null; if (dotty.exists(cmd, this.definition.aggregateId)) { aggregateId = dotty.get(cmd, this.definition.aggregateId); } else { ...
javascript
function (cmd) { if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } var aggregateId = null; if (dotty.exists(cmd, this.definition.aggregateId)) { aggregateId = dotty.get(cmd, this.definition.aggregateId); } else { ...
[ "function", "(", "cmd", ")", "{", "if", "(", "!", "cmd", "||", "!", "_", ".", "isObject", "(", "cmd", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid command!'", ")", ";", "debug", "(", "err", ")", ";", "throw", "err", ...
Returns the target information of this command. @param {Object} cmd The passed command. @returns {{name: 'commandName', aggregateId: 'aggregateId', version: 0, aggregate: 'aggregateName', context: 'contextName'}}
[ "Returns", "the", "target", "information", "of", "this", "command", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/commandDispatcher.js#L39-L83
14,733
adrai/node-cqrs-domain
lib/commandDispatcher.js
function (cmd, callback) { if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } if (!callback || !_.isFunction(callback)) { var err = new Error('Please pass a valid callback!'); debug(err); throw err; } va...
javascript
function (cmd, callback) { if (!cmd || !_.isObject(cmd)) { var err = new Error('Please pass a valid command!'); debug(err); throw err; } if (!callback || !_.isFunction(callback)) { var err = new Error('Please pass a valid callback!'); debug(err); throw err; } va...
[ "function", "(", "cmd", ",", "callback", ")", "{", "if", "(", "!", "cmd", "||", "!", "_", ".", "isObject", "(", "cmd", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid command!'", ")", ";", "debug", "(", "err", ")", ";",...
Dispatches a command. @param {Object} cmd The passed command. @param {Function} callback The function, that will be called when this action is completed. `function(err, evts){}`
[ "Dispatches", "a", "command", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/commandDispatcher.js#L91-L135
14,734
adrai/node-cqrs-domain
lib/definitions/committingEventTransformer.js
function (evt, callback) { var self = this; var callbacked = false; function handleError (err) { debug(err); callbacked = true; callback(err); } try { if (this.transformFn.length === 2) { this.transformFn(_.cloneDeep(evt), function (err, newEvt) { if (err)...
javascript
function (evt, callback) { var self = this; var callbacked = false; function handleError (err) { debug(err); callbacked = true; callback(err); } try { if (this.transformFn.length === 2) { this.transformFn(_.cloneDeep(evt), function (err, newEvt) { if (err)...
[ "function", "(", "evt", ",", "callback", ")", "{", "var", "self", "=", "this", ";", "var", "callbacked", "=", "false", ";", "function", "handleError", "(", "err", ")", "{", "debug", "(", "err", ")", ";", "callbacked", "=", "true", ";", "callback", "(...
transform an CommittingEventTransformer. @param {Object} evt The CommittingEventTransformer object. @param {Function} callback The function, that will be called when this action is completed. `function(err, evt){}`
[ "transform", "an", "CommittingEventTransformer", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/committingEventTransformer.js#L39-L66
14,735
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (context) { if (!context || !_.isObject(context)) { var err = new Error('Please inject a valid context object!'); debug(err); throw err; } this.context = context; for (var r in this.snapshotConversionRegistrations) { var reg = this.snapshotConversionRegistrations[r]; ...
javascript
function (context) { if (!context || !_.isObject(context)) { var err = new Error('Please inject a valid context object!'); debug(err); throw err; } this.context = context; for (var r in this.snapshotConversionRegistrations) { var reg = this.snapshotConversionRegistrations[r]; ...
[ "function", "(", "context", ")", "{", "if", "(", "!", "context", "||", "!", "_", ".", "isObject", "(", "context", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please inject a valid context object!'", ")", ";", "debug", "(", "err", ")", ";",...
Inject the context module. @param {Context} context The context module to be injected.
[ "Inject", "the", "context", "module", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L189-L230
14,736
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (command) { if (!command || !_.isObject(command)) { var err = new Error('Please inject a valid command object!'); debug(err); throw err; } if (!command.payload && command.payload !== '') { command.payload = this.defaultCommandPayload; } command.defineAggregate(this...
javascript
function (command) { if (!command || !_.isObject(command)) { var err = new Error('Please inject a valid command object!'); debug(err); throw err; } if (!command.payload && command.payload !== '') { command.payload = this.defaultCommandPayload; } command.defineAggregate(this...
[ "function", "(", "command", ")", "{", "if", "(", "!", "command", "||", "!", "_", ".", "isObject", "(", "command", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please inject a valid command object!'", ")", ";", "debug", "(", "err", ")", ";",...
Add command module. @param {Command} command The command module to be injected.
[ "Add", "command", "module", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L236-L252
14,737
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (event) { if (!event || !_.isObject(event)) { var err = new Error('Please inject a valid event object!'); debug(err); throw err; } if (!event.payload && event.payload !== '') { event.payload = this.defaultEventPayload; } if (this.events.indexOf(event) < 0) { ...
javascript
function (event) { if (!event || !_.isObject(event)) { var err = new Error('Please inject a valid event object!'); debug(err); throw err; } if (!event.payload && event.payload !== '') { event.payload = this.defaultEventPayload; } if (this.events.indexOf(event) < 0) { ...
[ "function", "(", "event", ")", "{", "if", "(", "!", "event", "||", "!", "_", ".", "isObject", "(", "event", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please inject a valid event object!'", ")", ";", "debug", "(", "err", ")", ";", "thro...
Add event module. @param {Event} event The event module to be injected.
[ "Add", "event", "module", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L258-L272
14,738
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (businessRule) { if (!businessRule || !_.isObject(businessRule)) { var err = new Error('Please inject a valid businessRule object!'); debug(err); throw err; } if (this.businessRules.indexOf(businessRule) < 0) { businessRule.defineAggregate(this); this.businessRules.pu...
javascript
function (businessRule) { if (!businessRule || !_.isObject(businessRule)) { var err = new Error('Please inject a valid businessRule object!'); debug(err); throw err; } if (this.businessRules.indexOf(businessRule) < 0) { businessRule.defineAggregate(this); this.businessRules.pu...
[ "function", "(", "businessRule", ")", "{", "if", "(", "!", "businessRule", "||", "!", "_", ".", "isObject", "(", "businessRule", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please inject a valid businessRule object!'", ")", ";", "debug", "(", ...
Add businessRule module. @param {BusinessRule} businessRule The businessRule module to be injected.
[ "Add", "businessRule", "module", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L278-L292
14,739
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (loadingEventTransformer) { if (!loadingEventTransformer || !_.isObject(loadingEventTransformer)) { var err = new Error('Please inject a valid loadingEventTransformer object!'); debug(err); throw err; } if (this.loadingEventTransformers.indexOf(loadingEventTransformer) < 0) { ...
javascript
function (loadingEventTransformer) { if (!loadingEventTransformer || !_.isObject(loadingEventTransformer)) { var err = new Error('Please inject a valid loadingEventTransformer object!'); debug(err); throw err; } if (this.loadingEventTransformers.indexOf(loadingEventTransformer) < 0) { ...
[ "function", "(", "loadingEventTransformer", ")", "{", "if", "(", "!", "loadingEventTransformer", "||", "!", "_", ".", "isObject", "(", "loadingEventTransformer", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please inject a valid loadingEventTransformer o...
Add loadingEventTransformer module. @param {LoadingEventTransformer} loadingEventTransformer The loadingEventTransformer module to be injected.
[ "Add", "loadingEventTransformer", "module", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L298-L308
14,740
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (committingEventTransformer) { if (!committingEventTransformer || !_.isObject(committingEventTransformer)) { var err = new Error('Please inject a valid committingEventTransformer object!'); debug(err); throw err; } if (this.committingEventTransformers.indexOf(committingEventTrans...
javascript
function (committingEventTransformer) { if (!committingEventTransformer || !_.isObject(committingEventTransformer)) { var err = new Error('Please inject a valid committingEventTransformer object!'); debug(err); throw err; } if (this.committingEventTransformers.indexOf(committingEventTrans...
[ "function", "(", "committingEventTransformer", ")", "{", "if", "(", "!", "committingEventTransformer", "||", "!", "_", ".", "isObject", "(", "committingEventTransformer", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please inject a valid committingEventT...
Add committingEventTransformer module. @param {CommittingEventTransformer} committingEventTransformer The committingEventTransformer module to be injected.
[ "Add", "committingEventTransformer", "module", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L314-L324
14,741
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (commandHandler) { if (!commandHandler || !_.isObject(commandHandler) || !_.isFunction(commandHandler.useAggregate)) { var err = new Error('Please inject a valid commandHandler object!'); debug(err); throw err; } commandHandler.useAggregate(this); if (this.commandHandlers.in...
javascript
function (commandHandler) { if (!commandHandler || !_.isObject(commandHandler) || !_.isFunction(commandHandler.useAggregate)) { var err = new Error('Please inject a valid commandHandler object!'); debug(err); throw err; } commandHandler.useAggregate(this); if (this.commandHandlers.in...
[ "function", "(", "commandHandler", ")", "{", "if", "(", "!", "commandHandler", "||", "!", "_", ".", "isObject", "(", "commandHandler", ")", "||", "!", "_", ".", "isFunction", "(", "commandHandler", ".", "useAggregate", ")", ")", "{", "var", "err", "=", ...
Add commandHandler module. @param {CommandHandler} commandHandler The commandHandler module to be injected.
[ "Add", "commandHandler", "module", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L330-L342
14,742
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (name) { if (!name || !_.isString(name)) { var err = new Error('Please pass a valid string as name!'); debug(err); throw err; } return _.filter(this.commands, function (cmd) { return cmd.name === name; }); }
javascript
function (name) { if (!name || !_.isString(name)) { var err = new Error('Please pass a valid string as name!'); debug(err); throw err; } return _.filter(this.commands, function (cmd) { return cmd.name === name; }); }
[ "function", "(", "name", ")", "{", "if", "(", "!", "name", "||", "!", "_", ".", "isString", "(", "name", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid string as name!'", ")", ";", "debug", "(", "err", ")", ";", "throw",...
Returns the command modules by command name. @param {String} name The command name. @returns {Array}
[ "Returns", "the", "command", "modules", "by", "command", "name", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L349-L359
14,743
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (name, version) { if (!name || !_.isString(name)) { var err = new Error('Please pass a valid string as name!'); debug(err); throw err; } version = version || 0; if (!_.isNumber(version)) { var err = new Error('Please pass a valid number as version!'); debug(err);...
javascript
function (name, version) { if (!name || !_.isString(name)) { var err = new Error('Please pass a valid string as name!'); debug(err); throw err; } version = version || 0; if (!_.isNumber(version)) { var err = new Error('Please pass a valid number as version!'); debug(err);...
[ "function", "(", "name", ",", "version", ")", "{", "if", "(", "!", "name", "||", "!", "_", ".", "isString", "(", "name", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid string as name!'", ")", ";", "debug", "(", "err", ")...
Returns the command module by command name and command version. @param {String} name The command name. @param {Number} version The command version. [optional; default 0] @returns {Command}
[ "Returns", "the", "command", "module", "by", "command", "name", "and", "command", "version", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L367-L385
14,744
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (name, version) { if (!name || !_.isString(name)) { var err = new Error('Please pass a valid string as name!'); debug(err); throw err; } version = version || 0; if (!_.isNumber(version)) { var err = new Error('Please pass a valid number as version!'); debug(err);...
javascript
function (name, version) { if (!name || !_.isString(name)) { var err = new Error('Please pass a valid string as name!'); debug(err); throw err; } version = version || 0; if (!_.isNumber(version)) { var err = new Error('Please pass a valid number as version!'); debug(err);...
[ "function", "(", "name", ",", "version", ")", "{", "if", "(", "!", "name", "||", "!", "_", ".", "isString", "(", "name", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid string as name!'", ")", ";", "debug", "(", "err", ")...
Returns the event module by event name and event version. @param {String} name The event name. @param {Number} version The event version. [optional; default 0] @returns {Event}
[ "Returns", "the", "event", "module", "by", "event", "name", "and", "event", "version", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L401-L419
14,745
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (name, version) { if (!name || !_.isString(name)) { var err = new Error('Please pass a valid string as name!'); debug(err); throw err; } version = version || 0; if (!_.isNumber(version)) { var err = new Error('Please pass a valid number as version!'); debug(err);...
javascript
function (name, version) { if (!name || !_.isString(name)) { var err = new Error('Please pass a valid string as name!'); debug(err); throw err; } version = version || 0; if (!_.isNumber(version)) { var err = new Error('Please pass a valid number as version!'); debug(err);...
[ "function", "(", "name", ",", "version", ")", "{", "if", "(", "!", "name", "||", "!", "_", ".", "isString", "(", "name", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid string as name!'", ")", ";", "debug", "(", "err", ")...
Returns the commandHandler module by command name and command version. @param {String} name The command name. @param {Number} version The command version. [optional; default 0] @returns {CommandHandler}
[ "Returns", "the", "commandHandler", "module", "by", "command", "name", "and", "command", "version", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L451-L479
14,746
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (name, version) { if (!name || !_.isString(name)) { var err = new Error('Please pass a valid string as name!'); debug(err); throw err; } version = version || 0; if (!_.isNumber(version)) { var err = new Error('Please pass a valid number as version!'); debug(err);...
javascript
function (name, version) { if (!name || !_.isString(name)) { var err = new Error('Please pass a valid string as name!'); debug(err); throw err; } version = version || 0; if (!_.isNumber(version)) { var err = new Error('Please pass a valid number as version!'); debug(err);...
[ "function", "(", "name", ",", "version", ")", "{", "if", "(", "!", "name", "||", "!", "_", ".", "isString", "(", "name", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid string as name!'", ")", ";", "debug", "(", "err", ")...
Returns the loadingEventTransformer module by event name and event version. @param {String} name The event name. @param {Number} version The event version. [optional; default 0] @returns {Event}
[ "Returns", "the", "loadingEventTransformer", "module", "by", "event", "name", "and", "event", "version", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L487-L511
14,747
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (id) { if (!id || !_.isString(id)) { var err = new Error('Please pass a valid string as id!'); debug(err); throw err; } return new AggregateModel(id, this.modelInitValues); }
javascript
function (id) { if (!id || !_.isString(id)) { var err = new Error('Please pass a valid string as id!'); debug(err); throw err; } return new AggregateModel(id, this.modelInitValues); }
[ "function", "(", "id", ")", "{", "if", "(", "!", "id", "||", "!", "_", ".", "isString", "(", "id", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass a valid string as id!'", ")", ";", "debug", "(", "err", ")", ";", "throw", "err"...
Returns a new aggregate model, to be used in the command and event functions. @param {String} id The aggregate id. @returns {AggregateModel}
[ "Returns", "a", "new", "aggregate", "model", "to", "be", "used", "in", "the", "command", "and", "event", "functions", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L550-L558
14,748
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (cmd, callback) { var cmdName = dotty.get(cmd, this.definitions.command.name); var err; if (!cmdName) { err = new Error('command has no command name in ' + this.definitions.command.name); debug(err); return callback(err); } var version = 0; if (!!this.definitions.com...
javascript
function (cmd, callback) { var cmdName = dotty.get(cmd, this.definitions.command.name); var err; if (!cmdName) { err = new Error('command has no command name in ' + this.definitions.command.name); debug(err); return callback(err); } var version = 0; if (!!this.definitions.com...
[ "function", "(", "cmd", ",", "callback", ")", "{", "var", "cmdName", "=", "dotty", ".", "get", "(", "cmd", ",", "this", ".", "definitions", ".", "command", ".", "name", ")", ";", "var", "err", ";", "if", "(", "!", "cmdName", ")", "{", "err", "=",...
Validates the requested command. @param {Object} cmd The command object @returns {ValidationError}
[ "Validates", "the", "requested", "command", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L565-L596
14,749
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (cmd, callback) { var cmdName = dotty.get(cmd, this.definitions.command.name); if (!cmdName) { var err = new Error('command has no command name in ' + this.definitions.command.name); debug(err); throw err; } var version = 0; if (!!this.definitions.command.version) { ...
javascript
function (cmd, callback) { var cmdName = dotty.get(cmd, this.definitions.command.name); if (!cmdName) { var err = new Error('command has no command name in ' + this.definitions.command.name); debug(err); throw err; } var version = 0; if (!!this.definitions.command.version) { ...
[ "function", "(", "cmd", ",", "callback", ")", "{", "var", "cmdName", "=", "dotty", ".", "get", "(", "cmd", ",", "this", ".", "definitions", ".", "command", ".", "name", ")", ";", "if", "(", "!", "cmdName", ")", "{", "var", "err", "=", "new", "Err...
Checks for pre-load-conditions. This check will be done BEFORE the aggregate is locked and loaded. @param {Object} cmd The command that was handled. @param {Function} callback The function, that will be called when this action is completed. `function(err){}`
[ "Checks", "for", "pre", "-", "load", "-", "conditions", ".", "This", "check", "will", "be", "done", "BEFORE", "the", "aggregate", "is", "locked", "and", "loaded", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L603-L625
14,750
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (changed, previous, events, command, callback) { async.eachSeries(this.getBusinessRules(), function (rule, callback) { rule.check(changed, previous, events, command, callback); }, callback); }
javascript
function (changed, previous, events, command, callback) { async.eachSeries(this.getBusinessRules(), function (rule, callback) { rule.check(changed, previous, events, command, callback); }, callback); }
[ "function", "(", "changed", ",", "previous", ",", "events", ",", "command", ",", "callback", ")", "{", "async", ".", "eachSeries", "(", "this", ".", "getBusinessRules", "(", ")", ",", "function", "(", "rule", ",", "callback", ")", "{", "rule", ".", "ch...
Checks business rules. @param {Object} changed The new aggregate values. @param {Object} previous The previous aggregate values. @param {Array} events All new generated events. @param {Object} command The command that was handled. @param {Function} callback The function, that will be called when this actio...
[ "Checks", "business", "rules", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L667-L671
14,751
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (aggregateModel, cmd, callback) { var cmdName = dotty.get(cmd, this.definitions.command.name); if (!cmdName) { var err = new Error('command has no command name in ' + this.definitions.command.name); debug(err); return callback(err); } var version = 0; if (!!this.definitio...
javascript
function (aggregateModel, cmd, callback) { var cmdName = dotty.get(cmd, this.definitions.command.name); if (!cmdName) { var err = new Error('command has no command name in ' + this.definitions.command.name); debug(err); return callback(err); } var version = 0; if (!!this.definitio...
[ "function", "(", "aggregateModel", ",", "cmd", ",", "callback", ")", "{", "var", "cmdName", "=", "dotty", ".", "get", "(", "cmd", ",", "this", ".", "definitions", ".", "command", ".", "name", ")", ";", "if", "(", "!", "cmdName", ")", "{", "var", "e...
Handles the passed command and checks the business rules. @param {AggregateModel} aggregateModel The aggregateModel that should be used. @param {Object} cmd The command that was handled. @param {Function} callback The function, that will be called when this action is completed. `functi...
[ "Handles", "the", "passed", "command", "and", "checks", "the", "business", "rules", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L715-L795
14,752
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (events, aggregateModel, notSameOrigin) { if (!events) { return; } if (!_.isArray(events)) { events = [events]; } var self = this; events.forEach(function (evt) { var evtName = dotty.get(evt, self.definitions.event.name); if (!evtName) { var err = new ...
javascript
function (events, aggregateModel, notSameOrigin) { if (!events) { return; } if (!_.isArray(events)) { events = [events]; } var self = this; events.forEach(function (evt) { var evtName = dotty.get(evt, self.definitions.event.name); if (!evtName) { var err = new ...
[ "function", "(", "events", ",", "aggregateModel", ",", "notSameOrigin", ")", "{", "if", "(", "!", "events", ")", "{", "return", ";", "}", "if", "(", "!", "_", ".", "isArray", "(", "events", ")", ")", "{", "events", "=", "[", "events", "]", ";", "...
Applies the passed events to the passed aggregateModel. @param {Array || Object} events The events that should be applied. @param {AggregateModel} aggregateModel The aggregateModel that should be used. @param {boolean} notSameOrigin If true it's an indication to not throw if event handler not found.
[ "Applies", "the", "passed", "events", "to", "the", "passed", "aggregateModel", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L803-L841
14,753
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (aggregateModel, snapshot, events, loadingTime, stream, streams, notSameOrigin) { var self = this; var isSnapshotNeeded = false; if (snapshot) { // load snapshot debug('load snapshot ' + snapshot.id + ' from history', _.pick(snapshot, ['context', 'aggregate', 'version']), { co...
javascript
function (aggregateModel, snapshot, events, loadingTime, stream, streams, notSameOrigin) { var self = this; var isSnapshotNeeded = false; if (snapshot) { // load snapshot debug('load snapshot ' + snapshot.id + ' from history', _.pick(snapshot, ['context', 'aggregate', 'version']), { co...
[ "function", "(", "aggregateModel", ",", "snapshot", ",", "events", ",", "loadingTime", ",", "stream", ",", "streams", ",", "notSameOrigin", ")", "{", "var", "self", "=", "this", ";", "var", "isSnapshotNeeded", "=", "false", ";", "if", "(", "snapshot", ")",...
Loads the aggregateModel with the data of the snapshot and the events. And returns true if a new snapshot should be done. @param {AggregateModel} aggregateModel The aggregateModel that should be used. @param {Object} snapshot The snapshot object. @param {Array} events The events that s...
[ "Loads", "the", "aggregateModel", "with", "the", "data", "of", "the", "snapshot", "and", "the", "events", ".", "And", "returns", "true", "if", "a", "new", "snapshot", "should", "be", "done", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L855-L919
14,754
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (meta, fn) { if (!_.isObject(meta) || meta.version === undefined || meta.version === null || !_.isNumber(meta.version)) { throw new Error('Please pass in a version'); } if (!_.isFunction(fn)) { throw new Error('Please pass in a function'); } var wrappedFn; if (fn.length ===...
javascript
function (meta, fn) { if (!_.isObject(meta) || meta.version === undefined || meta.version === null || !_.isNumber(meta.version)) { throw new Error('Please pass in a version'); } if (!_.isFunction(fn)) { throw new Error('Please pass in a function'); } var wrappedFn; if (fn.length ===...
[ "function", "(", "meta", ",", "fn", ")", "{", "if", "(", "!", "_", ".", "isObject", "(", "meta", ")", "||", "meta", ".", "version", "===", "undefined", "||", "meta", ".", "version", "===", "null", "||", "!", "_", ".", "isNumber", "(", "meta", "."...
Defines a new loading transform function for snapshot. @param {Object} meta Meta infos like: { version: 10 } @param {Function} fn Function containing the transform function `function(snapshotData, callback){}` @returns {Aggregate}
[ "Defines", "a", "new", "loading", "transform", "function", "for", "snapshot", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L928-L951
14,755
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (loadingTime, events) { var snapshotThreshold = 100; if (this.options.snapshotThreshold) { snapshotThreshold = this.options.snapshotThreshold; } if (this.options.snapshotThresholdMs) { return loadingTime >= this.options.snapshotThresholdMs; } return events.length >= snapsh...
javascript
function (loadingTime, events) { var snapshotThreshold = 100; if (this.options.snapshotThreshold) { snapshotThreshold = this.options.snapshotThreshold; } if (this.options.snapshotThresholdMs) { return loadingTime >= this.options.snapshotThresholdMs; } return events.length >= snapsh...
[ "function", "(", "loadingTime", ",", "events", ")", "{", "var", "snapshotThreshold", "=", "100", ";", "if", "(", "this", ".", "options", ".", "snapshotThreshold", ")", "{", "snapshotThreshold", "=", "this", ".", "options", ".", "snapshotThreshold", ";", "}",...
Returns true if a new snapshot should be done. @param {Number} loadingTime The loading time in ms of the eventstore data. @param {Array} events The loaded events. @param {Object} aggregateModel The aggregate json object. [could be used for other algorithms] @param {Array} streams All loaded eventstr...
[ "Returns", "true", "if", "a", "new", "snapshot", "should", "be", "done", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L993-L1004
14,756
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (snapshot) { if (!this.snapshotIgnores[snapshot.version]) { return false; } return this.snapshotIgnores[snapshot.version](snapshot.data); }
javascript
function (snapshot) { if (!this.snapshotIgnores[snapshot.version]) { return false; } return this.snapshotIgnores[snapshot.version](snapshot.data); }
[ "function", "(", "snapshot", ")", "{", "if", "(", "!", "this", ".", "snapshotIgnores", "[", "snapshot", ".", "version", "]", ")", "{", "return", "false", ";", "}", "return", "this", ".", "snapshotIgnores", "[", "snapshot", ".", "version", "]", "(", "sn...
Checks if a snapshot should be ignored. @param {Object} snapshot The the snapshot. @returns {boolean}
[ "Checks", "if", "a", "snapshot", "should", "be", "ignored", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L1011-L1017
14,757
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (meta, fn) { if (!_.isObject(meta) || meta.version === undefined || meta.version === null || !_.isNumber(meta.version)) { throw new Error('Please pass in a version'); } if (!_.isFunction(fn)) { throw new Error('Please pass in a function'); } this.snapshotConversionRegistrations...
javascript
function (meta, fn) { if (!_.isObject(meta) || meta.version === undefined || meta.version === null || !_.isNumber(meta.version)) { throw new Error('Please pass in a version'); } if (!_.isFunction(fn)) { throw new Error('Please pass in a function'); } this.snapshotConversionRegistrations...
[ "function", "(", "meta", ",", "fn", ")", "{", "if", "(", "!", "_", ".", "isObject", "(", "meta", ")", "||", "meta", ".", "version", "===", "undefined", "||", "meta", ".", "version", "===", "null", "||", "!", "_", ".", "isNumber", "(", "meta", "."...
Defines a new conversion function for older snapshot versions. @param {Object} meta Meta infos like: { version: 10 } @param {Function} fn Function containing the conversion rule `function(snapshotData, aggregateModel){}` @returns {Aggregate}
[ "Defines", "a", "new", "conversion", "function", "for", "older", "snapshot", "versions", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L1040-L1050
14,758
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (meta, fn) { if (!_.isObject(meta) || meta.version === undefined || meta.version === null || !_.isNumber(meta.version)) { throw new Error('Please pass in a version'); } if (!fn) { this.snapshotIgnores[meta.version] = function () { return true; }; return this; } ...
javascript
function (meta, fn) { if (!_.isObject(meta) || meta.version === undefined || meta.version === null || !_.isNumber(meta.version)) { throw new Error('Please pass in a version'); } if (!fn) { this.snapshotIgnores[meta.version] = function () { return true; }; return this; } ...
[ "function", "(", "meta", ",", "fn", ")", "{", "if", "(", "!", "_", ".", "isObject", "(", "meta", ")", "||", "meta", ".", "version", "===", "undefined", "||", "meta", ".", "version", "===", "null", "||", "!", "_", ".", "isNumber", "(", "meta", "."...
Defines a if a snapshot should be ignored. -> if true it will loads all events @param {Object} meta Meta infos like: { version: 10 } @param {Function} fn Function containing the check function [optional], default return true `function(snapshotData){ return true; }` @returns {Aggregate}
[ "Defines", "a", "if", "a", "snapshot", "should", "be", "ignored", ".", "-", ">", "if", "true", "it", "will", "loads", "all", "events" ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L1059-L1080
14,759
adrai/node-cqrs-domain
lib/definitions/aggregate.js
function (fn) { if (fn.length === 0) throw new Error('Please define your function to accept the command!'); if (fn.length === 1) { var orgFn = fn; fn = function(cmd, callback) { callback(null, orgFn(cmd)); }; } this.getNewAggregateId = fn; return this; }
javascript
function (fn) { if (fn.length === 0) throw new Error('Please define your function to accept the command!'); if (fn.length === 1) { var orgFn = fn; fn = function(cmd, callback) { callback(null, orgFn(cmd)); }; } this.getNewAggregateId = fn; return this; }
[ "function", "(", "fn", ")", "{", "if", "(", "fn", ".", "length", "===", "0", ")", "throw", "new", "Error", "(", "'Please define your function to accept the command!'", ")", ";", "if", "(", "fn", ".", "length", "===", "1", ")", "{", "var", "orgFn", "=", ...
Inject idGenerator function for aggregate id that is command aware. @param {Function} fn The function to be injected. @returns {Aggregate} to be able to chain...
[ "Inject", "idGenerator", "function", "for", "aggregate", "id", "that", "is", "command", "aware", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/aggregate.js#L1105-L1117
14,760
adrai/node-cqrs-domain
lib/definitions/command.js
function (preCond) { if (!preCond || !_.isObject(preCond)) { var err = new Error('Please inject a valid preCondition object!'); debug(err); throw err; } if (!preCond.payload && preCond.payload !== '') { preCond.payload = this.aggregate.defaultPreConditionPayload; } if (this...
javascript
function (preCond) { if (!preCond || !_.isObject(preCond)) { var err = new Error('Please inject a valid preCondition object!'); debug(err); throw err; } if (!preCond.payload && preCond.payload !== '') { preCond.payload = this.aggregate.defaultPreConditionPayload; } if (this...
[ "function", "(", "preCond", ")", "{", "if", "(", "!", "preCond", "||", "!", "_", ".", "isObject", "(", "preCond", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please inject a valid preCondition object!'", ")", ";", "debug", "(", "err", ")", ...
Injects the pre-condition function. @param {Function} preCond The pre-condition function that should be injected
[ "Injects", "the", "pre", "-", "condition", "function", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/command.js#L67-L85
14,761
adrai/node-cqrs-domain
lib/definitions/command.js
function (preLoadCond) { if (!preLoadCond || !_.isObject(preLoadCond)) { var err = new Error('Please inject a valid preCondition object!'); debug(err); throw err; } if (!preLoadCond.payload) { preLoadCond.payload = this.aggregate.defaultPreLoadConditionPayload; } if (this.p...
javascript
function (preLoadCond) { if (!preLoadCond || !_.isObject(preLoadCond)) { var err = new Error('Please inject a valid preCondition object!'); debug(err); throw err; } if (!preLoadCond.payload) { preLoadCond.payload = this.aggregate.defaultPreLoadConditionPayload; } if (this.p...
[ "function", "(", "preLoadCond", ")", "{", "if", "(", "!", "preLoadCond", "||", "!", "_", ".", "isObject", "(", "preLoadCond", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please inject a valid preCondition object!'", ")", ";", "debug", "(", "er...
Injects the pre-load-condition function. @param {Function} preLoadCond The pre-load-condition function that should be injected
[ "Injects", "the", "pre", "-", "load", "-", "condition", "function", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/command.js#L91-L109
14,762
adrai/node-cqrs-domain
lib/definitions/command.js
function (validator) { if (!_.isFunction(validator)) { var err = new Error('Please pass in a function'); debug(err); throw err; } if (validator.length == 2) { return this.validator = validator; } this.validator = function (data, callback) { callback(validator(data)); ...
javascript
function (validator) { if (!_.isFunction(validator)) { var err = new Error('Please pass in a function'); debug(err); throw err; } if (validator.length == 2) { return this.validator = validator; } this.validator = function (data, callback) { callback(validator(data)); ...
[ "function", "(", "validator", ")", "{", "if", "(", "!", "_", ".", "isFunction", "(", "validator", ")", ")", "{", "var", "err", "=", "new", "Error", "(", "'Please pass in a function'", ")", ";", "debug", "(", "err", ")", ";", "throw", "err", ";", "}",...
Injects the validator function. @param {Function} validator The validator function that should be injected
[ "Injects", "the", "validator", "function", "." ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/command.js#L115-L130
14,763
adrai/node-cqrs-domain
lib/definitions/command.js
function (cmd, callback) { if (this.preLoadConditions.length === 0) { debug('no pre-load-condition for ' + this.name); return callback(null); } var self = this; async.eachSeries(this.preLoadConditions, function (preLoadCondition, callback) { if (preLoadCondition.version === undefined ...
javascript
function (cmd, callback) { if (this.preLoadConditions.length === 0) { debug('no pre-load-condition for ' + this.name); return callback(null); } var self = this; async.eachSeries(this.preLoadConditions, function (preLoadCondition, callback) { if (preLoadCondition.version === undefined ...
[ "function", "(", "cmd", ",", "callback", ")", "{", "if", "(", "this", ".", "preLoadConditions", ".", "length", "===", "0", ")", "{", "debug", "(", "'no pre-load-condition for '", "+", "this", ".", "name", ")", ";", "return", "callback", "(", "null", ")",...
Checks for pre-load conditions @param {Object} cmd The command object. @param {Function} callback The function, that will be called when this action is completed. `function(err){}`
[ "Checks", "for", "pre", "-", "load", "conditions" ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/command.js#L151-L164
14,764
adrai/node-cqrs-domain
lib/definitions/command.js
function (cmd, aggregateModel, callback) { if (this.existing === true && aggregateModel.get('_revision') === 0) { var err = new BusinessRuleError('This command only wants to be handled, if aggregate already existing!', { type: 'AggregateNotExisting', aggregateId: aggregateModel.id, agg...
javascript
function (cmd, aggregateModel, callback) { if (this.existing === true && aggregateModel.get('_revision') === 0) { var err = new BusinessRuleError('This command only wants to be handled, if aggregate already existing!', { type: 'AggregateNotExisting', aggregateId: aggregateModel.id, agg...
[ "function", "(", "cmd", ",", "aggregateModel", ",", "callback", ")", "{", "if", "(", "this", ".", "existing", "===", "true", "&&", "aggregateModel", ".", "get", "(", "'_revision'", ")", "===", "0", ")", "{", "var", "err", "=", "new", "BusinessRuleError",...
Checks for pre-conditions @param {Object} cmd The command object. @param {AggregateModel} aggregateModel The aggregate object. @param {Function} callback The function, that will be called when this action is completed. `function(err){}`
[ "Checks", "for", "pre", "-", "conditions" ]
4e70105b11a444b02c12f2850c61242b4998361c
https://github.com/adrai/node-cqrs-domain/blob/4e70105b11a444b02c12f2850c61242b4998361c/lib/definitions/command.js#L173-L206
14,765
jshttp/etag
index.js
entitytag
function entitytag (entity) { if (entity.length === 0) { // fast-path empty return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"' } // compute hash of entity var hash = crypto .createHash('sha1') .update(entity, 'utf8') .digest('base64') .substring(0, 27) // compute length of entity var len = t...
javascript
function entitytag (entity) { if (entity.length === 0) { // fast-path empty return '"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk"' } // compute hash of entity var hash = crypto .createHash('sha1') .update(entity, 'utf8') .digest('base64') .substring(0, 27) // compute length of entity var len = t...
[ "function", "entitytag", "(", "entity", ")", "{", "if", "(", "entity", ".", "length", "===", "0", ")", "{", "// fast-path empty", "return", "'\"0-2jmj7l5rSw0yVb/vlWAYkK/YBwk\"'", "}", "// compute hash of entity", "var", "hash", "=", "crypto", ".", "createHash", "(...
Generate an entity tag. @param {Buffer|string} entity @return {string} @private
[ "Generate", "an", "entity", "tag", "." ]
4664b6e53c85a56521076f9c5004dd9626ae10c8
https://github.com/jshttp/etag/blob/4664b6e53c85a56521076f9c5004dd9626ae10c8/index.js#L39-L58
14,766
jshttp/etag
index.js
etag
function etag (entity, options) { if (entity == null) { throw new TypeError('argument entity is required') } // support fs.Stats object var isStats = isstats(entity) var weak = options && typeof options.weak === 'boolean' ? options.weak : isStats // validate argument if (!isStats && typeof e...
javascript
function etag (entity, options) { if (entity == null) { throw new TypeError('argument entity is required') } // support fs.Stats object var isStats = isstats(entity) var weak = options && typeof options.weak === 'boolean' ? options.weak : isStats // validate argument if (!isStats && typeof e...
[ "function", "etag", "(", "entity", ",", "options", ")", "{", "if", "(", "entity", "==", "null", ")", "{", "throw", "new", "TypeError", "(", "'argument entity is required'", ")", "}", "// support fs.Stats object", "var", "isStats", "=", "isstats", "(", "entity"...
Create a simple ETag. @param {string|Buffer|Stats} entity @param {object} [options] @param {boolean} [options.weak] @return {String} @public
[ "Create", "a", "simple", "ETag", "." ]
4664b6e53c85a56521076f9c5004dd9626ae10c8
https://github.com/jshttp/etag/blob/4664b6e53c85a56521076f9c5004dd9626ae10c8/index.js#L70-L94
14,767
jshttp/etag
index.js
isstats
function isstats (obj) { // genuine fs.Stats if (typeof Stats === 'function' && obj instanceof Stats) { return true } // quack quack return obj && typeof obj === 'object' && 'ctime' in obj && toString.call(obj.ctime) === '[object Date]' && 'mtime' in obj && toString.call(obj.mtime) === '[object D...
javascript
function isstats (obj) { // genuine fs.Stats if (typeof Stats === 'function' && obj instanceof Stats) { return true } // quack quack return obj && typeof obj === 'object' && 'ctime' in obj && toString.call(obj.ctime) === '[object Date]' && 'mtime' in obj && toString.call(obj.mtime) === '[object D...
[ "function", "isstats", "(", "obj", ")", "{", "// genuine fs.Stats", "if", "(", "typeof", "Stats", "===", "'function'", "&&", "obj", "instanceof", "Stats", ")", "{", "return", "true", "}", "// quack quack", "return", "obj", "&&", "typeof", "obj", "===", "'obj...
Determine if object is a Stats object. @param {object} obj @return {boolean} @api private
[ "Determine", "if", "object", "is", "a", "Stats", "object", "." ]
4664b6e53c85a56521076f9c5004dd9626ae10c8
https://github.com/jshttp/etag/blob/4664b6e53c85a56521076f9c5004dd9626ae10c8/index.js#L104-L116
14,768
jshttp/etag
index.js
stattag
function stattag (stat) { var mtime = stat.mtime.getTime().toString(16) var size = stat.size.toString(16) return '"' + size + '-' + mtime + '"' }
javascript
function stattag (stat) { var mtime = stat.mtime.getTime().toString(16) var size = stat.size.toString(16) return '"' + size + '-' + mtime + '"' }
[ "function", "stattag", "(", "stat", ")", "{", "var", "mtime", "=", "stat", ".", "mtime", ".", "getTime", "(", ")", ".", "toString", "(", "16", ")", "var", "size", "=", "stat", ".", "size", ".", "toString", "(", "16", ")", "return", "'\"'", "+", "...
Generate a tag for a stat. @param {object} stat @return {string} @private
[ "Generate", "a", "tag", "for", "a", "stat", "." ]
4664b6e53c85a56521076f9c5004dd9626ae10c8
https://github.com/jshttp/etag/blob/4664b6e53c85a56521076f9c5004dd9626ae10c8/index.js#L126-L131
14,769
epoberezkin/ajv-keywords
index.js
defineKeywords
function defineKeywords(ajv, keyword) { if (Array.isArray(keyword)) { for (var i=0; i<keyword.length; i++) get(keyword[i])(ajv); return ajv; } if (keyword) { get(keyword)(ajv); return ajv; } for (keyword in KEYWORDS) get(keyword)(ajv); return ajv; }
javascript
function defineKeywords(ajv, keyword) { if (Array.isArray(keyword)) { for (var i=0; i<keyword.length; i++) get(keyword[i])(ajv); return ajv; } if (keyword) { get(keyword)(ajv); return ajv; } for (keyword in KEYWORDS) get(keyword)(ajv); return ajv; }
[ "function", "defineKeywords", "(", "ajv", ",", "keyword", ")", "{", "if", "(", "Array", ".", "isArray", "(", "keyword", ")", ")", "{", "for", "(", "var", "i", "=", "0", ";", "i", "<", "keyword", ".", "length", ";", "i", "++", ")", "get", "(", "...
Defines one or several keywords in ajv instance @param {Ajv} ajv validator instance @param {String|Array<String>|undefined} keyword keyword(s) to define @return {Ajv} ajv instance (for chaining)
[ "Defines", "one", "or", "several", "keywords", "in", "ajv", "instance" ]
9ebcae203fac7a78c391bfc7076497f591fe0be6
https://github.com/epoberezkin/ajv-keywords/blob/9ebcae203fac7a78c391bfc7076497f591fe0be6/index.js#L14-L26
14,770
efeiefei/node-file-manager
lib/public/js/angular-file.js
function(file) { var deferred = $q.defer(); var reader = angular.extend(new FileReader(), { onload: function(e) { deferred.resolve(e.target.result); if (!$rootScope.$$phase) $rootScope.$apply(); }, onerror: function(e) { deferred.reject(e); if...
javascript
function(file) { var deferred = $q.defer(); var reader = angular.extend(new FileReader(), { onload: function(e) { deferred.resolve(e.target.result); if (!$rootScope.$$phase) $rootScope.$apply(); }, onerror: function(e) { deferred.reject(e); if...
[ "function", "(", "file", ")", "{", "var", "deferred", "=", "$q", ".", "defer", "(", ")", ";", "var", "reader", "=", "angular", ".", "extend", "(", "new", "FileReader", "(", ")", ",", "{", "onload", ":", "function", "(", "e", ")", "{", "deferred", ...
Loads a file as a data URL and returns a promise representing the file's value.
[ "Loads", "a", "file", "as", "a", "data", "URL", "and", "returns", "a", "promise", "representing", "the", "file", "s", "value", "." ]
b28dd01f22796658d245d7a3a9c05f784c4b959e
https://github.com/efeiefei/node-file-manager/blob/b28dd01f22796658d245d7a3a9c05f784c4b959e/lib/public/js/angular-file.js#L128-L151
14,771
efeiefei/node-file-manager
lib/public/js/angular-file.js
function(file) { return { name: file.name, size: file.size, lastModifiedDate: file.lastModifiedDate }; }
javascript
function(file) { return { name: file.name, size: file.size, lastModifiedDate: file.lastModifiedDate }; }
[ "function", "(", "file", ")", "{", "return", "{", "name", ":", "file", ".", "name", ",", "size", ":", "file", ".", "size", ",", "lastModifiedDate", ":", "file", ".", "lastModifiedDate", "}", ";", "}" ]
Returns the metadata from a File object, including the name, size and last modified date.
[ "Returns", "the", "metadata", "from", "a", "File", "object", "including", "the", "name", "size", "and", "last", "modified", "date", "." ]
b28dd01f22796658d245d7a3a9c05f784c4b959e
https://github.com/efeiefei/node-file-manager/blob/b28dd01f22796658d245d7a3a9c05f784c4b959e/lib/public/js/angular-file.js#L156-L162
14,772
efeiefei/node-file-manager
lib/public/js/angular-file.js
function(data) { var extras = {}; if (data instanceof File) { extras = this.meta(data); data = data.toDataURL(); } var parts = data.split(","), headers = parts[0].split(":"), body; if (parts.length !== 2 || headers.length !== 2 || headers[0] !== "data") { throw ne...
javascript
function(data) { var extras = {}; if (data instanceof File) { extras = this.meta(data); data = data.toDataURL(); } var parts = data.split(","), headers = parts[0].split(":"), body; if (parts.length !== 2 || headers.length !== 2 || headers[0] !== "data") { throw ne...
[ "function", "(", "data", ")", "{", "var", "extras", "=", "{", "}", ";", "if", "(", "data", "instanceof", "File", ")", "{", "extras", "=", "this", ".", "meta", "(", "data", ")", ";", "data", "=", "data", ".", "toDataURL", "(", ")", ";", "}", "va...
Converts a File object or data URL to a Blob.
[ "Converts", "a", "File", "object", "or", "data", "URL", "to", "a", "Blob", "." ]
b28dd01f22796658d245d7a3a9c05f784c4b959e
https://github.com/efeiefei/node-file-manager/blob/b28dd01f22796658d245d7a3a9c05f784c4b959e/lib/public/js/angular-file.js#L167-L187
14,773
Zod-/jsVideoUrlParser
lib/util.js
getLetterTime
function getLetterTime(timeString) { var totalSeconds = 0; var timeValues = { 's': 1, 'm': 1 * 60, 'h': 1 * 60 * 60, 'd': 1 * 60 * 60 * 24, 'w': 1 * 60 * 60 * 24 * 7, }; var timePairs; //expand to "1 h 30 m 20 s" and split timeString = timeString.replace(/([smhdw])/g, ' $1 ').trim(); ...
javascript
function getLetterTime(timeString) { var totalSeconds = 0; var timeValues = { 's': 1, 'm': 1 * 60, 'h': 1 * 60 * 60, 'd': 1 * 60 * 60 * 24, 'w': 1 * 60 * 60 * 24 * 7, }; var timePairs; //expand to "1 h 30 m 20 s" and split timeString = timeString.replace(/([smhdw])/g, ' $1 ').trim(); ...
[ "function", "getLetterTime", "(", "timeString", ")", "{", "var", "totalSeconds", "=", "0", ";", "var", "timeValues", "=", "{", "'s'", ":", "1", ",", "'m'", ":", "1", "*", "60", ",", "'h'", ":", "1", "*", "60", "*", "60", ",", "'d'", ":", "1", "...
parses strings like 1h30m20s to seconds
[ "parses", "strings", "like", "1h30m20s", "to", "seconds" ]
4f819a536f57413f784f2a78ff826b605722e275
https://github.com/Zod-/jsVideoUrlParser/blob/4f819a536f57413f784f2a78ff826b605722e275/lib/util.js#L55-L75
14,774
esvit/ng-table
scripts/webpack/libParts.js
extractSass
function extractSass(files) { // note: The way we're setting up webpack here seems a bit of a hack: // // Although the setup creates two bundles seperating the js and css as desired, // it's also producing an extra styles.js file which we're throwing away/ignoring. // The alter...
javascript
function extractSass(files) { // note: The way we're setting up webpack here seems a bit of a hack: // // Although the setup creates two bundles seperating the js and css as desired, // it's also producing an extra styles.js file which we're throwing away/ignoring. // The alter...
[ "function", "extractSass", "(", "files", ")", "{", "// note: The way we're setting up webpack here seems a bit of a hack:", "//", "// Although the setup creates two bundles seperating the js and css as desired,", "// it's also producing an extra styles.js file which we're throwing away/ignoring."...
Extracts styles into a seperate bundle
[ "Extracts", "styles", "into", "a", "seperate", "bundle" ]
b6d5d0bfeef923c617081ffe80a0266d7fb4aa33
https://github.com/esvit/ng-table/blob/b6d5d0bfeef923c617081ffe80a0266d7fb4aa33/scripts/webpack/libParts.js#L65-L103
14,775
mapbox/tilelive
lib/stream-pyramid.js
nextShallow
function nextShallow(stream) { if (!stream.cursor) return false; var cursor = stream.cursor; cursor.x++; var bbox = stream.bboxes[cursor.z]; if (cursor.x > bbox.maxX) { cursor.x = bbox.minX; cursor.y++; } if (cursor.y > bbox.maxY) { stream.cursor = false; retu...
javascript
function nextShallow(stream) { if (!stream.cursor) return false; var cursor = stream.cursor; cursor.x++; var bbox = stream.bboxes[cursor.z]; if (cursor.x > bbox.maxX) { cursor.x = bbox.minX; cursor.y++; } if (cursor.y > bbox.maxY) { stream.cursor = false; retu...
[ "function", "nextShallow", "(", "stream", ")", "{", "if", "(", "!", "stream", ".", "cursor", ")", "return", "false", ";", "var", "cursor", "=", "stream", ".", "cursor", ";", "cursor", ".", "x", "++", ";", "var", "bbox", "=", "stream", ".", "bboxes", ...
Increment a tile cursor to the next position on the lowest zoom level.
[ "Increment", "a", "tile", "cursor", "to", "the", "next", "position", "on", "the", "lowest", "zoom", "level", "." ]
8a37d89dd6e9fb0f6938e1c6ccf62349556c9375
https://github.com/mapbox/tilelive/blob/8a37d89dd6e9fb0f6938e1c6ccf62349556c9375/lib/stream-pyramid.js#L172-L186
14,776
mapbox/tilelive
lib/stream-scanline.js
nextDeep
function nextDeep(stream) { if (!stream.cursor) return false; var cursor = stream.cursor; cursor.x++; var bbox = stream.bboxes[cursor.z]; if (cursor.x > bbox.maxX) { cursor.x = bbox.minX; cursor.y++; } if (cursor.y > bbox.maxY) { cursor.z++; if (cursor.z > str...
javascript
function nextDeep(stream) { if (!stream.cursor) return false; var cursor = stream.cursor; cursor.x++; var bbox = stream.bboxes[cursor.z]; if (cursor.x > bbox.maxX) { cursor.x = bbox.minX; cursor.y++; } if (cursor.y > bbox.maxY) { cursor.z++; if (cursor.z > str...
[ "function", "nextDeep", "(", "stream", ")", "{", "if", "(", "!", "stream", ".", "cursor", ")", "return", "false", ";", "var", "cursor", "=", "stream", ".", "cursor", ";", "cursor", ".", "x", "++", ";", "var", "bbox", "=", "stream", ".", "bboxes", "...
Increment a tile cursor to the next position, descending zoom levels until maxzoom is reached.
[ "Increment", "a", "tile", "cursor", "to", "the", "next", "position", "descending", "zoom", "levels", "until", "maxzoom", "is", "reached", "." ]
8a37d89dd6e9fb0f6938e1c6ccf62349556c9375
https://github.com/mapbox/tilelive/blob/8a37d89dd6e9fb0f6938e1c6ccf62349556c9375/lib/stream-scanline.js#L129-L149
14,777
mapbox/tilelive
lib/stream-util.js
multiread
function multiread(stream, get) { if (stream._multiread === undefined) { stream._multiread = stream._multiread || []; stream._multireading = stream._multireading || 0; stream._multireadmax = stream._multireadmax || concurrency; } if (stream._multiread.length) { push(); } ...
javascript
function multiread(stream, get) { if (stream._multiread === undefined) { stream._multiread = stream._multiread || []; stream._multireading = stream._multireading || 0; stream._multireadmax = stream._multireadmax || concurrency; } if (stream._multiread.length) { push(); } ...
[ "function", "multiread", "(", "stream", ",", "get", ")", "{", "if", "(", "stream", ".", "_multiread", "===", "undefined", ")", "{", "stream", ".", "_multiread", "=", "stream", ".", "_multiread", "||", "[", "]", ";", "stream", ".", "_multireading", "=", ...
Helper utility for _read functions. Pass your stream object and a getter that can be called concurrently and it will concurrently call your getter behind the scenes and manage the endstate of the stream.
[ "Helper", "utility", "for", "_read", "functions", ".", "Pass", "your", "stream", "object", "and", "a", "getter", "that", "can", "be", "called", "concurrently", "and", "it", "will", "concurrently", "call", "your", "getter", "behind", "the", "scenes", "and", "...
8a37d89dd6e9fb0f6938e1c6ccf62349556c9375
https://github.com/mapbox/tilelive/blob/8a37d89dd6e9fb0f6938e1c6ccf62349556c9375/lib/stream-util.js#L167-L200
14,778
sc-forks/solidity-coverage
lib/preprocessor.js
blockWrap
function blockWrap(contract, expression) { return contract.slice(0, expression.start) + '{' + contract.slice(expression.start, expression.end) + '}' + contract.slice(expression.end); }
javascript
function blockWrap(contract, expression) { return contract.slice(0, expression.start) + '{' + contract.slice(expression.start, expression.end) + '}' + contract.slice(expression.end); }
[ "function", "blockWrap", "(", "contract", ",", "expression", ")", "{", "return", "contract", ".", "slice", "(", "0", ",", "expression", ".", "start", ")", "+", "'{'", "+", "contract", ".", "slice", "(", "expression", ".", "start", ",", "expression", ".",...
Splices enclosing brackets into `contract` around `expression`; @param {String} contract solidity source @param {Object} node AST node to bracket @return {String} contract
[ "Splices", "enclosing", "brackets", "into", "contract", "around", "expression", ";" ]
7e18028812849ed4f2e0e7e78558a7b18dfda0e8
https://github.com/sc-forks/solidity-coverage/blob/7e18028812849ed4f2e0e7e78558a7b18dfda0e8/lib/preprocessor.js#L11-L13
14,779
sc-forks/solidity-coverage
lib/preprocessor.js
getModifierWhitespace
function getModifierWhitespace(contract, modifier){ const source = contract.slice(modifier.start, modifier.end); const whitespace = source.match(crRegex) || []; return whitespace.join(''); }
javascript
function getModifierWhitespace(contract, modifier){ const source = contract.slice(modifier.start, modifier.end); const whitespace = source.match(crRegex) || []; return whitespace.join(''); }
[ "function", "getModifierWhitespace", "(", "contract", ",", "modifier", ")", "{", "const", "source", "=", "contract", ".", "slice", "(", "modifier", ".", "start", ",", "modifier", ".", "end", ")", ";", "const", "whitespace", "=", "source", ".", "match", "("...
Captures carriage returns at modifiers we'll remove. These need to be re-injected into the source to keep line report alignments accurate. @param {String} contract solidity source @param {Object} modifier AST node @return {String} whitespace around the modifier
[ "Captures", "carriage", "returns", "at", "modifiers", "we", "ll", "remove", ".", "These", "need", "to", "be", "re", "-", "injected", "into", "the", "source", "to", "keep", "line", "report", "alignments", "accurate", "." ]
7e18028812849ed4f2e0e7e78558a7b18dfda0e8
https://github.com/sc-forks/solidity-coverage/blob/7e18028812849ed4f2e0e7e78558a7b18dfda0e8/lib/preprocessor.js#L23-L27
14,780
sc-forks/solidity-coverage
lib/instrumenter.js
createOrAppendInjectionPoint
function createOrAppendInjectionPoint(contract, key, value) { if (contract.injectionPoints[key]) { contract.injectionPoints[key].push(value); } else { contract.injectionPoints[key] = [value]; } }
javascript
function createOrAppendInjectionPoint(contract, key, value) { if (contract.injectionPoints[key]) { contract.injectionPoints[key].push(value); } else { contract.injectionPoints[key] = [value]; } }
[ "function", "createOrAppendInjectionPoint", "(", "contract", ",", "key", ",", "value", ")", "{", "if", "(", "contract", ".", "injectionPoints", "[", "key", "]", ")", "{", "contract", ".", "injectionPoints", "[", "key", "]", ".", "push", "(", "value", ")", ...
These functions work out where in an expression we can inject our instrumenation events.
[ "These", "functions", "work", "out", "where", "in", "an", "expression", "we", "can", "inject", "our", "instrumenation", "events", "." ]
7e18028812849ed4f2e0e7e78558a7b18dfda0e8
https://github.com/sc-forks/solidity-coverage/blob/7e18028812849ed4f2e0e7e78558a7b18dfda0e8/lib/instrumenter.js#L6-L12
14,781
sitespeedio/browsertime
lib/core/seleniumRunner.js
timeout
async function timeout(promise, ms, errorMessage) { let timer = null; return Promise.race([ new Promise((resolve, reject) => { timer = setTimeout(reject, ms, new BrowserError(errorMessage)); return timer; }), promise.then(value => { clearTimeout(timer); return value; }) ])...
javascript
async function timeout(promise, ms, errorMessage) { let timer = null; return Promise.race([ new Promise((resolve, reject) => { timer = setTimeout(reject, ms, new BrowserError(errorMessage)); return timer; }), promise.then(value => { clearTimeout(timer); return value; }) ])...
[ "async", "function", "timeout", "(", "promise", ",", "ms", ",", "errorMessage", ")", "{", "let", "timer", "=", "null", ";", "return", "Promise", ".", "race", "(", "[", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "timer", "="...
Timeout a promise after ms. Use promise.race to compete about the timeout and the promise. @param {promise} promise - The promise to wait for @param {int} ms - how long in ms to wait for the promise to fininsh @param {string} errorMessage - the error message in the Error if we timeouts
[ "Timeout", "a", "promise", "after", "ms", ".", "Use", "promise", ".", "race", "to", "compete", "about", "the", "timeout", "and", "the", "promise", "." ]
97cefe2a081e2a14d95a19e3a22ab68467988c68
https://github.com/sitespeedio/browsertime/blob/97cefe2a081e2a14d95a19e3a22ab68467988c68/lib/core/seleniumRunner.js#L35-L48
14,782
sitespeedio/browsertime
browserscripts/timings/rumSpeedIndex.js
function(el, url) { if (url) { var rect = GetElementViewportRect(el); if (rect) { rects.push({'url': url, 'area': rect.area, 'rect': rect}); } } }
javascript
function(el, url) { if (url) { var rect = GetElementViewportRect(el); if (rect) { rects.push({'url': url, 'area': rect.area, 'rect': rect}); } } }
[ "function", "(", "el", ",", "url", ")", "{", "if", "(", "url", ")", "{", "var", "rect", "=", "GetElementViewportRect", "(", "el", ")", ";", "if", "(", "rect", ")", "{", "rects", ".", "push", "(", "{", "'url'", ":", "url", ",", "'area'", ":", "r...
Check a given element to see if it is visible
[ "Check", "a", "given", "element", "to", "see", "if", "it", "is", "visible" ]
97cefe2a081e2a14d95a19e3a22ab68467988c68
https://github.com/sitespeedio/browsertime/blob/97cefe2a081e2a14d95a19e3a22ab68467988c68/browserscripts/timings/rumSpeedIndex.js#L78-L87
14,783
sitespeedio/browsertime
browserscripts/timings/rumSpeedIndex.js
function() { var timings = {}; var requests = win.performance.getEntriesByType("resource"); for (var i = 0; i < requests.length; i++) timings[requests[i].name] = requests[i].responseEnd; for (var j = 0; j < rects.length; j++) { if (!('tm' in rects[j])) rects[j].tm = tim...
javascript
function() { var timings = {}; var requests = win.performance.getEntriesByType("resource"); for (var i = 0; i < requests.length; i++) timings[requests[i].name] = requests[i].responseEnd; for (var j = 0; j < rects.length; j++) { if (!('tm' in rects[j])) rects[j].tm = tim...
[ "function", "(", ")", "{", "var", "timings", "=", "{", "}", ";", "var", "requests", "=", "win", ".", "performance", ".", "getEntriesByType", "(", "\"resource\"", ")", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "requests", ".", "length", ...
Get the time at which each external resource loaded
[ "Get", "the", "time", "at", "which", "each", "external", "resource", "loaded" ]
97cefe2a081e2a14d95a19e3a22ab68467988c68
https://github.com/sitespeedio/browsertime/blob/97cefe2a081e2a14d95a19e3a22ab68467988c68/browserscripts/timings/rumSpeedIndex.js#L128-L137
14,784
sitespeedio/browsertime
browserscripts/timings/rumSpeedIndex.js
function() { var paints = {'0':0}; var total = 0; for (var i = 0; i < rects.length; i++) { var tm = firstPaint; if ('tm' in rects[i] && rects[i].tm > firstPaint) tm = rects[i].tm; if (paints[tm] === undefined) paints[tm] = 0; paints[tm] += rects[i].a...
javascript
function() { var paints = {'0':0}; var total = 0; for (var i = 0; i < rects.length; i++) { var tm = firstPaint; if ('tm' in rects[i] && rects[i].tm > firstPaint) tm = rects[i].tm; if (paints[tm] === undefined) paints[tm] = 0; paints[tm] += rects[i].a...
[ "function", "(", ")", "{", "var", "paints", "=", "{", "'0'", ":", "0", "}", ";", "var", "total", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "rects", ".", "length", ";", "i", "++", ")", "{", "var", "tm", "=", "firstPaint...
Sort and group all of the paint rects by time and use them to calculate the visual progress
[ "Sort", "and", "group", "all", "of", "the", "paint", "rects", "by", "time", "and", "use", "them", "to", "calculate", "the", "visual", "progress" ]
97cefe2a081e2a14d95a19e3a22ab68467988c68
https://github.com/sitespeedio/browsertime/blob/97cefe2a081e2a14d95a19e3a22ab68467988c68/browserscripts/timings/rumSpeedIndex.js#L188-L225
14,785
sitespeedio/browsertime
browserscripts/timings/rumSpeedIndex.js
function() { if (progress.length) { SpeedIndex = 0; var lastTime = 0; var lastProgress = 0; for (var i = 0; i < progress.length; i++) { var elapsed = progress[i].tm - lastTime; if (elapsed > 0 && lastProgress < 1) SpeedIndex += (1 - lastProgress) * e...
javascript
function() { if (progress.length) { SpeedIndex = 0; var lastTime = 0; var lastProgress = 0; for (var i = 0; i < progress.length; i++) { var elapsed = progress[i].tm - lastTime; if (elapsed > 0 && lastProgress < 1) SpeedIndex += (1 - lastProgress) * e...
[ "function", "(", ")", "{", "if", "(", "progress", ".", "length", ")", "{", "SpeedIndex", "=", "0", ";", "var", "lastTime", "=", "0", ";", "var", "lastProgress", "=", "0", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "progress", ".", "l...
Given the visual progress information, Calculate the speed index.
[ "Given", "the", "visual", "progress", "information", "Calculate", "the", "speed", "index", "." ]
97cefe2a081e2a14d95a19e3a22ab68467988c68
https://github.com/sitespeedio/browsertime/blob/97cefe2a081e2a14d95a19e3a22ab68467988c68/browserscripts/timings/rumSpeedIndex.js#L228-L243
14,786
sitespeedio/browsertime
browserscripts/pageinfo/visualElements.js
toArray
function toArray(arrayLike) { if (arrayLike === undefined || arrayLike === null) { return []; } if (Array.isArray(arrayLike)) { return arrayLike; } return [arrayLike]; }
javascript
function toArray(arrayLike) { if (arrayLike === undefined || arrayLike === null) { return []; } if (Array.isArray(arrayLike)) { return arrayLike; } return [arrayLike]; }
[ "function", "toArray", "(", "arrayLike", ")", "{", "if", "(", "arrayLike", "===", "undefined", "||", "arrayLike", "===", "null", ")", "{", "return", "[", "]", ";", "}", "if", "(", "Array", ".", "isArray", "(", "arrayLike", ")", ")", "{", "return", "a...
When we feed options from the CLI it can be a String or an Array with Strings. Make it easy to treat everything the same.
[ "When", "we", "feed", "options", "from", "the", "CLI", "it", "can", "be", "a", "String", "or", "an", "Array", "with", "Strings", ".", "Make", "it", "easy", "to", "treat", "everything", "the", "same", "." ]
97cefe2a081e2a14d95a19e3a22ab68467988c68
https://github.com/sitespeedio/browsertime/blob/97cefe2a081e2a14d95a19e3a22ab68467988c68/browserscripts/pageinfo/visualElements.js#L14-L22
14,787
sitespeedio/browsertime
lib/support/browserScript.js
scriptsFromDirectory
async function scriptsFromDirectory(dirpath) { const dir = (await readdir(dirpath)) .map(name => toFullPath(name, dirpath)) .filter(await filters.onlyFiles) .filter(filters.onlyWithExtension('.js')); const result = {}; for (const filepath of dir) { const name = path.basename(filepath, '.js'); ...
javascript
async function scriptsFromDirectory(dirpath) { const dir = (await readdir(dirpath)) .map(name => toFullPath(name, dirpath)) .filter(await filters.onlyFiles) .filter(filters.onlyWithExtension('.js')); const result = {}; for (const filepath of dir) { const name = path.basename(filepath, '.js'); ...
[ "async", "function", "scriptsFromDirectory", "(", "dirpath", ")", "{", "const", "dir", "=", "(", "await", "readdir", "(", "dirpath", ")", ")", ".", "map", "(", "name", "=>", "toFullPath", "(", "name", ",", "dirpath", ")", ")", ".", "filter", "(", "awai...
Read all JavaScript files in a specific dir. Will use the filename without .js as the name of the script. @param {*} dirpath
[ "Read", "all", "JavaScript", "files", "in", "a", "specific", "dir", ".", "Will", "use", "the", "filename", "without", ".", "js", "as", "the", "name", "of", "the", "script", "." ]
97cefe2a081e2a14d95a19e3a22ab68467988c68
https://github.com/sitespeedio/browsertime/blob/97cefe2a081e2a14d95a19e3a22ab68467988c68/lib/support/browserScript.js#L21-L33
14,788
sitespeedio/browsertime
lib/support/browserScript.js
findAndParseScripts
async function findAndParseScripts(root, category) { async function scriptsFromDirectory(dirpath) { const dir = (await readdir(dirpath)) .map(name => toFullPath(name, dirpath)) .filter(await filters.onlyFiles) .filter(filters.onlyWithExtension('.js')); const result = {}; for (const filep...
javascript
async function findAndParseScripts(root, category) { async function scriptsFromDirectory(dirpath) { const dir = (await readdir(dirpath)) .map(name => toFullPath(name, dirpath)) .filter(await filters.onlyFiles) .filter(filters.onlyWithExtension('.js')); const result = {}; for (const filep...
[ "async", "function", "findAndParseScripts", "(", "root", ",", "category", ")", "{", "async", "function", "scriptsFromDirectory", "(", "dirpath", ")", "{", "const", "dir", "=", "(", "await", "readdir", "(", "dirpath", ")", ")", ".", "map", "(", "name", "=>"...
Parse a file or directory, and return an object representing that groups scripts by category. Single js files will be put into the category 'custom', for directories the category name will be taken from the directory name. The resulting value looks like this: <pre> { 'category': { 'script': <contents of script.js> } }...
[ "Parse", "a", "file", "or", "directory", "and", "return", "an", "object", "representing", "that", "groups", "scripts", "by", "category", ".", "Single", "js", "files", "will", "be", "put", "into", "the", "category", "custom", "for", "directories", "the", "cat...
97cefe2a081e2a14d95a19e3a22ab68467988c68
https://github.com/sitespeedio/browsertime/blob/97cefe2a081e2a14d95a19e3a22ab68467988c68/lib/support/browserScript.js#L66-L108
14,789
nagix/chartjs-plugin-streaming
src/scales/scale.realtime.js
toTimestamp
function toTimestamp(scale, input) { var adapter = scale._adapter || defaultAdapter; var options = scale.options.time; var parser = options.parser; var format = parser || options.format; var value = input; if (typeof parser === 'function') { value = parser(value); } // Only parse if its not a timestamp alre...
javascript
function toTimestamp(scale, input) { var adapter = scale._adapter || defaultAdapter; var options = scale.options.time; var parser = options.parser; var format = parser || options.format; var value = input; if (typeof parser === 'function') { value = parser(value); } // Only parse if its not a timestamp alre...
[ "function", "toTimestamp", "(", "scale", ",", "input", ")", "{", "var", "adapter", "=", "scale", ".", "_adapter", "||", "defaultAdapter", ";", "var", "options", "=", "scale", ".", "options", ".", "time", ";", "var", "parser", "=", "options", ".", "parser...
Ported from Chart.js 2.8.0-rc.1 35273ee. Modified for Chart.js 2.7.x backward compatibility.
[ "Ported", "from", "Chart", ".", "js", "2", ".", "8", ".", "0", "-", "rc", ".", "1", "35273ee", ".", "Modified", "for", "Chart", ".", "js", "2", ".", "7", ".", "x", "backward", "compatibility", "." ]
b53ec168f2d0729014651d694cc041a6a7d4ff26
https://github.com/nagix/chartjs-plugin-streaming/blob/b53ec168f2d0729014651d694cc041a6a7d4ff26/src/scales/scale.realtime.js#L34-L68
14,790
nagix/chartjs-plugin-streaming
src/plugins/plugin.streaming.js
update
function update(config) { var me = this; var preservation = config && config.preservation; var tooltip, lastActive, tooltipLastActive, lastMouseEvent; if (preservation) { tooltip = me.tooltip; lastActive = me.lastActive; tooltipLastActive = tooltip._lastActive; me._bufferedRender = true; } Chart.prototy...
javascript
function update(config) { var me = this; var preservation = config && config.preservation; var tooltip, lastActive, tooltipLastActive, lastMouseEvent; if (preservation) { tooltip = me.tooltip; lastActive = me.lastActive; tooltipLastActive = tooltip._lastActive; me._bufferedRender = true; } Chart.prototy...
[ "function", "update", "(", "config", ")", "{", "var", "me", "=", "this", ";", "var", "preservation", "=", "config", "&&", "config", ".", "preservation", ";", "var", "tooltip", ",", "lastActive", ",", "tooltipLastActive", ",", "lastMouseEvent", ";", "if", "...
Update the chart keeping the current animation but suppressing a new one @param {object} config - animation options
[ "Update", "the", "chart", "keeping", "the", "current", "animation", "but", "suppressing", "a", "new", "one" ]
b53ec168f2d0729014651d694cc041a6a7d4ff26
https://github.com/nagix/chartjs-plugin-streaming/blob/b53ec168f2d0729014651d694cc041a6a7d4ff26/src/plugins/plugin.streaming.js#L24-L69
14,791
nagix/chartjs-plugin-streaming
src/plugins/plugin.streaming.js
drawChart
function drawChart(chart) { var streaming = chart.streaming; var frameRate = chart.options.plugins.streaming.frameRate; var frameDuration = 1000 / (Math.max(frameRate, 0) || 30); var next = streaming.lastDrawn + frameDuration || 0; var now = Date.now(); var lastMouseEvent = streaming.lastMouseEvent; if (next <=...
javascript
function drawChart(chart) { var streaming = chart.streaming; var frameRate = chart.options.plugins.streaming.frameRate; var frameDuration = 1000 / (Math.max(frameRate, 0) || 30); var next = streaming.lastDrawn + frameDuration || 0; var now = Date.now(); var lastMouseEvent = streaming.lastMouseEvent; if (next <=...
[ "function", "drawChart", "(", "chart", ")", "{", "var", "streaming", "=", "chart", ".", "streaming", ";", "var", "frameRate", "=", "chart", ".", "options", ".", "plugins", ".", "streaming", ".", "frameRate", ";", "var", "frameDuration", "=", "1000", "/", ...
Draw chart at frameRate
[ "Draw", "chart", "at", "frameRate" ]
b53ec168f2d0729014651d694cc041a6a7d4ff26
https://github.com/nagix/chartjs-plugin-streaming/blob/b53ec168f2d0729014651d694cc041a6a7d4ff26/src/plugins/plugin.streaming.js#L72-L90
14,792
DubFriend/jquery.repeater
jquery.repeater.js
function (minimumInterval, callback) { var timeout = null; return function () { var that = this, args = arguments; if(timeout === null) { timeout = setTimeout(function () { timeout = null; }, minimumInterval); callback.apply(that, args); ...
javascript
function (minimumInterval, callback) { var timeout = null; return function () { var that = this, args = arguments; if(timeout === null) { timeout = setTimeout(function () { timeout = null; }, minimumInterval); callback.apply(that, args); ...
[ "function", "(", "minimumInterval", ",", "callback", ")", "{", "var", "timeout", "=", "null", ";", "return", "function", "(", ")", "{", "var", "that", "=", "this", ",", "args", "=", "arguments", ";", "if", "(", "timeout", "===", "null", ")", "{", "ti...
execute callback immediately and at most one time on the minimumInterval, ignore block attempts
[ "execute", "callback", "immediately", "and", "at", "most", "one", "time", "on", "the", "minimumInterval", "ignore", "block", "attempts" ]
1c3ba62b6a6801f0555cd58ba23706a6b65a4c1e
https://github.com/DubFriend/jquery.repeater/blob/1c3ba62b6a6801f0555cd58ba23706a6b65a4c1e/jquery.repeater.js#L123-L134
14,793
biggora/caminte
lib/validatable.js
blank
function blank(v) { if (typeof v === 'undefined') return true; if (v instanceof Array && v.length === 0) return true; if (v === null) return true; if (typeof v === 'string' && v === '') return true; return false; }
javascript
function blank(v) { if (typeof v === 'undefined') return true; if (v instanceof Array && v.length === 0) return true; if (v === null) return true; if (typeof v === 'string' && v === '') return true; return false; }
[ "function", "blank", "(", "v", ")", "{", "if", "(", "typeof", "v", "===", "'undefined'", ")", "return", "true", ";", "if", "(", "v", "instanceof", "Array", "&&", "v", ".", "length", "===", "0", ")", "return", "true", ";", "if", "(", "v", "===", "...
Return true when v is undefined, blank array, null or empty string otherwise returns false @param {Mix} v @returns {Boolean} whether `v` blank or not
[ "Return", "true", "when", "v", "is", "undefined", "blank", "array", "null", "or", "empty", "string", "otherwise", "returns", "false" ]
1d75b68052416d9819e2275479ef51b88e96d3e6
https://github.com/biggora/caminte/blob/1d75b68052416d9819e2275479ef51b88e96d3e6/lib/validatable.js#L546-L552
14,794
biggora/caminte
lib/schema.js
Schema
function Schema(name, settings) { var schema = this; name = name ? name.toLowerCase() : ''; switch (name) { case 'sqlite': name = 'sqlite3'; break; case 'mysqldb': case 'mariadb': name = 'mysql'; break; case 'mongo': ...
javascript
function Schema(name, settings) { var schema = this; name = name ? name.toLowerCase() : ''; switch (name) { case 'sqlite': name = 'sqlite3'; break; case 'mysqldb': case 'mariadb': name = 'mysql'; break; case 'mongo': ...
[ "function", "Schema", "(", "name", ",", "settings", ")", "{", "var", "schema", "=", "this", ";", "name", "=", "name", "?", "name", ".", "toLowerCase", "(", ")", ":", "''", ";", "switch", "(", "name", ")", "{", "case", "'sqlite'", ":", "name", "=", ...
Schema - adapter-specific classes factory. All classes in single schema shares same adapter type and one database connection @param name - type of schema adapter (mysql, mongoose, sequelize, redis) @param settings - any database-specific settings which we need to establish connection (of course it depends on specific...
[ "Schema", "-", "adapter", "-", "specific", "classes", "factory", "." ]
1d75b68052416d9819e2275479ef51b88e96d3e6
https://github.com/biggora/caminte/blob/1d75b68052416d9819e2275479ef51b88e96d3e6/lib/schema.js#L50-L158
14,795
gruntjs/grunt-contrib-watch
tasks/watch.js
function(time) { grunt.log.writeln(String( 'Completed in ' + time.toFixed(3) + 's at ' + (new Date()).toString() ).cyan + ' - ' + waiting); }
javascript
function(time) { grunt.log.writeln(String( 'Completed in ' + time.toFixed(3) + 's at ' + (new Date()).toString() ).cyan + ' - ' + waiting); }
[ "function", "(", "time", ")", "{", "grunt", ".", "log", ".", "writeln", "(", "String", "(", "'Completed in '", "+", "time", ".", "toFixed", "(", "3", ")", "+", "'s at '", "+", "(", "new", "Date", "(", ")", ")", ".", "toString", "(", ")", ")", "."...
Default date format logged
[ "Default", "date", "format", "logged" ]
3b7ddf4453787979a22b83949b86106534c78d26
https://github.com/gruntjs/grunt-contrib-watch/blob/3b7ddf4453787979a22b83949b86106534c78d26/tasks/watch.js#L23-L30
14,796
gruntjs/grunt-contrib-watch
tasks/lib/taskrun.js
TaskRun
function TaskRun(target) { this.name = target.name || 0; this.files = target.files || []; this._getConfig = target._getConfig; this.options = target.options; this.startedAt = false; this.spawned = null; this.changedFiles = Object.create(null); this.spawnTaskFailure = false; this.live...
javascript
function TaskRun(target) { this.name = target.name || 0; this.files = target.files || []; this._getConfig = target._getConfig; this.options = target.options; this.startedAt = false; this.spawned = null; this.changedFiles = Object.create(null); this.spawnTaskFailure = false; this.live...
[ "function", "TaskRun", "(", "target", ")", "{", "this", ".", "name", "=", "target", ".", "name", "||", "0", ";", "this", ".", "files", "=", "target", ".", "files", "||", "[", "]", ";", "this", ".", "_getConfig", "=", "target", ".", "_getConfig", ";...
Create a TaskRun on a target
[ "Create", "a", "TaskRun", "on", "a", "target" ]
3b7ddf4453787979a22b83949b86106534c78d26
https://github.com/gruntjs/grunt-contrib-watch/blob/3b7ddf4453787979a22b83949b86106534c78d26/tasks/lib/taskrun.js#L14-L27
14,797
bhushankumarl/amazon-mws
lib/AmazonMwsResource.js
AmazonMwsResource
function AmazonMwsResource(AmazonMws, urlData) { this._AmazonMws = AmazonMws; this._urlData = urlData || {}; this.basePath = utils.makeURLInterpolator(AmazonMws.getApiField('basePath')); this.path = utils.makeURLInterpolator(this.path); if (this.includeBasic) { this.includeBasic.forEach(fu...
javascript
function AmazonMwsResource(AmazonMws, urlData) { this._AmazonMws = AmazonMws; this._urlData = urlData || {}; this.basePath = utils.makeURLInterpolator(AmazonMws.getApiField('basePath')); this.path = utils.makeURLInterpolator(this.path); if (this.includeBasic) { this.includeBasic.forEach(fu...
[ "function", "AmazonMwsResource", "(", "AmazonMws", ",", "urlData", ")", "{", "this", ".", "_AmazonMws", "=", "AmazonMws", ";", "this", ".", "_urlData", "=", "urlData", "||", "{", "}", ";", "this", ".", "basePath", "=", "utils", ".", "makeURLInterpolator", ...
Encapsulates request logic for a AmazonMws Resource
[ "Encapsulates", "request", "logic", "for", "a", "AmazonMws", "Resource" ]
e531635363a03a124c75bfac7aedde89b1193d07
https://github.com/bhushankumarl/amazon-mws/blob/e531635363a03a124c75bfac7aedde89b1193d07/lib/AmazonMwsResource.js#L32-L46
14,798
bhushankumarl/amazon-mws
lib/AmazonMwsMethod.js
amazonMwsMethod
function amazonMwsMethod(spec) { var commandPath = typeof spec.path === 'function' ? spec.path : utils.makeURLInterpolator(spec.path || ''); var requestMethod = (spec.method || 'GET').toUpperCase(); var urlParams = spec.urlParams || []; var encode = spec.encode || function (data) { return ...
javascript
function amazonMwsMethod(spec) { var commandPath = typeof spec.path === 'function' ? spec.path : utils.makeURLInterpolator(spec.path || ''); var requestMethod = (spec.method || 'GET').toUpperCase(); var urlParams = spec.urlParams || []; var encode = spec.encode || function (data) { return ...
[ "function", "amazonMwsMethod", "(", "spec", ")", "{", "var", "commandPath", "=", "typeof", "spec", ".", "path", "===", "'function'", "?", "spec", ".", "path", ":", "utils", ".", "makeURLInterpolator", "(", "spec", ".", "path", "||", "''", ")", ";", "var"...
Create an API method from the declared spec. @param [spec.method='GET'] Request Method (POST, GET, DELETE, PUT) @param [spec.path=''] Path to be appended to the API BASE_PATH, joined with the instance's path (e.g. 'charges' or 'customers') @param [spec.required=[]] Array of required arguments in the order that they mu...
[ "Create", "an", "API", "method", "from", "the", "declared", "spec", "." ]
e531635363a03a124c75bfac7aedde89b1193d07
https://github.com/bhushankumarl/amazon-mws/blob/e531635363a03a124c75bfac7aedde89b1193d07/lib/AmazonMwsMethod.js#L22-L90
14,799
bhushankumarl/amazon-mws
lib/Error.js
_Error
function _Error() { this.populate.apply(this, arguments); var stack = (new Error(this.message)).stack; debug('stack ', stack); }
javascript
function _Error() { this.populate.apply(this, arguments); var stack = (new Error(this.message)).stack; debug('stack ', stack); }
[ "function", "_Error", "(", ")", "{", "this", ".", "populate", ".", "apply", "(", "this", ",", "arguments", ")", ";", "var", "stack", "=", "(", "new", "Error", "(", "this", ".", "message", ")", ")", ".", "stack", ";", "debug", "(", "'stack '", ",", ...
Generic Error Class to wrap any errors returned by AmazonMws-node
[ "Generic", "Error", "Class", "to", "wrap", "any", "errors", "returned", "by", "AmazonMws", "-", "node" ]
e531635363a03a124c75bfac7aedde89b1193d07
https://github.com/bhushankumarl/amazon-mws/blob/e531635363a03a124c75bfac7aedde89b1193d07/lib/Error.js#L11-L15