-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: use npm scripts instead of Makefile (#9)
- Loading branch information
Showing
16 changed files
with
167 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
test/fixtures | ||
examples/**/app/public | ||
logs | ||
run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "eslint-config-egg" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
sudo: false | ||
language: node_js | ||
node_js: | ||
- '0.10' | ||
- '0.11' | ||
script: make test-coveralls | ||
- '4' | ||
- '6' | ||
- '7' | ||
install: | ||
- npm i npminstall && npminstall | ||
script: | ||
- npm run ci | ||
after_script: | ||
- npminstall codecov && codecov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
# Ordered by date of first contribution. | ||
# Auto-generated by 'contributors' on Mon, 20 Jan 2014 01:34:58 GMT. | ||
# https://github.com/xingrz/node-contributors | ||
|
||
fengmk2 <fengmk2@gmail.com> (https://github.com/fengmk2) | ||
kof <oleg008@gmail.com> (https://github.com/kof) | ||
Oleg Slobodskoi <oleg008@gmail.com> (https://github.com/kof) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
environment: | ||
matrix: | ||
- nodejs_version: '4' | ||
- nodejs_version: '6' | ||
- nodejs_version: '7' | ||
|
||
install: | ||
- ps: Install-Product node $env:nodejs_version | ||
- npm i npminstall && node_modules\.bin\npminstall | ||
|
||
test_script: | ||
- node --version | ||
- npm --version | ||
- npm run ci | ||
|
||
build: off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,59 @@ | ||
module.exports = require('./lib/charset'); | ||
'use strict'; | ||
|
||
const CHARTSET_RE = /(?:charset|encoding)\s*=\s*['"]? *([\w\-]+)/i; | ||
|
||
module.exports = charset; | ||
|
||
/** | ||
* guest data charset from req.headers, xml, html content-type meta tag | ||
* headers: | ||
* 'content-type': 'text/html;charset=gbk' | ||
* meta tag: | ||
* <meta http-equiv="Content-Type" content="text/html; charset=xxxx"/> | ||
* xml file: | ||
* <?xml version="1.0" encoding="UTF-8"?> | ||
* | ||
* @param {Object} obj `Content-Type` String, or `res.headers`, or `res` Object | ||
* @param {Buffer} [data] content buffer | ||
* @param {Number} [peekSize] max content peek size, default is 512 | ||
* @return {String} charset, lower case, e.g.: utf8, gbk, gb2312, .... | ||
* If can\'t guest, return null | ||
* @api public | ||
*/ | ||
function charset(obj, data, peekSize) { | ||
let matchs = null; | ||
let end = 0; | ||
if (data) { | ||
peekSize = peekSize || 512; | ||
// https://github.com/node-modules/charset/issues/4 | ||
end = data.length > peekSize ? peekSize : data.length; | ||
} | ||
// charset('text/html;charset=gbk') | ||
let contentType = obj; | ||
if (contentType && typeof contentType !== 'string') { | ||
// charset(res.headers) | ||
let headers = obj; | ||
if (obj.headers) { | ||
// charset(res) | ||
headers = obj.headers; | ||
} | ||
contentType = headers['content-type'] || headers['Content-Type']; | ||
} | ||
if (contentType) { | ||
// guest from obj first | ||
matchs = CHARTSET_RE.exec(contentType); | ||
} | ||
if (!matchs && end > 0) { | ||
// guest from content body (html/xml) header | ||
contentType = data.slice(0, end).toString(); | ||
matchs = CHARTSET_RE.exec(contentType); | ||
} | ||
let cs = null; | ||
if (matchs) { | ||
cs = matchs[1].toLowerCase(); | ||
if (cs === 'utf-8') { | ||
cs = 'utf8'; | ||
} | ||
} | ||
return cs; | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.