style-to-object.ts — astro Source File
Architecture documentation for style-to-object.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 58afbcc5_d627_3dca_f7eb_60147679f7ca["style-to-object.ts"] d1db3d23_ad24_9870_8a45_b2bf40f98347["./parse-inline-styles.js"] 58afbcc5_d627_3dca_f7eb_60147679f7ca --> d1db3d23_ad24_9870_8a45_b2bf40f98347 style 58afbcc5_d627_3dca_f7eb_60147679f7ca fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
// @ts-nocheck
// https://github.com/remarkablemark/style-to-object
/**
* @license MIT
*
* The MIT License (MIT)
*
* Copyright (c) 2017 Menglin "Mark" Xu <mark@remarkablemark.org>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import { parseInlineStyles } from './parse-inline-styles.js';
/**
* Parses inline style to object.
*
* @example
* // returns { 'line-height': '42' }
* styleToObject('line-height: 42;');
*
* @param {String} style - The inline style.
* @param {Function} [iterator] - The iterator function.
* @return {null|Object}
*/
export function styleToObject(style, iterator) {
let output = null;
if (!style || typeof style !== 'string') {
return output;
}
let declaration;
let declarations = parseInlineStyles(style);
let hasIterator = typeof iterator === 'function';
let property;
let value;
for (let i = 0, len = declarations.length; i < len; i++) {
declaration = declarations[i];
property = declaration.property;
value = declaration.value;
if (hasIterator) {
iterator(property, value, declaration);
} else if (value) {
output || (output = {});
output[property] = value;
}
}
return output;
}
Domain
Subdomains
Functions
Dependencies
- ./parse-inline-styles.js
Source
Frequently Asked Questions
What does style-to-object.ts do?
style-to-object.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in style-to-object.ts?
style-to-object.ts defines 1 function(s): styleToObject.
What does style-to-object.ts depend on?
style-to-object.ts imports 1 module(s): ./parse-inline-styles.js.
Where is style-to-object.ts in the architecture?
style-to-object.ts is located at packages/integrations/markdoc/src/html/css/style-to-object.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/integrations/markdoc/src/html/css).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free