You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP →

@transformation/core

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@transformation/core - npm Package Compare versions

Comparing version

to
4.2.0

{
"name": "@transformation/core",
"version": "4.1.2",
"version": "4.2.0",
"description": "Create transformation pipelines",

@@ -22,9 +22,9 @@ "main": "./src/index.js",

"lru": "^3.1.0",
"medium": "1.1.1"
"medium": "1.2.0"
},
"devDependencies": {
"mocha": "9.0.3",
"sinon": "^11.1.2",
"mocha": "9.1.4",
"sinon": "^12.0.1",
"unexpected": "12.0.3",
"unexpected-steps": "^4.1.0"
"unexpected-steps": "^4.2.0"
},

@@ -34,3 +34,3 @@ "engines": {

},
"gitHead": "6b0749ca6bee0bf4100c98a38ceaddd5615b6da6"
"gitHead": "88a4660cbb267db5a8ee7eb57bb38a528519c036"
}

@@ -787,4 +787,4 @@ # @transformation/core

[
Group.create({ key: "even", items: [0, 2, 4, 6] }),
Group.create({ key: "odd", items: [1, 3, 5] }),
{ key: "even", items: [0, 2, 4, 6] },
{ key: "odd", items: [1, 3, 5] },
]

@@ -810,3 +810,3 @@ );

[
Group.create({
{
key: "GOOG",

@@ -817,4 +817,4 @@ items: [

],
}),
Group.create({
},
{
key: "AAPL",

@@ -826,3 +826,3 @@ items: [

],
}),
},
]

@@ -1081,6 +1081,6 @@ );

[
Group.create({ key: "[0;1]", items: [0, 1] }),
Group.create({ key: "[2;3]", items: [2, 3] }),
Group.create({ key: "[4;5]", items: [4, 5] }),
Group.create({ key: "[6;7]", items: [6] }),
{ key: "[0;1]", items: [0, 1] },
{ key: "[2;3]", items: [2, 3] },
{ key: "[4;5]", items: [4, 5] },
{ key: "[6;7]", items: [6] },
]

@@ -1108,2 +1108,41 @@ );

),
partitionBy("symbol")
),
"to yield items",
[
{
key: "GOOG",
items: [{ symbol: "GOOG", price: 1349 }],
},
{
key: "AAPL",
items: [
{ symbol: "AAPL", price: 274 },
{ symbol: "AAPL", price: 275 },
],
},
{
key: "GOOG",
items: [{ symbol: "GOOG", price: 1351 }],
},
{
key: "AAPL",
items: [{ symbol: "AAPL", price: 279 }],
},
]
);
```
You can also use a function to select the discriminating value.
```js
await expect(
pipeline(
emitItems(
{ symbol: "GOOG", price: 1349 },
{ symbol: "AAPL", price: 274 },
{ symbol: "AAPL", price: 275 },
{ symbol: "GOOG", price: 1351 },
{ symbol: "AAPL", price: 279 }
),
partitionBy(({ symbol }) => symbol)

@@ -1113,7 +1152,7 @@ ),

[
Group.create({
{
key: "GOOG",
items: [{ symbol: "GOOG", price: 1349 }],
}),
Group.create({
},
{
key: "AAPL",

@@ -1124,11 +1163,11 @@ items: [

],
}),
Group.create({
},
{
key: "GOOG",
items: [{ symbol: "GOOG", price: 1351 }],
}),
Group.create({
},
{
key: "AAPL",
items: [{ symbol: "AAPL", price: 279 }],
}),
},
]

@@ -1931,3 +1970,3 @@ );

[
Group.create({
{
key: "GOOG",

@@ -1938,4 +1977,4 @@ items: [

],
}),
Group.create({
},
{
key: "AAPL",

@@ -1947,3 +1986,3 @@ items: [

],
}),
},
]

@@ -1950,0 +1989,0 @@ );