Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abstract-leveldown

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abstract-leveldown - npm Package Compare versions

Comparing version 0.7.4 to 0.8.0

10

abstract/batch-test.js
var db
function isTypedArray (value) {
return value instanceof ArrayBuffer || value instanceof Uint8Array
}
module.exports.setUp = function (leveldown, test, testCommon) {

@@ -68,3 +72,3 @@ test('setUp common', testCommon.setUp)

var result
if (value instanceof ArrayBuffer) {
if (isTypedArray(value)) {
result = String.fromCharCode.apply(null, new Uint16Array(value))

@@ -99,3 +103,3 @@ } else {

var result
if (value instanceof ArrayBuffer) {
if (isTypedArray(value)) {
result = String.fromCharCode.apply(null, new Uint16Array(value))

@@ -120,3 +124,3 @@ } else {

var result
if (value instanceof ArrayBuffer) {
if (isTypedArray(value)) {
result = String.fromCharCode.apply(null, new Uint16Array(value))

@@ -123,0 +127,0 @@ } else {

var db
function isTypedArray (value) {
return value instanceof ArrayBuffer || value instanceof Uint8Array
}
module.exports.setUp = function (leveldown, test, testCommon) {

@@ -49,3 +53,3 @@ test('setUp common', testCommon.setUp)

var result
if (value instanceof ArrayBuffer) {
if (isTypedArray(value)) {
result = String.fromCharCode.apply(null, new Uint16Array(value))

@@ -64,3 +68,3 @@ } else {

var result
if (value instanceof ArrayBuffer) {
if (isTypedArray(value)) {
result = String.fromCharCode.apply(null, new Uint16Array(value))

@@ -67,0 +71,0 @@ } else {

/**** SETUP & UTILITY STUFF ****/
function isTypedArray (value) {
return value instanceof ArrayBuffer || value instanceof Uint8Array
}
var db

@@ -45,3 +49,3 @@ , testBuffer

var result, valueString
if (_value instanceof ArrayBuffer) {
if (isTypedArray(_value)) {
result = String.fromCharCode.apply(null, new Uint16Array(_value))

@@ -53,3 +57,3 @@ } else {

if (value instanceof ArrayBuffer) {
if (isTypedArray(value)) {
value = String.fromCharCode.apply(null, new Uint16Array(value))

@@ -91,3 +95,5 @@ } else {

module.exports.errorKeys = function (testFunc) {
module.exports.errorKeys = function (testFunc, BufferType) {
if (!BufferType)
BufferType = process.browser ? ArrayBuffer : Buffer
test = testFunc

@@ -97,4 +103,3 @@ makeErrorKeyTest('null key', null, /key cannot be `null` or `undefined`/)

makeErrorKeyTest('empty String key', '', /key cannot be an empty String/)
if (process.browser) makeErrorKeyTest('empty ArrayBuffer key', new ArrayBuffer(0), /key cannot be an empty ArrayBuffer/)
else makeErrorKeyTest('empty Buffer key', new Buffer(0), /key cannot be an empty Buffer/)
makeErrorKeyTest('empty Buffer key', new BufferType(0), /key cannot be an empty Buffer/)
makeErrorKeyTest('empty Array key', [], /key cannot be an empty String/)

@@ -105,4 +110,5 @@ }

module.exports.nonErrorKeys = function () {
module.exports.nonErrorKeys = function (testFunc) {
// valid falsey keys
test = testFunc
makePutGetDelSuccessfulTest('`false` key', false, 'foo false')

@@ -130,13 +136,16 @@ makePutGetDelSuccessfulTest('`0` key', 0, 'foo 0')

module.exports.errorValues = function () {
module.exports.errorValues = function (testFunc, BufferType) {
if (!BufferType)
BufferType = process.browser ? ArrayBuffer : Buffer
test = testFunc
makePutErrorTest('null value', 'foo', null, /value cannot be `null` or `undefined`/)
makePutErrorTest('undefined value', 'foo', undefined, /value cannot be `null` or `undefined`/)
makePutErrorTest('empty String value', 'foo', '', /value cannot be an empty String/)
if (process.browser) makePutErrorTest('empty ArrayBuffer value', 'foo', new ArrayBuffer(0), /value cannot be an empty ArrayBuffer/)
else makePutErrorTest('empty Buffer value', 'foo', new Buffer(0), /value cannot be an empty Buffer/)
makePutErrorTest('empty Buffer value', 'foo', new BufferType(0), /value cannot be an empty Buffer/)
makePutErrorTest('empty Array value', 'foo', [], /value cannot be an empty String/)
}
module.exports.nonErrorKeys = function () {
module.exports.nonErrorKeys = function (testFunc) {
// valid falsey values
test = testFunc
makePutGetDelSuccessfulTest('`false` value', 'foo false', false)

@@ -168,11 +177,11 @@ makePutGetDelSuccessfulTest('`0` value', 'foo 0', 0)

module.exports.all = function (leveldown, testFunc, testCommon, buffer) {
module.exports.all = function (leveldown, testFunc, testCommon, buffer, BufferType) {
testBuffer = buffer
test = testFunc
module.exports.setUp(leveldown, test, testCommon)
module.exports.errorKeys(test)
module.exports.nonErrorKeys()
module.exports.errorValues()
module.exports.nonErrorKeys()
module.exports.errorKeys(test, BufferType)
module.exports.nonErrorKeys(test)
module.exports.errorValues(test, BufferType)
module.exports.nonErrorKeys(test)
module.exports.tearDown(test, testCommon)
}
var db
function isTypedArray (value) {
return value instanceof ArrayBuffer || value instanceof Uint8Array
}
module.exports.setUp = function (leveldown, test, testCommon) {

@@ -56,3 +60,3 @@ test('setUp common', testCommon.setUp)

var result = value.toString()
if (value instanceof ArrayBuffer)
if (isTypedArray(value))
result = String.fromCharCode.apply(null, new Uint16Array(value))

@@ -59,0 +63,0 @@ t.equal(result, 'bar')

{
"name" : "abstract-leveldown"
, "description" : "An abstract prototype matching the LevelDOWN API"
, "version" : "0.7.4"
, "version" : "0.8.0"
, "homepage" : "https://github.com/rvagg/node-abstract-leveldown"

@@ -6,0 +6,0 @@ , "contributors" : [

@@ -28,5 +28,5 @@ const tap = require('tap')

require('./abstract/put-get-del-test').setUp(factory, tap.test, testCommon)
require('./abstract/put-get-del-test').errorKeys(tap.test, testCommon)
require('./abstract/put-get-del-test').errorKeys(tap.test)
//require('./abstract/put-get-del-test').nonErrorKeys(tap.test, testCommon)
require('./abstract/put-get-del-test').errorValues(tap.test, testCommon)
require('./abstract/put-get-del-test').errorValues(tap.test)
//require('./abstract/test/put-get-del-test').nonErrorKeys(tap.test, testCommon)

@@ -33,0 +33,0 @@ require('./abstract/put-get-del-test').tearDown(tap.test, testCommon)

const path = require('path')
, fs = process.title != 'browser' && require('fs')
, rimraf = process.title != 'browser' && require('rimraf')
, fs = !process.browser && require('fs')
, rimraf = !process.browser && require('rimraf')

@@ -16,23 +16,24 @@ var dbidx = 0

, cleanup = function (callback) {
if (process.title != 'browser') {
fs.readdir(__dirname, function (err, list) {
if (err) return callback(err)
if (process.browser)
return callback()
list = list.filter(function (f) {
return (/^_leveldown_test_db_/).test(f)
})
fs.readdir(__dirname, function (err, list) {
if (err) return callback(err)
if (!list.length)
return callback()
list = list.filter(function (f) {
return (/^_leveldown_test_db_/).test(f)
})
var ret = 0
if (!list.length)
return callback()
list.forEach(function (f) {
rimraf(path.join(__dirname, f), function (err) {
if (++ret == list.length)
callback()
})
var ret = 0
list.forEach(function (f) {
rimraf(path.join(__dirname, f), function (err) {
if (++ret == list.length)
callback()
})
})
}
})
}

@@ -39,0 +40,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