Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cycle-gear

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cycle-gear - npm Package Compare versions

Comparing version 7.3.0 to 7.4.0

5

dist-es2015/index.d.ts

@@ -29,2 +29,3 @@ import { Observable } from 'xstream';

export interface PedalOptions {
cacheModel?: boolean;
defaultGear?: Gear<any, any>;

@@ -43,3 +44,3 @@ defaultFilter?: (model: any) => boolean;

}
export declare function pedal(transmission: Transmission, {defaultGear, defaultFilter, sinkMap, sourcesWrapper}?: PedalOptions): (sources: any) => {};
export declare function motor(gearbox: Gearbox, {defaultGear, defaultFilter, defaultConnector, cumulative, sourcesWrapper, connectors, sinkMap}?: MotorOptions): (sources: any) => {};
export declare function pedal(transmission: Transmission, {cacheModel, defaultGear, defaultFilter, sinkMap, sourcesWrapper}?: PedalOptions): (sources: any) => {};
export declare function motor(gearbox: Gearbox, {cacheModel, defaultGear, defaultFilter, defaultConnector, cumulative, sourcesWrapper, connectors, sinkMap}?: MotorOptions): (sources: any) => {};

22

dist-es2015/index.js

@@ -46,6 +46,6 @@ import { adapt } from '@cycle/run/lib/adapt';

}
function spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView, toothCombineGear = false, defaultConnector = {}, connectors = new Map()) {
const modelCache = new WeakMap();
function spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView, cacheModel = true, toothCombineGear = false, defaultConnector = {}, connectors = new Map()) {
const modelCache = cacheModel ? new WeakMap() : null;
return gear => {
let state = modelCache.get(gear);
let state = cacheModel ? modelCache.get(gear) : null;
if (!state) {

@@ -57,3 +57,5 @@ const wrappedSources = sourcesWrapper(sources, gear);

.remember();
modelCache.set(gear, state);
if (cacheModel) {
modelCache.set(gear, state);
}
}

@@ -78,3 +80,3 @@ const views = teeth.reduce((accum, tooth) => {

}
export function pedal(transmission, { defaultGear = { intent: () => ({}), model: () => xs.of({}), teeth: {} }, defaultFilter = () => true, sinkMap = new Map(), sourcesWrapper = (sources) => sources } = {}) {
export function pedal(transmission, { cacheModel = true, defaultGear = { intent: () => ({}), model: () => xs.of({}), teeth: {} }, defaultFilter = () => true, sinkMap = new Map(), sourcesWrapper = (sources) => sources } = {}) {
const { defaultIntent, defaultModel, defaultCatch, teeth, toothFilter, toothView, emptyTeeth } = defaultsAndHelpers(defaultGear, defaultFilter);

@@ -90,3 +92,3 @@ return (sources) => {

const spin = xs.fromObservable(gear)
.map(spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView))
.map(spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView, cacheModel))
.startWith(emptyTeeth)

@@ -101,5 +103,5 @@ .remember();

const defaultReduce = (acc, [cur, gear]) => Object.assign(acc, { [gear.name || '?']: cur });
function spinGears(sources, defaultIntent, defaultModel, defaultCatch, teeth, toothFilter, toothView, cumulative, sourcesWrapper, defaultConnector, connectors) {
function spinGears(sources, defaultIntent, defaultModel, cacheModel, defaultCatch, teeth, toothFilter, toothView, cumulative, sourcesWrapper, defaultConnector, connectors) {
const spinCache = new WeakMap();
const spinner = spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView, true, defaultConnector, connectors);
const spinner = spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView, cacheModel, true, defaultConnector, connectors);
return gears => {

@@ -121,3 +123,3 @@ const spins = [];

}
export function motor(gearbox, { defaultGear = { intent: () => ({}), model: () => xs.of({}), teeth: {} }, defaultFilter = () => true, defaultConnector = {}, cumulative = false, sourcesWrapper = (sources) => sources, connectors = new Map(), sinkMap = new Map() } = {}) {
export function motor(gearbox, { cacheModel = true, defaultGear = { intent: () => ({}), model: () => xs.of({}), teeth: {} }, defaultFilter = () => true, defaultConnector = {}, cumulative = false, sourcesWrapper = (sources) => sources, connectors = new Map(), sinkMap = new Map() } = {}) {
const { defaultIntent, defaultModel, defaultCatch, teeth, toothFilter, toothView } = defaultsAndHelpers(defaultGear, defaultFilter);

@@ -133,3 +135,3 @@ return (sources) => {

let spin = xs.fromObservable(gears)
.map(spinGears(sources, defaultIntent, defaultModel, defaultCatch, teeth, toothFilter, toothView, cumulative, sourcesWrapper, defaultConnector, connectors))
.map(spinGears(sources, defaultIntent, defaultModel, cacheModel, defaultCatch, teeth, toothFilter, toothView, cumulative, sourcesWrapper, defaultConnector, connectors))
.startWith([]);

@@ -136,0 +138,0 @@ if (cumulative) {

@@ -29,2 +29,3 @@ import { Observable } from 'xstream';

export interface PedalOptions {
cacheModel?: boolean;
defaultGear?: Gear<any, any>;

@@ -43,3 +44,3 @@ defaultFilter?: (model: any) => boolean;

}
export declare function pedal(transmission: Transmission, {defaultGear, defaultFilter, sinkMap, sourcesWrapper}?: PedalOptions): (sources: any) => {};
export declare function motor(gearbox: Gearbox, {defaultGear, defaultFilter, defaultConnector, cumulative, sourcesWrapper, connectors, sinkMap}?: MotorOptions): (sources: any) => {};
export declare function pedal(transmission: Transmission, {cacheModel, defaultGear, defaultFilter, sinkMap, sourcesWrapper}?: PedalOptions): (sources: any) => {};
export declare function motor(gearbox: Gearbox, {cacheModel, defaultGear, defaultFilter, defaultConnector, cumulative, sourcesWrapper, connectors, sinkMap}?: MotorOptions): (sources: any) => {};

@@ -88,9 +88,10 @@ "use strict";

}
function spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView, toothCombineGear, defaultConnector, connectors) {
function spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView, cacheModel, toothCombineGear, defaultConnector, connectors) {
if (cacheModel === void 0) { cacheModel = true; }
if (toothCombineGear === void 0) { toothCombineGear = false; }
if (defaultConnector === void 0) { defaultConnector = {}; }
if (connectors === void 0) { connectors = new Map(); }
var modelCache = new WeakMap();
var modelCache = cacheModel ? new WeakMap() : null;
return function (gear) {
var state = modelCache.get(gear);
var state = cacheModel ? modelCache.get(gear) : null;
if (!state) {

@@ -102,3 +103,5 @@ var wrappedSources = sourcesWrapper(sources, gear);

.remember();
modelCache.set(gear, state);
if (cacheModel) {
modelCache.set(gear, state);
}
}

@@ -125,4 +128,4 @@ var views = teeth.reduce(function (accum, tooth) {

function pedal(transmission, _a) {
var _b = _a === void 0 ? {} : _a, _c = _b.defaultGear, defaultGear = _c === void 0 ? { intent: function () { return ({}); }, model: function () { return xstream_1.default.of({}); }, teeth: {} } : _c, _d = _b.defaultFilter, defaultFilter = _d === void 0 ? function () { return true; } : _d, _e = _b.sinkMap, sinkMap = _e === void 0 ? new Map() : _e, _f = _b.sourcesWrapper, sourcesWrapper = _f === void 0 ? function (sources) { return sources; } : _f;
var _g = defaultsAndHelpers(defaultGear, defaultFilter), defaultIntent = _g.defaultIntent, defaultModel = _g.defaultModel, defaultCatch = _g.defaultCatch, teeth = _g.teeth, toothFilter = _g.toothFilter, toothView = _g.toothView, emptyTeeth = _g.emptyTeeth;
var _b = _a === void 0 ? {} : _a, _c = _b.cacheModel, cacheModel = _c === void 0 ? true : _c, _d = _b.defaultGear, defaultGear = _d === void 0 ? { intent: function () { return ({}); }, model: function () { return xstream_1.default.of({}); }, teeth: {} } : _d, _e = _b.defaultFilter, defaultFilter = _e === void 0 ? function () { return true; } : _e, _f = _b.sinkMap, sinkMap = _f === void 0 ? new Map() : _f, _g = _b.sourcesWrapper, sourcesWrapper = _g === void 0 ? function (sources) { return sources; } : _g;
var _h = defaultsAndHelpers(defaultGear, defaultFilter), defaultIntent = _h.defaultIntent, defaultModel = _h.defaultModel, defaultCatch = _h.defaultCatch, teeth = _h.teeth, toothFilter = _h.toothFilter, toothView = _h.toothView, emptyTeeth = _h.emptyTeeth;
return function (sources) {

@@ -137,3 +140,3 @@ var gear;

var spin = xstream_1.default.fromObservable(gear)
.map(spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView))
.map(spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView, cacheModel))
.startWith(emptyTeeth)

@@ -156,5 +159,5 @@ .remember();

};
function spinGears(sources, defaultIntent, defaultModel, defaultCatch, teeth, toothFilter, toothView, cumulative, sourcesWrapper, defaultConnector, connectors) {
function spinGears(sources, defaultIntent, defaultModel, cacheModel, defaultCatch, teeth, toothFilter, toothView, cumulative, sourcesWrapper, defaultConnector, connectors) {
var spinCache = new WeakMap();
var spinner = spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView, true, defaultConnector, connectors);
var spinner = spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView, cacheModel, true, defaultConnector, connectors);
return function (gears) {

@@ -188,4 +191,4 @@ var spins = [];

function motor(gearbox, _a) {
var _b = _a === void 0 ? {} : _a, _c = _b.defaultGear, defaultGear = _c === void 0 ? { intent: function () { return ({}); }, model: function () { return xstream_1.default.of({}); }, teeth: {} } : _c, _d = _b.defaultFilter, defaultFilter = _d === void 0 ? function () { return true; } : _d, _e = _b.defaultConnector, defaultConnector = _e === void 0 ? {} : _e, _f = _b.cumulative, cumulative = _f === void 0 ? false : _f, _g = _b.sourcesWrapper, sourcesWrapper = _g === void 0 ? function (sources) { return sources; } : _g, _h = _b.connectors, connectors = _h === void 0 ? new Map() : _h, _j = _b.sinkMap, sinkMap = _j === void 0 ? new Map() : _j;
var _k = defaultsAndHelpers(defaultGear, defaultFilter), defaultIntent = _k.defaultIntent, defaultModel = _k.defaultModel, defaultCatch = _k.defaultCatch, teeth = _k.teeth, toothFilter = _k.toothFilter, toothView = _k.toothView;
var _b = _a === void 0 ? {} : _a, _c = _b.cacheModel, cacheModel = _c === void 0 ? true : _c, _d = _b.defaultGear, defaultGear = _d === void 0 ? { intent: function () { return ({}); }, model: function () { return xstream_1.default.of({}); }, teeth: {} } : _d, _e = _b.defaultFilter, defaultFilter = _e === void 0 ? function () { return true; } : _e, _f = _b.defaultConnector, defaultConnector = _f === void 0 ? {} : _f, _g = _b.cumulative, cumulative = _g === void 0 ? false : _g, _h = _b.sourcesWrapper, sourcesWrapper = _h === void 0 ? function (sources) { return sources; } : _h, _j = _b.connectors, connectors = _j === void 0 ? new Map() : _j, _k = _b.sinkMap, sinkMap = _k === void 0 ? new Map() : _k;
var _l = defaultsAndHelpers(defaultGear, defaultFilter), defaultIntent = _l.defaultIntent, defaultModel = _l.defaultModel, defaultCatch = _l.defaultCatch, teeth = _l.teeth, toothFilter = _l.toothFilter, toothView = _l.toothView;
return function (sources) {

@@ -200,3 +203,3 @@ var gears;

var spin = xstream_1.default.fromObservable(gears)
.map(spinGears(sources, defaultIntent, defaultModel, defaultCatch, teeth, toothFilter, toothView, cumulative, sourcesWrapper, defaultConnector, connectors))
.map(spinGears(sources, defaultIntent, defaultModel, cacheModel, defaultCatch, teeth, toothFilter, toothView, cumulative, sourcesWrapper, defaultConnector, connectors))
.startWith([]);

@@ -203,0 +206,0 @@ if (cumulative) {

@@ -40,2 +40,3 @@ import { adapt } from '@cycle/run/lib/adapt'

export interface PedalOptions {
cacheModel?: boolean
defaultGear?: Gear<any, any>

@@ -108,8 +109,9 @@ defaultFilter?: (model: any) => boolean

toothView: (name: string, tooth: GearTooth<any> | GearView<any>) => GearView<any>,
cacheModel = true,
toothCombineGear = false,
defaultConnector: ToothConnector<any, any, any, any> = {},
connectors: Map<string, ToothConnector<any, any, any, any>> = new Map()): (t: Gear<any, any>) => {} {
const modelCache = new WeakMap<Gear<any, any>, xs<any>>()
const modelCache = cacheModel ? new WeakMap<Gear<any, any>, xs<any>>() : null
return gear => {
let state = modelCache.get(gear)
let state = cacheModel ? modelCache!.get(gear) : null
if (!state) {

@@ -121,3 +123,5 @@ const wrappedSources = sourcesWrapper(sources, gear)

.remember()
modelCache.set(gear, state)
if (cacheModel) {
modelCache!.set(gear, state)
}
}

@@ -145,2 +149,3 @@ const views = teeth.reduce((accum, tooth) => {

export function pedal(transmission: Transmission, {
cacheModel = true,
defaultGear = { intent: () => ({}), model: () => xs.of({}), teeth: {} as GearTeeth<any> },

@@ -170,3 +175,3 @@ defaultFilter = () => true,

const spin = xs.fromObservable<Gear<any, any>>(gear)
.map(spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView))
.map(spinGear(sources, defaultIntent, defaultModel, defaultCatch, sourcesWrapper, teeth, toothFilter, toothView, cacheModel))
.startWith(emptyTeeth)

@@ -189,2 +194,3 @@ .remember()

defaultModel: (actions: any) => Observable<any>,
cacheModel: boolean,
defaultCatch: (error: any, actions: any) => Observable<any>,

@@ -207,2 +213,3 @@ teeth: string[],

toothView,
cacheModel,
true,

@@ -228,2 +235,3 @@ defaultConnector,

export function motor(gearbox: Gearbox, {
cacheModel = true,
defaultGear = { intent: () => ({}), model: () => xs.of({}), teeth: {} as GearTeeth<any> },

@@ -258,2 +266,3 @@ defaultFilter = () => true,

defaultModel,
cacheModel,
defaultCatch,

@@ -260,0 +269,0 @@ teeth,

{
"name": "cycle-gear",
"version": "7.3.0",
"version": "7.4.0",
"description": "Main function factory for CycleJS",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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