array-to-hash

Copy array values as hash keys

Usage no npm install needed!

<script type="module">
  import arrayToHash from 'https://cdn.skypack.dev/array-to-hash';
</script>

README

array-to-hash Build Status

Copy array values as hash keys

Install

$ npm install --save array-to-hash

Usage

var arrayToHash = require('array-to-hash')

arrayToHash(['foo', 'bar'])
//=> {foo: undefined, bar: undefined}

API

arrayToHash(array) -> object

Returns an object. The object has no prototype, so inherited object methods like hasOwnProperty will be unavailable.

array

Required
Type: array[strings]

An array of strings to use as hash keys.

License

MIT © Ben Drucker