Skip to content

Commit

Permalink
[breaking] Use named export instead of default.
Browse files Browse the repository at this point in the history
  • Loading branch information
RillingDev committed Mar 14, 2021
1 parent bf9df6a commit 133d38b
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 26 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ npm install okjs --save
### Syntax

```typescript
import Ok from "okjs";
import { Ok } from "okjs";

/**
* Create Ok instance with custom validators
Expand Down Expand Up @@ -81,7 +81,7 @@ Multiple validators can be used for a single field in a given order by chaining
```

```typescript
import Ok from "okjs";
import { Ok } from "okjs";

const ok = new Ok({
nameCaps: {
Expand All @@ -100,7 +100,7 @@ const ok = new Ok({
Ok currently only has one option, the class to use for invalid elements.

```typescript
import Ok from "okjs";
import { Ok } from "okjs";

// The default invalid class('invalid') will be used
new Ok({});
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/search.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions docs/classes/default.html → docs/classes/ok.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>default | okjs</title>
<title>Ok | okjs</title>
<meta name="description" content="Documentation for okjs">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">:root {
Expand Down Expand Up @@ -2703,16 +2703,16 @@
<nav class="tsd-navigation secondary">
<ul>
<li class="current tsd-kind-class">
<a href="default.html" class="tsd-kind-icon">default</a>
<a href="ok.html" class="tsd-kind-icon">Ok</a>
<ul>
<li class=" tsd-kind-constructor tsd-parent-kind-class">
<a href="default.html#constructor" class="tsd-kind-icon">constructor</a>
<a href="ok.html#constructor" class="tsd-kind-icon">constructor</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="default.html#bind" class="tsd-kind-icon">bind</a>
<a href="ok.html#bind" class="tsd-kind-icon">bind</a>
</li>
<li class=" tsd-kind-method tsd-parent-kind-class">
<a href="default.html#validate" class="tsd-kind-icon">validate</a>
<a href="ok.html#validate" class="tsd-kind-icon">validate</a>
</li>
</ul>
</li>
Expand All @@ -2737,7 +2737,7 @@
<h3>Hierarchy</h3>
<ul class="tsd-hierarchy">
<li>
<span class="target">default</span>
<span class="target">Ok</span>
</li>
</ul>
</section>
Expand All @@ -2748,14 +2748,14 @@ <h2>Index</h2>
<section class="tsd-index-section ">
<h3>Constructors</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="default.html#constructor" class="tsd-kind-icon">constructor</a></li>
<li class="tsd-kind-constructor tsd-parent-kind-class"><a href="ok.html#constructor" class="tsd-kind-icon">constructor</a></li>
</ul>
</section>
<section class="tsd-index-section ">
<h3>Methods</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-method tsd-parent-kind-class"><a href="default.html#bind" class="tsd-kind-icon">bind</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="default.html#validate" class="tsd-kind-icon">validate</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="ok.html#bind" class="tsd-kind-icon">bind</a></li>
<li class="tsd-kind-method tsd-parent-kind-class"><a href="ok.html#validate" class="tsd-kind-icon">validate</a></li>
</ul>
</section>
</div>
Expand All @@ -2767,7 +2767,7 @@ <h2>Constructors</h2>
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">new default<span class="tsd-signature-symbol">(</span>validators<span class="tsd-signature-symbol">: </span><a href="../interfaces/validatordictionary.html" class="tsd-signature-type" data-tsd-kind="Interface">ValidatorDictionary</a>, invalidClass<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="default.html" class="tsd-signature-type" data-tsd-kind="Class">default</a></li>
<li class="tsd-signature tsd-kind-icon">new <wbr>Ok<span class="tsd-signature-symbol">(</span>validators<span class="tsd-signature-symbol">: </span><a href="../interfaces/validatordictionary.html" class="tsd-signature-type" data-tsd-kind="Interface">ValidatorDictionary</a>, invalidClass<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="ok.html" class="tsd-signature-type" data-tsd-kind="Class">Ok</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
Expand All @@ -2793,7 +2793,7 @@ <h5>validators: <a href="../interfaces/validatordictionary.html" class="tsd-sign
<h5>invalidClass: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">false</span><span class="tsd-signature-symbol"> = &quot;invalid&quot;</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="default.html" class="tsd-signature-type" data-tsd-kind="Class">default</a></h4>
<h4 class="tsd-returns-title">Returns <a href="ok.html" class="tsd-signature-type" data-tsd-kind="Class">Ok</a></h4>
</li>
</ul>
</section>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2703,7 +2703,7 @@
<nav class="tsd-navigation secondary">
<ul>
<li class=" tsd-kind-class">
<a href="classes/default.html" class="tsd-kind-icon">default</a>
<a href="classes/ok.html" class="tsd-kind-icon">Ok</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/validator.html" class="tsd-kind-icon">Validator</a>
Expand Down Expand Up @@ -2832,7 +2832,7 @@ <h2>Index</h2>
<section class="tsd-index-section ">
<h3>Classes</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-class"><a href="classes/default.html" class="tsd-kind-icon">default</a></li>
<li class="tsd-kind-class"><a href="classes/ok.html" class="tsd-kind-icon">Ok</a></li>
</ul>
</section>
<section class="tsd-index-section ">
Expand Down
2 changes: 1 addition & 1 deletion docs/interfaces/validator.html
Original file line number Diff line number Diff line change
Expand Up @@ -2703,7 +2703,7 @@
<nav class="tsd-navigation secondary">
<ul>
<li class=" tsd-kind-class">
<a href="../classes/default.html" class="tsd-kind-icon">default</a>
<a href="../classes/ok.html" class="tsd-kind-icon">Ok</a>
</li>
<li class="current tsd-kind-interface">
<a href="validator.html" class="tsd-kind-icon">Validator</a>
Expand Down
2 changes: 1 addition & 1 deletion docs/interfaces/validatordictionary.html
Original file line number Diff line number Diff line change
Expand Up @@ -2703,7 +2703,7 @@
<nav class="tsd-navigation secondary">
<ul>
<li class=" tsd-kind-class">
<a href="../classes/default.html" class="tsd-kind-icon">default</a>
<a href="../classes/ok.html" class="tsd-kind-icon">Ok</a>
</li>
<li class=" tsd-kind-interface">
<a href="validator.html" class="tsd-kind-icon">Validator</a>
Expand Down
4 changes: 2 additions & 2 deletions docs/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -2703,7 +2703,7 @@
<nav class="tsd-navigation secondary">
<ul>
<li class=" tsd-kind-class">
<a href="classes/default.html" class="tsd-kind-icon">default</a>
<a href="classes/ok.html" class="tsd-kind-icon">Ok</a>
</li>
<li class=" tsd-kind-interface">
<a href="interfaces/validator.html" class="tsd-kind-icon">Validator</a>
Expand Down Expand Up @@ -2831,7 +2831,7 @@ <h2>Index</h2>
<section class="tsd-index-section ">
<h3>Classes</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-class"><a href="classes/default.html" class="tsd-kind-icon">default</a></li>
<li class="tsd-kind-class"><a href="classes/ok.html" class="tsd-kind-icon">Ok</a></li>
</ul>
</section>
<section class="tsd-index-section ">
Expand Down
2 changes: 1 addition & 1 deletion spec/Ok.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ok from "../src/main";
import { Ok } from "../src/main";

describe("Ok", () => {
it("constructs", () => {
Expand Down
5 changes: 4 additions & 1 deletion spec/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
"compilerOptions": {
"noEmit": true
},
"include": ["./", "../src/"]
"include": [
"./",
"../src/"
]
}
4 changes: 1 addition & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Ok } from "./Ok";
// eslint-disable-next-line import/no-default-export
export default Ok;
export { Ok } from "./Ok";
export { Validator } from "./validator/Validator";
export { ValidatorDictionary } from "./validator/ValidatorDictionary";

0 comments on commit 133d38b

Please sign in to comment.