biofriction-wp-theme/node_modules/sort-keys-length/index.js

23 lines
356 B
JavaScript
Raw Permalink Normal View History

2021-10-26 14:18:09 +02:00
'use strict';
var sortKeys = require('sort-keys');
/**
* Sort object keys by length
*
* @param obj
* @api public
*/
module.exports.desc = function (obj) {
return sortKeys(obj, function (a, b) {
return b.length - a.length;
});
}
module.exports.asc = function (obj) {
return sortKeys(obj, function (a, b) {
return a.length - b.length;
});
}