# sp-functions

> Functions for super-project

Latest version **2.1.0** (published 2017-11-10) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install sp-functions
pnpm add sp-functions
yarn add sp-functions
bun add sp-functions
```

## 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 | 2.1.0 |
| Published | 2017-11-10 |
| First published | 2017-10-24 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 12 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | dongwenxiao |
| Maintainers | diablohu, dongwenxiao |
| Keywords | super-project, functions |

## Links

- npm: https://www.npmjs.com/package/sp-functions
- Repository: https://github.com/websage-team/sp-functions
- Homepage: https://github.com/websage-team/sp-functions#readme
- Issues: https://github.com/websage-team/sp-functions/issues
- npm.io page: https://npm.io/package/sp-functions

## Dependencies (12)

- [md5](https://npm.io/package/md5.md) ^2.2.1
- [sha1](https://npm.io/package/sha1.md) ^1.1.1
- [is_js](https://npm.io/package/is_js.md) ^0.9.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [moment](https://npm.io/package/moment.md) ^2.19.1
- [base64-url](https://npm.io/package/base64-url.md) ^2.0.1
- [random-int](https://npm.io/package/random-int.md) ^1.0.0
- [random-item](https://npm.io/package/random-item.md) ^1.0.0
- [random-float](https://npm.io/package/random-float.md) ^1.0.0
- [random-boolean](https://npm.io/package/random-boolean.md) ^1.0.0
- [sp-isomorphic-utils](https://npm.io/package/sp-isomorphic-utils.md) >=1.2.0
- [crypto-random-string](https://npm.io/package/crypto-random-string.md) ^1.0.0

## Recent versions

- 2.1.0 (latest) — 2017-11-10
- 2.0.0 — 2017-11-10
- 1.1.2 — 2017-10-28
- 1.1.1 — 2017-10-25
- 1.1.0 — 2017-10-25
- 1.0.0 — 2017-10-24

## README

# sp-functions
Functions for super-project


# Usage

## is

More: http://is.js.org/
```
const is = require('sp-functions/is')

is.not.array([]) // => false
```

## moment

More: http://momentjs.com/docs/
```
const moment = require('sp-functions/moment')

moment().format('YYYY-MM-DD HH:mm:ss')
```

## random

Random string\int\float\bool\item
```
const random = require('sp-functions/random')

random.string(10) // => adf6f7a8s6 (a-z,0-9)
random.string(10, true) // => aDf6F7a8s6 (a-z,A-Z,0-9)

random.int(5) // => 4 (0-5)
random.int(5, 10) // => 4 (5-10)

random.float(5) // => 4.401887938147411
random.float(10, 100) // => 72.34217455144972

random.bool() // => true

random.item(['a', 'b', 'c']) // => b
```

or

```
const randomString = require('sp-function/random/string')
randomString(10) // => adf6f7a8s6 (a-z,0-9)
```


## crypto

MD5\SHA1\Base64
```
const crypto = require('sp-functions/crypto')

crypto.md5('aa') // => 4124bc0a9335c27f086f24ba207a4912

crypto.sha1('aa') // => e0c9035898dd52fc65c41454cec9c4d2611bfb37

crypto.base64.encode('aa') // => YWE
crypto.base64.decode('YWE') // => aa
```

or

```
const md5 = require('sp-functions/crypto/md5')
md5('aa') // => 4124bc0a9335c27f086f24ba207a4912
```


## isomorphic-tool

TODO: Remove and instead of [sp-isomorphic-utils](https://github.com/websage-team/sp-isomorphic-utils)

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