npm

Need private packages and team management tools?Check out npm Orgs. »

This package has been deprecated

Author message:

Deprecating this in favor of https://www.npmjs.com/package/object-literal-parse

parse-keys-and-values-from-object-literal-strings

1.0.1 • Public • Published

Parse Keys And Values From Object Literal Strings

This library will turn a string like this:

'{ yeah : bro, no : dawg }'

Into:

[
    {
        key : 'yeah',
        value : 'bro'
    },
    {
        key : 'no',
        value : 'dawg'
    }
]

Thats it! Pretty cool huh?

Install it like so: npm install --save-dev parse-keys-and-values-from-object-literal-strings

I use it in my custom attribute library but it could be used in other places as well.

Inspiration: I was implementing something like this for my custom attribute library:

<div on-event='{ click : handleClick, mouseover : handleMouseOver, mouseOut : handleMouseOut }'></div>

Knockout.js does it. Angular does it. Jade does it. Ember does it. Why cant I do it too? Anyways, I reverse engineered it from knockout.js source code. Sue me.

Keywords

none

install

npm i parse-keys-and-values-from-object-literal-strings

Downloadsweekly downloads

7

version

1.0.1

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability