Socket
Socket
Sign inDemoInstall

viewmodel

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

viewmodel - npm Package Compare versions

Comparing version 0.2.5 to 0.3.0

.npmignore

94

lib/repository.js

@@ -1,4 +0,1 @@

// lib/queue.js v0.1.0
// (c) 2012 Adriano Raiano (adrai); under MIT License
var fs = require('fs')

@@ -82,50 +79,65 @@ , _ = require('underscore');

module.exports = {
var WriteRepository = function() {};
write: {
WriteRepository.prototype = {
getNewViewModel: function(id) {
return this.fromObject({ id: id, actionOnCommit: 'create', _revision: 1 });
},
getNewViewModel: function(id) {
return this.fromObject({ id: id, actionOnCommit: 'create', _revision: 1 });
},
fromViewModel: fromViewModel,
fromObject: function(obj) {
var self = this;
var vm = _.clone(obj);
vm.actionOnCommit = vm.actionOnCommit || 'update';
vm.destroy = destroy;
vm.commit = function(callback) {
self.commit(this, callback);
};
vm.toJSON = function() { return fromViewModel(this); };
vm.set = set;
vm.get = get;
return vm;
},
init: function(options, callback) {
initialize(this, options, callback);
}
fromViewModel: fromViewModel,
fromObject: function(obj) {
var self = this;
var vm = _.clone(obj);
vm.actionOnCommit = vm.actionOnCommit || 'update';
vm.destroy = destroy;
vm.commit = function(callback) {
self.commit(this, callback);
};
vm.toJSON = function() { return fromViewModel(this); };
vm.set = set;
vm.get = get;
return vm;
},
read: {
init: function(options, callback) {
initialize(this, options, callback);
}
getNewViewModel: function(id) {
return null;
},
};
fromViewModel: fromViewModel,
fromObject: function(obj) {
return obj;
},
var ReadRepository = function() {};
init: function(options, callback) {
initialize(this, options, callback);
}
ReadRepository.prototype = {
getNewViewModel: function(id) {
return null;
},
fromViewModel: fromViewModel,
fromObject: function(obj) {
return obj;
},
init: function(options, callback) {
initialize(this, options, callback);
}
};
var repository = {
write: new WriteRepository(),
read: new ReadRepository()
};
repository.write.create = function() {
return new WriteRepository();
};
repository.read.create = function() {
return new ReadRepository();
};
module.exports = repository;
{
"author": "adrai",
"name": "viewmodel",
"version": "0.2.5",
"version": "0.3.0",
"private": false,

@@ -6,0 +6,0 @@ "main": "index.js",

@@ -6,2 +6,17 @@ var expect = require('expect.js')

describe('calling create', function() {
describe('on read (or write)', function() {
it('it should return the same type of object as the singleton instance', function() {
var newReadRepo = repository.read.create();
expect(newReadRepo.init).to.eql(repository.read.init);
});
});
});
describe('calling init', function() {

@@ -8,0 +23,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc