File Coverage

blib/lib/Data/Sah/Filter/js/Str/trim.pm
Criterion Covered Total %
statement 8 14 57.1
branch n/a
condition n/a
subroutine 3 5 60.0
pod 0 2 0.0
total 11 21 52.3


line stmt bran cond sub pod time code
1             package Data::Sah::Filter::js::Str::trim;
2              
3 1     1   487359 use 5.010001;
  1         3  
4 1     1   5 use strict;
  1         1  
  1         28  
5 1     1   4 use warnings;
  1         1  
  1         212  
6              
7             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
8             our $DATE = '2024-07-17'; # DATE
9             our $DIST = 'Data-Sah-Filter'; # DIST
10             our $VERSION = '0.025'; # VERSION
11              
12             sub meta {
13             +{
14 0     0 0   v => 1,
15             summary => 'Trim whitespace at the beginning and end of string',
16             examples => [
17             {value=>'foo'},
18             {value=>' foo ', filtered_value=>'foo'},
19             ],
20             };
21             }
22              
23             sub filter {
24 0     0 0   my %args = @_;
25              
26 0           my $dt = $args{data_term};
27              
28 0           my $res = {};
29              
30 0           $res->{expr_filter} = "$dt.trim()";
31              
32 0           $res;
33             }
34              
35             1;
36             # ABSTRACT: Trim whitespace at the beginning and end of string
37              
38             __END__