Giter VIP home page Giter VIP logo

jmon's Introduction

JMON (Javascript Mutable Object Notation)

Main idea behind this library is to provide few functionalities over default Javascript Objects.

Installation

Using yarn

yarn add jmon

Usage

var JMON = require('jmon');

const INPUT_DATA = {
  'JMON': {
    'name': 'JMON',
    'author': 'Bibek',
    'url': 'https://github.com/bibekluitel/JMON',
  },
};

const jmonData = new JMON(INPUT_DATA);

/**
 * OUTPUT: jmonData
 * ----------------
 * 
 * JMON({
 *    initialData: {
 *      'JMON': JMON({
 *        initialData: {
 *          'name': 'JMON',
 *          'author': 'Bibek',
 *          'url': 'https://github.com/bibekluitel/JMON',
 *        },
 *        data: {
 *          'name': 'JMON',
 *          'author': 'Bibek',
 *          'url': 'https://github.com/bibekluitel/JMON',
 *        },
 *        'isCreated': false,
 *        'isUpdated': false,
 *        'isDeleted': false
 *      }),
 *    }
 *    data: {
 *      'JMON': JMON({
 *        initialData: {
 *          'name': 'JMON',
 *          'author': 'Bibek',
 *          'url': 'https://github.com/bibekluitel/JMON',
 *        },
 *        data: {
 *          'name': 'JMON',
 *          'author': 'Bibek',
 *          'url': 'https://github.com/bibekluitel/JMON',
 *        },
 *        'isCreated': false,
 *        'isUpdated': false,
 *        'isDeleted': false
 *      }),
 *    }
 *    'isCreated': false,
 *    'isUpdated': false,
 *    'isDeleted': false
 * })

Features

  • set(): This function can be used to change any value at any key or add a new {key:value} in the JMON object


    Example

    jmonData.get('JMON').set('name', 'Arshad');
    
    // OR
    
    jmonData.get('JMON').set('profile': { 'name': 'Arshad', 'role': 'Developer' });
  • get(): This function can be used to fetch value at any level from the JMON object


    Example

    jmonData.get('JMON').get('name');
    
    // OR 
    
    jmonData.get('JMON.name');
  • isModified: This function can be used to check if any level of the object is modified


    Example

    jmon.isModified();
    
    // OR
    
    jmon.get('JMON.name').isModified();
  • commit: This function can be used to commit you current changes, this basically clears all the tracks of changes and treats the changed values as initialValue of the JMON object. (It resets all the isModified flags)


    Example

    jmon.commit();

Errors and Exception:

  • JMON initialization with any primitive types will throw an Error object. It only supports JSON and Arrays of JSON

Contributing

We are constantly working on improving JMON and we need all the help we can get. You can contribute to this project by giving suggestions, fixing open issues or by implementing a new feature. Read our contibution guide here

jmon's People

Contributors

arshadkazmi42 avatar bibekluitel avatar dshved avatar krithika-n avatar

Stargazers

Rakshit Sinha avatar Ashutosh Kumar avatar  avatar  avatar

Watchers

 avatar  avatar

jmon's Issues

should return undefined if constructor argument is not a object.

Describe the bug

if (!isObject(data)){

   // If data provided is not a JSON, The JMON will not be Initialized.
   // This library will not handle data other than a JSON Object.
   console.error(`${data} is not a JSON`);
   return false;
 };

Expected behavior
the constructor should return undefined if the argument is other than JSON Object

Readme Typo Fix

Change this
jmon.get('JMON.name').isMOdified();
to
jmon.get('JMON.name').isModified();

In modified capital O is added. It should be small

Add Linting to Repo.

Need to make the linting of the code base similar across all the contributors. Need to use common vscode linting pattern.

Add Errors & Exceptions in readme

Let's create a sub heading Errors and Exceptions and add all errors related details under this
Important JMON supports JSON and Arrays of JSON. Other types will throw an error. for starting let's move this under that tab,

Let's keep the tab below features

npm 1.0.3 release

We want to do a new release for this on NPM.
The following fixes are included in this

  • Fix of broken contributing guide link #37

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.