1.0.1 • Published 6 years ago

nicerobjects v1.0.1

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
6 years ago

Better Objects

This module adds 30+ utility functions for objects and a better object class, which saves your objects in a JSON.

Simple Example:

const Methods = new Utility();
const myObj = new BetterObject({}, './save', () => console.log('Something was edited'));


 myObj.BetterObject = {
  version: '0.0.1',
     author: 'GoogleFeud',
     classes: [ 'BetterObject', 'Utility' ],
     documentation: true
}

myObj.Someotherpackage = {
  version: '1.4.5',
     author: 'Hidden',
     classes: [ 'Bettermap' ],
     documentation: false
}

myObj.ThirdObject = {
  version: '0.1.7',
     author: 'Vivi',
     classes: [],
     documentation: true
}

myObj.ForthObject = {};
myObj.FifthObj = 333;

const searchedpackage = Methods.search(myObj, value => value.documentation == false) // Returns: { ... }
console.log(searchedpackage.version) // Returns: '1.4.5'

const navigator = Methods.BetterObjectify(myObj);
navigator.jump(2) // Returns: 'Someotherpackage': { ... } 
.previous() // Returns: 'BetterObjects': { ... }

Methods.getByIndex(myObj, 0) // 'BetterObjects': { ... }
Methods.joinKeys(myObj, '-') // 'BetterObjects-Someotherpackage-ThirdObject-ForthObject-FifthObj'*/

JSON syntax error

If for the object parameter in the BetterObject parameter you don't enter an empty object your JSON might be screwed up, in order to fix it you'll have to run the same code again, or just manually edit it. I know it's annoying but It seems to be a JSON issue. Apologies.

Documentation

BetterObject class

Syntax:

new BetterObject(object, path, listener)

Where object and path are required and listener is optional.

Utility class

Syntax:

new Utility();

Full Documentation

The full documentation is located in this package's github page. (Documentation folder!)