Comparing version 2.0.0 to 3.0.0
13
index.js
@@ -1,3 +0,1 @@ | ||
const clone = require('clone-component'); | ||
class Bounds { | ||
@@ -75,8 +73,9 @@ | ||
restrict(v) { | ||
const { _min, _max } = this; | ||
if (this.reversed()) { | ||
if(this.after(v) && this.before(v)) { | ||
// select closer bound | ||
return (this._distance(this._max, v) < this._distance(v, this._min)) ? | ||
clone(this._max) : | ||
clone(this._min); | ||
return (this._distance(_max, v) < this._distance(v, _min)) ? | ||
_max: | ||
_min; | ||
} | ||
@@ -86,6 +85,6 @@ return v; | ||
if(this.before(v)) { | ||
return clone(this._min); | ||
return _min; | ||
} | ||
if(this.after(v)) { | ||
return clone(this._max); | ||
return _max; | ||
} | ||
@@ -92,0 +91,0 @@ return v; |
{ | ||
"name": "bounds", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Mixin for checking if value is inside or outside of bounds", | ||
@@ -19,10 +19,7 @@ "main": "index.js", | ||
"jshint": "~2", | ||
"mocha": "~5" | ||
"mocha": "~9" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"dependencies": { | ||
"clone-component": "^0.2.2" | ||
} | ||
] | ||
} |
@@ -1,2 +0,3 @@ | ||
[![Build Status](https://secure.travis-ci.org/pirxpilot/bounds.png)](http://travis-ci.org/pirxpilot/bounds) | ||
[![NPM version][npm-image]][npm-url] | ||
[![Build Status][build-image]][build-url] | ||
@@ -65,1 +66,7 @@ # bounds | ||
MIT | ||
[npm-url]: https://npmjs.org/package/bounds | ||
[npm-image]: https://img.shields.io/npm/v/bounds.svg | ||
[build-url]: https://github.com/pirxpilot/bounds/actions/workflows/check.yaml | ||
[build-image]: https://img.shields.io/github/workflow/status/pirxpilot/bounds/check |
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
0
72
5119
4
- Removedclone-component@^0.2.2
- Removedclone-component@0.2.2(transitive)
- Removedcomponent-type@2.0.0(transitive)