cj

chili-js

A collection of nodeJS shortcuts

Showing:

Popularity

Downloads/wk

9

Maintenance

No Maintenance Data Available

Package

Dependencies

0

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

ChiliJs

Usefuls variables for node env.

## Install NPM

  $ npm install chili-js --save

Yarn

  $ yarn add chili-js

Features / API

Path

  • #### Shortcuts

    • path.join() => join()
    • path.parse() => parse()
    • path.normalize() => normalize()
    • path.relative() => relative_path()
    • path.sep => separator
  • #### Functions

  • String.prototype.relativeTo() It returns path.relative(pth1, pth2) as pth1.relativeTo(pth2)

    ```js
      require('chili-js');
    
      join( home, 'Desktop', 'myFolder' ).relativeTo( join(home, 'Documents') );
      //=> ../../Documents
    ```
    

JSON Shortcuts

  • JSON.jparse() => jparse()
  • JSON.jstringify() => jstringify()

Console Shortcuts

  • console.log() => log()
  • console.warn() => warn()
  • console.error() => err()

FS Shortcuts

  • fs.writeFile() => write()
  • fs.writeFileSync() => writeSync()
  • fs.readFile() => read()
  • fs.readFileSync() => readSync()

Variables

home who is the /Users/<user>/ (~ path) and user who is the <user> in ~ path.

Standalone Functions

  • String.prototype.capitalize(divider, joiner)

    This function provides to capitalize a word.

    ...
      'hello world'.capitalize() //=> 'Hello World'
    

    It can also parse a word

    ...
      'hello-world'.capitalize('-') //=> 'Hello-World'
      'hello-world'.capitalize('-', ' ') //=> 'Hello World'
      'hello world'.capitalize(' ', '-')
      //=> Hello-World
    
  • Array.prototype.sum()

    This function provides to sum all items in array

    ...
      [1, 2, 3].sum()
      //=> 6
    

    If an item in array is not a number it will be ignored.

    ...
      ['a', 15, 'b', 5, 'c'].sum()
      //=> 20
    

    Made with ❤️ by Rawnly

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial