Skip to content

Commit

Permalink
Bugfix, better trim
Browse files Browse the repository at this point in the history
  • Loading branch information
guo-yu committed Dec 23, 2014
1 parent 6e73bb8 commit d6b646d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 0 additions & 2 deletions example/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ starwood.search({
}, function(err, hotels){
if (err)
return console.error(err);

console.log(hotels);
});
8 changes: 5 additions & 3 deletions lib/apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ exports.routes = {
if ($address.find('.spgCategory').length)
hotel.category = utils.escape($address.find('.spgCategory').text(), 'SPG 俱乐部类别');

if ($address.find('.description').length)
hotel.description = trim($address.find('.description').text());
if ($address.find('.description').length) {
if (!$address.find('.description #layerContent').length)
hotel.description = trim($address.find('.description').text());
}
}

if ($(this).find('.promoSection').length) {
Expand All @@ -88,7 +90,7 @@ exports.routes = {

// Best rate as local currency.
hotel.bestRate = $prices.find('.promos').eq(0).find('.rateAmount').length ?
trim($prices.find('.promos').eq(0).find('.rateAmount').text()) : null;
trim(utils.escape($prices.find('.promos').eq(0).find('.rateAmount').text(), 'CNY')) : null;

// Find out if cash and points could be redeemed.
hotel.redeemPoints = !!$prices.find('.promos').eq(1).find('.rateAmount').length;
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"test": "DEBUG=starwood,starwood:* node_modules/.bin/mocha tests/search.js",
"dev": "DEBUG=starwood,starwood:*,sdk,sdk:* node example/example.js"
"dev": "DEBUG=starwood,starwood:*,sdk,sdk:* node example/example.js",
"example": "npm run dev"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit d6b646d

Please sign in to comment.