Retitle snippets

This commit is contained in:
Chalarangelo
2022-02-13 18:40:16 +02:00
parent cd58cfe194
commit d88d014e80
130 changed files with 134 additions and 134 deletions

View File

@ -1,11 +1,11 @@
---
title: invertKeyValues
title: Invert object
tags: object,advanced
firstSeen: 2018-01-01T17:33:46+02:00
lastUpdated: 2020-10-20T23:02:01+03:00
---
Inverts the key-value pairs of an object, without mutating it.
Inverts the key-value pairs of an object, without mutating it.
- Use `Object.keys()` and `Array.prototype.reduce()` to invert the key-value pairs of an object and apply the function provided (if any).
- Omit the second argument, `fn`, to get the inverted keys without applying a function to them.