Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

object-key-path-transformer

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-key-path-transformer

Transform object keys to corresponding path strings

latest
Source
npmnpm
Version
1.0.3
Version published
Weekly downloads
13
160%
Maintainers
1
Weekly downloads
 
Created
Source

object-key-path-transformer

DESCRIPTION

Transforms object keys to be strings correspending to their path. The operation is completely immutable even for nested objects.

Meant to be used with i18n-js and typescript as a way to provide type-safing and autocompletion.

EXAMPLE USAGE WITH i18N-JS

import i18n from 'i18n-js'
import transformKeys from 'object-key-path-transformer'

const en = {
  buttons: {
    next: 'Next'
  }
}

export const lang = transformKeys(en)

i18n.translations = { en }

i18n.t(lang.buttons.next) // value: "buttons.next"

Keywords

object

FAQs

Package last updated on 16 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts