{"id":13588455,"url":"https://github.com/justinlettau/hash-value","last_synced_at":"2025-04-08T06:32:03.958Z","repository":{"id":34688667,"uuid":"182617893","full_name":"justinlettau/hash-value","owner":"justinlettau","description":"Get a consistent value from an array based on a string value.","archived":false,"fork":false,"pushed_at":"2024-07-25T03:29:41.000Z","size":179,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-11T01:12:00.878Z","etag":null,"topics":["avatar","color","consistent","hash","permanent","string"],"latest_commit_sha":null,"homepage":null,"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/justinlettau.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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}},"created_at":"2019-04-22T03:38:26.000Z","updated_at":"2024-07-25T03:29:44.000Z","dependencies_parsed_at":"2023-01-15T08:45:31.609Z","dependency_job_id":"14e60291-1c24-46dd-82b2-4fa26fe1731d","html_url":"https://github.com/justinlettau/hash-value","commit_stats":{"total_commits":36,"total_committers":6,"mean_commits":6.0,"dds":"0.36111111111111116","last_synced_commit":"236b2fd2f51516b705b44e724df327f7eea1b39d"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlettau%2Fhash-value","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlettau%2Fhash-value/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlettau%2Fhash-value/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justinlettau%2Fhash-value/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justinlettau","download_url":"https://codeload.github.com/justinlettau/hash-value/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247792075,"owners_count":20996876,"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":["avatar","color","consistent","hash","permanent","string"],"created_at":"2024-08-01T15:06:43.531Z","updated_at":"2025-04-08T06:32:02.942Z","avatar_url":"https://github.com/justinlettau.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"[![NPM Version](https://badge.fury.io/js/hash-value.svg)](https://badge.fury.io/js/hash-value)\n[![CI](https://github.com/justinlettau/hash-value/workflows/CI/badge.svg)](https://github.com/justinlettau/hash-value/actions)\n[![codecov](https://codecov.io/gh/justinlettau/hash-value/branch/master/graph/badge.svg?token=mKNrIeh3mX)](https://codecov.io/gh/justinlettau/hash-value)\n\n\n# Hash Value\n\nGet a consistent value from an array based on a string value.\n\n# Table of Contents\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [Examples](#examples)\n  - [Material UI Avatar](#material-ui-avatar)\n- [Development](#development)\n\n# Installation\n\n```bash\nnpm install hash-value --save\n```\n\n# Usage\n\n```js\nimport hashValue from 'hash-value';\n\n// colors from https://www.materialui.co/flatuicolors\nconst colors = [\n  '#1abc9c', // Turquoise\n  '#2ecc71', // Emerald\n  '#3498db', // Peterriver\n  '#9b59b6', // Amethyst\n  '#34495e', // Wetasphalt\n  '#f1c40f', // Sunflower\n  '#e67e22', // Carrot\n  '#e74c3c', // Alizarin\n];\n\nhashValue('Luke Skywalker', colors);\n// =\u003e #3498db\n```\n\n# Example\n\n## Material UI Avatar\n\n```js\nimport Avatar from '@material-ui/core/Avatar';\nimport {\n  blue,\n  green,\n  orange,\n  purple,\n  red,\n  teal,\n} from '@material-ui/core/colors';\nimport hashValue from 'hash-value';\n\nconst colors = [\n  blue[500],\n  green[500],\n  orange[500],\n  purple[500],\n  red[500],\n  teal[500],\n];\n\nfunction ColorAvatar(props) {\n  const { name } = props;\n  const bg = hashValue(name, colors);\n\n  return \u003cAvatar style={{ backgroundColor: bg }}\u003e{name.charAt(0)}\u003c/Avatar\u003e;\n}\n```\n\n# Development\n\n```\nnpm install\nnpm run build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinlettau%2Fhash-value","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustinlettau%2Fhash-value","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustinlettau%2Fhash-value/lists"}