All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.helpers.esm.toPrimitive.js Maven / Gradle / Ivy

There is a newer version: 7.25.6
Show newest version
import _typeof from "./typeof.js";
function toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}
export { toPrimitive as default };




© 2015 - 2024 Weber Informatics LLC | Privacy Policy