@thi.ng/compare
Advanced tools
Comparing version 1.0.10 to 1.1.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [1.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/compare@1.0.10...@thi.ng/compare@1.1.0) (2019-11-30) | ||
### Features | ||
* **compare:** add compareNumAsc/Desc numeric comparators ([2b8fafc](https://github.com/thi-ng/umbrella/commit/2b8fafc9eca040b649ade479203537bbd9ba54ef)) | ||
## [1.0.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/compare@1.0.9...@thi.ng/compare@1.0.10) (2019-11-09) | ||
@@ -8,0 +19,0 @@ |
export declare const compare: (a: any, b: any) => number; | ||
/** | ||
* Numeric comparator (ascending order) | ||
* | ||
* @param a | ||
* @param b | ||
*/ | ||
export declare const compareNumAsc: (a: number, b: number) => number; | ||
/** | ||
* Numeric comparator (descending order) | ||
* | ||
* @param a | ||
* @param b | ||
*/ | ||
export declare const compareNumDesc: (a: number, b: number) => number; |
14
index.js
@@ -19,1 +19,15 @@ export const compare = (a, b) => { | ||
}; | ||
/** | ||
* Numeric comparator (ascending order) | ||
* | ||
* @param a | ||
* @param b | ||
*/ | ||
export const compareNumAsc = (a, b) => a - b; | ||
/** | ||
* Numeric comparator (descending order) | ||
* | ||
* @param a | ||
* @param b | ||
*/ | ||
export const compareNumDesc = (a, b) => b - a; |
@@ -23,3 +23,7 @@ 'use strict'; | ||
}; | ||
const compareNumAsc = (a, b) => a - b; | ||
const compareNumDesc = (a, b) => b - a; | ||
exports.compare = compare; | ||
exports.compareNumAsc = compareNumAsc; | ||
exports.compareNumDesc = compareNumDesc; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.compare={}))}(this,(function(e){"use strict";e.compare=(e,t)=>e===t?0:null==e?null==t?0:-1:null==t?null==e?0:1:"function"==typeof e.compare?e.compare(t):"function"==typeof t.compare?-t.compare(e):e<t?-1:e>t?1:0,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?o(exports):"function"==typeof define&&define.amd?define(["exports"],o):o(((e=e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.compare={}))}(this,(function(e){"use strict";e.compare=(e,o)=>e===o?0:null==e?null==o?0:-1:null==o?null==e?0:1:"function"==typeof e.compare?e.compare(o):"function"==typeof o.compare?-o.compare(e):e<o?-1:e>o?1:0,e.compareNumAsc=(e,o)=>e-o,e.compareNumDesc=(e,o)=>o-e,Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@thi.ng/compare", | ||
"version": "1.0.10", | ||
"description": "Comparator with optional delegation for types implementing @thi.ng/api/ICompare interface", | ||
"version": "1.1.0", | ||
"description": "Comparators with support for types implementing the @thi.ng/api/ICompare interface", | ||
"module": "./index.js", | ||
@@ -21,15 +21,18 @@ "main": "./lib/index.js", | ||
"build:test": "rimraf build && tsc -p test/tsconfig.json", | ||
"test": "yarn build:test && mocha build/test/*.js", | ||
"cover": "yarn build:test && nyc mocha build/test/*.js && nyc report --reporter=lcov", | ||
"test": "mocha test", | ||
"cover": "nyc mocha test && nyc report --reporter=lcov", | ||
"clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib", | ||
"doc": "node_modules/.bin/typedoc --mode modules --out doc --ignoreCompilerErrors src", | ||
"doc:readme": "../../scripts/generate-readme", | ||
"doc": "node_modules/.bin/typedoc --mode modules --out doc src", | ||
"pub": "yarn build:release && yarn publish --access public" | ||
}, | ||
"devDependencies": { | ||
"@istanbuljs/nyc-config-typescript": "^0.1.3", | ||
"@types/mocha": "^5.2.6", | ||
"@types/node": "^12.6.3", | ||
"mocha": "^6.1.4", | ||
"@types/node": "^12.12.11", | ||
"mocha": "^6.2.2", | ||
"nyc": "^14.0.0", | ||
"typedoc": "^0.15.0", | ||
"typescript": "^3.6.4" | ||
"ts-node": "^8.5.2", | ||
"typedoc": "^0.15.2", | ||
"typescript": "^3.7.2" | ||
}, | ||
@@ -45,3 +48,3 @@ "keywords": [ | ||
"sideEffects": false, | ||
"gitHead": "97add769f24aa32a1a5e13c5c941605e1b9eb569" | ||
"gitHead": "36c4d9e967bd80ccdbfa0f4a42f594080f95f105" | ||
} |
@@ -0,1 +1,3 @@ | ||
<!-- This file is generated - DO NOT EDIT! --> | ||
# @thi.ng/compare | ||
@@ -10,11 +12,19 @@ | ||
- [About](#about) | ||
- [Status](#status) | ||
- [Installation](#installation) | ||
- [Dependencies](#dependencies) | ||
- [Usage examples](#usage-examples) | ||
- [API](#api) | ||
- [Authors](#authors) | ||
- [License](#license) | ||
## About | ||
General purpose comparator with optional delegation for types | ||
implementing the `@thi.ng/api/ICompare` interface. | ||
Comparators with support for types implementing the [@thi.ng/api `ICompare`](https://github.com/thi-ng/umbrella/tree/master/packages/api/src/api/compare.ts) interface. | ||
This feature was previously part of the | ||
[@thi.ng/api](https://github.com/thi-ng/umbrella/tree/master/packages/api) | ||
package. | ||
### Status | ||
**STABLE** - used in production | ||
## Installation | ||
@@ -32,2 +42,16 @@ | ||
Several demos in this repo's | ||
[/examples](https://github.com/thi-ng/umbrella/tree/master/examples) | ||
directory are using this package. | ||
A selection: | ||
### triple-query <!-- NOTOC --> | ||
[Live demo](https://demo.thi.ng/umbrella/triple-query/) | [Source](https://github.com/thi-ng/umbrella/tree/master/examples/triple-query) | ||
## API | ||
[Generated API docs](https://docs.thi.ng/umbrella/compare/) | ||
```ts | ||
@@ -56,6 +80,6 @@ import { ICompare } from "@thi.ng/api"; | ||
- Karsten Schmidt | ||
Karsten Schmidt | ||
## License | ||
© 2018 Karsten Schmidt // Apache Software License 2.0 | ||
© 2016 - 2019 Karsten Schmidt // Apache Software License 2.0 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
22794
12
72
83
8