Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

further simplify array and hash emitting code

it just now stops to look superficially complicated
  • Loading branch information...
commit 577e3a2a2d9a2b32e7d0dbde9a47f33aad4986dd 1 parent 89e7d18
@moritz authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/JSON/Tiny.pm
View
4 lib/JSON/Tiny.pm
@@ -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(', ')
~ ' }';
}
Please sign in to comment.
Something went wrong with that request. Please try again.