content-entry-transform 1.5.17 → 1.5.18
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/README.md +1 -1
- package/package.json +1 -1
- package/src/expression-transformer.mjs +7 -3
- package/src/transform.mjs +1 -1
package/README.md
CHANGED
|
@@ -57,7 +57,7 @@ Apply transformers.
|
|
|
57
57
|
|
|
58
58
|
* `source` **AsyncIterable\<ContentEntry>** 
|
|
59
59
|
* `transformers` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Transformer>** (optional, default `[]`)
|
|
60
|
-
* `onlyMatching` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** filter out all none matching entries
|
|
60
|
+
* `onlyMatching` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** filter out all none matching entries (optional, default `false`)
|
|
61
61
|
|
|
62
62
|
# install
|
|
63
63
|
|
package/package.json
CHANGED
|
@@ -12,9 +12,9 @@ export function createPropertiesInterceptor(properties) {
|
|
|
12
12
|
) {
|
|
13
13
|
function ev(e, deepth) {
|
|
14
14
|
if (deepth > 9) {
|
|
15
|
-
throw new Error(
|
|
16
|
-
|
|
17
|
-
);
|
|
15
|
+
throw new Error(`Circular reference evaluating: ${expression}`, {
|
|
16
|
+
cause: expression
|
|
17
|
+
});
|
|
18
18
|
}
|
|
19
19
|
let value = properties[e];
|
|
20
20
|
if (value !== undefined) {
|
|
@@ -67,6 +67,10 @@ export function createExpressionTransformer(
|
|
|
67
67
|
name,
|
|
68
68
|
match,
|
|
69
69
|
transform: async entry => {
|
|
70
|
+
if (entry.isCollection) {
|
|
71
|
+
return entry;
|
|
72
|
+
}
|
|
73
|
+
|
|
70
74
|
const stream = await entry.stream;
|
|
71
75
|
const ne = new IteratorContentEntry(
|
|
72
76
|
entry.name,
|
package/src/transform.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { ContentEntry } from "content-entry";
|
|
|
10
10
|
* @param {Transformer[]} transformers
|
|
11
11
|
* @param {boolean} onlyMatching filter out all none matching entries
|
|
12
12
|
*/
|
|
13
|
-
export async function* transform(source, transformers = [], onlyMatching) {
|
|
13
|
+
export async function* transform(source, transformers = [], onlyMatching=false) {
|
|
14
14
|
const usedTransformers = new Set();
|
|
15
15
|
|
|
16
16
|
for await (let entry of source) {
|