Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
formatPrice( price ) {
const priceObject = getCurrencyObject( price, this.props.currencyCode );
if ( price.toFixed( 5 ).split( '.' )[ 1 ] !== '00000' ) {
return `${ priceObject.symbol }${ priceObject.integer }${ priceObject.fraction }`;
}
return `${ priceObject.symbol }${ priceObject.integer }`;
}
renderPrice() {
if ( this.props.price === null ) {
return null;
}
const priceObject = getCurrencyObject( this.props.price, this.props.currencyCode );
let price = `${ priceObject.symbol }${ priceObject.integer }`;
if ( this.props.price.toFixed( 5 ).split( '.' )[ 1 ] !== '00000' ) {
price += priceObject.fraction;
}
return price;
}
}
formatPrice( price ) {
const priceObject = getCurrencyObject( price, this.props.currencyCode );
if ( price.toFixed( 5 ).split( '.' )[ 1 ] !== '00000' ) {
return `${ priceObject.symbol }${ priceObject.integer }${ priceObject.fraction }`;
}
return `${ priceObject.symbol }${ priceObject.integer }`;
}
renderPrice() {
if ( this.props.price === null ) {
return null;
}
const priceObject = getCurrencyObject( this.props.price, this.props.currencyCode );
let price = `${ priceObject.symbol }${ priceObject.integer }`;
if ( this.props.price.toFixed( 5 ).split( '.' )[ 1 ] !== '00000' ) {
price += priceObject.fraction;
}
return price;
}
}
getDiscountPriceObject() {
const { currencyCode, discountPrice, originalPrice } = this.props;
return getCurrencyObject( originalPrice - discountPrice, currencyCode );
}
render() {
const {
currency,
currencySetting,
initialValue,
siteId,
translate,
value,
...props
} = this.props;
const displayCurrency = ! currency && currencySetting ? currencySetting.value : currency;
const currencyObject = getCurrencyObject( value, displayCurrency );
let resetButton;
if ( initialValue ) {
if ( initialValue === this.state.value ) {
resetButton = <span>;
} else {
resetButton = (
<button aria-label="{">
</button>
);
}</span>