# pug-filters

> Code for processing filters in pug templates

Latest version **4.0.0** (published 2020-05-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install pug-filters
pnpm add pug-filters
yarn add pug-filters
bun add pug-filters
```

## Health

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

Positive: no vulnerabilities; popular repo.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2020-05-25 |
| First published | 2015-12-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21851 |
| Author | Forbes Lindesay |
| Maintainers | forbeslindesay, pug-bot, timothygu |
| Keywords | pug |

## Links

- npm: https://www.npmjs.com/package/pug-filters
- Repository: https://github.com/pugjs/pug/tree/master/packages/pug-filters
- npm.io page: https://npm.io/package/pug-filters

## Dependencies (5)

- [resolve](https://npm.io/package/resolve.md) ^1.15.1
- [pug-walk](https://npm.io/package/pug-walk.md) ^2.0.0
- [pug-error](https://npm.io/package/pug-error.md) ^2.0.0
- [jstransformer](https://npm.io/package/jstransformer.md) 1.0.0
- [constantinople](https://npm.io/package/constantinople.md) ^4.0.1

## Recent versions

- 4.0.0 (latest) — 2020-05-25
- 4.0.0-canary-2 (canary) — 2020-05-25
- 4.0.0-canary-1 — 2020-05-24
- 3.1.1 — 2019-06-18
- 3.1.0 — 2018-03-21
- 3.0.2 — 2018-03-20
- 3.0.1 — 2018-03-08
- 3.0.0 — 2018-03-06
- 2.1.5 — 2017-09-06
- 2.1.4 — 2017-08-01
- 2.1.3 — 2017-06-02
- 2.1.2 — 2017-04-18
- 2.1.1 — 2017-02-04
- 2.1.0 — 2017-01-25
- 2.0.0 — 2017-01-24
- … 7 more at https://npm.io/package/pug-filters/versions

## README

# pug-filters

Code for processing filters in pug templates

[![Build Status](https://img.shields.io/travis/pugjs/pug-filters/master.svg)](https://travis-ci.org/pugjs/pug-filters)
[![Dependencies Status](https://david-dm.org/pugjs/pug/status.svg?path=packages/pug-filters)](https://david-dm.org/pugjs/pug?path=packages/pug-filters)
[![DevDependencies Status](https://david-dm.org/pugjs/pug/dev-status.svg?path=packages/pug-filters)](https://david-dm.org/pugjs/pug?path=packages/pug-filters&type=dev)
[![NPM version](https://img.shields.io/npm/v/pug-filters.svg)](https://www.npmjs.org/package/pug-filters)

## Installation

    npm install pug-filters

## Usage

```
var filters = require('pug-filters');
```

### `filters.handleFilters(ast, filters)`

Renders all `Filter` nodes in a Pug AST (`ast`), using user-specified filters (`filters`) or a JSTransformer.

### `filters.runFilter(name, str[, options[, currentDirectory]])`

Invokes filter through `jstransformer`.

This is internally used in `filters.handleFilters`, and is a lower-level interface exclusively for invoking JSTransformer-based filters.

`name` represents the name of the JSTransformer.

`str` represents the string to render.

`currentDirectory` is used when attempting to `require` the transformer module.

`options` may contain the following properties:

- `minify` (boolean): whether or not to attempt minifying the result from the transformer. If minification fails, the original result is returned.

## License

  MIT

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