@takeshape/util 9.80.3 → 9.81.0

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.
Files changed (53) hide show
  1. package/dist/arrays.js +0 -10
  2. package/dist/async-noop.js +0 -2
  3. package/dist/billing.js +8 -4
  4. package/dist/browser.js +0 -2
  5. package/dist/clone.js +0 -1
  6. package/dist/common.js +0 -50
  7. package/dist/delay.js +3 -6
  8. package/dist/draftjs-templates.js +1 -11
  9. package/dist/draftjs.js +37 -196
  10. package/dist/encryption.js +2 -11
  11. package/dist/get-image-url.js +2 -3
  12. package/dist/gzip.js +0 -4
  13. package/dist/highlight-code.js +1 -19
  14. package/dist/http.js +0 -6
  15. package/dist/index.js +0 -8
  16. package/dist/map.js +0 -1
  17. package/dist/merge.js +3 -20
  18. package/dist/mime.js +4 -12
  19. package/dist/predicate.js +0 -3
  20. package/dist/search-params.js +0 -6
  21. package/dist/set-in.js +0 -2
  22. package/dist/sets.js +0 -5
  23. package/dist/sleep.js +0 -1
  24. package/dist/sort-object.js +4 -4
  25. package/dist/strings.js +4 -21
  26. package/dist/templates.js +1 -25
  27. package/dist/timezone.js +2 -4
  28. package/dist/types.js +8 -10
  29. package/dist/unix-to-iso.js +0 -2
  30. package/dist/value.js +0 -2
  31. package/dist/visit.js +1 -15
  32. package/es/arrays.js +0 -4
  33. package/es/billing.js +10 -0
  34. package/es/delay.js +3 -4
  35. package/es/draftjs-templates.js +1 -1
  36. package/es/draftjs.js +39 -173
  37. package/es/encryption.js +2 -3
  38. package/es/get-image-url.js +2 -1
  39. package/es/highlight-code.js +0 -1
  40. package/es/http.js +0 -4
  41. package/es/index.js +2 -2
  42. package/es/merge.js +4 -8
  43. package/es/mime.js +4 -5
  44. package/es/search-params.js +0 -2
  45. package/es/set-in.js +1 -1
  46. package/es/sets.js +0 -3
  47. package/es/sort-object.js +4 -2
  48. package/es/strings.js +4 -8
  49. package/es/templates.js +0 -14
  50. package/es/timezone.js +2 -2
  51. package/es/types.js +8 -3
  52. package/es/visit.js +1 -12
  53. package/package.json +3 -3
package/dist/timezone.js CHANGED
@@ -5,16 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.guessTimeZone = guessTimeZone;
7
7
  exports.timeZoneList = void 0;
8
-
9
8
  function guessTimeZone() {
10
9
  if (Intl) {
11
10
  // eslint-disable-next-line new-cap
12
11
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
13
12
  }
14
-
15
13
  return 'UTC';
16
- } // Equivalent to `moment.tz.names()`
17
-
14
+ }
18
15
 
16
+ // Equivalent to `moment.tz.names()`
19
17
  const timeZoneList = ['Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Asmera', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Ceuta', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Dar_es_Salaam', 'Africa/Djibouti', 'Africa/Douala', 'Africa/El_Aaiun', 'Africa/Freetown', 'Africa/Gaborone', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Juba', 'Africa/Kampala', 'Africa/Khartoum', 'Africa/Kigali', 'Africa/Kinshasa', 'Africa/Lagos', 'Africa/Libreville', 'Africa/Lome', 'Africa/Luanda', 'Africa/Lubumbashi', 'Africa/Lusaka', 'Africa/Malabo', 'Africa/Maputo', 'Africa/Maseru', 'Africa/Mbabane', 'Africa/Mogadishu', 'Africa/Monrovia', 'Africa/Nairobi', 'Africa/Ndjamena', 'Africa/Niamey', 'Africa/Nouakchott', 'Africa/Ouagadougou', 'Africa/Porto-Novo', 'Africa/Sao_Tome', 'Africa/Timbuktu', 'Africa/Tripoli', 'Africa/Tunis', 'Africa/Windhoek', 'America/Adak', 'America/Anchorage', 'America/Anguilla', 'America/Antigua', 'America/Araguaina', 'America/Argentina/Buenos_Aires', 'America/Argentina/Catamarca', 'America/Argentina/ComodRivadavia', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/La_Rioja', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Salta', 'America/Argentina/San_Juan', 'America/Argentina/San_Luis', 'America/Argentina/Tucuman', 'America/Argentina/Ushuaia', 'America/Aruba', 'America/Asuncion', 'America/Atikokan', 'America/Atka', 'America/Bahia', 'America/Bahia_Banderas', 'America/Barbados', 'America/Belem', 'America/Belize', 'America/Blanc-Sablon', 'America/Boa_Vista', 'America/Bogota', 'America/Boise', 'America/Buenos_Aires', 'America/Cambridge_Bay', 'America/Campo_Grande', 'America/Cancun', 'America/Caracas', 'America/Catamarca', 'America/Cayenne', 'America/Cayman', 'America/Chicago', 'America/Chihuahua', 'America/Coral_Harbour', 'America/Cordoba', 'America/Costa_Rica', 'America/Creston', 'America/Cuiaba', 'America/Curacao', 'America/Danmarkshavn', 'America/Dawson', 'America/Dawson_Creek', 'America/Denver', 'America/Detroit', 'America/Dominica', 'America/Edmonton', 'America/Eirunepe', 'America/El_Salvador', 'America/Ensenada', 'America/Fort_Nelson', 'America/Fort_Wayne', 'America/Fortaleza', 'America/Glace_Bay', 'America/Godthab', 'America/Goose_Bay', 'America/Grand_Turk', 'America/Grenada', 'America/Guadeloupe', 'America/Guatemala', 'America/Guayaquil', 'America/Guyana', 'America/Halifax', 'America/Havana', 'America/Hermosillo', 'America/Indiana/Indianapolis', 'America/Indiana/Knox', 'America/Indiana/Marengo', 'America/Indiana/Petersburg', 'America/Indiana/Tell_City', 'America/Indiana/Vevay', 'America/Indiana/Vincennes', 'America/Indiana/Winamac', 'America/Indianapolis', 'America/Inuvik', 'America/Iqaluit', 'America/Jamaica', 'America/Jujuy', 'America/Juneau', 'America/Kentucky/Louisville', 'America/Kentucky/Monticello', 'America/Knox_IN', 'America/Kralendijk', 'America/La_Paz', 'America/Lima', 'America/Los_Angeles', 'America/Louisville', 'America/Lower_Princes', 'America/Maceio', 'America/Managua', 'America/Manaus', 'America/Marigot', 'America/Martinique', 'America/Matamoros', 'America/Mazatlan', 'America/Mendoza', 'America/Menominee', 'America/Merida', 'America/Metlakatla', 'America/Mexico_City', 'America/Miquelon', 'America/Moncton', 'America/Monterrey', 'America/Montevideo', 'America/Montreal', 'America/Montserrat', 'America/Nassau', 'America/New_York', 'America/Nipigon', 'America/Nome', 'America/Noronha', 'America/North_Dakota/Beulah', 'America/North_Dakota/Center', 'America/North_Dakota/New_Salem', 'America/Nuuk', 'America/Ojinaga', 'America/Panama', 'America/Pangnirtung', 'America/Paramaribo', 'America/Phoenix', 'America/Port-au-Prince', 'America/Port_of_Spain', 'America/Porto_Acre', 'America/Porto_Velho', 'America/Puerto_Rico', 'America/Punta_Arenas', 'America/Rainy_River', 'America/Rankin_Inlet', 'America/Recife', 'America/Regina', 'America/Resolute', 'America/Rio_Branco', 'America/Rosario', 'America/Santa_Isabel', 'America/Santarem', 'America/Santiago', 'America/Santo_Domingo', 'America/Sao_Paulo', 'America/Scoresbysund', 'America/Shiprock', 'America/Sitka', 'America/St_Barthelemy', 'America/St_Johns', 'America/St_Kitts', 'America/St_Lucia', 'America/St_Thomas', 'America/St_Vincent', 'America/Swift_Current', 'America/Tegucigalpa', 'America/Thule', 'America/Thunder_Bay', 'America/Tijuana', 'America/Toronto', 'America/Tortola', 'America/Vancouver', 'America/Virgin', 'America/Whitehorse', 'America/Winnipeg', 'America/Yakutat', 'America/Yellowknife', 'Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/DumontDUrville', 'Antarctica/Macquarie', 'Antarctica/Mawson', 'Antarctica/McMurdo', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/South_Pole', 'Antarctica/Syowa', 'Antarctica/Troll', 'Antarctica/Vostok', 'Arctic/Longyearbyen', 'Asia/Aden', 'Asia/Almaty', 'Asia/Amman', 'Asia/Anadyr', 'Asia/Aqtau', 'Asia/Aqtobe', 'Asia/Ashgabat', 'Asia/Ashkhabad', 'Asia/Atyrau', 'Asia/Baghdad', 'Asia/Bahrain', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Barnaul', 'Asia/Beirut', 'Asia/Bishkek', 'Asia/Brunei', 'Asia/Calcutta', 'Asia/Chita', 'Asia/Choibalsan', 'Asia/Chongqing', 'Asia/Chungking', 'Asia/Colombo', 'Asia/Dacca', 'Asia/Damascus', 'Asia/Dhaka', 'Asia/Dili', 'Asia/Dubai', 'Asia/Dushanbe', 'Asia/Famagusta', 'Asia/Gaza', 'Asia/Harbin', 'Asia/Hebron', 'Asia/Ho_Chi_Minh', 'Asia/Hong_Kong', 'Asia/Hovd', 'Asia/Irkutsk', 'Asia/Istanbul', 'Asia/Jakarta', 'Asia/Jayapura', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Kashgar', 'Asia/Kathmandu', 'Asia/Katmandu', 'Asia/Khandyga', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuching', 'Asia/Kuwait', 'Asia/Macao', 'Asia/Macau', 'Asia/Magadan', 'Asia/Makassar', 'Asia/Manila', 'Asia/Muscat', 'Asia/Nicosia', 'Asia/Novokuznetsk', 'Asia/Novosibirsk', 'Asia/Omsk', 'Asia/Oral', 'Asia/Phnom_Penh', 'Asia/Pontianak', 'Asia/Pyongyang', 'Asia/Qatar', 'Asia/Qostanay', 'Asia/Qyzylorda', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Saigon', 'Asia/Sakhalin', 'Asia/Samarkand', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Srednekolymsk', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tel_Aviv', 'Asia/Thimbu', 'Asia/Thimphu', 'Asia/Tokyo', 'Asia/Tomsk', 'Asia/Ujung_Pandang', 'Asia/Ulaanbaatar', 'Asia/Ulan_Bator', 'Asia/Urumqi', 'Asia/Ust-Nera', 'Asia/Vientiane', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yangon', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Bermuda', 'Atlantic/Canary', 'Atlantic/Cape_Verde', 'Atlantic/Faeroe', 'Atlantic/Faroe', 'Atlantic/Jan_Mayen', 'Atlantic/Madeira', 'Atlantic/Reykjavik', 'Atlantic/South_Georgia', 'Atlantic/St_Helena', 'Atlantic/Stanley', 'Australia/ACT', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Broken_Hill', 'Australia/Canberra', 'Australia/Currie', 'Australia/Darwin', 'Australia/Eucla', 'Australia/Hobart', 'Australia/LHI', 'Australia/Lindeman', 'Australia/Lord_Howe', 'Australia/Melbourne', 'Australia/NSW', 'Australia/North', 'Australia/Perth', 'Australia/Queensland', 'Australia/South', 'Australia/Sydney', 'Australia/Tasmania', 'Australia/Victoria', 'Australia/West', 'Australia/Yancowinna', 'Brazil/Acre', 'Brazil/DeNoronha', 'Brazil/East', 'Brazil/West', 'CET', 'CST6CDT', 'Canada/Atlantic', 'Canada/Central', 'Canada/Eastern', 'Canada/Mountain', 'Canada/Newfoundland', 'Canada/Pacific', 'Canada/Saskatchewan', 'Canada/Yukon', 'Chile/Continental', 'Chile/EasterIsland', 'Cuba', 'EET', 'EST', 'EST5EDT', 'Egypt', 'Eire', 'Etc/GMT', 'Etc/GMT+0', 'Etc/GMT+1', 'Etc/GMT+10', 'Etc/GMT+11', 'Etc/GMT+12', 'Etc/GMT+2', 'Etc/GMT+3', 'Etc/GMT+4', 'Etc/GMT+5', 'Etc/GMT+6', 'Etc/GMT+7', 'Etc/GMT+8', 'Etc/GMT+9', 'Etc/GMT-0', 'Etc/GMT-1', 'Etc/GMT-10', 'Etc/GMT-11', 'Etc/GMT-12', 'Etc/GMT-13', 'Etc/GMT-14', 'Etc/GMT-2', 'Etc/GMT-3', 'Etc/GMT-4', 'Etc/GMT-5', 'Etc/GMT-6', 'Etc/GMT-7', 'Etc/GMT-8', 'Etc/GMT-9', 'Etc/GMT0', 'Etc/Greenwich', 'Etc/UCT', 'Etc/UTC', 'Etc/Universal', 'Etc/Zulu', 'Europe/Amsterdam', 'Europe/Andorra', 'Europe/Astrakhan', 'Europe/Athens', 'Europe/Belfast', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Busingen', 'Europe/Chisinau', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Gibraltar', 'Europe/Guernsey', 'Europe/Helsinki', 'Europe/Isle_of_Man', 'Europe/Istanbul', 'Europe/Jersey', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Kirov', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/Luxembourg', 'Europe/Madrid', 'Europe/Malta', 'Europe/Mariehamn', 'Europe/Minsk', 'Europe/Monaco', 'Europe/Moscow', 'Europe/Nicosia', 'Europe/Oslo', 'Europe/Paris', 'Europe/Podgorica', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/San_Marino', 'Europe/Sarajevo', 'Europe/Saratov', 'Europe/Simferopol', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Tirane', 'Europe/Tiraspol', 'Europe/Ulyanovsk', 'Europe/Uzhgorod', 'Europe/Vaduz', 'Europe/Vatican', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Europe/Zaporozhye', 'Europe/Zurich', 'GB', 'GB-Eire', 'GMT', 'GMT+0', 'GMT-0', 'GMT0', 'Greenwich', 'HST', 'Hongkong', 'Iceland', 'Indian/Antananarivo', 'Indian/Chagos', 'Indian/Christmas', 'Indian/Cocos', 'Indian/Comoro', 'Indian/Kerguelen', 'Indian/Mahe', 'Indian/Maldives', 'Indian/Mauritius', 'Indian/Mayotte', 'Indian/Reunion', 'Iran', 'Israel', 'Jamaica', 'Japan', 'Kwajalein', 'Libya', 'MET', 'MST', 'MST7MDT', 'Mexico/BajaNorte', 'Mexico/BajaSur', 'Mexico/General', 'NZ', 'NZ-CHAT', 'Navajo', 'PRC', 'PST8PDT', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Bougainville', 'Pacific/Chatham', 'Pacific/Chuuk', 'Pacific/Easter', 'Pacific/Efate', 'Pacific/Enderbury', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Funafuti', 'Pacific/Galapagos', 'Pacific/Gambier', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Johnston', 'Pacific/Kiritimati', 'Pacific/Kosrae', 'Pacific/Kwajalein', 'Pacific/Majuro', 'Pacific/Marquesas', 'Pacific/Midway', 'Pacific/Nauru', 'Pacific/Niue', 'Pacific/Norfolk', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Palau', 'Pacific/Pitcairn', 'Pacific/Pohnpei', 'Pacific/Ponape', 'Pacific/Port_Moresby', 'Pacific/Rarotonga', 'Pacific/Saipan', 'Pacific/Samoa', 'Pacific/Tahiti', 'Pacific/Tarawa', 'Pacific/Tongatapu', 'Pacific/Truk', 'Pacific/Wake', 'Pacific/Wallis', 'Pacific/Yap', 'Poland', 'Portugal', 'ROC', 'ROK', 'Singapore', 'Turkey', 'UCT', 'US/Alaska', 'US/Aleutian', 'US/Arizona', 'US/Central', 'US/East-Indiana', 'US/Eastern', 'US/Hawaii', 'US/Indiana-Starke', 'US/Michigan', 'US/Mountain', 'US/Pacific', 'US/Samoa', 'UTC', 'Universal', 'W-SU', 'WET', 'Zulu'];
20
18
  exports.timeZoneList = timeZoneList;
package/dist/types.js CHANGED
@@ -9,13 +9,9 @@ exports.isNumericString = isNumericString;
9
9
  exports.isPrimitive = isPrimitive;
10
10
  exports.isRecord = isRecord;
11
11
  exports.isScalar = isScalar;
12
-
13
12
  var _isNull = _interopRequireDefault(require("lodash/isNull"));
14
-
15
13
  var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
16
-
17
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
-
19
15
  /**
20
16
  * A guard for objects that ensures they are plain objects, and thus, can
21
17
  * reasonably be typed as a Record.
@@ -24,6 +20,13 @@ function isRecord(maybeRecord) {
24
20
  return (0, _isPlainObject.default)(maybeRecord);
25
21
  }
26
22
 
23
+ // https://stackoverflow.com/questions/50573891/maybe-a-type-in-typescript
24
+
25
+ /**
26
+ * Type util migrated from schema package. Not currently used, but certain to
27
+ * be useful.
28
+ */
29
+
27
30
  /**
28
31
  * Create enum matchers, which will return the enum entry from the provided
29
32
  * enum when the value matches.
@@ -31,27 +34,22 @@ function isRecord(maybeRecord) {
31
34
  function createEnumMatcher(enumVariable) {
32
35
  return testValue => Object.entries(enumVariable).find(([, enumValue]) => enumValue === testValue);
33
36
  }
34
-
35
37
  function isPrimitive(maybePrimitive) {
36
38
  return typeof maybePrimitive === 'string' || typeof maybePrimitive === 'number' || typeof maybePrimitive === 'boolean' || typeof maybePrimitive === 'symbol' || typeof maybePrimitive === 'undefined' || typeof maybePrimitive === 'bigint' || (0, _isNull.default)(maybePrimitive);
37
39
  }
38
-
39
40
  function isScalar(maybeScalar) {
40
41
  return typeof maybeScalar === 'string' || typeof maybeScalar === 'number' || typeof maybeScalar === 'boolean' || typeof maybeScalar === 'bigint';
41
42
  }
42
-
43
43
  function getSingle(t) {
44
44
  if (Array.isArray(t)) {
45
45
  return t[0];
46
46
  }
47
-
48
47
  return t;
49
48
  }
49
+
50
50
  /**
51
51
  * Test whether a provided string is numeric, e.g., '9' is numeric while 'nine' is not.
52
52
  */
53
-
54
-
55
53
  function isNumericString(key) {
56
54
  return !isNaN(Number(key));
57
55
  }
@@ -5,11 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.unixToISO = unixToISO;
7
7
  exports.unixToISODateOnly = unixToISODateOnly;
8
-
9
8
  function unixToISO(unix) {
10
9
  return new Date(unix * 1000).toISOString();
11
10
  }
12
-
13
11
  function unixToISODateOnly(unix) {
14
12
  return unixToISO(unix).slice(0, 10);
15
13
  }
package/dist/value.js CHANGED
@@ -5,10 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  exports.value = value;
8
-
9
8
  function value(x) {
10
9
  return () => x;
11
10
  }
12
-
13
11
  var _default = value;
14
12
  exports.default = _default;
package/dist/visit.js CHANGED
@@ -5,11 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.visit = visit;
7
7
  exports.visitJsonPath = visitJsonPath;
8
-
9
8
  var _isObject = _interopRequireDefault(require("lodash/isObject"));
10
-
11
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
13
10
  /**
14
11
  * Walk a tree, calling the callback for any property name matching a value in the keys array.
15
12
  */
@@ -19,57 +16,46 @@ function visit(tree, keys, callback) {
19
16
  if (keys.includes(key)) {
20
17
  callback(value, [...path, key]);
21
18
  }
22
-
23
19
  if ((0, _isObject.default)(value)) {
24
20
  traverse(value, [...path, key]);
25
21
  }
26
22
  }
27
23
  };
28
-
29
24
  traverse(tree, []);
30
25
  }
26
+
31
27
  /**
32
28
  * Walk a tree with JSONPath, calling the callback for matching properties.
33
29
  * Normalizes the resulting path
34
30
  */
35
-
36
-
37
31
  function visitJsonPath(tree, jsonPaths, callback) {
38
32
  const paths = jsonPaths.map(p => p.split('.').slice());
39
-
40
33
  const testPaths = propPath => {
41
34
  return paths.findIndex(testPath => {
42
35
  const isFromRoot = testPath[0] === '$';
43
36
  const tPath = isFromRoot ? testPath.slice(1) : testPath.slice().reverse();
44
37
  const pPath = isFromRoot ? propPath.slice() : propPath.slice().reverse();
45
38
  let isMatchingPath = isFromRoot ? tPath.length === pPath.length : tPath.length <= pPath.length;
46
-
47
39
  for (const [pI, pP] of pPath.entries()) {
48
40
  if (tPath[pI] === undefined || !isMatchingPath) {
49
41
  break;
50
42
  }
51
-
52
43
  isMatchingPath = pP === tPath[pI] || tPath[pI] === '*';
53
44
  }
54
-
55
45
  return isMatchingPath;
56
46
  });
57
47
  };
58
-
59
48
  const traverse = (obj, path) => {
60
49
  for (const [prop, value] of Object.entries(obj)) {
61
50
  const propPath = [...path, prop];
62
51
  const foundIndex = testPaths(propPath);
63
-
64
52
  if (foundIndex > -1) {
65
53
  callback(value, propPath, foundIndex);
66
54
  }
67
-
68
55
  if ((0, _isObject.default)(value)) {
69
56
  traverse(value, propPath);
70
57
  }
71
58
  }
72
59
  };
73
-
74
60
  traverse(tree, []);
75
61
  }
package/es/arrays.js CHANGED
@@ -5,11 +5,9 @@ export function setIsEqual(a, b) {
5
5
  if (a.length !== b.length) {
6
6
  return false;
7
7
  }
8
-
9
8
  if (a.length === 0) {
10
9
  return true;
11
10
  }
12
-
13
11
  const refSet = new Set(a);
14
12
  return b.every(value => refSet.has(value));
15
13
  }
@@ -17,13 +15,11 @@ export function arrayStartsWith(a, b) {
17
15
  if (a.length < b.length) {
18
16
  return false;
19
17
  }
20
-
21
18
  for (let i = 0; i < b.length; i++) {
22
19
  if (a[i] !== b[i]) {
23
20
  return false;
24
21
  }
25
22
  }
26
-
27
23
  return true;
28
24
  }
29
25
  export function isDefined(x) {
package/es/billing.js CHANGED
@@ -1,4 +1,14 @@
1
1
  import invariant from 'tiny-invariant';
2
+
3
+ // Mirrors StripeAddressElementChangeEvent["value"] from @stripe/stripe-js
4
+
5
+ /**
6
+ * Stripe is replacing plans with prices. The Stripe API still returns a plan property on subscriptions
7
+ * but it has already been removed from the types. This interface should only be used in the specific places
8
+ * where we use plans so they can be easily found and migrated in the future.
9
+ * More info https://stripe.com/docs/billing/migration/migrating-prices
10
+ */
11
+
2
12
  export function isStripeProductObject(product) {
3
13
  return Boolean(product && typeof product !== 'string' && product.object === 'product' && !product.deleted);
4
14
  }
package/es/delay.js CHANGED
@@ -1,15 +1,14 @@
1
1
  export const delay = async (timeout, value) => new Promise(resolve => {
2
2
  setTimeout(resolve, timeout, value);
3
3
  });
4
-
5
4
  function randomInt(minimum, maximum) {
6
5
  // eslint-disable-next-line security-node/detect-insecure-randomness
7
6
  const co = Math.random() * (maximum - minimum + 1);
8
7
  return Math.floor(co + minimum);
9
- } // Decorrelated jitter backoff:
10
- // https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
11
-
8
+ }
12
9
 
10
+ // Decorrelated jitter backoff:
11
+ // https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
13
12
  export async function backoff(baseDelay, maxDelay, attempt = {
14
13
  num: 1,
15
14
  lastDelay: 0
@@ -1,9 +1,9 @@
1
1
  /* eslint-disable camelcase */
2
-
3
2
  /*
4
3
  * The intention is to move all this to the client package in the end, but right now it's here
5
4
  * to be shared between the draftjs / mdx implementations, which span the client / server differently.
6
5
  */
6
+
7
7
  import shortid from 'shortid';
8
8
  export const getDraftjsImage = params => {
9
9
  const {