Skip to content

The Maslak library converts your flat object to key and value objects, and then sort it by the given array.

License

Notifications You must be signed in to change notification settings

thalesrc/maslak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maslak

alt text

Travis Coverage Status npm

The Maslak library converts your flat object to key and value objects, and then sort it by the given array. It's simple & basic.

Documentation

Installation

npm i maslak

Usage

Basic Usage

const DataTransform = require("maslak");
const testCase1 = {
  data2: "value2",
  data1: "value1",
  data3: 3
};

const transform = new DataTransform(testCase1).result;
console.log(transform); // [ { key: 'data2', value: 'value2' },{ key: 'data1', value:'value1'},{ key: 'data3', value: 3 } ] //

Sorted Usage

const DataTransform = require("maslak");
const testCase1 = {
  data2: "value2",
  data1: "value1",
  data3: 3
};

const sortRule = ["data1", "data2", "data3"];

const transform = new DataTransform(testCase1).dataSort(sortRule).result;
console.log(transform); // [ { key: 'data1', value:'value1'},{ key: 'data2', value: 'value2' },{ key: 'data3', value: 3 } ] //

About

The Maslak library converts your flat object to key and value objects, and then sort it by the given array.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •