sort_by_key

0.0.2 • Public • Published

example:

// actions array is sorted by date
var sortByKey = require("sort_by_key");
var bill = { actions: 
   [ { 
       action: 'Referred to the committee on Public Safety and Homeland Security',
       date: '2013-01-22 00:00:00',
       '+chamber': [Object] },
     { date: '2013-01-22 00:00:00',
       action: 'House concurred',
       actor: 'lower' },
     { date: '2013-09-13 00:00:00',
       action: 'Hearing scheduled for 09/13/2013 from 10:00 AM-08:00 PM in Gardner Auditorium',
       actor: 'joint' },
     { date: '2014-07-10 00:00:00',
       action: 'Senate concurred',
       actor: 'upper' } ]
}

  var actionsSorted = sortByKey.desc(bill.actions,"date");
  console.log(actionsSorted);

Package Sidebar

Install

npm i sort_by_key

Weekly Downloads

0

Version

0.0.2

License

ISC

Last publish

Collaborators

  • mark116