mirror of
https://github.com/bigchaindb/js-bigchaindb-driver.git
synced 2024-11-22 09:46:58 +01:00
fix: update polyfills path
This commit is contained in:
parent
e76c6227f8
commit
57a3e89871
@ -3,7 +3,7 @@
|
|||||||
// Code is Apache-2.0 and docs are CC-BY-4.0
|
// Code is Apache-2.0 and docs are CC-BY-4.0
|
||||||
|
|
||||||
import base58 from 'bs58'
|
import base58 from 'bs58'
|
||||||
import nacl from 'tweetnacl'
|
import { sign } from 'tweetnacl'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -14,7 +14,7 @@ import nacl from 'tweetnacl'
|
|||||||
* @property {string} privateKey
|
* @property {string} privateKey
|
||||||
*/
|
*/
|
||||||
export default function Ed25519Keypair(seed) {
|
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))
|
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)
|
// 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)))
|
this.privateKey = base58.encode(Buffer.from(keyPair.secretKey.slice(0, 32)))
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||||
// Code is Apache-2.0 and docs are 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 'core-js/features/array/includes';
|
||||||
import coreObjectEntries from 'core-js/library/fn/object/entries'
|
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 } = {}) {
|
function filterFromObject(obj, filter, { isInclusion = true } = {}) {
|
||||||
if (filter && Array.isArray(filter)) {
|
if (filter && Array.isArray(filter)) {
|
||||||
return applyFilterOnObject(obj, isInclusion ? (val => coreIncludes(filter, val))
|
return applyFilterOnObject(obj, isInclusion ? (val => filter.includes(val))
|
||||||
: (val => !coreIncludes(filter, val)))
|
: (val => !filter.includes(val)))
|
||||||
} else if (filter && typeof filter === 'function') {
|
} else if (filter && typeof filter === 'function') {
|
||||||
// Flip the filter fn's return if it's for inclusion
|
// Flip the filter fn's return if it's for inclusion
|
||||||
return applyFilterOnObject(obj, isInclusion ? filter
|
return applyFilterOnObject(obj, isInclusion ? filter
|
||||||
@ -36,7 +36,7 @@ function applyFilterOnObject(obj, filterFn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const filteredObj = {}
|
const filteredObj = {}
|
||||||
coreObjectEntries(obj).forEach(([key, val]) => {
|
Object.entries(obj).forEach(([key, val]) => {
|
||||||
if (filterFn(val, key)) {
|
if (filterFn(val, key)) {
|
||||||
filteredObj[key] = val
|
filteredObj[key] = val
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
||||||
// Code is Apache-2.0 and docs are 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 decamelize from 'decamelize'
|
||||||
import queryString from 'query-string'
|
import queryString from 'query-string'
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ export default function stringifyAsQueryParam(obj, transform = decamelize) {
|
|||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
const transformedKeysObj = coreObjectEntries(obj).reduce((paramsObj, [key, value]) => {
|
const transformedKeysObj = Object.entries(obj).reduce((paramsObj, [key, value]) => {
|
||||||
paramsObj[transform(key)] = value
|
paramsObj[transform(key)] = value
|
||||||
return paramsObj
|
return paramsObj
|
||||||
}, {})
|
}, {})
|
||||||
|
Loading…
Reference in New Issue
Block a user