This repository was archived by the owner on Oct 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-16
lines changed Expand file tree Collapse file tree 1 file changed +21
-16
lines changed Original file line number Diff line number Diff line change 11"use strict" ;
22
3- exports . _unsafeReadProtoTagged = function ( name ) {
4- return function ( failure ) {
5- return function ( success ) {
6- return function ( value ) {
7- var obj = value ;
8- while ( obj != null ) {
9- var proto = Object . getPrototypeOf ( obj ) ;
10- var ctor = proto . constructor . name ;
11- if ( ctor === name ) {
12- return success ( value ) ;
13- } else if ( ctor === "Object" ) {
14- return failure ( Object . getPrototypeOf ( value ) . constructor . name ) ;
3+ exports . _unsafeReadProtoTagged = ( function ( ) {
4+ var tagOf = function ( value ) {
5+ return Object . prototype . toString . call ( value ) . slice ( 8 , - 1 ) ;
6+ }
7+ return function ( name ) {
8+ return function ( failure ) {
9+ return function ( success ) {
10+ return function ( value ) {
11+ var obj = value ;
12+ while ( obj != null ) {
13+ var proto = Object . getPrototypeOf ( obj ) ;
14+ var ctor = tagOf ( proto ) ;
15+ if ( ctor === name ) {
16+ return success ( value ) ;
17+ } else if ( ctor === "Object" ) {
18+ return failure ( tagOf ( value ) ) ;
19+ }
20+ obj = proto ;
1521 }
16- obj = proto ;
17- }
18- return failure ( Object . getPrototypeOf ( value ) . constructor . name ) ;
22+ return failure ( tagOf ( value ) ) ;
23+ } ;
1924 } ;
2025 } ;
2126 } ;
22- } ;
27+ } ( ) ) ;
You can’t perform that action at this time.
0 commit comments