@pie-lib/categorize 3.0.6-next.20261201094125 → 3.0.6-next.20261202142832
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +16 -16
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import t from "
|
|
3
|
-
import {
|
|
1
|
+
import e from "debug";
|
|
2
|
+
import { clone as t, remove as n } from "@pie-element/shared-lodash";
|
|
3
|
+
import { score as r } from "./scoring.js";
|
|
4
4
|
// src/index.ts
|
|
5
|
-
var i = "foo-two", a =
|
|
5
|
+
var i = "foo-two", a = e("@pie-lib:categorize"), o = (e, t, n) => n.reduce((n, r) => {
|
|
6
6
|
let i = f(e, n.choices);
|
|
7
7
|
return (r !== e || i < t) && n.choices.push(r), n;
|
|
8
8
|
}, { choices: [] }).choices, s = (e, t, n) => (t ||= [], t.reduce((t, r) => {
|
|
@@ -61,21 +61,21 @@ var i = "foo-two", a = t("@pie-lib:categorize"), o = (e, t, n) => n.reduce((n, r
|
|
|
61
61
|
}, e)), d = (e, t) => {
|
|
62
62
|
let n = t.reduce((t, n) => t + f(e, n.choices), 0);
|
|
63
63
|
return a("[countInAnswer] choiceId:", e, t), n;
|
|
64
|
-
}, f = (e, t) => (t || []).filter((t) => t === e).length, p = (e, t) => !e || !e.id || !Array.isArray(t) ? 0 : t.reduce((t, n) => t + (n.choices || []).filter((t) => t && t.id === e.id).length, 0), m = (e, t) => t.filter((t) => t.category !== e), h = (e,
|
|
65
|
-
if (!i ||
|
|
66
|
-
let i =
|
|
67
|
-
return
|
|
68
|
-
...
|
|
64
|
+
}, f = (e, t) => (t || []).filter((t) => t === e).length, p = (e, t) => !e || !e.id || !Array.isArray(t) ? 0 : t.reduce((t, n) => t + (n.choices || []).filter((t) => t && t.id === e.id).length, 0), m = (e, t) => t.filter((t) => t.category !== e), h = (e, r, i) => r.map((r) => {
|
|
65
|
+
if (!i || r.category === i) {
|
|
66
|
+
let i = t(r.choices);
|
|
67
|
+
return n(i, (t) => t === e), {
|
|
68
|
+
...r,
|
|
69
69
|
choices: i
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
return
|
|
73
|
-
}), g = (e, t, n) => (e.length === 0 || e.splice(t, 1, e.splice(n, 1, e[t])[0]), e), _ = (e, t, n) => n.map((n) => n.category === t ? (n.choices = n.choices.reduce((t, n) => (n.id === e.id ? t.findIndex((t) => t.id === e.id) === -1 && t.push(n) : t.push(n), t), []), n) : (n.choices = (n.choices || []).filter((t) => t !== e.id), n)), v = (e,
|
|
74
|
-
if (i.category ===
|
|
75
|
-
let
|
|
76
|
-
return a !== -1 &&
|
|
72
|
+
return r;
|
|
73
|
+
}), g = (e, t, n) => (e.length === 0 || e.splice(t, 1, e.splice(n, 1, e[t])[0]), e), _ = (e, t, n) => n.map((n) => n.category === t ? (n.choices = n.choices.reduce((t, n) => (n.id === e.id ? t.findIndex((t) => t.id === e.id) === -1 && t.push(n) : t.push(n), t), []), n) : (n.choices = (n.choices || []).filter((t) => t !== e.id), n)), v = (e, n, r, i) => (a("[removeChoiceFromCategory] choiceIndex:", r), i.map((i) => {
|
|
74
|
+
if (i.category === n) {
|
|
75
|
+
let n = t(i.choices), a = n.findIndex((t, n) => t === e && n >= r);
|
|
76
|
+
return a !== -1 && n.splice(a, 1), {
|
|
77
77
|
...i,
|
|
78
|
-
choices:
|
|
78
|
+
choices: n
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
return i;
|
|
@@ -147,4 +147,4 @@ var i = "foo-two", a = t("@pie-lib:categorize"), o = (e, t, n) => n.reduce((n, r
|
|
|
147
147
|
bestResponse: o
|
|
148
148
|
};
|
|
149
149
|
};
|
|
150
|
-
export { i as FooTwo, E as buildCategories, C as buildChoices, D as buildState, p as countChosen, d as countInAnswer, f as countInChoices, u as ensureNoExtraChoicesInAlternate, l as ensureNoExtraChoicesInAnswer, T as getAllPossibleResponses, w as getBuiltCategories, o as limitChoices, c as limitInArray, s as limitInArrays, x as moveChoiceToAlternate, b as moveChoiceToCategory, g as rearrangeChoices, h as removeAllChoices, m as removeCategory, y as removeChoiceFromAlternate, v as removeChoiceFromCategory,
|
|
150
|
+
export { i as FooTwo, E as buildCategories, C as buildChoices, D as buildState, p as countChosen, d as countInAnswer, f as countInChoices, u as ensureNoExtraChoicesInAlternate, l as ensureNoExtraChoicesInAnswer, T as getAllPossibleResponses, w as getBuiltCategories, o as limitChoices, c as limitInArray, s as limitInArrays, x as moveChoiceToAlternate, b as moveChoiceToCategory, g as rearrangeChoices, h as removeAllChoices, m as removeCategory, y as removeChoiceFromAlternate, v as removeChoiceFromCategory, r as score, S as stillSelectable, _ as verifyAllowMultiplePlacements };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/categorize",
|
|
3
|
-
"version": "3.0.6-next.
|
|
3
|
+
"version": "3.0.6-next.20261202142832",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"debug": "^4.1.1",
|
|
13
|
-
"@pie-element/shared-lodash": "0.1.7-next.
|
|
13
|
+
"@pie-element/shared-lodash": "0.1.7-next.20261202142832"
|
|
14
14
|
},
|
|
15
15
|
"type": "module",
|
|
16
16
|
"main": "./dist/index.js",
|