Sha256: 6ff5517b3554168d9350047d65af9a811af2593208ae1b036a8e5240f636a11e

Contents?: true

Size: 742 Bytes

Versions: 1

Compression:

Stored size: 742 Bytes

Contents

Jazz.Db = function () {
  this._prepare();
}

Jazz.Db.extend = Jazz.Db.create = Jazz.Helper.extend;

_.extend(
  Jazz.Db.prototype,
  {
    //
    _prepare:function () {
      //Resets the attributes per OBJ
      this.models = {};
    },

    add:function (model) {
      obj = jQuery.extend(true, {}, model);
      obj._config.persist = true;
      this.models[obj.uid] = obj;
    },

    all:function () {
      return this.models;
    },

    first:function () {
      return _.first(this.models);
    },

    findBy:function (query) {
      var objs = [];
      _.each(
        this.models,
        function (model) {
          if (model.hasPropertiesWithValues(query)) objs.push(model);
        }
      );
      return objs
    }
  }
);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jazz-jss-0.0.2 dist/jazz/lib/db.js