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

v1.0.0
This library will turn a string like this: `{ yeah : bro, no : dawg }`

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.

Metadata

  • ISC
  • Whatever
  • Unknown
  • released 7/1/2016

Downloads

Maintainers