# @pdsl/babel-plugin-pdsl

> This plugin speeds up [`pdsl`](https://github.com/ryardley/pdsl) in babelified codebases by pre-compiling p-expressions to predicate function definitions.

Latest version **5.2.10** (published 2020-04-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @pdsl/babel-plugin-pdsl
pnpm add @pdsl/babel-plugin-pdsl
yarn add @pdsl/babel-plugin-pdsl
bun add @pdsl/babel-plugin-pdsl
```

## 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 | 5.2.10 |
| Published | 2020-04-03 |
| First published | 2019-08-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 27.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | ryardley |

## Links

- npm: https://www.npmjs.com/package/@pdsl/babel-plugin-pdsl
- Repository: https://github.com/ryardley/babel-plugin-pdsl
- Homepage: https://github.com/ryardley/babel-plugin-pdsl#readme
- Issues: https://github.com/ryardley/babel-plugin-pdsl/issues
- npm.io page: https://npm.io/package/@pdsl/babel-plugin-pdsl

## Dependencies (5)

- [@babel/types](https://npm.io/package/@babel/types.md) ^7.5.5
- [@babel/template](https://npm.io/package/@babel/template.md) ^7.4.4
- [@babel/traverse](https://npm.io/package/@babel/traverse.md) ^7.5.5
- [@babel/generator](https://npm.io/package/@babel/generator.md) ^7.5.5
- [@babel/helper-module-imports](https://npm.io/package/@babel/helper-module-imports.md) ^7.0.0

## Recent versions

- 5.2.10 (latest) — 2020-04-03
- 5.2.9 — 2020-04-03
- 5.2.8 — 2020-04-03
- 5.2.7 — 2020-04-03
- 5.2.6 — 2020-03-28
- 5.2.5 — 2020-03-28
- 5.2.4 — 2020-03-28
- 5.2.3 — 2020-03-27
- 5.2.2 — 2020-03-27
- 5.2.1 — 2020-03-27
- 5.2.0 — 2020-03-27
- 5.1.0 — 2020-03-26
- 5.0.3 — 2019-12-12
- 5.0.2 — 2019-12-12
- 5.0.1 — 2019-12-12
- … 19 more at https://npm.io/package/@pdsl/babel-plugin-pdsl/versions

## README

# `@pdsl/babel-plugin-pdsl`

This plugin speeds up [`pdsl`](https://github.com/ryardley/pdsl) in babelified codebases by pre-compiling p-expressions to predicate function definitions.

_This should be considered experimental for the time being._

## Prerequisites

Ensure you have [`pdsl`](https://github.com/ryardley/pdsl) installed in your project.

## Installation

Install the plugin with yarn or npm.

```bash
yarn add --dev @pdsl/babel-plugin-pdsl
```

```bash
npm install -D @pdsl/babel-plugin-pdsl
```

## Configuration

Add the plugin to your `.bablerc`:

```json
{
  "plugins": ["@pdsl/babel-plugin-pdsl"]
}
```

_NOTE: Ensure the plugin is placed before any module resolution plugins._

## How this works

This plugin parses p-expressions and repaces them with function calls:

#### Input

```js
import p from "pdsl";

const notNil = p`!(null|undefined)`;
const hasName = p`{name}`;
const isTrue = p`true`;
const hasNameWithFn = p`{name:${a => a.length > 10}}`;
```

#### Output

```js
import { val, not, or, obj, entry, pred } from "pdsl/helpers";

const notNil = val(not(or(val(null), val(undefined))));
const hasName = val(obj("name"));
const isTrue = val(true);
const hasNameWithFn = val(obj(entry("name", pred(a => a.length > 10))));
```

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