postcss-map-get
Version:
PostCSS plugin for sass-like Map Function
1 lines • 620 B
JavaScript
;var _constant=require("./constant");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=parseParenthesisContent;function parseParenthesisContent(stringToParse,startingPosition=0){let position=startingPosition,content="";const stack=[];for(;position!==stringToParse.length;){const mapChracter=stringToParse[position];if("("===mapChracter?stack.push(position):")"===mapChracter&&stack.pop(),content+=mapChracter,position++,0===stack.length)break}if(0!==stack.length)throw new Error(`${_constant.ERROR_PREFIX} parenthesis not closed`);return{content,position}}module.exports=exports.default;