MCPcopy
hub / github.com/extractus/article-extractor / removeTransformations

Function removeTransformations

src/utils/transformation.js:48–64  ·  view source on GitHub ↗
(patterns)

Source from the content-addressed store, hash-verified

46 * @returns {number} Number of transformations removed
47 */
48export const removeTransformations = (patterns) => {
49 if (!patterns) {
50 const removed = transformations.length
51 transformations.length = 0
52 return removed
53 }
54 let removing = 0
55 for (let i = transformations.length - 1; i >= 0; i--) {
56 const { patterns: ipatterns } = transformations[i]
57 const matched = ipatterns.some((ptn) => patterns.some((pattern) => String(pattern) === String(ptn)))
58 if (matched) {
59 transformations.splice(i, 1)
60 removing += 1
61 }
62 }
63 return removing
64}
65
66/**
67 * Get a copy of all registered transformations.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…