| 1 |
import { blocksAttributes } from '@Attributes/getBlocksDefaultAttributes'; |
| 2 |
|
| 3 |
// Parameters for these methods: |
| 4 |
// currentValue - The variable/attribute that is altered by settings. |
| 5 |
// key - The key of the default attribute for that setting. |
| 6 |
// blockName - The name of the block. |
| 7 |
|
| 8 |
const getAttributeFallback = ( currentValue, key, blockName ) => |
| 9 |
currentValue ? currentValue : blocksAttributes[ blockName ][ key ].default; |
| 10 |
|
| 11 |
export const getFallbackNumber = ( currentValue, key, blockName ) => |
| 12 |
isNaN( currentValue ) |
| 13 |
? blocksAttributes[ blockName ][ key ].default |
| 14 |
: currentValue; |
| 15 |
|
| 16 |
export default getAttributeFallback; |
| 17 |
|