Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from peterkhayes/1.3
changed extend scripts and import method
- Loading branch information
Showing
9 changed files
with
170 additions
and
108 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 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
Import this file to automatically extend ExtendedPropTypes with React's | ||
built-in proptypes. | ||
*/ | ||
|
||
import {PropTypes} from "react"; | ||
import ExtendedPropTypes from "."; | ||
Object.keys(PropTypes).forEach((name) => { | ||
ExtendedPropTypes[name] = PropTypes[name]; | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
Import this file to automatically extend ExtendedPropTypes with the | ||
standalone `prop-types` library's validators. | ||
*/ | ||
|
||
import PropTypes from "prop-types"; | ||
import ExtendedPropTypes from "."; | ||
Object.keys(PropTypes).forEach((name) => { | ||
ExtendedPropTypes[name] = PropTypes[name]; | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1 @@ | ||
import collection from "./validators/collection"; | ||
import collectionOf from "./validators/collectionOf"; | ||
import color from "./validators/color"; | ||
import constant from "./validators/constant"; | ||
import cssLength from "./validators/cssLength"; | ||
import cssSize from "./validators/cssSize"; | ||
import date from "./validators/date"; | ||
import dateBetween from "./validators/dateBetween"; | ||
import elementWithType from "./validators/elementWithType"; | ||
import emailAddress from "./validators/emailAddress"; | ||
import hex from "./validators/hex"; | ||
import iterable from "./validators/iterable"; | ||
import keyedObject from "./validators/keyedObject"; | ||
import keyedObjectOf from "./validators/keyedObjectOf"; | ||
import locale from "./validators/locale"; | ||
import mongoId from "./validators/mongoId"; | ||
import mongoIdKeyedObject from "./validators/mongoIdKeyedObject"; | ||
import mongoIdKeyedObjectOf from "./validators/mongoIdKeyedObjectOf"; | ||
import percent from "./validators/percent"; | ||
import primative from "./validators/primative"; | ||
import stringMatching from "./validators/stringMatching"; | ||
import stringWithLength from "./validators/stringWithLength"; | ||
import time from "./validators/time"; | ||
import timeBetween from "./validators/timeBetween"; | ||
import uuid from "./validators/uuid"; | ||
|
||
const validators = { | ||
collection, | ||
collectionOf, | ||
color, | ||
constant, | ||
cssLength, | ||
cssSize, | ||
date, | ||
dateBetween, | ||
elementWithType, | ||
emailAddress, | ||
hex, | ||
iterable, | ||
keyedObject, | ||
keyedObjectOf, | ||
locale, | ||
mongoId, | ||
mongoIdKeyedObject, | ||
mongoIdKeyedObjectOf, | ||
percent, | ||
primative, | ||
stringMatching, | ||
stringWithLength, | ||
time, | ||
timeBetween, | ||
uuid, | ||
}; | ||
|
||
function extendWithPropTypes (target) { | ||
Object.keys(validators).forEach((name) => { | ||
target[name] = validators[name]; | ||
}); | ||
} | ||
|
||
extendWithPropTypes(extendWithPropTypes); | ||
|
||
module.exports = extendWithPropTypes; | ||
module.exports = process.env.NODE_ENV === "production" ? require("./mocks") : require("./proptypes"); |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
function noop () {}; | ||
function noopThunk () { return noop; } | ||
|
||
module.exports = { | ||
collection: noopThunk, | ||
collectionOf: noopThunk, | ||
color: noopThunk, | ||
constant: noopThunk, | ||
cssLength: noopThunk, | ||
cssSize: noopThunk, | ||
date: noopThunk, | ||
dateBetween: noopThunk, | ||
elementWithType: noopThunk, | ||
emailAddress: noopThunk, | ||
hex: noopThunk, | ||
iterable: noopThunk, | ||
keyedObject: noopThunk, | ||
keyedObjectOf: noopThunk, | ||
locale: noopThunk, | ||
mongoId: noopThunk, | ||
mongoIdKeyedObject: noopThunk, | ||
mongoIdKeyedObjectOf: noopThunk, | ||
percent: noopThunk, | ||
primative: noopThunk, | ||
stringMatching: noopThunk, | ||
stringWithLength: noopThunk, | ||
time: noopThunk, | ||
timeBetween: noopThunk, | ||
uuid: noopThunk, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import collection from "./validators/collection"; | ||
import collectionOf from "./validators/collectionOf"; | ||
import color from "./validators/color"; | ||
import constant from "./validators/constant"; | ||
import cssLength from "./validators/cssLength"; | ||
import cssSize from "./validators/cssSize"; | ||
import date from "./validators/date"; | ||
import dateBetween from "./validators/dateBetween"; | ||
import elementWithType from "./validators/elementWithType"; | ||
import emailAddress from "./validators/emailAddress"; | ||
import hex from "./validators/hex"; | ||
import iterable from "./validators/iterable"; | ||
import keyedObject from "./validators/keyedObject"; | ||
import keyedObjectOf from "./validators/keyedObjectOf"; | ||
import locale from "./validators/locale"; | ||
import mongoId from "./validators/mongoId"; | ||
import mongoIdKeyedObject from "./validators/mongoIdKeyedObject"; | ||
import mongoIdKeyedObjectOf from "./validators/mongoIdKeyedObjectOf"; | ||
import percent from "./validators/percent"; | ||
import primative from "./validators/primative"; | ||
import stringMatching from "./validators/stringMatching"; | ||
import stringWithLength from "./validators/stringWithLength"; | ||
import time from "./validators/time"; | ||
import timeBetween from "./validators/timeBetween"; | ||
import uuid from "./validators/uuid"; | ||
|
||
module.exports = { | ||
collection, | ||
collectionOf, | ||
color, | ||
constant, | ||
cssLength, | ||
cssSize, | ||
date, | ||
dateBetween, | ||
elementWithType, | ||
emailAddress, | ||
hex, | ||
iterable, | ||
keyedObject, | ||
keyedObjectOf, | ||
locale, | ||
mongoId, | ||
mongoIdKeyedObject, | ||
mongoIdKeyedObjectOf, | ||
percent, | ||
primative, | ||
stringMatching, | ||
stringWithLength, | ||
time, | ||
timeBetween, | ||
uuid, | ||
}; |
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