example.js 454 B

1234567891011121314151617
  1. var match = require('./');
  2. // exact match
  3. console.log(match('image/jpeg', 'image/jpeg'));
  4. // --> true
  5. // wildcard match
  6. console.log(match('image/jpeg', 'image/*'));
  7. // --> true
  8. // find which of our wildcard patterns matches a specific mimetype
  9. console.log(['application/*', 'image/*'].filter(match('image/jpeg')));
  10. // --> ['image/*']
  11. // charset suffix is ignored
  12. console.log(match('application/json', 'application/json; charset=utf-8'));
  13. // --> true