@@ -62,23 +62,23 @@ export function fnToString(fn: IInjectable) {
6262 return ( _fn && _fn . toString ( ) ) || 'undefined' ;
6363}
6464
65- const isRejection = Rejection . isRejectionPromise ;
66- const hasToString = ( obj : any ) =>
67- isObject ( obj ) && ! isArray ( obj ) && obj . constructor !== Object && isFunction ( obj . toString ) ;
68-
69- const stringifyPattern = pattern ( [
70- [ isUndefined , val ( 'undefined' ) ] ,
71- [ isNull , val ( 'null' ) ] ,
72- [ isPromise , val ( '[Promise]' ) ] ,
73- [ isRejection , ( x : any ) => x . _transitionRejection . toString ( ) ] ,
74- [ hasToString , ( x : object ) => x . toString ( ) ] ,
75- [ isInjectable , functionToString ] ,
76- [ val ( true ) , identity ] ,
77- ] ) as ( val : any ) => string ;
78-
7965export function stringify ( o : any ) {
8066 const seen : any [ ] = [ ] ;
8167
68+ const isRejection = Rejection . isRejectionPromise ;
69+ const hasToString = ( obj : any ) =>
70+ isObject ( obj ) && ! isArray ( obj ) && obj . constructor !== Object && isFunction ( obj . toString ) ;
71+
72+ const stringifyPattern = pattern ( [
73+ [ isUndefined , val ( 'undefined' ) ] ,
74+ [ isNull , val ( 'null' ) ] ,
75+ [ isPromise , val ( '[Promise]' ) ] ,
76+ [ isRejection , ( x : any ) => x . _transitionRejection . toString ( ) ] ,
77+ [ hasToString , ( x : object ) => x . toString ( ) ] ,
78+ [ isInjectable , functionToString ] ,
79+ [ val ( true ) , identity ] ,
80+ ] ) as ( val : any ) => string ;
81+
8282 function format ( value : any ) {
8383 if ( isObject ( value ) ) {
8484 if ( seen . indexOf ( value ) !== - 1 ) return '[circular ref]' ;
@@ -98,12 +98,14 @@ export function stringify(o: any) {
9898}
9999
100100/** Returns a function that splits a string on a character or substring */
101- export const beforeAfterSubstr = ( char : string ) => ( str : string ) : string [ ] => {
102- if ( ! str ) return [ '' , '' ] ;
103- const idx = str . indexOf ( char ) ;
104- if ( idx === - 1 ) return [ str , '' ] ;
105- return [ str . substr ( 0 , idx ) , str . substr ( idx + 1 ) ] ;
106- } ;
101+ export const beforeAfterSubstr =
102+ ( char : string ) =>
103+ ( str : string ) : string [ ] => {
104+ if ( ! str ) return [ '' , '' ] ;
105+ const idx = str . indexOf ( char ) ;
106+ if ( idx === - 1 ) return [ str , '' ] ;
107+ return [ str . substr ( 0 , idx ) , str . substr ( idx + 1 ) ] ;
108+ } ;
107109
108110export const hostRegex = new RegExp ( '^(?:[a-z]+:)?//[^/]+/' ) ;
109111export const stripLastPathElement = ( str : string ) => str . replace ( / \/ [ ^ / ] * $ / , '' ) ;
0 commit comments