7 use File::Slurp 'read_file';
11 my $source = readline;
13 for ($source) { # cleanup
14 # convert seperate variables to hash keys
16 s/^caniuse\.(\w+) *= */"$1":/gm;
19 # fractions not supported by barekey
20 s/(?<=[,{\n]) (\d*\.\d) (?=:['"])/"$1"/gx;
21 # escapes not supported in singlequote
22 s{: *\K'((?:[^\\']+|\\.)*)'}{
30 my $data = from_json($source, {
31 allow_singlequote => 1,
41 convert-caniuse - Turn Javascript data into an equivalent Perl structure
45 curl http://caniuse.com/js/data.js |
46 tools/convert-caniuse.pl > browser-support.inc.pl