summaryrefslogtreecommitdiff
path: root/node_modules/normalize-range
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2026-05-18 23:10:59 +0800
committerlittleblack111 <littleblack11111@gmail.com>2026-05-18 23:41:44 +0800
commitfc87c009806dcc98867f6b58efe29b042aa01dee (patch)
tree8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/normalize-range
parent3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff)
node: updatemain
Diffstat (limited to 'node_modules/normalize-range')
-rw-r--r--node_modules/normalize-range/index.js54
-rw-r--r--node_modules/normalize-range/license21
-rw-r--r--node_modules/normalize-range/package.json46
-rw-r--r--node_modules/normalize-range/readme.md148
4 files changed, 0 insertions, 269 deletions
diff --git a/node_modules/normalize-range/index.js b/node_modules/normalize-range/index.js
deleted file mode 100644
index d5a2ea80..00000000
--- a/node_modules/normalize-range/index.js
+++ /dev/null
@@ -1,54 +0,0 @@
-'use strict';
-module.exports = {
- wrap: wrapRange,
- limit: limitRange,
- validate: validateRange,
- test: testRange,
- curry: curry,
- name: name
-};
-
-function wrapRange(min, max, value) {
- var maxLessMin = max - min;
- return ((value - min) % maxLessMin + maxLessMin) % maxLessMin + min;
-}
-
-function limitRange(min, max, value) {
- return Math.max(min, Math.min(max, value));
-}
-
-function validateRange(min, max, value, minExclusive, maxExclusive) {
- if (!testRange(min, max, value, minExclusive, maxExclusive)) {
- throw new Error(value + ' is outside of range [' + min + ',' + max + ')');
- }
- return value;
-}
-
-function testRange(min, max, value, minExclusive, maxExclusive) {
- return !(
- value < min ||
- value > max ||
- (maxExclusive && (value === max)) ||
- (minExclusive && (value === min))
- );
-}
-
-function name(min, max, minExcl, maxExcl) {
- return (minExcl ? '(' : '[') + min + ',' + max + (maxExcl ? ')' : ']');
-}
-
-function curry(min, max, minExclusive, maxExclusive) {
- var boundNameFn = name.bind(null, min, max, minExclusive, maxExclusive);
- return {
- wrap: wrapRange.bind(null, min, max),
- limit: limitRange.bind(null, min, max),
- validate: function(value) {
- return validateRange(min, max, value, minExclusive, maxExclusive);
- },
- test: function(value) {
- return testRange(min, max, value, minExclusive, maxExclusive);
- },
- toString: boundNameFn,
- name: boundNameFn
- };
-}
diff --git a/node_modules/normalize-range/license b/node_modules/normalize-range/license
deleted file mode 100644
index ad5d021e..00000000
--- a/node_modules/normalize-range/license
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) James Talmage <james@talmage.io> (github.com/jamestalmage)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/node_modules/normalize-range/package.json b/node_modules/normalize-range/package.json
deleted file mode 100644
index b98035ae..00000000
--- a/node_modules/normalize-range/package.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "name": "normalize-range",
- "version": "0.1.2",
- "description": "Utility for normalizing a numeric range, with a wrapping function useful for polar coordinates",
- "license": "MIT",
- "repository": "jamestalmage/normalize-range",
- "author": {
- "name": "James Talmage",
- "email": "james@talmage.io",
- "url": "github.com/jamestalmage"
- },
- "engines": {
- "node": ">=0.10.0"
- },
- "scripts": {
- "test": "npm run cover && npm run lint && npm run style",
- "cover": "istanbul cover ./node_modules/.bin/_mocha",
- "lint": "jshint --reporter=node_modules/jshint-stylish *.js test/*.js",
- "debug": "mocha",
- "watch": "mocha -w",
- "style": "jscs *.js ./**/*.js && jscs ./test/** --config=./test/.jscsrc"
- },
- "files": [
- "index.js"
- ],
- "keywords": [
- "range",
- "normalize",
- "utility",
- "angle",
- "degrees",
- "polar"
- ],
- "dependencies": {},
- "devDependencies": {
- "almost-equal": "^1.0.0",
- "codeclimate-test-reporter": "^0.1.0",
- "coveralls": "^2.11.2",
- "istanbul": "^0.3.17",
- "jscs": "^2.1.1",
- "jshint": "^2.8.0",
- "jshint-stylish": "^2.0.1",
- "mocha": "^2.2.5",
- "stringify-pi": "0.0.3"
- }
-}
diff --git a/node_modules/normalize-range/readme.md b/node_modules/normalize-range/readme.md
deleted file mode 100644
index 29d84cd2..00000000
--- a/node_modules/normalize-range/readme.md
+++ /dev/null
@@ -1,148 +0,0 @@
-# normalize-range
-
-Utility for normalizing a numeric range, with a wrapping function useful for polar coordinates.
-
-[![Build Status](https://travis-ci.org/jamestalmage/normalize-range.svg?branch=master)](https://travis-ci.org/jamestalmage/normalize-range)
-[![Coverage Status](https://coveralls.io/repos/jamestalmage/normalize-range/badge.svg?branch=master&service=github)](https://coveralls.io/github/jamestalmage/normalize-range?branch=master)
-[![Code Climate](https://codeclimate.com/github/jamestalmage/normalize-range/badges/gpa.svg)](https://codeclimate.com/github/jamestalmage/normalize-range)
-[![Dependency Status](https://david-dm.org/jamestalmage/normalize-range.svg)](https://david-dm.org/jamestalmage/normalize-range)
-[![devDependency Status](https://david-dm.org/jamestalmage/normalize-range/dev-status.svg)](https://david-dm.org/jamestalmage/normalize-range#info=devDependencies)
-
-[![NPM](https://nodei.co/npm/normalize-range.png)](https://nodei.co/npm/normalize-range/)
-
-## Usage
-
-```js
-var nr = require('normalize-range');
-
-nr.wrap(0, 360, 400);
-//=> 40
-
-nr.wrap(0, 360, -90);
-//=> 270
-
-nr.limit(0, 100, 500);
-//=> 100
-
-nr.limit(0, 100, -20);
-//=> 0
-
-// There is a convenient currying function
-var wrapAngle = nr.curry(0, 360).wrap;
-var limitTo10 = nr.curry(0, 10).limit;
-
-wrapAngle(-30);
-//=> 330
-```
-## API
-
-### wrap(min, max, value)
-
-Normalizes a values that "wraps around". For example, in a polar coordinate system, 270˚ can also be
-represented as -90˚.
-For wrapping purposes we assume `max` is functionally equivalent to `min`, and that `wrap(max + 1) === wrap(min + 1)`.
-Wrap always assumes that `min` is *inclusive*, and `max` is *exclusive*.
-In other words, if `value === max` the function will wrap it, and return `min`, but `min` will not be wrapped.
-
-```js
-nr.wrap(0, 360, 0) === 0;
-nr.wrap(0, 360, 360) === 0;
-nr.wrap(0, 360, 361) === 1;
-nr.wrap(0, 360, -1) === 359;
-```
-
-You are not restricted to whole numbers, and ranges can be negative.
-
-```js
-var π = Math.PI;
-var radianRange = nr.curry(-π, π);
-
-redianRange.wrap(0) === 0;
-nr.wrap(π) === -π;
-nr.wrap(4 * π / 3) === -2 * π / 3;
-```
-
-### limit(min, max, value)
-
-Normalize the value by bringing it within the range.
-If `value` is greater than `max`, `max` will be returned.
-If `value` is less than `min`, `min` will be returned.
-Otherwise, `value` is returned unaltered.
-Both ends of this range are *inclusive*.
-
-### test(min, max, value, [minExclusive], [maxExclusive])
-
-Returns `true` if `value` is within the range, `false` otherwise.
-It defaults to `inclusive` on both ends of the range, but that can be
-changed by setting `minExclusive` and/or `maxExclusive` to a truthy value.
-
-### validate(min, max, value, [minExclusive], [maxExclusive])
-
-Returns `value` or throws an error if `value` is outside the specified range.
-
-### name(min, max, value, [minExclusive], [maxExclusive])
-
-Returns a string representing this range in
-[range notation](https://en.wikipedia.org/wiki/Interval_(mathematics)#Classification_of_intervals).
-
-### curry(min, max, [minExclusive], [maxExclusive])
-
-Convenience method for currying all method arguments except `value`.
-
-```js
-var angle = require('normalize-range').curry(-180, 180, false, true);
-
-angle.wrap(270)
-//=> -90
-
-angle.limit(200)
-//=> 180
-
-angle.test(0)
-//=> true
-
-angle.validate(300)
-//=> throws an Error
-
-angle.toString() // or angle.name()
-//=> "[-180,180)"
-```
-
-#### min
-
-*Required*
-Type: `number`
-
-The minimum value (inclusive) of the range.
-
-#### max
-
-*Required*
-Type: `number`
-
-The maximum value (exclusive) of the range.
-
-#### value
-
-*Required*
-Type: `number`
-
-The value to be normalized.
-
-#### returns
-
-Type: `number`
-
-The normalized value.
-
-## Building and Releasing
-
-- `npm test`: tests, linting, coverage and style checks.
-- `npm run watch`: autotest mode for active development.
-- `npm run debug`: run tests without coverage (istanbul can obscure line #'s)
-
-Release via `cut-release` tool.
-
-## License
-
-MIT © [James Talmage](http://github.com/jamestalmage)