Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed a couple readme references to the old api #7

Merged
merged 2 commits into from
Apr 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var pattern = new Pattern(':sub.google.com', '.');
```

the default separator is `/`. you can pass a custom separator
as the second argument to `newPattern`.
as the second argument to `Pattern`.

##### match pattern against domain

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

```javascript
var regexPattern = urlPattern.newPattern(/example\.(.*)/);
var regexPattern = new Pattern(/example\.(.*)/);
```

##### match regex pattern against domain
Expand Down
3 changes: 3 additions & 0 deletions lib/url-pattern.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/url-pattern.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
.replace(':' + name,"([^\\#{separator}]+)")

return "^#{stringWithEscapedSeparators}$"

UrlPattern.newPattern = () ->
# helpful hint for new API
throw Error('`urlPattern.newPattern` is no longer supported. Use `new Pattern` instead.');

return UrlPattern
)
4 changes: 4 additions & 0 deletions test/url-pattern.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,7 @@ module.exports =
userId: '10'
taskId: '52'
test.done()

'new API warning': (test) ->
test.throws Pattern.newPattern
test.done()