array-obj

1.0.0 • Public • Published

What is this ?

Convert arraying to object with option useful for generating cards

Instalation

npm i arr2obj

With import

import {arr2obj} from 'array-obj'

With require

const {arr2obj} = require('array-obj')

USAGE ...

import {arr2obj} from 'arr2obj'


  arr2obj({
    arr: <YOUR_ARRAY_NAME>,       // your array name
    status: <YOUR_ITEM_STATUS>,   // your status name will apply for each item in the array
    Uid: <YOUR_ITEM_STATUS>,       // the id will increase by one for each item
  })


Example ..

import {arr2obj} from 'arr2obj'

let arrTest = ['Alex', 'Jacob', 'Mark'];



  arr2obj({
    arr: arrTest,
    status: 'active',
    Uid: 30,
  })

Return ...

[
  {
    name  : 'Alex',
    status: 'active',
    Uid   : 31
  },
  {
    name  : 'Jacob',
    status: 'active',
    Uid   : 32
  },
  {
    name  : 'Mark',
    status: 'active',
    Uid   : 33
  },
];


Package Sidebar

Install

npm i array-obj

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

1.87 kB

Total Files

3

Last publish

Collaborators

  • m98jk