tripstorekrabi-shared 1.9.5 → 1.9.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/package.json +1 -1
- package/utils.js +7 -1
package/package.json
CHANGED
package/utils.js
CHANGED
|
@@ -91,7 +91,7 @@ export function formatDuration(minutes) {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
export function getPickuptimeSummary(pickupZones) {
|
|
94
|
-
if (pickupZones) {
|
|
94
|
+
if (pickupZones && pickupZones.length>0) {
|
|
95
95
|
let pickupTimesArray = [];
|
|
96
96
|
pickupZones.forEach((pickupZone) => {
|
|
97
97
|
let pickupLength = pickupZone.indexOf(": ");
|
|
@@ -590,4 +590,10 @@ export function hasCustomPricing(pricing, bookingType) {
|
|
|
590
590
|
|
|
591
591
|
export function truncate(str, num) {
|
|
592
592
|
return str.length > num ? str.slice(0, num - 1) : str;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
export function isJSON(text) {
|
|
596
|
+
return /^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@').
|
|
597
|
+
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
|
|
598
|
+
replace(/(?:^|:|,)(?:\s*\[)+/g, ''));
|
|
593
599
|
}
|