Usage:
test([
() => expr1,
() => expr2,
// ...
() => exprN
], <how many times execute>);| Document = {} | |
| function Document.new (raw) | |
| local doc = {} | |
| Document.attach_deep_proxy(raw, doc) | |
| return doc | |
| end | |
| function Document.attach_deep_proxy (raw, doc, path) |
| export default { | |
| install (less, mgr) { | |
| mgr.addPostProcessor({ | |
| process (input, meta) { | |
| return input.replace(/:global (.*?)\s*([{,])/g, ':global($1)$2'); | |
| } | |
| }); | |
| } | |
| } |
| const ffi = require('node-ffi'); | |
| const FFIStruct = require('ref-struct'); | |
| const arch = require('os').arch(); | |
| const INPUT_KEYBOARD = 0x1; | |
| const KEYEVENTF_KEYUP = 0x2; | |
| const KEYEVENTF_SCANCODE = 0x8; | |
| const InputStruct = FFIStruct({ | |
| type: 'int', | |
| '???': 'int', |
| module.exports = function Enum (keys) { | |
| let result = {}; | |
| keys.forEach((key, i) => { | |
| result[key] = i; | |
| result[i] = key; | |
| }); | |
| return result; | |
| } |
| // https://gist.github.com/gre/1650294 | |
| const easeOutCubic = t => (--t) * t * t + 1; | |
| function animate (obj, prop, from, to, duration, ease) { | |
| if (!obj) return; | |
| const delta = to - from; | |
| const start = Date.now(); | |
| const end = start + duration; | |
| const interval = setInterval(() => { | |
| const timeDelta = Date.now() - start; |
Usage:
test([
() => expr1,
() => expr2,
// ...
() => exprN
], <how many times execute>);| function assign (obj1, obj2) { | |
| if (!obj1) return obj2; | |
| if (!obj2) return obj1; | |
| let result = {}; | |
| for (let key in obj1) { | |
| if (key in obj2) { | |
| if (typeof obj2[key] == 'object') result[key] = assign(obj1[key], obj2[key]); | |
| else result[key] = obj2[key]; | |
| } else result[key] = obj1[key]; |