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

emmi

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emmi - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

dist/either.test.d.ts

19

dist/index.js

@@ -21,4 +21,16 @@ function emmi() {

function emit(key, data) {
const replies = (listeners.get(key) || []).map((fn) => fn(data));
(replyListeners.get(key) || []).forEach((fn) => fn(replies));
let replies = [];
const l = listeners.get(key) || [];
let i = -1;
while (l.length > ++i) {
const fn = l[i];
const res = fn(data);
res !== void 0 && replies.push(res);
}
const rl = replyListeners.get(key) || [];
i = -1;
while (rl.length > ++i) {
const fn = rl[i];
fn(replies);
}
return replies;

@@ -43,3 +55,4 @@ }

if (handlers) {
handlers.splice(handlers.indexOf(listener) >>> 0, 1);
const index = handlers.indexOf(listener);
index !== -1 && handlers.splice(index, 1);
}

@@ -46,0 +59,0 @@ }

10

package.json
{
"name": "emmi",
"version": "0.0.1",
"version": "0.1.0",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",

@@ -9,3 +10,4 @@ "types": "./dist/index.d.ts",

".": {
"import": "./dist/index.js"
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}

@@ -19,6 +21,8 @@ },

"build": "vite build",
"test": "vitest"
"test": "vitest",
"prepublishOnly": "vitest run && npm run build"
},
"devDependencies": {
"@types/node": "^20.4.8",
"@vitest/coverage-v8": "^0.34.1",
"prettier": "^3.0.1",

@@ -25,0 +29,0 @@ "typescript": "^5.0.2",

@@ -1,3 +0,10 @@

# mitti
# emmi
Inspired by [mitt](https://github.com/developit/mitt/tree/main), but with a few modifications.
> WIP
Inspired by [mitt](https://github.com/developit/mitt/tree/main), but with a few modifications. Main change is that events are typed with an `input` and `output` field.
This enables:
- `emit` returns an `Output[]` type when emitting an event.
- You can listen to event replies with `onReply`
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