MCPcopy Create free account
hub / github.com/marijnh/Eloquent-JavaScript / compareClipped

Function compareClipped

src/run_tests.mjs:158–167  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

156}
157
158function compareClipped(a, b) {
159 a = a.split("\n")
160 b = b.split("\n")
161 if (a.length != b.length) return false
162 for (let i = 0; i < a.length; ++i) {
163 let len = Math.max(0, a[i].length - 1)
164 if (a[i].slice(0, len) != b[i].slice(0, len)) return false
165 }
166 return true
167}
168
169function compareJoined(a, b) {
170 return a.replace(/\n\s*/g, " ").trim() == b.replace(/\n\s*/g, " ").trim()

Callers 1

run_tests.mjsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected