code
stringlengths
24
2.07M
docstring
stringlengths
25
85.3k
func_name
stringlengths
1
92
language
stringclasses
1 value
repo
stringlengths
5
64
path
stringlengths
4
172
url
stringlengths
44
218
license
stringclasses
7 values
function validateMethodOverride(proto, name) { var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; // Disallow overriding of base class methods unless explicitly allowed. if (ReactClassMixin.hasOwnProperty(name)) { !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? "develo...
Special case getDefaultProps which should move into statics but requires automatic merging.
validateMethodOverride
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function mixSpecIntoComponent(Constructor, spec) { if (!spec) { return; } !(typeof spec !== 'function') ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined; !!React...
Mixin helper which handles policy validation and reserved specification keys when building React classses.
mixSpecIntoComponent
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function mixStaticSpecIntoComponent(Constructor, statics) { if (!statics) { return; } for (var name in statics) { var property = statics[name]; if (!statics.hasOwnProperty(name)) { continue; } var isReserved = (name in RESERVED_SPEC_KEYS); !!isReserved ? "development" !== 'productio...
Mixin helper which handles policy validation and reserved specification keys when building React classses.
mixStaticSpecIntoComponent
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function mergeIntoWithNoDuplicateKeys(one, two) { !(one && two && typeof one === 'object' && typeof two === 'object') ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined; for (var key in two) { if (two.hasOwnProperty(ke...
Merge two objects, but throw if both contain the same key. @param {object} one The first object, which is mutated. @param {object} two The second object @return {object} one after it has been mutated to contain everything in two.
mergeIntoWithNoDuplicateKeys
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createMergedResultFunction(one, two) { return function mergedResult() { var a = one.apply(this, arguments); var b = two.apply(this, arguments); if (a == null) { return b; } else if (b == null) { return a; } var c = {}; mergeIntoWithNoDuplicateKeys(c, a); mergeIntoW...
Creates a function that invokes two functions and merges their return values. @param {function} one Function to invoke first. @param {function} two Function to invoke second. @return {function} Function that invokes the two argument functions. @private
createMergedResultFunction
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createChainedFunction(one, two) { return function chainedFunction() { one.apply(this, arguments); two.apply(this, arguments); }; }
Creates a function that invokes two functions and ignores their return vales. @param {function} one Function to invoke first. @param {function} two Function to invoke second. @return {function} Function that invokes the two argument functions. @private
createChainedFunction
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function bindAutoBindMethod(component, method) { var boundMethod = method.bind(component); if ("development" !== 'production') { boundMethod.__reactBoundContext = component; boundMethod.__reactBoundMethod = method; boundMethod.__reactBoundArguments = null; var componentName = component.constructor.d...
Binds a method to the component. @param {object} component Component whose method is going to be bound. @param {function} method Method to be bound. @return {function} The bound method.
bindAutoBindMethod
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function bindAutoBindMethods(component) { for (var autoBindKey in component.__reactAutoBindMap) { if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) { var method = component.__reactAutoBindMap[autoBindKey]; component[autoBindKey] = bindAutoBindMethod(component, method); } } }
Binds all auto-bound methods in a component. @param {object} component Component whose method is going to be bound.
bindAutoBindMethods
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
Constructor = function (props, context, updater) { // This constructor is overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if ("development" !== 'production') { "development" !== 'production' ? warning(this instanceof Constructor, 'Something is calling a R...
Creates a composite component class given a class specification. @param {object} spec Class specification (which must define `render`). @return {function} Component constructor function. @public
Constructor
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function ReactComponent(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue; }
Base class helpers for the updating state of a component.
ReactComponent
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
defineDeprecationWarning = function (methodName, info) { if (canDefineProperty) { Object.defineProperty(ReactComponent.prototype, methodName, { get: function () { "development" !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) ...
Deprecated APIs. These APIs used to exist on classic React classes but since we would like to deprecate them, we're not going to move them over to this modern base class. Instead, we define a getter that warns if it's accessed.
defineDeprecationWarning
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function assertValidProps(component, props) { if (!props) { return; } // Note the use of `==` which checks for null or undefined. if ("development" !== 'production') { if (voidElementTags[component._tag]) { "development" !== 'production' ? warning(props.children == null && props.dangerouslySetInne...
@param {object} component @param {?object} props
assertValidProps
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function enqueuePutListener(id, registrationName, listener, transaction) { if ("development" !== 'production') { // IE8 has no API for event capturing and the `onScroll` event doesn't // bubble. "development" !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), '...
@param {object} component @param {?object} props
enqueuePutListener
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function putListener() { var listenerToPut = this; ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener); }
@param {object} component @param {?object} props
putListener
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function trapBubbledEventsLocal() { var inst = this; // If a component renders to null or if another component fatals and causes // the state of the tree to be corrupted, `node` here can be null. !inst._rootNodeID ? "development" !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(...
@param {object} component @param {?object} props
trapBubbledEventsLocal
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validateDangerousTag(tag) { if (!hasOwnProperty.call(validatedTagCache, tag)) { !VALID_TAG_REGEX.test(tag) ? "development" !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined; validatedTagCache[tag] = true; } }
@param {object} component @param {?object} props
validateDangerousTag
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function processChildContextDev(context, inst) { // Pass down our tag name to child components for validation purposes context = assign({}, context); var info = context[validateDOMNesting.ancestorInfoContextKey]; context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, i...
@param {object} component @param {?object} props
processChildContextDev
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function isCustomComponent(tagName, props) { return tagName.indexOf('-') >= 0 || props.is != null; }
@param {object} component @param {?object} props
isCustomComponent
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function ReactDOMComponent(tag) { validateDangerousTag(tag); this._tag = tag.toLowerCase(); this._renderedChildren = null; this._previousStyle = null; this._previousStyleCopy = null; this._rootNodeID = null; this._wrapperState = null; this._topLevelWrapper = null; this._nodeWithLegacyProperties = null...
Creates a new React class that is idempotent and capable of containing other React components. It accepts event listeners and DOM properties that are valid according to `DOMProperty`. - Event listeners: `onClick`, `onMouseDown`, etc. - DOM properties: `className`, `name`, `title`, etc. The `style` property function...
ReactDOMComponent
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createDOMFactory(tag) { if ("development" !== 'production') { return ReactElementValidator.createFactory(tag); } return ReactElement.createFactory(tag); }
Create a factory that creates HTML tag elements. @param {string} tag Tag name (e.g. `div`). @private
createDOMFactory
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function _handleChange(event) { var props = this._currentElement.props; var returnValue = LinkedValueUtils.executeOnChange(props, event); // Here we use asap to wait until all updates have propagated, which // is important when using controlled components within layers: // https://github.com/facebook/react/...
Implements an <input> native component that allows setting these optional props: `checked`, `value`, `defaultChecked`, and `defaultValue`. If `checked` or `value` are not supplied (or null/undefined), user actions that affect the checked state or value will trigger updates to the element. If they are supplied (and no...
_handleChange
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function checkSelectPropTypes(inst, props) { var owner = inst._currentElement._owner; LinkedValueUtils.checkPropTypes('select', props, owner); for (var i = 0; i < valuePropNames.length; i++) { var propName = valuePropNames[i]; if (props[propName] == null) { continue; } if (props.multiple) {...
Validation function for `value` and `defaultValue`. @private
checkSelectPropTypes
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function updateOptions(inst, multiple, propValue) { var selectedValue, i; var options = ReactMount.getNode(inst._rootNodeID).options; if (multiple) { selectedValue = {}; for (i = 0; i < propValue.length; i++) { selectedValue['' + propValue[i]] = true; } for (i = 0; i < options.length; i++) ...
@param {ReactDOMComponent} inst @param {boolean} multiple @param {*} propValue A stringable (with `multiple`, a list of stringables). @private
updateOptions
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function _handleChange(event) { var props = this._currentElement.props; var returnValue = LinkedValueUtils.executeOnChange(props, event); this._wrapperState.pendingUpdate = true; ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this); return returnValue; }
Implements a <select> native component that allows optionally setting the props `value` and `defaultValue`. If `multiple` is false, the prop must be a stringable. If `multiple` is true, the prop must be an array of stringables. If `value` is not supplied (or null/undefined), user actions that change the selected optio...
_handleChange
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) { return anchorNode === focusNode && anchorOffset === focusOffset; }
While `isCollapsed` is available on the Selection object and `collapsed` is available on the Range object, IE11 sometimes gets them wrong. If the anchor/focus nodes and offsets are the same, the range is collapsed.
isCollapsed
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getIEOffsets(node) { var selection = document.selection; var selectedRange = selection.createRange(); var selectedLength = selectedRange.text.length; // Duplicate selection so we can move range without breaking user selection. var fromStart = selectedRange.duplicate(); fromStart.moveToElementText(...
Get the appropriate anchor and focus node/offset pairs for IE. The catch here is that IE's selection API doesn't provide information about whether the selection is forward or backward, so we have to behave as though it's always forward. IE text differs from modern selection in that it behaves as though block elements...
getIEOffsets
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function setIEOffsets(node, offsets) { var range = document.selection.createRange().duplicate(); var start, end; if (typeof offsets.end === 'undefined') { start = offsets.start; end = start; } else if (offsets.start > offsets.end) { start = offsets.end; end = offsets.start; } else { start...
@param {DOMElement|DOMTextNode} node @param {object} offsets
setIEOffsets
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function setModernOffsets(node, offsets) { if (!window.getSelection) { return; } var selection = window.getSelection(); var length = node[getTextContentAccessor()].length; var start = Math.min(offsets.start, length); var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length); ...
In modern non-IE browsers, we can support both forward and backward selections. Note: IE10+ supports the Selection object, but it does not support the `extend` method, which means that even in modern IE, it's not possible to programatically create a backward selection. Thus, for all IE versions, we use the old IE API ...
setModernOffsets
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
ReactDOMTextComponent = function (props) { // This constructor and its argument is currently used by mocks. }
Text nodes violate a couple assumptions that React makes about components: - When mounting text into the DOM, adjacent text nodes are merged. - Text nodes cannot be assigned a React root ID. This component is used to wrap strings in elements so that they can undergo the same reconciliation that is applied to elemen...
ReactDOMTextComponent
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function _handleChange(event) { var props = this._currentElement.props; var returnValue = LinkedValueUtils.executeOnChange(props, event); ReactUpdates.asap(forceUpdateIfMounted, this); return returnValue; }
Implements a <textarea> native component that allows setting `value`, and `defaultValue`. This differs from the traditional DOM API because value is usually set as PCDATA children. If `value` is not supplied (or null/undefined), user actions that affect the value will trigger updates to the element. If `value` is sup...
_handleChange
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
ReactElement = function (type, key, ref, self, source, owner, props) { var element = { // This tag allow us to uniquely identify this as a React Element $$typeof: REACT_ELEMENT_TYPE, // Built-in properties that belong on the element type: type, key: key, ref: ref, props: props, // Re...
Base constructor for all React elements. This is only used to make this work with a dynamic instanceof check. Nothing should live on this prototype. @param {*} type @param {*} key @param {string|object} ref @param {*} self A *temporary* helper to detect places where `this` is different from the `owner` when React.crea...
ReactElement
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getDeclarationErrorAddendum() { if (ReactCurrentOwner.current) { var name = ReactCurrentOwner.current.getName(); if (name) { return ' Check the render method of `' + name + '`.'; } } return ''; }
ReactElementValidator provides a wrapper around a element factory which validates the props passed to the element. This is intended to be used only in DEV and could be replaced by a static type checker for languages that support it.
getDeclarationErrorAddendum
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validateExplicitKey(element, parentType) { if (!element._store || element._store.validated || element.key != null) { return; } element._store.validated = true; var addenda = getAddendaForKeyUse('uniqueKey', element, parentType); if (addenda === null) { // we already showed the warning re...
Warn if the element doesn't have an explicit key assigned to it. This element is in an array. The array could grow and shrink or be reordered. All children that haven't already been validated are required to have a "key" property assigned to it. @internal @param {ReactElement} element Element that requires a key. @par...
validateExplicitKey
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getAddendaForKeyUse(messageType, element, parentType) { var addendum = getDeclarationErrorAddendum(); if (!addendum) { var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; if (parentName) { addendum = ' Check the top-level render call using...
Shared warning and monitoring code for the key warnings. @internal @param {string} messageType A key used for de-duping warnings. @param {ReactElement} element Component that requires a key. @param {*} parentType element's parent's type. @returns {?object} A set of addenda to use in the warning message, or null if the...
getAddendaForKeyUse
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validateChildKeys(node, parentType) { if (typeof node !== 'object') { return; } if (Array.isArray(node)) { for (var i = 0; i < node.length; i++) { var child = node[i]; if (ReactElement.isValidElement(child)) { validateExplicitKey(child, parentType); } } } else if (...
Ensure that every element either is passed in a static location, in an array with an explicit keys property defined, or in an object literal with valid key property. @internal @param {ReactNode} node Statically passed child of any type. @param {*} parentType node's parent's type.
validateChildKeys
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function checkPropTypes(componentName, propTypes, props, location) { for (var propName in propTypes) { if (propTypes.hasOwnProperty(propName)) { var error; // Prop type validation may throw. In case they do, we don't want to // fail the render phase where it didn't fail before. So we log it. ...
Assert that the props are valid @param {string} componentName Name of the component for error messages. @param {object} propTypes Map of prop name to a ReactPropType @param {object} props @param {string} location e.g. "prop", "context", "child context" @private
checkPropTypes
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validatePropTypes(element) { var componentClass = element.type; if (typeof componentClass !== 'function') { return; } var name = componentClass.displayName || componentClass.name; if (componentClass.propTypes) { checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocati...
Given an element, validate that its props follow the propTypes definition, provided by the type. @param {ReactElement} element
validatePropTypes
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function isNullComponentID(id) { return !!nullComponentIDsRegistry[id]; }
@param {string} id Component's `_rootNodeID`. @return {boolean} True if the component is rendered to null.
isNullComponentID
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function registerNullComponentID(id) { nullComponentIDsRegistry[id] = true; }
Mark the component as having rendered to null. @param {string} id Component's `_rootNodeID`.
registerNullComponentID
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function deregisterNullComponentID(id) { delete nullComponentIDsRegistry[id]; }
Unmark the component as having rendered to null: it renders to something now. @param {string} id Component's `_rootNodeID`.
deregisterNullComponentID
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function invokeGuardedCallback(name, func, a, b) { try { return func(a, b); } catch (x) { if (caughtError === null) { caughtError = x; } return undefined; } }
Call a function while guarding against errors that happens within it. @param {?String} name of the guard to use for logging or debugging @param {Function} func The function to invoke @param {*} a First argument @param {*} b Second argument
invokeGuardedCallback
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function findParent(node) { // TODO: It may be a good idea to cache this to prevent unnecessary DOM // traversal, but caching is difficult to do correctly without using a // mutation observer to listen for all DOM changes. var nodeID = ReactMount.getID(node); var rootID = ReactInstanceHandles.getReactRootIDFr...
Finds the parent React component of `node`. @param {*} node @return {?DOMEventTarget} Parent container, or `null` if the specified node is not nested.
findParent
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) { this.topLevelType = topLevelType; this.nativeEvent = nativeEvent; this.ancestors = []; }
Finds the parent React component of `node`. @param {*} node @return {?DOMEventTarget} Parent container, or `null` if the specified node is not nested.
TopLevelCallbackBookKeeping
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function handleTopLevelImpl(bookKeeping) { // TODO: Re-enable event.path handling // // if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) { // // New browsers have a path attribute on native events // handleTopLevelWithPath(bookKeeping); // } else { // // Legacy browsers d...
Finds the parent React component of `node`. @param {*} node @return {?DOMEventTarget} Parent container, or `null` if the specified node is not nested.
handleTopLevelImpl
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function handleTopLevelWithoutPath(bookKeeping) { var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window; // Loop through the hierarchy, in case there's any nested components. // It's important that we build the array of ancestors before calling any // event handler...
Finds the parent React component of `node`. @param {*} node @return {?DOMEventTarget} Parent container, or `null` if the specified node is not nested.
handleTopLevelWithoutPath
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function handleTopLevelWithPath(bookKeeping) { var path = bookKeeping.nativeEvent.path; var currentNativeTarget = path[0]; var eventsFired = 0; for (var i = 0; i < path.length; i++) { var currentPathElement = path[i]; if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) { currentNative...
Finds the parent React component of `node`. @param {*} node @return {?DOMEventTarget} Parent container, or `null` if the specified node is not nested.
handleTopLevelWithPath
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function scrollValueMonitor(cb) { var scrollPosition = getUnboundedScrollPosition(window); cb(scrollPosition); }
Finds the parent React component of `node`. @param {*} node @return {?DOMEventTarget} Parent container, or `null` if the specified node is not nested.
scrollValueMonitor
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getReactRootIDString(index) { return SEPARATOR + index.toString(36); }
Creates a DOM ID prefix to use when mounting React components. @param {number} index A unique integer @return {string} React root ID. @internal
getReactRootIDString
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function isBoundary(id, index) { return id.charAt(index) === SEPARATOR || index === id.length; }
Checks if a character in the supplied ID is a separator or the end. @param {string} id A React DOM ID. @param {number} index Index of the character to check. @return {boolean} True if the character is a separator or end of the ID. @private
isBoundary
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function isValidID(id) { return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR; }
Checks if the supplied string is a valid React DOM ID. @param {string} id A React DOM ID, maybe. @return {boolean} True if the string is a valid React DOM ID. @private
isValidID
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function isAncestorIDOf(ancestorID, descendantID) { return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length); }
Checks if the first ID is an ancestor of or equal to the second ID. @param {string} ancestorID @param {string} descendantID @return {boolean} True if `ancestorID` is an ancestor of `descendantID`. @internal
isAncestorIDOf
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getParentID(id) { return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : ''; }
Gets the parent ID of the supplied React DOM ID, `id`. @param {string} id ID of a component. @return {string} ID of the parent, or an empty string. @private
getParentID
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getNextDescendantID(ancestorID, destinationID) { !(isValidID(ancestorID) && isValidID(destinationID)) ? "development" !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined; !isAncestorIDOf(ancestorID, ...
Gets the next DOM ID on the tree path from the supplied `ancestorID` to the supplied `destinationID`. If they are equal, the ID is returned. @param {string} ancestorID ID of an ancestor node of `destinationID`. @param {string} destinationID ID of the destination node. @return {string} Next ID on the path from `ancesto...
getNextDescendantID
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getFirstCommonAncestorID(oneID, twoID) { var minLength = Math.min(oneID.length, twoID.length); if (minLength === 0) { return ''; } var lastCommonMarkerIndex = 0; // Use `<=` to traverse until the "EOL" of the shorter string. for (var i = 0; i <= minLength; i++) { if (isBoundary(oneID, i) &&...
Gets the nearest common ancestor ID of two IDs. Using this ID scheme, the nearest common ancestor ID is the longest common prefix of the two IDs that immediately preceded a "marker" in both strings. @param {string} oneID @param {string} twoID @return {string} Nearest common ancestor ID, or the empty string if none. @...
getFirstCommonAncestorID
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) { start = start || ''; stop = stop || ''; !(start !== stop) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined; var traverseUp ...
Traverses the parent path between two IDs (either up or down). The IDs must not be the same, and there must exist a parent path between them. If the callback returns `false`, traversal is stopped. @param {?string} start ID at which to start traversal. @param {?string} stop ID at which to end traversal. @param {functio...
traverseParentPath
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function firstDifferenceIndex(string1, string2) { var minLen = Math.min(string1.length, string2.length); for (var i = 0; i < minLen; i++) { if (string1.charAt(i) !== string2.charAt(i)) { return i; } } return string1.length === string2.length ? -1 : minLen; }
Finds the index of the first character that's not common between the two given strings. @return {number} the index of the character where the strings diverge
firstDifferenceIndex
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getReactRootElementInContainer(container) { if (!container) { return null; } if (container.nodeType === DOC_NODE_TYPE) { return container.documentElement; } else { return container.firstChild; } }
@param {DOMElement|DOMDocument} container DOM element that may contain a React component @return {?*} DOM element that may have the reactRoot ID, or null.
getReactRootElementInContainer
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getReactRootID(container) { var rootElement = getReactRootElementInContainer(container); return rootElement && ReactMount.getID(rootElement); }
@param {DOMElement} container DOM element that may contain a React component. @return {?string} A "reactRoot" ID, if a React component is rendered.
getReactRootID
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getID(node) { var id = internalGetID(node); if (id) { if (nodeCache.hasOwnProperty(id)) { var cached = nodeCache[id]; if (cached !== node) { !!isValid(cached, id) ? "development" !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', AT...
Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form element can return its control whose name or ID equals ATTR_NAME. All DOM nodes support `getAttributeNode` but this can also get called on other objects so just return '' if we're given something other than a DOM node (such as window). @param {?DOM...
getID
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function internalGetID(node) { // If node is something like a window, document, or text node, none of // which support attributes or a .getAttribute method, gracefully return // the empty string, as if the attribute were missing. return node && node.getAttribute && node.getAttribute(ATTR_NAME) || ''; }
Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form element can return its control whose name or ID equals ATTR_NAME. All DOM nodes support `getAttributeNode` but this can also get called on other objects so just return '' if we're given something other than a DOM node (such as window). @param {?DOM...
internalGetID
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function setID(node, id) { var oldID = internalGetID(node); if (oldID !== id) { delete nodeCache[oldID]; } node.setAttribute(ATTR_NAME, id); nodeCache[id] = node; }
Sets the React-specific ID of the given node. @param {DOMElement} node The DOM node whose ID will be set. @param {string} id The value of the ID attribute.
setID
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getNode(id) { if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) { nodeCache[id] = ReactMount.findReactNodeByID(id); } return nodeCache[id]; }
Finds the node with the supplied React-generated DOM ID. @param {string} id A React-generated DOM ID. @return {DOMElement} DOM node with the suppled `id`. @internal
getNode
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getNodeFromInstance(instance) { var id = ReactInstanceMap.get(instance)._rootNodeID; if (ReactEmptyComponentRegistry.isNullComponentID(id)) { return null; } if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) { nodeCache[id] = ReactMount.findReactNodeByID(id); } return nodeCac...
Finds the node with the supplied public React instance. @param {*} instance A public React instance. @return {?DOMElement} DOM node with the suppled `id`. @internal
getNodeFromInstance
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function isValid(node, id) { if (node) { !(internalGetID(node) === id) ? "development" !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined; var container = ReactMount.findReactContainerForID(id); if (container && containsNode(contai...
A node is "valid" if it is contained by a currently mounted container. This means that the node does not have to be contained by a document in order to be considered valid. @param {?DOMElement} node The candidate DOM node. @param {string} id The expected ID of the node. @return {boolean} Whether the node is contained...
isValid
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function purgeID(id) { delete nodeCache[id]; }
Causes the cache to forget about one React-specific ID. @param {string} id The ID to forget.
purgeID
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function findDeepestCachedAncestorImpl(ancestorID) { var ancestor = nodeCache[ancestorID]; if (ancestor && isValid(ancestor, ancestorID)) { deepestNodeSoFar = ancestor; } else { // This node isn't populated in the cache, so presumably none of its // descendants are. Break out of the loop. return f...
Causes the cache to forget about one React-specific ID. @param {string} id The ID to forget.
findDeepestCachedAncestorImpl
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function findDeepestCachedAncestor(targetID) { deepestNodeSoFar = null; ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl); var foundNode = deepestNodeSoFar; deepestNodeSoFar = null; return foundNode; }
Return the deepest cached node whose ID is a prefix of `targetID`.
findDeepestCachedAncestor
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) { if (ReactDOMFeatureFlags.useCreateElement) { context = assign({}, context); if (container.nodeType === DOC_NODE_TYPE) { context[ownerDocumentContextKey] = container; } else { contex...
Mounts this component and inserts it into the DOM. @param {ReactComponent} componentInstance The instance to mount. @param {string} rootID DOM ID of the root node. @param {DOMElement} container DOM element to mount into. @param {ReactReconcileTransaction} transaction @param {boolean} shouldReuseMarkup If true, do not ...
mountComponentIntoNode
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) { var transaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */shouldReuseMarkup); transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, sho...
Batched mount. @param {ReactComponent} componentInstance The instance to mount. @param {string} rootID DOM ID of the root node. @param {DOMElement} container DOM element to mount into. @param {boolean} shouldReuseMarkup If true, do not insert markup
batchedMountComponentIntoNode
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function unmountComponentFromNode(instance, container) { ReactReconciler.unmountComponent(instance); if (container.nodeType === DOC_NODE_TYPE) { container = container.documentElement; } // http://jsperf.com/emptying-a-node while (container.lastChild) { container.removeChild(container.lastChild); }...
Unmounts a component and removes it from the DOM. @param {ReactComponent} instance React component instance. @param {DOMElement} container DOM element to unmount from. @final @internal @see {ReactMount.unmountComponentAtNode}
unmountComponentFromNode
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function hasNonRootReactChild(node) { var reactRootID = getReactRootID(node); return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false; }
True if the supplied DOM node has a direct React-rendered child that is not a React root element. Useful for warning in `render`, `unmountComponentAtNode`, etc. @param {?DOMElement} node The candidate DOM node. @return {boolean} True if the DOM element contains a direct child that was rendered by React but is not a ro...
hasNonRootReactChild
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function findFirstReactDOMImpl(node) { // This node might be from another React instance, so we make sure not to // examine the node cache here for (; node && node.parentNode !== node; node = node.parentNode) { if (node.nodeType !== 1) { // Not a DOMElement, therefore not a React component continu...
Returns the first (deepest) ancestor of a node which is rendered by this copy of React.
findFirstReactDOMImpl
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function enqueueInsertMarkup(parentID, markup, toIndex) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.INSERT_MARKUP, markupIndex: markupQueue.push(markup) - 1, content: null, fromIndex: null, toInde...
Enqueues markup to be rendered and inserted at a supplied index. @param {string} parentID ID of the parent component. @param {string} markup Markup that renders into an element. @param {number} toIndex Destination index. @private
enqueueInsertMarkup
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function enqueueMove(parentID, fromIndex, toIndex) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.MOVE_EXISTING, markupIndex: null, content: null, fromIndex: fromIndex, toIndex: toIndex }); }
Enqueues moving an existing element to another index. @param {string} parentID ID of the parent component. @param {number} fromIndex Source index of the existing element. @param {number} toIndex Destination index of the element. @private
enqueueMove
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function enqueueRemove(parentID, fromIndex) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.REMOVE_NODE, markupIndex: null, content: null, fromIndex: fromIndex, toIndex: null }); }
Enqueues removing an element at an index. @param {string} parentID ID of the parent component. @param {number} fromIndex Index of the element to remove. @private
enqueueRemove
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function enqueueSetMarkup(parentID, markup) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.SET_MARKUP, markupIndex: null, content: markup, fromIndex: null, toIndex: null }); }
Enqueues setting the markup of a node. @param {string} parentID ID of the parent component. @param {string} markup Markup that renders into an element. @private
enqueueSetMarkup
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function enqueueTextContent(parentID, textContent) { // NOTE: Null values reduce hidden classes. updateQueue.push({ parentID: parentID, parentNode: null, type: ReactMultiChildUpdateTypes.TEXT_CONTENT, markupIndex: null, content: textContent, fromIndex: null, toIndex: null }); }
Enqueues setting the text content. @param {string} parentID ID of the parent component. @param {string} textContent Text content to set. @private
enqueueTextContent
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function getComponentClassForElement(element) { if (typeof element.type === 'function') { return element.type; } var tag = element.type; var componentClass = tagToComponentClass[tag]; if (componentClass == null) { tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag); } return ...
Get a composite component wrapper class for a specific tag. @param {ReactElement} element The tag for which to get the class. @return {function} The React class constructor function.
getComponentClassForElement
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createInternalComponent(element) { !genericComponentClass ? "development" !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined; return new genericComponentClass(element.type, element.props); }
Get a native internal component class for a specific tag. @param {ReactElement} element The element to create. @return {function} The internal class constructor function.
createInternalComponent
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
wrapper = function () { if (ReactPerf.enableMeasure) { if (!measuredFunc) { measuredFunc = ReactPerf.storedMeasure(objName, fnName, func); } return measuredFunc.apply(this, arguments); } return func.apply(this, arguments); }
Use this to wrap methods you want to measure. Zero overhead in production. @param {string} objName @param {string} fnName @param {function} func @return {function}
wrapper
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function _noMeasure(objName, fnName, func) { return func; }
Simply passes through the measured function, without measuring it. @param {string} objName @param {string} fnName @param {function} func @return {function}
_noMeasure
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createChainableTypeChecker(validate) { function checkType(isRequired, props, propName, componentName, location, propFullName) { componentName = componentName || ANONYMOUS; propFullName = propFullName || propName; if (props[propName] == null) { var locationName = ReactPropTypeLocationNames[l...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
createChainableTypeChecker
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function checkType(isRequired, props, propName, componentName, location, propFullName) { componentName = componentName || ANONYMOUS; propFullName = propFullName || propName; if (props[propName] == null) { var locationName = ReactPropTypeLocationNames[location]; if (isRequired) { return n...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
checkType
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createPrimitiveTypeChecker(expectedType) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== expectedType) { var locationName = ReactPropTypeLocationNames[location]; // `...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
createPrimitiveTypeChecker
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== expectedType) { var locationName = ReactPropTypeLocationNames[location]; // `propValue` being instance of, say, date/regexp, pass t...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
validate
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createAnyTypeChecker() { return createChainableTypeChecker(emptyFunction.thatReturns(null)); }
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
createAnyTypeChecker
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createArrayOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; if (!Array.isArray(propValue)) { var locationName = ReactPropTypeLocationNames[location]; var propType = getPropType(propValue); retur...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
createArrayOfTypeChecker
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; if (!Array.isArray(propValue)) { var locationName = ReactPropTypeLocationNames[location]; var propType = getPropType(propValue); return new Error('Invalid ' + locationName + ' `' + prop...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
validate
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createElementTypeChecker() { function validate(props, propName, componentName, location, propFullName) { if (!ReactElement.isValidElement(props[propName])) { var locationName = ReactPropTypeLocationNames[location]; return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
createElementTypeChecker
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validate(props, propName, componentName, location, propFullName) { if (!ReactElement.isValidElement(props[propName])) { var locationName = ReactPropTypeLocationNames[location]; return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expec...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
validate
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createInstanceTypeChecker(expectedClass) { function validate(props, propName, componentName, location, propFullName) { if (!(props[propName] instanceof expectedClass)) { var locationName = ReactPropTypeLocationNames[location]; var expectedClassName = expectedClass.name || ANONYMOUS; var...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
createInstanceTypeChecker
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validate(props, propName, componentName, location, propFullName) { if (!(props[propName] instanceof expectedClass)) { var locationName = ReactPropTypeLocationNames[location]; var expectedClassName = expectedClass.name || ANONYMOUS; var actualClassName = getClassName(props[propName]); ...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
validate
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) { return createChainableTypeChecker(function () { return new Error('Invalid argument supplied to oneOf, expected an instance of array.'); }); } function validate(props, propName, componentName, location, propFullNa...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
createEnumTypeChecker
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; for (var i = 0; i < expectedValues.length; i++) { if (propValue === expectedValues[i]) { return null; } } var locationName = ReactPropTypeLocationNames[location]; var val...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
validate
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createObjectOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { var locationName = ReactPropTypeLocationNames[location]; return new...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
createObjectOfTypeChecker
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { var locationName = ReactPropTypeLocationNames[location]; return new Error('Invalid ' + locationName + ' `' + propFullNa...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
validate
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createUnionTypeChecker(arrayOfTypeCheckers) { if (!Array.isArray(arrayOfTypeCheckers)) { return createChainableTypeChecker(function () { return new Error('Invalid argument supplied to oneOfType, expected an instance of array.'); }); } function validate(props, propName, componentName, locat...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
createUnionTypeChecker
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (checker(props, propName, componentName, location, propFullName) == null) { return null; } } var locationName...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
validate
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function createNodeChecker() { function validate(props, propName, componentName, location, propFullName) { if (!isNode(props[propName])) { var locationName = ReactPropTypeLocationNames[location]; return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
createNodeChecker
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT
function validate(props, propName, componentName, location, propFullName) { if (!isNode(props[propName])) { var locationName = ReactPropTypeLocationNames[location]; return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); ...
Collection of methods that allow declaration and validation of props that are supplied to React components. Example usage: var Props = require('ReactPropTypes'); var MyArticle = React.createClass({ propTypes: { // An optional string prop named "description". description: Props.string, // A r...
validate
javascript
amol-/dukpy
dukpy/jsmodules/react/react.js
https://github.com/amol-/dukpy/blob/master/dukpy/jsmodules/react/react.js
MIT