new ConText(targetopt)
- Source:
Creates an isolated filters context for evaluating strings
Example
import { ConText } from '@triskel/con-text'
const TEXT = new ConText()
TEXT.defineFilter('foo', (input) => input + ':foo' )
TEXT.eval(' name | foo', { name: 'John' })
// return 'John:foo'
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
target |
* |
<optional> |
only pass a target when not creating a new ConText instance, otherwise it will drop an exception |