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

level-packager

Package Overview
Dependencies
Maintainers
3
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

level-packager - npm Package Compare versions

Comparing version 5.0.3 to 5.1.0

12

CHANGELOG.md
# Changelog
## [5.1.0] - 2019-10-13
### Added
- Support constructing without location ([#95](https://github.com/Level/packager/issues/95)) ([**@vweevers**](https://github.com/vweevers))
### Fixed
- Bump `levelup` and `encoding-down` to prevent dedupe ([`cd22e66`](https://github.com/Level/packager/commit/cd22e66)) ([**@vweevers**](https://github.com/vweevers))
## [5.0.3] - 2019-09-08

@@ -364,2 +374,4 @@

[5.1.0]: https://github.com/Level/packager/compare/v5.0.3...v5.1.0
[5.0.3]: https://github.com/Level/packager/compare/v5.0.2...v5.0.3

@@ -366,0 +378,0 @@

6

CONTRIBUTORS.md

@@ -6,7 +6,7 @@ # Contributors

| **Lars-Magnus Skog** | [**@ralphtheninja**](https://github.com/ralphtheninja) | [**@ralph@social.weho.st**](https://social.weho.st/@ralph) |
| **Vincent Weevers** | [**@vweevers**](https://github.com/vweevers) | [**@vweevers@twitter**](https://twitter.com/vweevers) |
| **Julian Gruber** | [**@juliangruber**](https://github.com/juliangruber) | [**@juliangruber@twitter**](https://twitter.com/juliangruber) |
| **Vincent Weevers** | [**@vweevers**](https://github.com/vweevers) | [**@vweevers@twitter**](https://twitter.com/vweevers) |
| **Rod Vagg** | [**@rvagg**](https://github.com/rvagg) | [**@rvagg@twitter**](https://twitter.com/rvagg) |
| **Andrew Kelley** | [**@andrewrk**](https://github.com/andrewrk) | |
| **Deian Stefan** | [**@deian**](https://github.com/deian) | |
| **Matteo Collina** | [**@mcollina**](https://github.com/mcollina) | [**@matteocollina@twitter**](https://twitter.com/matteocollina) |
| **Deian Stefan** | [**@deian**](https://github.com/deian) | |
| **Andrew Kelley** | [**@andrewrk**](https://github.com/andrewrk) | |

@@ -6,7 +6,10 @@ var levelup = require('levelup')

function Level (location, options, callback) {
if (typeof options === 'function') {
if (typeof location === 'function') {
callback = location
} else if (typeof options === 'function') {
callback = options
}
if (typeof options !== 'object' || options === null) {
options = {}
if (!isObject(options)) {
options = isObject(location) ? location : {}
}

@@ -17,2 +20,6 @@

function isObject (o) {
return typeof o === 'object' && o !== null
}
['destroy', 'repair'].forEach(function (m) {

@@ -19,0 +26,0 @@ if (typeof leveldown[m] === 'function') {

{
"name": "level-packager",
"version": "5.0.3",
"version": "5.1.0",
"description": "LevelUP package helper for distributing with a LevelDOWN-compatible back-end",

@@ -15,4 +15,4 @@ "license": "MIT",

"dependencies": {
"encoding-down": "^6.2.0",
"levelup": "^4.2.0"
"encoding-down": "^6.3.0",
"levelup": "^4.3.2"
},

@@ -19,0 +19,0 @@ "devDependencies": {

@@ -8,3 +8,3 @@ # level-packager

[![Node version](https://img.shields.io/node/v/level-packager.svg)](https://www.npmjs.com/package/level-packager)
[![Travis](https://img.shields.io/travis/Level/packager.svg?logo=travis&label=)](https://travis-ci.org/Level/packager)
[![Travis](https://img.shields.io/travis/com/Level/packager.svg?logo=travis&label=)](https://travis-ci.com/Level/packager)
[![Coverage Status](https://coveralls.io/repos/github/Level/packager/badge.svg)](https://coveralls.io/github/Level/packager)

@@ -11,0 +11,0 @@ [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

@@ -35,8 +35,36 @@ 'use strict'

test('Level constructor with default options', function (t) {
test('Level constructor', function (t) {
t.plan(3)
function Down () {
return {
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
// This is a side effect of encoding-down (mutating options)
keyEncoding: 'utf8',
valueEncoding: 'utf8'
})
}
}
}
var levelup = packager(Down)()
t.is(levelup.options.keyEncoding, 'utf8')
t.is(levelup.options.valueEncoding, 'utf8')
})
test('Level constructor with location', function (t) {
t.plan(4)
function Down (location) {
t.is(location, 'location', 'location is correct')
return {
open: function (opts, cb) {}
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'utf8',
valueEncoding: 'utf8'
})
}
}

@@ -50,2 +78,23 @@ }

test('Level constructor with callback', function (t) {
t.plan(3)
function Down () {
return {
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'utf8',
valueEncoding: 'utf8'
})
process.nextTick(cb)
}
}
}
packager(Down)(function (err, db) {
t.error(err)
t.ok(db, 'db set in callback')
})
})
test('Level constructor with location & callback', function (t) {
t.plan(4)

@@ -56,3 +105,8 @@ function Down (location) {

open: function (opts, cb) {
t.pass('open called')
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'utf8',
valueEncoding: 'utf8'
})
process.nextTick(cb)

@@ -68,8 +122,15 @@ }

test('Level constructor with custom options', function (t) {
t.plan(3)
test('Level constructor with location & options', function (t) {
t.plan(4)
var Down = function (location) {
t.is(location, 'location', 'location is correct')
return {
open: function (opts, cb) {}
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'binary',
valueEncoding: 'binary'
})
}
}

@@ -84,1 +145,49 @@ }

})
test('Level constructor with options', function (t) {
t.plan(3)
var Down = function () {
return {
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'binary',
valueEncoding: 'binary'
})
}
}
}
var levelup = packager(Down)({
keyEncoding: 'binary',
valueEncoding: 'binary'
})
t.is(levelup.options.keyEncoding, 'binary')
t.is(levelup.options.valueEncoding, 'binary')
})
test('Level constructor with options & callback', function (t) {
t.plan(5)
var Down = function () {
return {
open: function (opts, cb) {
t.same(opts, {
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'binary',
valueEncoding: 'binary'
})
process.nextTick(cb)
}
}
}
var levelup = packager(Down)({
keyEncoding: 'binary',
valueEncoding: 'binary'
}, function (err, db) {
t.error(err)
t.ok(db, 'db set in callback')
})
t.is(levelup.options.keyEncoding, 'binary')
t.is(levelup.options.valueEncoding, 'binary')
})
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