From 57a3e898715ef80d758a8db625f071809b60dfb2 Mon Sep 17 00:00:00 2001 From: getlarge Date: Tue, 9 Mar 2021 07:51:36 +0100 Subject: [PATCH] fix: update polyfills path --- src/Ed25519Keypair.js | 4 ++-- src/sanitize.js | 10 +++++----- src/stringify_as_query_param.js | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Ed25519Keypair.js b/src/Ed25519Keypair.js index e649901..0affec4 100644 --- a/src/Ed25519Keypair.js +++ b/src/Ed25519Keypair.js @@ -3,7 +3,7 @@ // Code is Apache-2.0 and docs are CC-BY-4.0 import base58 from 'bs58' -import nacl from 'tweetnacl' +import { sign } from 'tweetnacl' /** * @public @@ -14,7 +14,7 @@ import nacl from 'tweetnacl' * @property {string} privateKey */ export default function Ed25519Keypair(seed) { - const keyPair = seed ? nacl.sign.keyPair.fromSeed(seed) : nacl.sign.keyPair() + const keyPair = seed ? sign.keyPair.fromSeed(seed) : sign.keyPair() this.publicKey = base58.encode(Buffer.from(keyPair.publicKey)) // tweetnacl's generated secret key is the secret key + public key (resulting in a 64-byte buffer) this.privateKey = base58.encode(Buffer.from(keyPair.secretKey.slice(0, 32))) diff --git a/src/sanitize.js b/src/sanitize.js index 3400472..2d7029d 100644 --- a/src/sanitize.js +++ b/src/sanitize.js @@ -2,8 +2,8 @@ // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) // Code is Apache-2.0 and docs are CC-BY-4.0 -import coreIncludes from 'core-js/library/fn/array/includes' -import coreObjectEntries from 'core-js/library/fn/object/entries' +import 'core-js/features/array/includes'; +import 'core-js/features/object/entries'; /** @@ -14,8 +14,8 @@ import coreObjectEntries from 'core-js/library/fn/object/entries' */ function filterFromObject(obj, filter, { isInclusion = true } = {}) { if (filter && Array.isArray(filter)) { - return applyFilterOnObject(obj, isInclusion ? (val => coreIncludes(filter, val)) - : (val => !coreIncludes(filter, val))) + return applyFilterOnObject(obj, isInclusion ? (val => filter.includes(val)) + : (val => !filter.includes(val))) } else if (filter && typeof filter === 'function') { // Flip the filter fn's return if it's for inclusion return applyFilterOnObject(obj, isInclusion ? filter @@ -36,7 +36,7 @@ function applyFilterOnObject(obj, filterFn) { } const filteredObj = {} - coreObjectEntries(obj).forEach(([key, val]) => { + Object.entries(obj).forEach(([key, val]) => { if (filterFn(val, key)) { filteredObj[key] = val } diff --git a/src/stringify_as_query_param.js b/src/stringify_as_query_param.js index 8045fd6..d6afd09 100644 --- a/src/stringify_as_query_param.js +++ b/src/stringify_as_query_param.js @@ -2,7 +2,7 @@ // SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0) // Code is Apache-2.0 and docs are CC-BY-4.0 -import coreObjectEntries from 'core-js/library/fn/object/entries' +import 'core-js/features/object/entries' import decamelize from 'decamelize' import queryString from 'query-string' @@ -38,7 +38,7 @@ export default function stringifyAsQueryParam(obj, transform = decamelize) { return '' } - const transformedKeysObj = coreObjectEntries(obj).reduce((paramsObj, [key, value]) => { + const transformedKeysObj = Object.entries(obj).reduce((paramsObj, [key, value]) => { paramsObj[transform(key)] = value return paramsObj }, {})