lib/phonelib/phone_analyzer.rb in phonelib-0.4.9 vs lib/phonelib/phone_analyzer.rb in phonelib-0.5.0
- old
+ new
@@ -143,10 +143,10 @@
# * +country_match+ - result of match of phone within full regex
def get_national_and_data(phone, data, country_match)
prefix_length = data[Core::COUNTRY_CODE].length
prefix_length += [1, 2].map { |i| country_match[i].to_s.size }.inject(:+)
result = data.select { |k, v| k != :types && k != :formats }
- result[:national] = phone[prefix_length..-1]
+ result[:national] = phone[prefix_length..-1] || ''
result[:format] = get_number_format(result[:national],
data[Core::FORMATS])
result.merge! all_number_types(result[:national], data[Core::TYPES])
{ result[:id] => result }
end