@pdsl/babel-plugin-pdsl v5.2.10
@pdsl/babel-plugin-pdsl
This plugin speeds up 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 installed in your project.
Installation
Install the plugin with yarn or npm.
yarn add --dev @pdsl/babel-plugin-pdslnpm install -D @pdsl/babel-plugin-pdslConfiguration
Add the plugin to your .bablerc:
{
"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
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
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))));6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago