level-supports
Advanced tools
Comparing version 1.0.1 to 2.0.0
# Changelog | ||
## [2.0.0] - 2021-04-09 | ||
### Changed | ||
- **Breaking:** modernize syntax and bump standard ([`5d7cc6d`](https://github.com/Level/supports/commit/5d7cc6d)) ([Level/community#98](https://github.com/Level/community/issues/98)) (Vincent Weevers). Drops support of node 6, node 8 and old browsers. | ||
## [1.0.1] - 2019-10-13 | ||
@@ -17,2 +23,4 @@ | ||
[2.0.0]: https://github.com/Level/supports/compare/v1.0.1...v2.0.0 | ||
[1.0.1]: https://github.com/Level/supports/compare/v1.0.0...v1.0.1 |
12
index.js
'use strict' | ||
// For (old) browser support | ||
var xtend = require('xtend') | ||
var assign = require('xtend/mutable') | ||
module.exports = function supports (...manifests) { | ||
const manifest = manifests.reduce((acc, m) => Object.assign(acc, m), {}) | ||
module.exports = function supports () { | ||
var manifest = xtend.apply(null, arguments) | ||
return assign(manifest, { | ||
return Object.assign(manifest, { | ||
// Features of abstract-leveldown | ||
@@ -33,4 +29,4 @@ bufferKeys: manifest.bufferKeys || false, | ||
// Methods that are not part of abstract-leveldown or levelup | ||
additionalMethods: xtend(manifest.additionalMethods) | ||
additionalMethods: Object.assign({}, manifest.additionalMethods) | ||
}) | ||
} |
{ | ||
"name": "level-supports", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "Create a manifest describing the abilities of a levelup or abstract-leveldown db", | ||
@@ -8,7 +8,5 @@ "license": "MIT", | ||
"test": "standard && hallmark && (nyc -s node test/self.js | faucet) && nyc report", | ||
"test-browser-local": "airtap --coverage --local test/self.js", | ||
"test-browsers-local": "airtap --coverage test/self.js", | ||
"coverage": "nyc report --reporter=text-lcov | coveralls", | ||
"hallmark": "hallmark --fix", | ||
"dependency-check": "dependency-check --no-dev . test/*.js", | ||
"prepublishOnly": "npm run dependency-check" | ||
"hallmark": "hallmark --fix" | ||
}, | ||
@@ -21,15 +19,13 @@ "files": [ | ||
], | ||
"dependencies": { | ||
"xtend": "^4.0.2" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"airtap": "^2.0.4", | ||
"airtap": "^4.0.3", | ||
"airtap-playwright": "^1.0.1", | ||
"coveralls": "^3.0.6", | ||
"dependency-check": "^4.1.0", | ||
"faucet": "^0.0.1", | ||
"hallmark": "^2.0.0", | ||
"hallmark": "^3.1.0", | ||
"level-community": "^3.0.0", | ||
"nyc": "^14.1.1", | ||
"standard": "^14.3.1", | ||
"tape": "^4.11.0" | ||
"standard": "^16.0.3", | ||
"tape": "^5.0.1" | ||
}, | ||
@@ -53,4 +49,4 @@ "hallmark": { | ||
"engines": { | ||
"node": ">=6" | ||
"node": ">=10" | ||
} | ||
} |
'use strict' | ||
var supports = require('..') | ||
const supports = require('..') | ||
@@ -10,3 +10,3 @@ // Every object in a manifest must have a unique identity, to avoid accidental | ||
module.exports = function cloneable (t, manifest) { | ||
var copy = supports(manifest) | ||
const copy = supports(manifest) | ||
verifyUnique(t, 'manifest', manifest, copy) | ||
@@ -13,0 +13,0 @@ } |
'use strict' | ||
var xtend = require('xtend') | ||
var shape = require('./shape') | ||
var cloneable = require('./cloneable') | ||
const shape = require('./shape') | ||
const cloneable = require('./cloneable') | ||
module.exports = function suite (test, testCommon) { | ||
test('db has manifest', function (t) { | ||
var db = testCommon.factory() | ||
var manifest = db.supports | ||
const db = testCommon.factory() | ||
const manifest = db.supports | ||
@@ -15,4 +14,4 @@ shape(t, manifest) | ||
var before = xtend(manifest, { | ||
additionalMethods: xtend(manifest.additionalMethods) | ||
const before = Object.assign({}, manifest, { | ||
additionalMethods: Object.assign({}, manifest.additionalMethods) | ||
}) | ||
@@ -19,0 +18,0 @@ |
'use strict' | ||
var test = require('tape') | ||
var supports = require('..') | ||
var shape = require('./shape') | ||
var cloneable = require('./cloneable') | ||
const test = require('tape') | ||
const supports = require('..') | ||
const shape = require('./shape') | ||
const cloneable = require('./cloneable') | ||
@@ -16,3 +16,3 @@ test('no options', function (t) { | ||
;[null, false, undefined, 0, ''].forEach(function (value) { | ||
var manifest = supports({ | ||
const manifest = supports({ | ||
bufferKeys: value, | ||
@@ -33,3 +33,3 @@ additionalMethods: { | ||
;[true, {}, 'yes', 1, []].forEach(function (value) { | ||
var manifest = supports({ | ||
const manifest = supports({ | ||
streams: value, | ||
@@ -50,5 +50,5 @@ additionalMethods: { | ||
test('merges input objects without mutating them', function (t) { | ||
var input1 = { bufferKeys: null, streams: false } | ||
var input2 = { streams: true, additionalMethods: {} } | ||
var manifest = supports(input1, input2) | ||
const input1 = { bufferKeys: null, streams: false } | ||
const input2 = { streams: true, additionalMethods: {} } | ||
const manifest = supports(input1, input2) | ||
@@ -67,3 +67,3 @@ manifest.foobar = true | ||
test('inherits additionalMethods', function (t) { | ||
var manifest = supports({ additionalMethods: { foo: true } }, {}) | ||
const manifest = supports({ additionalMethods: { foo: true } }, {}) | ||
t.same(manifest.additionalMethods, { foo: true }) | ||
@@ -74,7 +74,7 @@ t.end() | ||
test('does not merge additionalMethods', function (t) { | ||
var input1 = { additionalMethods: { foo: true } } | ||
var input2 = { additionalMethods: { bar: true } } | ||
var manifest = supports(input1, input2) | ||
const input1 = { additionalMethods: { foo: true } } | ||
const input2 = { additionalMethods: { bar: true } } | ||
const manifest = supports(input1, input2) | ||
t.same(manifest.additionalMethods, { bar: true }) | ||
t.end() | ||
}) |
'use strict' | ||
var hasOwnProperty = Object.prototype.hasOwnProperty | ||
const hasOwnProperty = Object.prototype.hasOwnProperty | ||
@@ -9,3 +9,3 @@ module.exports = function shape (t, manifest) { | ||
for (var k in manifest) { | ||
for (const k in manifest) { | ||
if (!hasOwnProperty.call(manifest, k)) continue | ||
@@ -12,0 +12,0 @@ |
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
15427
0
148
- Removedxtend@^4.0.2
- Removedxtend@4.0.2(transitive)