Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. const input = `Balsam Bay Hideaway http://www.kawarthacottagevacations.ca/property/balsam-bay-hideaway/ Entire Home 8 23 Treewood Lane, Kirkfield, ON K0M 2B0 Cozy 4 bedroom cottage on the stunning shores of Balsam Lake. Public water access directly in front of the house gives all the perks of lakefront, for less of the cost. Regardless of season, this cottage is a great vacation getaway. Enjoy the dog days of summer or chilly winter landscapes, endless activities to be enjoyed in all weather. Cottage 4 bedrooms 5 beds queen, double, double; 1 twin + 1 twin loft bed 1 bathroom ESSENTIALS NOT INCLUDED WiFi, Apple TV With Access To Netflix, Gas Fireplace, Fire Pit, Child/Elderly Friendly, Pet Friendly No 7 "
  2. June 30 to Sept 4 2017" SS 60 2 Canadian 500 See website "Cleaning services, if requested: $100
  3.  
  4. " "Based on 8 people. $105/extra person. Max 12 people.Linen service (if requested): King/Queen/Double $25.00, Single $15.00, Towels $5.00
  5. Cleaning service (if requested): $100" 4 PM Early check-ins cannot be guaranteed 10 AM. Late check outs must be arranged in advance. A feel of up to 1 night's rent will be charged for unauthorized late check out. Vail Valley Real Estate Brokers, Inc. is Agent of the Property Owner. Town of Vail tax lic# 673 `;
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13. function toNumberOnly(input) {
  14. return input.match(/\d/g).join("");
  15. }
  16.  
  17. const map = {};
  18. map[0] = '#propertyName';
  19. map[3] = '#propertyGuests';
  20. map[7] = '#propertyBedrooms';
  21. map[8] = '#propertyBeds';
  22.  
  23. const transform = {};
  24. transform[7] = toNumberOnly;
  25. transform[8] = toNumberOnly;
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. if (input !== null || input !== "") {
  37. const cols = input.split("\t");
  38. for (let colNum = 0; colNum < cols.length; colNum++) {
  39. if (map[colNum]) {
  40. let value = cols[colNum];
  41. if (transform[colNum]) {
  42. value = transform[colNum](value);
  43. }
  44. document.querySelector(map[colNum]).value = value;
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement