# @screamingfrog/newtils

> Utilities for Screaming Frog projects.

Latest version **0.5.1** (published 2021-07-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @screamingfrog/newtils
pnpm add @screamingfrog/newtils
yarn add @screamingfrog/newtils
bun add @screamingfrog/newtils
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.1 |
| Published | 2021-07-20 |
| First published | 2021-05-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 1 |
| Unpacked size | 1.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Eben Tuff |
| Maintainers | screamingfrog |

## Links

- npm: https://www.npmjs.com/package/@screamingfrog/newtils
- Repository: https://github.com/screamingfrog/webdev
- Homepage: https://github.com/screamingfrog/webdev#readme
- Issues: https://github.com/screamingfrog/webdev/issues
- npm.io page: https://npm.io/package/@screamingfrog/newtils

## Dependencies (1)

- [bowser](https://npm.io/package/bowser.md) ^2.11.0

## Recent versions

- 0.5.1 (latest) — 2021-07-20
- 0.5.1-testing.0 — 2021-07-20
- 0.5.0 — 2021-07-20
- 0.5.0-testing.4 — 2021-07-19
- 0.5.0-testing.3 — 2021-07-19
- 0.5.0-testing.2 — 2021-07-19
- 0.5.0-testing.1 — 2021-07-19
- 0.5.0-testing — 2021-07-14
- 0.4.1 — 2021-06-24
- 0.4.0 — 2021-06-09
- 0.3.0 — 2021-06-07
- 0.2.1 — 2021-06-04
- 0.2.0 — 2021-06-01
- 0.0.3 — 2021-05-18
- 0.0.2 — 2021-05-07
- … 2 more at https://npm.io/package/@screamingfrog/newtils/versions

## README

# @screamingfrog/newtils

A collection of utility methods and classes to aid in project creation.

## Classes

- `AnimationController` - Start, stop and apply animations to elements.
- `BrowserChecker` - Check the current browser being used, and apply browser-specific class names to the `<body />`.
- `El` - Create and interact with HTML Elements.
- `ElementCache` - Cache results of `querySelector` and `querySelectorAll`.
- `MergeSorter` - Comprehensive array sorter.
- `Table` - Comprehensive `<table />` builder.
- `ZoomPanner` - Add zoom/panning functionality to an `<img />` in a containing element.

## Utilities

### Array

- `findObjects` - Filter an array of objects by a specific key/value pairing.
- `partition` - Split an array into two by a predicate function.
- `sortObjects` - Sort an array of objects, with optional ranking/ignoring functionality.
- `sortPrimitives` - Sort an array of primitives with optional ignoring functionality.
- `splitAt` - Split an array into two at a specified position.
- `toArray` - Wrap values in arrays, if not already an array.
- `toUniques` - Remove duplicate items from an array.

### Boolean

- `toBoolean` - Convert values to their boolean equivalent (incl. "yes", "true" etc.).

### DOM

- `appendChildren` - Append child nodes to a parent element.
- `createElement` - Streamline the HTML Element creation process.
- `delegateEvents` - Group event listeners/handlers logic in one place.
- `generateSocialLinks` - Generate `href` values for specified `<a />` elements based on metadata.
- `makeBackToToppable` - Give an element 'back to top' functionality, as well as classes dependent on scroll position.
- `moveElAtBreakpoint` - Append an element to other elements at respective breakpoints.
- `removeChildren` - Remove child nodes from a parent element.
- `setAttributeOnNodes` - Set an attribute on nodes matching the provided selector.
- `smoothScroll` - Cross-browser smooth scroll functionality.

### Is

- `isBoolean` - Determine if a value is a boolean value.
- `isDefined` - Determine if a value is defined.
- `isFunction` - Determine if a value is a function.
- `isNumber` - Determine if a value is a number.
- `isObject` - Determine if a value is an object.
- `isString` - Determine if a value is a string.
- `isTouchDevice` - Determine if the user is on a touch device.
- `isUnsupportedBrowser` - Determine if the user is on an unsupported browser.

### Maths

- `getRandomNumber` - Generate a random number (optionally: between bounds).
- `getUniqueNumber` - Generate a unique number.
- `isEven` - Determine if a number is even.
- `isOdd` - Determine if a number is odd.
- `modulo` - Custom JavaScript remainder (`%`) function.

### Misc

- `debounce` - Debounces a function [read more](https://css-tricks.com/debouncing-throttling-explained-examples/).
- `easings` - A collection of easing functions.
- `noop` - Does nothing :D
- `throttle` - Throttles a function [read more](https://css-tricks.com/debouncing-throttling-explained-examples/).

### Object

- `deepMerge` - Deeply merges two or more objects.
- `sortKeys` - Sorts an object's keys by ASCII value.

### String

- `capitalise` - Capitalises one word, or all the words, of a string
- `toKebabCase` - Converts from PascalCase to kebab-case.
- `toNumber` - Extracts a number from a string by removing commonly used symbols (e.g. `"£1,000"` -> `1000`)
- `toOrdinal` - Adds appropriate ordinal suffix to a number (e.g. `1` -> `"1st"`)

## Deprecated Classes

- `compat` - Comptability functions for old JavaScript utilities.
- `DepElement` - Deprecated version of `El`.
- `DepEventDelegator` - Deprecated version of `dom/delegateEvents`.
- `DepTable` - Deprecated version of `Table`.
- `MergeSort` - No updated equivalent.
- `State` - No updated equivalent.

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