Sha256: 405769c45a3be5bd22df04542c8dc870929d4c8f556aa733a9f5312c5a7c9aa5
Contents?: true
Size: 570 Bytes
Versions: 4
Compression:
Stored size: 570 Bytes
Contents
# Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 class TwitterCldr.PostalCodes postal_codes = `{{{postal_codes}}}` find_regex = (territory) -> regex_str = postal_codes[territory] if regex_str? then regex_str else null @territories: -> @codes ||= (data for data, _ of postal_codes) @regex_for_territory: (territory) -> regex = find_regex(territory) if regex? then new RegExp(regex) else null @is_valid: (territory, postal_code) -> regex = @regex_for_territory(territory) regex.test (postal_code)
Version data entries
4 entries across 4 versions & 1 rubygems