|
1 | 1 | # array-to-object-keys
|
2 | 2 |
|
3 |
| -[](https://greenkeeper.io/) |
| 3 | + |
| 4 | +<a href="https://raw.githubusercontent.com/Jaid/array-to-object-keys/master/license.txt"><img src="https://img.shields.io/github/license/Jaid/array-to-object-keys?style=flat-square" alt="License"/></a> |
| 5 | +<a href="https://actions-badge.atrox.dev/Jaid/array-to-object-keys/goto"><img src="https://img.shields.io/endpoint.svg?style=flat-square&url=https%3A%2F%2Factions-badge.atrox.dev%2FJaid%2Farray-to-object-keys%2Fbadge" alt="Build status"/></a> <a href="https://github.com/Jaid/array-to-object-keys/commits"><img src="https://img.shields.io/github/commits-since/Jaid/array-to-object-keys/v1.3.5?style=flat-square&logo=github" alt="Commits since v1.3.5"/></a> <a href="https://github.com/Jaid/array-to-object-keys/commits"><img src="https://img.shields.io/github/last-commit/Jaid/array-to-object-keys?style=flat-square&logo=github" alt="Last commit"/></a> <a href="https://github.com/Jaid/array-to-object-keys/issues"><img src="https://img.shields.io/github/issues/Jaid/array-to-object-keys?style=flat-square&logo=github" alt="Issues"/></a> |
| 6 | +<a href="https://npmjs.com/package/array-to-object-keys"><img src="https://img.shields.io/npm/v/array-to-object-keys?style=flat-square&logo=npm&label=latest%20version" alt="Latest version on npm"/></a> <a href="https://github.com/Jaid/array-to-object-keys/network/dependents"><img src="https://img.shields.io/librariesio/dependents/npm/array-to-object-keys?style=flat-square&logo=npm" alt="Dependents"/></a> <a href="https://npmjs.com/package/array-to-object-keys"><img src="https://img.shields.io/npm/dm/array-to-object-keys?style=flat-square&logo=npm" alt="Downloads"/></a> |
| 7 | + |
| 8 | +**Converts an array to an object where the keys are the array entries and the values are customizable in a function.** |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | +## Installation |
| 25 | +<a href="https://npmjs.com/package/array-to-object-keys"><img src="https://img.shields.io/badge/npm-array--to--object--keys-C23039?style=flat-square&logo=npm" alt="array-to-object-keys on npm"/></a> |
| 26 | +```bash |
| 27 | +npm install --save array-to-object-keys@^1.3.5 |
| 28 | +``` |
| 29 | +<a href="https://yarnpkg.com/package/array-to-object-keys"><img src="https://img.shields.io/badge/Yarn-array--to--object--keys-2F8CB7?style=flat-square&logo=yarn&logoColor=white" alt="array-to-object-keys on Yarn"/></a> |
| 30 | +```bash |
| 31 | +yarn add array-to-object-keys@^1.3.5 |
| 32 | +``` |
| 33 | +<a href="https://jsdelivr.com/package/npm/array-to-object-keys/"><img src="https://img.shields.io/badge/jsDelivr-array--to--object--keys-orange?style=flat-square&logo=html5&logoColor=white" alt="array-to-object-keys on jsDelivr"/></a> <a href="https://unpkg.com/browse/array-to-object-keys/"><img src="https://img.shields.io/badge/UNPKG-array--to--object--keys-orange?style=flat-square&logo=html5&logoColor=white" alt="array-to-object-keys on UNPKG"/></a> |
| 34 | +```html |
| 35 | +<script src="https://cdn.jsdelivr.net/npm/array-to-object-keys@1.3.5/index.js"/> |
| 36 | +``` |
| 37 | +
|
| 38 | +
|
| 39 | +## Try it out |
| 40 | +
|
| 41 | +
|
| 42 | +
|
| 43 | +Open a browser's JavaScript console and execute: |
| 44 | +
|
| 45 | +```javascript |
| 46 | +const scriptElement = document.createElement("script"); |
| 47 | +scriptElement.setAttribute("type", "text/javascript"); |
| 48 | +scriptElement.setAttribute("src", "https://cdn.jsdelivr.net/npm/array-to-object-keys@1.3.5/index.js"); |
| 49 | +document.querySelector("head").appendChild(scriptElement); |
| 50 | +``` |
| 51 | +
|
| 52 | +array-to-object-keys is now stored in the global variable `arrayToObjectKeys`. The following console expression should return something other than `"undefined"`. |
| 53 | +
|
| 54 | +```javascript |
| 55 | +typeof arrayToObjectKeys.default |
| 56 | +``` |
| 57 | +
|
| 58 | +
|
| 59 | +
|
| 60 | +
|
| 61 | +
|
| 62 | +
|
| 63 | +## Development |
| 64 | +
|
| 65 | +
|
| 66 | +
|
| 67 | +Setting up: |
| 68 | +```bash |
| 69 | +git clone git@github.com:Jaid/array-to-object-keys.git |
| 70 | +cd array-to-object-keys |
| 71 | +npm install |
| 72 | +``` |
| 73 | +Testing: |
| 74 | +```bash |
| 75 | +npm run test:dev |
| 76 | +``` |
| 77 | +Testing in production environment: |
| 78 | +```bash |
| 79 | +npm run test |
| 80 | +``` |
| 81 | +
|
| 82 | +
|
| 83 | +## License |
| 84 | +```text |
| 85 | +MIT License |
| 86 | +
|
| 87 | +Copyright © 2019, Jaid <jaid.jsx@gmail.com> (github.com/jaid) |
| 88 | +
|
| 89 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 90 | +of this software and associated documentation files (the "Software"), to deal |
| 91 | +in the Software without restriction, including without limitation the rights |
| 92 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 93 | +copies of the Software, and to permit persons to whom the Software is |
| 94 | +furnished to do so, subject to the following conditions: |
| 95 | +
|
| 96 | +The above copyright notice and this permission notice shall be included in all |
| 97 | +copies or substantial portions of the Software. |
| 98 | +
|
| 99 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 100 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 101 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 102 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 103 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 104 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 105 | +SOFTWARE. |
| 106 | +``` |
0 commit comments