@respeecher/respeecher-js
Version:
[](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Frespeecher%2Frespeecher-js) [ • 934 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.string = void 0;
const Schema_js_1 = require("../../Schema.js");
const createIdentitySchemaCreator_js_1 = require("../../utils/createIdentitySchemaCreator.js");
const getErrorMessageForIncorrectType_js_1 = require("../../utils/getErrorMessageForIncorrectType.js");
exports.string = (0, createIdentitySchemaCreator_js_1.createIdentitySchemaCreator)(Schema_js_1.SchemaType.STRING, (value, { breadcrumbsPrefix = [] } = {}) => {
if (typeof value === "string") {
return {
ok: true,
value,
};
}
else {
return {
ok: false,
errors: [
{
path: breadcrumbsPrefix,
message: (0, getErrorMessageForIncorrectType_js_1.getErrorMessageForIncorrectType)(value, "string"),
},
],
};
}
});