Skip to content

Commit 3123e77

Browse files
committed
Merge pull request #7 from spicydonuts/master
fixed a couple readme references to the old api
2 parents 4074466 + 3c07d95 commit 3123e77

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ var pattern = new Pattern(':sub.google.com', '.');
103103
```
104104

105105
the default separator is `/`. you can pass a custom separator
106-
as the second argument to `newPattern`.
106+
as the second argument to `Pattern`.
107107

108108
##### match pattern against domain
109109

@@ -117,7 +117,7 @@ pattern.match('www.google.io'); // => null
117117
##### make pattern from regex
118118

119119
```javascript
120-
var regexPattern = urlPattern.newPattern(/example\.(.*)/);
120+
var regexPattern = new Pattern(/example\.(.*)/);
121121
```
122122

123123
##### match regex pattern against domain

lib/url-pattern.js

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/url-pattern.coffee

+4
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@
103103
.replace(':' + name,"([^\\#{separator}]+)")
104104

105105
return "^#{stringWithEscapedSeparators}$"
106+
107+
UrlPattern.newPattern = () ->
108+
# helpful hint for new API
109+
throw Error('`urlPattern.newPattern` is no longer supported. Use `new Pattern` instead.');
106110

107111
return UrlPattern
108112
)

test/url-pattern.coffee

+4
Original file line numberDiff line numberDiff line change
@@ -273,3 +273,7 @@ module.exports =
273273
userId: '10'
274274
taskId: '52'
275275
test.done()
276+
277+
'new API warning': (test) ->
278+
test.throws Pattern.newPattern
279+
test.done()

0 commit comments

Comments
 (0)