Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Filter by Rating */
- const filterRating = function(value) {
- return hotel.filter(function(e) {
- return e.starRating == value;
- });
- }
- /** Filter by Price Range */
- const filterPriceRange = function(min, max) {
- return hotel.filter(function(e) {
- return e[0].totalPrice >= min && e[0].totalPrice <= max;
- });
- }
- /** Filter by Facilities */
- const filterFacilities = function(arr) {
- return hotel.filter(function(e) {
- return arr.indexOf(e) > -1;
- });
- }
- /** Actice Filter Rating */
- function setRatingFilter() {
- var hotelFilter = JSON.stringify(filterRating(2));
- setItem('hotel_filter', hotelFilter)
- }
- /** Active Filter Price Range */
- function setPriceFIlter() {
- var hotelFilter = JSON.stringify(filterPriceRange(2000, 500000));
- setItem('hotel_filter', hotelFilter)
- }
- /** Actice Filter Facilities */
- function setFacilitiesFIlter() {
- var facilities = ['wifi', 'bath', 'bbaf'];
- var hotelFilter = JSON.stringify(filterFacilities(facilities));
- setItem('hotel_filter', hotelFilter)
- }
- /** Get Item */
- function getItem(item) {
- return localStorage.getItem(item);
- }
- /** Set Item */
- function setItem(name, item) {
- return localStorage.setItem(name, item);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement