1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | /**
|
4 | * Determines whether a component is controlled.
|
5 | * @param props - Component props
|
6 | * @param valueProp - Prop containing the controlled value
|
7 | * @returns true if controlled, false if uncontrolled
|
8 | */
|
9 | function isControlled(props, valueProp) {
|
10 | // React's built-in <input> considers a prop to be provided if its value is non-null/undefined.
|
11 | // Mirror that behavior here (rather than checking for just undefined).
|
12 | return props[valueProp] !== undefined && props[valueProp] !== null;
|
13 | }
|
14 | exports.isControlled = isControlled;
|
15 | //# sourceMappingURL=controlled.js.map |
\ | No newline at end of file |