( block: string, existingBlocks: string[] )
| 285 | }; |
| 286 | |
| 287 | const validateBlockName = ( |
| 288 | block: string, |
| 289 | existingBlocks: string[] |
| 290 | ): true | string => { |
| 291 | if (existingBlocks.includes(block.trim())) { |
| 292 | return 'a block with this name already exists'; |
| 293 | } |
| 294 | if (!block.trim().length) { |
| 295 | return 'please enter a dashed name'; |
| 296 | } |
| 297 | if (/[^a-z0-9-]/.test(block.trim())) { |
| 298 | return 'please use alphanumerical characters and kebab case'; |
| 299 | } |
| 300 | return true; |
| 301 | }; |
| 302 | |
| 303 | export { |
| 304 | createStepFile, |
no outgoing calls
no test coverage detected