Permalink
Browse files

further simplify array and hash emitting code

it just now stops to look superficially complicated
  • Loading branch information...
1 parent 89e7d18 commit 577e3a2a2d9a2b32e7d0dbde9a47f33aad4986dd @moritz committed Dec 21, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/JSON/Tiny.pm
View
@@ -31,12 +31,12 @@ multi to-json(Str:D $d) {
}
multi to-json(Array:D $d) {
return '[ '
- ~ (map &to-json, $d.values).join(', ')
+ ~ $d.map(&to-json).join(', ')
~ ' ]';
}
multi to-json(Hash:D $d) {
return '{ '
- ~ (map { to-json(.key) ~ ' : ' ~ to-json(.value) }, $d.pairs).join(', ')
+ ~ $d.map({ to-json(.key) ~ ' : ' ~ to-json(.value) }).join(', ')
~ ' }';
}

0 comments on commit 577e3a2

Please sign in to comment.