# node-simple-utilities

> A nice boilerplate with unit tests, linting and code coverage.

Latest version **1.3.63** (published 2025-12-30) · 0 weekly downloads

## Install

```sh
npm install node-simple-utilities
pnpm add node-simple-utilities
yarn add node-simple-utilities
bun add node-simple-utilities
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.3.63 |
| Published | 2025-12-30 |
| First published | 2020-04-14 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.11.0 |
| Dependencies | 8 |
| Unpacked size | 86.7 KB |
| Known vulnerabilities | 0 (+7 in 4 direct dependencies) |
| Install scripts | no |
| Author | Øistein Sørensen |
| Maintainers | sorenso |

## Links

- npm: https://www.npmjs.com/package/node-simple-utilities
- Repository: https://github.com/5orenso/node-simple-utilities
- Issues: https://github.com/5orenso/node-simple-utilities/issues
- npm.io page: https://npm.io/package/node-simple-utilities

## Dependencies (8)

- [lynx](https://npm.io/package/lynx.md) ^0.2.0
- [mobx](https://npm.io/package/mobx.md) ^5.15.4
- [swig](https://npm.io/package/swig.md) ^1.4.2
- [uuid](https://npm.io/package/uuid.md) ^8.3.2
- [marked](https://npm.io/package/marked.md) ^3.0.4
- [strftime](https://npm.io/package/strftime.md) ^0.10.1
- [jsonwebtoken](https://npm.io/package/jsonwebtoken.md) ^8.5.1
- [fast-type-check](https://npm.io/package/fast-type-check.md) ^1.3.6

## Recent versions

- 1.3.63 (latest) — 2025-12-30
- 1.3.62 — 2025-10-16
- 1.3.61 — 2025-10-08
- 1.3.60 — 2025-10-08
- 1.3.59 — 2025-10-08
- 1.3.58 — 2025-10-08
- 1.3.57 — 2025-10-08
- 1.3.56 — 2025-10-08
- 1.3.55 — 2024-03-13
- 1.3.54 — 2024-01-15
- 1.3.53 — 2024-01-15
- 1.3.52 — 2023-12-29
- 1.3.51 — 2023-12-29
- 1.3.50 — 2023-12-29
- 1.3.49 — 2023-12-29
- … 52 more at https://npm.io/package/node-simple-utilities/versions

## README

# A Node.js collection model for mongoose stuff

[![Build Status](https://travis-ci.org/5orenso/node-simple-utilities.svg?branch=master)](https://travis-ci.org/5orenso/node-simple-utilities)
[![Coverage Status](https://coveralls.io/repos/github/5orenso/node-simple-utilities/badge.svg?branch=master)](https://coveralls.io/github/5orenso/node-simple-utilities?branch=master)
[![GitHub version](https://badge.fury.io/gh/5orenso%2Fnode-simple-utilities.svg)](https://badge.fury.io/gh/5orenso%2Fnode-simple-utilities)
[![npm version](https://badge.fury.io/js/node-simple-utilities.svg)](https://badge.fury.io/js/node-simple-utilities)

## TL;DR

### Installation

```bash
npm install node-simple-utilities --save
```

### Usage

It's easy. Import and use the utilities.

```javascript
const { util } = require('node-simple-utilities');

const formatted = util.format(12345.6789, 2);
// 12 345,68
```

```javascript
const { util } = require('node-simple-utilities');

const config = {
    jwt: {
        secret: 'I am a very secret secret!',
    }
};
const jwtToken = util.makeJwtToken({ email: 'sorenso@gmail.com' }, config);
```

### List of some useful functions

#### util

- format
- formatDate
- epoch
- cleanObject
- indexOf
- length
- makeJwtToken
- decodeJwtToken
- getApiObject
- getApiObjects
- mongoSanitize
- makeSearchObject
- oneline
- uc

#### utilHtml

- fixImageLinksWhiteSpace
- replaceMarked
- inlineImageSize
- replaceDataTags
- replaceAt
- dropFirstLetter
- dropFirstLetterAfterHr
- runPlugins
- cleanHtml
- mapNorwegianLetter
- stripTags
- asUrlSafe
- asHtmlIdSafe
- asLinkPart
- substring
- fixFilename
- removeLineBreaks
- match

#### utilExpress

- isDevelopment
- print
- printIfDev
- restrict
- renderApi
- restrictAPI
- getConsoleColors
- lynxSafe
- logFunctionTimer
- getCommonTemplateValues
- resolveTemplate
- sendResultResponse
- renderPage
- renderError
- loadFile

I promise to add some more documentation, or if you want to help, please follow the instructions below.

## Helper modules in use:

__Jest__ A browser JavaScript testing toolkit. Jest is used by Facebook to test all JavaScript code including React applications. One of Jest's philosophies is to provide an integrated "zero-configuration" experience.

__ESLint__ ESLint is a code style linter for programmatically enforcing your style guide.

__Travis__
Travis CI is a hosted continuous integration service. It is integrated with GitHub and offers first class support for many languages.

__Coveralls.io__
Coveralls is a web service to help you track your code coverage over time, and ensure that all your new code is fully covered.

__Retire__
Scanner detecting the use of JavaScript libraries with known vulnerabilities.


### Howto to get started with contributions

```bash
$ git clone git@github.com:5orenso/node-simple-utilities.git
$ cd node-simple-utilities/
$ npm install
```

Start developing. Remember to start watching your files:
```bash
$ npm run test:watch
```


### HOWTO fix eslint issues
```bash
$ eslint --fix lib/utilities.js
```


### Howto contribute

```bash
$ git clone git@github.com:5orenso/node-simple-utilities.git
```
Do your magic and create a pull request.


### Howto report issues
Use the [Issue tracker](https://github.com/5orenso/node-simple-utilities/issues)


### Howto update CHANGELOG.md
```bash
$ bash ./changelog.sh
```


### Howto update NPM module

1. Bump version inside `package.json`
2. Push all changes to Github.
3. Push all changes to npmjs.com: `$ bash ./npm-release.sh`.


### Howto check for vulnerabilities in modules
```bash
# Install Node Security Platform CLI
$ npm install nsp --global  

# From inside your project directory
$ nsp check  
```


### Howto upgrade modules
```bash
$ sudo npm install -g npm-check-updates
$ ncu -u -a
$ npm install --no-optional
```


### Versioning
For transparency and insight into the release cycle, releases will be
numbered with the follow format:

`<major>.<minor>.<patch>`

And constructed with the following guidelines:

* Breaking backwards compatibility bumps the major
* New additions without breaking backwards compatibility bumps the minor
* Bug fixes and misc changes bump the patch

For more information on semantic versioning, please visit http://semver.org/.


## Contributions and feedback:

We ❤️ contributions and feedback.

If you want to contribute, please check out the [CONTRIBUTING.md](CONTRIBUTING.md) file.

If you have any question or suggestion create an issue.

Bug reports should always be done with a new issue.


## Other Resources

* [Node.js utilities](https://github.com/5orenso/node-simple-utilities)
* [Node.js Preact utilities](https://github.com/5orenso/node-simple-utilities)
* [Node.js Preact Mobx storemodel](https://github.com/5orenso/node-simple-utilities)
* [Node.js boilerplate for Express](https://github.com/5orenso/node-express-boilerplate)
* [Node.js boilerplate for modules](https://github.com/5orenso/node-simple-boilerplate)
* [Node.js boilerplate for Preact](https://github.com/5orenso/preact-boilerplate)


## More about the author

- Twitter: [@sorenso](https://twitter.com/sorenso)
- Instagram: [@sorenso](https://instagram.com/sorenso)
- Facebook: [@sorenso](https://facebook.com/sorenso)

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