This file contains hidden or 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
| export function Deferred () { | |
| this.promise = new Promise((resolve, reject) => Object.assign(this, {resolve, reject})) | |
| } |
This file contains hidden or 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
| let lodash = _.runInContext() | |
| export let wrapLodashArrForVue = _(['pull', 'pullAll', 'pullAllBy', 'pullAllWith', 'pullAt', 'remove']) | |
| .map(fnName => { | |
| let fn = lodash[fnName] | |
| return [ | |
| fnName, | |
| function (v, …args) { | |
| let ret = fn(v, …args) | |
| if (v instanceof Array) v.push() | |
| return ret |
This file contains hidden or 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
| const _ = require('lodash') | |
| function isPromise(result) { | |
| return result && (typeof result.then === 'function') | |
| } | |
| function seq(init) { | |
| let result = typeof init === 'function' ? init() : init | |
| let properties = {value: {get() { return result }}} | |
| _.forEach(['then', 'catch', 'finally'], x => { properties[x] = {get() { return (...args) => result[x](...args) }} }) |
This file contains hidden or 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
| const entities = { | |
| lt: '<', | |
| gt: '>', | |
| amp: '&', | |
| quot: '"', | |
| apos: `'`, | |
| cent: '¢', | |
| pound: '£', | |
| yen: '¥', | |
| euro: '€', |
This file contains hidden or 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
| function dfsXyConv (code, v1, v2) { | |
| const { PI, tan, log, cos, pow, floor, sin, sqrt, atan, abs, atan2 } = Math | |
| // | |
| // LCC DFS 좌표변환을 위한 기초 자료 | |
| // | |
| const RE = 6371.00877 // 지구 반경(km) | |
| const GRID = 5.0 // 격자 간격(km) | |
| const SLAT1 = 30.0 // 투영 위도1(degree) | |
| const SLAT2 = 60.0 // 투영 위도2(degree) | |
| const OLON = 126.0 // 기준점 경도(degree) |
This file contains hidden or 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
| const htmlparser2 = require('htmlparser2') | |
| const define = (src, ...args) => { | |
| if (!args.length) args.push(src) | |
| const [configurable, enumerable] = [true, false] | |
| args.forEach(obj => { | |
| const keys = Object.entries(obj) | |
| .map(([key, value]) => ({ [key]: { value, configurable, enumerable } })) | |
| Object.defineProperties(src, Object.assign(...keys)) | |
| }) | |
| return src |
OlderNewer