1.0.5 • Published 10 years ago

optiopus v1.0.5

Weekly downloads
3
License
-
Repository
github
Last release
10 years ago

Optiopus

Build Status Coverage Status Climate Status Issues Open Issue Resolution

Version Node Downloads Slack Status License

Optiopus is a function thats provide a plain object with the tree path of properties and their own values.

Motivation

Sometimes, you need simplify a complex JSON structure to compare objects or iterate several times, so this method provides a flatten object to make easier the access to values. it's really usefull when you want compare two objects without nested child.

NPM GRID

Installation

Install with npm install optiopus --save.

Usage

To use, add the require node module:

    const optiopus = require('optiopus');

    const defs = optiopus({
              'color': '#EFEFEF',
              'font': {
                  'size': '10px',
                  'family': 'Arial'
              },
              'background': {
                  'color': ['rgba', 0, 0, 0, 1]
              }
          }),
          opts = defs.options({
              'color': '#FF0000'
          });

          opts.option('font.size', '11px');
          
          opts.options({
            'font.family': 'Monaco' ,
            'background.color'
          });

    console.log(opts.options);

    /******
    {
      "color": '#FF0000',
      "font": {
          "size": '11px',
          "family": 'Arial'
      },
      "background": {
          "color": [ 'rgba', 0, 0, 0, 1 ]
      }
    }
    *******/

WTF

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.0

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago