Skip to content

Commit

Permalink
removed core/utils.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Nov 12, 2023
1 parent 3389e6d commit 75af978
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 0 additions & 2 deletions core.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { DeepPartial } from "./core/utils.ts";
import type {
ComponentsOptions,
default as Site,
Expand Down Expand Up @@ -82,7 +81,6 @@ export type {
Content,
Data,
DataLoader,
DeepPartial,
Engine,
Entry,
Event,
Expand Down
5 changes: 0 additions & 5 deletions core/utils.ts

This file was deleted.

6 changes: 6 additions & 0 deletions core/utils/object.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
const reactElement = Symbol.for("react.element");
const objectConstructor = {}.constructor;

/** TypeScript helper to create optional properties recursively */
export type DeepPartial<T> = T extends object ? {
[P in keyof T]?: DeepPartial<T[P]>;
}
: T;

/** Check if the argument passed is a plain object */
export function isPlainObject(obj: unknown): obj is Record<string, unknown> {
return typeof obj === "object" && obj !== null &&
Expand Down
2 changes: 1 addition & 1 deletion mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import toml, { Options as TomlOptions } from "./plugins/toml.ts";
import yaml, { Options as YamlOptions } from "./plugins/yaml.ts";
import { merge } from "./core/utils/object.ts";

import type { DeepPartial } from "./core/utils.ts";
import type { DeepPartial } from "./core/utils/object.ts";
import type { SiteOptions } from "./core/site.ts";

export interface PluginOptions {
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { assertSnapshot } from "../deps/snapshot.ts";
import lume from "../mod.ts";
import { basename, fromFileUrl, join } from "../deps/path.ts";
import { DeepPartial } from "../core/utils.ts";
import { DeepPartial } from "../core/utils/object.ts";

import type { default as Site, SiteOptions } from "../core/site.ts";
import type { SourceMap } from "../plugins/source_maps.ts";
Expand Down

0 comments on commit 75af978

Please sign in to comment.