MCPcopy
hub / github.com/observing/pre-commit / Hook

Function Hook

index.js:17–31  ·  view source on GitHub ↗

* Representation of a hook runner. * * @constructor * @param {Function} fn Function to be called when we want to exit * @param {Object} options Optional configuration, primarily used for testing. * @api public

(fn, options)

Source from the content-addressed store, hash-verified

15 * @api public
16 */
17function Hook(fn, options) {
18 if (!this) return new Hook(fn, options);
19 options = options || {};
20
21 this.options = options; // Used for testing only. Ignore this. Don't touch.
22 this.config = {}; // pre-commit configuration from the `package.json`.
23 this.json = {}; // Actual content of the `package.json`.
24 this.npm = ''; // The location of the `npm` binary.
25 this.git = ''; // The location of the `git` binary.
26 this.root = ''; // The root location of the .git folder.
27 this.status = ''; // Contents of the `git status`.
28 this.exit = fn; // Exit function.
29
30 this.initialize();
31}
32
33/**
34 * Boolean indicating if we're allowed to output progress information into the

Callers 1

test.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected