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

@apicase/core

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apicase/core - npm Package Compare versions

Comparing version 0.7.0-beta.12 to 0.7.0-beta.13

21

es/apicase.js

@@ -115,3 +115,4 @@ import _default4 from 'nanoutils/lib/mapObjIndexed';

off: (evt, cb) => {
const idx = bus.events.indexOf(cb);
if (!bus.events[evt]) return res;
const idx = bus.events[evt].indexOf(cb);
if (idx !== -1) {

@@ -152,5 +153,5 @@ bus.events[name].splice(idx, 1);

/* TODO: reduce boilerplate for sets */
const setState = change => {
const setState = diff => {
const prev = _default3(getState());
const next = _default(prev, change);
const next = _default(prev, diff);
Object.assign(res, next);

@@ -160,9 +161,9 @@ bus.emit('change:state', {

next: next,
change: change
diff: diff
});
};
const setPayload = change => {
const setPayload = diff => {
const prev = _default3(res.payload);
const next = _default(prev, change);
const next = _default(prev, diff);
res.payload = next;

@@ -172,9 +173,9 @@ bus.emit('change:payload', {

next: next,
change: change
diff: diff
});
};
const setResult = change => {
const setResult = diff => {
const prev = _default3(res.result);
const next = _default(prev, change);
const next = _default(prev, diff);
res.result = next;

@@ -184,3 +185,3 @@ bus.emit('change:result', {

next: next,
change: change
diff: diff
});

@@ -187,0 +188,0 @@ };

@@ -10,7 +10,9 @@ import NanoEvents from 'nanoevents';

export function ApiQueue(opts) {
opts = Object.assign({ immediate: true }, opts);
opts = Object.assign({ immediate: true }, opts || {});
this.queue = [];
const bus = new NanoEvents();
this.push = function (cb, opts) {
this.push = function (cb, payload, opts) {
opts = typeof payload === 'function' ? opts : Object.assign({}, payload, opts);
const request = cb(mergeOptions(null, [opts, { options: { immediate: false, timer: null } }]));

@@ -37,6 +39,6 @@

preLast.on('done', () => {
preLast.on('done', result => {
const idx = this.queue.indexOf(preLast) + 1;
if (this.queue[idx]) {
this.queue[idx].start();
this.queue[idx].start(typeof payload === 'function' ? payload(result) : payload);
}

@@ -62,2 +64,3 @@ });

this.off = function (evt, cb) {
if (!bus.events[evt]) return this;
const idx = bus.events.indexOf(cb);

@@ -64,0 +67,0 @@ if (idx !== -1) {

@@ -52,2 +52,3 @@ import _default2 from 'nanoutils/lib/equals';

this.off = function (evt, cb) {
if (!this._listeners[evt]) return this;
const idx = this._listeners[evt].indexOf(cb);

@@ -54,0 +55,0 @@ if (idx > -1) this._listeners[evt].splice(idx, 1);

{
"name": "@apicase/core",
"version": "0.7.0-beta.12",
"version": "0.7.0-beta.13",
"description": "Core library to make API calls with any adapter",

@@ -5,0 +5,0 @@ "main": "es/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