From b8958814dcef2ca8d5433b8f29ee88d351848036 Mon Sep 17 00:00:00 2001 From: theghostbel Date: Thu, 17 Sep 2015 12:18:06 +0300 Subject: [PATCH] Pass stream msg into appendAs function Allows to write simpler code: ``` .select(function(x){ return _.merge(x, { newProp: transform(x) }) ``` ``` .appendAs('newProp', transform) ``` --- rx.contribute.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rx.contribute.js b/rx.contribute.js index 208f225..02b452c 100644 --- a/rx.contribute.js +++ b/rx.contribute.js @@ -65,12 +65,12 @@ observableProto.appendAs = function (propertyName, data) { return this.select(function (x) { if (x !== null && typeof (x) == 'object') { - x[propertyName] = isFunction(data) ? data() : data; + x[propertyName] = isFunction(data) ? data(x) : data; return x; } else { var temp = {}; - temp[propertyName] = isFunction(data) ? data() : data; + temp[propertyName] = isFunction(data) ? data(x) : data; return temp; } });