Files
scriptc/tests/fixtures/npm/node_modules/cb/index.js
2026-07-22 18:08:04 -05:00

27 lines
593 B
JavaScript

"use strict";
exports.repeat = function repeat(n, fn) {
for (let i = 0; i < n; i++) fn(i, i * 2);
};
exports.transform = function transform(x, fn) {
return fn(x) + 1;
};
exports.tryCatch = function tryCatch(fn) {
try {
fn();
return "no throw";
} catch (e) {
return "caught: " + e;
}
};
exports.describeError = function describeError(fn) {
try {
fn();
return "no throw";
} catch (e) {
return [e instanceof Error, e.name, e.message, String(e)].join("|");
}
};
exports.throwTypeError = function throwTypeError() {
throw new TypeError("package boom");
};