Skip to content
Mike Byrne edited this page Mar 22, 2023 · 7 revisions

JS Helpers

What?

A collection of documented vanilla JS widgets.

In the A17 Boilerplate, we use these as a dependency and install via NPM. Alternatively you can copy the src folder and the index.js into a folder of your project and compile.

If installed via NPM, you'll want to import into your JavaScript by:

import helpers from '@area17/a17-helpers'

or, cherry pick individual helpers:

import { getCurrentMediaQuery, resized } from '@area17/a17-helpers'

Available helpers

Deprecated

Developing

Feel free to add any vanilla JS helpers that will be common to many projects and save someone some time working them out in the future. The main aims are no dependencies, small elegant code and high potential sharing across sites.

.editorconfig

Download the editor config plugin for your text editor: http://editorconfig.org/#download

no jQuery

Intentionally vanilla JS to keep this JS library agnostic.

Tests

Written using Jest with tests in /test/. To run:

$ npm run test

To add/update a helper

  • Make your changes
  • Bump the version number
  • Test it, you may need to update the tests in /test/
  • Update the wiki document for it if required