Initial commit
This commit is contained in:
commit
78f8d225ee
21173 changed files with 2907774 additions and 0 deletions
31
node_modules/style-to-js/src/index.ts
generated
vendored
Normal file
31
node_modules/style-to-js/src/index.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import StyleToObject from 'style-to-object';
|
||||
|
||||
import { camelCase, CamelCaseOptions } from './utilities';
|
||||
|
||||
type StyleObject = Record<string, string>;
|
||||
|
||||
interface StyleToJSOptions extends CamelCaseOptions {}
|
||||
|
||||
/**
|
||||
* Parses CSS inline style to JavaScript object (camelCased).
|
||||
*/
|
||||
function StyleToJS(style: string, options?: StyleToJSOptions): StyleObject {
|
||||
const output: StyleObject = {};
|
||||
|
||||
if (!style || typeof style !== 'string') {
|
||||
return output;
|
||||
}
|
||||
|
||||
StyleToObject(style, (property, value) => {
|
||||
// skip CSS comment
|
||||
if (property && value) {
|
||||
output[camelCase(property, options)] = value;
|
||||
}
|
||||
});
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
StyleToJS.default = StyleToJS;
|
||||
|
||||
export = StyleToJS;
|
||||
Loading…
Add table
Add a link
Reference in a new issue