@jsmney/minitools
v2.3.1
Published
Library of helper functions in JavaScript
Downloads
35
Readme
Jasmine's personal NPM JS Utility library
Created in April 2020 in participation of a Mintbean Hackathon. github
Install
$ npm install @jsmney/minitools
Usage
const mini = require('@jsmney/minitools')
// adds one!
mini.addOne(3) // 4
// emulates behavior of the infamous [left-pad](https://www.npmjs.com/package/left-pad)
mini.leftPad('hello', 10) // ' hello'
mini.leftPad(100, 10, '0') // '0000000100'
mini.leftPad(100, 1, '0') // Error: cannot pad, argument is too long
// leftPad, but for all elements in an array
mini.leftPadAll(['hi', 'hello', 'greetings', 'yo'], 15)
// [
// ' hi',
// ' hello',
// ' greetings',
// ' yo'
// ]
// Happy Number checker!
mini.isHappy(19) // true
mini.isHappy(20) // false
Example execution on RunKit
Check it out on my RunKit playground
Requirements
- Create a personal npm library.
- Fill it with methods you would find useful in future projects.
- Publish it to
npm
(you may have to sign up for annpm
account). - Demonstrate that it can be
require
d right fromnpm
, by building a project using Runkit or Codepen
Resources
- I found freeCodeCamp's Tutorial SUPER helpful :)
Additional Links
- Creating and publishing unscoped public packages
- Video - Creating & publishing your own NPM modules
- Testing npm modules locally
- npm-link