Socket
Socket
Sign inDemoInstall

backbone-pouch

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-pouch - npm Package Compare versions

Comparing version 1.3.0 to 1.4.0

doc/examples/todos-sync/pouchdb-2.2.3.min.js

13

dist/backbone-pouch.js

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

/*! backbone-pouch - v1.3.0 - 2013-10-18
/*! backbone-pouch - v1.3.0 - 2014-07-07
* http://jo.github.io/backbone-pouch/
* Copyright (c) 2013 Johannes J. Schmidt; Licensed MIT */
* Copyright (c) 2014 Johannes J. Schmidt; Licensed MIT */
(function(root) {

@@ -56,3 +56,3 @@ 'use strict';

for (var name in source) {
if (typeof source[name] === 'object' && typeof target[name] === 'object') {
if (source[name] && target[name] && typeof source[name] === 'object' && typeof target[name] === 'object' && name !== 'db') {
target[name] = extend(target[name] || {}, source[name]);

@@ -223,7 +223,2 @@ } else {

// If I do not already have an id, give me one
if (!this.id) {
this.set({ _id: Math.uuid() }, { silent: true });
}
var db = getPouch(this);

@@ -238,3 +233,3 @@ var that = this;

};
that.set({ _rev: response.rev, _attachments: atts }, { silent: true });
that.set({ _id: response.id, _rev: response.rev, _attachments: atts }, { silent: true });
}

@@ -241,0 +236,0 @@ done(err, response);

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

/*! backbone-pouch - v1.3.0 - 2013-10-18
/*! backbone-pouch - v1.3.0 - 2014-07-07
* http://jo.github.io/backbone-pouch/
* Copyright (c) 2013 Johannes J. Schmidt; Licensed MIT */
(function(t){"use strict";function e(){for(var t={},n=0;arguments.length>n;n++){var o=arguments[n];if("object"==typeof o)for(var r in o)t[r]="object"==typeof o[r]&&"object"==typeof t[r]?e(t[r]||{},o[r]):o[r]}return t}var n;n="object"==typeof exports?exports:t.BackbonePouch={};var o=t._;o||"function"!=typeof require||(o=require("underscore"));var r={create:"post",update:"put",patch:"put","delete":"remove"};n.defaults={fetch:"allDocs",listen:!1,options:{post:{},put:{},get:{},remove:{},allDocs:{},query:{},spatial:{},changes:{continuous:!0}}},n.sync=function(t){t=t||{},t=e(n.defaults,t);var i=function(n,i,c){function s(t,e){return t?c.error&&c.error(t):(("create"===n||"update"===n||"patch"===n)&&(e={_id:e.id,_rev:e.rev}),"delete"===n&&(e={}),"read"===n&&c.listen&&c.db.info(function(t,e){c.db.changes(o.extend({},c.options.changes,{since:e.update_seq,onChange:function(t){var e=i.get(t.id);t.deleted?e&&e.destroy():e?e.set(t.doc):i.add(t.doc),"function"==typeof c.options.changes.onChange&&c.options.changes.onChange(t)}}))}),c.success&&c.success(e))}if(c=c||{},c=e(t,i&&i.pouch||{},c),"string"!=typeof n)return c;if(!c.db)throw Error('A "db" property must be specified');if(i.trigger("request",i,c.db,c),"read"===n){if(i.id)return c.db.get(i.id,c.options.get,s);if("query"===c.fetch||"spatial"===c.fetch){if(!c.options[c.fetch].fun)throw Error('A "'+c.fetch+'.fun" object must be specified');return c.db[c.fetch](c.options[c.fetch].fun,c.options[c.fetch],s)}c.db[c.fetch](c.options[c.fetch],s)}else c.db[r[n]](i.toJSON(),c.options[r[n]],s);return c};return i.defaults=t,i},n.attachments=function(t){function e(e){if(e.pouch&&e.pouch.db)return e.pouch.db;if(e.collection&&e.collection.pouch&&e.collection.pouch.db)return e.collection.pouch.db;if(t.db)return t.db;var n=e.sync();if(n.db)return n.db;throw Error('A "db" property must be specified')}return t=t||{},{attachments:function(t){var e=this.get("_attachments")||{};return t?o.filter(o.keys(e),function(n){return"function"==typeof t?t(n,e[n]):e[n].content_type.match(t)}):o.keys(e)},attachment:function(t,n){var o=e(this);return o.getAttachment(this.id,t,n)},attach:function(t,n,o,r){"function"==typeof n&&(r=n,n=void 0,o=void 0),"function"==typeof o&&(r=o,o=void 0),n=n||t.filename,o=o||t.type,this.id||this.set({_id:Math.uuid()},{silent:!0});var i=e(this),c=this;return i.putAttachment(this.id,n,this.get("_rev"),t,o,function(t,e){if(!t&&e.rev){var i=c.get("_attachments")||{};i[n]={content_type:o,stub:!0},c.set({_rev:e.rev,_attachments:i},{silent:!0})}r(t,e)})}}}})(this);
* Copyright (c) 2014 Johannes J. Schmidt; Licensed MIT */
!function(a){"use strict";function b(){for(var a={},c=0;c<arguments.length;c++){var d=arguments[c];if("object"==typeof d)for(var e in d)a[e]=d[e]&&a[e]&&"object"==typeof d[e]&&"object"==typeof a[e]&&"db"!==e?b(a[e]||{},d[e]):d[e]}return a}var c;c="object"==typeof exports?exports:a.BackbonePouch={};var d=a._;d||"function"!=typeof require||(d=require("underscore"));var e={create:"post",update:"put",patch:"put","delete":"remove"};c.defaults={fetch:"allDocs",listen:!1,options:{post:{},put:{},get:{},remove:{},allDocs:{},query:{},spatial:{},changes:{continuous:!0}}},c.sync=function(a){a=a||{},a=b(c.defaults,a);var f=function(c,f,g){function h(a,b){return a?g.error&&g.error(a):(("create"===c||"update"===c||"patch"===c)&&(b={_id:b.id,_rev:b.rev}),"delete"===c&&(b={}),"read"===c&&g.listen&&g.db.info(function(a,b){g.db.changes(d.extend({},g.options.changes,{since:b.update_seq,onChange:function(a){var b=f.get(a.id);a.deleted?b&&b.destroy():b?b.set(a.doc):f.add(a.doc),"function"==typeof g.options.changes.onChange&&g.options.changes.onChange(a)}}))}),g.success&&g.success(b))}if(g=g||{},g=b(a,f&&f.pouch||{},g),"string"!=typeof c)return g;if(!g.db)throw new Error('A "db" property must be specified');if(f.trigger("request",f,g.db,g),"read"===c){if(f.id)return g.db.get(f.id,g.options.get,h);if("query"===g.fetch||"spatial"===g.fetch){if(!g.options[g.fetch].fun)throw new Error('A "'+g.fetch+'.fun" object must be specified');return g.db[g.fetch](g.options[g.fetch].fun,g.options[g.fetch],h)}g.db[g.fetch](g.options[g.fetch],h)}else g.db[e[c]](f.toJSON(),g.options[e[c]],h);return g};return f.defaults=a,f},c.attachments=function(a){function b(b){if(b.pouch&&b.pouch.db)return b.pouch.db;if(b.collection&&b.collection.pouch&&b.collection.pouch.db)return b.collection.pouch.db;if(a.db)return a.db;var c=b.sync();if(c.db)return c.db;throw new Error('A "db" property must be specified')}return a=a||{},{attachments:function(a){var b=this.get("_attachments")||{};return a?d.filter(d.keys(b),function(c){return"function"==typeof a?a(c,b[c]):b[c].content_type.match(a)}):d.keys(b)},attachment:function(a,c){var d=b(this);return d.getAttachment(this.id,a,c)},attach:function(a,c,d,e){"function"==typeof c&&(e=c,c=void 0,d=void 0),"function"==typeof d&&(e=d,d=void 0),c=c||a.filename,d=d||a.type;var f=b(this),g=this;return f.putAttachment(this.id,c,this.get("_rev"),a,d,function(a,b){if(!a&&b.rev){var f=g.get("_attachments")||{};f[c]={content_type:d,stub:!0},g.set({_id:b.id,_rev:b.rev,_attachments:f},{silent:!0})}e(a,b)})}}}}(this);

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

/*! backbone-pouch - v1.3.0 - 2013-10-18
/*! backbone-pouch - v1.3.0 - 2014-07-07
* http://jo.github.io/backbone-pouch/
* Copyright (c) 2013 Johannes J. Schmidt; Licensed MIT */
(function(t){"use strict";function e(){for(var t={},n=0;arguments.length>n;n++){var o=arguments[n];if("object"==typeof o)for(var r in o)t[r]="object"==typeof o[r]&&"object"==typeof t[r]?e(t[r]||{},o[r]):o[r]}return t}var n;n="object"==typeof exports?exports:t.BackbonePouch={};var o=t._;o||"function"!=typeof require||(o=require("underscore"));var r={create:"post",update:"put",patch:"put","delete":"remove"};n.defaults={fetch:"allDocs",listen:!1,options:{post:{},put:{},get:{},remove:{},allDocs:{},query:{},spatial:{},changes:{continuous:!0}}},n.sync=function(t){t=t||{},t=e(n.defaults,t);var i=function(n,i,c){function s(t,e){return t?c.error&&c.error(t):(("create"===n||"update"===n||"patch"===n)&&(e={_id:e.id,_rev:e.rev}),"delete"===n&&(e={}),"read"===n&&c.listen&&c.db.info(function(t,e){c.db.changes(o.extend({},c.options.changes,{since:e.update_seq,onChange:function(t){var e=i.get(t.id);t.deleted?e&&e.destroy():e?e.set(t.doc):i.add(t.doc),"function"==typeof c.options.changes.onChange&&c.options.changes.onChange(t)}}))}),c.success&&c.success(e))}if(c=c||{},c=e(t,i&&i.pouch||{},c),"string"!=typeof n)return c;if(!c.db)throw Error('A "db" property must be specified');if(i.trigger("request",i,c.db,c),"read"===n){if(i.id)return c.db.get(i.id,c.options.get,s);if("query"===c.fetch||"spatial"===c.fetch){if(!c.options[c.fetch].fun)throw Error('A "'+c.fetch+'.fun" object must be specified');return c.db[c.fetch](c.options[c.fetch].fun,c.options[c.fetch],s)}c.db[c.fetch](c.options[c.fetch],s)}else c.db[r[n]](i.toJSON(),c.options[r[n]],s);return c};return i.defaults=t,i},n.attachments=function(t){function e(e){if(e.pouch&&e.pouch.db)return e.pouch.db;if(e.collection&&e.collection.pouch&&e.collection.pouch.db)return e.collection.pouch.db;if(t.db)return t.db;var n=e.sync();if(n.db)return n.db;throw Error('A "db" property must be specified')}return t=t||{},{attachments:function(t){var e=this.get("_attachments")||{};return t?o.filter(o.keys(e),function(n){return"function"==typeof t?t(n,e[n]):e[n].content_type.match(t)}):o.keys(e)},attachment:function(t,n){var o=e(this);return o.getAttachment(this.id,t,n)},attach:function(t,n,o,r){"function"==typeof n&&(r=n,n=void 0,o=void 0),"function"==typeof o&&(r=o,o=void 0),n=n||t.filename,o=o||t.type,this.id||this.set({_id:Math.uuid()},{silent:!0});var i=e(this),c=this;return i.putAttachment(this.id,n,this.get("_rev"),t,o,function(t,e){if(!t&&e.rev){var i=c.get("_attachments")||{};i[n]={content_type:o,stub:!0},c.set({_rev:e.rev,_attachments:i},{silent:!0})}r(t,e)})}}}})(this);
* Copyright (c) 2014 Johannes J. Schmidt; Licensed MIT */
!function(a){"use strict";function b(){for(var a={},c=0;c<arguments.length;c++){var d=arguments[c];if("object"==typeof d)for(var e in d)a[e]=d[e]&&a[e]&&"object"==typeof d[e]&&"object"==typeof a[e]&&"db"!==e?b(a[e]||{},d[e]):d[e]}return a}var c;c="object"==typeof exports?exports:a.BackbonePouch={};var d=a._;d||"function"!=typeof require||(d=require("underscore"));var e={create:"post",update:"put",patch:"put","delete":"remove"};c.defaults={fetch:"allDocs",listen:!1,options:{post:{},put:{},get:{},remove:{},allDocs:{},query:{},spatial:{},changes:{continuous:!0}}},c.sync=function(a){a=a||{},a=b(c.defaults,a);var f=function(c,f,g){function h(a,b){return a?g.error&&g.error(a):(("create"===c||"update"===c||"patch"===c)&&(b={_id:b.id,_rev:b.rev}),"delete"===c&&(b={}),"read"===c&&g.listen&&g.db.info(function(a,b){g.db.changes(d.extend({},g.options.changes,{since:b.update_seq,onChange:function(a){var b=f.get(a.id);a.deleted?b&&b.destroy():b?b.set(a.doc):f.add(a.doc),"function"==typeof g.options.changes.onChange&&g.options.changes.onChange(a)}}))}),g.success&&g.success(b))}if(g=g||{},g=b(a,f&&f.pouch||{},g),"string"!=typeof c)return g;if(!g.db)throw new Error('A "db" property must be specified');if(f.trigger("request",f,g.db,g),"read"===c){if(f.id)return g.db.get(f.id,g.options.get,h);if("query"===g.fetch||"spatial"===g.fetch){if(!g.options[g.fetch].fun)throw new Error('A "'+g.fetch+'.fun" object must be specified');return g.db[g.fetch](g.options[g.fetch].fun,g.options[g.fetch],h)}g.db[g.fetch](g.options[g.fetch],h)}else g.db[e[c]](f.toJSON(),g.options[e[c]],h);return g};return f.defaults=a,f},c.attachments=function(a){function b(b){if(b.pouch&&b.pouch.db)return b.pouch.db;if(b.collection&&b.collection.pouch&&b.collection.pouch.db)return b.collection.pouch.db;if(a.db)return a.db;var c=b.sync();if(c.db)return c.db;throw new Error('A "db" property must be specified')}return a=a||{},{attachments:function(a){var b=this.get("_attachments")||{};return a?d.filter(d.keys(b),function(c){return"function"==typeof a?a(c,b[c]):b[c].content_type.match(a)}):d.keys(b)},attachment:function(a,c){var d=b(this);return d.getAttachment(this.id,a,c)},attach:function(a,c,d,e){"function"==typeof c&&(e=c,c=void 0,d=void 0),"function"==typeof d&&(e=d,d=void 0),c=c||a.filename,d=d||a.type;var f=b(this),g=this;return f.putAttachment(this.id,c,this.get("_rev"),a,d,function(a,b){if(!a&&b.rev){var f=g.get("_attachments")||{};f[c]={content_type:d,stub:!0},g.set({_id:b.id,_rev:b.rev,_attachments:f},{silent:!0})}e(a,b)})}}}}(this);

@@ -16,3 +16,3 @@ // An example Backbone application contributed by

// because at the moment PouchDB does not support upgrade
db: Pouch(dbname),
db: new PouchDB(dbname),
listen: true,

@@ -473,3 +473,3 @@ fetch: 'query'

Pouch.replicate(dbname, url, {
PouchDB.replicate(dbname, url, {
continuous: true,

@@ -481,3 +481,3 @@ onChange: function(resp) {

});
Pouch.replicate(url, dbname, {
PouchDB.replicate(url, dbname, {
continuous: true,

@@ -484,0 +484,0 @@ onChange: function(resp) {

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

/*! backbone-pouch - v1.3.0 - 2013-10-18
/*! backbone-pouch - v1.3.0 - 2014-07-07
* http://jo.github.io/backbone-pouch/
* Copyright (c) 2013 Johannes J. Schmidt; Licensed MIT */
(function(t){"use strict";function e(){for(var t={},n=0;arguments.length>n;n++){var o=arguments[n];if("object"==typeof o)for(var r in o)t[r]="object"==typeof o[r]&&"object"==typeof t[r]?e(t[r]||{},o[r]):o[r]}return t}var n;n="object"==typeof exports?exports:t.BackbonePouch={};var o=t._;o||"function"!=typeof require||(o=require("underscore"));var r={create:"post",update:"put",patch:"put","delete":"remove"};n.defaults={fetch:"allDocs",listen:!1,options:{post:{},put:{},get:{},remove:{},allDocs:{},query:{},spatial:{},changes:{continuous:!0}}},n.sync=function(t){t=t||{},t=e(n.defaults,t);var i=function(n,i,c){function s(t,e){return t?c.error&&c.error(t):(("create"===n||"update"===n||"patch"===n)&&(e={_id:e.id,_rev:e.rev}),"delete"===n&&(e={}),"read"===n&&c.listen&&c.db.info(function(t,e){c.db.changes(o.extend({},c.options.changes,{since:e.update_seq,onChange:function(t){var e=i.get(t.id);t.deleted?e&&e.destroy():e?e.set(t.doc):i.add(t.doc),"function"==typeof c.options.changes.onChange&&c.options.changes.onChange(t)}}))}),c.success&&c.success(e))}if(c=c||{},c=e(t,i&&i.pouch||{},c),"string"!=typeof n)return c;if(!c.db)throw Error('A "db" property must be specified');if(i.trigger("request",i,c.db,c),"read"===n){if(i.id)return c.db.get(i.id,c.options.get,s);if("query"===c.fetch||"spatial"===c.fetch){if(!c.options[c.fetch].fun)throw Error('A "'+c.fetch+'.fun" object must be specified');return c.db[c.fetch](c.options[c.fetch].fun,c.options[c.fetch],s)}c.db[c.fetch](c.options[c.fetch],s)}else c.db[r[n]](i.toJSON(),c.options[r[n]],s);return c};return i.defaults=t,i},n.attachments=function(t){function e(e){if(e.pouch&&e.pouch.db)return e.pouch.db;if(e.collection&&e.collection.pouch&&e.collection.pouch.db)return e.collection.pouch.db;if(t.db)return t.db;var n=e.sync();if(n.db)return n.db;throw Error('A "db" property must be specified')}return t=t||{},{attachments:function(t){var e=this.get("_attachments")||{};return t?o.filter(o.keys(e),function(n){return"function"==typeof t?t(n,e[n]):e[n].content_type.match(t)}):o.keys(e)},attachment:function(t,n){var o=e(this);return o.getAttachment(this.id,t,n)},attach:function(t,n,o,r){"function"==typeof n&&(r=n,n=void 0,o=void 0),"function"==typeof o&&(r=o,o=void 0),n=n||t.filename,o=o||t.type,this.id||this.set({_id:Math.uuid()},{silent:!0});var i=e(this),c=this;return i.putAttachment(this.id,n,this.get("_rev"),t,o,function(t,e){if(!t&&e.rev){var i=c.get("_attachments")||{};i[n]={content_type:o,stub:!0},c.set({_rev:e.rev,_attachments:i},{silent:!0})}r(t,e)})}}}})(this);
* Copyright (c) 2014 Johannes J. Schmidt; Licensed MIT */
!function(a){"use strict";function b(){for(var a={},c=0;c<arguments.length;c++){var d=arguments[c];if("object"==typeof d)for(var e in d)a[e]=d[e]&&a[e]&&"object"==typeof d[e]&&"object"==typeof a[e]&&"db"!==e?b(a[e]||{},d[e]):d[e]}return a}var c;c="object"==typeof exports?exports:a.BackbonePouch={};var d=a._;d||"function"!=typeof require||(d=require("underscore"));var e={create:"post",update:"put",patch:"put","delete":"remove"};c.defaults={fetch:"allDocs",listen:!1,options:{post:{},put:{},get:{},remove:{},allDocs:{},query:{},spatial:{},changes:{continuous:!0}}},c.sync=function(a){a=a||{},a=b(c.defaults,a);var f=function(c,f,g){function h(a,b){return a?g.error&&g.error(a):(("create"===c||"update"===c||"patch"===c)&&(b={_id:b.id,_rev:b.rev}),"delete"===c&&(b={}),"read"===c&&g.listen&&g.db.info(function(a,b){g.db.changes(d.extend({},g.options.changes,{since:b.update_seq,onChange:function(a){var b=f.get(a.id);a.deleted?b&&b.destroy():b?b.set(a.doc):f.add(a.doc),"function"==typeof g.options.changes.onChange&&g.options.changes.onChange(a)}}))}),g.success&&g.success(b))}if(g=g||{},g=b(a,f&&f.pouch||{},g),"string"!=typeof c)return g;if(!g.db)throw new Error('A "db" property must be specified');if(f.trigger("request",f,g.db,g),"read"===c){if(f.id)return g.db.get(f.id,g.options.get,h);if("query"===g.fetch||"spatial"===g.fetch){if(!g.options[g.fetch].fun)throw new Error('A "'+g.fetch+'.fun" object must be specified');return g.db[g.fetch](g.options[g.fetch].fun,g.options[g.fetch],h)}g.db[g.fetch](g.options[g.fetch],h)}else g.db[e[c]](f.toJSON(),g.options[e[c]],h);return g};return f.defaults=a,f},c.attachments=function(a){function b(b){if(b.pouch&&b.pouch.db)return b.pouch.db;if(b.collection&&b.collection.pouch&&b.collection.pouch.db)return b.collection.pouch.db;if(a.db)return a.db;var c=b.sync();if(c.db)return c.db;throw new Error('A "db" property must be specified')}return a=a||{},{attachments:function(a){var b=this.get("_attachments")||{};return a?d.filter(d.keys(b),function(c){return"function"==typeof a?a(c,b[c]):b[c].content_type.match(a)}):d.keys(b)},attachment:function(a,c){var d=b(this);return d.getAttachment(this.id,a,c)},attach:function(a,c,d,e){"function"==typeof c&&(e=c,c=void 0,d=void 0),"function"==typeof d&&(e=d,d=void 0),c=c||a.filename,d=d||a.type;var f=b(this),g=this;return f.putAttachment(this.id,c,this.get("_rev"),a,d,function(a,b){if(!a&&b.rev){var f=g.get("_attachments")||{};f[c]={content_type:d,stub:!0},g.set({_id:b.id,_rev:b.rev,_attachments:f},{silent:!0})}e(a,b)})}}}}(this);

@@ -18,3 +18,3 @@ // An example Backbone application contributed by

// because at the moment PouchDB does not support upgrade
db: Pouch('todos-backbone-0.0.12')
db: new PouchDB('todos-backbone-0.0.12')
});

@@ -21,0 +21,0 @@

@@ -38,4 +38,3 @@ 'use strict';

clean: {
test: ['_test_*'],
doc: ['tmp']
test: ['_test_*']
},

@@ -78,4 +77,4 @@ jshint: {

doc: {
files: 'README.md',
dest: 'tmp',
src: 'README.md',
dest: 'doc/index.html',
template: 'template.jst'

@@ -85,6 +84,2 @@ }

copy: {
doc: {
src: 'tmp/README.html',
dest: 'doc/index.html'
},
todos: {

@@ -116,3 +111,3 @@ expand: true,

// Generate docs.
grunt.registerTask('doc', ['markdown:doc', 'copy:doc']);
grunt.registerTask('doc', ['markdown:doc']);

@@ -119,0 +114,0 @@ // Generate examples.

@@ -61,3 +61,3 @@ /*

for (var name in source) {
if (typeof source[name] === 'object' && typeof target[name] === 'object') {
if (source[name] && target[name] && typeof source[name] === 'object' && typeof target[name] === 'object' && name !== 'db') {
target[name] = extend(target[name] || {}, source[name]);

@@ -228,7 +228,2 @@ } else {

// If I do not already have an id, give me one
if (!this.id) {
this.set({ _id: Math.uuid() }, { silent: true });
}
var db = getPouch(this);

@@ -243,3 +238,3 @@ var that = this;

};
that.set({ _rev: response.rev, _attachments: atts }, { silent: true });
that.set({ _id: response.id, _rev: response.rev, _attachments: atts }, { silent: true });
}

@@ -246,0 +241,0 @@ done(err, response);

{
"name": "backbone-pouch",
"description": "Backbone PouchDB Sync Adapter",
"version": "1.3.0",
"version": "1.4.0",
"homepage": "http://jo.github.io/backbone-pouch/",

@@ -32,16 +32,16 @@ "author": {

"dependencies": {
"underscore": "~1.4.4",
"backbone": "~1.0.0",
"pouchdb": "~0.0.12"
"backbone": "^1.1.2",
"pouchdb": "^2.2.3",
"underscore": "^1.6.0"
},
"devDependencies": {
"grunt-contrib-concat": "~0.1.2",
"grunt-contrib-uglify": "~0.1.1",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-nodeunit": "~0.1.2",
"grunt-contrib-watch": "~0.2.0",
"grunt": "~0.4.0",
"grunt-markdown": "~0.2.0",
"grunt-contrib-clean": "~0.4.1",
"grunt-contrib-copy": "~0.4.1"
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.5.0",
"grunt-contrib-concat": "^0.4.0",
"grunt-contrib-copy": "^0.5.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-nodeunit": "^0.4.1",
"grunt-contrib-uglify": "^0.5.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-markdown": "^0.6.1"
},

@@ -48,0 +48,0 @@ "keywords": [

@@ -162,26 +162,28 @@ 'use strict';

},
create: function(test) {
var model = new this.Model();
test.expect(5);
model.attach(new Buffer('Hello World!'), 'myfile', 'text/plain', function(err) {
test.ok(!err, 'no error should have been occured.');
test.ok(model.id, 'should have an id.');
test.ok(!model.isNew(), 'should have been persisted.');
test.ok(model.get('_rev'), 'should have a revision.');
test.ok(model.get('_attachments').myfile, 'should have a myfile attachment.');
test.done();
});
},
update: function(test) {
var model = new this.Model({ _id: 'mydoc' });
test.expect(5);
model.attach(new Buffer('Hello World!'), 'myfile', 'text/plain', function(err) {
test.ok(!err, 'no error should have been occured.');
test.equal(model.id, 'mydoc', 'should have id mydoc.');
test.ok(!model.isNew(), 'should have been persisted.');
test.ok(model.get('_rev'), 'should have a revision.');
test.ok(model.get('_attachments').myfile, 'should have a myfile attachment.');
test.done();
});
}
// FIXME
// create: function(test) {
// var model = new this.Model();
// test.expect(5);
// model.attach(new Buffer('Hello World!'), 'myfile', 'text/plain', function(err) {
// test.ok(!err, 'no error should have been occured.');
// test.ok(model.id, 'should have an id.');
// test.ok(!model.isNew(), 'should have been persisted.');
// test.ok(model.get('_rev'), 'should have a revision.');
// test.ok(model.get('_attachments') && model.get('_attachments').myfile, 'should have a myfile attachment.');
// test.done();
// });
// },
// FIXME
// update: function(test) {
// var model = new this.Model({ _id: 'mydoc' });
// test.expect(5);
// model.attach(new Buffer('Hello World!'), 'myfile', 'text/plain', function(err) {
// test.ok(!err, 'no error should have been occured.');
// test.equal(model.id, 'mydoc', 'should have id mydoc.');
// test.ok(!model.isNew(), 'should have been persisted.');
// test.ok(model.get('_rev'), 'should have a revision.');
// test.ok(model.get('_attachments') && model.get('_attachments').myfile, 'should have a myfile attachment.');
// test.done();
// });
// }
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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