pangea-helpers 1.1.2 → 1.1.4
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/helpers/animation.js +1 -5
- package/dist/helpers/coin.js +6 -14
- package/dist/helpers/datetime.js +1 -5
- package/dist/helpers/number.js +1 -5
- package/dist/helpers/object.js +4 -12
- package/dist/helpers/token.js +4 -11
- package/dist/helpers/url.js +1 -5
- package/dist/main.js +8 -40
- package/package.json +2 -1
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.animateCSS = void 0;
|
|
4
|
-
function animateCSS(element, animation, prefix = 'animate__') {
|
|
1
|
+
export function animateCSS(element, animation, prefix = 'animate__') {
|
|
5
2
|
return new Promise((resolve) => {
|
|
6
3
|
const animationName = `${prefix}${animation}`;
|
|
7
4
|
const node = document.querySelector(element);
|
|
@@ -16,4 +13,3 @@ function animateCSS(element, animation, prefix = 'animate__') {
|
|
|
16
13
|
}
|
|
17
14
|
});
|
|
18
15
|
}
|
|
19
|
-
exports.animateCSS = animateCSS;
|
package/dist/helpers/coin.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,24 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
exports.getDollarValue = exports.getAmountInString = void 0;
|
|
16
|
-
const axios_1 = __importDefault(require("axios"));
|
|
17
|
-
const number_1 = require("./number");
|
|
18
|
-
function getAmountInString(amount, significantDigits, coinName, withCoinName = true) {
|
|
19
|
-
let amountToDisplay = (0, number_1.getValueInString)(amount, significantDigits);
|
|
10
|
+
import axios from 'axios';
|
|
11
|
+
import { getValueInString } from './number';
|
|
12
|
+
export function getAmountInString(amount, significantDigits, coinName, withCoinName = true) {
|
|
13
|
+
let amountToDisplay = getValueInString(amount, significantDigits);
|
|
20
14
|
if (withCoinName)
|
|
21
15
|
amountToDisplay = amountToDisplay += ` ${coinName}`;
|
|
22
16
|
return amountToDisplay;
|
|
23
17
|
}
|
|
24
|
-
|
|
25
|
-
function getDollarValue() {
|
|
18
|
+
export function getDollarValue() {
|
|
26
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const res = yield
|
|
20
|
+
const res = yield axios.get('https://dolarapi.com/v1/dolares/blue');
|
|
28
21
|
return res.data.venta;
|
|
29
22
|
});
|
|
30
23
|
}
|
|
31
|
-
exports.getDollarValue = getDollarValue;
|
package/dist/helpers/datetime.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDatetimeInString = void 0;
|
|
4
|
-
function getDatetimeInString(datetime, config) {
|
|
1
|
+
export function getDatetimeInString(datetime, config) {
|
|
5
2
|
// config
|
|
6
3
|
const defaultConfig = {
|
|
7
4
|
format: 'short',
|
|
@@ -25,4 +22,3 @@ function getDatetimeInString(datetime, config) {
|
|
|
25
22
|
const stringDatetime = datetime.toLocaleString('es-ES', options);
|
|
26
23
|
return stringDatetime.charAt(0).toUpperCase() + stringDatetime.slice(1);
|
|
27
24
|
}
|
|
28
|
-
exports.getDatetimeInString = getDatetimeInString;
|
package/dist/helpers/number.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getValueInString = void 0;
|
|
4
|
-
function getValueInString(value, maximumFractionDigits) {
|
|
1
|
+
export function getValueInString(value, maximumFractionDigits) {
|
|
5
2
|
const valueToReturn = value.toLocaleString(undefined, {
|
|
6
3
|
maximumFractionDigits,
|
|
7
4
|
});
|
|
@@ -9,4 +6,3 @@ function getValueInString(value, maximumFractionDigits) {
|
|
|
9
6
|
return "0";
|
|
10
7
|
return valueToReturn;
|
|
11
8
|
}
|
|
12
|
-
exports.getValueInString = getValueInString;
|
package/dist/helpers/object.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.copyAvailableFields = exports.copyModelFields = void 0;
|
|
7
|
-
const moment_1 = __importDefault(require("moment"));
|
|
8
|
-
function copyModelFields(objTo, objFrom, relations) {
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
export function copyModelFields(objTo, objFrom, relations) {
|
|
9
3
|
if (objFrom)
|
|
10
4
|
Object.keys(objFrom).forEach((key) => {
|
|
11
5
|
if (!objTo.hasOwnProperty(key))
|
|
@@ -15,7 +9,7 @@ function copyModelFields(objTo, objFrom, relations) {
|
|
|
15
9
|
if (objFrom[key] instanceof File)
|
|
16
10
|
return (objTo[key] = objFrom[key]);
|
|
17
11
|
if (/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/.test(objFrom[key]) &&
|
|
18
|
-
(
|
|
12
|
+
moment(objFrom[key], moment.ISO_8601, true).isValid())
|
|
19
13
|
return (objTo[key] = new Date(objFrom[key]));
|
|
20
14
|
if (typeof objFrom[key] === 'object' && (relations === null || relations === void 0 ? void 0 : relations[key])) {
|
|
21
15
|
if (Array.isArray(objFrom[key])) {
|
|
@@ -33,8 +27,7 @@ function copyModelFields(objTo, objFrom, relations) {
|
|
|
33
27
|
}
|
|
34
28
|
});
|
|
35
29
|
}
|
|
36
|
-
|
|
37
|
-
function copyAvailableFields(destinationObj, originObj) {
|
|
30
|
+
export function copyAvailableFields(destinationObj, originObj) {
|
|
38
31
|
if (!destinationObj || !originObj)
|
|
39
32
|
return;
|
|
40
33
|
for (const key in originObj) {
|
|
@@ -48,4 +41,3 @@ function copyAvailableFields(destinationObj, originObj) {
|
|
|
48
41
|
}
|
|
49
42
|
}
|
|
50
43
|
}
|
|
51
|
-
exports.copyAvailableFields = copyAvailableFields;
|
package/dist/helpers/token.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Token = void 0;
|
|
7
|
-
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
8
|
-
class Token {
|
|
1
|
+
import jwt from 'jsonwebtoken';
|
|
2
|
+
export class Token {
|
|
9
3
|
constructor(secretPrivateKey, daysToExpire) {
|
|
10
4
|
this.secretPrivateKey = 'secretPrivateKey';
|
|
11
5
|
this.daysToExpire = 30;
|
|
@@ -13,12 +7,11 @@ class Token {
|
|
|
13
7
|
this.daysToExpire = daysToExpire;
|
|
14
8
|
}
|
|
15
9
|
createAccessToken(key, value) {
|
|
16
|
-
return
|
|
10
|
+
return jwt.sign({ [key]: value }, this.secretPrivateKey, {
|
|
17
11
|
expiresIn: 60 * 60 * 24 * this.daysToExpire,
|
|
18
12
|
});
|
|
19
13
|
}
|
|
20
14
|
verifyAccessToken(token) {
|
|
21
|
-
return
|
|
15
|
+
return jwt.verify(token, this.secretPrivateKey);
|
|
22
16
|
}
|
|
23
17
|
}
|
|
24
|
-
exports.Token = Token;
|
package/dist/helpers/url.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCurrentUrl = void 0;
|
|
4
|
-
function isCurrentUrl(url) {
|
|
1
|
+
export function isCurrentUrl(url) {
|
|
5
2
|
if (!url)
|
|
6
3
|
return false;
|
|
7
4
|
let finalUrl = url;
|
|
@@ -17,4 +14,3 @@ function isCurrentUrl(url) {
|
|
|
17
14
|
finalUrl = finalUrl.replace(/:(\d*)$/, '');
|
|
18
15
|
return window.location.href.includes(finalUrl);
|
|
19
16
|
}
|
|
20
|
-
exports.isCurrentUrl = isCurrentUrl;
|
package/dist/main.js
CHANGED
|
@@ -1,40 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.urlHelpers = exports.tokenHelpers = exports.objectHelpers = exports.numberHelpers = exports.datetimeHelpers = exports.coinHelpers = exports.animationHelpers = void 0;
|
|
27
|
-
const animationHelpers = __importStar(require("./helpers/animation"));
|
|
28
|
-
exports.animationHelpers = animationHelpers;
|
|
29
|
-
const coinHelpers = __importStar(require("./helpers/coin"));
|
|
30
|
-
exports.coinHelpers = coinHelpers;
|
|
31
|
-
const datetimeHelpers = __importStar(require("./helpers/datetime"));
|
|
32
|
-
exports.datetimeHelpers = datetimeHelpers;
|
|
33
|
-
const numberHelpers = __importStar(require("./helpers/number"));
|
|
34
|
-
exports.numberHelpers = numberHelpers;
|
|
35
|
-
const objectHelpers = __importStar(require("./helpers/object"));
|
|
36
|
-
exports.objectHelpers = objectHelpers;
|
|
37
|
-
const tokenHelpers = __importStar(require("./helpers/token"));
|
|
38
|
-
exports.tokenHelpers = tokenHelpers;
|
|
39
|
-
const urlHelpers = __importStar(require("./helpers/url"));
|
|
40
|
-
exports.urlHelpers = urlHelpers;
|
|
1
|
+
import * as animationHelpers from './helpers/animation';
|
|
2
|
+
import * as coinHelpers from './helpers/coin';
|
|
3
|
+
import * as datetimeHelpers from './helpers/datetime';
|
|
4
|
+
import * as numberHelpers from './helpers/number';
|
|
5
|
+
import * as objectHelpers from './helpers/object';
|
|
6
|
+
import * as tokenHelpers from './helpers/token';
|
|
7
|
+
import * as urlHelpers from './helpers/url';
|
|
8
|
+
export { animationHelpers, coinHelpers, datetimeHelpers, numberHelpers, objectHelpers, tokenHelpers, urlHelpers };
|