Skip to content

Commit

Permalink
Merge pull request #5 from ilovepixelart/feature/remove-dependency
Browse files Browse the repository at this point in the history
Remove dependency
  • Loading branch information
ilovepixelart authored Apr 30, 2023
2 parents 0298794 + 9a3e0bb commit 39cba89
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 15 deletions.
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.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
},
"dependencies": {
"ioredis": "5.3.2",
"lodash": "4.17.21",
"ms": "2.1.3",
"sort-keys": "4.2.0"
},
Expand All @@ -88,7 +87,6 @@
"@swc/jest": "0.2.26",
"@swc/register": "0.1.10",
"@types/jest": "29.5.1",
"@types/lodash": "4.14.194",
"@types/ms": "^0.7.31",
"@types/node": "18.16.2",
"@typescript-eslint/eslint-plugin": "5.59.1",
Expand Down
4 changes: 1 addition & 3 deletions src/extend/aggregate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import _ from 'lodash'

import type { Mongoose } from 'mongoose'
import type Cache from '../cache/Cache'

Expand Down Expand Up @@ -30,7 +28,7 @@ export default function extendQuery (mongoose: Mongoose, cache: Cache): void {

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
mongoose.Aggregate.prototype.exec = async function () {
if (!_.has(this, '_ttl')) {
if (!Object.prototype.hasOwnProperty.call(this, '_ttl')) {
return mongooseExec.apply(this)
}

Expand Down
6 changes: 2 additions & 4 deletions src/extend/query.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import _ from 'lodash'

import type { Mongoose } from 'mongoose'
import type Cache from '../cache/Cache'

Expand Down Expand Up @@ -48,7 +46,7 @@ export default function extendQuery (mongoose: Mongoose, cache: Cache): void {

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
mongoose.Query.prototype.exec = async function () {
if (!_.has(this, '_ttl')) {
if (!Object.prototype.hasOwnProperty.call(this, '_ttl')) {
return mongooseExec.apply(this)
}

Expand All @@ -70,7 +68,7 @@ export default function extendQuery (mongoose: Mongoose, cache: Cache): void {
}

const constructor = mongoose.model(model)
if (_.isArray(resultCache)) {
if (Array.isArray(resultCache)) {
return resultCache.map((item) => constructor.hydrate(item) as Record<string, unknown>)
} else {
return constructor.hydrate(resultCache) as Record<string, unknown>
Expand Down

0 comments on commit 39cba89

Please # to comment.