HopefulLlama/UnitTestSCAD

View on GitHub
docs/api_AbstractParent.js.html

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>JSDoc: Source: api/AbstractParent.js</title>

    <script src="scripts/prettify/prettify.js"> </script>
    <script src="scripts/prettify/lang-css.js"> </script>
    <!--[if lt IE 9]>
      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

    <h1 class="page-title">Source: api/AbstractParent.js</h1>

    



    
    <section>
        <article>
            <pre class="prettyprint source linenums"><code>const {getHeader} = require('../file/Header');

function valueOrDefault(object, property, defaultValue) {
  return (object !== undefined &amp;&amp; object[property] !== undefined) ? object[property] : defaultValue;
}

function sanitise(options) {
  return {
    openSCADDirectory: valueOrDefault(options, 'openSCADDirectory', ''),
    use: valueOrDefault(options, 'use', []),
    include: valueOrDefault(options, 'include', []),
    setUpText: valueOrDefault(options, 'setUpText', ''),
    testText: valueOrDefault(options, 'testText', ''),
  };
}

/**
 * @typedef {object} Options Key/value pair of options to configure the execution of an OpenSCAD test.
 * @property {String} openSCADDirectory The prefix to prepend to all uses/includes.
 * @property {String[]} use List of .scad files to import as 'use'.
 * @property {String[]} include List of .scad files to import as 'include'.
 * @property {String} setUpText Any required OpenSCAD code to set up the test.
 * @property {String} testText The OpenSCAD code to be tested and asserted on.
 */

/**
 * @typedef {number[]} Vertex A 2/3 length co-ordinate representing a point in 2D/3D space.
 */

module.exports = class {
  constructor(dirtyOptions, fileType) {
    const options = sanitise(dirtyOptions);
    const header = getHeader(options.openSCADDirectory, options.use, options.include);
    this.output = fileType.execute(header, options.setUpText, options.testText);
  }
};</code></pre>
        </article>
    </section>




</div>

<nav>
    <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Function.html">Function</a></li><li><a href="ThreeDModule.html">ThreeDModule</a></li><li><a href="TwoDModule.html">TwoDModule</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>

<br class="clear">

<footer>
    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a>
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>