split-keypath
Splits strings into an array of keys used for reading nested data structures
split-keypath is a method that takes a string as an input and generates an array of keys that can be used for reading values from a deeply nested object. The algorithm supports extracting array keys, which is how you can specify arbitrary keys. Please see below for examples.
Install
$ npm install split-keypath
The npm package has a bundle for the browser
Examples
;var result = ;// Result is ["hello", "world"]
;var result = ;// Result is ["hello", "0", "world", "some really long string. with non ascii chars."];
Practical use that reads a value from a somewhat deeply nested object hierarchy
;{return ;}var input =some:deep:key: 42;var result = ;// Result is 42
License
MIT