Skip to content

Commit

Permalink
chore: bump deps, fixed lint issues, updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed Sep 2, 2019
1 parent 75783ef commit 2b04021
Show file tree
Hide file tree
Showing 6 changed files with 1,372 additions and 2,409 deletions.
3 changes: 2 additions & 1 deletion .dist.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"Object.getOwnPropertySymbols",
"Symbol.iterator",
"Symbol.prototype",
"Symbol.for"
"Symbol.for",
"Object.assign"
]
}
}
3 changes: 2 additions & 1 deletion .lib.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"Symbol.prototype",
"Number.isFinite",
"Object.getOwnPropertySymbols",
"Symbol.for"
"Symbol.for",
"Object.assign"
]
}
}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ We highly recommend to simply use [Cabin][] as this package is built-in!
The example below uses [xhook][] which is used to intercept HTTP requests made in the browser.

```html
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6,Number.isFinite,Object.getOwnPropertySymbols,Symbol.iterator,Symbol.prototype,Symbol.for"></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6,Number.isFinite,Object.getOwnPropertySymbols,Symbol.iterator,Symbol.prototype,Symbol.for,Object.assign"></script>
<script src="https://unpkg.com/xhook"></script>
<script src="https://unpkg.com/parse-request"></script>
<script type="text/javascript">
Expand All @@ -206,14 +206,15 @@ The example below uses [xhook][] which is used to intercept HTTP requests made i
We recommend using <https://polyfill.io> (specifically with the bundle mentioned in [VanillaJS](#vanillajs) above):

```html
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6,Number.isFinite,Object.getOwnPropertySymbols,Symbol.iterator,Symbol.prototype,Symbol.for"></script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6,Number.isFinite,Object.getOwnPropertySymbols,Symbol.iterator,Symbol.prototype,Symbol.for,Object.assign"></script>
```

* Number.isFinite() is not supported in IE 10
* Object.getOwnPropertySymbols() is not supported in IE 10
* Symbol.iterator() is not supported in IE 10
* Symbol.prototype() is not supported in IE 10
* Symbol.for() is not supported in IE 10
* Object.assign() is not supported in IE 10

### Koa

Expand Down
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,43 +36,43 @@
"ms": "^2.1.2",
"no-case": "^2.3.2",
"rfdc": "^1.1.4",
"sensitive-fields": "^0.0.5",
"sensitive-fields": "^0.0.6",
"url-parse": "^1.4.7"
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@commitlint/cli": "^8.0.0",
"@commitlint/config-conventional": "^8.0.0",
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"@koa/multer": "^2.0.0",
"@koa/router": "^8.0.0",
"ava": "^2.1.0",
"ava": "^2.3.0",
"babelify": "^10.0.0",
"browserify": "^16.2.3",
"cabin": "^3.0.8",
"browserify": "^16.5.0",
"cabin": "^5.0.0",
"codecov": "^3.5.0",
"cross-env": "^5.2.0",
"eslint": "^6.0.1",
"cross-env": "^5.2.1",
"eslint": "^6.3.0",
"eslint-config-xo-lass": "^1.0.3",
"eslint-plugin-compat": "^3.2.0",
"eslint-plugin-node": "^9.1.0",
"eslint-plugin-compat": "^3.3.0",
"eslint-plugin-node": "^9.2.0",
"express": "^4.17.1",
"express-request-id": "^1.4.1",
"fixpack": "^2.3.1",
"husky": "^2.7.0",
"husky": "^3.0.5",
"jsdom": "^15.1.1",
"koa": "^2.7.0",
"koa": "^2.8.1",
"koa-connect": "^2.0.1",
"lint-staged": "^8.2.1",
"lint-staged": "^9.2.5",
"multer": "^2.0.0-alpha.7",
"nyc": "^14.1.1",
"prettier": "^1.18.2",
"remark-cli": "^6.0.1",
"remark-preset-github": "^0.0.14",
"remark-cli": "^7.0.0",
"remark-preset-github": "^0.0.16",
"request-received": "^0.0.2",
"response-time": "^2.3.2",
"rimraf": "^2.6.3",
"rimraf": "^3.0.0",
"signale": "^1.4.0",
"supertest": "^4.0.2",
"tinyify": "^2.5.1",
Expand Down
80 changes: 43 additions & 37 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@ function maskArray(obj, options) {
}

function maskSpecialTypes(obj, options) {
options = {
maskBuffers: true,
maskStreams: true,
checkObjectId: true,
...options
};
options = Object.assign(
{
maskBuffers: true,
maskStreams: true,
checkObjectId: true
},
options
);
if (typeof obj !== 'object') return obj;

// we need to return an array if passed an array
Expand Down Expand Up @@ -229,15 +231,17 @@ function headersToLowerCase(headers) {
}

function maskProps(obj, props, options) {
options = {
maskCreditCards: true,
isHeaders: false,
checkId: true,
checkCuid: true,
checkObjectId: true,
checkUUID: true,
...options
};
options = Object.assign(
{
maskCreditCards: true,
isHeaders: false,
checkId: true,
checkCuid: true,
checkObjectId: true,
checkUUID: true
},
options
);

if (isString(obj)) return maskString(null, obj, props, options);

Expand All @@ -258,29 +262,31 @@ const parseRequest = (config = {}) => {
const start = hrtime();
const id = new ObjectId();

config = {
req: false,
ctx: false,
responseHeaders: '',
userFields: ['id', 'email', 'full_name', 'ip_address'],
sanitizeFields: sensitiveFields,
sanitizeHeaders: ['authorization'],
maskCreditCards: true,
maskBuffers: true,
maskStreams: true,
checkId: true,
checkCuid: true,
checkObjectId: true,
checkUUID: true,
// <https://github.com/davidmarkclements/rfdc>
rfdc: {
proto: false,
circles: false
config = Object.assign(
{
req: false,
ctx: false,
responseHeaders: '',
userFields: ['id', 'email', 'full_name', 'ip_address'],
sanitizeFields: sensitiveFields,
sanitizeHeaders: ['authorization'],
maskCreditCards: true,
maskBuffers: true,
maskStreams: true,
checkId: true,
checkCuid: true,
checkObjectId: true,
checkUUID: true,
// <https://github.com/davidmarkclements/rfdc>
rfdc: {
proto: false,
circles: false
},
parseBody: true,
parseFiles: true
},
parseBody: true,
parseFiles: true,
...config
};
config
);

const clone = rfdc(config.rfdc);

Expand Down
Loading

0 comments on commit 2b04021

Please sign in to comment.