1.0.11 • Published 7 years ago

shape-array v1.0.11

Weekly downloads
28
License
MIT
Repository
github
Last release
7 years ago

Build Status

Install

Using npm:

npm install shape-array

Usage

Shape array to a json object:

'use strict';
const shape = require('shape-array');
const personify = shape.scheme(['id', 'name', 'address.street', 'address.zip']);

let data = [1, 'John', 'github', '1234'];
let person = personify(data);
//person equals:
{
  id: 1,
  name: 'John',
  address: {
    street: 'github',
    zip: '1234'
  }
}

Reverse json to array:

const reverse = shape.reverse(['id', 'name', 'address.street', 'address.zip']);

let json = {
  id: 1,
  name: 'John',
  address: {
    street: 'github',
    zip: '1234'
  }
};
let array = reverse(json);
//array equals:
[1, 'John', 'github', '1234']

Related

License

MIT © Andre Stehle

1.0.11

7 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.1

8 years ago