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

magpie

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

magpie - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

6

index.js

@@ -75,3 +75,3 @@ var fs = require('fs'),

// Get one record by ID
} else if ((_.isString(query) || _.isNumber(id) || _.has(query, 'id')) && _.isFunction(callback)) {
} else if ((_.isString(query) || _.isNumber(query) || _.has(query, 'id')) && _.isFunction(callback)) {
var id = query.id || query;

@@ -111,6 +111,2 @@ this.getById(id, function(error, record) {

Connection.prototype.getAll = function(callback) {
if (!_.isFunction(callback)) {
throw new Error('Invalid arguments.');
}
var allRecords = [];

@@ -117,0 +113,0 @@ this.connection.createValueStream()

4

package.json
{
"name": "magpie",
"version": "0.0.2",
"version": "0.0.3",
"description": "Simple persistence for rapid prototyping. Powered by levelup.",

@@ -20,3 +20,3 @@ "main": "index.js",

"json",
"levelup",
"levelup",
"leveldb"

@@ -23,0 +23,0 @@ ],

@@ -20,11 +20,16 @@ /**

var bookWithId = {
var bookWithStringId = {
id: "978-1449410247"
};
bookWithId = _.merge(theOatmealBook, bookWithId);
bookWithStringId = _.merge(bookWithStringId, theOatmealBook);
var bookWithNumberId = {
id: 100
};
bookWithNumberId = _.merge(bookWithNumberId, theOatmealBook);
var updatedBook = {
isbn10: "1449410243"
};
updatedBook = _.merge(bookWithId, updatedBook);
updatedBook = _.merge(updatedBook, bookWithStringId);

@@ -57,2 +62,3 @@ /**

db.create(theOatmealBook, function(error, record) {
if (error) throw error;
record.should.have.property('id');

@@ -63,8 +69,17 @@ done();

it('should use an existing ID when one is provided', function(done) {
db.create(bookWithId, function(error, record) {
record.should.have.property('id', bookWithId.id);
it('should use an existing string ID when one is provided', function(done) {
db.create(bookWithStringId, function(error, record) {
if (error) throw error;
record.should.have.property('id', bookWithStringId.id);
done();
});
});
it('should use an existing number ID when one is provided', function(done) {
db.create(bookWithNumberId, function(error, record) {
if (error) throw error;
record.should.have.property('id', bookWithNumberId.id);
done();
});
});
});

@@ -79,4 +94,5 @@

it('should return a record when querying for an ID as a string', function(done) {
db.get(bookWithId.id, function(error, record) {
record.should.have.property('id', bookWithId.id);
db.get(bookWithStringId.id, function(error, record) {
if (error) throw error;
record.should.have.property('id', bookWithStringId.id);
done();

@@ -94,6 +110,14 @@ });

it('should return a record when querying for an ID as a number', function(done) {
db.get(bookWithNumberId.id, function(error, record) {
if (error) throw error;
record.should.have.property('id', bookWithNumberId.id);
done();
});
});
it('should return a record when querying for an ID on a query object', function(done) {
db.get({id: bookWithId.id}, function(error, record) {
db.get({id: bookWithStringId.id}, function(error, record) {
if (error) throw error;
record.should.have.property('id', bookWithId.id);
record.should.have.property('id', bookWithStringId.id);
done();

@@ -100,0 +124,0 @@ });

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