Acme.BookStore.HttpApi.Host/node_modules/array-sort/README.md
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
# array-sort [](https://www.npmjs.com/package/array-sort) [](https://npmjs.org/package/array-sort) [](https://npmjs.org/package/array-sort) [](https://travis-ci.org/jonschlinkert/array-sort) [](https://ci.appveyor.com/project/jonschlinkert/array-sort)
> Fast and powerful array sorting. Sort an array of objects by one or more properties. Any number of nested properties or custom comparison functions may be used.
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save array-sort
```
Install with [yarn](https://yarnpkg.com):
```sh
$ yarn add array-sort
```
## Usage
Sort an array by the given object property:
```js
var arraySort = require('array-sort');
arraySort([{foo: 'y'}, {foo: 'z'}, {foo: 'x'}], 'foo');
//=> [{foo: 'x'}, {foo: 'y'}, {foo: 'z'}]
```
**Reverse order**
```js
arraySort([{foo: 'y'}, {foo: 'z'}, {foo: 'x'}], 'foo', {reverse: true});
//=> [{foo: 'z'}, {foo: 'y'}, {foo: 'x'}]
```
## Params
```js
arraySort(array, comparisonArgs);
```
* `array`: **{Array}** The array to sort
* `comparisonArgs`: **{Function|String|Array}**: One or more functions or object paths to use for sorting.
## Examples
**[Sort blog posts](examples/blog-posts.js)**
```js
var arraySort = require('array-sort');
var posts = [
{ path: 'c.md', locals: { date: '2014-01-09' } },
{ path: 'a.md', locals: { date: '2014-01-02' } },
{ path: 'b.md', locals: { date: '2013-05-06' } },
];
// sort by `locals.date`
console.log(arraySort(posts, 'locals.date'));
后面还有 143 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
