# File lib/vpim/vcard.rb, line 759
    def value(name, type = nil)
      v = nil

      fields = enum_by_name(name).find_all { |f| type == nil || f.type?(type) }

      valued = fields.select { |f| f.value != '' }
      if valued.first
        fields = valued
      end

      pref = fields.select { |f| f.pref? }

      if pref.first
        fields = pref
      end

      if fields.first
        line = begin
                 Line.decode(@@decode, self, fields.first)
               rescue Vpim::InvalidEncodingError
               end

        if line
          return line.value
        end
      end

      nil
    end