'null' and 'undefined' are primitives, too

This commit is contained in:
rolux 2012-05-29 12:12:54 +02:00
parent 15f1463360
commit 8cd27bca2f

View file

@ -272,8 +272,9 @@ Ox.isPrimitive <f> Tests if a value is a primitive (boolean, number or string)
false
@*/
Ox.isPrimitive = function(value) {
var type = Ox.typeOf(value);
return type == 'boolean' || type == 'number' || type == 'string';
return Ox.contains(
['boolean', 'null', 'number', 'string', 'undefined'], Ox.typeOf(value)
);
};
/*@