Skip to content

Commit

Permalink
fix: remove lodash-es from deps
Browse files Browse the repository at this point in the history
  • Loading branch information
thihathit committed Jun 13, 2023
1 parent 694058b commit ede739e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 11 deletions.
3 changes: 1 addition & 2 deletions core/router.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { mapValues } from 'lodash-es'
import { Signal, signal, computed, effect } from '@preact/signals-core'

import { buildURL } from '$utility/url'
import { mapValues, buildURL } from '$utility'

import {
RouteName,
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@commitlint/cli": "^17.4.4",
"@commitlint/config-conventional": "^17.4.4",
"@commitlint/types": "^17.4.4",
"@types/lodash-es": "^4.17.6",
"@types/lodash-es": "^4.17.7",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.55.0",
Expand All @@ -65,6 +65,7 @@
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unused-imports": "^2.0.0",
"lodash-es": "^4.17.21",
"prettier": "^2.8.4",
"pretty-quick": "^3.1.3",
"publint": "^0.1.11",
Expand All @@ -80,7 +81,6 @@
"zod": "^3.21.4"
},
"dependencies": {
"@preact/signals-core": "^1.2.3",
"lodash-es": "^4.17.21"
"@preact/signals-core": "^1.2.3"
}
}
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

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

20 changes: 20 additions & 0 deletions utility/functions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export const mapValues = <Value extends object, Result extends object>(
original: Value,
iteratee: (
value: Value[keyof Value],
key: keyof Value,
original: Value
) => Result
) => {
type Key = keyof Value
type NewValues = Record<Key, Result>

const values = Object(original)
const newValues = {} as NewValues

Object.keys(values).forEach(key => {
newValues[key as Key] = iteratee(values[key], key as Key, values)
})

return newValues
}
1 change: 1 addition & 0 deletions utility/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './url'
export * from './functions'

0 comments on commit ede739e

Please sign in to comment.