Skip to content

Commit 5197f4a

Browse files
committed
0.7.8 - add isJSON/isJson and isUUID/isUuid aliases and add CHANGELOG.md
1 parent 90b7c2b commit 5197f4a

7 files changed

Lines changed: 154 additions & 16 deletions

File tree

CHANGELOG.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
Changes not listed here (skipped semver) are typically dependency updates or README fixes.
6+
7+
8+
## [0.7.8] - 2023-05-19
9+
10+
### Added
11+
12+
- (string) `isUUID` / `isUuid` alias
13+
- (string) `isJSON` / `isJson` alias
14+
15+
## [0.7.7] - 2023-03-30
16+
17+
### Added
18+
19+
- (string) `isUuid`
20+
21+
22+
## [0.7.5] - 2021-11-03
23+
24+
### Added
25+
26+
- (string) `isMySqlTimestamp`
27+
28+
29+
## [0.7.0] - 2017-12-10
30+
31+
### Added
32+
33+
- (primitive) `isBoolean`
34+
35+
36+
## [0.5.0] - 2017-11-19
37+
38+
### Added
39+
40+
- babel support and point main package to dist es5 version
41+
42+
43+
## [0.4.0] - 2017-08-24
44+
45+
### Added
46+
47+
- (string) `isTimestamp`
48+
49+
50+
## [0.3.0] - 2017-08-11
51+
52+
### Added
53+
54+
- (number) `isNumeric`
55+
- (string) `isNumericString`
56+
57+
58+
## [0.2.2] - 2017-02-22
59+
60+
### Added
61+
62+
- (string) `isStringOfLengthBetween`
63+
64+
### Fixed
65+
66+
- (number) `isCalendarMonth`
67+
- (number) `isCalendarMonthZeroBased`
68+
69+
70+
## [0.2.1] - 2017-02-22
71+
72+
### Changed
73+
74+
- (number) optimize `isNumberBetween`
75+
76+
77+
## [0.2.0] - 2017-02-22
78+
79+
### Added
80+
81+
- (object) `isObject`
82+
- (object) `isObjectContaining`
83+
- (object) `isObjectAbsent`
84+
- (object) `isObjectMatching`
85+
- (object) `isObjectExtending`
86+
- (object) `isObjectSatisfying`
87+
88+
### Changed
89+
90+
- update to ES6
91+
92+
93+
## [0.1.0] - 2015-12-31
94+
95+
### Added
96+
97+
- (string) `isJSON`
98+
99+
100+
## [0.0.9] - 2015-07-08
101+
102+
### Added
103+
104+
- (number) `isNumericBoolean`
105+
106+
107+
## [0.0.5] - 2015-07-07
108+
109+
### Added
110+
111+
- (number) `numberIsOneOf`
112+
- (string) `stringIsOneOf`
113+
114+
115+
## [0.0.1] - 2015-07-07
116+
117+
### Added
118+
119+
- Initial commit

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ const validateUserOrThrow = V.isObjectOf(userType);
4747
validateUserOrThrow(userType, user);
4848
```
4949

50+
# Interface
51+
- [Strings](#strings)
52+
- [Numbers](#numbers)
53+
- [Arrays](#arrays)
54+
- [Objects](#objects)
55+
- [Primitives](#primitives)
56+
5057
## Strings
5158

5259
### isString
@@ -187,19 +194,29 @@ expect(prr.isNumericString('asd123asd')).toBe(false);
187194
```
188195

189196
---
190-
### isJSON
197+
### isJSON / isJson
191198
String → Boolean
192199
```
193200
expect(prr.isJSON('foo')).toBe(false);
194201
expect(prr.isJSON('{foo:"bar"}')).toBe(false);
195202
expect(prr.isJSON('{}')).toBe(true);
196203
expect(prr.isJSON('{"foo":"bar"}')).toBe(true);
204+
205+
expect(prr.isJson('foo')).toBe(false);
206+
expect(prr.isJson('{foo:"bar"}')).toBe(false);
207+
expect(prr.isJson('{}')).toBe(true);
208+
expect(prr.isJson('{"foo":"bar"}')).toBe(true);
197209
```
198210

199211
---
200-
### isUuid
212+
### isUUID / isUuid
201213
String → Boolean
202214
```
215+
expect(prr.isUUID('foo')).toBe(false);
216+
expect(prr.isUUID(123)).toBe(false);
217+
expect(prr.isUUID('cd17c371-9468-963b-f3e0bf05e70e')).toBe(false);
218+
expect(prr.isUUID('cd17c371-9468-4baa-963b-f3e0bf05e70e')).toBe(true);
219+
203220
expect(prr.isUuid('foo')).toBe(false);
204221
expect(prr.isUuid(123)).toBe(false);
205222
expect(prr.isUuid('cd17c371-9468-963b-f3e0bf05e70e')).toBe(false);

lib/predicates/arrays.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ const R = require('ramda'),
55

66
module.exports = {
77
isArray : R.is(Array),
8-
isArrayOfLength : __.ofLength(Array, 'identical'),
8+
isArrayOfLength : __.ofLength(Array, 'equals'),
99
isArrayOfLengthAtLeast : __.ofLength(Array, 'gte'),
1010
isArrayOfLengthAtMost : __.ofLength(Array, 'lte'),
1111
isArrayLongerThan : __.ofLength(Array, 'gt'),
1212
isArrayShorterThan : __.ofLength(Array, 'lt'),
13-
isArrayContaining : R.contains(R.__),
13+
isArrayContaining : R.includes(R.__),
1414
isEmptyArray : R.allPass([R.is(Array), R.isEmpty])
1515
};

lib/predicates/numbers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const isNumberBetweenInclusive = R.curry((min, max, n) => {
1212
});
1313

1414
const numberIsOneOf = R.curry((selectionArr, num) => {
15-
return R.allPass([R.is(Number), R.contains(R.__, selectionArr)])(num);
15+
return R.allPass([R.is(Number), R.includes(R.__, selectionArr)])(num);
1616
});
1717

1818
const isNumber = R.is(Number),
@@ -25,7 +25,7 @@ const isNumber = R.is(Number),
2525
isEvenNumber = __.modTwoEq(0),
2626
isOddNumber = __.modTwoEq(1),
2727
isNumeric = v => !isNaN(parseInt(v, 10)),
28-
isNumericBoolean = R.contains(R.__, [0, 1]);
28+
isNumericBoolean = R.includes(R.__, [0, 1]);
2929

3030
module.exports = {
3131
isNumber,

lib/predicates/strings.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const R = require('ramda'),
44
__ = require('./_private.js');
55

66
const isString = R.is(String),
7-
isStringOfLength = __.ofLength(String, 'identical'),
7+
isStringOfLength = __.ofLength(String, 'equals'),
88
isStringOfLengthAtLeast = __.ofLength(String, 'gte'),
99
isStringOfLengthAtMost = __.ofLength(String, 'lte'),
1010
isStringLongerThan = __.ofLength(String, 'gt'),
@@ -19,7 +19,7 @@ const isStringMatching = R.curry((pattern, str) => {
1919
});
2020

2121
const stringIsOneOf = R.curry((selectionArr, str) => {
22-
return R.allPass([R.is(String), R.contains(R.__, selectionArr)])(str);
22+
return R.allPass([R.is(String), R.includes(R.__, selectionArr)])(str);
2323
});
2424

2525
const isStringOfLengthBetween = R.curry((min, max, str) => {
@@ -38,7 +38,7 @@ const isTimestamp = R.test(/(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([
3838

3939
const isMySqlTimestamp = R.test(/^([1-2][0-9]{3})-([0-1][0-9])-([0-3][0-9])(?:( [0-2][0-9]):([0-5][0-9]):([0-5][0-9]))?$/);
4040

41-
const isUuid = R.test(/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi);
41+
const isUUID = R.test(/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi);
4242

4343
const isJSON = (str) => {
4444
try {
@@ -66,5 +66,7 @@ module.exports = {
6666
isMySqlTimestamp,
6767
isEmail,
6868
isJSON,
69-
isUuid
69+
isUUID,
70+
isJson : isJSON,
71+
isUuid : isUUID
7072
};

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "prettycats",
3-
"version": "0.7.7",
3+
"version": "0.7.8",
44
"description": "Helpful, common, and curried predicates library built on Ramda.",
55
"main": "dist/prettycats.js",
66
"dependencies": {
7-
"ramda": "^0.27.x"
7+
"ramda": "^0.29.x"
88
},
99
"devDependencies": {
1010
"@babel/cli": "^7.6.4",

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,10 +2435,10 @@ qs@~6.5.2:
24352435
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
24362436
integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==
24372437

2438-
ramda@^0.27.x:
2439-
version "0.27.1"
2440-
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.1.tgz#66fc2df3ef873874ffc2da6aa8984658abacf5c9"
2441-
integrity sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw==
2438+
ramda@^0.29.x:
2439+
version "0.29.0"
2440+
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.29.0.tgz#fbbb67a740a754c8a4cbb41e2a6e0eb8507f55fb"
2441+
integrity sha512-BBea6L67bYLtdbOqfp8f58fPMqEwx0doL+pAi8TZyp2YWz8R9G8z9x75CZI8W+ftqhFHCpEX2cRnUUXK130iKA==
24422442

24432443
read-pkg-up@^4.0.0:
24442444
version "4.0.0"

0 commit comments

Comments
 (0)