Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@nichoth/events

Package Overview
Dependencies
Maintainers
1
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nichoth/events - npm Package Compare versions

Comparing version
3.1.7
to
3.1.8
+2
-3
package.json
{
"name": "@nichoth/events",
"version": "3.1.7",
"version": "3.1.8",
"description": "Event emitter and helpers",

@@ -30,3 +30,3 @@ "directories": {

"test": "tsc --project tsconfig.build.json && npm run build-tests && NODE_ENV=test node ./test/index.js | tap-arc",
"build-cjs": "esbuild src/*.ts --format=cjs --keep-names --outdir=./dist --out-extension:.js=.cjs",
"build-cjs": "esbuild src/*.ts --tsconfig=./tsconfig.build.json --format=cjs --keep-names --outdir=./dist --out-extension:.js=.cjs",
"build": "mkdir -p ./dist && rm -rf ./dist/* && npm run build-cjs && tsc --project tsconfig.build.json && npm run build:min",

@@ -40,3 +40,2 @@ "build:min": "mkdir -p dist && esbuild src/index.ts --keep-names --minify --outfile=dist/index.min.js",

"devDependencies": {
"@socketsupply/tapzero": "^0.7.1",
"@typescript-eslint/eslint-plugin": "^6.7.0",

@@ -43,0 +42,0 @@ "@typescript-eslint/parser": "^6.0.0",

+22
-21

@@ -26,23 +26,2 @@ # events ![tests](https://github.com/nichoth/events/actions/workflows/nodejs.yml/badge.svg)

### Bus.flatten
Get an array of the leaf node values of an object of any shape, for example the return value of `Bus.createEvents`.
It's recommended to use the `.flatten` static function to get the event name values after calling `.createEvents`. Or, if you pass in anything that is not an array, the constructor will call `.flatten` on it.
```js
import { Bus } from '@nichoth/events'
const events = Bus.createEvents({
a: {
_: [1, 2, 3]
b: {
c: [1,2,3]
}
}
})
const bus = new Bus(Bus.flatten(events))
// is the same as
const bust2 = new Bus(events)
```
### create namespaced events

@@ -80,2 +59,24 @@ Take an object of arrays of strings, and return a new object where the leaf nodes are strings containing the full object path.

### Bus.flatten
Get an array of the leaf node values of an object of any shape, for example the return value of `Bus.createEvents`.
It's recommended to use the `.flatten` static function to get the event name values after calling `.createEvents`. Or, if you pass in anything that is not an array, the constructor will call `.flatten` on it.
```js
import { Bus } from '@nichoth/events'
const events = Bus.createEvents({
a: {
_: [1, 2, 3]
b: {
c: [1,2,3]
}
}
})
// pass in a list of valid event names
const bus = new Bus(Bus.flatten(events))
// is the same as
const bust2 = new Bus(events)
```
### subscribe

@@ -82,0 +83,0 @@ ```js