-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidator.red
More file actions
61 lines (53 loc) · 1.41 KB
/
validator.red
File metadata and controls
61 lines (53 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Red [
Title: "Validator"
Description: "Global validator as pack (wrapper) of various validators."
Author: "Mateusz Palichleb"
File: %validator.red
]
; you should use this file to validate
valid: context [
/local validators: context [
vat: do %validator/vat.red
mac: do %validator/mac.red
isbn: do %validator/isbn.red
credit-card: do %validator/credit-card.red
sedol: do %validator/sedol.red
swift-bic: do %validator/swift-bic.red
]
vat: func [
"Is provided string a valid VAT number?"
text[string!]
] [
return validators/vat/validate text
]
mac: func [
"Is provided string a valid MAC address?"
text[string!]
] [
return validators/mac/validate text
]
isbn: func [
"Is provided string a valid ISBN?"
text[string!]
] [
return validators/isbn/validate text
]
credit-card: func [
"Is provided string a valid Credit Card number?"
text[string!]
] [
return validators/credit-card/validate text
]
sedol: func [
"Is provided string a valid Stock Exchange code?"
text[string!]
] [
return validators/sedol/validate text
]
swift-bic: func [
"Is provided string a valid SWIFT or BIC code?"
text[string!]
] [
return validators/swift-bic/validate text
]
]