Skip to content

Instantly share code, notes, and snippets.

@ddanielsantos
Last active February 16, 2022 17:47
Show Gist options
  • Save ddanielsantos/814aa89fc5421e258b3220824d6bdabf to your computer and use it in GitHub Desktop.
Save ddanielsantos/814aa89fc5421e258b3220824d6bdabf to your computer and use it in GitHub Desktop.
JS Tools
export function removePropriedadesNumeradas<T extends Object>(objetoComNumero: T): Partial<T> {
const objetoTratado: Partial<T> = {}
const propriedades = Object.keys(objetoComNumero) as Array<keyof typeof objetoComNumero>
for (let index = 0; index < propriedades.length; index++) {
if (isNaN(Number(propriedades[index]))) {
objetoComNumero[propriedades[index]] = propriedades[index]
}
}
return objetoTratado
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment