-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: revert the clarify type change in 5.1.3
The type system needs to overhaul. The clarified type is causing usage problems.
- Loading branch information
Showing
10 changed files
with
17 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
import { Tersible, tersible } from 'tersify' | ||
import { Predicate } from './interfaces' | ||
import { tersible } from 'tersify' | ||
|
||
export function isInOpenInterval(start: number, end: number): Tersible<Predicate> { | ||
export function isInOpenInterval(start: number, end: number) { | ||
return tersible((a: any) => a > start && (a < end), () => `(${start}...${end})`) | ||
} | ||
export function isInClosedInterval(start: number, end: number): Tersible<Predicate> { | ||
export function isInClosedInterval(start: number, end: number) { | ||
return tersible((a: any) => a >= start && a <= end, () => `[${start}...${end}]`) | ||
} | ||
|
||
export function isInLeftClosedInterval(start: number, end: number): Tersible<Predicate> { | ||
export function isInLeftClosedInterval(start: number, end: number) { | ||
return tersible((a: any) => a >= start && (a < end), () => `[${start}...${end})`) | ||
} | ||
|
||
export function isInRightClosedInterval(start: number, end: number): Tersible<Predicate> { | ||
export function isInRightClosedInterval(start: number, end: number) { | ||
return tersible((a: any) => a > start && a <= end, () => `(${start}...${end}]`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
import { Tersible, tersible } from 'tersify' | ||
import { Predicate } from './interfaces' | ||
import { tersible } from 'tersify' | ||
|
||
export function isInRange(start: number, end: number): Tersible<Predicate> { | ||
export function isInRange(start: number, end: number) { | ||
return tersible((a: any) => a >= start && a <= end, () => `[${start}...${end}]`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
import { Tersible, tersible } from 'tersify' | ||
import { Predicate } from './interfaces' | ||
import { tersible } from 'tersify' | ||
|
||
export function isTypeOf(x: 'number' | 'boolean' | 'string'): Tersible<Predicate>{ | ||
export function isTypeOf(x: 'number' | 'boolean' | 'string') { | ||
return tersible( | ||
// tslint:disable-next-line:strict-type-predicates | ||
(a: any) => typeof a === x, | ||
() => `typeof ${x}`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import { Tersible, tersible, tersify } from 'tersify' | ||
import { tersible, tersify } from 'tersify' | ||
import { createSatisfier } from './createSatisfier' | ||
import { Predicate } from './interfaces' | ||
|
||
/** | ||
* Check if an array have no entry satisfying the expectation. | ||
* @param expectation expectation | ||
*/ | ||
export function none(expectation: any): Tersible<Predicate> { | ||
export function none(expectation: any) { | ||
const s = createSatisfier(expectation) | ||
return tersible((e: any) => e && Array.isArray(e) && !e.some(v => s.test(v)), () => `none(${tersify(expectation)})`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
import { Tersible, tersible, tersify } from 'tersify' | ||
import { tersible, tersify } from 'tersify' | ||
import { createSatisfier, Expectation } from './createSatisfier' | ||
import { Predicate } from './interfaces' | ||
|
||
/** | ||
* Check if an array have at least one entry satisfying the expectation. | ||
* @param expectation expectation | ||
*/ | ||
export function some<E extends Expectation>(expectation: E): Tersible<Predicate> { | ||
export function some<E extends Expectation>(expectation: E) { | ||
const s = createSatisfier(expectation) | ||
return tersible((e: any) => e && Array.isArray(e) && e.some(v => s.test(v)), () => `some(${tersify(expectation)})`) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters