mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2025-01-11 06:59:29 -07:00
19 lines
499 B
JavaScript
19 lines
499 B
JavaScript
|
"use strict";
|
||
|
|
||
|
var toString = require("@sinonjs/commons").prototypes.object.toString;
|
||
|
|
||
|
/**
|
||
|
* Returns the internal `Class` by calling `Object.prototype.toString`
|
||
|
* with the provided value as `this`. Return value is a `String`, naming the
|
||
|
* internal class, e.g. "Array"
|
||
|
*
|
||
|
* @private
|
||
|
* @param {*} value - Any value
|
||
|
* @returns {string} - A string representation of the `Class` of `value`
|
||
|
*/
|
||
|
function getClass(value) {
|
||
|
return toString(value).split(/[ \]]/)[1];
|
||
|
}
|
||
|
|
||
|
module.exports = getClass;
|