# passprint

> For debugging functional-programming style, print value and pass it back.

Latest version **0.0.1** (published 2020-05-28) · EPL-2.0 license · 0 weekly downloads

## Install

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

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2020-05-28 |
| First published | 2020-05-28 |
| Weekly downloads | 0 |
| License | EPL-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Eamonn O'Brien-Strain |
| Maintainers | eobrain |
| Keywords | debug, log |

## Links

- npm: https://www.npmjs.com/package/passprint
- Repository: https://github.com/eobrain/passprint
- Homepage: https://github.com/eobrain/passprint#readme
- Issues: https://github.com/eobrain/passprint/issues
- npm.io page: https://npm.io/package/passprint

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 0.0.1 (latest) — 2020-05-28

## README

# passprint -- print a value and return it

Imagine you have a bug in some code that looks like this and you want to inspect the value of `a + x` returned by the reducer.

```js
const dotProd = (v1, v2) =>
  zip(v1, v2).map(pair => pair[0] * pair[1]).reduce((a, x) => a + x, 0)
```

Ideally you would use a debugger, but sometimes that not convenient and you want to just write out the value to the console, but to do that you normally would have to refactor the reducer code.

The `pp` function provides a convenient alternative, like so:

```js
const { pp } = require('passprint')
...
const dotProdPP = (v1, v2) =>
  zip(v1, v2).map(pair => pair[0] * pair[1]).reduce((a, x) => pp(a + x), 0)
```

This will log out lines that look something like:

```
|||||||||MyClass.myFunction myFile.js:46:63 22ms 78878
```

where `22ms` is the time elapsed since logging started and `78878` is the value of `a + x`.  The number of `|` shows the depth of the call stack.

The `pp` simply returns the value passed to it, so it can be used with minimal perturbation to your code.

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