12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
-
-
- 'use strict'
-
-
-
- var db = require('mime-db')
-
-
-
- var COMPRESSIBLE_TYPE_REGEXP = /^text\/|\+(?:json|text|xml)$/i
- var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/
-
-
-
- module.exports = compressible
-
-
-
- function compressible (type) {
- if (!type || typeof type !== 'string') {
- return false
- }
-
-
- var match = EXTRACT_TYPE_REGEXP.exec(type)
- var mime = match && match[1].toLowerCase()
- var data = db[mime]
-
-
- if (data && data.compressible !== undefined) {
- return data.compressible
- }
-
-
- return COMPRESSIBLE_TYPE_REGEXP.test(mime) || undefined
- }
|