New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arch-stream

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arch-stream - npm Package Compare versions

Comparing version 0.0.23 to 0.0.24

test/performance/observable.ts

4

dist/arch-stream.js

@@ -1,2 +0,2 @@

/*! arch-stream v0.0.23 | (c) 2015, falsandtru | MIT Licence */
/*! arch-stream v0.0.24 | (c) 2015, falsandtru | MIT Licence */
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){

@@ -212,3 +212,3 @@ 'use strict';

};
Observable.prototype.one = function (type, listener) {
Observable.prototype.once = function (type, listener) {
var _this = this;

@@ -215,0 +215,0 @@ var wrapper = function (data) {

@@ -1,2 +0,2 @@

/*! arch-stream v0.0.23 | (c) 2015, falsandtru | MIT Licence */
require=function t(e,r,o){function n(u,s){if(!r[u]){if(!e[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(i)return i(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var p=r[u]={exports:{}};e[u][0].call(p.exports,function(t){var r=e[u][1][t];return n(r?r:t)},p,p.exports,t,e,r,o)}return r[u].exports}for(var i="function"==typeof require&&require,u=0;u<o.length;u++)n(o[u]);return n}({1:[function(t,e,r){"use strict";var o=t("./decorator/bind");r.bind=o.bind},{"./decorator/bind":2}],2:[function(t,e,r){"use strict";function o(t,e,r){t[e]=t[e].bind(t)}r.bind=o},{}],3:[function(t,e,r){"use strict";function o(t){return t}var n=this&&this.__decorate||function(t,e,r,o){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(t,e,r,o);switch(arguments.length){case 2:return t.reduceRight(function(t,e){return e&&e(t)||t},e);case 3:return t.reduceRight(function(t,o){return void(o&&o(e,r))},void 0);case 4:return t.reduceRight(function(t,o){return o&&o(e,r,t)||t},o)}},i=t("../decorator"),u=t("../lib/thenable"),s=t("./tick"),c=Object.create(null),a=function(){function t(t,e){void 0===e&&(e=o),this.parent=t,this.listener=e,this.memory_=c,this.collection_=[],this.waits_=[],t&&(this.parent.child_=this)}return t.prototype.root=function(){return this.parent?this.parent.root():this},t.prototype.collect_=function(){if(this.collection_.length>0)return this.collection_;var t=this,e=[];do void e.push(t);while(t=t.child_);return this.collection_=e},t.prototype.transport_=function(t,e){function r(e){return e.every(function(e){e.memory_=t;var r=e.listener(t);return u.isThenable(r)?(n=e,s=!1,void r.then(o,o),s):!0})}function o(){s=!0,i&&n.child_&&void n.child_.send(t,e)}var n,i=!1,s=!1,c=r(this.collect_());i=!0,c&&"function"==typeof e&&void e(t)},t.prototype.clone=function(){function e(r){return r.parent?new t(e(r.parent),r.listener):new t(void 0,r.listener)}return e(this)},t.prototype.connect=function(t){return this.parent.child_=t,t.parent=this.parent,this},t.prototype.send=function(t,e,r){switch(!0){case"function"==typeof e:return this.send(t,!1,e);case!e:return void this.transport_(t,r),this;default:return void s["default"](this.transport_.bind(this,t,r)),this}},t.prototype.recv=function(e){return this.listener=e,this.collection_=[],this.memory_!==c&&void this.send(this.memory_),new t(this)},t.prototype.then=function(t,e){function r(t){if(0!==o.length)for(s["default"](r.bind(this,t));o.length>0;)o.shift()(t)}var o=this.waits_;return o.push(t),this.recv(r)},Object.defineProperty(t.prototype,"send",n([i.bind],t.prototype,"send",Object.getOwnPropertyDescriptor(t.prototype,"send"))),Object.defineProperty(t.prototype,"recv",n([i.bind],t.prototype,"recv",Object.getOwnPropertyDescriptor(t.prototype,"recv"))),t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=a},{"../decorator":1,"../lib/thenable":7,"./tick":9}],4:[function(t,e,r){"use strict";function o(){}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{}],5:[function(t,e,r){"use strict";var o=function(){function t(){this.separator_=".",this.map_=Object.create(null)}return t.prototype.seek_=function(t,e){switch(e.length){case 0:throw new Error("ArchStream: Observable: Cannot use empty string for event type and namespace.");case 1:return this.namespace_(t,e.shift());default:return this.seek_(this.namespace_(t,e.shift()).map,e)}},t.prototype.namespace_=function(t,e){return e in t&&t[e].map?t[e]:t[e]={map:Object.create(null),list:[]}},t.prototype.on=function(t,e){return void this.seek_(this.map_,t.toString().split(this.separator_)).list.push(e),this},t.prototype.off=function(t,e){switch(typeof e){case"function":var r=this.seek_(this.map_,t.toString().split(this.separator_)).list,o=r.indexOf(e);switch(o){case-1:break;case 0:void r.shift();break;default:void r.splice(o,1)}return this;case"undefined":var n=this.seek_(this.map_,t.toString().split(this.separator_));return n.map=Object.create(null),n.list=[],this;default:throw new TypeError("ArchStream: Observable: Invalid type argument: "+e)}},t.prototype.one=function(t,e){var r=this,o=function(n){void r.off(t,o),void e(n)};return void this.on(t,o),this},t.prototype.collect_=function(t){var e=this,r=t.map,o=t.list;return Object.keys(r).reduce(function(t,o){return void t.unshift.apply(t,e.collect_(r[o])),t},o.slice())},t.prototype.emit=function(t,e){return void this.collect_(this.seek_(this.map_,t.toString().split(this.separator_))).reduce(function(t,r){return r(e)},void 0),this},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{}],6:[function(t,e,r){"use strict";var o=t("../proxy/case"),n=t("../proxy/hook"),i=t("../proxy/responsibility");Object.defineProperty(r,"__esModule",{value:!0}),r["default"]={Case:o["default"],Hook:n["default"],Responsibility:i["default"]}},{"../proxy/case":10,"../proxy/hook":11,"../proxy/responsibility":12}],7:[function(t,e,r){"use strict";function o(t){return!!t&&"object"==typeof t&&"then"in t}r.isThenable=o},{}],8:[function(t,e,r){"use strict";var o=function(){function t(){this.queue_=[],this.processing_=[],this.limit_=1/0,this.volume_=1/0}return t.prototype.isDrainable_=function(){return this.processing_.length<this.volume_},t.prototype.discharger_=function(t,e){},t.prototype.flow=function(t,e,r){void 0===e&&(e=1/0),void 0===r&&(r=function(){return null}),this.volume_=t,this.limit_=e,this.discharger_=r},t.prototype.enqueue=function(t){if(this.isDrainable_())return void this.processing_.push(t),void this.resolver_(t),!0;this.queue_.push(t);do void this.discharger_(this.queue_,this.processing_);while(this.processing_.length+this.queue_.length>this.limit_);return!1},t.prototype.dequeue=function(t){var e=this.processing_.indexOf(t);e>0?void this.processing_.splice(e,1):void this.processing_.shift(),this.queue_.length>0&&this.isDrainable_()&&void this.enqueue(this.queue_.shift())},t.prototype.register=function(t){this.resolver_=t},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{}],9:[function(t,e,r){"use strict";var o;!function(t){function e(t){void n.push(t),void o()}function r(){void--i,void o();for(var t=n.length;t-->0;)void n.shift()()}function o(){if(0!==n.length)if(u)for(;2>i;)void Promise.resolve().then(r),void++i;else for(;i<s.length;)void setTimeout(r,s[i%s.length]),void++i}t.queue=e;var n=[],i=0,u="function"==typeof Promise,s=[0,4,10,20,25].reverse()}(o||(o={}));var n=Function("return typeof process === 'object' && typeof window !== 'object'")();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n?Function("return fn => process.nextTick(fn)")():o.queue},{}],10:[function(t,e,r){"use strict";function o(t,e){function r(){for(var t=[],r=0;r<arguments.length;r++)t[r-0]=arguments[r];return function(r){var n=+o[e(r)+""];n>-1&&n<t.length&&t[n](r)}}var o=Object.create(null);return void t.reduce(function(t,e,r){return o[e+""]=r},void 0),function(t){return{pipe:r}}}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{}],11:[function(t,e,r){"use strict";function o(t){function e(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return t.map(function(t){return function(e){o(e),t(e),u(e)}})}var r=t.pre,o=void 0===r?n["default"]:r,i=t.post,u=void 0===i?n["default"]:i;return function(t){return{pipe:e}}}var n=t("../lib/noop");Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{"../lib/noop":4}],12:[function(t,e,r){"use strict";function o(){function t(t,r){e.pipe=function(){for(var e=[],o=0;o<arguments.length;o++)e[o-0]=arguments[o];return e.map(function(e){return function(o){if(!(r(o)instanceof t))throw TypeError("ArchStream: ResponsibilityProxy: Uncovered internal entity: "+r(o).constructor);e(o)}})},e["export"]=function(){return function(e){r(e)instanceof t&&void Object.freeze(r(e))}}}var e;return function(r){return e={rule:t}}}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{}],13:[function(t,e,r){"use strict";var o=t("./modular"),n=function(){function t(t){this.extract_=t,this.procs_=[],this.branched_=0}return t.prototype.register=function(t){var e=this.procs_.length;return void t.reduceRight(function(t,r,o){return t[o+e]=r,t},this.procs_),this},t.prototype["import"]=function(e,r){var o=this;return void this.throwErrorIfNotImportable_(e,r),r&&(e=(new t)["import"](e)["export"]().wrap(function(t,e){return o.extract_(t)instanceof r?e(t):0})),void--e.count,e.count<0&&void e.throwCountExceededError(),void this.register(e.procs),this},t.prototype["export"]=function(t){return new o["default"](this.procs_,t,this.branched_)},t.prototype.throwErrorIfNotImportable_=function(t,e){e?((t.branched>0||this.branched_>1)&&(void--t.count,void this.throwConditionalImportError()),this.branched_=1):(t.branched>0&&this.branched_>0&&(void--t.count,void this.throwConditionalImportError()),this.branched_=t.branched>0?t.branched+1:t.branched)},t.prototype.throwConditionalImportError=function(){throw new Error("ArchStream: Conditional import cannot call from different streams.")},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n},{"./modular":14}],14:[function(t,e,r){"use strict";var o=this&&this.__decorate||function(t,e,r,o){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(t,e,r,o);switch(arguments.length){case 2:return t.reduceRight(function(t,e){return e&&e(t)||t},e);case 3:return t.reduceRight(function(t,o){return void(o&&o(e,r))},void 0);case 4:return t.reduceRight(function(t,o){return o&&o(e,r,t)||t},o)}},n=t("../decorator"),i=t("../lib/throttle"),u=t("../lib/tick"),s=t("../lib/noop"),c=function(){function t(t,e,r){var o=this;void 0===e&&(e=1),this.procs=t,this.count=e,this.branched=r,void u["default"](function(t){return 0<o.count&&o.count<1/0&&o.throwCountDeprivedError()})}return t.prototype.compose_=function(){this.last_=this.procs.map(function(t){return t.clone()}).reduce(function(t,e){return t.connect(e.root())&&e}),this.first_=this.last_.root()},t.prototype.wrap=function(t){function e(e){return function(r){return t(r,e)}}void this.compose_();var r=this.last_;do r=r.parent,r.listener=e(r.listener);while(r.parent);return this.procs=[this.last_],this},t.prototype.read_=function(t){void--this.count,this.count<0&&void this.throwCountExceededError(),void this.compose_(),void this.last_.recv(t)},t.prototype.read=function(t){var e=this;void 0===t&&(t=s["default"]);var r=!1;return void this.read_(function(o){e.flow_&&void u["default"](function(){return void e.flow_.dequeue(o)}),r&&void t(o)}),r=!0,this},t.prototype.write_=function(t,e){void this.first_.send(t,e)},t.prototype.write=function(t,e){return this.flow_?void this.flow_.enqueue(t):void this.write_(t,e),this},t.prototype.flow=function(t,e,r){var o=this;return void 0===e&&(e=1/0),this.flow_=new i["default"],void this.flow_.flow(t,e,r),void this.flow_.register(function(t){return o.write_(t)}),this},t.prototype.throwCountExceededError=function(){throw new Error("ArchStream: Import and read counts are exeeded.")},t.prototype.throwCountDeprivedError=function(){throw this.count=0,new Error("ArchStream: Import and read counts are not deprived.")},Object.defineProperty(t.prototype,"read",o([n.bind],t.prototype,"read",Object.getOwnPropertyDescriptor(t.prototype,"read"))),Object.defineProperty(t.prototype,"write",o([n.bind],t.prototype,"write",Object.getOwnPropertyDescriptor(t.prototype,"write"))),t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=c},{"../decorator":1,"../lib/noop":4,"../lib/throttle":8,"../lib/tick":9}],15:[function(t,e,r){"use strict";var o=t("../lib/message"),n=t("./compose"),i=t("./modular"),u=function(){function t(t,e){var r=this;void 0===e&&(e=new o["default"]),this.parent_=t,this.message_=e,this.proxies_=[],this.parent_&&void this.parent_.proxies_.reduce(function(t,e){return r.proxy(e)},void 0)}return t.prototype.pipe=function(e){return new t(this,this.message_.recv(e))},t.prototype["import"]=function(t,e){return t instanceof i["default"]?(new n["default"])["import"](t,e):new n["default"](t)},t.prototype["export"]=function(t){return(new n["default"]).register([this.message_])["export"](t)},t.prototype.proxy_=function(e,r){function o(t){return Array.isArray(t)?t:[t]}var n=this.proxies_.filter(function(t){return e in t&&"function"==typeof t[e]}).reduce(function(t,r){return o(r[e].apply(void 0,t)||t)},r),i="pipe";switch(e){case i:return t.prototype[e].call(this,n[0]);case"import":throw new Error("ArchStream: `import` method cannot extend by proxy.");case"export":return(u=t.prototype[e]).call.apply(u,[this.proxy_(i,n)].concat(r));default:return this.proxy_(i,n)}var u},t.prototype.proxy=function(t){var e=this,r="function"==typeof t?t():t;return this.proxies_.push(r),void Object.keys(r).filter(function(t){return t.length>0&&"_"!==t[0]&&"_"!==t[t.length-1]}).filter(function(t){return"function"==typeof r[t]}).reduce(function(t,r){return e[r]=function(){for(var t=[],o=0;o<arguments.length;o++)t[o-0]=arguments[o];return e.proxy_(r,t)}},void 0),this},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=u},{"../lib/message":3,"./compose":13,"./modular":14}],"arch-stream":[function(t,e,r){"use strict";function o(){return new i["default"]}function n(){return new u["default"]}var i=t("./stream/transform");r.ArchStream=i["default"];var u=t("./lib/message");r.Message=u["default"];var s=t("./lib/proxy");r.Proxy=s["default"];var c=t("./lib/tick");r.Tick=c["default"];var a=t("./lib/observable");r.Observable=a["default"],Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o;var o,p={Msg:n,Proxy:s["default"],Tick:c["default"]};!function(t){t.Msg=p.Msg,t.Proxy=p.Proxy,t.Tick=p.Tick}(o||(o={})),r.Msg=n},{"./lib/message":3,"./lib/observable":5,"./lib/proxy":6,"./lib/tick":9,"./stream/transform":15}]},{},[1,2,"arch-stream",3,4,5,6,7,8,9,10,11,12,13,14,15]),"object"==typeof module&&module&&"exports"in module&&(module.exports=require("arch-stream"));
/*! arch-stream v0.0.24 | (c) 2015, falsandtru | MIT Licence */
require=function t(e,r,o){function n(u,s){if(!r[u]){if(!e[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(i)return i(u,!0);var a=new Error("Cannot find module '"+u+"'");throw a.code="MODULE_NOT_FOUND",a}var p=r[u]={exports:{}};e[u][0].call(p.exports,function(t){var r=e[u][1][t];return n(r?r:t)},p,p.exports,t,e,r,o)}return r[u].exports}for(var i="function"==typeof require&&require,u=0;u<o.length;u++)n(o[u]);return n}({1:[function(t,e,r){"use strict";var o=t("./decorator/bind");r.bind=o.bind},{"./decorator/bind":2}],2:[function(t,e,r){"use strict";function o(t,e,r){t[e]=t[e].bind(t)}r.bind=o},{}],3:[function(t,e,r){"use strict";function o(t){return t}var n=this&&this.__decorate||function(t,e,r,o){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(t,e,r,o);switch(arguments.length){case 2:return t.reduceRight(function(t,e){return e&&e(t)||t},e);case 3:return t.reduceRight(function(t,o){return void(o&&o(e,r))},void 0);case 4:return t.reduceRight(function(t,o){return o&&o(e,r,t)||t},o)}},i=t("../decorator"),u=t("../lib/thenable"),s=t("./tick"),c=Object.create(null),a=function(){function t(t,e){void 0===e&&(e=o),this.parent=t,this.listener=e,this.memory_=c,this.collection_=[],this.waits_=[],t&&(this.parent.child_=this)}return t.prototype.root=function(){return this.parent?this.parent.root():this},t.prototype.collect_=function(){if(this.collection_.length>0)return this.collection_;var t=this,e=[];do void e.push(t);while(t=t.child_);return this.collection_=e},t.prototype.transport_=function(t,e){function r(e){return e.every(function(e){e.memory_=t;var r=e.listener(t);return u.isThenable(r)?(n=e,s=!1,void r.then(o,o),s):!0})}function o(){s=!0,i&&n.child_&&void n.child_.send(t,e)}var n,i=!1,s=!1,c=r(this.collect_());i=!0,c&&"function"==typeof e&&void e(t)},t.prototype.clone=function(){function e(r){return r.parent?new t(e(r.parent),r.listener):new t(void 0,r.listener)}return e(this)},t.prototype.connect=function(t){return this.parent.child_=t,t.parent=this.parent,this},t.prototype.send=function(t,e,r){switch(!0){case"function"==typeof e:return this.send(t,!1,e);case!e:return void this.transport_(t,r),this;default:return void s["default"](this.transport_.bind(this,t,r)),this}},t.prototype.recv=function(e){return this.listener=e,this.collection_=[],this.memory_!==c&&void this.send(this.memory_),new t(this)},t.prototype.then=function(t,e){function r(t){if(0!==o.length)for(s["default"](r.bind(this,t));o.length>0;)o.shift()(t)}var o=this.waits_;return o.push(t),this.recv(r)},Object.defineProperty(t.prototype,"send",n([i.bind],t.prototype,"send",Object.getOwnPropertyDescriptor(t.prototype,"send"))),Object.defineProperty(t.prototype,"recv",n([i.bind],t.prototype,"recv",Object.getOwnPropertyDescriptor(t.prototype,"recv"))),t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=a},{"../decorator":1,"../lib/thenable":7,"./tick":9}],4:[function(t,e,r){"use strict";function o(){}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{}],5:[function(t,e,r){"use strict";var o=function(){function t(){this.separator_=".",this.map_=Object.create(null)}return t.prototype.seek_=function(t,e){switch(e.length){case 0:throw new Error("ArchStream: Observable: Cannot use empty string for event type and namespace.");case 1:return this.namespace_(t,e.shift());default:return this.seek_(this.namespace_(t,e.shift()).map,e)}},t.prototype.namespace_=function(t,e){return e in t&&t[e].map?t[e]:t[e]={map:Object.create(null),list:[]}},t.prototype.on=function(t,e){return void this.seek_(this.map_,t.toString().split(this.separator_)).list.push(e),this},t.prototype.off=function(t,e){switch(typeof e){case"function":var r=this.seek_(this.map_,t.toString().split(this.separator_)).list,o=r.indexOf(e);switch(o){case-1:break;case 0:void r.shift();break;default:void r.splice(o,1)}return this;case"undefined":var n=this.seek_(this.map_,t.toString().split(this.separator_));return n.map=Object.create(null),n.list=[],this;default:throw new TypeError("ArchStream: Observable: Invalid type argument: "+e)}},t.prototype.once=function(t,e){var r=this,o=function(n){void r.off(t,o),void e(n)};return void this.on(t,o),this},t.prototype.collect_=function(t){var e=this,r=t.map,o=t.list;return Object.keys(r).reduce(function(t,o){return void t.unshift.apply(t,e.collect_(r[o])),t},o.slice())},t.prototype.emit=function(t,e){return void this.collect_(this.seek_(this.map_,t.toString().split(this.separator_))).reduce(function(t,r){return r(e)},void 0),this},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{}],6:[function(t,e,r){"use strict";var o=t("../proxy/case"),n=t("../proxy/hook"),i=t("../proxy/responsibility");Object.defineProperty(r,"__esModule",{value:!0}),r["default"]={Case:o["default"],Hook:n["default"],Responsibility:i["default"]}},{"../proxy/case":10,"../proxy/hook":11,"../proxy/responsibility":12}],7:[function(t,e,r){"use strict";function o(t){return!!t&&"object"==typeof t&&"then"in t}r.isThenable=o},{}],8:[function(t,e,r){"use strict";var o=function(){function t(){this.queue_=[],this.processing_=[],this.limit_=1/0,this.volume_=1/0}return t.prototype.isDrainable_=function(){return this.processing_.length<this.volume_},t.prototype.discharger_=function(t,e){},t.prototype.flow=function(t,e,r){void 0===e&&(e=1/0),void 0===r&&(r=function(){return null}),this.volume_=t,this.limit_=e,this.discharger_=r},t.prototype.enqueue=function(t){if(this.isDrainable_())return void this.processing_.push(t),void this.resolver_(t),!0;this.queue_.push(t);do void this.discharger_(this.queue_,this.processing_);while(this.processing_.length+this.queue_.length>this.limit_);return!1},t.prototype.dequeue=function(t){var e=this.processing_.indexOf(t);e>0?void this.processing_.splice(e,1):void this.processing_.shift(),this.queue_.length>0&&this.isDrainable_()&&void this.enqueue(this.queue_.shift())},t.prototype.register=function(t){this.resolver_=t},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{}],9:[function(t,e,r){"use strict";var o;!function(t){function e(t){void n.push(t),void o()}function r(){void--i,void o();for(var t=n.length;t-->0;)void n.shift()()}function o(){if(0!==n.length)if(u)for(;2>i;)void Promise.resolve().then(r),void++i;else for(;i<s.length;)void setTimeout(r,s[i%s.length]),void++i}t.queue=e;var n=[],i=0,u="function"==typeof Promise,s=[0,4,10,20,25].reverse()}(o||(o={}));var n=Function("return typeof process === 'object' && typeof window !== 'object'")();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n?Function("return fn => process.nextTick(fn)")():o.queue},{}],10:[function(t,e,r){"use strict";function o(t,e){function r(){for(var t=[],r=0;r<arguments.length;r++)t[r-0]=arguments[r];return function(r){var n=+o[e(r)+""];n>-1&&n<t.length&&t[n](r)}}var o=Object.create(null);return void t.reduce(function(t,e,r){return o[e+""]=r},void 0),function(t){return{pipe:r}}}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{}],11:[function(t,e,r){"use strict";function o(t){function e(){for(var t=[],e=0;e<arguments.length;e++)t[e-0]=arguments[e];return t.map(function(t){return function(e){o(e),t(e),u(e)}})}var r=t.pre,o=void 0===r?n["default"]:r,i=t.post,u=void 0===i?n["default"]:i;return function(t){return{pipe:e}}}var n=t("../lib/noop");Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{"../lib/noop":4}],12:[function(t,e,r){"use strict";function o(){function t(t,r){e.pipe=function(){for(var e=[],o=0;o<arguments.length;o++)e[o-0]=arguments[o];return e.map(function(e){return function(o){if(!(r(o)instanceof t))throw TypeError("ArchStream: ResponsibilityProxy: Uncovered internal entity: "+r(o).constructor);e(o)}})},e["export"]=function(){return function(e){r(e)instanceof t&&void Object.freeze(r(e))}}}var e;return function(r){return e={rule:t}}}Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o},{}],13:[function(t,e,r){"use strict";var o=t("./modular"),n=function(){function t(t){this.extract_=t,this.procs_=[],this.branched_=0}return t.prototype.register=function(t){var e=this.procs_.length;return void t.reduceRight(function(t,r,o){return t[o+e]=r,t},this.procs_),this},t.prototype["import"]=function(e,r){var o=this;return void this.throwErrorIfNotImportable_(e,r),r&&(e=(new t)["import"](e)["export"]().wrap(function(t,e){return o.extract_(t)instanceof r?e(t):0})),void--e.count,e.count<0&&void e.throwCountExceededError(),void this.register(e.procs),this},t.prototype["export"]=function(t){return new o["default"](this.procs_,t,this.branched_)},t.prototype.throwErrorIfNotImportable_=function(t,e){e?((t.branched>0||this.branched_>1)&&(void--t.count,void this.throwConditionalImportError()),this.branched_=1):(t.branched>0&&this.branched_>0&&(void--t.count,void this.throwConditionalImportError()),this.branched_=t.branched>0?t.branched+1:t.branched)},t.prototype.throwConditionalImportError=function(){throw new Error("ArchStream: Conditional import cannot call from different streams.")},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=n},{"./modular":14}],14:[function(t,e,r){"use strict";var o=this&&this.__decorate||function(t,e,r,o){if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)return Reflect.decorate(t,e,r,o);switch(arguments.length){case 2:return t.reduceRight(function(t,e){return e&&e(t)||t},e);case 3:return t.reduceRight(function(t,o){return void(o&&o(e,r))},void 0);case 4:return t.reduceRight(function(t,o){return o&&o(e,r,t)||t},o)}},n=t("../decorator"),i=t("../lib/throttle"),u=t("../lib/tick"),s=t("../lib/noop"),c=function(){function t(t,e,r){var o=this;void 0===e&&(e=1),this.procs=t,this.count=e,this.branched=r,void u["default"](function(t){return 0<o.count&&o.count<1/0&&o.throwCountDeprivedError()})}return t.prototype.compose_=function(){this.last_=this.procs.map(function(t){return t.clone()}).reduce(function(t,e){return t.connect(e.root())&&e}),this.first_=this.last_.root()},t.prototype.wrap=function(t){function e(e){return function(r){return t(r,e)}}void this.compose_();var r=this.last_;do r=r.parent,r.listener=e(r.listener);while(r.parent);return this.procs=[this.last_],this},t.prototype.read_=function(t){void--this.count,this.count<0&&void this.throwCountExceededError(),void this.compose_(),void this.last_.recv(t)},t.prototype.read=function(t){var e=this;void 0===t&&(t=s["default"]);var r=!1;return void this.read_(function(o){e.flow_&&void u["default"](function(){return void e.flow_.dequeue(o)}),r&&void t(o)}),r=!0,this},t.prototype.write_=function(t,e){void this.first_.send(t,e)},t.prototype.write=function(t,e){return this.flow_?void this.flow_.enqueue(t):void this.write_(t,e),this},t.prototype.flow=function(t,e,r){var o=this;return void 0===e&&(e=1/0),this.flow_=new i["default"],void this.flow_.flow(t,e,r),void this.flow_.register(function(t){return o.write_(t)}),this},t.prototype.throwCountExceededError=function(){throw new Error("ArchStream: Import and read counts are exeeded.")},t.prototype.throwCountDeprivedError=function(){throw this.count=0,new Error("ArchStream: Import and read counts are not deprived.")},Object.defineProperty(t.prototype,"read",o([n.bind],t.prototype,"read",Object.getOwnPropertyDescriptor(t.prototype,"read"))),Object.defineProperty(t.prototype,"write",o([n.bind],t.prototype,"write",Object.getOwnPropertyDescriptor(t.prototype,"write"))),t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=c},{"../decorator":1,"../lib/noop":4,"../lib/throttle":8,"../lib/tick":9}],15:[function(t,e,r){"use strict";var o=t("../lib/message"),n=t("./compose"),i=t("./modular"),u=function(){function t(t,e){var r=this;void 0===e&&(e=new o["default"]),this.parent_=t,this.message_=e,this.proxies_=[],this.parent_&&void this.parent_.proxies_.reduce(function(t,e){return r.proxy(e)},void 0)}return t.prototype.pipe=function(e){return new t(this,this.message_.recv(e))},t.prototype["import"]=function(t,e){return t instanceof i["default"]?(new n["default"])["import"](t,e):new n["default"](t)},t.prototype["export"]=function(t){return(new n["default"]).register([this.message_])["export"](t)},t.prototype.proxy_=function(e,r){function o(t){return Array.isArray(t)?t:[t]}var n=this.proxies_.filter(function(t){return e in t&&"function"==typeof t[e]}).reduce(function(t,r){return o(r[e].apply(void 0,t)||t)},r),i="pipe";switch(e){case i:return t.prototype[e].call(this,n[0]);case"import":throw new Error("ArchStream: `import` method cannot extend by proxy.");case"export":return(u=t.prototype[e]).call.apply(u,[this.proxy_(i,n)].concat(r));default:return this.proxy_(i,n)}var u},t.prototype.proxy=function(t){var e=this,r="function"==typeof t?t():t;return this.proxies_.push(r),void Object.keys(r).filter(function(t){return t.length>0&&"_"!==t[0]&&"_"!==t[t.length-1]}).filter(function(t){return"function"==typeof r[t]}).reduce(function(t,r){return e[r]=function(){for(var t=[],o=0;o<arguments.length;o++)t[o-0]=arguments[o];return e.proxy_(r,t)}},void 0),this},t}();Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=u},{"../lib/message":3,"./compose":13,"./modular":14}],"arch-stream":[function(t,e,r){"use strict";function o(){return new i["default"]}function n(){return new u["default"]}var i=t("./stream/transform");r.ArchStream=i["default"];var u=t("./lib/message");r.Message=u["default"];var s=t("./lib/proxy");r.Proxy=s["default"];var c=t("./lib/tick");r.Tick=c["default"];var a=t("./lib/observable");r.Observable=a["default"],Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=o;var o,p={Msg:n,Proxy:s["default"],Tick:c["default"]};!function(t){t.Msg=p.Msg,t.Proxy=p.Proxy,t.Tick=p.Tick}(o||(o={})),r.Msg=n},{"./lib/message":3,"./lib/observable":5,"./lib/proxy":6,"./lib/tick":9,"./stream/transform":15}]},{},[1,2,"arch-stream",3,4,5,6,7,8,9,10,11,12,13,14,15]),"object"==typeof module&&module&&"exports"in module&&(module.exports=require("arch-stream"));
{
"name": "arch-stream",
"version": "0.0.23",
"version": "0.0.24",
"description": "Pipeline stream for software architecture of Domain-Driven Design and Data-Oriented Design.",

@@ -5,0 +5,0 @@ "private": false,

@@ -65,3 +65,3 @@ var Observable = (function () {

};
Observable.prototype.one = function (type, listener) {
Observable.prototype.once = function (type, listener) {
var _this = this;

@@ -68,0 +68,0 @@ assert(typeof listener === 'function');

@@ -38,6 +38,6 @@ import Observable from './observable';

it('one', function (done) {
it('once', function (done) {
let cnt = 0;
new Observable<string, number>()
.one('test', data => assert(data === 0 && ++cnt === 1) || Tick(done))
.once('test', data => assert(data === 0 && ++cnt === 1) || Tick(done))
.emit('test', 0)

@@ -44,0 +44,0 @@ .emit('test', 0);

@@ -78,3 +78,3 @@ import {Observable as IObservable} from 'arch-stream';

}
public one(type: S, listener: Listener<T>): Observable<S, T> {
public once(type: S, listener: Listener<T>): Observable<S, T> {
assert(typeof listener === 'function');

@@ -81,0 +81,0 @@ const wrapper = data => {

@@ -93,3 +93,3 @@ /**

off(type: S, listener?: Listener<T>): Observable<S, T>
one(type: S, listener: Listener<T>): Observable<S, T>
once(type: S, listener: Listener<T>): Observable<S, T>
emit(type: S, data: T): Observable<S, T>

@@ -96,0 +96,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc