This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
packages/optimizely-sdk/lib/utils/fns Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -40,5 +40,7 @@ module.exports = {
40
40
return uuid . v4 ( ) ;
41
41
} ,
42
42
values : require ( 'lodash/values' ) ,
43
- isNumber : require ( 'lodash/isNumber' ) ,
43
+ isNumber : function ( value ) {
44
+ return typeof value === 'number' ;
45
+ } ,
44
46
} ;
Original file line number Diff line number Diff line change @@ -63,6 +63,24 @@ describe('lib/utils/fns', function() {
63
63
64
64
obj = fns . keyBy ( undefined , 'key1' ) ;
65
65
assert . isEmpty ( obj ) ;
66
+ } ) ;
67
+ } ) ;
68
+
69
+ describe ( 'isNumber' , function ( ) {
70
+ it ( 'should return true in case of number' , function ( ) {
71
+ assert . isTrue ( fns . isNumber ( 3 ) ) ;
72
+ } ) ;
73
+ it ( 'should return true in case of value from Number object ' , function ( ) {
74
+ assert . isTrue ( fns . isNumber ( Number . MIN_VALUE ) ) ;
75
+ } ) ;
76
+ it ( 'should return true in case of Infinity ' , function ( ) {
77
+ assert . isTrue ( fns . isNumber ( Infinity ) ) ;
78
+ } ) ;
79
+ it ( 'should return false in case of string' , function ( ) {
80
+ assert . isFalse ( fns . isNumber ( '3' ) ) ;
81
+ } ) ;
82
+ it ( 'should return false in case of null' , function ( ) {
83
+ assert . isFalse ( fns . isNumber ( null ) ) ;
66
84
} ) ;
67
85
} ) ;
68
86
} ) ;
You can’t perform that action at this time.
0 commit comments