flipFromString()
This function is part of Iconify Utils package.
Function flipFromString() applies flip shorthand property to IconCustomisations object.
Usage
Function has the following parameters:
- custom, IconCustomisations. Customisations.
- value, string. Value to parse.
Function does not return anything, it applies changes to object passed in first parameter.
Value
Value can be set of the following strings, separated by space and/or comma:
- "horizontal" sets hFlip to true.
- "vertical" sets vFlip to true.
Example
demo.ts
ts
import type { IconifyIconCustomisations } from '@iconify/utils';
import { flipFromString } from '@iconify/utils';
let customisations: IconifyIconCustomisations;
customisations = {};
flipFromString(customisations, 'horizontal');
// { hFlip: true }
console.log(customisations);
customisations = {};
flipFromString(customisations, 'horizontal,vertical');
// { hFlip: true, vFlip: true }
console.log(customisations);
// Function does not toggle existing value, so this code does not change anything
customisations = { vFlip: true };
flipFromString(customisations, 'vertical');
// { vFlip: true }
console.log(customisations);