Comparing version 0.1.3 to 0.2.0
@@ -20,10 +20,7 @@ 'use strict'; | ||
function filter(liveSet, cb) { | ||
var s = new _set2.default(); | ||
return new _2.default({ | ||
read: function read() { | ||
s.clear(); | ||
var ret = new _set2.default(); | ||
liveSet.values().forEach(function (value) { | ||
if (cb(value)) { | ||
s.add(value); | ||
ret.add(value); | ||
@@ -34,4 +31,4 @@ } | ||
}, | ||
listen: function listen(controller) { | ||
return liveSet.subscribe({ | ||
listen: function listen(setValues, controller) { | ||
var sub = liveSet.subscribe({ | ||
next: function next(changes) { | ||
@@ -41,8 +38,8 @@ changes.forEach(function (change) { | ||
if (cb(change.value)) { | ||
s.add(change.value); | ||
passedFilter.add(change.value); | ||
controller.add(change.value); | ||
} | ||
} else if (change.type === 'remove') { | ||
if (s.has(change.value)) { | ||
s.delete(change.value); | ||
if (passedFilter.has(change.value)) { | ||
passedFilter.delete(change.value); | ||
controller.remove(change.value); | ||
@@ -60,2 +57,18 @@ } | ||
}); | ||
var passedFilter = new _set2.default(); | ||
{ | ||
(function () { | ||
var s = new _set2.default(); | ||
liveSet.values().forEach(function (value) { | ||
if (cb(value)) { | ||
passedFilter.add(value); | ||
s.add(value); | ||
} | ||
}); | ||
setValues(s); | ||
})(); | ||
} | ||
return sub; | ||
} | ||
@@ -66,2 +79,2 @@ }); | ||
module.exports = exports['default']; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9maWx0ZXIuanMiXSwibmFtZXMiOlsiZmlsdGVyIiwibGl2ZVNldCIsImNiIiwicyIsInJlYWQiLCJjbGVhciIsInJldCIsInZhbHVlcyIsImZvckVhY2giLCJ2YWx1ZSIsImFkZCIsImxpc3RlbiIsInN1YnNjcmliZSIsIm5leHQiLCJjaGFuZ2VzIiwiY2hhbmdlIiwidHlwZSIsImNvbnRyb2xsZXIiLCJoYXMiLCJkZWxldGUiLCJyZW1vdmUiLCJlcnJvciIsImVyciIsImNvbXBsZXRlIi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gICBpZiAoY2hhbmdlLnR5cGUgPT09ICdhZGQnKSB7XG4gICAgICAgICAgICBpZiAoY2IoY2hhbmdlLnZhbHVlKSkge1xuICAgICAgICAgICAgICBzLmFkZChjaGFuZ2UudmFsdWUpO1xuICAgICAgICAgICAgICBjb250cm9sbGVyLmFkZChjaGFuZ2UudmFsdWUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSBpZiAoY2hhbmdlLnR5cGUgPT09ICdyZW1vdmUnKSB7XG4gICAgICAgICAgICBpZiAocy5oYXMoY2hhbmdlLnZhbHVlKSkge1xuICAgICAgICAgICAgICBzLmRlbGV0ZShjaGFuZ2UudmFsdWUpO1xuICAgICAgICAgICAgICBjb250cm9sbGVyLnJlbW92ZShjaGFuZ2UudmFsdWUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgICB9LFxuICAgICAgZXJyb3IoZXJyKSB7XG4gICAgICAgIGNvbnRyb2xsZXIuZXJyb3IoZXJyKTtcbiAgICAgIH0sXG4gICAgICBjb21wbGV0ZSgpIHtcbiAgICAgICAgY29udHJvbGxlci5lbmQoKTtcbiAgICAgIH1cbiAgICB9KVxuICB9KTtcbn1cbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9maWx0ZXIuanMiXSwibmFtZXMiOlsiZmlsdGVyIiwibGl2ZVNldCIsImNiIiwicmVhZCIsInJldCIsInZhbHVlcyIsImZvckVhY2giLCJ2YWx1ZSIsImFkZCIsImxpc3RlbiIsInNldFZhbHVlcyIsImNvbnRyb2xsZXIiLCJzdWIiLCJzdWJzY3JpYmUiLCJuZXh0IiwiY2hhbmdlcyIsImNoYW5nZSIsInR5cGUiLCJwYXNzZWRGaWx0ZXIiLCJoYXMiLCJkZWxldGUiLCJyZW1vdmUiLCJlcnJvciIsImVyciIsImNvbXBsZXRlIiwiZW5kIiwicyJdLCJtYXBwaW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gICAgfVxuICAgICAgfSk7XG4gICAgICByZXR1cm4gcmV0O1xuICAgIH0sXG4gICAgbGlzdGVuKHNldFZhbHVlcywgY29udHJvbGxlcikge1xuICAgICAgY29uc3Qgc3ViID0gbGl2ZVNldC5zdWJzY3JpYmUoe1xuICAgICAgICBuZXh0KGNoYW5nZXMpIHtcbiAgICAgICAgICBjaGFuZ2VzLmZvckVhY2goY2hhbmdlID0+IHtcbiAgICAgICAgICAgIGlmIChjaGFuZ2UudHlwZSA9PT0gJ2FkZCcpIHtcbiAgICAgICAgICAgICAgaWYgKGNiKGNoYW5nZS52YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICBwYXNzZWRGaWx0ZXIuYWRkKGNoYW5nZS52YWx1ZSk7XG4gICAgICAgICAgICAgICAgY29udHJvbGxlci5hZGQoY2hhbmdlLnZhbHVlKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIGlmIChjaGFuZ2UudHlwZSA9PT0gJ3JlbW92ZScpIHtcbiAgICAgICAgICAgICAgaWYgKHBhc3NlZEZpbHRlci5oYXMoY2hhbmdlLnZhbHVlKSkge1xuICAgICAgICAgICAgICAgIHBhc3NlZEZpbHRlci5kZWxldGUoY2hhbmdlLnZhbHVlKTtcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyLnJlbW92ZShjaGFuZ2UudmFsdWUpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSk7XG4gICAgICAgIH0sXG4gICAgICAgIGVycm9yKGVycikge1xuICAgICAgICAgIGNvbnRyb2xsZXIuZXJyb3IoZXJyKTtcbiAgICAgICAgfSxcbiAgICAgICAgY29tcGxldGUoKSB7XG4gICAgICAgICAgY29udHJvbGxlci5lbmQoKTtcbiAgICAgICAgfVxuICAgICAgfSk7XG5cbiAgICAgIGNvbnN0IHBhc3NlZEZpbHRlciA9IG5ldyBTZXQoKTtcbiAgICAgIHtcbiAgICAgICAgY29uc3QgcyA9IG5ldyBTZXQoKTtcbiAgICAgICAgbGl2ZVNldC52YWx1ZXMoKS5mb3JFYWNoKHZhbHVlID0+IHtcbiAgICAgICAgICBpZiAoY2IodmFsdWUpKSB7XG4gICAgICAgICAgICBwYXNzZWRGaWx0ZXIuYWRkKHZhbHVlKTtcbiAgICAgICAgICAgIHMuYWRkKHZhbHVlKTtcbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICBzZXRWYWx1ZXMocyk7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBzdWI7XG4gICAgfVxuICB9KTtcbn1cbiJdfQ== |
@@ -7,2 +7,6 @@ 'use strict'; | ||
var _map = require('babel-runtime/core-js/map'); | ||
var _map2 = _interopRequireDefault(_map); | ||
var _set = require('babel-runtime/core-js/set'); | ||
@@ -12,6 +16,2 @@ | ||
var _map = require('babel-runtime/core-js/map'); | ||
var _map2 = _interopRequireDefault(_map); | ||
exports.default = flatMap; | ||
@@ -26,10 +26,7 @@ | ||
function flatMap(liveSet, cb) { | ||
var childSets = new _map2.default(); | ||
return new _2.default({ | ||
read: function read() { | ||
childSets.clear(); | ||
var s = new _set2.default(); | ||
liveSet.values().forEach(function (value) { | ||
var childSet = cb(value); | ||
childSets.set(value, childSet); | ||
childSet.values().forEach(function (value) { | ||
@@ -41,3 +38,3 @@ s.add(value); | ||
}, | ||
listen: function listen(controller) { | ||
listen: function listen(setValues, controller) { | ||
var mainSubCompleted = false; | ||
@@ -73,4 +70,2 @@ var childSetSubs = new _map2.default(); | ||
childSets.forEach(childSetSubscribe); | ||
var mainSub = liveSet.subscribe({ | ||
@@ -111,2 +106,18 @@ next: function next(changes) { | ||
var childSets = new _map2.default(); | ||
{ | ||
(function () { | ||
var initialValues = new _set2.default(); | ||
liveSet.values().forEach(function (value) { | ||
var childSet = cb(value); | ||
childSets.set(value, childSet); | ||
childSetSubscribe(childSet, value); | ||
childSet.values().forEach(function (value) { | ||
initialValues.add(value); | ||
}); | ||
}); | ||
setValues(initialValues); | ||
})(); | ||
} | ||
return function () { | ||
@@ -124,2 +135,2 @@ mainSub.unsubscribe(); | ||
module.exports = exports['default']; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9mbGF0TWFwLmpzIl0sIm5hbWVzIjpbImZsYXRNYXAiLCJsaXZlU2V0IiwiY2IiLCJjaGlsZFNldHMiLCJyZWFkIiwiY2xlYXIiLCJzIiwidmFsdWVzIiwiZm9yRWFjaCIsImNoaWxkU2V0IiwidmFsdWUiLCJzZXQiLCJhZGQiLCJsaXN0ZW4iLCJjb250cm9sbGVyIiwibWFpblN1YkNvbXBsZXRlZCIsImNoaWxkU2V0U3VicyIsImNoaWxkU2V0U3Vic2NyaWJlIiwic3Vic2NyaWJlIiwic3RhcnQiLCJzdWIiLCJuZXh0IiwiY2hhbmdlcyIsImNoYW5nZSIsInR5cGUiLCJyZW1vdmUiLCJlcnJvciIsImVyciIsImNvbXBsZXRlIiwiZGVsZXRlIiwic2l6ZSIsImVuZCIsIm1haW5TdWIiLCJnZXQiLCJFcnJvciIsImNoaWxkU2V0U3ViIiwidW5zdWJzY3JpYmUiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7O2tCQUt3QkEsTzs7QUFIeEI7Ozs7OztBQUdlLFNBQVNBLE9BQVQsQ0FBc0JDLE9BQXRCLEVBQTJDQyxFQUEzQyxFQUFxRjtBQUNsRyxNQUFNQyxZQUFnQyxtQkFBdEM7QUFDQSxTQUFPLGVBQVk7QUFDakJDLFFBRGlCLGtCQUNWO0FBQ0xELGdCQUFVRSxLQUFWO0FBQ0EsVUFBTUMsSUFBSSxtQkFBVjtBQUNBTCxjQUFRTSxNQUFSLEdBQWlCQyxPQUFqQixDQUF5QixpQkFBUztBQUNoQyxZQUFNQyxXQUFXUCxHQUFHUSxLQUFILENBQWpCO0FBQ0FQLGtCQUFVUSxHQUFWLENBQWNELEtBQWQsRUFBcUJELFFBQXJCO0FBQ0FBLGlCQ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ZSk7XG4gICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2hhbmdlLnR5cGUgPT09ICdyZW1vdmUnKSB7XG4gICAgICAgICAgICAgICAgY29udHJvbGxlci5yZW1vdmUoY2hhbmdlLnZhbHVlKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfSxcbiAgICAgICAgICBlcnJvcihlcnIpIHtcbiAgICAgICAgICAgIGNvbnRyb2xsZXIuZXJyb3IoZXJyKTtcbiAgICAgICAgICB9LFxuICAgICAgICAgIGNvbXBsZXRlKCkge1xuICAgICAgICAgICAgY2hpbGRTZXRTdWJzLmRlbGV0ZShjaGlsZFNldCk7XG4gICAgICAgICAgICBjaGlsZFNldHMuZGVsZXRlKHZhbHVlKTtcbiAgICAgICAgICAgIGlmIChtYWluU3ViQ29tcGxldGVkICYmIGNoaWxkU2V0U3Vicy5zaXplID09PSAwKSB7XG4gICAgICAgICAgICAgIGNvbnRyb2xsZXIuZW5kKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgIH1cblxuICAgICAgY2hpbGRTZXRzLmZvckVhY2goY2hpbGRTZXRTdWJzY3JpYmUpO1xuXG4gICAgICBjb25zdCBtYWluU3ViID0gbGl2ZVNldC5zdWJzY3JpYmUoe1xuICAgICAgICBuZXh0KGNoYW5nZXMpIHtcbiAgICAgICAgICBjaGFuZ2VzLmZvckVhY2goY2hhbmdlID0+IHtcbiAgICAgICAgICAgIGlmIChjaGFuZ2UudHlwZSA9PT0gJ2FkZCcpIHtcbiAgICAgICAgICAgICAgY29uc3QgY2hpbGRTZXQgPSBjYihjaGFuZ2UudmFsdWUpO1xuICAgICAgICAgICAgICBjaGlsZFNldHMuc2V0KGNoYW5nZS52YWx1ZSwgY2hpbGRTZXQpO1xuICAgICAgICAgICAgICBjaGlsZFNldC52YWx1ZXMoKS5mb3JFYWNoKHZhbHVlID0+IHtcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyLmFkZCh2YWx1ZSk7XG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICBjaGlsZFNldFN1YnNjcmliZShjaGlsZFNldCwgY2hhbmdlLnZhbHVlKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY2hhbmdlLnR5cGUgPT09ICdyZW1vdmUnKSB7XG4gICAgICAgICAgICAgIGNvbnN0IGNoaWxkU2V0ID0gY2hpbGRTZXRzLmdldChjaGFuZ2UudmFsdWUpO1xuICAgICAgICAgICAgICBpZiAoIWNoaWxkU2V0KSB0aHJvdyBuZXcgRXJyb3IoJ3JlbW92ZWQgdmFsdWUgbm90IGluIGxpdmVzZXQnKTtcbiAgICAgICAgICAgICAgY29uc3QgY2hpbGRTZXRTdWIgPSBjaGlsZFNldFN1YnMuZ2V0KGNoaWxkU2V0KTtcbiAgICAgICAgICAgICAgaWYgKCFjaGlsZFNldFN1YikgdGhyb3cgRXJyb3IoJ2NoaWxkU2V0IHdhcyBub3Qgc3Vic2NyaWJlZCB0bycpO1xuICAgICAgICAgICAgICBjaGlsZFNldC52YWx1ZXMoKS5mb3JFYWNoKHZhbHVlID0+IHtcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyLnJlbW92ZSh2YWx1ZSk7XG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICBjaGlsZFNldFN1Yi51bnN1YnNjcmliZSgpO1xuICAgICAgICAgICAgICBjaGlsZFNldFN1YnMuZGVsZXRlKGNoaWxkU2V0KTtcbiAgICAgICAgICAgICAgY2hpbGRTZXRzLmRlbGV0ZShjaGFuZ2UudmFsdWUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pO1xuICAgICAgICB9LFxuICAgICAgICBlcnJvcihlcnIpIHtcbiAgICAgICAgICBjb250cm9sbGVyLmVycm9yKGVycik7XG4gICAgICAgIH0sXG4gICAgICAgIGNvbXBsZXRlKCkge1xuICAgICAgICAgIG1haW5TdWJDb21wbGV0ZWQgPSB0cnVl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iAgICAgIGNvbnN0IGNoaWxkU2V0U3ViczogTWFwPExpdmVTZXQ8VT4sIExpdmVTZXRTdWJzY3JpcHRpb24+ID0gbmV3IE1hcCgpO1xuXG4gICAgICBmdW5jdGlvbiBjaGlsZFNldFN1YnNjcmliZShjaGlsZFNldDogTGl2ZVNldDxVPiwgdmFsdWU6IFQpIHtcbiAgICAgICAgY2hpbGRTZXQuc3Vic2NyaWJlKHtcbiAgICAgICAgICBzdGFydChzdWIpIHtcbiAgICAgICAgICAgIGNoaWxkU2V0U3Vicy5zZXQoY2hpbGRTZXQsIHN1Yik7XG4gICAgICAgICAgfSxcbiAgICAgICAgICBuZXh0KGNoYW5nZXMpIHtcbiAgICAgICAgICAgIGNoYW5nZXMuZm9yRWFjaChjaGFuZ2UgPT4ge1xuICAgICAgICAgICAgICBpZiAoY2hhbmdlLnR5cGUgPT09ICdhZGQnKSB7XG4gICAgICAgICAgICAgICAgY29udHJvbGxlci5hZGQoY2hhbmdlLnZhbHVlKTtcbiAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaGFuZ2UudHlwZSA9PT0gJ3JlbW92ZScpIHtcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyLnJlbW92ZShjaGFuZ2UudmFsdWUpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9LFxuICAgICAgICAgIGVycm9yKGVycikge1xuICAgICAgICAgICAgY29udHJvbGxlci5lcnJvcihlcnIpO1xuICAgICAgICAgIH0sXG4gICAgICAgICAgY29tcGxldGUoKSB7XG4gICAgICAgICAgICBjaGlsZFNldFN1YnMuZGVsZXRlKGNoaWxkU2V0KTtcbiAgICAgICAgICAgIGNoaWxkU2V0cy5kZWxldGUodmFsdWUpO1xuICAgICAgICAgICAgaWYgKG1haW5TdWJDb21wbGV0ZWQgJiYgY2hpbGRTZXRTdWJzLnNpemUgPT09IDApIHtcbiAgICAgICAgICAgICAgY29udHJvbGxlci5lbmQoKTtcbiAgICAgICAgIC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KHZhbHVlID0+IHtcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyLnJlbW92ZSh2YWx1ZSk7XG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICBjaGlsZFNldFN1Yi51bnN1YnNjcmliZSgpO1xuICAgICAgICAgICAgICBjaGlsZFNldFN1YnMuZGVsZXRlKGNoaWxkU2V0KTtcbiAgICAgICAgICAgICAgY2hpbGRTZXRzLmRlbGV0ZShjaGFuZ2UudmFsdWUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pO1xuICAgICAgICB9LFxuICAgICAgICBlcnJvcihlcnIpIHtcbiAgICAgICAgICBjb250cm9sbGVyLmVycm9yKGVycik7XG4gICAgICAgIH0sXG4gICAgICAgIGNvbXBsZXRlKCkge1xuICAgICAgICAgIG1haW5TdWJDb21wbGV0ZWQgPSB0cnVlO1xuICAgICAgICAgIGlmIChjaGlsZFNldFN1YnMuc2l6ZSA9PT0gMCkge1xuICAgICAgICAgICAgY29udHJvbGxlci5lbmQoKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH0pO1xuXG4gICAgICBjb25zdCBjaGlsZFNldHM6IE1hcDxULCBMaXZlU2V0PFU+PiA9IG5ldyBNYXAoKTtcbiAgICAgIHtcbiAgICAgICAgY29uc3QgaW5pdGlhbFZhbHVlcyA9IG5ldyBTZXQoKTtcbiAgICAgICAgbGl2ZVNldC52YWx1ZXMoKS5mb3JFYWNoKHZhbHVlID0+IHtcbiAgICAgICAgICBjb25zdCBjaGlsZFNldCA9IGNiKHZhbHVlKTtcbiAgICAgICAgICBjaGlsZFNldHMuc2V0KHZhbHVlLCBjaGlsZFNldCk7XG4gICAgICAgICAgY2hpbGRTZXRTdWJzY3JpYmUoY2hpbGRTZXQsIHZhbHVlKTtcbiAgICAgICAgICBjaGlsZFNldC52YWx1ZXMoKS5mb3JFYWNoKHZhbHVlID0+IHtcbiAgICAgICAgICAgIGluaXRpYWxWYWx1ZXMuYWRkKHZhbHVlKTtcbiAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICAgIHNldFZhbHVlcyhpbml0aWFsVmFsdWVzKTtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuICgpID0+IHtcbiAgICAgICAgbWFpblN1Yi51bnN1YnNjcmliZSgpO1xuICAgICAgICBjaGlsZFNldFN1YnMuZm9yRWFjaChzdWIgPT4ge1xuICAgICAgICAgIHN1Yi51bnN1YnNjcmliZSgpO1xuICAgICAgICB9KTtcbiAgICAgICAgY2hpbGRTZXRzLmNsZWFyKCk7XG4gICAgICB9O1xuICAgIH1cbiAgfSk7XG59XG4iXX0= |
64
index.js
@@ -46,4 +46,3 @@ 'use strict'; | ||
this._read = init.read; | ||
this._listen = init.listen; | ||
this._init = init; | ||
} | ||
@@ -104,3 +103,3 @@ | ||
} else { | ||
return this._read(); | ||
return this._init.read(); | ||
} | ||
@@ -133,14 +132,2 @@ } | ||
var changeQueueLength = this._changeQueue.length; | ||
var originalNext = observer.next; | ||
if (changeQueueLength !== 0 && originalNext) { | ||
observer.next = function (changes) { | ||
observer.next = originalNext; | ||
var newChanges = changes.slice(changeQueueLength); | ||
if (newChanges.length !== 0) { | ||
originalNext.call(observer, newChanges); | ||
} | ||
}; | ||
} | ||
if (this._ended) { | ||
@@ -191,3 +178,2 @@ var _ret = function () { | ||
(function () { | ||
var values = _this2._values = _this2._read(); | ||
var controller = _this2._activeController = { | ||
@@ -199,2 +185,4 @@ // Flow doesn't support getters and setters yet | ||
, add: function add(value) { | ||
var values = _this2._values; | ||
if (!values) throw new Error('setValue must be called before controller is used'); | ||
if (!_this2._ended && !values.has(value)) { | ||
@@ -206,2 +194,4 @@ values.add(value); | ||
remove: function remove(value) { | ||
var values = _this2._values; | ||
if (!values) throw new Error('setValue must be called before controller is used'); | ||
if (!_this2._ended && values.has(value)) { | ||
@@ -227,3 +217,25 @@ values.delete(value); | ||
}; | ||
var cleanup = _this2._listen(controller); | ||
var setValuesError = function setValuesError() { | ||
throw new Error('setValues must be called once during listen'); | ||
}; | ||
var setValues = function (_setValues) { | ||
function setValues(_x) { | ||
return _setValues.apply(this, arguments); | ||
} | ||
setValues.toString = function () { | ||
return _setValues.toString(); | ||
}; | ||
return setValues; | ||
}(function (values) { | ||
setValues = setValuesError; | ||
_this2._values = values; | ||
}); | ||
var cleanup = _this2._init.listen(function (values) { | ||
return setValues(values); | ||
}, controller); | ||
if (!_this2._values) { | ||
setValuesError(); | ||
} | ||
if (cleanup != null) { | ||
@@ -245,2 +257,15 @@ if (typeof cleanup.unsubscribe === 'function') { | ||
} | ||
var changeQueueLength = this._changeQueue.length; | ||
var originalNext = observer.next; | ||
if (changeQueueLength !== 0 && originalNext) { | ||
observer.next = function (changes) { | ||
observer.next = originalNext; | ||
var newChanges = changes.slice(changeQueueLength); | ||
if (newChanges.length !== 0) { | ||
originalNext.call(observer, newChanges); | ||
} | ||
}; | ||
} | ||
return subscription; | ||
@@ -257,3 +282,4 @@ } | ||
}, | ||
listen: function listen(_controller) { | ||
listen: function listen(setValues, _controller) { | ||
setValues(set); | ||
controller = _controller; | ||
@@ -278,2 +304,2 @@ } | ||
module.exports = exports['default']; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJMaXZlU2V0IiwiaW5pdCIsIl92YWx1ZXMiLCJfYWN0aXZlQ29udHJvbGxlciIsIl9saXN0ZW5DbGVhbnVwIiwiX2VuZGVkIiwiX2VuZGVkV2l0aEVycm9yIiwiX2Vycm9yIiwiX3F1ZXVlZENhbGwiLCJfY2hhbmdlUXVldWUiLCJfb2JzZXJ2ZXJzIiwiX3JlYWQiLCJyZWFkIiwiX2xpc3RlbiIsImxpc3RlbiIsInJlY29yZCIsInB1c2giLCJjaGFuZ2VzIiwib2JzZXJ2ZXJzVG9DYWxsIiwiZW5kZWQiLCJzbGljZSIsImZvckVhY2giLCJvYnNlcnZlciIsIm5leHQiL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Z2VzLnNsaWNlKGNoYW5nZVF1ZXVlTGVuZ3RoKTtcbiAgICAgICAgaWYgKG5ld0NoYW5nZXMubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgICAgb3JpZ2luYWxOZXh0LmNhbGwob2JzZXJ2ZXIsIG5ld0NoYW5nZXMpO1xuICAgICAgICB9XG4gICAgICB9O1xuICAgIH1cblxuICAgIHJldHVybiBzdWJzY3JpcHRpb247XG4gIH1cbn1cblxuLy8gQXNzaWduIGhlcmUgYmVjYXVzZSBGbG93IGRvZXNuJ3Qgc3VwcG9ydCBjb21wdXRlZCBwcm9wZXJ0eSBrZXlzIG9uIGNsYXNzZXM6XG4vLyBodHRwczovL2dpdGh1Yi5jb20vZmFjZWJvb2svZmxvdy9pc3N1ZXMvMjI4NlxuKExpdmVTZXQ6YW55KS5wcm90b3R5cGVbJCRvYnNlcnZhYmxlXSA9IGZ1bmN0aW9uKCkge1xuICByZXR1cm4gdGhpcztcbn07XG4iXX0= |
31
map.js
@@ -7,2 +7,6 @@ 'use strict'; | ||
var _map = require('babel-runtime/core-js/map'); | ||
var _map2 = _interopRequireDefault(_map); | ||
var _set = require('babel-runtime/core-js/set'); | ||
@@ -12,6 +16,2 @@ | ||
var _map = require('babel-runtime/core-js/map'); | ||
var _map2 = _interopRequireDefault(_map); | ||
exports.default = map; | ||
@@ -26,16 +26,12 @@ | ||
function map(liveSet, cb) { | ||
var m = new _map2.default(); | ||
return new _2.default({ | ||
read: function read() { | ||
m.clear(); | ||
var s = new _set2.default(); | ||
liveSet.values().forEach(function (value) { | ||
var newValue = cb(value); | ||
m.set(value, newValue); | ||
s.add(newValue); | ||
s.add(cb(value)); | ||
}); | ||
return s; | ||
}, | ||
listen: function listen(controller) { | ||
return liveSet.subscribe({ | ||
listen: function listen(setValues, controller) { | ||
var sub = liveSet.subscribe({ | ||
next: function next(changes) { | ||
@@ -62,2 +58,13 @@ changes.forEach(function (change) { | ||
}); | ||
var m = new _map2.default(); | ||
var s = new _set2.default(); | ||
liveSet.values().forEach(function (value) { | ||
var newValue = cb(value); | ||
m.set(value, newValue); | ||
s.add(newValue); | ||
}); | ||
setValues(s); | ||
return sub; | ||
} | ||
@@ -68,2 +75,2 @@ }); | ||
module.exports = exports['default']; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9tYXAuanMiXSwibmFtZXMiOlsibWFwIiwibGl2ZVNldCIsImNiIiwibSIsInJlYWQiLCJjbGVhciIsInMiLCJ2YWx1ZXMiLCJmb3JFYWNoIiwibmV3VmFsdWUiLCJ2YWx1ZSIsInNldCIsImFkZCIsImxpc3RlbiIsInN1YnNjcmliZSIsIm5leHQiLCJjaGFuZ2VzIiwiY2hhbmdlIiwidHlwZSIsImNvbnRyb2xsZXIiLCJnZXQiLCJFcnJvciIsImRlbGV0ZSIsInJlbW92ZSIsImVycm9yIiwiZXJyIiwiY29tcGxldGUiLCJlbmQiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7O2tCQUl3QkEsRzs7QUFGeEI7Ozs7OztBQUVlLFNBQVNBLEdBQVQsQ0FBa0JDLE9BQWxCLEVBQXVDQyxFQUF2QyxFQUF3RTtBQUNyRixNQUFNQyxJQUFjLG1CQUFwQjtBQUNBLFNBQU8sZUFBWTtBQUNqQkMsVUFBTSxnQkFBTTtBQUNWRCxRQUFFRSxLQUFGO0FBQ0EsVUFBTUMsSUFBSSxtQkFBVjtBQUNBTCxjQUFRTSxNQUFSLEdBQWlCQyxPQUFqQixDQUF5QixpQkFBUztBQUNoQyxZQUFNQyxXQUFXUCxHQUFHUSxLQUFILENBQWpCO0FBQ0FQLFVBQUVRLEdBQUYsQ0FBTUQsS0FBTixFQUFhRCxRQUFiO0FBQ0FILFVBQUVNLEdBQUYsQ0FBTUgsUUFBTjtBQUNELE9BSkQ7QUFLQSxhQUFPSCxDQUFQO0FBQ0QsS0FWZ0I7QUFXakJPLFlBQVE7QUFBQSxhQUFjWixR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uICAgICAgICAgICAgICBjb250cm9sbGVyLmFkZChuZXdWYWx1ZSk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNoYW5nZS50eXBlID09PSAncmVtb3ZlJykge1xuICAgICAgICAgICAgICBjb25zdCBuZXdWYWx1ZSA9IG0uZ2V0KGNoYW5nZS52YWx1ZSk7XG4gICAgICAgICAgICAgIGlmICghbmV3VmFsdWUpIHRocm93IG5ldyBFcnJvcigncmVtb3ZlZCBpdGVtIG5vdCBpbiBsaXZlc2V0Jyk7XG4gICAgICAgICAgICAgIG0uZGVsZXRlKGNoYW5nZS52YWx1ZSk7XG4gICAgICAgICAgICAgIGNvbnRyb2xsZXIucmVtb3ZlKG5ld1ZhbHVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KTtcbiAgICAgICAgfSxcbiAgICAgICAgZXJyb3IoZXJyKSB7XG4gICAgICAgICAgY29udHJvbGxlci5lcnJvcihlcnIpO1xuICAgICAgICB9LFxuICAgICAgICBjb21wbGV0ZSgpIHtcbiAgICAgICAgICBjb250cm9sbGVyLmVuZCgpO1xuICAgICAgICB9XG4gICAgICB9KTtcblxuICAgICAgY29uc3QgbTogTWFwPFQsVT4gPSBuZXcgTWFwKCk7XG4gICAgICBjb25zdCBzID0gbmV3IFNldCgpO1xuICAgICAgbGl2ZVNldC52YWx1ZXMoKS5mb3JFYWNoKHZhbHVlID0+IHtcbiAgICAgICAgY29uc3QgbmV3VmFsdWUgPSBjYih2YWx1ZSk7XG4gICAgICAgIG0uc2V0KHZhbHVlLCBuZXdWYWx1ZSk7XG4gICAgICAgIHMuYWRkKG5ld1ZhbHVlKTtcbiAgICAgIH0pO1xuICAgICAgc2V0VmFsdWVzKHMpO1xuXG4gICAgICByZXR1cm4gc3ViO1xuICAgIH1cbiAgfSk7XG59XG4iXX0= |
11
merge.js
@@ -30,3 +30,4 @@ 'use strict'; | ||
}, | ||
listen: function listen(controller) { | ||
listen: function listen(setValues, controller) { | ||
var initialValues = new _set2.default(); | ||
var subs = new _set2.default(); | ||
@@ -60,3 +61,9 @@ var doneSubscribing = false; | ||
}); | ||
liveSet.values().forEach(function (value) { | ||
initialValues.add(value); | ||
}); | ||
}); | ||
setValues(initialValues); | ||
doneSubscribing = true; | ||
@@ -76,2 +83,2 @@ if (subs.size === 0) { | ||
module.exports = exports['default']; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9tZXJnZS5qcyJdLCJuYW1lcyI6WyJtZXJnZSIsImxpdmVTZXRzIiwicmVhZCIsInMiLCJmb3JFYWNoIiwibGl2ZVNldCIsInZhbHVlcyIsImFkZCIsInZhbHVlIiwibGlzdGVuIiwiY29udHJvbGxlciIsInN1YnMiLCJkb25lU3Vic2NyaWJpbmciLCJzdWIiLCJzdWJzY3JpYmUiLCJzdGFydCIsIl9zdWIiLCJuZXh0IiwiY2hhbmdlcyIsImNoYW5nZSIsInR5cGUiLCJyZW1vdmUiLCJlcnJvciIsImVyciIsImNvbXBsZXRlIiwiZGVsZXRlIiwic2l6ZSIsImVuZCIsInVuc3Vic2NyaWJlIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O2tCQUl3QkEsSzs7QUFGeEI7Ozs7OztBQUVlLFNBQVNBLEtBQVQsQ0FBa0JDLFFBQWxCLEVBQTJEO0FBQ3hFLFNBQU8sZUFBWTtBQUNqQkMsUUFEaUIsa0JBQ1Y7QUFDTCxVQUFNQyxJQUFJLG1CQUFWO0FBQ0FGLGVBQVNHLE9BQVQsQ0FBaUIsbUJBQVc7QUFDMUJDLGdCQUFRQyxNQUFSLEdBQWlCRixPQUFqQixDQUF5QixpQkFBUztBQUNoQ0QsWUFBRUksR0FBRixDQUFNQyxLQUFOO0FBQ0QsU0FGRDtBQUdELE9BSkQ7QUFLQSxhQUFPTCxDQUFQO0FBQ0QsS0FUZ0I7QUFVakJNLFVBVmlCLGtCQVVWQyxVQVZVLEVBVUU7QUFDakIsVUFBTUMsT0F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YgKGNoYW5nZS50eXBlID09PSAnYWRkJykge1xuICAgICAgICAgICAgICAgIGNvbnRyb2xsZXIuYWRkKGNoYW5nZS52YWx1ZSk7XG4gICAgICAgICAgICAgIH0gZWxzZSBpZiAoY2hhbmdlLnR5cGUgPT09ICdyZW1vdmUnKSB7XG4gICAgICAgICAgICAgICAgY29udHJvbGxlci5yZW1vdmUoY2hhbmdlLnZhbHVlKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfSxcbiAgICAgICAgICBlcnJvcihlcnIpIHtcbiAgICAgICAgICAgIGNvbnRyb2xsZXIuZXJyb3IoZXJyKTtcbiAgICAgICAgICB9LFxuICAgICAgICAgIGNvbXBsZXRlKCkge1xuICAgICAgICAgICAgc3Vicy5kZWxldGUoc3ViKTtcbiAgICAgICAgICAgIGlmIChkb25lU3Vic2NyaWJpbmcgJiYgc3Vicy5zaXplID09PSAwKSB7XG4gICAgICAgICAgICAgIGNvbnRyb2xsZXIuZW5kKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9KTtcbiAgICAgIH0pO1xuICAgICAgZG9uZVN1YnNjcmliaW5nID0gdHJ1ZTtcbiAgICAgIGlmIChzdWJzLnNpemUgPT09IDApIHtcbiAgICAgICAgY29udHJvbGxlci5lbmQoKTtcbiAgICAgIH1cbiAgICAgIHJldHVybiAoKSA9PiB7XG4gICAgICAgIHN1YnMuZm9yRWFjaChzdWIgPT4ge1xuICAgICAgICAgIHN1Yi51bnN1YnNjcmliZSgpO1xuICAgICAgICB9KTtcbiAgICAgIH07XG4gICAgfVxuICB9KTtcbn1cbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy9tZXJnZS5qcyJdLCJuYW1lcyI6WyJtZXJnZSIsImxpdmVTZXRzIiwicmVhZCIsInMiLCJmb3JFYWNoIiwibGl2ZVNldCIsInZhbHVlcyIsImFkZC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bHVlKTtcbiAgICAgICAgICAgICAgfSBlbHNlIGlmIChjaGFuZ2UudHlwZSA9PT0gJ3JlbW92ZScpIHtcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyLnJlbW92ZShjaGFuZ2UudmFsdWUpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9LFxuICAgICAgICAgIGVycm9yKGVycikge1xuICAgICAgICAgICAgY29udHJvbGxlci5lcnJvcihlcnIpO1xuICAgICAgICAgIH0sXG4gICAgICAgICAgY29tcGxldGUoKSB7XG4gICAgICAgICAgICBzdWJzLmRlbGV0ZShzdWIpO1xuICAgICAgICAgICAgaWYgKGRvbmVTdWJzY3JpYmluZyAmJiBzdWJzLnNpemUgPT09IDApIHtcbiAgICAgICAgICAgICAgY29udHJvbGxlci5lbmQoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0pO1xuICAgICAgICBsaXZlU2V0LnZhbHVlcygpLmZvckVhY2godmFsdWUgPT4ge1xuICAgICAgICAgIGluaXRpYWxWYWx1ZXMuYWRkKHZhbHVlKTtcbiAgICAgICAgfSk7XG4gICAgICB9KTtcblxuICAgICAgc2V0VmFsdWVzKGluaXRpYWxWYWx1ZXMpO1xuXG4gICAgICBkb25lU3Vic2NyaWJpbmcgPSB0cnVlO1xuICAgICAgaWYgKHN1YnMuc2l6ZSA9PT0gMCkge1xuICAgICAgICBjb250cm9sbGVyLmVuZCgpO1xuICAgICAgfVxuICAgICAgcmV0dXJuICgpID0+IHtcbiAgICAgICAgc3Vicy5mb3JFYWNoKHN1YiA9PiB7XG4gICAgICAgICAgc3ViLnVuc3Vic2NyaWJlKCk7XG4gICAgICAgIH0pO1xuICAgICAgfTtcbiAgICB9XG4gIH0pO1xufVxuIl19 |
{ | ||
"name": "live-set", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "Class representing a changing and transformable collection of items.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
163
transduce.js
@@ -7,6 +7,2 @@ 'use strict'; | ||
var _map = require('babel-runtime/core-js/map'); | ||
var _map2 = _interopRequireDefault(_map); | ||
var _getIterator2 = require('babel-runtime/core-js/get-iterator'); | ||
@@ -20,2 +16,6 @@ | ||
var _map = require('babel-runtime/core-js/map'); | ||
var _map2 = _interopRequireDefault(_map); | ||
exports.default = transduce; | ||
@@ -43,48 +43,76 @@ | ||
function transduce(liveSet, transducer) { | ||
var xform = transducer(arrayXf); | ||
var addsComplete = false; | ||
return new _2.default({ | ||
read: function read() { | ||
xform = transducer(arrayXf); | ||
addsComplete = false; | ||
var result = xform['@@transducer/init'](); | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
function step(xform, inputValue) { | ||
var addsComplete = false; | ||
var outputValues = void 0; | ||
var ret = xform['@@transducer/step']([], inputValue); | ||
if (ret && ret['@@transducer/reduced']) { | ||
outputValues = ret['@@transducer/value']; | ||
addsComplete = true; | ||
} else { | ||
outputValues = ret; | ||
} | ||
return { | ||
outputValues: outputValues, | ||
addsComplete: addsComplete | ||
}; | ||
} | ||
try { | ||
for (var _iterator = (0, _getIterator3.default)(liveSet.values()), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var value = _step.value; | ||
function valuesAndContext() { | ||
var inputToOutputValues = new _map2.default(); | ||
var xform = transducer(arrayXf); | ||
var addsComplete = false; | ||
var values = new _set2.default(xform['@@transducer/init']()); | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var ret = xform['@@transducer/step'](result, value); | ||
if (ret && ret['@@transducer/reduced']) { | ||
result = ret['@@transducer/value']; | ||
addsComplete = true; | ||
break; | ||
} | ||
result = ret; | ||
try { | ||
for (var _iterator = (0, _getIterator3.default)(liveSet.values()), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
var value = _step.value; | ||
var _step2 = step(xform, value), | ||
outputValues = _step2.outputValues, | ||
_addsComplete = _step2.addsComplete; | ||
inputToOutputValues.set(value, outputValues); | ||
for (var i = 0, len = outputValues.length; i < len; i++) { | ||
values.add(outputValues[i]); | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
if (_addsComplete) { | ||
addsComplete = true; | ||
xform['@@transducer/result']([]).forEach(function (value) { | ||
values.add(value); | ||
}); | ||
break; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
if (addsComplete) { | ||
result = xform['@@transducer/result'](result); | ||
} | ||
return new _set2.default(result); | ||
return { | ||
values: values, | ||
inputToOutputValues: inputToOutputValues, | ||
xform: xform, | ||
addsComplete: addsComplete | ||
}; | ||
} | ||
return new _2.default({ | ||
read: function read() { | ||
return valuesAndContext().values; | ||
}, | ||
listen: function listen(controller) { | ||
var inputToOutputValues = new _map2.default(); | ||
return liveSet.subscribe({ | ||
listen: function listen(setValues, controller) { | ||
var sub = liveSet.subscribe({ | ||
next: function next(changes) { | ||
@@ -97,20 +125,12 @@ for (var i = 0, len = changes.length; i < len; i++) { | ||
var ret = xform['@@transducer/step']([], value); | ||
if (ret && ret['@@transducer/reduced']) { | ||
ret = ret['@@transducer/value']; | ||
var _step3 = step(xform, value), | ||
outputValues = _step3.outputValues, | ||
_addsComplete = _step3.addsComplete; | ||
inputToOutputValues.set(value, outputValues); | ||
for (var _i = 0, _len = outputValues.length; _i < _len; _i++) { | ||
controller.add(outputValues[_i]); | ||
} | ||
if (_addsComplete) { | ||
addsComplete = true; | ||
} | ||
if (ret.length !== 0) { | ||
var list = inputToOutputValues.get(value); | ||
if (!list) { | ||
list = []; | ||
inputToOutputValues.set(value, list); | ||
} | ||
for (var _i = 0, _len = ret.length; _i < _len; _i++) { | ||
var transformedValue = ret[_i]; | ||
list.push(transformedValue); | ||
controller.add(transformedValue); | ||
} | ||
} | ||
if (addsComplete) { | ||
xform['@@transducer/result']([]).forEach(function (endValue) { | ||
@@ -124,9 +144,8 @@ controller.add(endValue); | ||
var _list = inputToOutputValues.get(_value); | ||
if (_list) { | ||
_list.forEach(function (transformedValue) { | ||
controller.remove(transformedValue); | ||
}); | ||
inputToOutputValues.delete(_value); | ||
} | ||
var list = inputToOutputValues.get(_value); | ||
if (!list) throw new Error('value had not been added'); | ||
list.forEach(function (transformedValue) { | ||
controller.remove(transformedValue); | ||
}); | ||
inputToOutputValues.delete(_value); | ||
} | ||
@@ -142,2 +161,12 @@ } | ||
}); | ||
var _valuesAndContext = valuesAndContext(), | ||
initialValues = _valuesAndContext.values, | ||
inputToOutputValues = _valuesAndContext.inputToOutputValues, | ||
xform = _valuesAndContext.xform, | ||
addsComplete = _valuesAndContext.addsComplete; | ||
setValues(initialValues); | ||
return sub; | ||
} | ||
@@ -147,2 +176,2 @@ }); | ||
module.exports = exports['default']; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy90cmFuc2R1Y2UuanMiXSwibmFtZXMiOlsidHJhbnNkdWNlIiwiYXJyYXlYZiIsInJlcyIsImlucHV0IiwicHVzaCIsImxpdmVTZXQiLCJ0cmFuc2R1Y2VyIiwieGZvcm0iLCJhZGRzQ29tcGxldGUiLCJyZWFkIiwicmVzdWx0IiwidmFsdWVzIiwidmFsdWUiLCJyZXQiLCJsaXN0ZW4iLCJjb250cm9sbGVyIiwiaW5wdXRUb091dHB1dFZhbHVlcyIsInN1YnNjcmliZSIsIm5leHQiLCJjaGFuZ2VzIiwiaSIsImxlbiIsImxlb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aGFuZ2U7XG4gICAgICAgICAgICAgICAgbGV0IHJldCA9IHhmb3JtWydAQHRyYW5zZHVjZXIvc3RlcCddKFtdLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgaWYgKHJldCAmJiByZXRbJ0BAdHJhbnNkdWNlci9yZWR1Y2VkJ10pIHtcbiAgICAgICAgICAgICAgICAgIHJldCA9IHJldFsnQEB0cmFuc2R1Y2VyL3ZhbHVlJ107XG4gICAgICAgICAgICAgICAgICBhZGRzQ29tcGxldGUgPSB0cnVlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpZiAocmV0Lmxlbmd0aCAhPT0gMCkge1xuICAgICAgICAgICAgICAgICAgbGV0IGxpc3QgPSBpbnB1dFRvT3V0cHV0VmFsdWVzLmdldCh2YWx1ZSk7XG4gICAgICAgICAgICAgICAgICBpZiAoIWxpc3QpIHtcbiAgICAgICAgICAgICAgICAgICAgbGlzdCA9IFtdO1xuICAgICAgICAgICAgICAgICAgICBpbnB1dFRvT3V0cHV0VmFsdWVzLnNldCh2YWx1ZSwgbGlzdCk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICBmb3IgKGxldCBpPTAsIGxlbj1yZXQubGVuZ3RoOyBpPGxlbjsgaSsrKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zZm9ybWVkVmFsdWUgPSByZXRbaV07XG4gICAgICAgICAgICAgICAgICAgIGxpc3QucHVzaCh0cmFuc2Zvcm1lZFZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgY29udHJvbGxlci5hZGQodHJhbnNmb3JtZWRWYWx1ZSk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChhZGRzQ29tcGxldGUpIHtcbiAgICAgICAgICAgICAgICAgIHhmb3JtWydAQHRyYW5zZHVjZXIvcmVzdWx0J10oW10pLmZvckVhY2goZW5kVmFsdWUgPT4ge1xuICAgICAgICAgICAgICAgICAgICBjb250cm9sbGVyLmFkZChlbmRWYWx1ZSk7XG4gICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSBpZiAoY2hhbmdlLnR5cGUgPT09ICdyZW1vdmUnKSB7XG4gICAgICAgICAgICAgIGNvbnN0IHt2YWx1ZX0gPSBjaGFuZ2U7XG4gICAgICAgICAgICAgIGNvbnN0IGxpc3QgPSBpbnB1dFRvT3V0cHV0VmFsdWVzLmdldCh2YWx1ZSk7XG4gICAgICAgICAgICAgIGlmIChsaXN0KSB7XG4gICAgICAgICAgICAgICAgbGlzdC5mb3JFYWNoKHRyYW5zZm9ybWVkVmFsdWUgPT4ge1xuICAgICAgICAgICAgICAgICAgY29udHJvbGxlci5yZW1vdmUodHJhbnNmb3JtZWRWYWx1ZSk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgaW5wdXRUb091dHB1dFZhbHVlcy5kZWxldGUodmFsdWUpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9LFxuICAgICAgICBlcnJvcihlcnIpIHtcbiAgICAgICAgICBjb250cm9sbGVyLmVycm9yKGVycik7XG4gICAgICAgIH0sXG4gICAgICAgIGNvbXBsZXRlKCkge1xuICAgICAgICAgIGNvbnRyb2xsZXIuZW5kKCk7XG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgIH1cbiAgfSk7XG59XG4iXX0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNyYy90cmFuc2R1Y2UuanMiXSwibmFtZXMiOlsidHJhbnNkdWNlIiwiYXJyYXlYZiIsInJlcyIsImlucHV0IiwicHVzaCIsImxpdmVTZXQiLCJ0cmFuc2R1Y2VyIiwic3RlcCIsInhmb3JtIiwiaW5wdXRWYWx1ZSIsImFk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hZGRzQ29tcGxldGV9ID0gc3RlcCh4Zm9ybSwgdmFsdWUpO1xuICAgICAgICAgICAgICAgIGlucHV0VG9PdXRwdXRWYWx1ZXMuc2V0KHZhbHVlLCBvdXRwdXRWYWx1ZXMpO1xuICAgICAgICAgICAgICAgIGZvciAobGV0IGk9MCxsZW49b3V0cHV0VmFsdWVzLmxlbmd0aDsgaTxsZW47IGkrKykge1xuICAgICAgICAgICAgICAgICAgY29udHJvbGxlci5hZGQob3V0cHV0VmFsdWVzW2ldKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgaWYgKF9hZGRzQ29tcGxldGUpIHtcbiAgICAgICAgICAgICAgICAgIGFkZHNDb21wbGV0ZSA9IHRydWU7XG4gICAgICAgICAgICAgICAgICB4Zm9ybVsnQEB0cmFuc2R1Y2VyL3Jlc3VsdCddKFtdKS5mb3JFYWNoKGVuZFZhbHVlID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29udHJvbGxlci5hZGQoZW5kVmFsdWUpO1xuICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGNoYW5nZS50eXBlID09PSAncmVtb3ZlJykge1xuICAgICAgICAgICAgICBjb25zdCB7dmFsdWV9ID0gY2hhbmdlO1xuICAgICAgICAgICAgICBjb25zdCBsaXN0ID0gaW5wdXRUb091dHB1dFZhbHVlcy5nZXQodmFsdWUpO1xuICAgICAgICAgICAgICBpZiAoIWxpc3QpIHRocm93IG5ldyBFcnJvcigndmFsdWUgaGFkIG5vdCBiZWVuIGFkZGVkJyk7XG4gICAgICAgICAgICAgIGxpc3QuZm9yRWFjaCh0cmFuc2Zvcm1lZFZhbHVlID0+IHtcbiAgICAgICAgICAgICAgICBjb250cm9sbGVyLnJlbW92ZSh0cmFuc2Zvcm1lZFZhbHVlKTtcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgIGlucHV0VG9PdXRwdXRWYWx1ZXMuZGVsZXRlKHZhbHVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0sXG4gICAgICAgIGVycm9yKGVycikge1xuICAgICAgICAgIGNvbnRyb2xsZXIuZXJyb3IoZXJyKTtcbiAgICAgICAgfSxcbiAgICAgICAgY29tcGxldGUoKSB7XG4gICAgICAgICAgY29udHJvbGxlci5lbmQoKTtcbiAgICAgICAgfVxuICAgICAgfSk7XG5cbiAgICAgIGxldCB7dmFsdWVzOiBpbml0aWFsVmFsdWVzLCBpbnB1dFRvT3V0cHV0VmFsdWVzLCB4Zm9ybSwgYWRkc0NvbXBsZXRlfSA9IHZhbHVlc0FuZENvbnRleHQoKTtcbiAgICAgIHNldFZhbHVlcyhpbml0aWFsVmFsdWVzKTtcblxuICAgICAgcmV0dXJuIHN1YjtcbiAgICB9XG4gIH0pO1xufVxuIl19 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92600
709