src/helpers.js
function withComment (example, comment) {
  const constructor = example == null ? null : example.constructor;

  if (constructor === Object || constructor === Array) {
    Object.defineProperty(example, '_comment', {
      value: comment,
      enumerable: false
    });

    return example;
  }

  // Convert primitives
  return new PrimitiveWithComment(example, comment);
}
function withComment (example, comment) {
  const constructor = example == null ? null : example.constructor;

  if (constructor === Object || constructor === Array) {
    Object.defineProperty(example, '_comment', {
      value: comment,
      enumerable: false
    });

    return example;
  }

  // Convert primitives
  return new PrimitiveWithComment(example, comment);
}
function withComment ( example , comment ) { const constructor = example == null ? null : example . constructor ; if ( constructor === Object || constructor === Array ) { Object . defineProperty ( example , '_comment' , { value : comment , enumerable : false } ) ; return example ; } // Convert primitives return new PrimitiveWithComment ( example , comment ) ; }
Enrich any example value with a comment to print in the docs
Enrich any example value with a comment to print in the docs