Skip to content

Commit

Permalink
Remove lodash
Browse files Browse the repository at this point in the history
  • Loading branch information
underscope committed Dec 18, 2024
1 parent 7c71d9e commit aeb01d3
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 19 deletions.
5 changes: 2 additions & 3 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,16 @@
"bytes": "^3.1.2",
"camelcase": "^8.0.0",
"class-transformer": "^0.5.1",
"lodash": "^4.17.21",
"mime-types": "^2.1.35",
"object-sizeof": "^2.6.5",
"reflect-metadata": "^0.2.2"
"reflect-metadata": "^0.2.2",
"set-value": "^4.1.0"
},
"devDependencies": {
"@antfu/eslint-config": "^3.8.0",
"@antfu/ni": "^0.23.0",
"@antfu/utils": "^0.7.10",
"@types/bytes": "^3.1.4",
"@types/lodash": "^4.17.12",
"@types/mime-types": "^2.1.4",
"@types/node": "^22.7.7",
"bumpp": "^9.7.1",
Expand Down
4 changes: 2 additions & 2 deletions lib/src/garment/entities/activity/Activity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { FileKey } from '../../interfaces'
import bytes from 'bytes'
import { Exclude, plainToClass, Type } from 'class-transformer'
import omit from 'lodash/omit.js'

import sizeof from 'object-sizeof'
import { ContentContainer, Repository } from '../'
Expand Down Expand Up @@ -94,6 +93,7 @@ export class Activity {
}

toJSON() {
return omit(this, ['repository'])
const { repository, ...rest } = this
return rest
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { FileKey } from '../../interfaces'
import bytes from 'bytes'
import { Type } from 'class-transformer'
import isString from 'lodash/isString.js'

import sizeof from 'object-sizeof'
import { isString } from '../../../utils'
import { type GraphNodeArray, NodeType } from '../../content-graph'
import { ContentElement } from '../content-element'

Expand Down
2 changes: 1 addition & 1 deletion lib/src/garment/entities/content-element/ContentElement.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import bytes from 'bytes'
import camelCase from 'camelcase'
import { Transform, Type } from 'class-transformer'
import set from 'lodash/set.js'
import sizeof from 'object-sizeof'

import set from 'set-value'
import { type GraphNodeArray, NodeType } from '../../content-graph'

// seconds, 12 hrs
Expand Down
5 changes: 2 additions & 3 deletions lib/src/garment/entities/repository/Repository.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { FileKey } from '../../interfaces'
import bytes from 'bytes'
import { plainToClass, Type } from 'class-transformer'
import flatten from 'lodash/flatten.js'
import isString from 'lodash/isString.js'
import sizeof from 'object-sizeof'

import { Activity, ContentContainer } from '../'
import { isString } from '../../../utils'
import { ContentGraph } from '../../content-graph'
import { GarmentEnv } from '../../enums'

Expand Down Expand Up @@ -55,7 +54,7 @@ export class Repository {

get containers(): ContentContainer[] {
const { activitiesWithContainers: activities } = this
return flatten(activities.map(it => it.contentContainers))
return activities.map(it => it.contentContainers).flat()
}

async load(): Promise<Repository> {
Expand Down
1 change: 1 addition & 0 deletions lib/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const isString = val => typeof val === 'string' || val instanceof String
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@
},
"dependencies": {
"aws-sdk": "^2.1691.0",
"dotenv": "^16.4.5",
"lodash": "^4.17.21"
"dotenv": "^16.4.5"
},
"devDependencies": {
"@antfu/eslint-config": "^3.8.0",
"@antfu/ni": "^0.23.0",
"@antfu/utils": "^0.7.10",
"@types/lodash": "^4.17.12",
"@types/node": "^22.7.7",
"bumpp": "^9.7.1",
"concurrently": "^9.0.1",
Expand Down
38 changes: 32 additions & 6 deletions pnpm-lock.yaml

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

0 comments on commit aeb01d3

Please sign in to comment.