Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7079215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:38:39+00:00 2026-05-28T06:38:39+00:00

I write my first module on nodejs. I need parse my site from google

  • 0

I write my first module on nodejs. I need parse my site from google cache. Post is map of table post. When i try use this module i have this error: “TypeError: Cannot set property ‘prototype’ of undefined”
How fix this error?It’s my code:

module.exports = function Post(documentDOM,options)
{
    this.opts = $.extend({id:0,author_id:0},options);
    this.doc = documentDOM;
    this.post  = {
        id: 0,
        name: '',
        alt_name: '',
        notice: '',
        content: '',
        author: '',
        author_id: 0,
    };
}

module.exports.Post.prototype = {
    init: function() {
        this.post.id = this.opts.id;
        this.post.author_id = this.opts.author_id;
    },

    content: function() {
        content = this.doc.find('.fullnews-content').html();
        if(!content.length)
            content = doc.find('.article-content').html();
        return content;
    }
}

Thank.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:38:39+00:00Added an answer on May 28, 2026 at 6:38 am
    module.exports = function Post((documentDOM,options)
    

    I think you meant

    module.exports.Post = function((documentDOM,options)
    

    And then access it like this

    var Post = require('./post.js').Post;
    

    With the first you’re making exports itself a named function, to modify it you would use module.exports.prototype.

    Relevant study material: http://kangax.github.com/nfe/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write a function to find the first non-repeating character in a
I am a novice to Python and have started to write my first module
This is my first post to stack overflow. I've been lurking this site for
So, I used the scribble/lp module to write my first literate program using plt-scheme:
I need to write some kernel module for my university classes and now I'm
Have had to write my first proper multithreaded coded recently, and realised just how
I am trying to write my first real python function that does something real.
I'm trying to write my first iterator class / container type. Basically, I want
I am trying to write my first WCF project. I have created a project
I'm trying to write my first iPhone app, and I'm using a date picker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.