UNPKG

amos-tool

Version:

amos ui tool

4,238 lines (1,007 loc) 194 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Global - 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 > <input type="text" id="nav-search" placeholder="Search" /> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Logger.html">Logger</a><ul class='methods'><li data-type='method'><a href="Logger.html#pkgInfo">pkgInfo</a></li><li data-type='method'><a href="Logger.html#pkgWarn">pkgWarn</a></li></ul></li><li><a href="RayDB.html">RayDB</a></li></ul><h3>Global</h3><ul><li><a href="global.html#_boost">_boost</a></li><li><a href="global.html#_defaultBrowsers">_defaultBrowsers</a></li><li><a href="global.html#_muiltBrowsers">_muiltBrowsers</a></li><li><a href="global.html#advancePolicy">advancePolicy</a></li><li><a href="global.html#alphaHexMap">alphaHexMap</a></li><li><a href="global.html#amosCookie">amosCookie</a></li><li><a href="global.html#array2tree">array2tree</a></li><li><a href="global.html#arrayFilter">arrayFilter</a></li><li><a href="global.html#beautifyRoutes">beautifyRoutes</a></li><li><a href="global.html#browserSupport">browserSupport</a></li><li><a href="global.html#bt4ToHex">bt4ToHex</a></li><li><a href="global.html#byteToString">byteToString</a></li><li><a href="global.html#calcBrowserVersion">calcBrowserVersion</a></li><li><a href="global.html#checkFileName">checkFileName</a></li><li><a href="global.html#checkFlash">checkFlash</a></li><li><a href="global.html#clone">clone</a></li><li><a href="global.html#colorKeyWordsHexStr">colorKeyWordsHexStr</a></li><li><a href="global.html#completeUnit">completeUnit</a></li><li><a href="global.html#contains">contains</a></li><li><a href="global.html#customEqual">customEqual</a></li><li><a href="global.html#debounce">debounce</a></li><li><a href="global.html#deepCopy">deepCopy</a></li><li><a href="global.html#deepEqual">deepEqual</a></li><li><a href="global.html#DesUtils">DesUtils</a></li><li><a href="global.html#divide">divide</a></li><li><a href="global.html#drawPolygon">drawPolygon</a></li><li><a href="global.html#enc">enc</a></li><li><a href="global.html#encodeLen">encodeLen</a></li><li><a href="global.html#encodeNumber">encodeNumber</a></li><li><a href="global.html#eq">eq</a></li><li><a href="global.html#fieldContentRegExp">fieldContentRegExp</a></li><li><a href="global.html#fileSizeToByte">fileSizeToByte</a></li><li><a href="global.html#fileterAllMatchedData">fileterAllMatchedData</a></li><li><a href="global.html#filterAllCheckedData">filterAllCheckedData</a></li><li><a href="global.html#filterChilds">filterChilds</a></li><li><a href="global.html#filterTreeLevel">filterTreeLevel</a></li><li><a href="global.html#genBitmapImage">genBitmapImage</a></li><li><a href="global.html#generateKeys">generateKeys</a></li><li><a href="global.html#getFileExtension">getFileExtension</a></li><li><a href="global.html#getKeyBytes">getKeyBytes</a></li><li><a href="global.html#getTreeFlatKeys">getTreeFlatKeys</a></li><li><a href="global.html#gradientColor">gradientColor</a></li><li><a href="global.html#has">has</a></li><li><a href="global.html#hasOwnProp">hasOwnProp</a></li><li><a href="global.html#hasOwnProperty">hasOwnProperty</a></li><li><a href="global.html#hexToBt4">hexToBt4</a></li><li><a href="global.html#imageCompress">imageCompress</a></li><li><a href="global.html#isArray">isArray</a></li><li><a href="global.html#isBaseNaN">isBaseNaN</a></li><li><a href="global.html#isBlank">isBlank</a></li><li><a href="global.html#isBoolean">isBoolean</a></li><li><a href="global.html#isBuiltInObject">isBuiltInObject</a></li><li><a href="global.html#isCollection">isCollection</a></li><li><a href="global.html#isDom">isDom</a></li><li><a href="global.html#isElement">isElement</a></li><li><a href="global.html#isEmpty">isEmpty</a></li><li><a href="global.html#isEmptyObject">isEmptyObject</a></li><li><a href="global.html#isENumber">isENumber</a></li><li><a href="global.html#isFloat">isFloat</a></li><li><a href="global.html#isGIF">isGIF</a></li><li><a href="global.html#isHexColor">isHexColor</a></li><li><a href="global.html#isImageSrc">isImageSrc</a></li><li><a href="global.html#isInputEqual">isInputEqual</a></li><li><a href="global.html#isInteger">isInteger</a></li><li><a href="global.html#isJson">isJson</a></li><li><a href="global.html#isKeyColor">isKeyColor</a></li><li><a href="global.html#isKeyInObject">isKeyInObject</a></li><li><a href="global.html#isnan">isnan</a></li><li><a href="global.html#isNil">isNil</a></li><li><a href="global.html#isNull">isNull</a></li><li><a href="global.html#isNullOrUndefined">isNullOrUndefined</a></li><li><a href="global.html#isNumber">isNumber</a></li><li><a href="global.html#isObject">isObject</a></li><li><a href="global.html#isOnlyObject">isOnlyObject</a></li><li><a href="global.html#isOpacity">isOpacity</a></li><li><a href="global.html#isOwnKeyInObject">isOwnKeyInObject</a></li><li><a href="global.html#isPromise">isPromise</a></li><li><a href="global.html#isRegExp">isRegExp</a></li><li><a href="global.html#isRgbColor">isRgbColor</a></li><li><a href="global.html#isUndefined">isUndefined</a></li><li><a href="global.html#isUrl">isUrl</a></li><li><a href="global.html#isValidDate">isValidDate</a></li><li><a href="global.html#keyColorToHex">keyColorToHex</a></li><li><a href="global.html#Log">Log</a></li><li><a href="global.html#MAX_LENGTH">MAX_LENGTH</a></li><li><a href="global.html#merge">merge</a></li><li><a href="global.html#mergeAll">mergeAll</a></li><li><a href="global.html#mod">mod</a></li><li><a href="global.html#multiply">multiply</a></li><li><a href="global.html#normalPolicy">normalPolicy</a></li><li><a href="global.html#null2default">null2default</a></li><li><a href="global.html#objRGB2str">objRGB2str</a></li><li><a href="global.html#parse">parse</a></li><li><a href="global.html#pathToTree">pathToTree</a></li><li><a href="global.html#plus">plus</a></li><li><a href="global.html#PNGlib">PNGlib</a></li><li><a href="global.html#Queue">Queue</a></li><li><a href="global.html#random">random</a></li><li><a href="global.html#randomInt">randomInt</a></li><li><a href="global.html#ranks">ranks</a></li><li><a href="global.html#recursive">recursive</a></li><li><a href="global.html#recursiveGen">recursiveGen</a></li><li><a href="global.html#rgb2object">rgb2object</a></li><li><a href="global.html#saveAsImage">saveAsImage</a></li><li><a href="global.html#serialize">serialize</a></li><li><a href="global.html#shallowEqual">shallowEqual</a></li><li><a href="global.html#simpleEqual">simpleEqual</a></li><li><a href="global.html#simpleThrottle">simpleThrottle</a></li><li><a href="global.html#slpitArray">slpitArray</a></li><li><a href="global.html#some">some</a></li><li><a href="global.html#stringIsJson">stringIsJson</a></li><li><a href="global.html#strToBt">strToBt</a></li><li><a href="global.html#subObjectEqual">subObjectEqual</a></li><li><a href="global.html#subtract">subtract</a></li><li><a href="global.html#throttle">throttle</a></li><li><a href="global.html#toHexAlphaColor">toHexAlphaColor</a></li><li><a href="global.html#toHexColor">toHexColor</a></li><li><a href="global.html#toRealSize">toRealSize</a></li><li><a href="global.html#toRGBcolor">toRGBcolor</a></li><li><a href="global.html#toStringHexColor">toStringHexColor</a></li><li><a href="global.html#transformColor">transformColor</a></li><li><a href="global.html#useMd5Policy">useMd5Policy</a></li><li><a href="global.html#useMd5Policy2">useMd5Policy2</a></li><li><a href="global.html#utils">utils</a></li><li><a href="global.html#values">values</a></li></ul> </nav> <div id="main"> <h1 class="page-title">Global</h1> <section> <header> <h2> </h2> </header> <article> <div class="container-overview"> <dl class="details"> </dl> </div> <h3 class="subsection-title">Members</h3> <h4 class="name" id="_defaultBrowsers"><span class="type-signature"></span>_defaultBrowsers<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>default support browsers</p> </div> <h4 class="name" id="_muiltBrowsers"><span class="type-signature"></span>_muiltBrowsers<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>default muilt support browsers such as equal some version</p> </div> <h4 class="name" id="alphaHexMap"><span class="type-signature">(constant) </span>alphaHexMap<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>设置style-config</p> </div> <h4 class="name" id="amosCookie"><span class="type-signature"></span>amosCookie<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>api: parse serialize</p> </div> <h4 class="name" id="colorKeyWordsHexStr"><span class="type-signature">(constant) </span>colorKeyWordsHexStr<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>color keywords 对照表,值为 hex 16进制 string</p> </div> <h4 class="name" id="DesUtils"><span class="type-signature">(constant) </span>DesUtils<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-author">Author:</dt> <dd class="tag-author"> <ul> <li>ilex.h</li> </ul> </dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>DESCore</li> </ul> </dd> </dl> <div class="description usertext"> <p>DES加密 / 解密</p> </div> <h4 class="name" id="encodeLen"><span class="type-signature"></span>encodeLen<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>url特殊字符转码</p> </div> <h4 class="name" id="fieldContentRegExp"><span class="type-signature"></span>fieldContentRegExp<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>RegExp to match field-content in RFC 7230 sec 3.2</p> <p>field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] field-vchar = VCHAR / obs-text obs-text = %x80-FF</p> </div> <h4 class="name" id="hasOwnProperty"><span class="type-signature"></span>hasOwnProperty<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>Used to check objects for own properties.</p> </div> <h4 class="name" id="isArray"><span class="type-signature"></span>isArray<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>Is a given value an array? Delegates to ECMA5's native Array.isArray</p> </div> <h4 class="name" id="isGIF"><span class="type-signature"></span>isGIF<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>判断图片是 gif</p> </div> <h5>Example</h5> <pre class="prettyprint"><code>isGIF('a.gif'); // true isGIF('data:image/;base64,'); // true</code></pre> <h4 class="name" id="isImageSrc"><span class="type-signature"></span>isImageSrc<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>判断是一个 image 的路径 (包含 svg) <code>/a/a/a.png|jpe?g|gif...</code> <code>http://a.b/a.png|jpe?g|gif...</code> <code>data:image/png|jpe?g|gif;base64,</code></p> </div> <h5>Example</h5> <pre class="prettyprint"><code>isImageSrc('/a/a/a.png'); // true isImageSrc('http://a.b/a.png'); // true isImageSrc('data:image/png|jpe?g|gif|svg;base64,'); // true</code></pre> <h4 class="name" id="Log"><span class="type-signature"></span>Log<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>Log.debug(...);</p> </div> <h4 class="name" id="MAX_LENGTH"><span class="type-signature">(constant) </span>MAX_LENGTH<span class="type-signature"> :number</span></h4> <dl class="details"> <dt class="tag-default">Default Value:</dt> <dd class="tag-default"><ul class="dummy"> <li>9007199254740991</li> </ul></dd> </dl> <div class="description usertext"> <p>Maximum length of a typed array.</p> <pre class="prettyprint source lang-tex"><code>2^{53} - 1 </code></pre> </div> <h5>Type:</h5> <ul> <li> <span class="param-type">number</span> </li> </ul> <h4 class="name" id="PNGlib"><span class="type-signature">(constant) </span>PNGlib<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>Identicon.js 2.3.3 http://github.com/stewartlord/identicon.js</p> <p>PNGLib required for PNG output http://www.xarg.org/download/pnglib.js</p> <p>Copyright 2018, Stewart Lord Released under the BSD license http://www.opensource.org/licenses/bsd-license.php</p> </div> <h4 class="name" id="utils"><span class="type-signature">(constant) </span>utils<span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>covert canvas to image and save the image file</p> </div> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="_boost"><span class="type-signature"></span>_boost<span class="signature">(a, b, operate, factor)</span><span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>将需要计算的值进行放大处理</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>参与计算的值</p></td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>参与计算的值</p></td> </tr> <tr> <td class="name"><code>operate</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>操作运算,即放大之后进行其它计算</p></td> </tr> <tr> <td class="name"><code>factor</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>缩小的倍数</p></td> </tr> </tbody> </table> <h4 class="name" id="advancePolicy"><span class="type-signature"></span>advancePolicy<span class="signature">(password, secretKey)</span><span class="type-signature"> &rarr; {object}</span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>普通密码生成策略</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>password</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>密码</p></td> </tr> <tr> <td class="name"><code>secretKey</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"><p>秘钥</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>{ password, secretKey }</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> <h4 class="name" id="array2tree"><span class="type-signature"></span>array2tree<span class="signature">(data, filterFn, options)</span><span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>将数据转化为tree使用的</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>data</code></td> <td class="type"> <span class="param-type">any</span> </td> <td class="description last"><p>待转化数据</p></td> </tr> <tr> <td class="name"><code>filterFn</code></td> <td class="type"> <span class="param-type">any</span> </td> <td class="description last"><p>执行过滤的函数</p></td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">any</span> </td> <td class="description last"><p>配置信息,需要转化的对象key</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>Array</p> </div> <h4 class="name" id="arrayFilter"><span class="type-signature"></span>arrayFilter<span class="signature">(data, filterFn, options)</span><span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>将数据转化为tree使用的</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>data</code></td> <td class="type"> <span class="param-type">any</span> </td> <td class="description last"><p>待转化数据</p></td> </tr> <tr> <td class="name"><code>filterFn</code></td> <td class="type"> <span class="param-type">any</span> </td> <td class="description last"><p>执行过滤的函数</p></td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">any</span> </td> <td class="description last"><p>配置信息,需要设置过滤匹配的对象key,value, childrenKey</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>Array</p> </div> <h4 class="name" id="beautifyRoutes"><span class="type-signature"></span>beautifyRoutes<span class="signature">(routes, options)</span><span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>美化 routes, 去掉 childrenKey 为空时该字段项</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>routes</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h4 class="name" id="browserSupport"><span class="type-signature"></span>browserSupport<span class="signature">(supBrowser, matchs)</span><span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>check browser support</p> </div> <h5>Example</h5> <pre class="prettyprint"><code>normal: const support = browserSupport(['firefox/', 'chrome/'], { 'firefox/': { limit: consts.GREATER_EQUAL, version: 50 }, 'chrome/': { limit: consts.GREATER_EQUAL, version: 55 } }); ie: const support = browserSupport(['firefox/', 'chrome/', 'ie'], { 'firefox/': { limit: consts.GREATER_EQUAL, version: 50 }, 'chrome/': { limit: consts.GREATER_EQUAL, version: 55 }, 'ie': { limit: consts.GREATER_EQUAL, version: 9 } });</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>supBrowser</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last"><p>browsers</p></td> </tr> <tr> <td class="name"><code>matchs</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"><p>the options of matchs</p></td> </tr> </tbody> </table> <h4 class="name" id="bt4ToHex"><span class="type-signature"></span>bt4ToHex<span class="signature">(binary)</span><span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>change the bit(it's length = 4) into the hex. return hex</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>binary</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h4 class="name" id="byteToString"><span class="type-signature"></span>byteToString<span class="signature">(byteData)</span><span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>changw the bit(it's length = 64) into the string, return string</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>byteData</code></td> <td class="type"> <span class="param-type">array</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h4 class="name" id="calcBrowserVersion"><span class="type-signature"></span>calcBrowserVersion<span class="signature">(ua, mbs, limit, version)</span><span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>calc version</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>ua</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>mbs</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>limit</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>version</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h4 class="name" id="checkFileName"><span class="type-signature"></span>checkFileName<span class="signature">(str, maxLen)</span><span class="type-signature"></span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>校验给定的 string 是否是 文件名</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>str</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="default"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>maxLen</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="default"> <code>259</code> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <h4 class="name" id="checkFlash"><span class="type-signature"></span>checkFlash<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>检测浏览器是否安装了flash; 返回json,f:是否安装;v:若安装,则返回版本号</p> </div> <h5>Returns:</h5> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id="clone"><span class="type-signature"></span>clone<span class="signature">(source)</span><span class="type-signature"> &rarr; {*}</span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>Those data types can be cloned: Plain object, Array, TypedArray, number, string, null, undefined. Those data types will be assgined using the orginal data: BUILTIN_OBJECT Instance of user defined class will be cloned to a plain object, without properties in prototype. Other data types is not supported (not sure what will happen).</p> <p>Caution: do not support clone Date, for performance consideration. (There might be a large number of date in <code>series.data</code>). So date should not be modified in and out of echarts.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>source</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>new</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="clone"><span class="type-signature"></span>clone<span class="signature">(value)</span><span class="type-signature"> &rarr; {*}</span></h4> <dl class="details"> <dt class="tag-since">Since:</dt> <dd class="tag-since"><ul class="dummy"><li>0.1.0</li></ul></dd> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>dc.cloneDeep</li> </ul> </dd> </dl> <div class="description usertext"> <p>Creates a shallow clone of <code>value</code>.</p> <p><strong>Note:</strong> This method is loosely based on the and supports cloning arrays, array buffers, booleans, date objects, maps, numbers, <code>Object</code> objects, regexes, sets, strings, symbols, and typed arrays. The own enumerable properties of <code>arguments</code> objects are cloned as plain objects. An empty object is returned for uncloneable values such as error objects, functions, DOM nodes, and WeakMaps.</p> </div> <h5>Example</h5> <pre class="prettyprint"><code>var objects = [{ 'a': 1 }, { 'b': 2 }]; var shallow = dc.clone(objects); console.log(shallow[0] === objects[0]); // => true</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"><p>The value to clone.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>Returns the cloned value.</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="completeUnit"><span class="type-signature"></span>completeUnit<span class="signature">(val, tag)</span><span class="type-signature"> &rarr; {String}</span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>补全单位</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>val</code></td> <td class="type"> <span class="param-type">String</span> | <span class="param-type">Number</span> </td> <td class="description last"><p>待转换数字</p></td> </tr> <tr> <td class="name"><code>tag</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last"><p>单位 tag</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id="contains"><span class="type-signature"></span>contains<span class="signature">(val, searchValue, position<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>Tests if an array-like value contains a search value.</p> </div> <h5>Examples</h5> <pre class="prettyprint"><code>var bool = contains( 'last man standing', 'stand' ); // returns true</code></pre> <pre class="prettyprint"><code>var bool = contains( [ 1, 2, 3, 4 ], 2 ); // returns true</code></pre> <pre class="prettyprint"><code>var bool = contains( 'presidential election', 'president' ); // returns true</code></pre> <pre class="prettyprint"><code>var bool = contains( [ NaN, 2, 3, 4 ], NaN ); // returns true</code></pre> <pre class="prettyprint"><code>var bool = contains( 'javaScript', 'js' ); // returns false</code></pre> <pre class="prettyprint"><code>var bool = contains( [ 1, 2, 3, {} ], {} ); // returns false</code></pre> <pre class="prettyprint"><code>var bool = contains( 'Hidden Treasures', '' ); // returns true</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>val</code></td> <td class="type"> <span class="param-type">Collection</span> | <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>input value</p></td> </tr> <tr> <td class="name"><code>searchValue</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>search value</p></td> </tr> <tr> <td class="name"><code>position</code></td> <td class="type"> <span class="param-type">integer</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="default"> <code>0</code> </td> <td class="description last"><p>position at which to start searching for <code>searchValue</code></p></td> </tr> </tbody> </table> <h5>Throws:</h5> <ul> <li> <dl> <dt> <div class="param-desc usertext"> <p>first argument must be array-like</p> </div> </dt> <dd></dd> <dt> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">TypeError</span> </dd> </dl> </dt> <dd></dd> </dl> </li> <li> <dl> <dt> <div class="param-desc usertext"> <p>must provide a search value</p> </div> </dt> <dd></dd> <dt> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Error</span> </dd> </dl> </dt> <dd></dd> </dl> </li> <li> <dl> <dt> <div class="param-desc usertext"> <p>second argument must be a string when the first argument is a string</p> </div> </dt> <dd></dd> <dt> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">TypeError</span> </dd> </dl> </dt> <dd></dd> </dl> </li> <li> <dl> <dt> <div class="param-desc usertext"> <p>third argument must be an integer</p> </div> </dt> <dd></dd> <dt> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">TypeError</span> </dd> </dl> </dt> <dd></dd> </dl> </li> </ul> <h5>Returns:</h5> <div class="param-desc"> <p>boolean indicating whether one value contains another</p> </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">boolean</span> </dd> </dl> <h4 class="name" id="customEqual"><span class="type-signature"></span>customEqual<span class="signature">(objA, objB, compare, compareContext)</span><span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="https://lodash.com/docs/4.17.4#isEqualWith">https://lodash.com/docs/4.17.4#isEqualWith</a></li> </ul> </dd> </dl> <div class="description usertext"> <p>浅层次比较两个对象</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>objA</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>objB</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>compare</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last"><p>可选</p></td> </tr> <tr> <td class="name"><code>compareContext</code></td> <td class="type"> <span class="param-type">any</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h4 class="name" id="debounce"><span class="type-signature"></span>debounce<span class="signature">(delay, atBegin<span class="signature-attributes">opt</span>, callback)</span><span class="type-signature"> &rarr; {function}</span></h4> <dl class="details"> </dl> <div class="description usertext"> <p>Debounce execution of a function. Debouncing, unlike throttling, guarantees that a function is only executed a single time, either at the very beginning of a series of calls, or at the very end.</p> </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>delay</code></td> <td class="type"> <span class="param-type">Number</span> </td> <td class="attributes"> </td> <td class="description last"><p>A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.</p></td> </tr> <tr> <td class="name"><code>atBegin</code></td> <td class="type"> <span class="param-type">Boolean</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last"><p>Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed <code>delay</code> milliseconds after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call. (After the throttled-function has not been called for <code>delay</code> milliseconds, the internal counter is reset).</p></td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="attributes"> </td> <td class="description last"><p>A function to be executed after delay milliseconds. The <code>this</code> context and all arguments are passed through, as-is, to <code>callback</code> when the debounced-function is executed.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> <p>A new, debounced function.</p> </div> <d