{"id":26716496,"url":"https://github.com/manferlo81/map-number","last_synced_at":"2026-05-02T13:34:18.349Z","repository":{"id":38377776,"uuid":"187687113","full_name":"manferlo81/map-number","owner":"manferlo81","description":"processing/p5.js map like function, including floating point numbers support","archived":false,"fork":false,"pushed_at":"2025-10-24T01:23:55.000Z","size":2841,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-24T02:25:44.931Z","etag":null,"topics":["floor","limit","map","number","numbers","p5","p5js","processing","round"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manferlo81.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-05-20T17:43:00.000Z","updated_at":"2025-10-24T01:22:46.000Z","dependencies_parsed_at":"2025-04-29T06:25:19.624Z","dependency_job_id":"b07b1f6a-7516-4ce1-b296-2d87d1895da5","html_url":"https://github.com/manferlo81/map-number","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/manferlo81/map-number","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manferlo81%2Fmap-number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manferlo81%2Fmap-number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manferlo81%2Fmap-number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manferlo81%2Fmap-number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manferlo81","download_url":"https://codeload.github.com/manferlo81/map-number/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manferlo81%2Fmap-number/sbom","scorecard":{"id":614912,"data":{"date":"2025-08-11","repo":{"name":"github.com/manferlo81/map-number","commit":"45fb12f737c072f54eaedf2ba9b4f73ab1eefb1a"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: jobLevel 'contents' permission set to 'write': .github/workflows/ci.yml:62","Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/lint-test-build.yml:1"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/manferlo81/map-number/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/manferlo81/map-number/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/manferlo81/map-number/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:79: update your workflow using https://app.stepsecurity.io/secureworkflow/manferlo81/map-number/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:92: update your workflow using https://app.stepsecurity.io/secureworkflow/manferlo81/map-number/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lint-test-build.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/manferlo81/map-number/lint-test-build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lint-test-build.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/manferlo81/map-number/lint-test-build.yml/main?enable=pin","Info:   0 out of   7 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":3,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Info: 'force pushes' disabled on branch 'main'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'main'","Warn: could not determine whether codeowners review is allowed","Info: 'up-to-date branches' is required to merge on branch 'main'","Info: status check found to merge onto on branch 'main'","Warn: PRs are not required to make changes on branch 'main'; or we don't have data to detect it.If you think it might be the latter, make sure to run Scorecard with a PAT or use Repo Rules (that are always public) instead of Branch Protection settings"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-xffm-g5w8-qvg7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T03:38:49.682Z","repository_id":38377776,"created_at":"2025-08-21T03:38:49.682Z","updated_at":"2025-08-21T03:38:49.682Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32536578,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T12:25:33.646Z","status":"ssl_error","status_checked_at":"2026-05-02T12:24:51.733Z","response_time":132,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["floor","limit","map","number","numbers","p5","p5js","processing","round"],"created_at":"2025-03-27T15:27:54.567Z","updated_at":"2026-05-02T13:34:18.342Z","avatar_url":"https://github.com/manferlo81.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# map-number\n\n[![CircleCI](https://circleci.com/gh/manferlo81/map-number.svg?style=svg)](https://circleci.com/gh/manferlo81/map-number)\n[![CI](https://github.com/manferlo81/map-number/actions/workflows/ci.yml/badge.svg?branch=main\u0026event=push)](https://github.com/manferlo81/map-number/actions/workflows/ci.yml)\n[![npm](https://badgen.net/npm/v/map-number)](https://www.npmjs.com/package/map-number)\n[![codecov](https://codecov.io/gh/manferlo81/map-number/branch/main/graph/badge.svg)](https://codecov.io/gh/manferlo81/map-number)\n[![jsDelivr](https://data.jsdelivr.com/v1/package/npm/map-number/badge?style=rounded)](https://www.jsdelivr.com/package/npm/map-number)\n[![packagephobia](https://badgen.net/packagephobia/install/map-number)](https://packagephobia.now.sh/result?p=map-number)\n[![bundlephobia](https://badgen.net/bundlephobia/min/map-number)](https://bundlephobia.com/result?p=map-number)\n[![types](https://img.shields.io/npm/types/map-number.svg)](https://github.com/microsoft/typescript)\n[![Known Vulnerabilities](https://snyk.io/test/github/manferlo81/map-number/badge.svg?targetFile=package.json)](https://snyk.io/test/github/manferlo81/map-number?targetFile=package.json)\n[![license](https://badgen.net/github/license/manferlo81/map-number)](LICENSE)\n\nprocessing/p5.js map like function, including floating point numbers support\n\n\u003e :warning: this `map` function has nothing to do with `Array.prototype.map` method.\n\n## In this guide\n\n* [Install](#install)\n* [CDN](#cdn)\n* [Usage](#usage)\n* [API](#api)\n  * [function `map`](#function-map)\n  * [function `floor`](#function-floor)\n  * [function `ceil`](#function-ceil)\n  * [function `round`](#function-round)\n  * [function `limit`](#function-limit)\n  * [function `compile`](#function-compile)\n  * [function `transformed`](#function-transformed)\n* [Types](#types)\n  * [type `MapFunction`](#type-mapfunction)\n  * [type `CompiledMapFunction`](#type-compiledmapfunction)\n  * [type `TransformFunction`](#type-transformfunction)\n  * [type `MapNumberFunction`](#type-mapnumberfunction)\n  * [type `CompiledMapNumberFunction`](#type-compiledmapnumberfunction)\n\n## Install\n\n### using npm\n\n```bash\nnpm install map-number\n```\n\n### using yarn\n\n```bash\nyarn add map-number\n```\n\n### using pnpm\n\n```bash\npnpm add map-number\n```\n\n## CDN\n\n### jsDelivr\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/map-number@latest/dist/umd/map.umd.js\"\u003e\u003c/script\u003e\n```\n\n***for production***\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/map-number@latest/dist/umd/map.umd.min.js\"\u003e\u003c/script\u003e\n```\n\n\u003e *for production you may want to replace the \"latest\" version for a specific one.*\n\n*[more options...](https://www.jsdelivr.com/package/npm/map-number?version=latest)*\n\n### unpkg\n\n```html\n\u003cscript src=\"https://unpkg.com/map-number@latest/dist/umd/map.umd.js\"\u003e\u003c/script\u003e\n```\n\n***for production***\n\n```html\n\u003cscript src=\"https://unpkg.com/map-number@latest/dist/umd/map.umd.min.js\"\u003e\u003c/script\u003e\n```\n\n\u003e *for production you may want to replace the \"latest\" version for a specific one.*\n\n*[more options...](https://unpkg.com/map-number@latest/)*\n\n## Usage\n\n### Node.js\n\n```javascript\nconst { map } = require('map-number');\nconst result = map(Math.sin(angle), -1, 1, 100, 0);\n```\n\n***using javascript modules...***\n\n```javascript\nimport { map } from 'map-number';\nconst result = map(Math.sin(angle), -1, 1, 100, 0);\n```\n\n### Browser\n\n*After the* `script` *tag has been added,* `mapNum` *will be available globally.*\n\n```javascript\nconst result = mapNum.map(Math.sin(angle), -1, 1, 100, 0);\n```\n\n## API\n\n### function `map`\n\n*Maps a number within a given range to a different range, returning a floating point number. The result **WILL NOT** be limited (clamped) to the the given output range.*\n\n*This is the core function and all other map function variants depend on it.*\n\n* ***syntax***\n\n```typescript\nfunction map(\n  input: number,\n  inputMin: number,\n  inputMax: number,\n  outputMin: number,\n  outputMax: number,\n): number;\n```\n\n* ***example***\n\n```typescript\nmap(4, 0, 10, 0, 100); // =\u003e returns 40\n```\n\n### function `floor`\n\n*Maps a number within a given range to a different range, returning a number rounded **down** to the **previous** integer number. The result **WILL NOT** be limited (clamped) to the the given output range.*\n\n***syntax***\n\n```typescript\nfunction floor(\n  input: number,\n  inputMin: number,\n  inputMax: number,\n  outputMin: number,\n  outputMax: number,\n): number;\n```\n\n### function `ceil`\n\n*Maps a number within a given range to a different range, returning a number rounded **up** to the **next** integer number. The result **WILL NOT** be limited (clamped) to the the given output range.*\n\n***syntax***\n\n```typescript\nfunction ceil(\n  input: number,\n  inputMin: number,\n  inputMax: number,\n  outputMin: number,\n  outputMax: number,\n): number;\n```\n\n### function `round`\n\n*Maps a number within a given range to a different range, returning a number **rounded** to the **closest** integer number. The result **WILL NOT** be limited (clamped) to the the given output range.*\n\n***syntax***\n\n```typescript\nfunction round(\n  input: number,\n  inputMin: number,\n  inputMax: number,\n  outputMin: number,\n  outputMax: number,\n): number;\n```\n\n\u003e *If you need to round to a specific number of decimal places, you can use the [`transformed`](#function-transformed) method and write your own round function.*\n\n### function `limit`\n\n***alias: `clamp`***\n\n*Maps a number within a given range to a different range, returning a floating point number. The result will be limited (clamped) to the given output range.*\n\n***syntax***\n\n```typescript\nfunction limit(\n  input: number,\n  inputMin: number,\n  inputMax: number,\n  outputMin: number,\n  outputMax: number,\n): number;\n```\n\n### function `compile`\n\n***alias: `wrap`, `create`***\n\n*Creates a single argument function implementing the given [`map`](#function-map), [`floor`](#function-floor), [`ceil`](#function-ceil), [`round`](#function-round), [`limit`](#function-limit), [`clamp`](#function-limit) or user created function. Useful when you need to map values multiple times within the same range, see example below.*\n\n***syntax***\n\n```typescript\nfunction compile\u003cO, I\u003e(\n  map: MapFunction\u003cO, I\u003e,\n  inputMin: number,\n  inputMax: number,\n  outputMin: number,\n  outputMax: number,\n): CompiledMapFunction\u003cO, I\u003e;\n```\n\nSee [`MapFunction`](#type-mapfunction) and [`CompiledMapFunction`](#type-compiledmapfunction).\n\n***example***\n\n```javascript\nimport { map, compile } from \"map-number\";\n\nconst myMap = compile(map, -1, 1, 100, 0);\n\nmyMap(-0.2);\nmyMap(0.33);\nmyMap(0.51);\n\n// ... is equivalent to...\n\nmap(-0.2, -1, 1, 100, 0);\nmap(0.33, -1, 1, 100, 0);\nmap(0.51, -1, 1, 100, 0);\n```\n\n### function `transformed`\n\n***alias: `transform`***\n\n*Creates a map function where the result of the given function is transformed to a different value. This method is used internally to create the [`floor`](#function-floor), [`ceil`](#function-ceil) and [`round`](#function-round) methods.*\n\n***syntax***\n\n```typescript\nfunction transformed\u003cO = number, M = number, I = number\u003e(\n  map: MapFunction\u003cM, I\u003e,\n  transform: TransformFunction\u003cM, O\u003e,\n): MapFunction\u003cO, I\u003e;\n```\n\nSee [`MapFunction`](#type-mapfunction) and [`TransformFunction`](#type-transformfunction).\n\n***example***\n\n```javascript\nimport { transform, map } from \"map-number\";\n\nconst plusOne = transform(\n  map,\n  (value) =\u003e value + 1,\n);\n\nplusOne(0.4, 0, 1, 0, 100); // =\u003e 41 instead of 40\n```\n\n## Types\n\n### type `MapFunction`\n\n```typescript\ntype MapFunction\u003cO = number, I = number\u003e = (value: I, inMin: number, inMax: number, outMin: number, outMax: number) =\u003e O;\n```\n\n### type `CompiledMapFunction`\n\n```typescript\ntype CompiledMapFunction\u003cO = number, I = number\u003e = (value: I) =\u003e O;\n```\n\n### type `TransformFunction`\n\n```typescript\ntype TransformFunction\u003cI = number, O = number\u003e = (value: I) =\u003e O;\n```\n\n### type `MapNumberFunction`\n\n```typescript\ntype MapNumberFunction = MapFunction\u003cnumber, number\u003e;\n```\n\nSee [`MapFunction`](#type-mapfunction)\n\n### type `CompiledMapNumberFunction`\n\n```typescript\ntype CompiledMapNumberFunction = CompiledMapFunction\u003cnumber, number\u003e;\n```\n\nSee [`CompiledMapFunction`](#type-compiledmapfunction)\n\n## License\n\n[MIT](LICENSE) \u0026copy; 2019-2025 [Manuel Fernández](https://github.com/manferlo81)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanferlo81%2Fmap-number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanferlo81%2Fmap-number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanferlo81%2Fmap-number/lists"}