mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-11 23:04:52 +09:00
24 lines
523 B
JavaScript
24 lines
523 B
JavaScript
/**
|
|
* Collection of small utilites that are useful in multiple places.
|
|
* @module
|
|
*/
|
|
|
|
/**
|
|
* Return a string describing the type of the value passed
|
|
*
|
|
* Works the same as typeof, excpet that null and array types get their
|
|
* own string.
|
|
*
|
|
* @param value - value to return the type of.
|
|
* @returns {string} basic type of the value passed.
|
|
*/
|
|
function basicType(value) {
|
|
if (value === null) { return "null"; }
|
|
if (value instanceof Array) { return "array"; }
|
|
return typeof value;
|
|
}
|
|
|
|
module.exports = {
|
|
basicType,
|
|
}
|