Sha256: 41c5cd79688c35e4fa737abf59c59b5f32f2bad655c6501713ce0012c8715a4d

Contents?: true

Size: 1.05 KB

Versions: 28

Compression:

Stored size: 1.05 KB

Contents

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

extend = require('assimilate');

merge = extend.withStrategy('deep');

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

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

28 entries across 28 versions & 1 rubygems

Version Path
ende-0.4.25 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.24 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.23 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.5.1 components/indefinido/indemma/master/lib/record/storable.js
ende-0.4.22 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.21 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.5.0 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.20 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.19 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.18 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.17 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.16 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.15 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.14 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.13 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.12 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.11 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.10 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.9 vendor/components/indefinido-indemma/lib/record/storable.js
ende-0.4.8 vendor/components/indefinido-indemma/lib/record/storable.js