0.5.0 • Published 7 years ago

tree-normalizer v0.5.0

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

tree-normalizer

Object tree normalizer (transform structure of the tree)

Installation

$ npm install tree-normalizer

Usage

import {normalizer} from 'tree-normalizer';

// schema example
const schema = [
  { key: 'user', parent: null },
  { key: 'index', parent: null },
  { key: 'create', parent: 'user' },
  { key: 'update', parent: 'user' },
  { key: 'delete', parent: 'user' }
];

// input example
const data = {
  user: {
    index: true,
    create: true,
    update: true,
    delete: true
  }
};

console.log(JSON.stringify(
  normalizer(data, schema), null, 2
));

/*
{
  "user": {
    "create": true,
    "update": true,
    "delete": true
  },
  "index": true
}
*/
0.5.0

7 years ago

0.4.9

7 years ago

0.4.8

7 years ago

0.4.7

7 years ago

0.4.6

7 years ago

0.4.5

7 years ago

0.4.4

7 years ago

0.4.3

7 years ago

0.4.2

7 years ago

0.3.2

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago