Socket
Socket
Sign inDemoInstall

@thi.ng/defmulti

Package Overview
Dependencies
Maintainers
0
Versions
183
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/defmulti - npm Package Compare versions

Comparing version 3.0.39 to 3.0.40

8

CHANGELOG.md
# Change Log
- **Last updated**: 2024-05-08T18:24:31Z
- **Last updated**: 2024-06-21T19:34:38Z
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)

@@ -12,2 +12,8 @@

### [3.0.40](https://github.com/thi-ng/umbrella/tree/@thi.ng/defmulti@3.0.40) (2024-06-21)
#### ♻️ Refactoring
- enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
### [3.0.37](https://github.com/thi-ng/umbrella/tree/@thi.ng/defmulti@3.0.37) (2024-04-20)

@@ -14,0 +20,0 @@

22

defmulti.js

@@ -6,6 +6,6 @@ import { unsupported } from "@thi.ng/errors/unsupported";

const impls = {};
const rels = _rels ? makeRels(_rels) : {};
const rels = _rels ? __makeRels(_rels) : {};
const fn = (...args) => {
const id = f(...args);
const g = impls[id] || findImpl(impls, rels, id) || impls[DEFAULT];
const g = impls[id] || __findImpl(impls, rels, id) || impls[DEFAULT];
return g ? g(...args) : unsupported(`missing implementation for: "${id.toString()}"`);

@@ -36,3 +36,3 @@ };

const id = f(...args);
return !!(impls[id] || findImpl(impls, rels, id) || impls[DEFAULT]);
return !!(impls[id] || __findImpl(impls, rels, id) || impls[DEFAULT]);
};

@@ -50,3 +50,3 @@ fn.isa = (id, parent) => {

for (let id in rels) {
const impl = findImpl(impls, rels, id);
const impl = __findImpl(impls, rels, id);
if (impl) res.set(id, impl);

@@ -59,6 +59,6 @@ }

};
fn.implForID = (id) => impls[String(id)] || findImpl(impls, rels, id) || impls[DEFAULT];
fn.implForID = (id) => impls[String(id)] || __findImpl(impls, rels, id) || impls[DEFAULT];
fn.rels = () => rels;
fn.parents = (id) => rels[id];
fn.ancestors = (id) => new Set(findAncestors([], rels, id));
fn.ancestors = (id) => new Set(__findAncestors([], rels, id));
fn.dependencies = function* () {

@@ -75,11 +75,11 @@ for (let a in rels) {

}
const findImpl = (impls, rels, id) => {
const __findImpl = (impls, rels, id) => {
const parents = rels[id];
if (!parents) return;
for (let p of parents) {
let impl = impls[p] || findImpl(impls, rels, p);
let impl = impls[p] || __findImpl(impls, rels, p);
if (impl) return impl;
}
};
const findAncestors = (acc, rels, id) => {
const __findAncestors = (acc, rels, id) => {
const parents = rels[id];

@@ -89,3 +89,3 @@ if (parents) {

acc.push(p);
findAncestors(acc, rels, p);
__findAncestors(acc, rels, p);
}

@@ -95,3 +95,3 @@ }

};
const makeRels = (spec) => {
const __makeRels = (spec) => {
const rels = {};

@@ -98,0 +98,0 @@ for (let k in spec) {

{
"name": "@thi.ng/defmulti",
"version": "3.0.39",
"version": "3.0.40",
"description": "Dynamic, extensible multiple dispatch via user supplied dispatch function.",

@@ -13,3 +13,3 @@ "type": "module",

},
"homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/defmulti#readme",
"homepage": "https://thi.ng/defmulti",
"funding": [

@@ -40,11 +40,11 @@ {

"dependencies": {
"@thi.ng/api": "^8.11.2",
"@thi.ng/errors": "^2.5.7",
"@thi.ng/logger": "^3.0.12"
"@thi.ng/api": "^8.11.3",
"@thi.ng/errors": "^2.5.8",
"@thi.ng/logger": "^3.0.13"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.43.2",
"esbuild": "^0.21.1",
"@microsoft/api-extractor": "^7.47.0",
"esbuild": "^0.21.5",
"typedoc": "^0.25.13",
"typescript": "^5.4.5"
"typescript": "^5.5.2"
},

@@ -95,3 +95,3 @@ "keywords": [

},
"gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
}

@@ -10,3 +10,3 @@ <!-- This file is generated - DO NOT EDIT! -->

> [!NOTE]
> This is one of 192 standalone projects, maintained as part
> This is one of 193 standalone projects, maintained as part
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo

@@ -13,0 +13,0 @@ > and anti-framework.

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