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 6978445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:45:27+00:00 2026-05-27T17:45:27+00:00

I use node.js for a while, now I need write an add-on, but I

  • 0

I use node.js for a while, now I need write an add-on, but I am a newb of c++.

in node.js I can pass optional arguments to function, and check their types.

function hello(arg, options, callback){
  if(!callback){
    if(typeof options === 'function'){
       callback = options;
       options = {};
    }
  }
  console.log(typeof arg);
}

But in an addon.

Handle<Value> hello(const Arguments &args) {
    HandleScope scope;
    printf("%d\n", args.Length());
    // how to check type of args[i]
    return String::New("world");
}
  • 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-27T17:45:28+00:00Added an answer on May 27, 2026 at 5:45 pm

    You should look over the API in http://v8.googlecode.com/svn/trunk/include/v8.h. Most of the functions you are interested are on the Value class. There is documentation online here, http://bespin.cz/~ondras/html/classv8_1_1Value.html but that looks like just some random person’s uploaded version of the docs. Not sure if they are online somewhere else.

    Something like this should do about the same thing as your JS snippet.

    Handle<Value> hello(const Arguments &args) {
      HandleScope scope;
      Local<Value> arg(args[0]);
      Local<Value> options(args[1]);
      Local<Value> callback(args[2]);
    
      if (callback.equals(False())) {
        if (options->IsFunction()) {
          callback = options;
          options = Object::New();
        }
      }
    
      // ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I use XPath to select an XML-node based on its content? If
I want to use LabVIEW's Call Library Function Node to access a DLL function,
I need to insert the comment form directly to the node template (I use
In the application that I'm working on right now, I need to periodically check
I've been struggling for a while now with an error I can't fix. I
Helo! Is this possible to use string value of one node which tells what
I am trying to implement the adaptive huffman code, but while trying to build
I'm new to xslt, and I'm out of ideas now. Hopefully you peeps can
I have been playing with CouchDB and CouchApp for a little while now. I
I have been working on JUNG2 for a while now, trying to visualize a

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.