abstract-leveldown
Advanced tools
Comparing version 0.0.0 to 0.0.1
/* Copyright (c) 2013 Rod Vagg, MIT License */ | ||
function checkKeyValue(obj, type) { | ||
if (obj === null || obj === undefined) | ||
return new Error(type + ' cannot be `null` or `undefined`') | ||
if (obj === null || obj === undefined) | ||
return new Error(type + ' cannot be `null` or `undefined`') | ||
if (Buffer.isBuffer(obj)) { | ||
if (obj.length === 0) | ||
return new Error(type + ' cannot be an empty Buffer') | ||
} else if (String(obj) === '') | ||
return new Error(type + ' cannot be an empty String') | ||
} | ||
function AbstractIterator (db) { | ||
@@ -86,2 +98,4 @@ this.db = db | ||
throw new Error('get() requires a callback argument') | ||
var err = checkKeyValue(key, 'key') | ||
if (err) return callback(err) | ||
if (typeof options != 'object') | ||
@@ -101,2 +115,6 @@ options = {} | ||
throw new Error('put() requires a callback argument') | ||
var err = checkKeyValue(value, 'value') | ||
if (err) return callback(err) | ||
err = checkKeyValue(key, 'key') | ||
if (err) return callback(err) | ||
if (typeof options != 'object') | ||
@@ -116,2 +134,4 @@ options = {} | ||
throw new Error('del() requires a callback argument') | ||
var err = checkKeyValue(key, 'key') | ||
if (err) return callback(err) | ||
if (typeof options != 'object') | ||
@@ -118,0 +138,0 @@ options = {} |
{ | ||
"name" : "abstract-leveldown" | ||
, "description" : "An abstract prototype matching the LevelDOWN API" | ||
, "version" : "0.0.0" | ||
, "version" : "0.0.1" | ||
, "homepage" : "https://github.com/rvagg/node-abstract-leveldown" | ||
@@ -19,4 +19,5 @@ , "authors" : [ | ||
"tap" : "*" | ||
, "leveldown" : "~0.2.0" | ||
, "leveldown" : "git+https://github.com/rvagg/node-leveldown.git#0.2-wip" | ||
, "sinon" : "*" | ||
, "rimraf" : "*" | ||
} | ||
@@ -23,0 +24,0 @@ , "scripts": { |
@@ -26,2 +26,9 @@ var tap = require('tap') | ||
require('leveldown/test/put-get-del-test').setUp(factory) | ||
require('leveldown/test/put-get-del-test').errorKeys() | ||
//require('leveldown/test/put-get-del-test').nonErrorKeys() | ||
require('leveldown/test/put-get-del-test').errorValues() | ||
//require('leveldown/test/put-get-del-test').nonErrorKeys() | ||
require('leveldown/test/put-get-del-test').tearDown() | ||
require('leveldown/test/approximate-size-test').setUp(factory) | ||
@@ -28,0 +35,0 @@ require('leveldown/test/approximate-size-test').args(factory) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27804
437
4