{"library":"normalize-range","title":"Numeric Range Normalization Utility","description":"normalize-range is a utility package designed to normalize numeric values within specified ranges, particularly useful for applications involving cyclical systems like angles or polar coordinates. The current stable version is 0.1.2, released approximately 8 years ago, indicating the package is no longer actively maintained. Its core functionality includes `wrap` for values that \"wrap around\" (e.g., 361 degrees becoming 1 degree in a 0-360 range), `limit` for clamping values within a fixed inclusive range, `test` for range checking, `validate` for asserting values within a range, and `curry` for creating partially applied range functions. A key differentiator is its explicit handling of inclusive/exclusive range boundaries, which differs between `wrap` and `limit` operations, providing precise control for various normalization scenarios.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install normalize-range"],"cli":null},"imports":["const nr = require('normalize-range');","const { wrap } = require('normalize-range');","const curryRange = require('normalize-range').curry;"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const nr = require('normalize-range');\n\nconsole.log('Wrapping 400 in (0, 360):', nr.wrap(0, 360, 400));\n//=> 40\nconsole.log('Wrapping -90 in (0, 360):', nr.wrap(0, 360, -90));\n//=> 270\nconsole.log('Limiting 500 in (0, 100):', nr.limit(0, 100, 500));\n//=> 100\nconsole.log('Limiting -20 in (0, 100):', nr.limit(0, 100, -20));\n//=> 0\n\n// Currying example for convenience\nconst wrapAngle = nr.curry(0, 360).wrap;\nconst limitTo10 = nr.curry(0, 10).limit;\n\nconsole.log('Curried wrapAngle(-30):', wrapAngle(-30));\n//=> 330\nconsole.log('Curried limitTo10(15):', limitTo10(15));\n//=> 10","lang":"javascript","description":"This quickstart demonstrates the core `wrap` and `limit` functions, along with the `curry` utility for creating partially applied range functions, showcasing how to normalize values in both cyclical and bounded ranges.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}