react-easy-format
v2.0.4
Published
Made with create-react-library
Downloads
4
Readme
react-easy-format
Made with create-react-library
Usually we format a string requires a fairly long javascript function. For example, in formatting currency, we search for it on google and then paste the code in our project. With this library, work will be shorter and more efficient.
Install
npm install --save react-easy-format
or
yarn add react-easy-format
Usage
import { Currency, DateFormat, Word } from 'react-easy-format'
import 'react-easy-format/dist/index.css'
class Example extends Component {
render() {
<>
<Currency value={1000} format="IDR"> // result IDR 1,000
<Currency value={1000000} format="Rp" separator="." /> // result Rp 1.000.000
<DateFormat value="1997-08-08" format="D, d F Y" /> // result Sabtu, 08 Agustus 1997
<DateFormat value="1997-08-08 12:00:00" format="D, d m Y H:i:s" /> // result Sabtu, 08 08 1997 12:00:00
<Word value="Agun Buhori Ganteng" format="slug" /> // result agun-buhori-ganteng
<Word value="Agun Buhori Ganteng" format="camel" /> // result agunBuhoriGanteng
<Word value="agun buhori ganteng" format="title" /> // result Agun Buhori Ganteng
</>
}
}
License
MIT © agunbuhori