The utility package of Henri's.
This package includes all simple functions used in most other packages. Utils can also be used separate from Henri's
Convert a string to safe letters.
Example:
input | output |
---|---|
safe-characters('Bjørk') |
Bjork |
Receive a list of letters.
- Used in 'allowed-characters'
Example:
input | output |
---|---|
character-set(('0-9')) |
("0" "1" "2" "3" "4" "5" "5" "6" "7" "8" "9") |
Options
input | output |
---|---|
a-z |
Returns all letters from a to z lowercase. |
A-Z |
Returns all letters from A to Z uppercase. |
a-Z |
Returns all letters from a to Z lowercase and uppercase. |
0-9 |
Returns number from 0 to 9. |
& |
Returns '&' as a value in the list of allowed characters, this can be done with any character. |
Convert a string to a string with allowed-chars. So you can
Set a map
Convert a list to a map
Add a value to the beginning of a list.
Convert a string to a list.
Arguments
argument | description |
---|---|
$string |
The string to be separated into a list |
$separator |
Find this value and break the string every time on this value. |
Flatten a list and make it into a string.
Arguments
argument | description |
---|---|
$list |
The list to be flattened into a string |
$separator |
After every value the separator will be placed. |
Sometimes a list, or map is not the type list. Easily bring it into a list with 'to-list'
Convert a string to a list of all letters in the string.
If a value is not a string, for instance a number. 'to-string' converts it into a string.
Get the shortest of both given values. This can be either the length of a string or the total length of a list.
Strip a unit from it's value.
Wrapper function to convert pixel values to rem
Example:
input | output |
---|---|
rem(14) |
0.875rem |
rem(14 16 20) |
0.875rem 1rem 1.25rem |
Arguments
input | output |
---|---|
$values |
Accept one value or multiple separated by spaces. |
Does the calculation for the pixel to rem.
Wrapper function to convert rem values to pixels
Example:
input | output |
---|---|
px(.75) |
12px |
rem(0.8 1 1.5) |
12.8px 16px 24px |
Arguments
argument | description |
---|---|
$values |
Accept one value or multiple separated by spaces. |
Does the calculation for the pixel to rem.