I hereby claim:
- I am tjconcept on github.
- I am thomasjensen (https://keybase.io/thomasjensen) on keybase.
- I have a public key whose fingerprint is CC4C DE2E 97F2 EEA0 5C3A C2AE 60BE 7EA0 1EB0 4B01
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
If you wish to put the entire fee on your customer, remember that the customer must also pay the fee of collecting the fee itself.
r = 0.025 // (rate fee)
f = 0.25 // (flat fee)
O = 100 // original amount (the cost of some product)
Naive (wrong) approach:
Array.from({ length: 1000 }, (v, k) => k) | |
.filter(x => x%3 === 0 || x%5 === 0) | |
.reduce((t, x) => t + x, 0) |
'use strict'; | |
const http = require('http'); | |
const Promise = require('bluebird'); | |
const tell = require('http-tell'); | |
const infer = require('http-infer'); | |
const dispatch = require('http-dispatch'); | |
const a404 = { code: 404 }; |
export default function using(...args) { | |
const fn = args.at(-1) | |
if (typeof fn !== 'function') { | |
throw new Error('Missing expected function argument') | |
} | |
if (args.length < 2) { | |
throw new Error('At least two arguments must be passed') | |
} | |
return Promise.all(args.slice(0, -1)).then((v) => fn(...v)) | |
} |
class Rejection { | |
constructor(reason) { | |
this.reason = reason | |
} | |
} | |
export default function using(...args) { | |
const lastIdx = args.length - 1 | |
const fn = args[lastIdx] | |
if (typeof fn !== 'function') { |
export default function using(hash, fn) { | |
if (typeof fn !== 'function') { | |
throw new Error('Missing expected function argument') | |
} | |
return Promise.all(Object.values(hash)).then((values) => | |
fn( | |
Object.fromEntries( | |
Object.keys(hash).map((key, idx) => [key, values[idx]]) | |
) | |
) |