Skip to content

michchan/simply-utils

Repository files navigation

Simply Utils

NPM

This is a simple, generic utils library that,

  • is written in a declarative style,
  • aims to compensate the lack of practical usage of some utils library like Lodash,
  • try to make pieces of codes smaller reusable blocks, and
  • is written in and refractored from some frontend React projects.

Feel free to make a pull request or raise a ticket of any issue.

Getting Started

This library is supposed to be used in most modern frontend projects (not limited to React) or some backend Node projects. It is designed to separate each function as a individual module, so that it is easier to implement code splitting.

Prerequisites

This library has major dependencies of:

  • Node (LTS recommended, minimum v8.0)
  • React 16
  • lodash 4

Others should be fine. But feel free to report any dependencies issue.

Installing

Install using npm or yarn:

npm i --save simply-utils
yarn add simply-utils

Usage

  1. Import separately using ES6 module (Recommended. This uses code-splitting style and is most cost-effective.):
    import isStr from 'simply-utils/string/isStr'

    const isString = isStr('testing')
  1. Named import as a whole using ES6 module:
    import utils from 'simply-utils'

    const isString = utils.isStr('testing')
  1. Separate import using ES6 module:
    import { isStr } from 'simply-utils'

    const isString = isStr('testing')
  1. Import using CommonJS
    const utils = require('simply-utils').default

Running the tests

No testing yet. Unit tests are planned to implement.

And coding style tests

  • Declarative programming
  • Stateless, pure function
  • Small code blocks (better controlling between 100-200 lines in a file)

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

Simple and generic JavaScript utils for practical use cases, mainly developed and refractored from frontend projects.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages