Skip to content

Commit

Permalink
feat: export defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
revelt committed Apr 10, 2022
1 parent 4bc7c0f commit 89a0431
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion packages/object-all-values-equal-to/README.md
Expand Up @@ -26,12 +26,14 @@

## Install

The latest version is **ESM only**: Node 12+ is needed to use it and it must be `import`ed instead of `require`d. If your project is not on ESM yet and you want to use `require`, use an older version of this program, `2.1.0`.
This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:

```bash
npm i object-all-values-equal-to
```

If you need a legacy version which works with `require`, use version 2.1.0

## Quick Take

```js
Expand Down
8 changes: 4 additions & 4 deletions packages/object-all-values-equal-to/src/main.ts
Expand Up @@ -10,6 +10,9 @@ const version: string = v;
interface Opts {
arraysMustNotContainPlaceholders: boolean;
}
const defaults: Opts = {
arraysMustNotContainPlaceholders: true,
};

// T H E M A I N F U N C T I O N T H A T D O E S T H E J O B
// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -81,13 +84,10 @@ function allEq(
}

// prep opts
let defaults: Opts = {
arraysMustNotContainPlaceholders: true,
};
let opts: Opts = { ...defaults, ...originalOpts };

// and finally,
return allValuesEqualTo(inputOriginal, valueOriginal, opts);
}

export { allEq, version };
export { allEq, defaults, version };
3 changes: 2 additions & 1 deletion packages/object-all-values-equal-to/types/index.d.ts
Expand Up @@ -2,10 +2,11 @@ declare const version: string;
interface Opts {
arraysMustNotContainPlaceholders: boolean;
}
declare const defaults: Opts;
declare function allEq(
inputOriginal: any,
valueOriginal: any,
originalOpts?: Partial<Opts>
): boolean;

export { allEq, version };
export { allEq, defaults, version };

0 comments on commit 89a0431

Please sign in to comment.