for ($source) { # cleanup
# convert seperate variables to hash keys
- s/\A/{/;
- s/^caniuse\.(\w+) = /"$1":/gm;
+ s/\A/{\n/;
+ s/^caniuse\.(\w+) *= */"$1":/gm;
s/;$/,/gm;
s/,\s*\Z/\n}/;
# fractions not supported by barekey
- s/(?<=[,{]) (\d*\.\d) (?=:')/"$1"/gx;
+ s/(?<=[,{\n]) (\d*\.\d) (?=:['"])/"$1"/gx;
# escapes not supported in singlequote
- s{'((?:[^\\']+|\\.)*)'}{
+ s{: *\K'((?:[^\\']+|\\.)*)'}{
my $_ = $1;
s/"/\\"/g;
s/\\'/'/g;