Module to validate and sum a string containing no negative numbers
module.exports is just an object. Set properties on it that you want to expose.



exports.add = add


This is also equivalent in this case.

module.exports = {add: add}


Now, when you require this module, you'll get an object with one property: add.

There are a few other small issues:

Nothing about your design depends on accessing methods via this. This module
is clearer without bringing this into the mix.

function add (string) {
  _checkForError(string)
  _checkForNegatives(string)
  return _result(string)
}


This code is quite easy to follow already, but It would be even better if you
had your methods in the order they are called so the code reads like an article:
broad info at the top, specific details later on.

I'd also leave out semicolons where they will be handled by automatic semicolon
insertion, but that's a style choice.

function _checkForError (string) {
  if (string.match(/\n$/)) {
    throw 'Expression ending in newline!'
  }
}

function _checkForNegatives (string) {
  var negatives = _negatives(string)
  if (negatives.length &gt; 0) {
    throw 'Negatives not allowed: ' + negatives.join(', ')
  }
}

function _negatives (string) {
  var numbers = _numbers(string)
  var negatives = numbers.filter(function (number) {
    return number &lt; 0
  })
  return negatives
}

function _result (string) {
  var numbers = _numbers(string)
  var result = numbers.reduce(function (sum, number) {
    return sum + number
  })
  return result
}

function _numbers (string) {
  var modded = _modded(string)
  var numbers = modded.map(function (number) {
    return parseInt(number, 10) || 0
  })
  return numbers
}

function _modded (string) {
  var delimiter = _delimiter(string)
  return string.replace(/\n/, delimiter).split(delimiter)
}

function _delimiter (string) {
  return (string.substr(0, 2) === '//') ? string[2] : ','
}