UNPKG

styled-components-test-utils

Version:

Test utils for styled-components compatible with jest, expect, chai and jasmine

23 lines (20 loc) 468 B
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports['default'] = function (code) { var start = code.indexOf('{'); if (start === -1) return ''; var i = start + 1; var parenthesis = 1; while (parenthesis !== 0 || i === start + 1) { var char = code[i]; if (char === '{') { parenthesis += 1; } else if (char === '}') { parenthesis -= 1; } i += 1; } return code.substring(start, i - 1); };