w-puppeteer-uitest
Version:
A uitest package for web developer.
91 lines (55 loc) • 2.67 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>readJson.mjs - Documentation</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.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
<script src="scripts/nav.js" defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
<label for="nav-trigger" class="navicon-button x">
<div class="navicon"></div>
</label>
<label for="nav-trigger" class="overlay"></label>
<nav >
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="w-puppeteer-uitest.html">w-puppeteer-uitest</a><ul class='methods'><li data-type='method'><a href="w-puppeteer-uitest.html#.build">build</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.compareB64">compareB64</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.expBuild">expBuild</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.expTest">expTest</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.getB64">getB64</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.getFiles">getFiles</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.readJson">readJson</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.test">test</a></li></ul></li></ul>
</nav>
<div id="main">
<h1 class="page-title">readJson.mjs</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>import fs from 'fs'
import JSON5 from 'json5'
/**
* 讀取json檔數據
*
* @memberOf w-puppeteer-uitest
* @param {String} fn 輸入json檔案路徑字串
* @returns {*} 回傳數據
*/
function readJson(fn) {
let c = fs.readFileSync(fn, 'utf8')
return JSON5.parse(c)
}
export default readJson
</code></pre>
</article>
</section>
</div>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Sat Mar 23 2024 23:37:02 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>
<script src="scripts/polyfill.js"></script>
<script src="scripts/linenumber.js"></script>
</body>
</html>