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

Fix eslint errors

This commit is contained in:
vrde 2017-07-05 17:13:05 +02:00 committed by Tim Daubenschütz
parent d0f4342f6f
commit 2fd3fcf8ce
4 changed files with 13 additions and 17 deletions

View File

@ -30,12 +30,8 @@ export default function request(url, config = {}, onlyJsonResponse = true) {
}
return baseRequest(apiUrl, requestConfig)
.then((res) => onlyJsonResponse ? res.json() : // eslint-disable-line no-confusing-arrow
{
json: res.json(),
url: res.url
})
.catch((err) => {
.then(res => (onlyJsonResponse ? res.json() : { json: res.json(), url: res.url }))
.catch(err => {
console.error(err)
throw err
})

View File

@ -10,11 +10,11 @@ import coreObjectEntries from 'core-js/library/fn/object/entries'
function filterFromObject(obj, filter, { isInclusion = true } = {}) {
if (filter && Array.isArray(filter)) {
return applyFilterOnObject(obj, isInclusion ? ((_, key) => coreIncludes(filter, key))
: ((_, key) => !coreIncludes(filter, key)))
: ((_, key) => !coreIncludes(filter, key)))
} else if (filter && typeof filter === 'function') {
// Flip the filter fn's return if it's for inclusion
return applyFilterOnObject(obj, isInclusion ? filter
: (...args) => !filter(...args))
: (...args) => !filter(...args))
} else {
throw new Error('The given filter is not an array or function. Exclude aborted')
}

View File

@ -25,11 +25,11 @@ import makeTransaction from './makeTransaction'
// TODO:
// - Make `metadata` optional argument
export default function makeTransferTransaction(
unspentTransaction,
metadata,
outputs,
...outputIndices
) {
unspentTransaction,
metadata,
outputs,
...outputIndices
) {
const inputs = outputIndices.map((outputIndex) => {
const fulfilledOutput = unspentTransaction.outputs[outputIndex]
const transactionLink = {
@ -42,7 +42,7 @@ export default function makeTransferTransaction(
const assetLink = {
'id': unspentTransaction.operation === 'CREATE' ? unspentTransaction.id
: unspentTransaction.asset.id
: unspentTransaction.asset.id
}
return makeTransaction('TRANSFER', assetLink, metadata, outputs, inputs)

View File

@ -20,7 +20,7 @@ test('Threshold condition encoding', t => {
const publicKey = '4zvwRjXUKGfvwnParsHAS3HuSVzV5cA4McphgmoCtajS'
const ed25519 = Transaction.makeEd25519Condition(publicKey, false)
const condition = Transaction.makeThresholdCondition(
1, [ed25519, ed25519])
1, [ed25519, ed25519])
const output = Transaction.makeOutput(condition)
const target = {
condition: {
@ -64,8 +64,8 @@ test('Fulfillment correctly formed', t => {
const msg = Transaction.serializeTransactionIntoCanonicalString(txTransfer)
const txSigned = Transaction.signTransaction(txTransfer, alice.privateKey)
t.truthy(cc.validateFulfillment(txSigned.inputs[0].fulfillment,
txCreate.outputs[0].condition.uri,
new Buffer(msg)))
txCreate.outputs[0].condition.uri,
new Buffer(msg)))
})