@8ms/helpers 1.0.3 → 1.0.7
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/api/constants.d.ts +2 -5
- package/dist/api/constants.js +1 -1
- package/dist/api/types.d.ts +1 -1
- package/dist/array/contains.d.ts +8 -0
- package/dist/array/contains.js +10 -0
- package/dist/array/index.d.ts +2 -1
- package/dist/array/index.js +3 -1
- package/dist/aws/athenaExpress/getClient.js +3 -2
- package/dist/aws/glue/getClient.js +3 -2
- package/dist/aws/lambda/getClient.js +3 -2
- package/dist/aws/s3/getClient.js +3 -2
- package/dist/aws/s3/getSignedUrl.js +1 -1
- package/dist/aws/s3/writePresignedPost.js +1 -1
- package/dist/aws/ses/getClient.js +3 -2
- package/dist/aws/ssm/getClient.js +3 -2
- package/dist/aws/ssm/getParameter.js +15 -8
- package/dist/axios/get.d.ts +3 -0
- package/dist/axios/get.js +106 -0
- package/dist/axios/index.d.ts +5 -0
- package/dist/axios/index.js +10 -0
- package/dist/axios/post.d.ts +6 -0
- package/dist/axios/post.js +109 -0
- package/dist/axios/types.d.ts +13 -0
- package/dist/axios/types.js +2 -0
- package/dist/crypto/getRandom.d.ts +2 -1
- package/dist/crypto/getRandom.js +2 -1
- package/dist/crypto/getSha256.d.ts +1 -0
- package/dist/crypto/getSha256.js +1 -0
- package/dist/eskimi/constants.d.ts +27 -0
- package/dist/eskimi/constants.js +76 -0
- package/dist/eskimi/getAccessToken.d.ts +14 -0
- package/dist/eskimi/getAccessToken.js +71 -0
- package/dist/eskimi/getAgeGroup.d.ts +7 -0
- package/dist/eskimi/getAgeGroup.js +17 -0
- package/dist/eskimi/getCampaignIds.d.ts +7 -0
- package/dist/eskimi/getCampaignIds.js +13 -0
- package/dist/eskimi/getDevice.d.ts +7 -0
- package/dist/eskimi/getDevice.js +15 -0
- package/dist/eskimi/getGender.d.ts +7 -0
- package/dist/eskimi/getGender.js +15 -0
- package/dist/eskimi/index.d.ts +10 -0
- package/dist/eskimi/index.js +23 -0
- package/dist/eskimi/request.d.ts +9 -0
- package/dist/eskimi/request.js +67 -0
- package/dist/eskimi/types.d.ts +19 -0
- package/dist/eskimi/types.js +2 -0
- package/dist/google/getCredentials.d.ts +2 -7
- package/dist/google/sheets/getAuth.d.ts +10 -0
- package/dist/google/sheets/getAuth.js +65 -0
- package/dist/google/sheets/index.d.ts +3 -0
- package/dist/google/sheets/index.js +8 -0
- package/dist/google/types.d.ts +6 -0
- package/dist/googleAds/getClient.js +5 -3
- package/dist/json/index.d.ts +3 -0
- package/dist/json/index.js +8 -0
- package/dist/json/isJson.d.ts +8 -0
- package/dist/json/isJson.js +21 -0
- package/dist/myTarget/getAccessToken.d.ts +12 -0
- package/dist/myTarget/getAccessToken.js +71 -0
- package/dist/myTarget/index.d.ts +4 -0
- package/dist/myTarget/index.js +10 -0
- package/dist/myTarget/request.d.ts +9 -0
- package/dist/myTarget/request.js +67 -0
- package/dist/nextAuth/index.d.ts +2 -1
- package/dist/nextAuth/index.js +6 -1
- package/dist/nextAuth/isSessionReady.d.ts +4 -0
- package/dist/nextAuth/isSessionReady.js +13 -0
- package/dist/number/getNumber.d.ts +8 -0
- package/dist/number/getNumber.js +38 -0
- package/dist/number/getPercent.d.ts +9 -0
- package/dist/number/getPercent.js +19 -0
- package/dist/number/getPercentIncrease.d.ts +9 -0
- package/dist/number/getPercentIncrease.js +19 -0
- package/dist/number/index.d.ts +5 -0
- package/dist/number/index.js +12 -0
- package/dist/prisma/getClient.js +1 -1
- package/dist/snapchat/getAccessToken.d.ts +12 -0
- package/dist/snapchat/getAccessToken.js +86 -0
- package/dist/snapchat/index.d.ts +3 -0
- package/dist/snapchat/index.js +8 -0
- package/dist/string/formatCapitalise.d.ts +9 -0
- package/dist/string/formatCapitalise.js +17 -0
- package/dist/string/index.d.ts +2 -1
- package/dist/string/index.js +3 -1
- package/package.json +2 -2
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var axios_1 = require("../axios");
|
|
40
|
+
/**
|
|
41
|
+
* Make the request to MyTarget API using the access token.
|
|
42
|
+
*/
|
|
43
|
+
var request = function (_a) {
|
|
44
|
+
var accessToken = _a.accessToken, data = _a.data, url = _a.url;
|
|
45
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
+
var response;
|
|
47
|
+
return __generator(this, function (_b) {
|
|
48
|
+
switch (_b.label) {
|
|
49
|
+
case 0: return [4 /*yield*/, (0, axios_1.post)({
|
|
50
|
+
config: {
|
|
51
|
+
headers: {
|
|
52
|
+
Authorization: "Bearer ".concat(accessToken),
|
|
53
|
+
"Content-Type": "application/json",
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
data: data,
|
|
57
|
+
onSuccess: function (response) { return response.data; },
|
|
58
|
+
url: url,
|
|
59
|
+
})];
|
|
60
|
+
case 1:
|
|
61
|
+
response = _b.sent();
|
|
62
|
+
return [2 /*return*/, response];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
exports.default = request;
|
package/dist/nextAuth/index.d.ts
CHANGED
package/dist/nextAuth/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
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 });
|
|
3
|
-
exports.AuthState = void 0;
|
|
6
|
+
exports.isSessionReady = exports.AuthState = void 0;
|
|
4
7
|
var constants_1 = require("./constants");
|
|
5
8
|
Object.defineProperty(exports, "AuthState", { enumerable: true, get: function () { return constants_1.AuthState; } });
|
|
9
|
+
var isSessionReady_1 = __importDefault(require("./isSessionReady"));
|
|
10
|
+
exports.isSessionReady = isSessionReady_1.default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var isSessionReady = function (_a) {
|
|
4
|
+
var session = _a.session;
|
|
5
|
+
var response = false;
|
|
6
|
+
if (undefined !== session && null !== session) {
|
|
7
|
+
if (undefined !== session.user && null !== session.user) {
|
|
8
|
+
response = true;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return response;
|
|
12
|
+
};
|
|
13
|
+
exports.default = isSessionReady;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var json_1 = require("../json");
|
|
4
|
+
/**
|
|
5
|
+
* Take an input and return a number.
|
|
6
|
+
*/
|
|
7
|
+
var getNumber = function (_a) {
|
|
8
|
+
var _b = _a === void 0 ? { defaultValue: 0, input: '' } : _a, defaultValue = _b.defaultValue, input = _b.input;
|
|
9
|
+
var actualDefaultValue = defaultValue || 0;
|
|
10
|
+
var response;
|
|
11
|
+
// JSON - Decode the value
|
|
12
|
+
if ((0, json_1.isJson)({ input: input })) {
|
|
13
|
+
response = JSON.parse(input);
|
|
14
|
+
}
|
|
15
|
+
// String input
|
|
16
|
+
if ('string' === typeof response) {
|
|
17
|
+
// Attempt to convert to number
|
|
18
|
+
response = Number(response);
|
|
19
|
+
// Not a number, try extracting the number value
|
|
20
|
+
if (isNaN(response)) {
|
|
21
|
+
var match = RegExp(/^\D*([0-9\.]*)\D*$/, 'g')
|
|
22
|
+
.exec(input);
|
|
23
|
+
if (match.length) {
|
|
24
|
+
response = Number(match[1]);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
// Attempt to convert to a number
|
|
29
|
+
else {
|
|
30
|
+
response = Number(response);
|
|
31
|
+
}
|
|
32
|
+
// Trouble converting the number, use default value
|
|
33
|
+
if (isNaN(response)) {
|
|
34
|
+
response = actualDefaultValue;
|
|
35
|
+
}
|
|
36
|
+
return response;
|
|
37
|
+
};
|
|
38
|
+
exports.default = getNumber;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var getNumber_1 = __importDefault(require("./getNumber"));
|
|
7
|
+
/**
|
|
8
|
+
* Get the percentage of two numbers.
|
|
9
|
+
*/
|
|
10
|
+
var getPercentage = function (_a) {
|
|
11
|
+
var defaultValue = _a.defaultValue, divisor = _a.divisor, value = _a.value;
|
|
12
|
+
var cleanValue = (0, getNumber_1.default)({ input: value });
|
|
13
|
+
var cleanDivisor = (0, getNumber_1.default)({ input: divisor });
|
|
14
|
+
if (0 === cleanDivisor) {
|
|
15
|
+
return defaultValue;
|
|
16
|
+
}
|
|
17
|
+
return cleanValue / cleanDivisor;
|
|
18
|
+
};
|
|
19
|
+
exports.default = getPercentage;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var getNumber_1 = __importDefault(require("./getNumber"));
|
|
7
|
+
/**
|
|
8
|
+
* Formula to work out the percentage increase/decrease.
|
|
9
|
+
*/
|
|
10
|
+
var getPercentageIncrease = function (_a) {
|
|
11
|
+
var comparison = _a.comparison, current = _a.current, defaultValue = _a.defaultValue;
|
|
12
|
+
var currentValue = (0, getNumber_1.default)({ input: current });
|
|
13
|
+
var comparisonValue = (0, getNumber_1.default)({ input: comparison });
|
|
14
|
+
if (0 === currentValue) {
|
|
15
|
+
return defaultValue;
|
|
16
|
+
}
|
|
17
|
+
return (currentValue - comparisonValue) / currentValue * 100;
|
|
18
|
+
};
|
|
19
|
+
exports.default = getPercentageIncrease;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPercentIncrease = exports.getPercent = exports.getNumber = void 0;
|
|
7
|
+
var getNumber_1 = __importDefault(require("./getNumber"));
|
|
8
|
+
exports.getNumber = getNumber_1.default;
|
|
9
|
+
var getPercent_1 = __importDefault(require("./getPercent"));
|
|
10
|
+
exports.getPercent = getPercent_1.default;
|
|
11
|
+
var getPercentIncrease_1 = __importDefault(require("./getPercentIncrease"));
|
|
12
|
+
exports.getPercentIncrease = getPercentIncrease_1.default;
|
package/dist/prisma/getClient.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AwsConfigType } from '../aws';
|
|
2
|
+
declare type GetAccessTokenType = {
|
|
3
|
+
SsmLib: any;
|
|
4
|
+
awsConfig: AwsConfigType;
|
|
5
|
+
force: boolean;
|
|
6
|
+
ssmName: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Renew the access token as it expires every 3 hours.
|
|
10
|
+
*/
|
|
11
|
+
declare const getAccessToken: ({ SsmLib, awsConfig, force, ssmName, }: GetAccessTokenType) => Promise<void>;
|
|
12
|
+
export default getAccessToken;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var ssm_1 = require("../aws/ssm");
|
|
40
|
+
var axios_1 = require("../axios");
|
|
41
|
+
var snapchatAccessToken;
|
|
42
|
+
/**
|
|
43
|
+
* Renew the access token as it expires every 3 hours.
|
|
44
|
+
*/
|
|
45
|
+
var getAccessToken = function (_a) {
|
|
46
|
+
var SsmLib = _a.SsmLib, awsConfig = _a.awsConfig, force = _a.force, ssmName = _a.ssmName;
|
|
47
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
48
|
+
var ssmClient, parameter, url;
|
|
49
|
+
return __generator(this, function (_b) {
|
|
50
|
+
switch (_b.label) {
|
|
51
|
+
case 0:
|
|
52
|
+
if (!(!global.snapchatAccessToken || force)) return [3 /*break*/, 3];
|
|
53
|
+
ssmClient = (0, ssm_1.getClient)({ SsmLib: SsmLib, config: awsConfig });
|
|
54
|
+
return [4 /*yield*/, (0, ssm_1.getParameter)({
|
|
55
|
+
SsmLib: SsmLib,
|
|
56
|
+
client: ssmClient,
|
|
57
|
+
name: ssmName,
|
|
58
|
+
withDecryption: true,
|
|
59
|
+
isJson: true,
|
|
60
|
+
})];
|
|
61
|
+
case 1:
|
|
62
|
+
parameter = _b.sent();
|
|
63
|
+
url = "https://accounts.snapchat.com/login/oauth2/access_token";
|
|
64
|
+
url += "?client_id=".concat(parameter.clientId);
|
|
65
|
+
url += "&client_secret=".concat(parameter.clientSecret);
|
|
66
|
+
url += "&grant_type=refresh_token";
|
|
67
|
+
url += "&refresh_token=".concat(parameter.refreshToken);
|
|
68
|
+
return [4 /*yield*/, (0, axios_1.post)({
|
|
69
|
+
onSuccess: function (apiResponse) {
|
|
70
|
+
if (undefined !== apiResponse['data']['access_token']) {
|
|
71
|
+
global.snapchatAccessToken = apiResponse['data']['access_token'];
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
url: url,
|
|
75
|
+
})];
|
|
76
|
+
case 2:
|
|
77
|
+
_b.sent();
|
|
78
|
+
_b.label = 3;
|
|
79
|
+
case 3:
|
|
80
|
+
snapchatAccessToken = global.snapchatAccessToken;
|
|
81
|
+
return [2 /*return*/, snapchatAccessToken];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
exports.default = getAccessToken;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getAccessToken = void 0;
|
|
7
|
+
var getAccessToken_1 = __importDefault(require("./getAccessToken"));
|
|
8
|
+
exports.getAccessToken = getAccessToken_1.default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Convert a string into Capitalised Text.
|
|
5
|
+
* https://stackoverflow.com/a/196991/2664955
|
|
6
|
+
*/
|
|
7
|
+
var formatCapitalise = function (_a) {
|
|
8
|
+
var _b = _a === void 0 ? { input: '', split: '_' } : _a, input = _b.input, split = _b.split;
|
|
9
|
+
return input
|
|
10
|
+
.replace("/".concat(split, "/g"), ' ')
|
|
11
|
+
.replace(/\w\S*/g, function (txt) {
|
|
12
|
+
return txt.charAt(0)
|
|
13
|
+
.toUpperCase() + txt.substr(1)
|
|
14
|
+
.toLowerCase();
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
exports.default = formatCapitalise;
|
package/dist/string/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import formatCapitalise from './formatCapitalise';
|
|
1
2
|
import getCleanFolder from './getCleanFolder';
|
|
2
3
|
import getStringFromStream from './getStringFromStream';
|
|
3
4
|
export type {};
|
|
4
|
-
export { getCleanFolder, getStringFromStream, };
|
|
5
|
+
export { formatCapitalise, getCleanFolder, getStringFromStream, };
|
package/dist/string/index.js
CHANGED
|
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getStringFromStream = exports.getCleanFolder = void 0;
|
|
6
|
+
exports.getStringFromStream = exports.getCleanFolder = exports.formatCapitalise = void 0;
|
|
7
|
+
var formatCapitalise_1 = __importDefault(require("./formatCapitalise"));
|
|
8
|
+
exports.formatCapitalise = formatCapitalise_1.default;
|
|
7
9
|
var getCleanFolder_1 = __importDefault(require("./getCleanFolder"));
|
|
8
10
|
exports.getCleanFolder = getCleanFolder_1.default;
|
|
9
11
|
var getStringFromStream_1 = __importDefault(require("./getStringFromStream"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@8ms/helpers",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/lodash": "4.14.178",
|
|
23
|
-
"@types/node": "17.0.
|
|
23
|
+
"@types/node": "17.0.12",
|
|
24
24
|
"tslib": "2.3.1",
|
|
25
25
|
"typescript": "4.5.5"
|
|
26
26
|
}
|