From 3d1cd02f27518f1a04374c7c8320cd5d82ede6e9 Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 23 Feb 2023 19:34:56 +0100 Subject: Updated 40 files, added 37 files, deleted 1103 files and renamed 3905 files (automated) --- .../examples/leave-only-opening-td.js | 62 ---------------------- 1 file changed, 62 deletions(-) delete mode 100644 school/node_modules/string-strip-html/examples/leave-only-opening-td.js (limited to 'school/node_modules/string-strip-html/examples/leave-only-opening-td.js') diff --git a/school/node_modules/string-strip-html/examples/leave-only-opening-td.js b/school/node_modules/string-strip-html/examples/leave-only-opening-td.js deleted file mode 100644 index e8ba37f..0000000 --- a/school/node_modules/string-strip-html/examples/leave-only-opening-td.js +++ /dev/null @@ -1,62 +0,0 @@ -// Leave only opening `td` tags - -import { strict as assert } from "assert"; -import { stripHtml } from "../dist/string-strip-html.esm.js"; - -const someHtml = ` - - - - - - - - -
- cell1 - - cell2 -
- cell3 - - cell4 -
`; - -// the first way -// ----------------------------------------------------------------------------- - -assert.equal( - stripHtml(someHtml, { - // notice there's no: onlyStripTags: ["td"] - // we operate purely via callback - cb: ({ tag, deleteFrom, deleteTo, insert, rangesArr, proposedReturn }) => { - if (tag.name === "td" && !tag.slashPresent) { - rangesArr.push(proposedReturn); - } - }, - }).ranges.reduce( - (acc, [from, to]) => `${acc}${someHtml.slice(from, to).trim()}`, - "" - ), - `` -); - -// the second way: -// ----------------------------------------------------------------------------- - -let resultStr = ""; -// notice we don't even assign stripHtml() output to anything - we rely only -// on the callback, it mutates the "resultStr" in the upper scope -stripHtml(someHtml, { - // notice there's no: onlyStripTags: ["td"] - // we operate purely via callback - cb: ({ tag, deleteFrom, deleteTo, insert, rangesArr, proposedReturn }) => { - if (tag.name === "td" && !tag.slashPresent) { - resultStr += someHtml.slice(deleteFrom, deleteTo).trim(); - } - }, -}); -assert.equal( - resultStr, - `` -); -- cgit