Sha256: 7771c998966d990496c3d39c5d1fab9a764fc19ebe5aa3b4b7a9504e723d2074
Contents?: true
Size: 565 Bytes
Versions: 4
Compression:
Stored size: 565 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