prop-types
Advanced tools
Comparing version 15.6.1 to 15.6.2
@@ -0,1 +1,7 @@ | ||
## 15.6.2 | ||
* Remove the `fbjs` dependency by inlining some helpers from it ([#194](https://github.com/reactjs/prop-types/pull/194))) | ||
## 15.6.1 | ||
* Fix an issue where outdated BSD license headers were still present in the published bundle [#162](https://github.com/facebook/prop-types/issues/162) | ||
## 15.6.0 | ||
@@ -2,0 +8,0 @@ |
@@ -10,7 +10,20 @@ /** | ||
var printWarning = function() {}; | ||
if (process.env.NODE_ENV !== 'production') { | ||
var invariant = require('fbjs/lib/invariant'); | ||
var warning = require('fbjs/lib/warning'); | ||
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); | ||
var loggedTypeFailures = {}; | ||
printWarning = function(text) { | ||
var message = 'Warning: ' + text; | ||
if (typeof console !== 'undefined') { | ||
console.error(message); | ||
} | ||
try { | ||
// --- Welcome to debugging React --- | ||
// This error was thrown as a convenience so that you can use this stack | ||
// to find the callsite that caused this warning to fire. | ||
throw new Error(message); | ||
} catch (x) {} | ||
}; | ||
} | ||
@@ -40,3 +53,10 @@ | ||
// behavior as without this statement except with a better message. | ||
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]); | ||
if (typeof typeSpecs[typeSpecName] !== 'function') { | ||
var err = Error( | ||
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + | ||
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' | ||
); | ||
err.name = 'Invariant Violation'; | ||
throw err; | ||
} | ||
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); | ||
@@ -46,3 +66,13 @@ } catch (ex) { | ||
} | ||
warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); | ||
if (error && !(error instanceof Error)) { | ||
printWarning( | ||
(componentName || 'React class') + ': type specification of ' + | ||
location + ' `' + typeSpecName + '` is invalid; the type checker ' + | ||
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + | ||
'You may have forgotten to pass an argument to the type checker ' + | ||
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + | ||
'shape all require an argument).' | ||
) | ||
} | ||
if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
@@ -55,3 +85,5 @@ // Only monitor this failure once because there tends to be a lot of the | ||
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); | ||
printWarning( | ||
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') | ||
); | ||
} | ||
@@ -58,0 +90,0 @@ } |
@@ -10,6 +10,6 @@ /** | ||
var emptyFunction = require('fbjs/lib/emptyFunction'); | ||
var invariant = require('fbjs/lib/invariant'); | ||
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); | ||
function emptyFunction() {} | ||
module.exports = function() { | ||
@@ -21,4 +21,3 @@ function shim(props, propName, componentName, location, propFullName, secret) { | ||
} | ||
invariant( | ||
false, | ||
var err = new Error( | ||
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | ||
@@ -28,2 +27,4 @@ 'Use PropTypes.checkPropTypes() to call them. ' + | ||
); | ||
err.name = 'Invariant Violation'; | ||
throw err; | ||
}; | ||
@@ -30,0 +31,0 @@ shim.isRequired = shim; |
@@ -10,5 +10,2 @@ /** | ||
var emptyFunction = require('fbjs/lib/emptyFunction'); | ||
var invariant = require('fbjs/lib/invariant'); | ||
var warning = require('fbjs/lib/warning'); | ||
var assign = require('object-assign'); | ||
@@ -19,2 +16,23 @@ | ||
var printWarning = function() {}; | ||
if (process.env.NODE_ENV !== 'production') { | ||
printWarning = function(text) { | ||
var message = 'Warning: ' + text; | ||
if (typeof console !== 'undefined') { | ||
console.error(message); | ||
} | ||
try { | ||
// --- Welcome to debugging React --- | ||
// This error was thrown as a convenience so that you can use this stack | ||
// to find the callsite that caused this warning to fire. | ||
throw new Error(message); | ||
} catch (x) {} | ||
}; | ||
} | ||
function emptyFunctionThatReturnsNull() { | ||
return null; | ||
} | ||
module.exports = function(isValidElement, throwOnDirectAccess) { | ||
@@ -162,4 +180,3 @@ /* global Symbol */ | ||
// New behavior only for users of `prop-types` package | ||
invariant( | ||
false, | ||
var err = new Error( | ||
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | ||
@@ -169,2 +186,4 @@ 'Use `PropTypes.checkPropTypes()` to call them. ' + | ||
); | ||
err.name = 'Invariant Violation'; | ||
throw err; | ||
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { | ||
@@ -178,11 +197,8 @@ // Old behavior for people using React.PropTypes | ||
) { | ||
warning( | ||
false, | ||
printWarning( | ||
'You are manually calling a React.PropTypes validation ' + | ||
'function for the `%s` prop on `%s`. This is deprecated ' + | ||
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + | ||
'and will throw in the standalone `prop-types` package. ' + | ||
'You may be seeing this warning due to a third-party PropTypes ' + | ||
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', | ||
propFullName, | ||
componentName | ||
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' | ||
); | ||
@@ -231,3 +247,3 @@ manualPropTypeCallCache[cacheKey] = true; | ||
function createAnyTypeChecker() { | ||
return createChainableTypeChecker(emptyFunction.thatReturnsNull); | ||
return createChainableTypeChecker(emptyFunctionThatReturnsNull); | ||
} | ||
@@ -282,4 +298,4 @@ | ||
if (!Array.isArray(expectedValues)) { | ||
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; | ||
return emptyFunction.thatReturnsNull; | ||
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : void 0; | ||
return emptyFunctionThatReturnsNull; | ||
} | ||
@@ -326,4 +342,4 @@ | ||
if (!Array.isArray(arrayOfTypeCheckers)) { | ||
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; | ||
return emptyFunction.thatReturnsNull; | ||
process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; | ||
return emptyFunctionThatReturnsNull; | ||
} | ||
@@ -334,10 +350,7 @@ | ||
if (typeof checker !== 'function') { | ||
warning( | ||
false, | ||
printWarning( | ||
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + | ||
'received %s at index %s.', | ||
getPostfixForTypeWarning(checker), | ||
i | ||
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' | ||
); | ||
return emptyFunction.thatReturnsNull; | ||
return emptyFunctionThatReturnsNull; | ||
} | ||
@@ -344,0 +357,0 @@ } |
{ | ||
"name": "prop-types", | ||
"version": "15.6.1", | ||
"version": "15.6.2", | ||
"description": "Runtime type checking for React props and similar objects.", | ||
@@ -28,3 +28,2 @@ "main": "index.js", | ||
"dependencies": { | ||
"fbjs": "^0.8.16", | ||
"loose-envify": "^1.3.1", | ||
@@ -31,0 +30,0 @@ "object-assign": "^4.1.1" |
@@ -11,7 +11,20 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.PropTypes = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var printWarning = function() {}; | ||
if ("development" !== 'production') { | ||
var invariant = require('fbjs/lib/invariant'); | ||
var warning = require('fbjs/lib/warning'); | ||
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); | ||
var loggedTypeFailures = {}; | ||
printWarning = function(text) { | ||
var message = 'Warning: ' + text; | ||
if (typeof console !== 'undefined') { | ||
console.error(message); | ||
} | ||
try { | ||
// --- Welcome to debugging React --- | ||
// This error was thrown as a convenience so that you can use this stack | ||
// to find the callsite that caused this warning to fire. | ||
throw new Error(message); | ||
} catch (x) {} | ||
}; | ||
} | ||
@@ -41,3 +54,10 @@ | ||
// behavior as without this statement except with a better message. | ||
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]); | ||
if (typeof typeSpecs[typeSpecName] !== 'function') { | ||
var err = Error( | ||
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + | ||
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' | ||
); | ||
err.name = 'Invariant Violation'; | ||
throw err; | ||
} | ||
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); | ||
@@ -47,3 +67,13 @@ } catch (ex) { | ||
} | ||
warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); | ||
if (error && !(error instanceof Error)) { | ||
printWarning( | ||
(componentName || 'React class') + ': type specification of ' + | ||
location + ' `' + typeSpecName + '` is invalid; the type checker ' + | ||
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + | ||
'You may have forgotten to pass an argument to the type checker ' + | ||
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + | ||
'shape all require an argument).' | ||
) | ||
} | ||
if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
@@ -56,3 +86,5 @@ // Only monitor this failure once because there tends to be a lot of the | ||
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); | ||
printWarning( | ||
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') | ||
); | ||
} | ||
@@ -66,3 +98,3 @@ } | ||
},{"./lib/ReactPropTypesSecret":5,"fbjs/lib/invariant":7,"fbjs/lib/warning":8}],2:[function(require,module,exports){ | ||
},{"./lib/ReactPropTypesSecret":5}],2:[function(require,module,exports){ | ||
/** | ||
@@ -77,6 +109,6 @@ * Copyright (c) 2013-present, Facebook, Inc. | ||
var emptyFunction = require('fbjs/lib/emptyFunction'); | ||
var invariant = require('fbjs/lib/invariant'); | ||
var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); | ||
function emptyFunction() {} | ||
module.exports = function() { | ||
@@ -88,4 +120,3 @@ function shim(props, propName, componentName, location, propFullName, secret) { | ||
} | ||
invariant( | ||
false, | ||
var err = new Error( | ||
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | ||
@@ -95,2 +126,4 @@ 'Use PropTypes.checkPropTypes() to call them. ' + | ||
); | ||
err.name = 'Invariant Violation'; | ||
throw err; | ||
}; | ||
@@ -130,3 +163,3 @@ shim.isRequired = shim; | ||
},{"./lib/ReactPropTypesSecret":5,"fbjs/lib/emptyFunction":6,"fbjs/lib/invariant":7}],3:[function(require,module,exports){ | ||
},{"./lib/ReactPropTypesSecret":5}],3:[function(require,module,exports){ | ||
/** | ||
@@ -141,5 +174,2 @@ * Copyright (c) 2013-present, Facebook, Inc. | ||
var emptyFunction = require('fbjs/lib/emptyFunction'); | ||
var invariant = require('fbjs/lib/invariant'); | ||
var warning = require('fbjs/lib/warning'); | ||
var assign = require('object-assign'); | ||
@@ -150,2 +180,23 @@ | ||
var printWarning = function() {}; | ||
if ("development" !== 'production') { | ||
printWarning = function(text) { | ||
var message = 'Warning: ' + text; | ||
if (typeof console !== 'undefined') { | ||
console.error(message); | ||
} | ||
try { | ||
// --- Welcome to debugging React --- | ||
// This error was thrown as a convenience so that you can use this stack | ||
// to find the callsite that caused this warning to fire. | ||
throw new Error(message); | ||
} catch (x) {} | ||
}; | ||
} | ||
function emptyFunctionThatReturnsNull() { | ||
return null; | ||
} | ||
module.exports = function(isValidElement, throwOnDirectAccess) { | ||
@@ -293,4 +344,3 @@ /* global Symbol */ | ||
// New behavior only for users of `prop-types` package | ||
invariant( | ||
false, | ||
var err = new Error( | ||
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | ||
@@ -300,2 +350,4 @@ 'Use `PropTypes.checkPropTypes()` to call them. ' + | ||
); | ||
err.name = 'Invariant Violation'; | ||
throw err; | ||
} else if ("development" !== 'production' && typeof console !== 'undefined') { | ||
@@ -309,11 +361,8 @@ // Old behavior for people using React.PropTypes | ||
) { | ||
warning( | ||
false, | ||
printWarning( | ||
'You are manually calling a React.PropTypes validation ' + | ||
'function for the `%s` prop on `%s`. This is deprecated ' + | ||
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + | ||
'and will throw in the standalone `prop-types` package. ' + | ||
'You may be seeing this warning due to a third-party PropTypes ' + | ||
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', | ||
propFullName, | ||
componentName | ||
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' | ||
); | ||
@@ -362,3 +411,3 @@ manualPropTypeCallCache[cacheKey] = true; | ||
function createAnyTypeChecker() { | ||
return createChainableTypeChecker(emptyFunction.thatReturnsNull); | ||
return createChainableTypeChecker(emptyFunctionThatReturnsNull); | ||
} | ||
@@ -413,4 +462,4 @@ | ||
if (!Array.isArray(expectedValues)) { | ||
"development" !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; | ||
return emptyFunction.thatReturnsNull; | ||
"development" !== 'production' ? printWarning('Invalid argument supplied to oneOf, expected an instance of array.') : void 0; | ||
return emptyFunctionThatReturnsNull; | ||
} | ||
@@ -457,4 +506,4 @@ | ||
if (!Array.isArray(arrayOfTypeCheckers)) { | ||
"development" !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; | ||
return emptyFunction.thatReturnsNull; | ||
"development" !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; | ||
return emptyFunctionThatReturnsNull; | ||
} | ||
@@ -465,10 +514,7 @@ | ||
if (typeof checker !== 'function') { | ||
warning( | ||
false, | ||
printWarning( | ||
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + | ||
'received %s at index %s.', | ||
getPostfixForTypeWarning(checker), | ||
i | ||
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' | ||
); | ||
return emptyFunction.thatReturnsNull; | ||
return emptyFunctionThatReturnsNull; | ||
} | ||
@@ -684,3 +730,3 @@ } | ||
},{"./checkPropTypes":1,"./lib/ReactPropTypesSecret":5,"fbjs/lib/emptyFunction":6,"fbjs/lib/invariant":7,"fbjs/lib/warning":8,"object-assign":9}],4:[function(require,module,exports){ | ||
},{"./checkPropTypes":1,"./lib/ReactPropTypesSecret":5,"object-assign":6}],4:[function(require,module,exports){ | ||
/** | ||
@@ -730,156 +776,2 @@ * Copyright (c) 2013-present, Facebook, Inc. | ||
},{}],6:[function(require,module,exports){ | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
*/ | ||
function makeEmptyFunction(arg) { | ||
return function () { | ||
return arg; | ||
}; | ||
} | ||
/** | ||
* This function accepts and discards inputs; it has no side effects. This is | ||
* primarily useful idiomatically for overridable function endpoints which | ||
* always need to be callable, since JS lacks a null-call idiom ala Cocoa. | ||
*/ | ||
var emptyFunction = function emptyFunction() {}; | ||
emptyFunction.thatReturns = makeEmptyFunction; | ||
emptyFunction.thatReturnsFalse = makeEmptyFunction(false); | ||
emptyFunction.thatReturnsTrue = makeEmptyFunction(true); | ||
emptyFunction.thatReturnsNull = makeEmptyFunction(null); | ||
emptyFunction.thatReturnsThis = function () { | ||
return this; | ||
}; | ||
emptyFunction.thatReturnsArgument = function (arg) { | ||
return arg; | ||
}; | ||
module.exports = emptyFunction; | ||
},{}],7:[function(require,module,exports){ | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
'use strict'; | ||
/** | ||
* Use invariant() to assert state which your program assumes to be true. | ||
* | ||
* Provide sprintf-style format (only %s is supported) and arguments | ||
* to provide information about what broke and what you were | ||
* expecting. | ||
* | ||
* The invariant message will be stripped in production, but the invariant | ||
* will remain to ensure logic does not differ in production. | ||
*/ | ||
var validateFormat = function validateFormat(format) {}; | ||
if ("development" !== 'production') { | ||
validateFormat = function validateFormat(format) { | ||
if (format === undefined) { | ||
throw new Error('invariant requires an error message argument'); | ||
} | ||
}; | ||
} | ||
function invariant(condition, format, a, b, c, d, e, f) { | ||
validateFormat(format); | ||
if (!condition) { | ||
var error; | ||
if (format === undefined) { | ||
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); | ||
} else { | ||
var args = [a, b, c, d, e, f]; | ||
var argIndex = 0; | ||
error = new Error(format.replace(/%s/g, function () { | ||
return args[argIndex++]; | ||
})); | ||
error.name = 'Invariant Violation'; | ||
} | ||
error.framesToPop = 1; // we don't care about invariant's own frame | ||
throw error; | ||
} | ||
} | ||
module.exports = invariant; | ||
},{}],8:[function(require,module,exports){ | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
'use strict'; | ||
var emptyFunction = require('./emptyFunction'); | ||
/** | ||
* Similar to invariant but only logs a warning if the condition is not met. | ||
* This can be used to log issues in development environments in critical | ||
* paths. Removing the logging code for production environments will keep the | ||
* same logic and follow the same code paths. | ||
*/ | ||
var warning = emptyFunction; | ||
if ("development" !== 'production') { | ||
var printWarning = function printWarning(format) { | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
var argIndex = 0; | ||
var message = 'Warning: ' + format.replace(/%s/g, function () { | ||
return args[argIndex++]; | ||
}); | ||
if (typeof console !== 'undefined') { | ||
console.error(message); | ||
} | ||
try { | ||
// --- Welcome to debugging React --- | ||
// This error was thrown as a convenience so that you can use this stack | ||
// to find the callsite that caused this warning to fire. | ||
throw new Error(message); | ||
} catch (x) {} | ||
}; | ||
warning = function warning(condition, format) { | ||
if (format === undefined) { | ||
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); | ||
} | ||
if (format.indexOf('Failed Composite propType: ') === 0) { | ||
return; // Ignore CompositeComponent proptype check. | ||
} | ||
if (!condition) { | ||
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
args[_key2 - 2] = arguments[_key2]; | ||
} | ||
printWarning.apply(undefined, [format].concat(args)); | ||
} | ||
}; | ||
} | ||
module.exports = warning; | ||
},{"./emptyFunction":6}],9:[function(require,module,exports){ | ||
/* | ||
@@ -886,0 +778,0 @@ object-assign |
@@ -1,1 +0,1 @@ | ||
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.PropTypes=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module){"use strict";var emptyFunction=require(4),invariant=require(5),ReactPropTypesSecret=require(3);module.exports=function(){function e(e,r,t,n,p,o){o!==ReactPropTypesSecret&&invariant(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function r(){return e}e.isRequired=e;var t={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:r,element:e,instanceOf:r,node:e,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r};return t.checkPropTypes=emptyFunction,t.PropTypes=t,t}},{3:3,4:4,5:5}],2:[function(require,module){module.exports=require(1)()},{1:1}],3:[function(require,module){"use strict";var ReactPropTypesSecret="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";module.exports=ReactPropTypesSecret},{}],4:[function(require,module){"use strict";function makeEmptyFunction(arg){return function(){return arg}}var emptyFunction=function(){};emptyFunction.thatReturns=makeEmptyFunction,emptyFunction.thatReturnsFalse=makeEmptyFunction(!1),emptyFunction.thatReturnsTrue=makeEmptyFunction(!0),emptyFunction.thatReturnsNull=makeEmptyFunction(null),emptyFunction.thatReturnsThis=function(){return this},emptyFunction.thatReturnsArgument=function(arg){return arg},module.exports=emptyFunction},{}],5:[function(require,module){"use strict";function invariant(condition,format,a,b,c,d,e,f){if(validateFormat(format),!condition){var error;if(void 0===format)error=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var args=[a,b,c,d,e,f],argIndex=0;error=new Error(format.replace(/%s/g,function(){return args[argIndex++]})),error.name="Invariant Violation"}throw error.framesToPop=1,error}}var validateFormat=function(){};module.exports=invariant},{}]},{},[2])(2)}); | ||
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.PropTypes=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module){"use strict";function emptyFunction(){}var ReactPropTypesSecret=require(3);module.exports=function(){function e(e,r,t,o,n,p){if(p!==ReactPropTypesSecret){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function r(){return e}e.isRequired=e;var t={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:r,element:e,instanceOf:r,node:e,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r};return t.checkPropTypes=emptyFunction,t.PropTypes=t,t}},{3:3}],2:[function(require,module){module.exports=require(1)()},{1:1}],3:[function(require,module){"use strict";var ReactPropTypesSecret="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";module.exports=ReactPropTypesSecret},{}]},{},[2])(2)}); |
@@ -25,4 +25,4 @@ # prop-types | ||
If you prefer to exclude `prop-types` from your application and use it | ||
globally via `window.PropTypes`, the `prop-types` package provides | ||
If you prefer to exclude `prop-types` from your application and use it | ||
globally via `window.PropTypes`, the `prop-types` package provides | ||
single-file distributions, which are hosted on the following CDNs: | ||
@@ -48,3 +48,3 @@ | ||
To load a specific version of `prop-types` replace `15.6.0` with the version number. | ||
To load a specific version of `prop-types` replace `15.6.0` with the version number. | ||
@@ -107,10 +107,17 @@ ## Usage | ||
// You can chain any of the above with `isRequired` to make sure a warning | ||
// is shown if the prop isn't provided. | ||
// An object taking on a particular shape | ||
optionalObjectWithShape: PropTypes.shape({ | ||
color: PropTypes.string, | ||
fontSize: PropTypes.number | ||
optionalProperty: PropTypes.string, | ||
requiredProperty: PropTypes.number.isRequired | ||
}), | ||
// You can chain any of the above with `isRequired` to make sure a warning | ||
// is shown if the prop isn't provided. | ||
// An object with warnings on extra properties | ||
optionalObjectWithStrictShape: PropTypes.exact({ | ||
optionalProperty: PropTypes.string, | ||
requiredProperty: PropTypes.number.isRequired | ||
}), | ||
requiredFunc: PropTypes.func.isRequired, | ||
@@ -166,3 +173,3 @@ | ||
"dependencies": { | ||
"prop-types": "^15.5.7" | ||
"prop-types": "^15.5.7" | ||
} | ||
@@ -175,6 +182,6 @@ ``` | ||
"dependencies": { | ||
"prop-types": "^15.5.7" | ||
"prop-types": "^15.5.7" | ||
}, | ||
"peerDependencies": { | ||
"react": "^15.5.0" | ||
"react": "^15.5.0" | ||
} | ||
@@ -181,0 +188,0 @@ ``` |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2
286
0
76276
1451
12
- Removedfbjs@^0.8.16
- Removedasap@2.0.6(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfbjs@0.8.18(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedpromise@7.3.1(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedua-parser-js@0.7.37(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)