math-operators.ts — tailwindcss Source File
Architecture documentation for math-operators.ts, a typescript file in the tailwindcss codebase. 0 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 49e6f0af_1e9c_a3fb_0227_698f6d66f3cc["math-operators.ts"] e90d9c51_31f0_3175_a861_610a15e277e5["decode-arbitrary-value.ts"] e90d9c51_31f0_3175_a861_610a15e277e5 --> 49e6f0af_1e9c_a3fb_0227_698f6d66f3cc 516809a4_c70e_60c3_bbb2_8de4c4572510["infer-data-type.ts"] 516809a4_c70e_60c3_bbb2_8de4c4572510 --> 49e6f0af_1e9c_a3fb_0227_698f6d66f3cc style 49e6f0af_1e9c_a3fb_0227_698f6d66f3cc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
const LOWER_A = 0x61
const LOWER_Z = 0x7a
const UPPER_A = 0x41
const UPPER_Z = 0x5a
const LOWER_E = 0x65
const UPPER_E = 0x45
const ZERO = 0x30
const NINE = 0x39
const ADD = 0x2b
const SUB = 0x2d
const MUL = 0x2a
const DIV = 0x2f
const OPEN_PAREN = 0x28
const CLOSE_PAREN = 0x29
const COMMA = 0x2c
const SPACE = 0x20
const PERCENT = 0x25
const MATH_FUNCTIONS = [
'calc',
'min',
'max',
'clamp',
'mod',
'rem',
'sin',
'cos',
'tan',
'asin',
'acos',
'atan',
'atan2',
'pow',
'sqrt',
'hypot',
'log',
'exp',
'round',
]
export function hasMathFn(input: string) {
return input.indexOf('(') !== -1 && MATH_FUNCTIONS.some((fn) => input.includes(`${fn}(`))
}
export function addWhitespaceAroundMathOperators(input: string) {
// Bail early if there are no math functions in the input
if (!MATH_FUNCTIONS.some((fn) => input.includes(fn))) {
return input
}
let result = ''
let formattable: boolean[] = []
let valuePos = null
let lastValuePos = null
for (let i = 0; i < input.length; i++) {
let char = input.charCodeAt(i)
// Track if we see a number followed by a unit, then we know for sure that
// ... (146 more lines)
Domain
Subdomains
Imported By
Source
Frequently Asked Questions
What does math-operators.ts do?
math-operators.ts is a source file in the tailwindcss codebase, written in typescript. It belongs to the OxideEngine domain, Extractor subdomain.
What functions are defined in math-operators.ts?
math-operators.ts defines 2 function(s): addWhitespaceAroundMathOperators, hasMathFn.
What files import math-operators.ts?
math-operators.ts is imported by 2 file(s): decode-arbitrary-value.ts, infer-data-type.ts.
Where is math-operators.ts in the architecture?
math-operators.ts is located at packages/tailwindcss/src/utils/math-operators.ts (domain: OxideEngine, subdomain: Extractor, directory: packages/tailwindcss/src/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free