Utility functions for working with Figma frames and strings
- Source:
Methods
(inner) capitalize(name) → {string}
- Source:
Capitalize first letter of string passed
input: banner output: Banner
Parameters:
Name | Type | Description |
---|---|---|
name |
string | string to capitalize |
Returns:
capitalized string
- Type
- string
(inner) checkIfChildNameExists(nodeId, layerName) → {null|string}
- Source:
Checks if layerName exists wihin the children of NodeID passed
Parameters:
Name | Type | Description |
---|---|---|
nodeId |
string | Node ID to grab |
layerName |
string | layer name to check against |
Returns:
if found returns id of layer OR returns null
- Type
- null | string
(inner) checkTypeOfA11yLayer(string) → {string}
- Source:
Check if native or web later
input: Accessibility Layer Name output: 'web' or 'native'
Parameters:
Name | Type | Description |
---|---|---|
string |
string | full a11y layer name |
Returns:
string - 'web' or 'native'
- Type
- string
(inner) frameExistsOrCreate(parentFrameId, layerName, page) → {object}
- Source:
Check is frame exists by name, if not, create it
Parameters:
Name | Type | Description |
---|---|---|
parentFrameId |
string | parent node ID |
layerName |
string | layer name |
page |
string | page creation data (optional: x, y, height, width) |
Returns:
Figma frame
- Type
- object
(inner) hasNoImageFills(node) → {boolean}
- Source:
Check if Node has no usable image fills or is visible
Parameters:
Name | Type | Description |
---|---|---|
node |
object | Figma node object |
Returns:
Has no fills OR is hidden
- Type
- boolean
(inner) nameBeforePipe(string) → {string}
- Source:
Grab the string before the pipe (|)
input: Contrast Layer | 165:578 output: Contrast Layer
Parameters:
Name | Type | Description |
---|---|---|
string |
string | string with pipe format |
Returns:
string content before pipe delimeter
- Type
- string
(inner) sanitizeName(name) → {string}
- Source:
Remove pipe (|) from Page names this will be the delimeter used for layer/data layer naming conventions along with removing double, triple spacing
Parameters:
Name | Type | Description |
---|---|---|
name |
string | Name of page scanned |
Returns:
new sanitized name for layer
- Type
- string
(inner) showAllLayers(a11ySuffix)
- Source:
Find all A11y layers and make the child layers visible
this is used when:
- Plugin Closes
- User goes back to Dashboard
Parameters:
Name | Type | Description |
---|---|---|
a11ySuffix |
string | layer suffix to search on |
Returns:
null