really-useful-js

1.0.8 • Public • Published

install

$ npm i --save really-useful-js

in nodeJS!

    const {
        tryCatch,
        AppError,
        addElementAtIntex,
        removeElementFromArray,
        randomString,
        multiClass,
        getTexctColor
    } = require("really-useful-js");

  <!-- clean code without try{...}catch(e){next(e)} -->
  router.get('/',
    tryCatch(async (req, res, next) => {
      const arrayOfObjects = await objectSchema.list();
      ...
      return res.send(arrayOfObjects);
   }));

  <!-- in your code you can throw --> 
   throw new AppError(message, statusCode);

  <!-- ADD -->
   let arr =  ["Sheldon", "Penny", "Leonard", "Howard"]
   addElementAtIntex(arr, 0, "noZZa")
   console.log(arr);  <!-- ["noZZa", "Sheldon", "Penny", "Leonard", "Howard"] -->

  <!-- REMOVE -->
   const newArr = removeElementFromArray(arr, "Leonard")
   console.log(newArr);  <!-- ["noZZa", "Sheldon", "Penny", "Howard"] -->

  <!-- mylti class for react without [...].join(' ') -->
  console.log(multiClass("noZZa", "Sheldon", "Penny", "Howard"))
  # returns: noZZa Sheldon Penny Howard

  <!-- RANDOM STRING GENERATOR -->
  randomString(10)  <!-- "jkn9mosxoe" -->


  <!-- RETURN LABEL COLOR -->
  getTexctColor('#000000')  <!-- "white" -->
  
  <!-- RETURNS BOOLEAN -->
  testEmail('nozza@gmail.com')  <!-- "true" -->

License

ISC

Package Sidebar

Install

npm i really-useful-js

Weekly Downloads

1

Version

1.0.8

License

ISC

Unpacked Size

5.96 kB

Total Files

7

Last publish

Collaborators

  • nozza