1.0.3 • Published 2 years ago

@benny-otieno/array-to-object v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

SIMPLE ARRAY TO OBJECT MAPPER

Installation

  • Using npm: npm i @benny-otieno/array-to-object
  • Using Yarn: yarn add @benny-otieno/array-to-object

Example

The first argument is the key array and the second argument is the values

const arrayToObject = require("array-to-object");


arrayToObject(["name", "height"], ["Benny", "1.7m"])

result // { name: 'Benny', height: '1.7m' }



arrayToObject(["fruits", "expenses"], [["apples","bananas"], ["rent","transport"]])

result // { fruits: [ 'apples', 'bananas' ], expenses: [ 'rent', 'transport' ] }

License

Author

Feel free to ask me questions on Twitter @CodeManyatta!

Contributors

Feel free to add more features or raise PR's for improvemts. I welcome collaborations.