1.0.2 • Published 2 years ago

transform-values-deep v1.0.2

Weekly downloads
-
License
BSL-1.0
Repository
github
Last release
2 years ago

transform-values-deep

build

Deeply convert object values using specified predicate.

const foo = () => true;
const actual = transformAnyValuesDeep(
  {
    a: 4,
    b: {
      c: '7',
      f: foo,
    },
    d: '9',
  },
  (s: string) => parseInt(s),
  (o: unknown): o is string => typeof o === 'string'
);
/*
=> {
  a: 4,
  b: {
    c: 7,
    f: foo,
  },
  d: 9,
}
*/