get-attr

0.0.4 • Public • Published

get-attr

This small function allows to extract properties of objects and array

import get from 'get-attr';

let data = {
    user : {
        name : 'Matias Trujillo',
        skills : [
            'js',
            'php',
            'css',
            'html',
            'sql',
            'nosql',
        ]
    }
}

get(data,'user.skills[0]') // js
get(data,'user.skills[9]') // undefined
get(data,'user.skills[10]','scss') // scss

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i get-attr

    Weekly Downloads

    2

    Version

    0.0.4

    License

    ISC

    Unpacked Size

    161 kB

    Total Files

    16

    Last publish

    Collaborators

    • uppercod