How to use the js-slang/dist/interop.stringify function in js-slang

To help you get started, we’ve selected a few js-slang 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 source-academy / cadet-frontend / src / components / workspace / side-content / AutograderCard.tsx View on Github external
const renderResult = (value: any) => {
      /** A class which is the output of the show() function */
      const ShapeDrawn = (window as any).ShapeDrawn;
      if (typeof ShapeDrawn !== 'undefined' && value instanceof ShapeDrawn) {
        return ;
      } else {
        return stringify(value);
      }
    };
github source-academy / cadet-frontend / src / components / workspace / Repl.tsx View on Github external
const renderResult = (value: any) => {
  /** A class which is the output of the show() function */
  const ShapeDrawn = (window as any).ShapeDrawn;
  if (typeof ShapeDrawn !== 'undefined' && value instanceof ShapeDrawn) {
    return ;
  } else {
    return stringify(value);
  }
};
github source-academy / cadet-frontend / src / components / assessment / AssessmentWorkspace.tsx View on Github external
const isCorrect = this.props.editorTestcases.reduce((acc, testcase) => {
            return acc && stringify(testcase.result) === testcase.answer;
          }, true);
          if (!isCorrect) {
github source-academy / cadet-frontend / src / utils / slangHelper.ts View on Github external
function cadetAlert(value: any) {
  alert(stringify(value));
}
github source-academy / cadet-frontend / src / utils / slangHelper.ts View on Github external
function display(value: Value, str: string, workspaceLocation: any) {
  display((str === undefined ? '' : str + ' ') + stringify(value), '', workspaceLocation);
  return value;
}
github source-academy / cadet-frontend / src / components / workspace / side-content / AutograderCard.tsx View on Github external
};

    const renderResult = (value: any) => {
      /** A class which is the output of the show() function */
      const ShapeDrawn = (window as any).ShapeDrawn;
      if (typeof ShapeDrawn !== 'undefined' && value instanceof ShapeDrawn) {
        return ;
      } else {
        return stringify(value);
      }
    };

    if (this.props.testcase.result !== undefined || this.props.testcase.errors) {
      gradingStatus = ' wrong';

      if (stringify(this.props.testcase.result) === this.props.testcase.answer) {
        gradingStatus = ' correct';
      }
    }

    return (
      <div>
        
          <pre>{this.props.testcase.program}</pre>
          <pre>{this.props.testcase.answer}</pre>
          <pre>            {this.props.testcase.errors
              ? buildErrorString(this.props.testcase.errors)
              : this.props.testcase.result !== undefined
              ? renderResult(this.props.testcase.result)
              : 'No Answer'}
          </pre></div>