import { CurrencyUtils, CommonUtils, StorageUtils, GeoLocationUtils, URLUtils, History, DateUtils } from 'utileo';
//---------------------------------- Currency Utils -------------------------//
CurrencyUtils.format('10000') // 10,000
CurrencyUtils.format('10000.1234',true) // 10,000.12
CurrencyUtils.parse('1,00,000') // 100000
//---------------------------------- Common Utils -------------------------------------//
CommonUtils.validateName('only alphabets')// true
CommonUtils.validateOnlyNumber('1233')// true
CommonUtils.titleCase('main menu')// Main Menu
CommonUtils.camelize('main-menu')// mainMenu
CommonUtils.toNumber('1234')// 1234
CommonUtils.isArray([1,2,3]);// true
CommonUtils.isObject({"name": "abc", "age": 12})// true
CommonUtils.isFunction(CommonUtils.isObject);// true
var users = [
{'user': 'barney', 'age': 36, 'active': false},
{'user': 'fred', 'age': 40, 'active': true},
{'user': 'pebbles', 'age': 1, 'active': false}
];
var groups = CommonUtils.partition(users, function (user) {
return user.active;
});
// groups[0] has [{'user':'fred', 'age': 40, 'active': true}]
// groups[1] has [{'user':'barney', 'age': 36, 'active': false}, {'user': 'pebbles', 'age': 1, 'active': false}]
CommonUtils.getIndex(users,{'user': 'barney', 'age': 36, 'active': false});// 0
CommonUtils.addKeyToObject(users);// key(type) will be added
// [{type: "0", user: "barney", age: 36, active: false}
// {type: "1", user: "fred", age: 40, active: true}
// {type: "2", user: "pebbles", age: 1, active: false}]
//------------------------ Storage Utils -----------------------------//
StorageUtils.get('phoneNumber')// 9899224433
StorageUtils.set('phoneNumber',9899224433)
StorageUtils.has('phoneNumber')// true
StorageUtils.remove('token')
StorageUtils.removeAll()
//----------------------- Geo Location ----------------------------//
let latLong = GeoLocationUtils.getLatLong()// value of lat long
let latitude = latLong.lat
let longitude = latLong.long
//--------------------------------- URL Parameter ---------------------------------------//
var appVisa = URLUtils.getURLParameter(window.location.href, 'visa')// 12n23be3h3bhbbh34
//--------- History --------//
History.replace("/")
History.goBack()
History.push("/")
//------------------------------------------ Date Utils ------------------------------------------------//
const currDate = DateUtils.getCurrentDate();// Wed Jul 14 2020 13:07:57 GMT+0530 (India Standard Time)
const dateObj = DateUtils.formatDate(currDate);// {day: 14, month: 6, year: 2020}
DateUtils.getDateByDashFormat(currDate);// 14-07-2020
DateUtils.getDateBySlashFormat(currDate);// 14/07/2020
DateUtils.timestampToDate(1560211200000);// Tue Jun 11 2019 05:30:00 GMT+0530 (India Standard Time)
DateUtils.getDateFromString('2/10/2017');// Sat Feb 10 2017 00:00:00 GMT+0530 (India Standard Time)