Skip to content

Commit

Permalink
💥 refactor!: rename empty to isEmpty.
Browse files Browse the repository at this point in the history
This required to upgrade @aureooms/js-fingertree to v6. Upgraded a bunch
of other dependencies along with it.

BREAKING CHANGE: This breaks any dependent relying on the old API.
  • Loading branch information
make-github-pseudonymous-again committed Mar 25, 2021
1 parent 7d9b72f commit ec1336c
Show file tree
Hide file tree
Showing 12 changed files with 554 additions and 1,046 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,13 @@
},
"dependencies": {},
"devDependencies": {
"@aureooms/js-fingertree": "5.0.2",
"@aureooms/js-itertools": "5.0.1",
"@aureooms/js-measure": "1.0.3",
"@aureooms/js-predicate": "2.0.2",
"@aureooms/js-fingertree": "6.0.0",
"@aureooms/js-itertools": "5.1.0",
"@aureooms/js-measure": "2.0.0",
"@aureooms/js-predicate": "3.0.1",
"@babel/cli": "7.13.10",
"@babel/core": "7.13.10",
"@babel/preset-env": "7.13.10",
"@babel/preset-env": "7.13.12",
"@babel/register": "7.13.8",
"ava": "3.15.0",
"babel-plugin-transform-remove-console": "6.9.4",
Expand Down
4 changes: 2 additions & 2 deletions src/heap.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ let Heap = function ( tree ) {
this.tree = tree ;
} ;

Heap.prototype.empty = function ( ) {
return this.tree.empty( ) ;
Heap.prototype.isEmpty = function ( ) {
return this.tree.isEmpty( ) ;
} ;

Heap.prototype.maxKey =
Expand Down
6 changes: 3 additions & 3 deletions src/indordseq.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const IndOrdSeq = function ( tree ) {
this.tree = tree ;
} ;

IndOrdSeq.prototype.empty = function ( ) {
return this.tree.empty( ) ;
IndOrdSeq.prototype.isEmpty = function ( ) {
return this.tree.isEmpty( ) ;
} ;

IndOrdSeq.prototype.measure = function ( ) {
Expand Down Expand Up @@ -72,7 +72,7 @@ IndOrdSeq.prototype.deleteAll = function ( value ) {

IndOrdSeq.prototype.merge = function ( other ) {

if ( other.empty( ) ) return this ;
if ( other.isEmpty( ) ) return this ;

const a = other.head( ) ;
const k = key.measure( a ) ;
Expand Down
8 changes: 4 additions & 4 deletions src/intervaltree.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const matches = function* ( low , tree ) {

const xs = tree.dropUntil( ( m ) => atleast( low , m ) ) ;

if ( xs.empty( ) ) return ;
if ( xs.isEmpty( ) ) return ;

yield xs.head( ) ;

Expand All @@ -25,8 +25,8 @@ const IntervalTree = function ( tree ) {
this.tree = tree ;
} ;

IntervalTree.prototype.empty = function ( ) {
return this.tree.empty( ) ;
IntervalTree.prototype.isEmpty = function ( ) {
return this.tree.isEmpty( ) ;
} ;

IntervalTree.prototype.measure = function ( ) {
Expand Down Expand Up @@ -74,7 +74,7 @@ IntervalTree.prototype.insert = function ( interval ) {

IntervalTree.prototype.merge = function ( other ) {

if ( other.empty( ) ) return this ;
if ( other.isEmpty( ) ) return this ;

const a = other.head( ) ;
const k = M.measure( a )[0] ;
Expand Down
6 changes: 3 additions & 3 deletions src/ordseq.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const OrdSeq = function ( tree ) {
this.tree = tree ;
} ;

OrdSeq.prototype.empty = function ( ) {
return this.tree.empty( ) ;
OrdSeq.prototype.isEmpty = function ( ) {
return this.tree.isEmpty( ) ;
} ;

OrdSeq.prototype.measure = function ( ) {
Expand Down Expand Up @@ -72,7 +72,7 @@ OrdSeq.prototype.deleteAll = function ( value ) {

OrdSeq.prototype.merge = function ( other ) {

if ( other.empty( ) ) return this ;
if ( other.isEmpty( ) ) return this ;

const a = other.head( ) ;
const k = key.measure( a ) ;
Expand Down
4 changes: 2 additions & 2 deletions src/seq.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ const Seq = function ( tree ) {
this.tree = tree ;
} ;

Seq.prototype.empty = function ( ) {
return this.tree.empty( ) ;
Seq.prototype.isEmpty = function ( ) {
return this.tree.isEmpty( ) ;
} ;

Seq.prototype.measure =
Expand Down
4 changes: 2 additions & 2 deletions test/src/heap.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test( 'heap' , t => {
t.is( b , 2 ) ;
t.is( c , 1 ) ;

t.true( z[1].empty( ) ) ;
t.true( z[1].isEmpty( ) ) ;
t.is( h.maxKey( ) , 3 ) ;
t.is( x[1].maxKey( ) , 2 ) ;
t.is( y[1].maxKey( ) , 1 ) ;
Expand All @@ -43,7 +43,7 @@ test( 'heap' , t => {
t.is( b , 2 ) ;
t.is( c , 1 ) ;

t.true( z[1].empty( ) ) ;
t.true( z[1].isEmpty( ) ) ;
t.is( h.maxKey( ) , 3 ) ;
t.is( x[1].maxKey( ) , 2 ) ;
t.is( y[1].maxKey( ) , 1 ) ;
Expand Down
8 changes: 4 additions & 4 deletions test/src/indordseq.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ test( 'indordseq (ordseq behavior)' , t => {

let o = IndOrdSeq.empty( ) ;

t.true( o.empty( ) ) ;
t.true( o.isEmpty( ) ) ;

o = o.insert( 1 ) ;
o = o.insert( 3 ) ;
o = o.insert( 2 ) ;

t.deepEqual( o.measure( ) , [ 3 , 3 ] ) ;

t.true( !o.empty( ) ) ;
t.true( !o.isEmpty( ) ) ;

t.is( o.min( ) , 1 ) ;
t.is( o.max( ) , 3 ) ;
Expand Down Expand Up @@ -51,15 +51,15 @@ test( 'indordseq (seq behavior)' , t => {

let s = IndOrdSeq.empty( ) ;

t.true( s.empty( ) ) ;
t.true( s.isEmpty( ) ) ;

t.is( s.len( ) , 0 ) ;

s = s.insert( 'b' ) ;
s = s.insert( 'c' ) ;
s = s.insert( 'a' ) ;

t.true( !s.empty( ) ) ;
t.true( !s.isEmpty( ) ) ;

t.is( s.len( ) , 3 ) ;

Expand Down
2 changes: 1 addition & 1 deletion test/src/intervaltree.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test( 'intervaltree' , t => {

let i = IntervalTree.empty( ) ;

t.true( i.empty( ) ) ;
t.true( i.isEmpty( ) ) ;

i = i.insert( [ 1 , 7 ] ) ;
i = i.insert( [ 3 , 9 ] ) ;
Expand Down
4 changes: 2 additions & 2 deletions test/src/ordseq.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ test( 'ordseq' , t => {

let o = OrdSeq.empty( ) ;

t.true( o.empty( ) ) ;
t.true( o.isEmpty( ) ) ;

o = o.insert( 1 ) ;
o = o.insert( 3 ) ;
o = o.insert( 2 ) ;

t.is( o.measure( ) , 3 ) ;

t.true( !o.empty( ) ) ;
t.true( !o.isEmpty( ) ) ;

t.is( o.min( ) , 1 ) ;
t.is( o.max( ) , 3 ) ;
Expand Down
4 changes: 2 additions & 2 deletions test/src/seq.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ test( 'seq' , t => {

let s = Seq.empty( ) ;

t.true( s.empty( ) ) ;
t.true( s.isEmpty( ) ) ;

t.is( s.len( ) , 0 ) ;

s = s.push( 'b' ) ;
s = s.push( 'c' ) ;
s = s.cons( 'a' ) ;

t.true( !s.empty( ) ) ;
t.true( !s.isEmpty( ) ) ;

t.is( s.len( ) , 3 ) ;

Expand Down
Loading

0 comments on commit ec1336c

Please sign in to comment.