Neurosis Prevention Mechanism

    empowerjs

    0.0.1 • Public • Published

    empower.js

    Empower regular JavaScript objects with shorthand routines

    Getting Started

    empower.js works in Node and browsers, and supports amd loaders.

    Install it via NPM:

    npm install empowerjs
    

    or with Bower:

    bower install empowerjs
    

    Functions

    Empower(object|string|number|array|function)

    Creates an empowered version of the passed object

    var man = {
      name: 'superman',
      age: 29,
      spouse: undefined,
      faceMask: null,
      species: 'kryptonians',
      father: {
       name: 'Zor-El'
      },
      category: 'superhero',
      grow: function() {
       this.age++;
      }
    };
     
    $man = Empower(man);
    $man.value(); //return original man object
    $man.name; //superman
    $man.clean(); //man = {name: 'superman'}; (undefined and null values removed)
    $man.$name.spaceOut(); // man.name = s u p e r m a n
    $man.$name.reverse();  // man.name = n a m r e p u s
    $man.$father.$name.reverse();  // man.father.name = 'lE-roZ'
    $man.$species.singularize();  // man.species = 'kryptonian'
    $man.$category.pluralize();  // man.category = 'heroes'
    $man.$grow.run();  // man.age = 30
    $man.$grow.runEvery(2000);  // will run man.grow() every 2 seconds
    $man.$grow.cancelRuns();  // will cancel previous periodic run

    Documentation

    Coming soon.

    Running the tests

    empower.js comes with automated tests that can be run by installing devDependencies and running:

    npm test
    

    Contributing

    Please feel free to add more functions to the suite and submit pull requests to us. If you have a better version of an existing function, that will be highly valued, too.

    Authors

    License

    This project is licensed under the MIT License - see the LICENSE.md file for details

    Install

    npm i empowerjs

    DownloadsWeekly Downloads

    0

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    31.8 kB

    Total Files

    7

    Last publish

    Collaborators

    • ritenv