Skip to content

Commit 3c07d95

Browse files
committed
added a more helpful warning for api change
1 parent dd63e23 commit 3c07d95

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

Diff for: lib/url-pattern.js

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

Diff for: 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
)

Diff for: 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)