UNPKG

@arthurgubaidullin/nx-embed-dependencies

Version:

This plugin for [Nx](https://nx.dev) helps injecting local dependencies into a package.

10 lines 758 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.time = void 0; const function_1 = require("fp-ts/function"); const T = require("fp-ts/Task"); function time(functionName, options) { return (t) => (0, function_1.pipe)(T.Do, T.bind('before', () => T.fromIO(performance.now)), T.bind('result', () => t), T.bind('after', () => T.fromIO(performance.now)), T.let('performance', ({ before, after }) => Math.floor(after - before)), T.let('message', ({ performance }) => `The \`${functionName}\` function took ${performance} milliseconds.`), T.chainFirstIOK(({ message }) => options.isVerbose ? () => console.log(message) : function_1.constVoid), T.map((a) => a.result)); } exports.time = time; //# sourceMappingURL=time.js.map