expensify-common 2.0.25 → 2.0.26

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/Cookie.js CHANGED
@@ -67,7 +67,7 @@ function enabled() {
67
67
  const cookieName = `cookieTest_${Math.floor(Math.random() * 1000)}`;
68
68
  const cookieValue = 'enabled';
69
69
  set(cookieName, cookieValue, 1);
70
- const result = Boolean(document.cookie.indexOf(cookieName) >= 0) || false;
70
+ const result = document.cookie.indexOf(cookieName) >= 0 || false;
71
71
  if (result) {
72
72
  remove(cookieName);
73
73
  }
@@ -417,7 +417,7 @@ class Combobox extends react_1.default.Component {
417
417
  const dividerIndex = this.options.findIndex(findDivider);
418
418
  // Split into two arrays everything before and after the divider (if the divider does not exist then we'll return a single array)
419
419
  const splitOptions = dividerIndex ? [this.options.slice(0, dividerIndex + 1), this.options.slice(dividerIndex + 1)] : [this.options];
420
- const formatOption = (option) => (Object.assign({ focused: false, isSelected: option.selected && ((0, lodash_1.isEqual)(option.value, currentValue) || Boolean(alreadySelected.find((item) => item.value === option.value))) }, option));
420
+ const formatOption = (option) => (Object.assign({ focused: false, isSelected: option.selected && ((0, lodash_1.isEqual)(option.value, currentValue) || !!alreadySelected.find((item) => item.value === option.value)) }, option));
421
421
  const sortByOption = (o) => {
422
422
  // Unselectable text-only entries (isFake: true) go to the bottom and selected entries go to the top only if alwaysShowSelectedOnTop was passed
423
423
  if (o.showLast) {
@@ -472,7 +472,7 @@ class Combobox extends react_1.default.Component {
472
472
  const deselectOption = (initialOption) => {
473
473
  const option = initialOption;
474
474
  const isSelected = (0, lodash_1.isEqual)(option.value, val);
475
- option.isSelected = isSelected || Boolean(this.props.alreadySelectedOptions.find((optionItem) => optionItem.value === option.value));
475
+ option.isSelected = isSelected || !!this.props.alreadySelectedOptions.find((optionItem) => optionItem.value === option.value);
476
476
  return option;
477
477
  };
478
478
  const deselectOptions = (options) => options.map(deselectOption);
@@ -562,7 +562,7 @@ class Combobox extends react_1.default.Component {
562
562
  }
563
563
  const state = this.getStartState(noDefaultValue, this.options, newAlreadySelectedOptions);
564
564
  const handleDropdownStateChange = () => {
565
- this.props.onDropdownStateChange(Boolean(state.isDropdownOpen));
565
+ this.props.onDropdownStateChange(!!state.isDropdownOpen);
566
566
  };
567
567
  this.setState(state, handleDropdownStateChange);
568
568
  }
@@ -739,8 +739,7 @@ class Combobox extends react_1.default.Component {
739
739
  }
740
740
  }
741
741
  matches = Array.from(matches);
742
- const formatOption = (option) => (Object.assign({ focused: false, isSelected: (0, lodash_1.isEqual)(option.value ? option.value.toUpperCase : '', value.toUpperCase()) ||
743
- Boolean(this.props.alreadySelectedOptions.find((optionItem) => optionItem.value === option.value)) }, option));
742
+ const formatOption = (option) => (Object.assign({ focused: false, isSelected: (0, lodash_1.isEqual)(option.value ? option.value.toUpperCase : '', value.toUpperCase()) || !!this.props.alreadySelectedOptions.find((optionItem) => optionItem.value === option.value) }, option));
744
743
  const options = matches.map(formatOption);
745
744
  // Focus the first option if there is one and show a message dependent on what options are present
746
745
  if (options.length) {
package/dist/str.js CHANGED
@@ -333,7 +333,7 @@ const Str = {
333
333
  * @returns True if the string is a domain name
334
334
  */
335
335
  isValidDomainName(str) {
336
- return Boolean(String(str).match(Constants.CONST.REG_EXP.DOMAIN));
336
+ return !!String(str).match(Constants.CONST.REG_EXP.DOMAIN);
337
337
  },
338
338
  /**
339
339
  * Checks that the string is a valid url
@@ -341,7 +341,7 @@ const Str = {
341
341
  * @returns True if the string is a valid hyperlink
342
342
  */
343
343
  isValidURL(str) {
344
- return Boolean(String(str).match(Constants.CONST.REG_EXP.HYPERLINK));
344
+ return !!String(str).match(Constants.CONST.REG_EXP.HYPERLINK);
345
345
  },
346
346
  /**
347
347
  * Checks that the string is an email address.
@@ -352,7 +352,7 @@ const Str = {
352
352
  * @returns True if the string is an email
353
353
  */
354
354
  isValidEmail(str) {
355
- return Boolean(String(str).match(Constants.CONST.REG_EXP.EMAIL));
355
+ return !!String(str).match(Constants.CONST.REG_EXP.EMAIL);
356
356
  },
357
357
  /**
358
358
  * Checks if the string is an valid email address formed during comment markdown formation.
@@ -362,7 +362,7 @@ const Str = {
362
362
  * @returns True if the string is an valid email created by comment markdown.
363
363
  */
364
364
  isValidEmailMarkdown(str) {
365
- return Boolean(String(str).match(`^${Constants.CONST.REG_EXP.MARKDOWN_EMAIL}$`));
365
+ return !!String(str).match(`^${Constants.CONST.REG_EXP.MARKDOWN_EMAIL}$`);
366
366
  },
367
367
  /**
368
368
  * Remove trailing comma from a string.
@@ -752,7 +752,7 @@ const Str = {
752
752
  if (this.isString(value)) {
753
753
  return value.toLowerCase() === 'true';
754
754
  }
755
- return Boolean(value);
755
+ return !!value;
756
756
  },
757
757
  /**
758
758
  * Checks if a string could be the masked version of another one.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expensify-common",
3
- "version": "2.0.25",
3
+ "version": "2.0.26",
4
4
  "author": "Expensify, Inc.",
5
5
  "description": "Expensify libraries and components shared across different repos",
6
6
  "homepage": "https://expensify.com",
@@ -56,7 +56,7 @@
56
56
  "babel-jest": "^29.0.0",
57
57
  "babelify": "10.0.0",
58
58
  "eslint": "^8.57.0",
59
- "eslint-config-expensify": "^2.0.48",
59
+ "eslint-config-expensify": "^2.0.50",
60
60
  "eslint-config-prettier": "^8.10.0",
61
61
  "eslint-plugin-jest": "^28.6.0",
62
62
  "eslint-plugin-prettier": "^5.1.3",