'use strict';

var utils_interfaces = require('../../utils/interfaces.cjs');
require('../../utils/assert.cjs');
require('../../utils/error.cjs');

/**
 * Creates a typed placeholder that implements `from`/`fromJSON`/`fromApi` and creates a value from the supplied
 * argument using `makePlacholder` function.
 *
 * @template P
 * @param {function(*): P} makePlaceholder
 * @returns {function(*): P}
 */
function createPlaceholder(makePlaceholder) {
  const name = `placeholder(${makePlaceholder.name})`;
  const obj = {
    [name]: (...args) => makePlaceholder(...args),
  };

  obj[name][utils_interfaces.NotAConstructor] = true;
  obj[name].from = obj[name];
  obj[name].fromApi = obj[name];
  obj[name].fromJSON = obj[name];

  return obj[name];
}

module.exports = createPlaceholder;
//# sourceMappingURL=create-placeholder.cjs.map
