Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.
/ joose-utils Public archive

A lightweight set of utility functions, from the joose component library

Notifications You must be signed in to change notification settings

scoobster17/joose-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Joose Utilities Component

A collection of lightweight, minimal utility helper functions. This component belongs to the Joose component library, but can be used completely independently.

Please see joose for the whole component library.

Installation

To install this component independently using npm

npm install joose-utils

Usage

ES2015+

As of version 2, Joose Utils methods can be imported either individually or collectively:

import utils from '/path/to/node_modules/joose-utils/src/joose-utils';

import { hasClass, addClass } from '/path/to/node_modules/joose-utils/src/joose-utils';

ES5

Simply add the JavaScript onto your page either using a script tag or concatenating/bundling with your own JavaScript:

<script type="text/javascript" src="/path/to/node_modules/joose-utils/dist/joose-utils-es5.js"></script>

You are then good to go using the joose.utils object available in the global namespace:

joose.utils.hasClass(elem, class);
joose.utils.toggleClass(elem, class);

Methods available

  • Class Handling
    • hasClass(elem, class) Check if an element has a class
    • addClass(elem, class) Add a class to an element
    • removeClass(elem, class) Remove a class from an element
    • toggleClass(elem, class) Toggle whether an element has a class or not
  • Conversions
    • convertStringToObject(string, arraySeparator, propertySeparator) Convert a string to an object (used in joose-storage for cookies)
    • convertObjectToString(object, arraySeparator, propertySeparator) Convert an object to a string

About

A lightweight set of utility functions, from the joose component library

Resources

Stars

Watchers

Forks

Packages

No packages published