@cycle/core
Advanced tools
Comparing version 7.0.0-rc4 to 7.0.0-rc5
@@ -124,3 +124,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Cycle = f()}})(function(){var define,module,exports;return (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(require,module,exports){ | ||
for (var k in sources) { | ||
if (sources.hasOwnProperty(k) && typeof sources[k].dispose === 'function') { | ||
if (sources.hasOwnProperty(k) && sources[k] && typeof sources[k].dispose === 'function') { | ||
sources[k].dispose(); | ||
@@ -127,0 +127,0 @@ } |
@@ -1,1 +0,1 @@ | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Cycle=f()}})(function(){var define,module,exports;return 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(require,module,exports){"use strict";var base_1=require("@cycle/base");var rx_adapter_1=require("@cycle/rx-adapter");var Cycle=function Cycle(main,drivers){return base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default})};function run(main,drivers){var run=base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default}).run;return run()}exports.run=run;Cycle.run=run;Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{"@cycle/base":2,"@cycle/rx-adapter":3}],2:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};function makeSinkProxies(drivers,streamAdapter){var sinkProxies={};for(var name_1 in drivers){if(drivers.hasOwnProperty(name_1)){var holdSubject=streamAdapter.makeHoldSubject();var driverStreamAdapter=drivers[name_1].streamAdapter||streamAdapter;var stream=driverStreamAdapter.adapt(holdSubject.stream,streamAdapter.streamSubscribe);sinkProxies[name_1]={stream:stream,observer:holdSubject.observer}}}return sinkProxies}function callDrivers(drivers,sinkProxies,streamAdapter){var sources={};for(var name_2 in drivers){if(drivers.hasOwnProperty(name_2)){var driverOutput=drivers[name_2](sinkProxies[name_2].stream,streamAdapter,name_2);var driverStreamAdapter=drivers[name_2].streamAdapter;if(driverStreamAdapter&&driverStreamAdapter.isValidStream(driverOutput)){sources[name_2]=streamAdapter.adapt(driverOutput,driverStreamAdapter.streamSubscribe)}else{sources[name_2]=driverOutput}}}return sources}function replicateMany(sinks,sinkProxies,streamAdapter){var results=Object.keys(sinks).filter(function(name){return!!sinkProxies[name]}).map(function(name){return streamAdapter.streamSubscribe(sinks[name],sinkProxies[name].observer)});var disposeFunctions=results.filter(function(dispose){return typeof dispose==="function"});return function(){disposeFunctions.forEach(function(dispose){return dispose()})}}function disposeSources(sources){for(var k in sources){if(sources.hasOwnProperty(k)&&typeof sources[k].dispose==="function"){sources[k].dispose()}}}var isObjectEmpty=function isObjectEmpty(obj){return Object.keys(obj).length===0};function Cycle(main,drivers,options){if(typeof main!=="function"){throw new Error("First argument given to Cycle must be the 'main' "+"function.")}if((typeof drivers==="undefined"?"undefined":_typeof(drivers))!=="object"||drivers===null){throw new Error("Second argument given to Cycle must be an object "+"with driver functions as properties.")}if(isObjectEmpty(drivers)){throw new Error("Second argument given to Cycle must be an object "+"with at least one driver function declared as a property.")}var streamAdapter=options.streamAdapter;if(!streamAdapter||isObjectEmpty(streamAdapter)){throw new Error("Third argument given to Cycle must be an options object "+"with the streamAdapter key supplied with a valid stream adapter.")}var sinkProxies=makeSinkProxies(drivers,streamAdapter);var sources=callDrivers(drivers,sinkProxies,streamAdapter);var sinks=main(sources);var run=function run(){var disposeReplication=replicateMany(sinks,sinkProxies,streamAdapter);return function(){streamAdapter.dispose(sinks,sinkProxies,sources);disposeSources(sources);disposeReplication()}};return{sinks:sinks,sources:sources,run:run}}Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{}],3:[function(require,module,exports){"use strict";var rx_1=require("rx");function logToConsoleError(err){var target=err.stack||err;if(console&&console.error){console.error(target)}else if(console&&console.log){console.log(target)}}var RxJSAdapter={adapt:function(originStream,originStreamSubscribe){if(this.isValidStream(originStream)){return originStream}return rx_1.Observable.create(function(destinationObserver){var originObserver={next:function(x){return destinationObserver.onNext(x)},error:function(e){return destinationObserver.onError(e)},complete:function(){return destinationObserver.onCompleted()}};var dispose=originStreamSubscribe(originStream,originObserver);return function(){if(typeof dispose==="function"){dispose.call(null)}}})},dispose:function(sinks,sinkProxies,sources){Object.keys(sources).forEach(function(k){if(typeof sources[k].dispose==="function"){sources[k].dispose()}});Object.keys(sinkProxies).forEach(function(k){sinkProxies[k].observer.complete()})},makeHoldSubject:function(){var stream=new rx_1.ReplaySubject(1);var observer={next:function(x){stream.onNext(x)},error:function(err){logToConsoleError(err);stream.onError(err)},complete:function(x){stream.onCompleted()}};return{stream:stream,observer:observer}},isValidStream:function(stream){return typeof stream.subscribeOnNext==="function"&&typeof stream.onValue!=="function"},streamSubscribe:function(stream,observer){var subscription=stream.subscribe(function(x){return observer.next(x)},function(e){return observer.error(e)},function(){return observer.complete()});return function(){subscription.dispose()}}};Object.defineProperty(exports,"__esModule",{value:true});exports.default=RxJSAdapter},{rx:undefined}]},{},[1])(1)}); | ||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Cycle=f()}})(function(){var define,module,exports;return 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(require,module,exports){"use strict";var base_1=require("@cycle/base");var rx_adapter_1=require("@cycle/rx-adapter");var Cycle=function Cycle(main,drivers){return base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default})};function run(main,drivers){var run=base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default}).run;return run()}exports.run=run;Cycle.run=run;Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{"@cycle/base":2,"@cycle/rx-adapter":3}],2:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};function makeSinkProxies(drivers,streamAdapter){var sinkProxies={};for(var name_1 in drivers){if(drivers.hasOwnProperty(name_1)){var holdSubject=streamAdapter.makeHoldSubject();var driverStreamAdapter=drivers[name_1].streamAdapter||streamAdapter;var stream=driverStreamAdapter.adapt(holdSubject.stream,streamAdapter.streamSubscribe);sinkProxies[name_1]={stream:stream,observer:holdSubject.observer}}}return sinkProxies}function callDrivers(drivers,sinkProxies,streamAdapter){var sources={};for(var name_2 in drivers){if(drivers.hasOwnProperty(name_2)){var driverOutput=drivers[name_2](sinkProxies[name_2].stream,streamAdapter,name_2);var driverStreamAdapter=drivers[name_2].streamAdapter;if(driverStreamAdapter&&driverStreamAdapter.isValidStream(driverOutput)){sources[name_2]=streamAdapter.adapt(driverOutput,driverStreamAdapter.streamSubscribe)}else{sources[name_2]=driverOutput}}}return sources}function replicateMany(sinks,sinkProxies,streamAdapter){var results=Object.keys(sinks).filter(function(name){return!!sinkProxies[name]}).map(function(name){return streamAdapter.streamSubscribe(sinks[name],sinkProxies[name].observer)});var disposeFunctions=results.filter(function(dispose){return typeof dispose==="function"});return function(){disposeFunctions.forEach(function(dispose){return dispose()})}}function disposeSources(sources){for(var k in sources){if(sources.hasOwnProperty(k)&&sources[k]&&typeof sources[k].dispose==="function"){sources[k].dispose()}}}var isObjectEmpty=function isObjectEmpty(obj){return Object.keys(obj).length===0};function Cycle(main,drivers,options){if(typeof main!=="function"){throw new Error("First argument given to Cycle must be the 'main' "+"function.")}if((typeof drivers==="undefined"?"undefined":_typeof(drivers))!=="object"||drivers===null){throw new Error("Second argument given to Cycle must be an object "+"with driver functions as properties.")}if(isObjectEmpty(drivers)){throw new Error("Second argument given to Cycle must be an object "+"with at least one driver function declared as a property.")}var streamAdapter=options.streamAdapter;if(!streamAdapter||isObjectEmpty(streamAdapter)){throw new Error("Third argument given to Cycle must be an options object "+"with the streamAdapter key supplied with a valid stream adapter.")}var sinkProxies=makeSinkProxies(drivers,streamAdapter);var sources=callDrivers(drivers,sinkProxies,streamAdapter);var sinks=main(sources);var run=function run(){var disposeReplication=replicateMany(sinks,sinkProxies,streamAdapter);return function(){streamAdapter.dispose(sinks,sinkProxies,sources);disposeSources(sources);disposeReplication()}};return{sinks:sinks,sources:sources,run:run}}Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{}],3:[function(require,module,exports){"use strict";var rx_1=require("rx");function logToConsoleError(err){var target=err.stack||err;if(console&&console.error){console.error(target)}else if(console&&console.log){console.log(target)}}var RxJSAdapter={adapt:function(originStream,originStreamSubscribe){if(this.isValidStream(originStream)){return originStream}return rx_1.Observable.create(function(destinationObserver){var originObserver={next:function(x){return destinationObserver.onNext(x)},error:function(e){return destinationObserver.onError(e)},complete:function(){return destinationObserver.onCompleted()}};var dispose=originStreamSubscribe(originStream,originObserver);return function(){if(typeof dispose==="function"){dispose.call(null)}}})},dispose:function(sinks,sinkProxies,sources){Object.keys(sources).forEach(function(k){if(typeof sources[k].dispose==="function"){sources[k].dispose()}});Object.keys(sinkProxies).forEach(function(k){sinkProxies[k].observer.complete()})},makeHoldSubject:function(){var stream=new rx_1.ReplaySubject(1);var observer={next:function(x){stream.onNext(x)},error:function(err){logToConsoleError(err);stream.onError(err)},complete:function(x){stream.onCompleted()}};return{stream:stream,observer:observer}},isValidStream:function(stream){return typeof stream.subscribeOnNext==="function"&&typeof stream.onValue!=="function"},streamSubscribe:function(stream,observer){var subscription=stream.subscribe(function(x){return observer.next(x)},function(e){return observer.error(e)},function(){return observer.complete()});return function(){subscription.dispose()}}};Object.defineProperty(exports,"__esModule",{value:true});exports.default=RxJSAdapter},{rx:undefined}]},{},[1])(1)}); |
{ | ||
"name": "@cycle/core", | ||
"version": "7.0.0-rc4", | ||
"version": "7.0.0-rc5", | ||
"author": "Andre Staltz", | ||
@@ -25,3 +25,3 @@ "description": "The Cycle run() function meant to be used with RxJS v4", | ||
"dependencies": { | ||
"@cycle/base": "^2.0.1", | ||
"@cycle/base": "^2.0.2", | ||
"@cycle/rx-adapter": "^1.0.3" | ||
@@ -28,0 +28,0 @@ }, |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
3
6
47610
26
703
Updated@cycle/base@^2.0.2