# tfilter

> selectively run browserify transforms using globs or a filter function

Latest version **1.0.1** (published 2017-12-07) · Apache-2.0 license · 0 weekly downloads

## Install

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

## 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 | 1.0.1 |
| Published | 2017-12-07 |
| First published | 2017-12-07 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Renée Kooi |
| Maintainers | goto-bus-stop |
| Keywords | browserify, exclude, filter, globs, include, transform |

## Links

- npm: https://www.npmjs.com/package/tfilter
- Repository: https://github.com/goto-bus-stop/tfilter
- Issues: https://github.com/goto-bus-stop/tfilter/issues
- npm.io page: https://npm.io/package/tfilter

## Dependencies (4)

- [defined](https://npm.io/package/defined.md) ^1.0.0
- [resolve](https://npm.io/package/resolve.md) ^1.5.0
- [minimatch](https://npm.io/package/minimatch.md) ^3.0.4
- [shallow-copy](https://npm.io/package/shallow-copy.md) 0.0.1

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-12-07
- 1.0.0 — 2017-12-07

## README

# tfilter

selectively run browserify transforms using globs or a filter function

it is different from most other transform filter packages in that this can be used simply from the CLI.

[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![standard][standard-image]][standard-url]

[npm-image]: https://img.shields.io/npm/v/tfilter.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/tfilter
[travis-image]: https://img.shields.io/travis/goto-bus-stop/tfilter.svg?style=flat-square
[travis-url]: https://travis-ci.org/goto-bus-stop/tfilter
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/standard

## Install

```
npm install tfilter
```

## Usage

```
browserify -t [ tfilter --include '*.js' brfs ]
browserify -t [ tfilter --exclude '**/*.json' envify --NODE_ENV production ]
```

```js
browserify()
  .transform(tfilter(brfs, { include: '*.js' }), { /* options for brfs */ })
  .transform(tfilter(envify, { exclude: /\.json$/ }), { NODE_ENV: 'production' })
  .transform(tfilter(uppercaseify, { filter: function () { return Math.random() < 0.5 } }))
```

### `--include`

Files matching this glob will be transformed. Other files will not be.

### `--exclude`

Files matching this glob will not be transformed. Other files will be.

Using both `--include` and `--exclude` means both conditions apply: A file path must match the `--include` glob **and** must **not** match the `--exclude` glob in order to be transformed.

## Node API

Call `tfilter` with a transform function in the first parameter, and options in the second parameter.
`tfilter(transform, opts)` will return a new transform function that can be passed to browserify.

```js
var babelify = require('babelify')
var tfilter = require('tfilter')

b.transform(
  tfilter(babelify, { include: /\.mjs$/ }),
  { plugins: 'transform-es2015-modules-commonjs' }
)
```

### `include: '' or /./`

Files matching this glob or Regex will be transformed.

### `exclude: '' or /./`

Files matching this glob or Regex will not be transformed.

### `filter: function (filename) {}`

Check if `filename` should be transformed, with some custom logic. If given, `include` and `exclude` are not considered.

## License

[Apache-2.0](LICENSE.md)

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