Code coverage report for lib/collection/collection.js

Statements: 90.91% (10 / 11)      Branches: 100% (0 / 0)      Functions: 33.33% (1 / 3)      Lines: 90.91% (10 / 11)      Ignored: none     

All files » lib/collection/ » collection.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34            1 1           1   1 8 8     1 1           1 8          
'use strict';
 
/**
 * methods a collection must implement
 */
 
var names = 'find findOne update remove count distict findAndModify aggregate';
var methods = names.split(' ');
 
/**
 * Collection base class from which implementations inherit
 */
 
function Collection () {}
 
for (var i = 0, len = methods.length; i < len; ++i) {
  var method = methods[i];
  Collection.prototype[method] = notImplemented(method);
}
 
module.exports = exports = Collection;
Collection.methods = methods;
 
/**
 * creates a function which throws an implementation error
 */
 
function notImplemented (method) {
  return function () {
    throw new Error('collection.' + method + ' not implemented');
  }
}