Skip to content

Commit

Permalink
refactor: inline types
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Sep 14, 2023
1 parent 4c6ae83 commit eb19ee7
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/runtime/utils/lodash.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
type OmitObject<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;

export function omit<T extends Record<string, any>, K extends keyof T> (
object: T,
keysToOmit: K[] | any[]
): OmitObject<T, K> {
): Pick<T, Exclude<keyof T, K>> {
const result = { ...object }

for (const key of keysToOmit) {
delete result[key]
}

return result as OmitObject<T, K>
return result
}


type Path = (string | number)[] | string;

export function get (object: Record<string, any>, path: Path, defaultValue?: any): any {
export function get (object: Record<string, any>, path: (string | number)[] | string, defaultValue?: any): any {
if (typeof path === 'string') {
path = path.split('.').map(key => {
const numKey = Number(key)
Expand Down

0 comments on commit eb19ee7

Please sign in to comment.