# @ed9/utility-lib

> A collection of javascript utilities

Latest version **1.0.6** (published 2018-05-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ed9/utility-lib
pnpm add @ed9/utility-lib
yarn add @ed9/utility-lib
bun add @ed9/utility-lib
```

## 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 | 1.0.6 |
| Published | 2018-05-16 |
| First published | 2018-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Edgars Kohs |
| Maintainers | ed9 |
| Keywords | utils, jsutils, utility |

## Links

- npm: https://www.npmjs.com/package/@ed9/utility-lib
- Repository: https://github.com/ed9/utility-lib
- Homepage: https://github.com/ed9/utility-lib#readme
- Issues: https://github.com/ed9/utility-lib/issues
- npm.io page: https://npm.io/package/@ed9/utility-lib

## Dependencies (3)

- [gulp](https://npm.io/package/gulp.md) ^3.9.1
- [natives](https://npm.io/package/natives.md) ^1.1.3
- [google-closure-compiler](https://npm.io/package/google-closure-compiler.md) ^20180204.0.0

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2018-05-16
- 1.0.5 — 2018-05-16
- 1.0.4 — 2018-05-16
- 1.0.3 — 2018-05-15
- 1.0.2 — 2018-05-15
- 1.0.1 — 2018-05-15
- 1.0.0 — 2018-05-15

## README

# utility-lib

A collection of javascript utilities

Install ----> `npm i @ed9/utility-lib`

Adds global variable `JSUtils` with list of libraries to use.

# Tree
* [JSUtils.Numbers](#working-with-numbers)
* [JSUtils.Numbers.Generic](#format-a-number-with-grouped-thousands)
* [JSUtils.Numbers.Money](#simplify-money-output)
* [JSUtils.Strings](#working-with-strings)
* [JSUtils.Strings.Links.ExtractHostnameFromUrl](#extract-hostname-from-url)
* [JSUtils.Colours](#working-with-colours)
* [JSUtils.Colours.Convert.HexToRgb](#convert-hex-to-rgb)
* [JSUtils.Colours.Convert.HexToRgbAlpha](#convert-hex-to-rgb-alpha)
* [JSUtils.Colours.Convert.AdjustBrightness](#adjust-brightness-of-a-hex-colour-code)
* [JSUtils.Colours.Convert.IdentifyLuminance](#identify-luminance-of-a-colour-code)

## Working with numbers

### Format a number with grouped thousands.

    string Generic ( float Number , int Decimals = 0 , string DecPoint = "." , String ThousandsSep = "," )

#### Examples

    JSUtils.Numbers.Formatting.Generic(1234.56);
    // 1,235
    
    JSUtils.Numbers.Formatting.Generic(1234.56, 2, ',', ' '); 
    // 1 234,56
    
    JSUtils.Numbers.Formatting.Generic(1234.5678, 3, '.', '');
    // 1234.568
    
    JSUtils.Numbers.Formatting.Generic(1234.56, 2, '.', ',');
    // 1,234.56
    
### Simplify money output

*An alias of JSUtils.Numbers.Formatting.Generic(Number, 2, '.', ',');*
	
    string Money( float Number )

#### Examples

	JSUtils.Numbers.Formatting.Money(1235.67);
    // 12,345.67

## Working with strings

### Extract hostname from URL

    string ExtractHostnameFromUrl( string URL )

#### Examples

    JSUtils.Strings.Links.ExtractHostnameFromUrl('https://github.com/ed9/utility-lib');
    // github.com

## Working with colours

### Convert HEX to RGB

    string HexToRgb ( string Hex )

#### Examples

    JSUtils.Colours.Convert.HexToRgb('#ffffff');
    // rgb(255,255,255)
    
### Convert HEX to RGB-Alpha

    string HexToRgbAlpha ( string Hex, float Alpha )

#### Examples

    JSUtils.Colours.Convert.HexToRgbAlpha('#ffffff', 0.5);
    // rgba(255,255,255,0.5)
        
### Adjust brightness of a HEX colour code

    string AdjustBrightness ( string Hex, float Percent )

#### Examples

    JSUtils.Colours.Convert.AdjustBrightness('#f00f00', 0.5);
    // equalivent of sass commad: lighten(#f00f00, 0.5)

    JSUtils.Colours.Convert.AdjustBrightness('#f00f00', -0.5);
    // equalivent of sass commad: darken(#f00f00, 0.5)
    
### Identify luminance of a colour code

    string IdentifyLuminance ( string Hex )

#### Examples

    JSUtils.Colours.Convert.IdentifyLuminance('#fff');
    // "L" - as Light
    
    JSUtils.Colours.Convert.IdentifyLuminance('#000');
    // "D" - as Dark

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