Skip to content

Commit e8d64c9

Browse files
committed
Add is-isbn-func, is-isrc-func and is-issn-func components
1 parent d8955ec commit e8d64c9

13 files changed

Lines changed: 591 additions & 3 deletions

src/app/shared/data/versions.data.ts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,78 @@ export const Versions: IVersion[] = [
503503
}
504504
]
505505
},
506+
{
507+
id: "is-isbn-func",
508+
title: ".IsISBN()",
509+
isCode: true,
510+
route: resolveRoute(VERSIONS["1.0.0"], "is-isbn-func"),
511+
sections: [
512+
{
513+
id: "definition",
514+
title: "Definition"
515+
},
516+
{
517+
id: "examples",
518+
title: "Examples"
519+
},
520+
{
521+
id: "example1",
522+
title: "Example 1"
523+
},
524+
{
525+
id: "example2",
526+
title: "Example 2"
527+
}
528+
]
529+
},
530+
{
531+
id: "is-isrc-func",
532+
title: ".IsISRC()",
533+
isCode: true,
534+
route: resolveRoute(VERSIONS["1.0.0"], "is-isrc-func"),
535+
sections: [
536+
{
537+
id: "definition",
538+
title: "Definition"
539+
},
540+
{
541+
id: "examples",
542+
title: "Examples"
543+
},
544+
{
545+
id: "example1",
546+
title: "Example 1"
547+
},
548+
{
549+
id: "example2",
550+
title: "Example 2"
551+
}
552+
]
553+
},
554+
{
555+
id: "is-issn-func",
556+
title: ".IsISSN()",
557+
isCode: true,
558+
route: resolveRoute(VERSIONS["1.0.0"], "is-issn-func"),
559+
sections: [
560+
{
561+
id: "definition",
562+
title: "Definition"
563+
},
564+
{
565+
id: "examples",
566+
title: "Examples"
567+
},
568+
{
569+
id: "example1",
570+
title: "Example 1"
571+
},
572+
{
573+
id: "example2",
574+
title: "Example 2"
575+
}
576+
]
577+
},
506578
]
507579
}
508580
]

src/app/version1.0.0/components/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ import {IsFqdnFuncComponent} from "./validation/is-fqdn-func/is-fqdn-func.compon
2222
import {IsGuidFuncComponent} from "./validation/is-guid-func/is-guid-func.component";
2323
import {IsInRangeFuncComponent} from "./validation/is-in-range-func/is-in-range-func.component";
2424
import {IsIpFuncComponent} from "./validation/is-ip-func/is-ip-func.component";
25+
import {IsIsbnFuncComponent} from "./validation/is-isbn-func/is-isbn-func.component";
26+
import {IsIsrcFuncComponent} from "./validation/is-isrc-func/is-isrc-func.component";
27+
import {IsIssnFuncComponent} from "./validation/is-issn-func/is-issn-func.component";
2528

2629
/* Introduction */
2730
export * from "./introduction/getting-started/getting-started.component";
@@ -47,6 +50,9 @@ export * from "./validation/is-fqdn-func/is-fqdn-func.component";
4750
export * from "./validation/is-guid-func/is-guid-func.component";
4851
export * from "./validation/is-in-range-func/is-in-range-func.component";
4952
export * from "./validation/is-ip-func/is-ip-func.component";
53+
export * from "./validation/is-isbn-func/is-isbn-func.component";
54+
export * from "./validation/is-isrc-func/is-isrc-func.component";
55+
export * from "./validation/is-issn-func/is-issn-func.component";
5056

5157
export const COMPONENTS: any[] = [
5258
GettingStartedComponent,
@@ -70,4 +76,7 @@ export const COMPONENTS: any[] = [
7076
IsGuidFuncComponent,
7177
IsInRangeFuncComponent,
7278
IsIpFuncComponent,
79+
IsIsbnFuncComponent,
80+
IsIsrcFuncComponent,
81+
IsIssnFuncComponent,
7382
];

src/app/version1.0.0/components/validation/is-ip-func/is-ip-func.component.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
<!-- Article -->
44
<ng-container class="article">
55
<p>
6-
An <code>extension</code> validation <code>method</code> checks if the property's value is a valid ip
7-
address.
6+
An <code>extension</code> validation <code>method</code> checks if the property's value is a valid
7+
<a href="https://www.webopedia.com/DidYouKnow/Internet/ipv6_ipv4_difference.html" target="blank">ip
8+
address</a>.
89
</p>
910
<div>
1011
<h2 class="section-heading">
@@ -50,7 +51,9 @@ <h3>Supported data types :</h3>
5051
<h3>Parameters :</h3>
5152
<ul>
5253
<li>
53-
<code>ipVersion</code> : The version of the ip address.
54+
<code>ipVersion</code> : The
55+
<a href="https://www.webopedia.com/DidYouKnow/Internet/ipv6_ipv4_difference.html"
56+
target="blank">version of the ip address</a>.
5457
</li>
5558
<li>
5659
<code>errorMessage</code> : An optional validation error message.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<app-post *ngIf="post" [post]="post" [previous]="previous" [next]="next">
2+
3+
<!-- Article -->
4+
<ng-container class="article">
5+
<p>
6+
An <code>extension</code> validation <code>method</code> checks if the property's value is a valid
7+
<a href="https://en.wikipedia.org/wiki/International_Standard_Book_Number" target="blank">
8+
international standard book number
9+
</a>.
10+
</p>
11+
<div>
12+
<h2 class="section-heading">
13+
Definition
14+
<a id="definition" aria-hidden="true" class="section-heading-ref"></a>
15+
</h2>
16+
<ul>
17+
<li>
18+
<h3>
19+
<code>.IsISBN(string: errorMessage = null)</code>
20+
</h3>
21+
<h3>Supported data types :</h3>
22+
<ul>
23+
<li>
24+
Strings.
25+
</li>
26+
</ul>
27+
<h3>Parameters :</h3>
28+
<ul>
29+
<li>
30+
<code>errorMessage</code> : An optional validation error message.
31+
<br><i>If omitted, a default error message will be used</i>.
32+
</li>
33+
</ul>
34+
35+
<h3>Returns :</h3>
36+
<ul>
37+
<li>
38+
A <code>Validator</code> to add more <code>validation</code> or <code>sanitization</code>.
39+
</li>
40+
</ul>
41+
</li>
42+
</ul>
43+
</div>
44+
<div>
45+
<h2 class="section-heading">
46+
Examples
47+
<a id="examples" aria-hidden="true" class="section-heading-ref"></a>
48+
</h2>
49+
<ul>
50+
<li>
51+
<h3>
52+
Example 1 :
53+
<a id="example1" aria-hidden="true" class="section-heading-ref"></a>
54+
</h3>
55+
<strong>To do : </strong>
56+
<i>Validate that the person's book-number is a valid international standard book number.
57+
</i>
58+
<p>
59+
Let's start with creating a new class called <code>Person</code>.
60+
</p>
61+
<pre class="code-block">
62+
<code appHighlight>{{person1}}</code>
63+
</pre>
64+
<pre class="code-block">
65+
<code appHighlight>{{example1}}</code>
66+
</pre>
67+
</li>
68+
<li>
69+
<h3>
70+
Example 2 :
71+
<a id="example2" aria-hidden="true" class="section-heading-ref"></a>
72+
</h3>
73+
<strong>To do : </strong>
74+
<i>Validate that the person's book-number is a valid international standard book number.
75+
</i>
76+
<pre class="code-block">
77+
<code appHighlight>{{example2}}</code>
78+
</pre>
79+
</li>
80+
</ul>
81+
</div>
82+
</ng-container>
83+
<!-- End Article -->
84+
85+
</app-post>

src/app/version1.0.0/components/validation/is-isbn-func/is-isbn-func.component.sass

Whitespace-only changes.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import {Component, OnInit} from "@angular/core";
2+
import {IPost, DocService} from "../../../../shared";
3+
4+
@Component({
5+
selector: "app-is-isbn-func",
6+
templateUrl: "./is-isbn-func.component.html",
7+
styleUrls: ["./is-isbn-func.component.sass"]
8+
})
9+
export class IsIsbnFuncComponent implements OnInit {
10+
11+
versionId = "1.0.0";
12+
postId = "is-isbn-func";
13+
14+
post: IPost;
15+
previous: IPost;
16+
next: IPost;
17+
18+
//#region Codes
19+
person1 = `
20+
public class Person
21+
{
22+
public string Name { get; set; }
23+
public string BookNumber { get; set; }
24+
}`;
25+
26+
example1 = `
27+
var model = new Person
28+
{
29+
Name = "John Smith",
30+
BookNumber = "123456"
31+
};
32+
33+
var validator = Validator.Create(model, "BookNumber")
34+
.IsISBN("Invalid book-number.");
35+
36+
var errors = validator.Validate();
37+
38+
/*
39+
errors value will be a List<ValidationError>
40+
41+
[
42+
{
43+
BookNumber = [
44+
"Invalid book-number."
45+
]
46+
}
47+
]
48+
*/`;
49+
50+
example2 = `
51+
var model = new Person
52+
{
53+
Name = "John Smith",
54+
BookNumber = "007462542X"
55+
};
56+
57+
var validator = Validator.Create(model, "BookNumber")
58+
.IsISBN("Invalid book-number.");
59+
60+
var errors = validator.Validate();
61+
62+
/*
63+
errors value will be null because the person's book-number is a valid international standard book number (ISBN).
64+
*/`;
65+
//#endregion
66+
67+
ngOnInit(): void {
68+
this.post = DocService.findPost(this.versionId, this.postId);
69+
70+
const prevNext = DocService.GetPrevNextPosts(this.versionId, this.postId);
71+
this.previous = prevNext.previous;
72+
this.next = prevNext.next;
73+
}
74+
75+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<app-post *ngIf="post" [post]="post" [previous]="previous" [next]="next">
2+
3+
<!-- Article -->
4+
<ng-container class="article">
5+
<p>
6+
An <code>extension</code> validation <code>method</code> checks if the property's value is a valid
7+
<a href="https://www.dittomusic.com/blog/what-is-an-isrc-code" target="blank">
8+
international standard recording code
9+
</a>.
10+
</p>
11+
<div>
12+
<h2 class="section-heading">
13+
Definition
14+
<a id="definition" aria-hidden="true" class="section-heading-ref"></a>
15+
</h2>
16+
<ul>
17+
<li>
18+
<h3>
19+
<code>.IsISRC(string: errorMessage = null)</code>
20+
</h3>
21+
<h3>Supported data types :</h3>
22+
<ul>
23+
<li>
24+
Strings.
25+
</li>
26+
</ul>
27+
<h3>Parameters :</h3>
28+
<ul>
29+
<li>
30+
<code>errorMessage</code> : An optional validation error message.
31+
<br><i>If omitted, a default error message will be used</i>.
32+
</li>
33+
</ul>
34+
35+
<h3>Returns :</h3>
36+
<ul>
37+
<li>
38+
A <code>Validator</code> to add more <code>validation</code> or <code>sanitization</code>.
39+
</li>
40+
</ul>
41+
</li>
42+
</ul>
43+
</div>
44+
<div>
45+
<h2 class="section-heading">
46+
Examples
47+
<a id="examples" aria-hidden="true" class="section-heading-ref"></a>
48+
</h2>
49+
<ul>
50+
<li>
51+
<h3>
52+
Example 1 :
53+
<a id="example1" aria-hidden="true" class="section-heading-ref"></a>
54+
</h3>
55+
<strong>To do : </strong>
56+
<i>Validate that the person's song-recording-code is a valid
57+
<a href="https://www.dittomusic.com/blog/what-is-an-isrc-code" target="blank">
58+
international standard recording code
59+
</a>.
60+
</i>
61+
<p>
62+
Let's start with creating a new class called <code>Person</code>.
63+
</p>
64+
<pre class="code-block">
65+
<code appHighlight>{{person1}}</code>
66+
</pre>
67+
<pre class="code-block">
68+
<code appHighlight>{{example1}}</code>
69+
</pre>
70+
</li>
71+
<li>
72+
<h3>
73+
Example 2 :
74+
<a id="example2" aria-hidden="true" class="section-heading-ref"></a>
75+
</h3>
76+
<strong>To do : </strong>
77+
<i>Validate that the person's song-recording-code is a valid
78+
<a href="https://www.dittomusic.com/blog/what-is-an-isrc-code" target="blank">
79+
international standard recording code
80+
</a>.
81+
</i>
82+
<pre class="code-block">
83+
<code appHighlight>{{example2}}</code>
84+
</pre>
85+
</li>
86+
</ul>
87+
</div>
88+
</ng-container>
89+
<!-- End Article -->
90+
91+
</app-post>

src/app/version1.0.0/components/validation/is-isrc-func/is-isrc-func.component.sass

Whitespace-only changes.

0 commit comments

Comments
 (0)