You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 356B

12345678910111213141516171819202122
  1. 'use strict';
  2. var sortKeys = require('sort-keys');
  3. /**
  4. * Sort object keys by length
  5. *
  6. * @param obj
  7. * @api public
  8. */
  9. module.exports.desc = function (obj) {
  10. return sortKeys(obj, function (a, b) {
  11. return b.length - a.length;
  12. });
  13. }
  14. module.exports.asc = function (obj) {
  15. return sortKeys(obj, function (a, b) {
  16. return a.length - b.length;
  17. });
  18. }