have overloaded operators)
=item -
The JavaScript datatypes provide C<TO_JSON> methods for compatibility with
L<JSON.pm|JSON>.
=back
JE's greatest weakness is that it's slow (well, what did you ex
ugh which you can modify the
object, use C<@$a>.
=cut
sub value { [@{$${+shift}{array}}] };
*TO_JSON=*value;
sub exists {
my ($self, $name) = (shift, @_);
my $guts = $$self;
if ($name eq 'len
to a global object.
sub new { bless \do{my $thing = $_[1]}, $_[0] }
sub value { undef }
*TO_JSON=*value;
sub typeof { 'undefined' }
sub id { 'undef' }
sub primitive { 1 }
sub to_primitive {
an.
=cut
#use Carp;
sub new { bless \do{my $thing = $_[1]}, $_[0] }
sub value { undef }
*TO_JSON=*value;
sub typeof { 'object' }
sub id { 'null' }
sub primitive { 1 }
sub to_primitive { $_[0
Number')->prop(shift)->apply(
$self,$$self[1]->upgrade(@_)
);
}
sub value {
shift->[0]
}
*TO_JSON=*value;
sub exists { !1 }
sub typeof { 'number' }
sub class { 'Number' }
sub id {
$self,$$self[1]->upgrade(@_)
);
}
sub value { warn caller if !ref $_[0];shift->[0] }
sub TO_JSON { \(0+shift->[0]) }
sub exists { !1 }
sub typeof { 'boolean' }
sub class { 'Boolean' }
s
lf.
=cut
sub value {
my $self = shift;
+{ map +($_ => $self->prop($_)), $self->keys };
}
*TO_JSON=*value;
sub id {
refaddr shift;
}
sub primitive { !1 };
sub prototype {
@_ > 1 ? (${+shif
(@_)
);
}
sub value {
defined $_[0][1] ? $_[0][1] : ($_[0][1] = desurrogify($_[0][0]));
}
*TO_JSON=*value;
sub value16 {
defined $_[0][0] ? $_[0][0] : ($_[0][0] = surrogify($_[0][1]));
}
sub t