Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ae711d6
Added Exact Condition for String Length & Updated README.md
bevatsal1122 Aug 6, 2022
f93cf70
Fixed Small Issue
bevatsal1122 Aug 6, 2022
cdd2192
Updated test/validators.js
bevatsal1122 Aug 6, 2022
27a40c8
Fixed in test/validators.js
bevatsal1122 Aug 6, 2022
cf729d1
Updated test/validators.js for isLength()
bevatsal1122 Aug 6, 2022
be706c4
Updated test/validators.js
bevatsal1122 Aug 6, 2022
db5b0c7
Updated test/validators.js
bevatsal1122 Aug 6, 2022
2e48053
Updated test/validators.js
bevatsal1122 Aug 6, 2022
c194526
Updated test/validators.js
bevatsal1122 Aug 6, 2022
21ec415
Updated test/validators.js
bevatsal1122 Aug 6, 2022
59abfc7
Fixed Small Issue
bevatsal1122 Aug 6, 2022
e1bb810
Fixed Small Issue
bevatsal1122 Aug 6, 2022
7c2c0cf
Fixed Small Issue
bevatsal1122 Aug 6, 2022
3ee58c0
Fixed Small Issue
bevatsal1122 Aug 6, 2022
d3e6ca5
Fixed Small Issue
bevatsal1122 Aug 6, 2022
b850b84
Fixed Small Issue
bevatsal1122 Aug 6, 2022
acfe071
Updated test/validators.js
bevatsal1122 Aug 6, 2022
cdb06a5
Updated test/validators.js
bevatsal1122 Aug 6, 2022
70775b4
Fixed Small Issue
bevatsal1122 Aug 6, 2022
a71b7ff
Renamed isPerfect to isValid
bevatsal1122 Aug 8, 2022
dc42e7f
Removed Backwards Compatibility for exact Feature
bevatsal1122 Aug 13, 2022
fb0def3
Fixed Minor Bug
bevatsal1122 Aug 13, 2022
ec1aa91
Fixed Small Issue
bevatsal1122 Aug 13, 2022
73dc505
Fixed Small Issue
bevatsal1122 Aug 13, 2022
c7605bc
Updated README.md, isLength.js & validators.js Files
bevatsal1122 Aug 13, 2022
93ac65f
Updated validators.js in test Folder
bevatsal1122 Aug 13, 2022
bc693dc
Included exact out of range Test
bevatsal1122 Aug 13, 2022
a90171f
Added Additional Test in validators.js for isLength
bevatsal1122 Aug 14, 2022
57a5633
Update src/lib/isLength.js
bevatsal1122 Nov 12, 2022
642e603
Update isLength.js
bevatsal1122 Nov 12, 2022
bb02daf
Updated discreteLengths only to be array
bevatsal1122 Nov 12, 2022
2a0a428
Resolved minor merged conflicts
bevatsal1122 Nov 12, 2022
1bf1ee4
Fixed minor bug
bevatsal1122 Nov 12, 2022
9fd65ed
Fixed minor bug
bevatsal1122 Nov 12, 2022
fd90691
Fixed tests for isLength
bevatsal1122 Nov 12, 2022
d09738c
Fixed minor bug
bevatsal1122 Nov 12, 2022
11aa19f
Minor test bug fixed
bevatsal1122 Nov 13, 2022
e63e7a5
Fixed minor bug in test/validator.js
bevatsal1122 Nov 13, 2022
3ef2588
Merge branch 'validatorjs:master' into MergeProposal
bevatsal1122 Nov 13, 2022
3b5cbd9
Update src/lib/isLength.js
bevatsal1122 Nov 18, 2022
2897ef9
Added blank lines between statements
bevatsal1122 Nov 18, 2022
22bb2f0
Updated isLength.js
bevatsal1122 Nov 18, 2022
bf34f6c
Merge remote-tracking branch 'origin/master' into 1937-support_exact_…
Suven-p Oct 11, 2024
f1cb604
Fix lint errors
Suven-p Oct 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated README.md, isLength.js & validators.js Files
  • Loading branch information
bevatsal1122 committed Aug 13, 2022
commit c7605bcbe64ff039d11ae62c31da3f4c401b8b2c
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Validator | Description
**isJSON(str [, options])** | check if the string is valid JSON (note: uses JSON.parse).<br/><br/>`options` is an object which defaults to `{ allow_primitives: false }`. If `allow_primitives` is true, the primitives 'true', 'false' and 'null' are accepted as valid JSON values.
**isJWT(str)** | check if the string is valid JWT token.
**isLatLong(str [, options])** | check if the string is a valid latitude-longitude coordinate in the format `lat,long` or `lat, long`.<br/><br/>`options` is an object that defaults to `{ checkDMS: false }`. Pass `checkDMS` as `true` to validate DMS(degrees, minutes, and seconds) latitude-longitude format.
**isLength(str [, options])** | check if the string's length falls in a range and equal to exactValue if provided.<br/><br/>`options` is an object which defaults to `{min:0, max: undefined, exact: undefined}`. Note: this function takes into account surrogate pairs.
**isLength(str [, options])** | check if the string's length falls in a range and equal to `exact` if provided. The `exact` can be an integer, an array or an object of several integers.<br/><br/>`options` is an object which defaults to `{min:0, max: undefined, exact: undefined}`. Note: this function takes into account surrogate pairs.
**isLicensePlate(str [, locale])** | check if string matches the format of a country's license plate.<br/><br/>(locale is one of `['cs-CZ', 'de-DE', 'de-LI', 'fi-FI', 'pt-BR', 'pt-PT', 'sq-AL', 'sv-SE', 'en-IN', 'hi-IN', 'gu-IN', 'as-IN', 'bn-IN', 'kn-IN', 'ml-IN', 'mr-IN', 'or-IN', 'pa-IN', 'sa-IN', 'ta-IN', 'te-IN', 'kok-IN']` or `any`)
**isLocale(str)** | check if the string is a locale
**isLowercase(str)** | check if the string is lowercase.
Expand Down
2 changes: 0 additions & 2 deletions src/lib/isLength.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export default function isLength(str, options) {
isValid = true;
}
}
} else {
isValid = false;
}
return isValid;
}
8 changes: 1 addition & 7 deletions test/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -4629,12 +4629,6 @@ describe('Validators', () => {
valid: [''],
invalid: ['a', 'ab'],
});
test({
validator: 'isLength',
args: [2, 8],
valid: ['Helloo', 'Laptop', 'ab'],
invalid: ['', 'a'],
});
});

it('should validate isLocale codes', () => {
Expand Down Expand Up @@ -4724,7 +4718,7 @@ describe('Validators', () => {
});
test({
validator: 'isLength',
args: [{ exact: 2 }],
args: [{ min: 1, exact: 2 }],
valid: ['fg', 'ff', 'po'],
invalid: ['bsa', 'vfvd', '', 'k'],
});
Expand Down