Sha256: f24f6dfc745a0fc3693fc7b9c81b4a16e516515d19edace35049a8869721c2c3
Contents?: true
Size: 840 Bytes
Versions: 11
Compression:
Stored size: 840 Bytes
Contents
u = up.util class up.UrlSet constructor: (@urls, options = {}) -> @normalizeUrl = options.normalizeUrl || u.normalizeUrl @urls = u.map(@urls, @normalizeUrl) @urls = u.compact(@urls) matches: (testUrl) => if testUrl.indexOf('*') >= 0 @doesMatchPattern(testUrl) else @doesMatchFully(testUrl) doesMatchFully: (testUrl) => u.contains(@urls, testUrl) doesMatchPattern: (pattern) => placeholder = "__ASTERISK__" pattern = pattern.replace(/\*/g, placeholder) pattern = u.escapeRegexp(pattern) pattern = pattern.replace(new RegExp(placeholder, 'g'), '.*?') pattern = new RegExp('^' + pattern + '$') u.find @urls, (url) -> pattern.test(url) matchesAny: (testUrls) => u.find(testUrls, @matches) "#{u.isEqual.key}": (otherSet) => u.isEqual(@urls, otherSet?.urls)
Version data entries
11 entries across 11 versions & 1 rubygems