package JSON::MergePatch;
use 5.008001;
use strict;
use warnings;
our $VERSION = "0.04";
use parent 'Exporter';
use JSON::MaybeXS qw/encode_json decode_json/;
use List::MoreUtils qw/uniq/;
use Test:
ur @EXPORT = qw/json_merge_patch json_merge_diff/;
sub patch {
my ($class, $target, $patch, $opt) = @_;
if (defined $target && !$opt->{repeat}) {
$target = decode_json($target);
}
}
}
return ref $target ? encode_json($target) : $target;
}
return ref $patch ? encode_json($patch) : $patch;
}
sub diff {
my ($class, $source, $target,