{"id":17736642,"url":"https://github.com/parro-it/normalize-array-number","last_synced_at":"2025-03-31T19:17:11.537Z","repository":{"id":36309966,"uuid":"40614592","full_name":"parro-it/normalize-array-number","owner":"parro-it","description":"normalize a numeric prop in an array between 0:100","archived":false,"fork":false,"pushed_at":"2015-08-12T18:46:15.000Z","size":120,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T22:39:32.400Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/parro-it.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-12T17:28:19.000Z","updated_at":"2019-07-09T11:52:16.000Z","dependencies_parsed_at":"2022-09-05T04:11:15.229Z","dependency_job_id":null,"html_url":"https://github.com/parro-it/normalize-array-number","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fnormalize-array-number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fnormalize-array-number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fnormalize-array-number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/parro-it%2Fnormalize-array-number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/parro-it","download_url":"https://codeload.github.com/parro-it/normalize-array-number/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246523847,"owners_count":20791444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-26T00:23:53.313Z","updated_at":"2025-03-31T19:17:11.509Z","avatar_url":"https://github.com/parro-it.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# normalize-array-number\n\nnormalize a numeric prop in an array between 0:100\n\n## Installation\n\n```bash\nnpm install --save normalize-array-number\n```\n\n## How it works\n\nGiven an array of objects, normalize a numeric property\nof each object between 0 and 100.\n\nE.g.: `[{n:2}, {n:4}, {n:0}] =\u003e [{n:50}, {n:100}, {n:0}]`\n\nYou can customize min and max value, and you can optionally\nspecify a number of decimal digits to round the values to.\nArray object are changed inplace.\n\n\n\n\n## Usage\n\n```javascript\n  import normalize from 'normalize-array-number';\n  const arr = [{n:2}, {n:4}, {n:0}];\n  const result = normalize(arr, 'n');\n  // result = [{n:50}, {n:100}, {n:0}]\n```\n\n## API\n\n`normalize(arr, options)`\n\n* arr: [REQUIRED] array of objects to normalize\n* options: [REQUIRED] either a string with the name of the property to normalize, or\n  an object containing these properties:\n\n  * prop: [REQUIRED] name of the property to normalize\n  * min: value to assign to the minimum value encountered. Defaults to 0\n  * max: value to assign to the maximum value encountered. Defaults to 100\n  * round: number of decimal digits to round the values to, or false to avoid rounding. Defaults to false.\n\nReturn the same array received in input.\n\n## License\n\nThe MIT License (MIT)\nCopyright (c) 2015 Andrea Parodi\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Fnormalize-array-number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparro-it%2Fnormalize-array-number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparro-it%2Fnormalize-array-number/lists"}