Skip to content

Commit 2b7c96c

Browse files
committed
input stuff.
1 parent bcc1b55 commit 2b7c96c

3 files changed

Lines changed: 4 additions & 7 deletions

File tree

spec/index.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ test('are arguments equal', t => {
2727
t.false(areArgumentsEqual(['foo', 'bar'], ['foo', 'bar']));
2828

2929
t.true(areArgumentsEqual(Arg.any('array'), ['foo', 'bar']));
30+
t.true(areArgumentsEqual(Arg.is(x => x), ['foo', 'bar']));
3031
});
3132

3233
test('class string field returns', t => {

src/Arguments.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,8 @@ export class Arg {
3535
});
3636
}
3737

38-
static is<T>(value: T): Arg & T
39-
static is<T>(predicate: (input: T) => boolean): Arg & T
40-
static is<T>(predicateOrValue: ((input: T) => boolean) | T): Arg & T {
41-
if(typeof predicateOrValue === 'function')
42-
return new Arg('{arg matching predicate ' + this.toStringify(predicateOrValue) + '}', predicateOrValue) as any;
43-
44-
return new Arg('{arg matching ' + this.toStringify(predicateOrValue) + '}', x => x === predicateOrValue) as any;
38+
static is<T>(predicate: (input: T) => boolean): Arg & T {
39+
return new Arg('{arg matching predicate ' + this.toStringify(predicate) + '}', predicate) as any;
4540
}
4641

4742
private static toStringify(obj: any) {

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Substitute } from './Substitute';
22

3+
export { ObjectSubstitute, PropertySubstitute, FunctionSubstitute } from './Transformations';
34
export { Arg } from './Arguments';
45
export { Substitute };
56

0 commit comments

Comments
 (0)