Working with React next at 16.0.0-rc.2 using the development/non-production path, the commonjs module 'object-assign' does not result in a usable function.
- Mac OS X 10.12.6 using node 8.4 and 8.5
$ npm install && npm run build
function promiseQueue(nextPromise=() => Promise.resolve()) { | |
let tip = null | |
return function () { | |
if (null === tip) { | |
tip = nextPromise() | |
tip.then(clear_tip) } | |
return tip | |
} | |
function clear_tip() { tip = null } | |
} |
#!/bin/bash | |
FAIL=0 | |
for job_pid in `jobs -p`; do | |
echo "Joining job $job_pid" | |
wait $job_pid || let "FAIL+=1" | |
done | |
if [[ "$FAIL" != "0" ]]; then | |
echo Failed join processes $FAIL | |
exit 1 | |
fi |
function show_memory(interval=1000) { | |
setTimeout(show_memory, interval).unref() | |
let out = [] | |
const mem = process.memoryUsage() | |
out.push('MEM') | |
for (const [k,v] of Object.entries(mem)) { | |
out.push(`${k}: ${(v / 1.0e6).toFixed(1)} MB`) | |
} |
const base64_encode_std = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' | |
const base64_encode_url = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_' | |
const base64_decode = [{}, {}, {}, {}] | |
{ | |
const add = (k, i) => { | |
base64_decode[0][k] = i << 0 | |
base64_decode[1][k] = i << 6 | |
base64_decode[2][k] = i << 12 | |
base64_decode[3][k] = i << 18 | |
} |
const _fromCharCode = String.fromCharCode | |
export function pack_base64(arr) { | |
let res='' | |
const u8 = new Uint8Array(arr.buffer || arr) | |
const len = u8.byteLength | |
for (let i=0; i<len; i++) | |
res += _fromCharCode(u8[i]) | |
return window.btoa(res) | |
} |
// to depth-first inspect all attributes of an object | |
inspect(obj) | |
// or, to see all attributes on the entire prototype chain | |
inspect.chain(obj) |
Using rollup 0.57.1 with "lodash-es" package does not treeshake properly.
const _fromCharCode = String.fromCharCode | |
export function pack_base64(arr) { | |
let res='' | |
const u8 = new Uint8Array(arr.buffer || arr) | |
const len = u8.byteLength | |
for (let i=0; i<len; i++) | |
res += _fromCharCode(u8[i]) | |
return window.btoa(res) | |
} |
export default asWorkerFunction | |
export asWorkerFunction | |
export asBlobURLFunction | |
function asWorkerFunction(func) { | |
return new Worker(asBlobURLFunction(func)) | |
} | |
function asBlobURLFunction(func) { | |
const rx_src = /(^.*=>|{)\s*([^]*?)(}\s*)?$/ |