|
|
|
@ -96,7 +96,9 @@ export class Pipe<T> {
|
|
|
|
|
* @param op
|
|
|
|
|
*/
|
|
|
|
|
when(check: PipeCondition<T>, op: ReflexivePipeOperator<T>): Pipe<T> {
|
|
|
|
|
if ( (typeof check === 'function' && check(this.subject)) || check ) {
|
|
|
|
|
if (
|
|
|
|
|
(typeof check === 'function' && check(this.subject))
|
|
|
|
|
|| (typeof check !== 'function' && check) ) {
|
|
|
|
|
return Pipe.wrap(op(this.subject))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -111,7 +113,9 @@ export class Pipe<T> {
|
|
|
|
|
* @param op
|
|
|
|
|
*/
|
|
|
|
|
unless(check: PipeCondition<T>, op: ReflexivePipeOperator<T>): Pipe<T> {
|
|
|
|
|
if ( (typeof check === 'function' && check(this.subject)) || check ) {
|
|
|
|
|
if (
|
|
|
|
|
(typeof check === 'function' && check(this.subject))
|
|
|
|
|
|| (typeof check !== 'function' && check) ) {
|
|
|
|
|
return this
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|