@@ -8,6 +8,7 @@ import { build, buildString } from './compiler.js'
88import chainingSupported from './utilities/chainingSupported.js'
99import InvalidControlInput from './errors/InvalidControlInput.js'
1010import YieldingIterators from './yieldingIterators.js'
11+ import { splitPath } from './utilities/splitPath.js'
1112
1213function isDeterministic ( method , engine , buildState ) {
1314 if ( Array . isArray ( method ) ) {
@@ -161,7 +162,8 @@ const defaultMethods = {
161162 get : {
162163 method : ( [ data , key , defaultValue ] , context , above , engine ) => {
163164 const notFound = defaultValue === undefined ? null : defaultValue
164- const subProps = String ( key ) . split ( '.' )
165+
166+ const subProps = splitPath ( String ( key ) )
165167 for ( let i = 0 ; i < subProps . length ; i ++ ) {
166168 if ( data === null || data === undefined ) {
167169 return notFound
@@ -203,7 +205,7 @@ const defaultMethods = {
203205 }
204206 return null
205207 }
206- const subProps = String ( key ) . split ( '.' )
208+ const subProps = splitPath ( String ( key ) )
207209 for ( let i = 0 ; i < subProps . length ; i ++ ) {
208210 if ( context === null || context === undefined ) {
209211 return notFound
@@ -810,7 +812,7 @@ defaultMethods.get.compile = function (data, buildState) {
810812 if ( key && typeof key === 'object' ) return false
811813
812814 key = key . toString ( )
813- const pieces = key . split ( '.' )
815+ const pieces = splitPath ( key )
814816 if ( ! chainingSupported ) {
815817 return `(((a,b) => (typeof a === 'undefined' || a === null) ? b : a)(${ pieces . reduce (
816818 ( text , i ) => {
@@ -854,7 +856,7 @@ defaultMethods.var.compile = function (data, buildState) {
854856 buildState . useContext = true
855857 return false
856858 }
857- const pieces = key . split ( '.' )
859+ const pieces = splitPath ( key )
858860 const [ top ] = pieces
859861 buildState . varTop . add ( top )
860862 // support older versions of node
0 commit comments