# hex-lib

> hex calc func

Latest version **1.0.2** (published 2018-10-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install hex-lib
pnpm add hex-lib
yarn add hex-lib
bun add hex-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.2 |
| Published | 2018-10-20 |
| First published | 2018-06-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | bluelovers |
| Keywords | add, and, calc, has, helper, hex, include, not, or, sub, util |

## Links

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

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-10-20
- 1.0.1 — 2018-06-08
- 1.0.0 — 2018-06-08

## README

# hex-lib

    hex helper func

```
npm install hex-lib
```

if u think function name is wrong or not clear mean, wellcome post [issues](https://github.com/bluelovers/hex-lib/issues)

```ts
import { hexAndAny, toHex, hexAnd, hexOr, hexAdd, hexSub, hexAndSub } from '../index';
import POSTAG from './_postag';

let r;
let padLen = 8;

r = hexAndAny(POSTAG.D_N, POSTAG.D_N);

console.log(toHex(r, padLen), r === POSTAG.D_N, r);
// => 0x00100000 true 1048576

r = hexAndAny(POSTAG.D_N | POSTAG.D_T, POSTAG.D_N, POSTAG.D_T);

console.log(toHex(r, padLen), r === POSTAG.D_N, r);
// => 0x00100000 true 1048576

r = hexAndAny(POSTAG.D_N | POSTAG.D_T, POSTAG.D_T, POSTAG.D_N);

console.log(toHex(r, padLen), r === POSTAG.D_T, r);
// => 0x00004000 true 16384

r = hexAdd(0, POSTAG.D_T, POSTAG.D_N);

console.log(toHex(r, padLen), r === (POSTAG.D_T | POSTAG.D_N), r);
// => 0x00104000 true 1064960

r = hexSub((POSTAG.D_T | POSTAG.D_N), POSTAG.D_T);

console.log(toHex(r, padLen), r === (POSTAG.D_N), r);
// => 0x00100000 true 1048576

r = hexAndSub((POSTAG.D_T | POSTAG.D_N), POSTAG.D_T, POSTAG.BAD);
// => 0x00100000 true 1048576

console.log(toHex(r, padLen), r === (POSTAG.D_N), r);

r = hexAndSub((POSTAG.D_T | POSTAG.D_N), POSTAG.D_T, POSTAG.BAD, POSTAG.D_N);

console.log(toHex(r, padLen), r === (0), r);
// => 0x00000000 true 0
```

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