fluent-flags
v3.1.1
Published
Decorates a function with arbitrary fluent boolean flags and passes them as the first parameter.
Downloads
290
Readme
Decorates a function with arbitrary fluent boolean flags and passes them as the first parameter.
API
const cb = FluentFlags(
['foo', 'bar'],
flags => (arg: string) => [flags.foo, flags.bar, arg]
)
expect(cb()).toMatchObject([void 0, void 0, void 0])
expect(cb('hello')).toMatchObject([void 0, void 0, 'hello'])
expect(cb.bar('hello')).toMatchObject([void 0, true, 'hello'])
expect(cb.foo.bar('hello')).toMatchObject([true, true, 'hello'])
Contributing
All contributions are welcome!
License
MIT © 2022 stagas