@ellipticltd/aml-utils 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -37,7 +37,7 @@ const validations = {
|
|
|
37
37
|
},
|
|
38
38
|
isSafeString(str) {
|
|
39
39
|
// eslint-disable-next-line no-useless-escape
|
|
40
|
-
return RegExp(/^(\p{L}|[0-9]|-|=|!|\.|:|\s|@|\+|_
|
|
40
|
+
return RegExp(/^(\p{L}|[0-9]|-|=|!|\.|:|\s|@|\+|_|,|\$|£|&)+$/, 'u').test(str);
|
|
41
41
|
},
|
|
42
42
|
ensureShortEnough(limit, x) {
|
|
43
43
|
const l = x != null ? x.length : undefined;
|
|
@@ -52,8 +52,9 @@ describe('Validations', () => {
|
|
|
52
52
|
validations_1.default.isSafeString('aaaaa').should.be.true;
|
|
53
53
|
validations_1.default.isSafeString('Customer reference').should.be.true;
|
|
54
54
|
validations_1.default.isSafeString('Safe-String-01827!@').should.be.true;
|
|
55
|
+
validations_1.default.isSafeString('NewSafeCharacters $ £ & - $').should.be.true;
|
|
55
56
|
});
|
|
56
|
-
it('should return false if the first argument is a safe string', () => {
|
|
57
|
+
it('should return false if the first argument is not a safe string', () => {
|
|
57
58
|
validations_1.default.isSafeString('{customer}').should.be.false;
|
|
58
59
|
validations_1.default.isSafeString('<string>').should.be.false;
|
|
59
60
|
});
|
|
@@ -44,7 +44,7 @@ const validations = {
|
|
|
44
44
|
},
|
|
45
45
|
isSafeString(str) {
|
|
46
46
|
// eslint-disable-next-line no-useless-escape
|
|
47
|
-
return RegExp(/^(\p{L}|[0-9]|-|=|!|\.|:|\s|@|\+|_
|
|
47
|
+
return RegExp(/^(\p{L}|[0-9]|-|=|!|\.|:|\s|@|\+|_|,|\$|£|&)+$/, 'u').test(str);
|
|
48
48
|
},
|
|
49
49
|
ensureShortEnough(limit, x) {
|
|
50
50
|
const l = x != null ? x.length : undefined;
|
|
@@ -59,8 +59,9 @@ describe('Validations', () => {
|
|
|
59
59
|
validations.isSafeString('aaaaa').should.be.true;
|
|
60
60
|
validations.isSafeString('Customer reference').should.be.true;
|
|
61
61
|
validations.isSafeString('Safe-String-01827!@').should.be.true;
|
|
62
|
+
validations.isSafeString('NewSafeCharacters $ £ & - $').should.be.true;
|
|
62
63
|
});
|
|
63
|
-
it('should return false if the first argument is a safe string', () => {
|
|
64
|
+
it('should return false if the first argument is not a safe string', () => {
|
|
64
65
|
validations.isSafeString('{customer}').should.be.false;
|
|
65
66
|
validations.isSafeString('<string>').should.be.false;
|
|
66
67
|
});
|