You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
454 B
18 lines
454 B
|
2 years ago
|
var match = require('./');
|
||
|
|
|
||
|
|
// exact match
|
||
|
|
console.log(match('image/jpeg', 'image/jpeg'));
|
||
|
|
// --> true
|
||
|
|
|
||
|
|
// wildcard match
|
||
|
|
console.log(match('image/jpeg', 'image/*'));
|
||
|
|
// --> true
|
||
|
|
|
||
|
|
// find which of our wildcard patterns matches a specific mimetype
|
||
|
|
console.log(['application/*', 'image/*'].filter(match('image/jpeg')));
|
||
|
|
// --> ['image/*']
|
||
|
|
|
||
|
|
// charset suffix is ignored
|
||
|
|
console.log(match('application/json', 'application/json; charset=utf-8'));
|
||
|
|
// --> true
|