# gutil

> GUtil

Latest version **1.6.4** (published 2015-02-25) · 0 weekly downloads

## Install

```sh
npm install gutil
pnpm add gutil
yarn add gutil
bun add gutil
```

## 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.6.4 |
| Published | 2015-02-25 |
| First published | 2014-04-13 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ludo1026 |

## Links

- npm: https://www.npmjs.com/package/gutil
- npm.io page: https://npm.io/package/gutil

## Dependencies (1)

- [sliced](https://npm.io/package/sliced.md) *

## Recent versions

- 1.6.4 (latest) — 2015-02-25
- 1.6.3 — 2015-02-25
- 1.6.2 — 2015-02-25
- 1.6.1 — 2015-02-19
- 1.6.0 — 2015-01-21
- 1.5.5 — 2014-08-29
- 1.5.4 — 2014-08-29
- 1.5.3 — 2014-08-29
- 1.5.2 — 2014-08-29
- 1.5.1 — 2014-08-29
- 1.5.0 — 2014-08-11
- 1.4.3 — 2014-08-03
- 1.4.2 — 2014-08-03
- 1.4.1 — 2014-07-27
- 1.4.0 — 2014-07-23
- … 11 more at https://npm.io/package/gutil/versions

## README

gutil
=====

General Util methods

- **get** : Get object attribute value :
```js
get( {o1:{o2:{o3:{a:1}}}}, "o1.o2.o3.a") // => 1
```
- **has** : Return true if the object has the attribute value :
```js
// array
has( [{a:1,b:1},{a:2,b:2}], "a", 1 ) // => true
has( [{a:1,b:1},{a:2,b:2}], "a", 11 ) // => false
has( [{o1:{a:1,b:1}},{o2:{a:2,b:2}}], "o1.a", 1 ) // => true
has( [{o1:{a:1,b:1}},{o2:{a:2,b:2}}], "o1.a", 11 ) // => false
// object
has( {o:{a:1,b:1}}, "a", 1 ) // => true
has( {o:{a:1,b:1}}, "a", 11 ) // => false
has( {o:{o1:{a:1,b:1},o2:{a:2,b:2}}}, "o1.a", 1 ) // => true
has( {o:{o1:{a:1,b:1},o2:{a:2,b:2}}}, "o1.a", 11 ) // => false
```
- **by** : Select values from an array or an object if they have the attribute value.
```js
// array
by( [{a:1,b:1},{a:2,b:2}], "a", 1 ) // => [{a:1,b:1}]
by( [{a:1,b:1},{a:2,b:2}], "a", 11 ) // => []
by( [{o1:{a:1,b:1}},{o2:{a:2,b:2}}], "o1.a", 1 ) // => [{o1:{a:1,b:1}}]
by( [{o1:{a:1,b:1}},{o2:{a:2,b:2}}], "o1.a", 11 ) // => [{o1:{a:1,b:1}}]
// object
by( {o:{a:1,b:1}}, "a", 1 ) // => [{a:1,b:1}]
by( {o:{a:1,b:1}}, "a", 11 ) // => []
by( {o:{o1:{a:1,b:1},o2:{a:2,b:2}}}, "o1.a", 1 ) // => [{o1:{a:1,b:1}}]
by( {o:{o1:{a:1,b:1},o2:{a:2,b:2}}}, "o1.a", 11 ) // => []
```
- **byNot** : Select values from an array or an object if they do not have the attribute value :
```js
// array
byNot( [{a:1,b:1},{a:2,b:2}], "a", 1 ) // => [{a:2,b:2}]
byNot( [{a:1,b:1},{a:2,b:2}], "a", 2 ) // => [{a:1,b:1}]
byNot( [{a:1,b:1},{a:2,b:2}], "a", 11 ) // => [{a:1,b:1},{a:2,b:2}]
byNot( [{o1:{a:1,b:1}},{o2:{a:2,b:2}}], "o1.a", 1 ) // => [{o2:{a:2,b:2}}]
byNot( [{o1:{a:1,b:1}},{o2:{a:2,b:2}}], "o1.a", 11 ) // => [{o1:{a:1,b:1}},{o2:{a:2,b:2}}]
// object
byNot( {o:{a:1,b:1}}, "a", 1 ) // => []
byNot( {o:{a:1,b:1}}, "a", 2 ) // => [{a:1,b:1}]
byNot( {o:{o1:{a:1,b:1},o2:{a:2,b:2}}}, "o1.a", 1 ) // => [{o2:{a:2,b:2}}]
byNot( {o:{o1:{a:1,b:1},o2:{a:2,b:2}}}, "o1.a", 11 ) // => [{o1:{a:1,b:1}},{o2:{a:2,b:2}}]
```
- **replace2** : scan only one time the text and replace many txt occurences during this scan
sample :
```js
// given
var txt = "simple text";
var oldValues = ["simple","text"];
var newValues = ["hello","world"];
// when
var result = replace2(txt, oldValues, newValues);
// txt == "hello world";
```
- **add** : insert value in an array
- **addAll** : insert values in an array
- **all**
- **and**
- **Assert**
- **concat**
- **each**
- **filter**
- **log**
- **oneBy**
- **requireReload**
- **sort** : sort array elements
- **unique**
- **walk**
- **string** : utils functions for String

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