How to use the decomment function in decomment

To help you get started, we’ve selected a few decomment examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github processing / p5.js-web-editor / client / modules / IDE / components / PreviewFrame.jsx View on Github external
jsPreprocess(jsText) {
    let newContent = jsText;
    // check the code for js errors before sending it to strip comments
    // or loops.
    JSHINT(newContent);

    if (JSHINT.errors.length === 0) {
      newContent = decomment(newContent, {
        ignore: /\/\/\s*noprotect/g,
        space: true
      });
      newContent = loopProtect(newContent);
    }
    return newContent;
  }
github processing / p5.js-web-editor / client / modules / IDE / components / PreviewFrame.jsx View on Github external
jsPreprocess(jsText) {
    let newContent = jsText;
    // check the code for js errors before sending it to strip comments
    // or loops.
    JSHINT(newContent);

    if (JSHINT.errors.length === 0) {
      newContent = decomment(newContent, {
        ignore: /\/\/\s*noprotect/g,
        space: true
      });
      newContent = loopProtect(newContent);
    }
    return newContent;
  }
github mongodb-js / compass-aggregations / src / components / stage-preview-toolbar / stage-preview-toolbar.jsx View on Github external
getText() {
    if (this.props.isEnabled) {
      if (this.props.stageOperator) {
        if (this.props.stageOperator === OUT && this.props.isValid) {
          return `Documents will be saved to the collection: ${decomment(this.props.stageValue)}`;
        }
        const stageInfo = STAGE_SPRINKLE_MAPPINGS[this.props.stageOperator];
        return (
          <div>
            <span>
              Output after <span>
                {this.props.stageOperator}
              </span> stage
            </span>
            {this.renderInfoSprinkle(stageInfo)}
            <span>(Sample of {this.props.count} {this.getWord()})</span>
          </div>
        );
      }
github mongodb-js / compass-aggregations / src / components / stage-preview / stage-preview.jsx View on Github external
renderOutSection() {
    if (this.props.isComplete) {
      return (
        <div>
          <div>
            Documents persisted to collection: {decomment(this.props.stage)}.
          </div>
          <div>
            Go to collection.
          </div>
        </div>
      );
    }
    return (
      <div>
        <div>
          The $out operator will cause the pipeline to persist the results
          to the specified collection. If the collection exists it will be
          replaced. Please confirm to execute.
        </div></div>
github mongodb-js / compass-aggregations / src / modules / stage.js View on Github external
export default function generateStage(state) {
  if (!state.isEnabled || !state.stageOperator || state.stage === '') {
    return {};
  }
  const stage = {};
  try {
    const decommented = decomment(state.stage);
    parse(`{${state.stageOperator}: ${decommented}}`);
    stage[state.stageOperator] = parser(decommented);
  } catch (e) {
    state.syntaxError = e.message;
    state.isValid = false;
    state.previewDocuments = [];
    return {};
  }
  state.isValid = true;
  state.syntaxError = null;
  return stage;
}

decomment

Removes comments from JSON/JavaScript, CSS/HTML, CPP/H, etc.

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis