-
Notifications
You must be signed in to change notification settings - Fork 0
Sort
Malexion edited this page Oct 31, 2016
·
2 revisions
-
array
Array object to sort via the options. -
[options]
[Optional] Object/Array of Objects to sort the array upon. Default is{ dir: 'asc', key: x => x }
- Note that as an array it does a multi-level sort, and the default is applied to all array objects for missing parts.
var sorted = __.sort([ 1, 64, 25, 0, 5 ]);
console.log(sorted);
sorted = __.sort([ 1, 64, 25, 0, 5 ], { dir: 'desc' });
console.log(sorted);
sorted = __.sort([
{ name: 'Frank', income: 60000 },
{ name: 'Mya', income: 100000 },
{ name: 'Mya', income: 120000 }
{ name: 'Bob', income: 0 },
{ name: 'Jeff', income: 0 }
], [
{ dir: 'asc', key: x => x.name },
{ dir: 'desc', key: x => x.income }
]);
console.log(sorted);
- Home
- String Prototype Functions
- Replace All
- Replace While
- Format
- Contains
- Whiteout
- Capitalize
- First Word
- Truncate
- Base Functions
- All
- Class
- Contains
- Count
- Debounce
- Deep All
- Distinct
- Enum
- First
- Filter
- Fuse
- Get Type
- Group
- Index
- Intersect
- Last
- Map
- Match
- Move
- Options
- Get Property
- Rank
- Remove
- Remove At
- Scope
- Search
- Sort
- Switch
- Throttle
- Formats
- Pad Left
- Pad Right
- Type Detection
- Defined
- Set
- Same Type
- Function
- Object
- Array
- Arguments
- Boolean
- String
- Number
- Date
- Null
- Undefined
- NaN
- Math
- Random 16-bit
- Round To
- Round Down To
- Round Up To
- Median
- Sum
- Average
- Max
- Min
- Between
- Percentage
- Generators
- Guid
- Password
- Classes
- Overwrite
- Updatable