jsx-to-string
jsx-to-string copied to clipboard
Unneded dependencies
The code has some unneded external dependencies. We have to add whole react only for a oneliner:
/**
* Verifies the object is a ReactElement.
* See https://reactjs.org/docs/react-api.html#isvalidelement
* @param {?object} object
* @return {boolean} True if `object` is a ReactElement.
* @final
*/
export function isValidElement(object) {
return (
typeof object === 'object' &&
object !== null &&
object.$$typeof === REACT_ELEMENT_TYPE
);
}
see: https://github.com/grommet/jsx-to-string/blob/bd786a0393fee81df262bfb83b3945710a1327cf/src/index.js#L1
same goes proabably for immutable.js and json-stringify-pretty-compact