Array Transform
Description: This module is used to do complex array transformations based on substrings to change the order of an array.
npm install arraytrans --save
var arrayTrans = require('arraytrans')
Method requires
1.The array to transform.
2.Array of substrings in proper order.
3.Base string the substrings will be pulled from.
4.Location you want values that do not include base string(start or end or null). If null will try best to reconstruct close to original array.
###example:
var testArr =
['basestring.arrayone.one',
'nobase1',
'basestring.arrayone.two',
'nobase2',
'basestring.arrayone.three',
'basestring.arraytwo.one',
'basestring.arraytwo.two',
'basestring.arraytwo.three',
'basestring.arraythree.one',
'basestring.arraythree.two',
'basestring.araythree.three'];
console.log(ArrayTrans(testArr,['arraytwo','arrayone','arraythree'],'basestring','start'));
//OUTPUT=========================
[ 'nobase1',
'nobase2',
'basestring.arraytwo.three',
'basestring.arraytwo.two',
'basestring.arraytwo.one',
'basestring.arrayone.three',
'basestring.arrayone.two',
'basestring.arrayone.one',
'basestring.arraythree.two',
'basestring.arraythree.one',
'basestring.araythree.three' ]