1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-22 01:36:56 +01:00

fix: update polyfills path

This commit is contained in:
getlarge 2021-03-09 07:51:36 +01:00
parent e76c6227f8
commit 57a3e89871
No known key found for this signature in database
GPG Key ID: E4E13243600F9566
3 changed files with 9 additions and 9 deletions

View File

@ -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)))

View File

@ -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
}

View File

@ -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
}, {})