UNPKG

abstract-state-router

Version:

The basics of a client-side state router ala the AngularJS ui-router, but without any DOM interactions

10 lines (9 loc) 294 B
module.exports = function(stateString) { return stateString.split('.').reduce(function(stateNames, latestNameChunk) { if (stateNames.length) { latestNameChunk = stateNames[stateNames.length - 1] + '.' + latestNameChunk } stateNames.push(latestNameChunk) return stateNames }, []) }