Function: normalizeModifiers()
ts
function normalizeModifiers(raw): ModifiersChain;Defined in: tiny/literals.ts:236
Normalizes a modifiers string of any shape into a ModifiersChain — the string-level counterpart of parseOperations, and the way a value that did not come from modifiers() becomes a chain.
The same leniency parseOperations grants, for the same reason: these values arrive from config, DOM attributes and stored cdnUrlModifiers alike, so the leading - marker, surrounding slashes, doubled slashes and surrounding whitespace are all tolerated. Operations within a chain still separate on -, which keeps resize/300x/-/blur/10 unambiguous. Nothing is validated: a malformed chain is accepted, not diagnosed.
Parameters
| Parameter | Type |
|---|---|
raw | string |
Returns
See
https://uploadcare.com/docs/cdn-operations/
Example
ts
normalizeModifiers('resize/100x') // → '-/resize/100x/'
normalizeModifiers('/resize//100x/') // → '-/resize/100x/'
normalizeModifiers(' -/resize/100x/ ') // → '-/resize/100x/'
normalizeModifiers('resize/300x/-/blur/10') // → '-/resize/300x/-/blur/10/'
normalizeModifiers('') // → ''