You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

validate-stringifiable.js 318B

123456789101112
  1. "use strict";
  2. var isCallable = require("./is-callable");
  3. module.exports = function (stringifiable) {
  4. try {
  5. if (stringifiable && isCallable(stringifiable.toString)) return stringifiable.toString();
  6. return String(stringifiable);
  7. } catch (e) {
  8. throw new TypeError("Passed argument cannot be stringifed");
  9. }
  10. };