Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Expensify/expensify-common into roc…
Browse files Browse the repository at this point in the history
…io-WS
  • Loading branch information
pecanoro committed Jun 25, 2024
2 parents c0e6492 + 7970902 commit ddffe74
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/Cookie.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function enabled() {
const cookieName = `cookieTest_${Math.floor(Math.random() * 1000)}`;
const cookieValue = 'enabled';
set(cookieName, cookieValue, 1);
const result = Boolean(document.cookie.indexOf(cookieName) >= 0) || false;
const result = document.cookie.indexOf(cookieName) >= 0 || false;
if (result) {
remove(cookieName);
}
Expand Down
9 changes: 4 additions & 5 deletions lib/components/form/element/combobox.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ class Combobox extends React.Component {

const formatOption = (option) => ({
focused: false,
isSelected: option.selected && (isEqual(option.value, currentValue) || Boolean(alreadySelected.find((item) => item.value === option.value))),
isSelected: option.selected && (isEqual(option.value, currentValue) || !!alreadySelected.find((item) => item.value === option.value)),
...option,
});

Expand Down Expand Up @@ -551,7 +551,7 @@ class Combobox extends React.Component {
const deselectOption = (initialOption) => {
const option = initialOption;
const isSelected = isEqual(option.value, val);
option.isSelected = isSelected || Boolean(this.props.alreadySelectedOptions.find((optionItem) => optionItem.value === option.value));
option.isSelected = isSelected || !!this.props.alreadySelectedOptions.find((optionItem) => optionItem.value === option.value);

return option;
};
Expand Down Expand Up @@ -655,7 +655,7 @@ class Combobox extends React.Component {
}
const state = this.getStartState(noDefaultValue, this.options, newAlreadySelectedOptions);
const handleDropdownStateChange = () => {
this.props.onDropdownStateChange(Boolean(state.isDropdownOpen));
this.props.onDropdownStateChange(!!state.isDropdownOpen);
};
this.setState(state, handleDropdownStateChange);
}
Expand Down Expand Up @@ -859,8 +859,7 @@ class Combobox extends React.Component {
const formatOption = (option) => ({
focused: false,
isSelected:
isEqual(option.value ? option.value.toUpperCase : '', value.toUpperCase()) ||
Boolean(this.props.alreadySelectedOptions.find((optionItem) => optionItem.value === option.value)),
isEqual(option.value ? option.value.toUpperCase : '', value.toUpperCase()) || !!this.props.alreadySelectedOptions.find((optionItem) => optionItem.value === option.value),
...option,
});

Expand Down
10 changes: 5 additions & 5 deletions lib/str.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ const Str = {
* @returns True if the string is a domain name
*/
isValidDomainName(str: string): boolean {
return Boolean(String(str).match(Constants.CONST.REG_EXP.DOMAIN));
return !!String(str).match(Constants.CONST.REG_EXP.DOMAIN);
},

/**
Expand All @@ -359,7 +359,7 @@ const Str = {
* @returns True if the string is a valid hyperlink
*/
isValidURL(str: string): boolean {
return Boolean(String(str).match(Constants.CONST.REG_EXP.HYPERLINK));
return !!String(str).match(Constants.CONST.REG_EXP.HYPERLINK);
},

/**
Expand All @@ -371,7 +371,7 @@ const Str = {
* @returns True if the string is an email
*/
isValidEmail(str: string): boolean {
return Boolean(String(str).match(Constants.CONST.REG_EXP.EMAIL));
return !!String(str).match(Constants.CONST.REG_EXP.EMAIL);
},

/**
Expand All @@ -382,7 +382,7 @@ const Str = {
* @returns True if the string is an valid email created by comment markdown.
*/
isValidEmailMarkdown(str: string): boolean {
return Boolean(String(str).match(`^${Constants.CONST.REG_EXP.MARKDOWN_EMAIL}$`));
return !!String(str).match(`^${Constants.CONST.REG_EXP.MARKDOWN_EMAIL}$`);
},

/**
Expand Down Expand Up @@ -818,7 +818,7 @@ const Str = {
if (this.isString(value)) {
return value.toLowerCase() === 'true';
}
return Boolean(value);
return !!value;
},

/**
Expand Down
13 changes: 7 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expensify-common",
"version": "2.0.25",
"version": "2.0.26",
"author": "Expensify, Inc.",
"description": "Expensify libraries and components shared across different repos",
"homepage": "https://expensify.com",
Expand Down Expand Up @@ -56,7 +56,7 @@
"babel-jest": "^29.0.0",
"babelify": "10.0.0",
"eslint": "^8.57.0",
"eslint-config-expensify": "^2.0.48",
"eslint-config-expensify": "^2.0.50",
"eslint-config-prettier": "^8.10.0",
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-prettier": "^5.1.3",
Expand Down

0 comments on commit ddffe74

Please sign in to comment.