diff --git a/.airtap.yml b/.airtap.yml new file mode 100644 index 0000000..225fb41 --- /dev/null +++ b/.airtap.yml @@ -0,0 +1,7 @@ +providers: + - airtap-playwright + +browsers: + - name: chromium + - name: firefox + - name: webkit diff --git a/.travis.yml b/.travis.yml index acaad06..71bbf0c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ language: node_js node_js: - - 6 - - 8 - 10 - 12 + - 14 after_success: npm run coverage diff --git a/index.js b/index.js index 1f7dd9d..6915d7c 100644 --- a/index.js +++ b/index.js @@ -1,13 +1,9 @@ '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 bufferKeys: manifest.bufferKeys || false, snapshots: manifest.snapshots || false, @@ -30,6 +26,6 @@ module.exports = function supports () { encodings: manifest.encodings || false, // Methods that are not part of abstract-leveldown or levelup - additionalMethods: xtend(manifest.additionalMethods) + additionalMethods: Object.assign({}, manifest.additionalMethods) }) } diff --git a/package.json b/package.json index fecb126..db9c2e9 100644 --- a/package.json +++ b/package.json @@ -5,11 +5,9 @@ "license": "MIT", "scripts": { "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" }, "files": [ "test", @@ -17,18 +15,16 @@ "CONTRIBUTORS.md", "index.js" ], - "dependencies": { - "xtend": "^4.0.2" - }, + "dependencies": {}, "devDependencies": { - "airtap": "^3.0.0", + "airtap": "^4.0.3", + "airtap-playwright": "^1.0.1", "coveralls": "^3.0.6", - "dependency-check": "^4.1.0", "faucet": "^0.0.1", "hallmark": "^3.1.0", "level-community": "^3.0.0", "nyc": "^14.1.1", - "standard": "^14.3.1", + "standard": "^16.0.3", "tape": "^5.0.1" }, "hallmark": { @@ -48,6 +44,6 @@ "manifest" ], "engines": { - "node": ">=6" + "node": ">=10" } } diff --git a/test/cloneable.js b/test/cloneable.js index 2712416..2a64b18 100644 --- a/test/cloneable.js +++ b/test/cloneable.js @@ -1,13 +1,13 @@ 'use strict' -var supports = require('..') +const supports = require('..') // Every object in a manifest must have a unique identity, to avoid accidental // mutation. In supports() we only shallowly clone the manifest object itself // and additionalMethods. If in the future we add more objects to manifests, // this test will break and we'll know to start performing a deep clone. module.exports = function cloneable (t, manifest) { - var copy = supports(manifest) + const copy = supports(manifest) verifyUnique(t, 'manifest', manifest, copy) } diff --git a/test/index.js b/test/index.js index aba38bd..0208416 100644 --- a/test/index.js +++ b/test/index.js @@ -1,19 +1,18 @@ '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 shape(t, manifest) cloneable(t, manifest) - var before = xtend(manifest, { - additionalMethods: xtend(manifest.additionalMethods) + const before = Object.assign({}, manifest, { + additionalMethods: Object.assign({}, manifest.additionalMethods) }) db.open(function (err) { diff --git a/test/self.js b/test/self.js index 3c7d75b..5b3678b 100644 --- a/test/self.js +++ b/test/self.js @@ -1,9 +1,9 @@ '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') test('no options', function (t) { shape(t, supports()) @@ -13,7 +13,7 @@ test('no options', function (t) { test('falsy options', function (t) { ;[null, false, undefined, 0, ''].forEach(function (value) { - var manifest = supports({ + const manifest = supports({ bufferKeys: value, additionalMethods: { foo: value @@ -29,7 +29,7 @@ test('falsy options', function (t) { test('truthy options', function (t) { ;[true, {}, 'yes', 1, []].forEach(function (value) { - var manifest = supports({ + const manifest = supports({ streams: value, additionalMethods: { foo: value @@ -45,9 +45,9 @@ test('truthy options', function (t) { }) 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) manifest.foobar = true manifest.additionalMethods.baz = true @@ -61,15 +61,15 @@ test('merges input objects without mutating them', function (t) { }) test('inherits additionalMethods', function (t) { - var manifest = supports({ additionalMethods: { foo: true } }, {}) + const manifest = supports({ additionalMethods: { foo: true } }, {}) t.same(manifest.additionalMethods, { foo: true }) 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() }) diff --git a/test/shape.js b/test/shape.js index dc96b54..82198ec 100644 --- a/test/shape.js +++ b/test/shape.js @@ -1,12 +1,12 @@ 'use strict' -var hasOwnProperty = Object.prototype.hasOwnProperty +const hasOwnProperty = Object.prototype.hasOwnProperty module.exports = function shape (t, manifest) { t.ok(isObject(manifest), 'manifest is object') t.ok(isObject(manifest.additionalMethods), 'additionalMethods is object') - for (var k in manifest) { + for (const k in manifest) { if (!hasOwnProperty.call(manifest, k)) continue if (manifest[k]) {