kung-fig-ref
Advanced tools
Comparing version 0.46.0 to 0.46.1
@@ -80,4 +80,9 @@ /* | ||
Ref.prototype.getPath = function( arg ) { return this.refParts.join( '.' ) ; } ; | ||
Ref.prototype.getPath = function( arg ) { | ||
return this.refParts[ this.refParts.length - 1 ] === '' ? this.refParts.join( '.' ) + '.' : | ||
this.refParts.join( '.' ) ; | ||
} ; | ||
// Used by stats-modifiers | ||
@@ -84,0 +89,0 @@ Ref.prototype.appendPart = function( part ) { this.refParts.push( part ) ; } ; |
{ | ||
"name": "kung-fig-ref", | ||
"version": "0.46.0", | ||
"version": "0.46.1", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=14.15.0" |
@@ -98,2 +98,53 @@ /* | ||
it( "ref with empty path parts" , () => { | ||
var ref_ ; | ||
var ctx = { | ||
"": { | ||
hidden: "value" , | ||
"": { | ||
hidden2: "value2" , | ||
} , | ||
sub: { | ||
"": { | ||
hidden3: "value3" , | ||
} , | ||
} | ||
} | ||
} ; | ||
ref_ = Ref.parse( '$' ) ; | ||
expect( ref_.getPath() ).to.be( '' ) ; | ||
expect( ref_.get( ctx ) ).to.be( ctx ) ; | ||
ref_ = Ref.parse( '$.' ) ; | ||
expect( ref_.getPath() ).to.be( '.' ) ; | ||
expect( ref_.get( ctx ) ).to.be( ctx[''] ) ; | ||
ref_ = Ref.parse( '$.hidden' ) ; | ||
expect( ref_.getPath() ).to.be( '.hidden' ) ; | ||
expect( ref_.get( ctx ) ).to.be( ctx[''].hidden ) ; | ||
ref_ = Ref.parse( '$..' ) ; | ||
expect( ref_.getPath() ).to.be( '..' ) ; | ||
expect( ref_.get( ctx ) ).to.be( ctx[''][''] ) ; | ||
ref_ = Ref.parse( '$..hidden2' ) ; | ||
expect( ref_.getPath() ).to.be( '..hidden2' ) ; | ||
expect( ref_.get( ctx ) ).to.be( ctx[''][''].hidden2 ) ; | ||
ref_ = Ref.parse( '$.sub' ) ; | ||
expect( ref_.get( ctx ) ).to.be( ctx[''].sub ) ; | ||
ref_ = Ref.parse( '$.sub.' ) ; | ||
expect( ref_.get( ctx ) ).to.be( ctx[''].sub ) ; | ||
ref_ = Ref.parse( '$.sub..' ) ; | ||
expect( ref_.getPath() ).to.be( '.sub..' ) ; | ||
expect( ref_.get( ctx ) ).to.be( ctx[''].sub[''] ) ; | ||
ref_ = Ref.parse( '$.sub..hidden3' ) ; | ||
expect( ref_.getPath() ).to.be( '.sub..hidden3' ) ; | ||
expect( ref_.get( ctx ) ).to.be( ctx[''].sub[''].hidden3 ) ; | ||
} ) ; | ||
it( "it should autobox Boolean, String and Number for the root ref" , () => { | ||
@@ -100,0 +151,0 @@ var ref_ ; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39963
1047