https://github.com/jeroentvb/jeroentvb-helper
A collection of functions I often use in my projects, mostly for developing
https://github.com/jeroentvb/jeroentvb-helper
helper-functions
Last synced: 3 months ago
JSON representation
A collection of functions I often use in my projects, mostly for developing
- Host: GitHub
- URL: https://github.com/jeroentvb/jeroentvb-helper
- Owner: jeroentvb
- License: mit
- Created: 2018-11-20T20:33:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T09:18:25.000Z (over 2 years ago)
- Last Synced: 2024-10-11T19:55:51.725Z (9 months ago)
- Topics: helper-functions
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# helper
A collection of functions I often use in my projects## Installation
```
npm install jeroentvb/helper
```## Usage
```js
const helper = require('jeroentvb-helper')
```## Functions
```js
helper.export.json(name, item, verbose)
helper.export.text(name, item, verbose)
```
Exports an object or array to a .json file in the root of a project.**name**
A string. The name the exported file will have.**item**
Object or array. This will be exported to the contents of the file.**verbose**
Optional
If set to `false`, nothing will be logged to the console. Default is true```js
helper.export.custom(filename, item, verbose)
```
Exports the passed item in a specified format**filename**
A string. The name the exported file will have, this must include the file extension.**item**
Object or array or string. This will be exported to the contents of the file.**verbose**
Optional
If set to `false`, nothing will be logged to the console. Default is true```js
helper.stringify(item)
```
Returns an object, array or anything in form of a nicely formatted, readable string (instead of a single line string). Useful for logging to the console.**item**
The object, array or something else you want to transform into a string.```js
helper.log(item)
```
Logs an item to the console. If it's an object it will be made a little more readable, instead of collapsed.**item**
Object that you want to log to the console.