File tree 2 files changed +29
-0
lines changed
2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 788
788
789
789
be . similarity . multiple = false ;
790
790
791
+ /**
792
+ * Check if number is between min and max
793
+ * @param num
794
+ * @param min
795
+ * @param max
796
+ * @returns {boolean }
797
+ */
798
+ be . between = function ( num , min , max ) {
799
+ return be . number ( num ) &&
800
+ be . number ( min ) &&
801
+ be . number ( max ) &&
802
+ num >= min && num <= max ;
803
+ } ;
804
+
805
+ be . between . multiple = false ;
806
+
791
807
/**
792
808
* Helper class
793
809
* @type {{} }
Original file line number Diff line number Diff line change @@ -1378,3 +1378,16 @@ describe('similarity', function () {
1378
1378
assert . equal ( result , false ) ;
1379
1379
} ) ;
1380
1380
} ) ;
1381
+
1382
+ describe ( 'between' , function ( ) {
1383
+ it ( 'should be return true' , function ( ) {
1384
+ var result = be . between ( 50 , 2 , 100 ) ;
1385
+ console . log ( result ) ;
1386
+ assert . equal ( result , true ) ;
1387
+ } ) ;
1388
+ it ( 'should be return false' , function ( ) {
1389
+ var result = be . between ( 101 , 2 , 100 ) ;
1390
+ console . log ( result ) ;
1391
+ assert . equal ( result , false ) ;
1392
+ } ) ;
1393
+ } ) ;
You can’t perform that action at this time.
0 commit comments