Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patch(n4s): use number rules in length rules
- Loading branch information
Showing
5 changed files
with
15 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import bindNot from 'bindNot'; | ||
|
||
import { numberEquals } from 'numberEquals'; | ||
|
||
export function lengthEquals( | ||
value: string | unknown[], | ||
arg1: string | number | ||
): boolean { | ||
return value.length === Number(arg1); | ||
return numberEquals(value.length, arg1); | ||
} | ||
|
||
export const lengthNotEquals = bindNot(lengthEquals); |
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,8 @@ | ||
import { greaterThan } from 'greaterThan'; | ||
|
||
export function longerThan( | ||
value: string | unknown[], | ||
arg1: string | number | ||
): boolean { | ||
return value.length > Number(arg1); | ||
return greaterThan(value.length, arg1); | ||
} |
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,8 @@ | ||
import { greaterThanOrEquals } from 'greaterThanOrEquals'; | ||
|
||
export function longerThanOrEquals( | ||
value: string | unknown[], | ||
arg1: string | number | ||
): boolean { | ||
return value.length >= Number(arg1); | ||
return greaterThanOrEquals(value.length, arg1); | ||
} |
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,8 @@ | ||
import { lessThan } from 'lessThan'; | ||
|
||
export function shorterThan( | ||
value: string | unknown[], | ||
arg1: string | number | ||
): boolean { | ||
return value.length < Number(arg1); | ||
return lessThan(value.length, arg1); | ||
} |
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,8 @@ | ||
import { lessThanOrEquals } from 'lessThanOrEquals'; | ||
|
||
export function shorterThanOrEquals( | ||
value: string | unknown[], | ||
arg1: string | number | ||
): boolean { | ||
return value.length <= Number(arg1); | ||
return lessThanOrEquals(value.length, arg1); | ||
} |