Skip to content
Browse files

Throw error if layer names start with a number

  • Loading branch information
Koen Bok
Koen Bok committed Dec 16, 2015
1 parent 864d7d5 commit b4583d4d5eed5939edcfbabe8a6c8627d0a45d5d
Showing with 6 additions and 1 deletion.
  1. +6 −1 framer/
@@ -27,7 +27,8 @@ getScaleFromName = (str) ->

return null

startsWithNumber = (str) ->
return (new RegExp("^[0-9]")).test(str)

class exports.Importer

@@ -123,6 +124,10 @@ class exports.Importer
else if superLayer
layerInfo.superLayer = superLayer

# Layer names cannot start with a number
if startsWithNumber(
throw new Error("(#{}) Layer or Artboard names can not start with a number")

# Sanitize the layer names so mylayer.jpg gets converted to mylayer
for suffix in [".jpg", ".pdf"] =, "") if _.endsWith(, suffix)

0 comments on commit b4583d4

Please sign in to comment.
You can’t perform that action at this time.