UNPKG

@stryke/helpers

Version:

A package containing miscellaneous helper functions that are used across many different Storm Software projects.

2 lines (1 loc) 300 B
import{isNumber as e}from"@stryke/type-checks/is-number";import{isSetString as i}from"@stryke/type-checks/is-set-string";export function toDeepKey(n){return n.reduce((r,t)=>addPathToDeepKey(r,t))}export function addPathToDeepKey(n,r){return e(r)||Number.isInteger(r)?`${n}[${r}]`:i(r)?`${n}.${r}`:n}