var sortBy = require('{%= name %}');
sortBy(array, {
prop: 'foo', // the property name to sort by
values: ['a', 'b', 'c'] // the property values to sort by
});
var arr = [
{title: 'Foo'},
{title: 'Baz'},
{title: 'Bar'},
{title: 'Qux'},
{title: 'Faz'},
{title: 'Fez'}
];
var res = sortBy(arr, {
prop: 'title',
values: ['Faz', 'Qux', 'Bar'],
normalize: function(val) {
return val;
}
});
console.log(res);
// [ { title: 'Faz' },
// { title: 'Qux' },
// { title: 'Bar' },
// { title: 'Foo' },
// { title: 'Baz' },
// { title: 'Fez' } ]