提交 fd276274 编写于 作者: 澄清寰宇's avatar 澄清寰宇

提交修改

上级 9b68fa64
...@@ -29,7 +29,7 @@ module.exports = Accepts ...@@ -29,7 +29,7 @@ module.exports = Accepts
* @public * @public
*/ */
function Accepts (req) { function Accepts(req) {
if (!(this instanceof Accepts)) { if (!(this instanceof Accepts)) {
return new Accepts(req) return new Accepts(req)
} }
...@@ -80,7 +80,7 @@ function Accepts (req) { ...@@ -80,7 +80,7 @@ function Accepts (req) {
*/ */
Accepts.prototype.type = Accepts.prototype.type =
Accepts.prototype.types = function (types_) { Accepts.prototype.types = function (types_) {
var types = types_ var types = types_
// support flattened arguments // support flattened arguments
...@@ -105,10 +105,10 @@ Accepts.prototype.types = function (types_) { ...@@ -105,10 +105,10 @@ Accepts.prototype.types = function (types_) {
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime)) var accepts = this.negotiator.mediaTypes(mimes.filter(validMime))
var first = accepts[0] var first = accepts[0]
return first return first ?
? types[mimes.indexOf(first)] types[mimes.indexOf(first)] :
: false false
} }
/** /**
* Return accepted encodings or best fit based on `encodings`. * Return accepted encodings or best fit based on `encodings`.
...@@ -124,7 +124,7 @@ Accepts.prototype.types = function (types_) { ...@@ -124,7 +124,7 @@ Accepts.prototype.types = function (types_) {
*/ */
Accepts.prototype.encoding = Accepts.prototype.encoding =
Accepts.prototype.encodings = function (encodings_) { Accepts.prototype.encodings = function (encodings_) {
var encodings = encodings_ var encodings = encodings_
// support flattened arguments // support flattened arguments
...@@ -141,7 +141,7 @@ Accepts.prototype.encodings = function (encodings_) { ...@@ -141,7 +141,7 @@ Accepts.prototype.encodings = function (encodings_) {
} }
return this.negotiator.encodings(encodings)[0] || false return this.negotiator.encodings(encodings)[0] || false
} }
/** /**
* Return accepted charsets or best fit based on `charsets`. * Return accepted charsets or best fit based on `charsets`.
...@@ -157,7 +157,7 @@ Accepts.prototype.encodings = function (encodings_) { ...@@ -157,7 +157,7 @@ Accepts.prototype.encodings = function (encodings_) {
*/ */
Accepts.prototype.charset = Accepts.prototype.charset =
Accepts.prototype.charsets = function (charsets_) { Accepts.prototype.charsets = function (charsets_) {
var charsets = charsets_ var charsets = charsets_
// support flattened arguments // support flattened arguments
...@@ -174,7 +174,7 @@ Accepts.prototype.charsets = function (charsets_) { ...@@ -174,7 +174,7 @@ Accepts.prototype.charsets = function (charsets_) {
} }
return this.negotiator.charsets(charsets)[0] || false return this.negotiator.charsets(charsets)[0] || false
} }
/** /**
* Return accepted languages or best fit based on `langs`. * Return accepted languages or best fit based on `langs`.
...@@ -190,9 +190,9 @@ Accepts.prototype.charsets = function (charsets_) { ...@@ -190,9 +190,9 @@ Accepts.prototype.charsets = function (charsets_) {
*/ */
Accepts.prototype.lang = Accepts.prototype.lang =
Accepts.prototype.langs = Accepts.prototype.langs =
Accepts.prototype.language = Accepts.prototype.language =
Accepts.prototype.languages = function (languages_) { Accepts.prototype.languages = function (languages_) {
var languages = languages_ var languages = languages_
// support flattened arguments // support flattened arguments
...@@ -209,7 +209,7 @@ Accepts.prototype.languages = function (languages_) { ...@@ -209,7 +209,7 @@ Accepts.prototype.languages = function (languages_) {
} }
return this.negotiator.languages(languages)[0] || false return this.negotiator.languages(languages)[0] || false
} }
/** /**
* Convert extnames to mime. * Convert extnames to mime.
...@@ -219,10 +219,10 @@ Accepts.prototype.languages = function (languages_) { ...@@ -219,10 +219,10 @@ Accepts.prototype.languages = function (languages_) {
* @private * @private
*/ */
function extToMime (type) { function extToMime(type) {
return type.indexOf('/') === -1 return type.indexOf('/') === -1 ?
? mime.lookup(type) mime.lookup(type) :
: type type
} }
/** /**
...@@ -233,6 +233,6 @@ function extToMime (type) { ...@@ -233,6 +233,6 @@ function extToMime (type) {
* @private * @private
*/ */
function validMime (type) { function validMime(type) {
return typeof type === 'string' return typeof type === 'string'
} }
\ No newline at end of file
/*
* @Author: 尹鹏孝
* @Date: 2018-09-07 16:38:01
* @LastEditTime: 2021-10-12 21:09:12
* @LastEditors: Please set LastEditors
* @Description: 操作webpack
* @FilePath: /web/webpack/src/index.js
*/
import _ from 'lodash' import _ from 'lodash'
import printMe from './print' import printMe from './print'
import './index.css' import './index.css'
...@@ -23,7 +31,7 @@ function createDiv() { ...@@ -23,7 +31,7 @@ function createDiv() {
document.body.appendChild(createDiv()) document.body.appendChild(createDiv())
if (module.hot) { if (module.hot) {
module.hot.accept('./print.js', function() { module.hot.accept('./print.js', function () {
console.log('热模块替换'); console.log('热模块替换');
printMe(); printMe();
}) })
......
/*
* @Author: 尹鹏孝
* @Date: 2021-10-12 20:44:57
* @LastEditTime: 2021-10-12 21:41:39
* @LastEditors: Please set LastEditors
* @Description: 配置测试环节的webpack
* @FilePath: /web/webpack/webpack.config.dev.js
*/
const path = require('path');
// require('style-loader!css-loader!./src/index.css?minimize')
const ExtractTextPlugin = require('mini-css-extract-plugin');
modules.export = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, './dist')
},
module: {
rules: [{
test: /\.css$/,
/* use: ['style-loader', 'css-loader?minimize', {
loader: 'css-loader',
options: {
minimize: true
}
}] */
loaders: ExtractTextPlugin.extract({
use: ['css-loader']
})
}]
},
plugins: [
new ExtractTextPlugin({
filename: [`[name]_[contenthash:8].css`]
})
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册