Utility for your node/frontend application
npm install node-utilify
npm install node-utilify --save
`
Or directly on your browser, simply download your file from the following:
- utilify.js Development version
- utilify.min.js Deployment version
`
`
Recent features added in the library
- Ajax: XHR wrapper for frontend.
- EventManager: Custom event manager.
Some sample utility functions
`
const Utilify = require('node-utilify');
`
`
Utilify.isArray([]); // true
`
`
const httpStatusCodes = Utilify.EnumGenerator({505:'Internal Server Error',404: 'Not Found'});
console.log(httpStatusCodes[505]); // 'Internal Server Error'
console.log(httpStatusCodes['Internal Server Error']); // 505
`
`
console.log(Utilify.getCurrentEpochTime()); // 1605467433
`
`
const defaultsFnc = Utilify.defaultsGenerator({id:1,name:'Sidd'});
console.log(defaultsFnc({name:'JS'})); // {id:1,name:'JS'}
`
`
Utilify.CacheMgr.set('key1', 10);
console.log(Utilify.CacheMgr.get('key1')); // 10
Utilify.CacheMgr.remove('key1');
console.log(Utilify.CacheMgr.get('key1')); // undefined
`
`
Utilify.Ajax.post('https://reqres.in/api/users', {
name: "paul rudd",
movies: ["Role Models"]
}).then(console.log).catch(console.warn);
``