1.1.2 • Published 5 years ago
sort-values v1.1.2
Sort Values
Sort the keys of an object based in the value.
Install
npm install sort-values --saveIf you want to use in the browser (powered by Browserify):
bower install sort-values --saveand later link in your HTML:
<script src="bower_components/sort-values/dist/sort-values.js"></script>Usage
var sortValues = require('sort-values');
sortValues({en: 10, es: 100, it: 50}, 'desc');
//=> {es: 100, it: 50, en: 10}
sortValues({en: 10, es: 100, it: 50}, 'asc');
//=> {en: 10, it: 50, es: 100}
sortValues({en: 10, es: 100, it: 50});
//=> {en: 10, it: 50, es: 100}API
sortValues(input, mode)
input
Required
Type: Object
mode
Type: String
Default: asc
How to sort the object. Could be asc or desc.
Related
- sort-keys – Sort the keys of an object.
- sort-keys-recursive – Sort the keys of an object recursively.
License
MIT © Kiko Beats