New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

liber

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liber - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

test/fixtures/connection.js

39

lib/Liber.js

@@ -32,6 +32,2 @@ var Utils = require('./Utils.js');

copy(data || {}, this);
if (data && data['_id'] && data['_rev']) {
this.updateImage();
}
}

@@ -47,3 +43,3 @@

Liber.inherit = function (Child, childPrototype, opts) {
console.log(this);
console.log('inheriting', Child);
Child = Child || function () {};

@@ -94,2 +90,3 @@ childPrototype = childPrototype || {};

Liber.getOneFromView = function (design, view, params, cb) {

@@ -118,2 +115,26 @@ if (isFunction(params)) {

Liber.get = function (params, cb) {
if (isFunction(params)) {
cb = params;
params = {};
} else if (isString(params)) {
params = {key: params};
}
var me = this;
var mapView = function (el) {
if (params.include_docs) {
return me.parse(el.doc);
} else {
return me.parse(el.value);
}
};
db.get(params, function (err, body) {
if (err) return cb(err);
cb && cb(err, body.rows.map(me.mapFunction(me.parse.bind(me), params)) );
});
};
Liber.getOne = function (id, params, cb) {

@@ -158,5 +179,2 @@ if (isFunction(params)) {

constructor: Liber,
get dirty () {
return toJson(this) !== this._.image;
},
parse: Liber.parse,

@@ -178,3 +196,2 @@ // constructor: Liber,

me['_rev'] = body['rev'];
me.updateImage();
cb && cb(err, me, body);

@@ -190,4 +207,4 @@ });

},
updateImage: function () {
this._.image = toJson(this);
toJSON: function () {
return Utils.copyOwn(this);
}

@@ -194,0 +211,0 @@ };

@@ -20,2 +20,5 @@

function isString(value) { return typeof value == 'string'; }
/**

@@ -58,2 +61,3 @@ * @ngdoc function

} else if (obj.forEach && obj.forEach !== forEach) {
console.log('problem');
obj.forEach(iterator, context);

@@ -131,3 +135,2 @@ } else if (isObject(obj) && isNumber(obj.length)) {

function copy(source, destination) {
console.log('copy', source, destination);
if (!destination) {

@@ -166,2 +169,39 @@ destination = source;

/*
Not too DRY. Temporary fix.
*/
function copyOwn(source, destination) {
if (!destination) {
destination = source;
if (source) {
if (isArray(source)) {
destination = copyOwn(source, []);
} else if (isDate(source)) {
destination = new Date(source.getTime());
} else if (isObject(source)) {
destination = copyOwn(source, {});
}
}
} else {
if (source === destination) throw Error("Can't copy equivalent objects or arrays");
if (isArray(source)) {
destination.length = 0;
for ( var i = 0; i < source.length; i++) {
destination.push(copyOwn(source[i]));
}
} else {
forEach(destination, function(value, key){
delete destination[key];
});
for ( var key in source) {
if (source.hasOwnProperty(key)) {
destination[key] = copyOwn(source[key]);
}
}
}
}
return destination;
}
module.exports = exports = {

@@ -172,6 +212,8 @@ isArray: isArray,

isFunction: isFunction,
isString: isString,
forEach: forEach,
copy: copy,
copyOwn: copyOwn,
extend: extend,
capitaliseFirstLetter: capitaliseFirstLetter
};
{
"name": "liber",
"version": "0.0.1",
"version": "0.0.2",
"description": "Shemaless ORMlike library for CouchDB",
"main": "lib/Liber.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha ./test/spec/index.js",
"setUp": "node ./test/fixtures/setUp.js",
"tearDown": "node ./test/fixtures/tearDown.js"
},

@@ -19,4 +21,12 @@ "repository": {

],
"dependencies": {
},
"devDependencies": {
"nano": "*",
"async": "*",
"mocha": "1.8.x",
"should": "0.6.x"
},
"author": "Rauno Viskus",
"license": "MIT"
}

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