Skip to content

Commit

Permalink
Prepare release 0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jsor committed Jan 8, 2016
1 parent e74bd09 commit 5e83d78
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 11 deletions.
37 changes: 29 additions & 8 deletions dist/carty.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Carty - v0.5.1 - 2016-01-07
* Carty - v0.6.0 - 2016-01-08
* http://sorgalla.com/carty/
* Copyright (c) 2015-2016 Jan Sorgalla; Licensed MIT
*/
Expand Down Expand Up @@ -438,8 +438,14 @@ return /******/ (function(modules) { // webpackBootstrap
function checkout(data) {
return emit('checkout').then(function() {
return resolve(
_options.storage && _options.storage.checkout && _options.storage.checkout(data, cart)
).then(emit.bind(cart, 'checkedout'), function(e) {
_options.storage && _options.storage.checkout(data, cart)
)
.then(function(value) {
_items.length = 0;

return value;
})
.then(emit.bind(cart, 'checkedout'), function(e) {
emit('checkoutfailed', e);
return reject(e);
})['catch'](function() {
Expand Down Expand Up @@ -502,15 +508,27 @@ return /******/ (function(modules) { // webpackBootstrap
return false;
}

if (otherItem.id !== _attributes.id) {
function compareValue(value1, value2) {
if ('number' === type(value1)) {
value1 = '' + value1;
}

if ('number' === type(value2)) {
value2 = '' + value2;
}

return value1 === value2;
}

if (!compareValue(otherItem.id, _attributes.id)) {
return false;
}

var itemVariant = variant();
var otherVariant = otherItem.variant;

function compare(key) {
return otherVariant[key] === itemVariant[key];
return compareValue(otherVariant[key], itemVariant[key]);
}

return Object.keys(itemVariant).every(compare) && Object.keys(otherVariant).every(compare);
Expand Down Expand Up @@ -1100,6 +1118,10 @@ return /******/ (function(modules) { // webpackBootstrap
localStorage.setItem(namespace, JSON.stringify(cart().items));
}

function empty() {
localStorage.removeItem(namespace);
}

return {
load: function() {
try {
Expand All @@ -1110,9 +1132,8 @@ return /******/ (function(modules) { // webpackBootstrap
},
put: save,
remove: save,
clear: function() {
localStorage.removeItem(namespace);
}
clear: empty,
checkout: empty
};
}

Expand Down
Loading

0 comments on commit 5e83d78

Please sign in to comment.