parse_attributes!

in lib/generators/react/component_generator.rb [189:210]


      def parse_attributes!
        self.attributes = (attributes || []).map do |attr|
          name = ''
          type = ''
          args = ''
          args_regex = /(?<args>{.*})/

          name, type = attr.split(':')

          if matchdata = args_regex.match(type)
            args = matchdata[:args]
            type = type.gsub(args_regex, '')
          end

          if options[:ts]
            { :name => name, :type => ts_lookup(name, type, args), :union => union?(args) }
          else
            { :name => name, :type => lookup(type, args) }
          end
        end
      end