@react-theming/storybook-addon
Version:
Develop themes and themable components with Emotion, Styled Components, Material-UI and your custom solution
36 lines (26 loc) • 722 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.processWord = exports.isColor = void 0;
var _colorString = _interopRequireDefault(require("color-string"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var isColor = function isColor(str) {
return _colorString.default.get(str);
};
exports.isColor = isColor;
var processWord = function processWord(str) {
if (!str) {
return null;
}
var value = str.replace(/^['|"|`|(]|['|"|`|)|:]*$/g, '');
if (!value) {
return null;
}
return {
name: '/* yaml */',
type: isColor(value) ? 'color' : '',
value: value
};
};
exports.processWord = processWord;