Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/behrad/node-toolbox
Useful node tools
https://github.com/behrad/node-toolbox
Last synced: about 1 month ago
JSON representation
Useful node tools
- Host: GitHub
- URL: https://github.com/behrad/node-toolbox
- Owner: behrad
- Created: 2013-10-06T07:00:08.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-09-25T18:44:09.000Z (over 11 years ago)
- Last Synced: 2024-04-14T18:03:30.197Z (9 months ago)
- Language: JavaScript
- Size: 179 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
node-toolbox
============Useful node tools
## Use json config files:
1. Create ./config/development.js and/or ./config/production.js in proj folder.
2. Import configs as ex below:
```js
var toolbox = require('../index').use({
config:true,
force_env:"production" // defaults to "development"
});console.log(toolbox.config)
// returns -->>>
// { mysql:
// { host: 'mydb.myhost.com',
// user: 'user',
// password: 'pass',
// database: 'test',
// connectionLimit: 4 },
// other: { ex_host: 'otherhost.com' } }var toolbox = require('../index').use({config:true,force_env:'production'})
toolbox.log("Simple string")
// Returns:
// 07/16/13-10:39:25 | Simple stringtoolbox.log({hi:123}) // returns:
// 07/16/13-10:39:37 | ============================== Obj =>
// { hi: 123 }
// <========================================================|toolbox.log("String plus obj is:",{hi:123}) // Returns:
// 07/16/13-10:42:18 | ============================== Obj =>
// Note: String plus obj is:
// { hi: 123 }
// <========================================================|var str = "String type should really be 'String'"
toolbox.log(str, toolbox.getType(str)) // Returns:
// 07/16/13-10:43:53 | ============================== Obj =>
// Note: String type should really be 'String'
// 'String'
// <========================================================|toolbox.log('A number should be a "Number"', toolbox.getType(123))
// 07/16/13-10:44:48 | ============================== Obj =>
// Note: A number should be a "Number"
// 'Number'
// <========================================================|var err = new Error('Error text')
toolbox.err('Optional note', err) // Returns:
// 07/16/13-10:43:53 | ============================== Obj =>
// Note: String type should really be 'String'
// 'String'
// <========================================================|var err = 'Just a string, desc of error'
toolbox.err('Optional note', err) // Returns:
// 07/16/13-10:43:53 | ============================== Obj =>
// Note: String type should really be 'String'
// 'String'
// <========================================================|```