This package has been deprecated

Author message:

See the `flat` package instead

deep-shallow
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

deep-shallow

An object convert between shallow and deep.

npm: deep-shallow CircleCI Coverage Status tested with jest code style: prettier license: mit

Install

yarn add [-d] deep-shallow

Usage

import {toDeep, toShallow} from 'deep-shallow';

const deepObj = {
  foo: {
    a: 'a',
    b: 'b',
    c: 'c',
    d: 'd',
  },
  bar: {
    x: 'x',
    y: 'y',
    z: 'z',
  },
  arr: [1, 2, 3, 4],
};

const shallowObj = toShallow(deepObj);
// {
//   'foo.a': 'a'
//   'foo.b': 'b'
//   'foo.c': 'c'
//   'foo.d': 'd',
//   'bar.x': 'x',
//   'bar.y': 'y',
//   'bar.z': 'z'
//    arr: [1, 2, 3, 4],
// }

toDeep(shallowObj);
// {
//   foo: {
//     a: 'a',
//     b: 'b',
//     c: 'c',
//     d: 'd',
//   },
//   bar: {
//     x: 'x',
//     y: 'y',
//     z: 'z',
//   },
//   arr: [1, 2, 3, 4],
// };

Readme

Keywords

Package Sidebar

Install

npm i deep-shallow

Weekly Downloads

0

Version

0.1.2

License

MIT

Unpacked Size

176 kB

Total Files

14

Last publish

Collaborators

  • nju33