This package has been deprecated

Author message:

end of development

order-align

0.1.1 • Public • Published

orderAlign

Build Status XO code style npm version

In the order specified the array

Install

npm i order-align

Usage

const orderAlign = require('order-align');
orderAlign(orderList, dataArr, targetKey);

Example

String

const orderList = ['foo', 'bar', 'baz'];
const dataArr = ['baz', 'foo', 'bar'];
 
const result = orderAlign(orderList, dataArr);
console.log(result);
// [ 'foo', 'bar', 'baz' ]

Object

const orderList = ['foo', 'bar', 'baz'];
const dataArr = [
  {name: 'baz'},
  {name: 'foo'},
  {name: 'bar'}
];
 
const result = orderAlign(orderList, dataArr, 'name');
console.log(result);
// [ { name: 'foo' }, { name: 'bar' }, { name: 'baz' } ]

Readme

Keywords

Package Sidebar

Install

npm i order-align

Weekly Downloads

0

Version

0.1.1

License

MIT

Last publish

Collaborators

  • nju33