Skip to content

Commit

Permalink
Remove import of lodash (segmentio#1749)
Browse files Browse the repository at this point in the history
  • Loading branch information
LLuque-twilio authored Nov 30, 2023
1 parent c9dad64 commit f45356f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/core/src/mapping-kit/value-keys.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// import { isDirective } from './is-directive'
// eslint-disable-next-line lodash/import-scope
import _ from 'lodash'

type ValueType = 'enrichment' | 'function' | 'literal' | 'variable'

function isObject(value: any): value is object {
return value !== null && typeof value === 'object'
}

export interface DirectiveMetadata {
_metadata?: {
label?: string
Expand Down Expand Up @@ -191,7 +191,7 @@ export function getFieldValueKeys(value: FieldValue): string[] {
'@template': (input: TemplateDirective) => getTemplateKeys(input['@template'])
})?.filter((k) => k) ?? []
)
} else if (_.isObject(value)) {
} else if (isObject(value)) {
return Object.values(value).flatMap(getFieldValueKeys)
}
return []
Expand All @@ -203,7 +203,7 @@ export function getFieldValueKeys(value: FieldValue): string[] {
export function getRawKeys(input: FieldValue): string[] {
if (isDirective(input)) {
return getFieldValueKeys(input)
} else if (_.isObject(input)) {
} else if (isObject(input)) {
return Object.values(input).flatMap(getFieldValueKeys)
}
return []
Expand Down

0 comments on commit f45356f

Please sign in to comment.