all files / semantic-graphql/src/utils/ invariant.js

100% Statements 7/7
100% Branches 2/2
100% Functions 1/1
100% Lines 7/7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15    95×            
// Inspired by Facebook's invariant
// https://github.com/facebook/react/blob/v0.13.3/src/vendor/core/invariant.js
function invariant(condition, message) {
  if (!condition) {
    const error = new Error(message);
 
    error.name = 'Invariant Violation';
    Error.captureStackTrace(error, invariant); // Remove this function's frame from the stack
 
    throw error;
  }
}
 
module.exports = invariant;