- hyperclick
- nuclide-diagnostics-store
- nuclide-diagnostics-ui
- nuclide-flow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to check array access | |
const arr = []; | |
const proxiedArr = new Proxy(arr, { | |
set(target, name, value) { | |
console.log(target, name, value); | |
// console.trace(); | |
target[name] = value; | |
return value; | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// no string get | |
const get = (fn, def) => { | |
try { | |
return fn(); | |
} catch (e) { | |
return def; | |
} | |
}; | |
// usage example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// promise | |
const sleep = (timeout, v) => new Promise(r => setTimeout(() => r(v), timeout)); | |
// series to call | |
const series = [() => sleep(1000, 1), () => sleep(1000, 2), () => sleep(1000, 3)]; | |
// serialize | |
const r = series | |
.reduce( | |
(m, p) => m.then(v => Promise.all([...v, p()])), | |
Promise.resolve([]) |
Similar js toExponential
method, but returns result in power format, instead of Xe-1
it returns X⋅10⁻¹
Usage example:
console.log(toPower(3, 111)); // out 1.110⋅10²
console.log(toPower(3, 0.00000000000000123)); //out 1.230⋅10⁻¹⁵
If you use sass
and css-modules
and want to restyle some base component without changing its code.
(base component already use css-modules and exposes styles
property)
I know two way how to do it.
- Using composes css-modules operator. Just extend classes you need, then in javascript code combine both styles as {...baseStyle, ...myStyleSimple}
NewerOlder