on
[Vue.js/라이브러리] deepmerge
[Vue.js/라이브러리] deepmerge
◽ 설치하기
npm i deepmerge
◽ API
- merge(x, y, [options])
import deepmerge from 'deepmerge' methods: { test() { const a = { name: 'davinch', } const b = { age: 132, birth: 230908, } const output = deepmerge(a, b) console.log(output) // { age: 132, birth: 230908, name: "davinch" } }; }
- merge.all(arrayOfObjects, [options])
import deepmerge from 'deepmerge' methods: { test() { const foobar = { foo: { bar: 3 } } const foobaz = { foo: { baz: 4 } } const bar = { bar: 'yay!' } const output = deepmerge.all([foobar, foobaz, bar]) console.log(output) // { "foo": { "bar": 3, "baz": 4 }, "bar": "yay!" } } }
◽ API with. options
아래 링크에서 필요한 옵션을 찾아 추가하면 된다.
출처
개인적으로 공부한 내용을 정리하는 블로그로
잘못된 개념을 게시하지않도록 주의하고 있으나 오류가 있을 수 있습니다.
from http://be-a-weapon.tistory.com/194 by ccl(A) rewrite - 2021-12-18 19:01:32