Handle undefined values for textShadow/transform (IE9)

This commit is contained in:
Niklas von Hertzen 2017-08-06 15:44:30 +08:00
parent 10ec079762
commit 6baa847092
2 changed files with 5 additions and 4 deletions

View File

@ -13,8 +13,8 @@ export type TextShadow = {
const TEXT_SHADOW_PROPERTY = /((rgba|rgb)\([^\)]+\)(\s-?\d+px){3})/g;
const TEXT_SHADOW_VALUES = /(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g;
export const parseTextShadow = (textShadow: string): Array<TextShadow> | null => {
if (textShadow === 'none') {
export const parseTextShadow = (textShadow: ?string): Array<TextShadow> | null => {
if (textShadow === 'none' || typeof(textShadow) !== 'string') {
return null;
}

View File

@ -31,10 +31,11 @@ const parseTransformOrigin = (origin: string): TransformOrigin => {
return [values[0], values[1]];
};
const parseTransformMatrix = (transform: string): Matrix | null => {
if (transform === 'none') {
const parseTransformMatrix = (transform: ?string): Matrix | null => {
if (transform === 'none' || typeof(transform) !== 'string') {
return null;
}
const match = transform.match(MATRIX);
if (match) {
if (match[1] === 'matrix') {