Skip to content

lowerize

Convert all object keys to lower case

146 bytes
since v12.1.0

Usage

Convert all keys in an object to lower case. Useful to standardize attribute key casing. For example, headers.

import * as
import _
_
from 'radashi'
const
const ra: {
Mode: string;
Power: string;
}
ra
= {
type Mode: string
Mode
: 'god',
type Power: string
Power
: 'sun',
}
import _
_
.
function lowerize<{
Mode: string;
Power: string;
}>(obj: {
Mode: string;
Power: string;
}): _.LowercaseKeys<{
Mode: string;
Power: string;
}>

Convert all keys in an object to lower case.

@seehttps://radashi.js.org/reference/object/lowerize

@example

const a = { A: 1, B: 2, C: 3 }
lowerize(a)
// => { a: 1, b: 2, c: 3 }

@version12.1.0

lowerize
(
const ra: {
Mode: string;
Power: string;
}
ra
) // => { mode, power }

The _.lowerize function is a shortcut for _.mapKeys(obj, k => k.toLowerCase())