检查传递给节点C ++插件的参数是Infinity还是NaN

时间:2015-08-01 03:04:42

标签: c++ node.js node.js-addon

如何检查直接传递给节点C ++插件(不是通过JS包装器)的参数是NaN还是+/- Infinity?

我尝试frexp(arg[0]->NumberValue(), &exponent),目的是检查指数是否为2047(JS如何表示NaN和Infinity),但显然Local<Value>->NumberValue()模糊了double并更改了exp值。

1 个答案:

答案 0 :(得分:1)

对于C ++ 11,回复是

Template.home.helpers({

  todos: function() {
  return Todos.find();
},


todoCount: function() {
  return Todos.find({userid: Meteor.userId()}).count();
},

  settings: function() {
    return {
      position: "top",
      limit: 5,
      rules: [
        {
          token: '@',
          collection: 'Todos',
          field: "title",
          subscription: 'todosAuto',
          template: Template.titlePill
        },
        {
          token: '#',
          collection: 'Todos',
          field: "categories",
          options: '',
          subscription: 'todosAuto',
          matchAll: true,
          template: Template.dataPiece
        }
      ]
    };
  }

});

Template.home.events({ // listen for selection and subscribe
  "autocompleteselect input": function(event, template, doc) {

   Meteor.subscribe("todosAuto", doc.title);
  }
});