html2canvas/src/parsing/textTransform.js
Niklas von Hertzen 8a6fb5f733 Library rewrite
2017-08-01 00:25:58 +08:00

25 lines
555 B
JavaScript

/* @flow */
'use strict';
export const TEXT_TRANSFORM = {
NONE: 0,
LOWERCASE: 1,
UPPERCASE: 2,
CAPITALIZE: 3
};
export type TextTransform = $Values<typeof TEXT_TRANSFORM>;
export const parseTextTransform = (textTransform: string): TextTransform => {
switch (textTransform) {
case 'uppercase':
return TEXT_TRANSFORM.UPPERCASE;
case 'lowercase':
return TEXT_TRANSFORM.LOWERCASE;
case 'capitalize':
return TEXT_TRANSFORM.CAPITALIZE;
}
return TEXT_TRANSFORM.NONE;
};