Sha256: 71d635ab2093f40de3f0ec4958459804e543099404993ef23395bef8327dd2f3

Contents?: true

Size: 1.31 KB

Versions: 20

Compression:

Stored size: 1.31 KB

Contents

var extend, merge, model, record, stampit, storable;

extend = require('assimilate');

merge = extend.withStrategy('deep');

stampit = require('../../vendor/stampit');

Object.values || (Object.values = (typeof _ !== "undefined" && _ !== null ? _.values : void 0) || function(object) {
  var key, value, _results;

  _results = [];
  for (key in object) {
    value = object[key];
    _results.push(value);
  }
  return _results;
});

storable = stampit({
  store: function(keypath, value, options) {
    var collection, entry, key, _i, _len;

    collection = this.database;
    keypath = keypath.toString().split('.');
    key = keypath.pop();
    for (_i = 0, _len = keypath.length; _i < _len; _i++) {
      entry = keypath[_i];
      collection[entry] || (collection[entry] = {});
      collection = collection[entry];
    }
    if (arguments.length === 1) {
      this.reads++;
      return collection[key];
    } else {
      this.writes++;
      value.sustained || (value.sustained = true);
      return collection[key] = value;
    }
  },
  values: function() {
    return Object.values(this.database);
  }
}, {
  type: 'object',
  writes: 0,
  reads: 0
}, function() {
  this.database || (this.database = {});
  return this;
});

model = window.model;

record = window.record;

model.storable = true;

module.exports = storable;

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ende-0.5.22 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.21 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.20 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.19 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.18 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.17 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.16 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.15 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.14 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.13 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.12 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.10 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.9 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.8 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.7 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.6 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.5 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.4 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.3 components/indefinido/indemma/master/lib/record/storable.js
ende-0.5.2 components/indefinido/indemma/master/lib/record/storable.js