@8ms/helpers 1.3.23 → 1.3.25
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/package.json +1 -1
- package/string/getCapitalised.js +2 -2
- package/xml/getXml.js +16 -9
package/package.json
CHANGED
package/string/getCapitalised.js
CHANGED
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
* https://stackoverflow.com/a/196991/2664955
|
|
6
6
|
*/
|
|
7
7
|
const getCapitalised = ({ input, split }) => {
|
|
8
|
-
const
|
|
8
|
+
const regex = new RegExp(split || '_', 'g');
|
|
9
9
|
return input
|
|
10
|
-
.replace(
|
|
10
|
+
.replace(regex, ' ')
|
|
11
11
|
.replace(/\w\S*/g, function (txt) {
|
|
12
12
|
return txt.charAt(0)
|
|
13
13
|
.toUpperCase() + txt.substr(1)
|
package/xml/getXml.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const get_1 = __importDefault(require("../axios/get"));
|
|
3
7
|
const getXml = async ({ url }) => {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
let response = '';
|
|
9
|
+
const apiResponse = await (0, get_1.default)({
|
|
10
|
+
url
|
|
11
|
+
});
|
|
12
|
+
if (apiResponse.isSuccess()) {
|
|
13
|
+
response = apiResponse.getBody().toString();
|
|
14
|
+
// Trim the contents
|
|
15
|
+
response = response.trim();
|
|
16
|
+
// Remove tabs, new lines, double spaces
|
|
17
|
+
response = response.replace(/[ ]{2}|\r\n|\n|\r|\t/gm, '');
|
|
18
|
+
}
|
|
19
|
+
return response;
|
|
13
20
|
};
|
|
14
21
|
exports.default = getXml;
|