UNPKG

broccoli-directory

Version:

Broccoli Directory provides familiar map/reduce/filter APIs for working with Broccoli Trees. It allows to chain broccoli tree transformations in the same way that you would chain array operations.

20 lines (15 loc) 426 B
import Filter = require('broccoli-filter'); export default class MapFilter extends Filter { private callback; constructor(node, options) { let { annotation, callback } = options; super(node, { annotation }); this.callback = callback; } processString(content: string, relativePath: string) { let result = this.callback(content, relativePath); if (result) { return content; } } }