UNPKG

vue-moo

Version:

moo

476 lines (217 loc) 13.4 kB
<!DOCTYPE HTML> <html lang="" > <head> <meta charset="UTF-8"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <title>Assert · GitBook</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="description" content=""> <meta name="generator" content="GitBook 3.2.3"> <link rel="stylesheet" href="../../gitbook/style.css"> <link rel="stylesheet" href="../../gitbook/gitbook-plugin-prism/prism.css"> <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search/search.css"> <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css"> <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-vuejs-2/vue.css"> <meta name="HandheldFriendly" content="true"/> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png"> <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon"> <link rel="next" href="Device.html" /> <link rel="prev" href="Array.html" /> </head> <body> <div class="book"> <div class="book-summary"> <div id="book-search-input" role="search"> <input type="text" placeholder="Type to search" /> </div> <nav role="navigation"> <ul class="summary"> <li class="chapter " data-level="1.1" data-path="../../"> <a href="../../"> Introduction </a> </li> <li class="chapter " data-level="1.2" data-path="../component/HOME.html"> <a href="../component/HOME.html"> 组件(component) </a> </li> <li class="chapter " data-level="1.3" data-path="HOME.html"> <a href="HOME.html"> 工具箱(util) </a> <ul class="articles"> <li class="chapter " data-level="1.3.1" data-path="Array.html"> <a href="Array.html"> Array </a> </li> <li class="chapter active" data-level="1.3.2" data-path="Assert.html"> <a href="Assert.html"> Assert </a> </li> <li class="chapter " data-level="1.3.3" data-path="Device.html"> <a href="Device.html"> Device </a> </li> <li class="chapter " data-level="1.3.4" data-path="Date.html"> <a href="Date.html"> Date </a> </li> <li class="chapter " data-level="1.3.5" data-path="Dom.html"> <a href="Dom.html"> Dom </a> </li> <li class="chapter " data-level="1.3.6" data-path="Http.html"> <a href="Http.html"> Http </a> </li> <li class="chapter " data-level="1.3.7" data-path="String.html"> <a href="String.html"> String </a> </li> <li class="chapter " data-level="1.3.8" data-path="Storage.html"> <a href="Storage.html"> Storage </a> </li> </ul> </li> <li class="chapter " data-level="1.4" data-path="../drive/HOME.html"> <a href="../drive/HOME.html"> 驱动器(drive) </a> <ul class="articles"> <li class="chapter " data-level="1.4.1" data-path="../drive/Http.html"> <a href="../drive/Http.html"> Http </a> </li> <li class="chapter " data-level="1.4.2" data-path="../drive/Vue.html"> <a href="../drive/Vue.html"> Vue </a> </li> </ul> </li> <li class="chapter " data-level="1.5" data-path="../planes/HOME.html"> <a href="../planes/HOME.html"> Planes </a> </li> <li class="divider"></li> <li> <a href="https://www.gitbook.com" target="blank" class="gitbook-link"> Published with GitBook </a> </li> </ul> </nav> </div> <div class="book-body"> <div class="body-inner"> <div class="book-header" role="navigation"> <!-- Title --> <h1> <i class="fa fa-circle-o-notch fa-spin"></i> <a href="../.." >Assert</a> </h1> </div> <div class="page-wrapper" tabindex="-1" role="main"> <div class="page-inner"> <div id="book-search-results"> <div class="search-noresults"> <section class="normal markdown-section"> <h1 id="assert">Assert</h1> <h2 id="utilassertdef">util.Assert.def</h2> <p>&#x503C;&#x4E3A;&#x7A7A;&#x503C;&#x65F6;&#xFF0C; &#x8FD4;&#x56DE;&#x9ED8;&#x8BA4;&#x503C;&#x3002;</p> <pre class="language-"><code>// result: 0 util.Assert.def(&apos;&apos;, 0); </code></pre><h2 id="utilasserthasemtpy">util.Assert.hasEmtpy</h2> <p>&#x662F;&#x5426;&#x4E3A;&#x7A7A;&#x503C;&#x3002;</p> <pre class="language-"><code>// result: true util.Assert.hasEmtpy({}); // result: true util.Assert.hasEmtpy([]); // result: true util.Assert.hasEmtpy(&apos;&apos;); // result: true util.Assert.hasEmtpy(null); // result: true util.Assert.hasEmtpy(undefined); </code></pre><h2 id="utilasserthas">util.Assert.has</h2> <p>&#x5224;&#x65AD;&#x5BF9;&#x8C61;&#x662F;&#x5426;&#x4E3A;&#x5176;&#x4E2D;&#x4E00;&#x4E2A;&#x7C7B;&#x578B;</p> <pre class="language-"><code>util.Assert.has(&apos;number,string&apos;, obj); </code></pre><h2 id="utilasserthasdate">util.Assert.hasDate</h2> <p>&#x662F;&#x5426;&#x4E3A;&#x65E5;&#x671F;&#x5BF9;&#x8C61;&#x3002;</p> <pre class="language-"><code>// result: true util.Assert.hasDate(new Date()); </code></pre><h2 id="utilasserthasstr">util.Assert.hasStr</h2> <p>&#x662F;&#x5426;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;&#x3002;</p> <pre class="language-"><code>// result: true util.Assert.hasStr(&apos;&apos;); </code></pre><h2 id="utilasserthasfile">util.Assert.hasFile</h2> <p>&#x662F;&#x5426;&#x4E3A;&#x6587;&#x4EF6;&#x3002;</p> <pre class="language-"><code>// result: true util.Assert.hasFile(new File()); </code></pre><h2 id="utilasserthasfunc">util.Assert.hasFunc</h2> <p>&#x662F;&#x5426;&#x4E3A;&#x51FD;&#x6570;&#x3002;</p> <pre class="language-"><code>// result: true util.Assert.hasFunc(new Function()); </code></pre><h2 id="utilasserthasobj">util.Assert.hasObj</h2> <p>&#x662F;&#x5426;&#x4E3A;&#x5BF9;&#x8C61;&#x3002;</p> <pre class="language-"><code>// result: true util.Assert.hasObj(new Object()); </code></pre><h2 id="utilasserthaspromise">util.Assert.hasPromise</h2> <p>&#x662F;&#x5426;&#x4E3A;&#x4E00;&#x4E2A;Promise&#x5BF9;&#x8C61;, &#x6709;&#x4E9B;&#x8F83;&#x8001;&#x7684;&#x5B89;&#x5353;&#x7CFB;&#x7EDF;&#x4E0D;&#x652F;&#x6301;instanceof Promise&#x3002;</p> <pre class="language-"><code>// result: true util.Assert.hasPromise(new Promise()); </code></pre> </section> </div> <div class="search-results"> <div class="has-results"> <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1> <ul class="search-results-list"></ul> </div> <div class="no-results"> <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1> </div> </div> </div> </div> </div> </div> <a href="Array.html" class="navigation navigation-prev " aria-label="Previous page: Array"> <i class="fa fa-angle-left"></i> </a> <a href="Device.html" class="navigation navigation-next " aria-label="Next page: Device"> <i class="fa fa-angle-right"></i> </a> </div> <script> var gitbook = gitbook || []; gitbook.push(function() { gitbook.page.hasChanged({"page":{"title":"Assert","level":"1.3.2","depth":2,"next":{"title":"Device","level":"1.3.3","depth":2,"path":"documents/util/Device.md","ref":"documents/util/Device.md","articles":[]},"previous":{"title":"Array","level":"1.3.1","depth":2,"path":"documents/util/Array.md","ref":"documents/util/Array.md","articles":[]},"dir":"ltr"},"config":{"plugins":["prism","-highlight","prism-themes","theme-vuejs-2"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"prism-themes":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-vuejs-2":{},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"config":{"prism":{"css":["prismjs/themes/prism-coy.css"],"lang":{"flow":"typescript"}}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"*"},"file":{"path":"documents/util/Assert.md","mtime":"2018-02-12T08:35:49.204Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-02-23T06:59:45.706Z"},"basePath":"../..","book":{"language":""}}); }); </script> </div> <script src="../../gitbook/gitbook.js"></script> <script src="../../gitbook/theme.js"></script> <script src="../../gitbook/gitbook-plugin-search/search-engine.js"></script> <script src="../../gitbook/gitbook-plugin-search/search.js"></script> <script src="../../gitbook/gitbook-plugin-lunr/lunr.min.js"></script> <script src="../../gitbook/gitbook-plugin-lunr/search-lunr.js"></script> <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script> <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script> </body> </html>