Skip to content

Commit

Permalink
deps: make "only" package inside (#1824)
Browse files Browse the repository at this point in the history
closes #1802
  • Loading branch information
kravorkid committed Jun 20, 2024
1 parent b89e19a commit 757e4eb
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Emitter = require('events')
const util = require('util')
const Stream = require('stream')
const http = require('http')
const only = require('only')
const only = require('./only.js')
const { HttpError } = require('http-errors')

/** @typedef {typeof import ('./context') & {
Expand Down
11 changes: 11 additions & 0 deletions lib/only.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = (obj, keys) => {
obj = obj || {}
if (typeof keys === 'string') keys = keys.split(/ +/)
const ret = {}
for (let i = 0; i < keys.length; i++) {
const key = keys[i]
if (obj[key] == null) continue
ret[key] = obj[key]
}
return ret
}
2 changes: 1 addition & 1 deletion lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const parse = require('parseurl')
const qs = require('querystring')
const typeis = require('type-is')
const fresh = require('fresh')
const only = require('only')
const only = require('./only.js')
const util = require('util')

const IP = Symbol('context#ip')
Expand Down
2 changes: 1 addition & 1 deletion lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const destroy = require('destroy')
const assert = require('assert')
const extname = require('path').extname
const vary = require('vary')
const only = require('only')
const only = require('./only.js')
const util = require('util')
const encodeUrl = require('encodeurl')
const Stream = require('stream')
Expand Down
6 changes: 0 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"http-errors": "^1.6.3",
"koa-compose": "^4.1.0",
"on-finished": "^2.3.0",
"only": "~0.0.2",
"parseurl": "^1.3.2",
"statuses": "^1.5.0",
"type-is": "^1.6.16",
Expand Down

0 comments on commit 757e4eb

Please sign in to comment.