# fizzy-ui-utils

> UI utilities

Latest version **3.0.0** (published 2020-12-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install fizzy-ui-utils
pnpm add fizzy-ui-utils
yarn add fizzy-ui-utils
bun add fizzy-ui-utils
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2020-12-19 |
| First published | 2015-01-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 45 |
| Author | David DeSandro |
| Maintainers | desandro |
| Keywords | ui, utility, browser, DOM |

## Links

- npm: https://www.npmjs.com/package/fizzy-ui-utils
- Repository: https://github.com/metafizzy/fizzy-ui-utils
- Issues: https://github.com/metafizzy/fizzy-ui-utils/issues
- npm.io page: https://npm.io/package/fizzy-ui-utils

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2020-12-19
- 2.0.7 — 2018-01-25
- 2.0.6 — 2018-01-24
- 2.0.5 — 2017-04-20
- 2.0.4 — 2017-03-08
- 2.0.3 — 2016-08-19
- 2.0.2 — 2016-05-06
- 2.0.1 — 2016-01-20
- 2.0.0 — 2016-01-08
- 1.0.1 — 2015-04-07
- 1.0.0 — 2015-02-26
- 0.1.1 — 2015-02-03
- 0.1.0 — 2015-01-22

## README

# Fizzy UI utils

UI utility & helper functions

Used in [Flickity](https://flickity.metafizzy.co), [Isotope](https://isotope.metafizzy.co), [Masonry](https://masonry.desandro.com), [Draggabilly](https://draggabilly.desandro.com)

## Install

npm: `npm install fizzy-ui-utils`

Yarn: `yarn add fizzy-ui-utils`

## API

``` js
// browser global
const utils = window.fizzyUIUtils;

// CommonJS
const utils = require('fizzy-ui-utils');

// JavaScript module
import utils from 'fizzy-ui-utils';

// ---- ---- //

utils.makeArray( obj )
// make array from object
// makeArray('single object') => [ 'single object' ]

utils.modulo( num, div )
// num [modulo] div

utils.removeFrom( ary, obj )
// remove object from array

utils.getQueryElement( elem )
// if elem is a string, use it as a selector and return element

MyClass.prototype.handleEvent = utils.handleEvent;
// enable MyClass.onclick when element.addEventListener( 'click', this, false )

utils.filterFindElements( elems, selector )
// iterate through elems, filter and find all elements that match selector

utils.debounceMethod( MyClass, methodName, threhold )
// debounce a class method

utils.docReady( callback )
// trigger callback on document ready

utils.toDashed( str )
// 'camelCaseString' -> 'camel-case-string'

utils.htmlInit( MyClass, namespace )
// on document ready, initialize MyClass on every element
// that matches [data-my-class] attribute
// pass in JSON options from attribute value
```

**Legacy API** The following methods were available in v2, and still available in v3, but should be avoided in favor of native browser API

``` js
utils.extend( a, b )
// extend object
// use Object.assign() or { ...obj } instead

utils.getParent( elem, selector )
// get parent element of an element, given a selector string
// use elem.closest( selector ) instead
```

## Browser support

Fizzy UI utils uses ES2018 features like spread operators and arrow functions. As such its browser support is: Chrome 46+, Firefox 34+, Safari 10+, and Edge 12+.

For older browser support, including IE10 and Android 4, [try v2](https://github.com/metafizzy/fizzy-ui-utils/tree/v2.0.7).

---

[MIT license](https://desandro.mit-license.org/). Have at it.

By [Metafizzy 🌈🐻](https://metafizzy.co)

---
_Source: https://npm.io/package/fizzy-ui-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
