Sha256: ef30a65f3f7086f4cdfb57b24830e942dff62c1a4f2280f79a2f4416fd1258c8

Contents?: true

Size: 740 Bytes

Versions: 17

Compression:

Stored size: 740 Bytes

Contents

/*!
 * compressible
 * Copyright(c) 2014 Jeremiah Senkpiel
 * MIT Licensed
 */

/**
 * Module dependencies.
 */

var db = require('mime-db')

/**
 * Module exports.
 */

module.exports = compressible

/**
 * Checks if a type is compressible.
 *
 * @param {string} type
 * @return {Boolean} compressible
 */

function compressible(type) {
  if (!type || typeof type !== "string") return false

  // Strip charset
  var i = type.indexOf(';')
  if (~i) type = type.slice(0, i)

  // handle types that have capitals or excess space
  type = type.trim().toLowerCase()
  
  // attempt to look up from database; fallback to regex if not found
  var mime = db[type]
  return mime ? mime.compressible : /^text\/|\+json$|\+text$|\+xml$/.test(type)
}

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
hooch-0.4.1 jasmine/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
hooch-0.4.0 jasmine/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
hooch-0.3.0 jasmine/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
hooch-0.2.1 jasmine/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
hooch-0.2.0 jasmine/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
hooch-0.1.0 jasmine/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
hooch-0.0.8 jasmine/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
hooch-0.0.7 jasmine/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
hooch-0.0.6 jasmine/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
entangled-0.0.13 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
entangled-0.0.12 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
entangled-0.0.11 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js
entangled-0.0.10 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/compression/node_modules/compressible/index.js