line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Promises6::Util; |
2
|
32
|
|
|
32
|
|
134
|
use Evo::Base -strict; |
|
32
|
|
|
|
|
43
|
|
|
32
|
|
|
|
|
173
|
|
3
|
|
|
|
|
|
|
|
4
|
32
|
|
|
32
|
|
3969
|
use Scalar::Util; |
|
32
|
|
|
|
|
52
|
|
|
32
|
|
|
|
|
2059
|
|
5
|
32
|
|
|
32
|
|
149
|
use Exporter 'import'; |
|
32
|
|
|
|
|
51
|
|
|
32
|
|
|
|
|
3032
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my @CONST = qw(PENDING FULFILLED REJECTED PROGRESS); |
8
|
|
|
|
|
|
|
our @EXPORT_OK = (@CONST, qw(is_promise is_thenable)); |
9
|
|
|
|
|
|
|
our %EXPORT_TAGS = (all => \@EXPORT_OK, const => \@CONST); |
10
|
|
|
|
|
|
|
|
11
|
32
|
|
|
32
|
|
172
|
use constant PENDING => -1; |
|
32
|
|
|
|
|
42
|
|
|
32
|
|
|
|
|
2479
|
|
12
|
32
|
|
|
32
|
|
144
|
use constant FULFILLED => 0; |
|
32
|
|
|
|
|
40
|
|
|
32
|
|
|
|
|
1401
|
|
13
|
32
|
|
|
32
|
|
139
|
use constant REJECTED => 1; |
|
32
|
|
|
|
|
46
|
|
|
32
|
|
|
|
|
1445
|
|
14
|
32
|
|
|
32
|
|
144
|
use constant PROGRESS => 2; |
|
32
|
|
|
|
|
52
|
|
|
32
|
|
|
|
|
6481
|
|
15
|
|
|
|
|
|
|
|
16
|
256
|
50
|
|
256
|
1
|
527
|
sub is_promise($val) { |
|
256
|
50
|
|
|
|
431
|
|
|
256
|
|
|
|
|
266
|
|
|
256
|
|
|
|
|
245
|
|
17
|
256
|
100
|
100
|
|
|
1267
|
return unless $val && Scalar::Util::blessed($val); |
18
|
88
|
|
|
|
|
335
|
return $val->isa(Promises6::Builder->singleton->promise_class); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
207
|
50
|
|
207
|
1
|
388
|
sub is_thenable($val) { |
|
207
|
50
|
|
|
|
352
|
|
|
207
|
|
|
|
|
203
|
|
|
207
|
|
|
|
|
182
|
|
22
|
207
|
|
100
|
|
|
1440
|
return $val && Scalar::Util::blessed($val) && $val->can('then'); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# ABSTRACT: internal utils |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |