Comparing version 0.1.1 to 0.2.0
/*! | ||
* sort-desc <https://github.com/helpers/sort-desc> | ||
* | ||
* Copyright (c) 2014 Jon Schlinkert, contributors. | ||
* Copyright (c) 2014-2015 Jon Schlinkert. | ||
* Licensed under the MIT License | ||
@@ -11,3 +11,3 @@ */ | ||
module.exports = function (a, b) { | ||
return a < b ? -1 : 1; | ||
return a === b ? 0 : b.localeCompare(a); | ||
}; |
{ | ||
"name": "sort-desc", | ||
"description": "Sort array elements in descending order.", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/jonschlinkert/sort-desc", | ||
"author": { | ||
"name": "Jon Schlinkert", | ||
"url": "https://github.com/jonschlinkert" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/jonschlinkert/sort-desc.git" | ||
}, | ||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"repository": "jonschlinkert/sort-desc", | ||
"bugs": { | ||
"url": "https://github.com/jonschlinkert/sort-desc/issues" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/jonschlinkert/sort-desc/blob/master/LICENSE-MIT" | ||
} | ||
"license": "MIT", | ||
"files": [ | ||
"index.js" | ||
], | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*" | ||
}, | ||
"keywords": [ | ||
"array", | ||
"arr", | ||
"desc", | ||
"descend", | ||
"descending", | ||
"function", | ||
"keys", | ||
"key", | ||
"element", | ||
"elements", | ||
"order", | ||
"ordered", | ||
"obj", | ||
"object", | ||
"sort" | ||
"sort", | ||
"sorted", | ||
"sorting" | ||
], | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha -R spec" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*", | ||
"verb": "^0.2.15" | ||
"verb": { | ||
"related": { | ||
"list": ["sort-asc", "sort-desc", "sort-object"] | ||
} | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# sort-desc [![NPM version](https://badge.fury.io/js/sort-desc.png)](http://badge.fury.io/js/sort-desc) | ||
# sort-desc [![NPM version](https://badge.fury.io/js/sort-desc.svg)](http://badge.fury.io/js/sort-desc) [![Build Status](https://travis-ci.org/jonschlinkert/sort-desc.svg)](https://travis-ci.org/jonschlinkert/sort-desc) | ||
@@ -6,6 +6,7 @@ > Sort array elements in descending order. | ||
## Install | ||
#### Install with [npm](npmjs.org) | ||
```bash | ||
npm i sort-desc --save | ||
Install with [npm](https://www.npmjs.com/) | ||
```sh | ||
$ npm i sort-desc --save | ||
``` | ||
@@ -16,20 +17,38 @@ | ||
```js | ||
var sortDesc = require('sort-desc'); | ||
console.log((['d', 'c', 'b', 'a']).sort(sortDesc)); | ||
//=> ['a', 'b', 'c', 'd'] | ||
var descending = require('sort-desc'); | ||
['a', 'b', 'c', 'd'].sort(descending); | ||
//=> ['d', 'c', 'b', 'a'] | ||
``` | ||
## Related projects | ||
* [sort-asc](https://github.com/jonschlinkert/sort-asc): Sort array elements in ascending order. | ||
* [sort-object](https://github.com/doowb/sort-object): Sort the keys in an object. | ||
## Running tests | ||
Install dev dependencies: | ||
```sh | ||
$ npm i -d && npm test | ||
``` | ||
## Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/sort-desc/issues/new) | ||
## Author | ||
**Jon Schlinkert** | ||
+ [github/jonschlinkert](https://github.com/jonschlinkert) | ||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
## License | ||
Copyright (c) 2014 Jon Schlinkert, contributors. | ||
Released under the MIT license | ||
Copyright © 2015 Jon Schlinkert | ||
Released under the MIT license. | ||
*** | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 15, 2014._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 17, 2015._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
52
3423
4
9
1
1