@util.js/emails 0.41.1 → 0.41.3
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.
- package/dist/EmailHeaders.js +11 -21
- package/dist/Emails.js +4 -21
- package/package.json +3 -3
package/dist/EmailHeaders.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* Wrapper of email headers that makes header lookup easy.
|
|
4
5
|
*
|
|
@@ -8,20 +9,16 @@
|
|
|
8
9
|
* @public
|
|
9
10
|
* @class
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
12
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
13
|
-
|
|
14
13
|
var _weakMap = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/weak-map"));
|
|
15
|
-
|
|
16
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
15
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
19
|
-
|
|
20
16
|
var EmailHeaders = /*#__PURE__*/function () {
|
|
21
17
|
function EmailHeaders(options) {
|
|
22
18
|
(0, _classCallCheck2["default"])(this, EmailHeaders);
|
|
23
19
|
dependencies.set(this, options);
|
|
24
20
|
}
|
|
21
|
+
|
|
25
22
|
/**
|
|
26
23
|
* Returns the value of the Delivered-To header
|
|
27
24
|
*
|
|
@@ -30,13 +27,12 @@ var EmailHeaders = /*#__PURE__*/function () {
|
|
|
30
27
|
* @instance
|
|
31
28
|
* @function
|
|
32
29
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
30
|
(0, _createClass2["default"])(EmailHeaders, [{
|
|
36
31
|
key: "deliveredTo",
|
|
37
32
|
value: function deliveredTo() {
|
|
38
33
|
return this.get("delivered-to");
|
|
39
34
|
}
|
|
35
|
+
|
|
40
36
|
/**
|
|
41
37
|
* Returns the value of the Date header
|
|
42
38
|
*
|
|
@@ -45,12 +41,12 @@ var EmailHeaders = /*#__PURE__*/function () {
|
|
|
45
41
|
* @instance
|
|
46
42
|
* @function
|
|
47
43
|
*/
|
|
48
|
-
|
|
49
44
|
}, {
|
|
50
45
|
key: "date",
|
|
51
46
|
value: function date() {
|
|
52
47
|
return this.get("date");
|
|
53
48
|
}
|
|
49
|
+
|
|
54
50
|
/**
|
|
55
51
|
* Returns the value of the From header
|
|
56
52
|
*
|
|
@@ -59,12 +55,12 @@ var EmailHeaders = /*#__PURE__*/function () {
|
|
|
59
55
|
* @instance
|
|
60
56
|
* @function
|
|
61
57
|
*/
|
|
62
|
-
|
|
63
58
|
}, {
|
|
64
59
|
key: "from",
|
|
65
60
|
value: function from() {
|
|
66
61
|
return this.get("from");
|
|
67
62
|
}
|
|
63
|
+
|
|
68
64
|
/**
|
|
69
65
|
* Returns the value of the given headerName
|
|
70
66
|
*
|
|
@@ -75,12 +71,12 @@ var EmailHeaders = /*#__PURE__*/function () {
|
|
|
75
71
|
* @instance
|
|
76
72
|
* @function
|
|
77
73
|
*/
|
|
78
|
-
|
|
79
74
|
}, {
|
|
80
75
|
key: "get",
|
|
81
76
|
value: function get(headerName) {
|
|
82
77
|
return lowercaseHeaderMap(this)[headerName.toLowerCase()];
|
|
83
78
|
}
|
|
79
|
+
|
|
84
80
|
/**
|
|
85
81
|
* Returns the value of the In-Reply-To header
|
|
86
82
|
*
|
|
@@ -89,12 +85,12 @@ var EmailHeaders = /*#__PURE__*/function () {
|
|
|
89
85
|
* @instance
|
|
90
86
|
* @function
|
|
91
87
|
*/
|
|
92
|
-
|
|
93
88
|
}, {
|
|
94
89
|
key: "inReplyTo",
|
|
95
90
|
value: function inReplyTo() {
|
|
96
91
|
return this.get("in-reply-to");
|
|
97
92
|
}
|
|
93
|
+
|
|
98
94
|
/**
|
|
99
95
|
* Returns the value of the Message-Id header
|
|
100
96
|
*
|
|
@@ -103,12 +99,12 @@ var EmailHeaders = /*#__PURE__*/function () {
|
|
|
103
99
|
* @instance
|
|
104
100
|
* @function
|
|
105
101
|
*/
|
|
106
|
-
|
|
107
102
|
}, {
|
|
108
103
|
key: "messageId",
|
|
109
104
|
value: function messageId() {
|
|
110
105
|
return this.get("message-id");
|
|
111
106
|
}
|
|
107
|
+
|
|
112
108
|
/**
|
|
113
109
|
* Returns the value of the References header
|
|
114
110
|
*
|
|
@@ -117,12 +113,12 @@ var EmailHeaders = /*#__PURE__*/function () {
|
|
|
117
113
|
* @instance
|
|
118
114
|
* @function
|
|
119
115
|
*/
|
|
120
|
-
|
|
121
116
|
}, {
|
|
122
117
|
key: "references",
|
|
123
118
|
value: function references() {
|
|
124
119
|
return this.get("references");
|
|
125
120
|
}
|
|
121
|
+
|
|
126
122
|
/**
|
|
127
123
|
* Returns the value of the Subject header
|
|
128
124
|
*
|
|
@@ -131,12 +127,12 @@ var EmailHeaders = /*#__PURE__*/function () {
|
|
|
131
127
|
* @instance
|
|
132
128
|
* @function
|
|
133
129
|
*/
|
|
134
|
-
|
|
135
130
|
}, {
|
|
136
131
|
key: "subject",
|
|
137
132
|
value: function subject() {
|
|
138
133
|
return this.get("subject");
|
|
139
134
|
}
|
|
135
|
+
|
|
140
136
|
/**
|
|
141
137
|
* Returns the value of the To header
|
|
142
138
|
*
|
|
@@ -145,12 +141,12 @@ var EmailHeaders = /*#__PURE__*/function () {
|
|
|
145
141
|
* @instance
|
|
146
142
|
* @function
|
|
147
143
|
*/
|
|
148
|
-
|
|
149
144
|
}, {
|
|
150
145
|
key: "to",
|
|
151
146
|
value: function to() {
|
|
152
147
|
return this.get("to");
|
|
153
148
|
}
|
|
149
|
+
|
|
154
150
|
/**
|
|
155
151
|
* Returns a string listing the email-header names and values of this object
|
|
156
152
|
*
|
|
@@ -159,7 +155,6 @@ var EmailHeaders = /*#__PURE__*/function () {
|
|
|
159
155
|
* @instance
|
|
160
156
|
* @function
|
|
161
157
|
*/
|
|
162
|
-
|
|
163
158
|
}, {
|
|
164
159
|
key: "toString",
|
|
165
160
|
value: function toString() {
|
|
@@ -168,22 +163,17 @@ var EmailHeaders = /*#__PURE__*/function () {
|
|
|
168
163
|
}]);
|
|
169
164
|
return EmailHeaders;
|
|
170
165
|
}();
|
|
171
|
-
|
|
172
166
|
module.exports = EmailHeaders;
|
|
173
167
|
var dependencies = new _weakMap["default"]();
|
|
174
|
-
|
|
175
168
|
function get(thiz, dependency) {
|
|
176
169
|
return dependencies.get(thiz)[dependency];
|
|
177
170
|
}
|
|
178
|
-
|
|
179
171
|
function headerMap(thiz) {
|
|
180
172
|
return get(thiz, "headerMap");
|
|
181
173
|
}
|
|
182
|
-
|
|
183
174
|
function json() {
|
|
184
175
|
return JSON;
|
|
185
176
|
}
|
|
186
|
-
|
|
187
177
|
function lowercaseHeaderMap(thiz) {
|
|
188
178
|
return get(thiz, "lowercaseHeaderMap");
|
|
189
179
|
}
|
package/dist/Emails.js
CHANGED
|
@@ -1,37 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* JavaScript utility methods for emails
|
|
4
5
|
* @public
|
|
5
6
|
* @class
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
8
|
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
9
|
-
|
|
10
9
|
var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
|
|
11
|
-
|
|
12
10
|
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
13
|
-
|
|
14
11
|
var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
|
|
15
|
-
|
|
16
12
|
var _Array$isArray = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
|
|
17
|
-
|
|
18
13
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
19
|
-
|
|
20
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
21
|
-
|
|
22
15
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
23
|
-
|
|
24
16
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
25
|
-
|
|
26
17
|
function _unsupportedIterableToArray(o, minLen) { var _context; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
27
|
-
|
|
28
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
29
|
-
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
30
19
|
var Emails = /*#__PURE__*/function () {
|
|
31
20
|
function Emails() {
|
|
32
21
|
(0, _classCallCheck2["default"])(this, Emails);
|
|
33
22
|
}
|
|
34
|
-
|
|
35
23
|
(0, _createClass2["default"])(Emails, [{
|
|
36
24
|
key: "isValidEmail",
|
|
37
25
|
value:
|
|
@@ -49,6 +37,7 @@ var Emails = /*#__PURE__*/function () {
|
|
|
49
37
|
function isValidEmail(string) {
|
|
50
38
|
return /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(string);
|
|
51
39
|
}
|
|
40
|
+
|
|
52
41
|
/**
|
|
53
42
|
* Wraps the given nameValueArrayOfHeaders inside an object that makes email-header lookup easy.
|
|
54
43
|
*
|
|
@@ -70,16 +59,13 @@ var Emails = /*#__PURE__*/function () {
|
|
|
70
59
|
* @instance
|
|
71
60
|
* @function
|
|
72
61
|
*/
|
|
73
|
-
|
|
74
62
|
}, {
|
|
75
63
|
key: "wrapHeaders",
|
|
76
64
|
value: function wrapHeaders(nameValueArrayOfHeaders) {
|
|
77
65
|
var headerMap = {};
|
|
78
66
|
var lowercaseHeaderMap = {};
|
|
79
|
-
|
|
80
67
|
var _iterator = _createForOfIteratorHelper(nameValueArrayOfHeaders),
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
_step;
|
|
83
69
|
try {
|
|
84
70
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
85
71
|
var header = _step.value;
|
|
@@ -91,7 +77,6 @@ var Emails = /*#__PURE__*/function () {
|
|
|
91
77
|
} finally {
|
|
92
78
|
_iterator.f();
|
|
93
79
|
}
|
|
94
|
-
|
|
95
80
|
var EmailHeaders = requireEmailHeaders();
|
|
96
81
|
return new EmailHeaders({
|
|
97
82
|
headerMap: headerMap,
|
|
@@ -101,10 +86,8 @@ var Emails = /*#__PURE__*/function () {
|
|
|
101
86
|
}]);
|
|
102
87
|
return Emails;
|
|
103
88
|
}();
|
|
104
|
-
|
|
105
89
|
module.exports = Emails;
|
|
106
90
|
var dependencies = {};
|
|
107
|
-
|
|
108
91
|
function requireEmailHeaders() {
|
|
109
92
|
return dependencies.EmailHeaders || (dependencies.EmailHeaders = require("./EmailHeaders"));
|
|
110
93
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "Chris Topher <c@creemama.com>",
|
|
3
3
|
"description": "JavaScript utility methods for emails",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@babel/runtime-corejs3": "7.
|
|
5
|
+
"@babel/runtime-corejs3": "7.21.0"
|
|
6
6
|
},
|
|
7
7
|
"dependencies-comments": [
|
|
8
8
|
"@babel/runtime-corejs3 is required by files in the dist directory to ",
|
|
@@ -28,6 +28,6 @@
|
|
|
28
28
|
"type": "git",
|
|
29
29
|
"url": "https://github.com/creemama/utiljs/tree/master/packages/utiljs-emails"
|
|
30
30
|
},
|
|
31
|
-
"version": "0.41.
|
|
32
|
-
"gitHead": "
|
|
31
|
+
"version": "0.41.3",
|
|
32
|
+
"gitHead": "e17139b7f85c3abec178d8facdacc2aa6c5bb553"
|
|
33
33
|
}
|