diff --git a/docs/api/js-yaml-schema.createinclude.md b/docs/api/js-yaml-schema.createinclude.md
index 0dc67c0..66a37f7 100644
--- a/docs/api/js-yaml-schema.createinclude.md
+++ b/docs/api/js-yaml-schema.createinclude.md
@@ -4,7 +4,7 @@
## createInclude() function
-Instantiate an includer with closure over the provided options.
+Instantiate an include type with a copy of the provided options, returning the include type and its schema setter.
Signature:
diff --git a/docs/api/js-yaml-schema.schemaoptions.base.md b/docs/api/js-yaml-schema.schemaoptions.base.md
new file mode 100644
index 0000000..8819ebe
--- /dev/null
+++ b/docs/api/js-yaml-schema.schemaoptions.base.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [@apextoaster/js-yaml-schema](./js-yaml-schema.md) > [SchemaOptions](./js-yaml-schema.schemaoptions.md) > [base](./js-yaml-schema.schemaoptions.base.md)
+
+## SchemaOptions.base property
+
+Signature:
+
+```typescript
+base?: Schema;
+```
diff --git a/docs/api/js-yaml-schema.schemaoptions.include.md b/docs/api/js-yaml-schema.schemaoptions.include.md
index 6ea564b..06339b7 100644
--- a/docs/api/js-yaml-schema.schemaoptions.include.md
+++ b/docs/api/js-yaml-schema.schemaoptions.include.md
@@ -7,5 +7,5 @@
Signature:
```typescript
-include: Readonly;
+include: Readonly>;
```
diff --git a/src/type/Include.ts b/src/type/Include.ts
index 34e9379..7f19e76 100644
--- a/src/type/Include.ts
+++ b/src/type/Include.ts
@@ -18,11 +18,15 @@ export interface IncludeOptions {
}
/**
- * Instantiate an includer with closure over the provided options.
+ * Instantiate an include type with a copy of the provided options,
+ * returning the include type and its schema setter.
+ *
* @public
*/
export function createInclude(options: Readonly) {
- const optionsCopy = {...options};
+ const mutableOptions = {
+ schema: mustCoalesce(options.schema, DEFAULT_SCHEMA),
+ };
const includeType = new YamlType('!include', {
kind: 'scalar',
@@ -45,7 +49,7 @@ export function createInclude(options: Readonly) {
return load(options.read(abs, {
encoding: 'utf-8',
}), {
- schema: mustCoalesce(optionsCopy.schema, DEFAULT_SCHEMA),
+ schema: mutableOptions.schema,
});
} catch (err) {
throw new InvalidArgumentError('error including file', err);
@@ -55,7 +59,7 @@ export function createInclude(options: Readonly) {
// callback to avoid circular dependency (type must be created before schema)
function setSchema(schema: Schema) {
- optionsCopy.schema = schema;
+ mutableOptions.schema = schema;
};
return {