import type { MakeNestedPathMethod } from './types' ; const makeNestedPath = ( nestedPath ) => { const jsonPathParts = [ ] ; for ( const part of nestedPath ) { if ( part == null || part . constructor !== String ) { throw new Error ( 'Invalid JSON path' ) ; } if ( ! isNaN ( + part ) ) { jsonPathParts . push ( String ( + part ) ) ; } else { jsonPathParts . push ( JSON . stringify ( part ) ) ; } } return `{${ jsonPathParts . join ( ',' ) }}` ; } ; export default makeNestedPath ;