* Returns the ECMAScript specification type of a JavaScript value. * @see https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values * @param {any} V JavaScript value. * @returns {'Undefined'|'Null'|'Boolean'|'String'|'Symbol'|'Number'|'BigInt'|'Object'}
(V)
| 138 | * @returns {'Undefined'|'Null'|'Boolean'|'String'|'Symbol'|'Number'|'BigInt'|'Object'} |
| 139 | */ |
| 140 | function type(V) { |
| 141 | // ECMA-262 6.1: map JavaScript values to language type names. |
| 142 | switch (typeof V) { |
| 143 | case 'undefined': |
| 144 | return 'Undefined'; |
| 145 | case 'boolean': |
| 146 | return 'Boolean'; |
| 147 | case 'string': |
| 148 | return 'String'; |
| 149 | case 'symbol': |
| 150 | return 'Symbol'; |
| 151 | case 'number': |
| 152 | return 'Number'; |
| 153 | case 'bigint': |
| 154 | return 'BigInt'; |
| 155 | case 'object': |
| 156 | case 'function': |
| 157 | default: |
| 158 | // ECMA-262 6.1.2: null is its own language type. |
| 159 | // ECMA-262 6.1.7: functions are Object values. |
| 160 | if (V === null) { |
| 161 | return 'Null'; |
| 162 | } |
| 163 | return 'Object'; |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * Returns IntegerPart(n). |
no outgoing calls
no test coverage detected
searching dependent graphs…