@moreonion/js-utils

0.1.2 • Public • Published

mo-js-utils

A collection of JavaScript utility functions for use in themes.

Utility functions

  • MO.utils.debounce(func, timeout = 100)
  • MO.utils.storageAvailable(type)

Development

Install nodejs and yarn, then install the needed dependencies:

apt install nodejs yarn
yarn install

Use the different yarn scripts for the development workflow:

yarn run lint
yarn run test
yarn run dev

For building a releaseable artifact (library file) use:

yarn run dist

The development files are configured to be created under build/, the releaseable files are created under dist/.

Advanced use

This project uses Parcel for bundling. For options run:

yarn run parcel --help

Setting the --global MO option publishes the functions via a window.MO global.

In order to build the JavaScript without [hash] in the file name, just use the main.js as entrypoint (not the .html file) when building:

yarn run parcel build --global MO src/main.js

It has eslint and babel configured for the source and test files. Tests are run via mocha, assertions use Node's assert(). Mocking can be done with sinon.

/@moreonion/js-utils/

    Package Sidebar

    Install

    npm i @moreonion/js-utils

    Weekly Downloads

    20

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    6.57 kB

    Total Files

    14

    Last publish

    Collaborators

    • katomat
    • torotil
    • alex-mo
    • katzmo