Skip to content

Commit c3b7734

Browse files
TrySoundjquense
authored andcommitted
chore: remove prop-types-extra (jquense#1349)
I found `all(object, customHandler)` can be replaced with `objectOf(customHandler)` so we may drop prop-types-extra package. There is still usage in react-overlays. Gonna send a PR too.
1 parent 94e3679 commit c3b7734

File tree

3 files changed

+21
-26
lines changed

3 files changed

+21
-26
lines changed

.size-snapshot.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
{
22
"./dist/react-big-calendar.js": {
3-
"bundled": 561903,
4-
"minified": 171545,
5-
"gzipped": 50435
3+
"bundled": 560715,
4+
"minified": 171082,
5+
"gzipped": 50325
66
},
77
"./dist/react-big-calendar.min.js": {
8-
"bundled": 498126,
9-
"minified": 152147,
10-
"gzipped": 45902
8+
"bundled": 496938,
9+
"minified": 151688,
10+
"gzipped": 45761
1111
},
1212
"dist/react-big-calendar.esm.js": {
13-
"bundled": 169800,
14-
"minified": 81627,
15-
"gzipped": 20102,
13+
"bundled": 169709,
14+
"minified": 81558,
15+
"gzipped": 20076,
1616
"treeshaked": {
1717
"rollup": {
18-
"code": 63039,
19-
"import_statements": 1418
18+
"code": 62946,
19+
"import_statements": 1378
2020
},
2121
"webpack": {
22-
"code": 66506
22+
"code": 66385
2323
}
2424
}
2525
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@
128128
"lodash": "^4.17.11",
129129
"memoize-one": "^4.0.3",
130130
"prop-types": "^15.6.2",
131-
"prop-types-extra": "^1.1.0",
132131
"react-overlays": "^1.2.0",
133132
"uncontrollable": "^6.0.0",
134133
"warning": "^4.0.2"

src/utils/propTypes.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import PropTypes from 'prop-types'
2-
import all from 'prop-types-extra/lib/all'
32
import { views as Views } from './constants'
43

54
let viewNames = Object.keys(Views).map(k => Views[k])
@@ -27,19 +26,16 @@ export let dateRangeFormat = PropTypes.func
2726
* }}
2827
* ```
2928
*/
29+
3030
export let views = PropTypes.oneOfType([
3131
PropTypes.arrayOf(PropTypes.oneOf(viewNames)),
32-
all(PropTypes.object, (props, name, ...args) => {
33-
let prop = props[name],
34-
err
35-
36-
Object.keys(prop).every(key => {
37-
let isBuiltinView =
38-
viewNames.indexOf(key) !== -1 && typeof prop[key] === 'boolean'
39-
40-
return isBuiltinView || !(err = PropTypes.elementType(prop, key, ...args))
41-
})
42-
43-
return err || null
32+
PropTypes.objectOf((prop, key, ...args) => {
33+
let isBuiltinView =
34+
viewNames.indexOf(key) !== -1 && typeof prop[key] === 'boolean'
35+
if (isBuiltinView) {
36+
return null
37+
} else {
38+
return PropTypes.elementType(prop, key, ...args)
39+
}
4440
}),
4541
])

0 commit comments

Comments
 (0)