Cannot read property '.js' of undefined

Open
#1 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
20/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, node.js
Domain
tooling

Research direction

Start by reproducing the reported hook.hook('.js', Request) call and the subsequent require('./node_modules/module_name/index') from the issue body. Trace the node-hook require entry point to identify why the .js hook produces the reported error; done means determining whether this usage is supported and documenting or fixing the observed behavior.

Written by the indexing model from the issue text.

Description

Hi,

I am trying to hook a function in node module, but I got error as mentioned in the title, below is my code:

var hook = require('node-hook');
function Request(method, url) {
alert(url);
}
hook.hook('.js', Request);
require('./node_modules/module_name/index');

Is it possible on the way I am trying to archive?

Dominant language
JavaScript
Stars
66
Forks
7
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bahmutov/node-hook

All issues in bahmutov/node-hook

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.