UNPKG

jslib-tools

Version:

js工具库 封装常用的工具函数 如深拷贝 时间转换日期格式化、浏览器判断等,提高开发效率

4,990 lines (1,157 loc) 112 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Global</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">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="clipboardObj"><span class="type-signature">(constant) </span>clipboardObj<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="dom_addEventListener.js.html">dom/addEventListener.js</a>, <a href="dom_addEventListener.js.html#line58">line 58</a> </li></ul></dd> </dl> <h4 class="name" id="cookie"><span class="type-signature"></span>cookie<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="store_index.js.html">store/index.js</a>, <a href="store_index.js.html#line84">line 84</a> </li></ul></dd> </dl> <h4 class="name" id="cursortPosition"><span class="type-signature">(constant) </span>cursortPosition<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="dom_addEventListener.js.html">dom/addEventListener.js</a>, <a href="dom_addEventListener.js.html#line91">line 91</a> </li></ul></dd> </dl> <h4 class="name" id="debounce"><span class="type-signature">(constant) </span>debounce<span class="type-signature"></span></h4> <div class="description"> 函数防抖 </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="performance_index.js.html">performance/index.js</a>, <a href="performance_index.js.html#line15">line 15</a> </li></ul></dd> </dl> <h4 class="name" id="getDeviceModel"><span class="type-signature">(constant) </span>getDeviceModel<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="device_getDeviceModel.js.html">device/getDeviceModel.js</a>, <a href="device_getDeviceModel.js.html#line14">line 14</a> </li></ul></dd> </dl> <h4 class="name" id="isDiff"><span class="type-signature">(constant) </span>isDiff<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="judgement_index.js.html">judgement/index.js</a>, <a href="judgement_index.js.html#line152">line 152</a> </li></ul></dd> </dl> <h4 class="name" id="objTools"><span class="type-signature">(constant) </span>objTools<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="obj_index.js.html">obj/index.js</a>, <a href="obj_index.js.html#line284">line 284</a> </li></ul></dd> </dl> <h4 class="name" id="sleepAction"><span class="type-signature">(constant) </span>sleepAction<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="performance_index.js.html">performance/index.js</a>, <a href="performance_index.js.html#line79">line 79</a> </li></ul></dd> </dl> <h4 class="name" id="throttle"><span class="type-signature">(constant) </span>throttle<span class="type-signature"></span></h4> <div class="description"> 函数节流 </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="performance_index.js.html">performance/index.js</a>, <a href="performance_index.js.html#line43">line 43</a> </li></ul></dd> </dl> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="alias"><span class="type-signature"></span>alias<span class="signature">(obj, name, aliasName)</span><span class="type-signature"></span></h4> <div class="description"> 给原型方法或属性添加别名 eg:alias(Array,"forEach","each"); </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>obj</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last">对象</td> </tr> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">object</span> </td> <td class="description last">属性名称或对象 eg: 'forEach' | {forEach:'each'}</td> </tr> <tr> <td class="name"><code>aliasName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">别名</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="obj_index.js.html">obj/index.js</a>, <a href="obj_index.js.html#line72">line 72</a> </li></ul></dd> </dl> <h4 class="name" id="arrayMove"><span class="type-signature"></span>arrayMove<span class="signature">(array, from, to)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 数组位移 </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>array</code></td> <td class="type"> <span class="param-type">array</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>from</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>to</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="obj_array_array.js.html">obj/array/array.js</a>, <a href="obj_array_array.js.html#line70">line 70</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>``` const { arrayMove } = require('@alrale/common-lib'); const input = ['a', 'b', 'c']; const array1 = arrayMove(input, 1, 2); console.log(array1); //=> ['a', 'c', 'b'] const array2 = arrayMove(input, -1, 0); console.log(array2); //=> ['c', 'a', 'b'] const array3 = arrayMove(input, -2, -3); console.log(array3); //=> ['b', 'a', 'c'] ```</code></pre> <h4 class="name" id="arrayMoveMutate"><span class="type-signature"></span>arrayMoveMutate<span class="signature">(array, from, to)</span><span class="type-signature"></span></h4> <div class="description"> 引用数组位移,性能优化 </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>array</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>from</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>to</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="obj_array_array.js.html">obj/array/array.js</a>, <a href="obj_array_array.js.html#line34">line 34</a> </li></ul></dd> </dl> <h4 class="name" id="arrayToObject"><span class="type-signature"></span>arrayToObject<span class="signature">(key, arr)</span><span class="type-signature"> &rarr; {object}</span></h4> <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>key</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>arr</code></td> <td class="type"> <span class="param-type">any</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="obj_array_array.js.html">obj/array/array.js</a>, <a href="obj_array_array.js.html#line18">line 18</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">object</span> </dd> </dl> <h4 class="name" id="arrayToTree"><span class="type-signature"></span>arrayToTree<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> 转换方法 </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="transfer_array.js.html">transfer/array.js</a>, <a href="transfer_array.js.html#line86">line 86</a> </li></ul></dd> </dl> <h4 class="name" id="arrFibonacci"><span class="type-signature"></span>arrFibonacci<span class="signature">(length, value, step)</span><span class="type-signature"></span></h4> <div class="description"> 按条件产生数组 arr(5,2,2) => [2,4,6,8,10] eg:按1-10项产生斐波那契数列 =>arr(10, function (value, i, list) { return i > 1 ? list[i - 1] + list[i - 2] : 1; }) </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>length</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">要产生的数组长度</td> </tr> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">数组项的初始值</td> </tr> <tr> <td class="name"><code>step</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last">递增值或处理函数(当前值,索引,当前产生的数组)</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="obj_array_array.js.html">obj/array/array.js</a>, <a href="obj_array_array.js.html#line84">line 84</a> </li></ul></dd> </dl> <h4 class="name" id="arrVals"><span class="type-signature"></span>arrVals<span class="signature">(list, prop, skipUndefined)</span><span class="type-signature"></span></h4> <div class="description"> 根据指定的键或索引抽取数组项的值 eg:vals([{id:1},{id:2}], "id") => [1,2] eg:vals([[1,"a"],[2,"b"]], 1) => ["a","b"] </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>list</code></td> <td class="type"> <span class="param-type">array</span> </td> <td class="description last">对象数组</td> </tr> <tr> <td class="name"><code>prop</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">要抽取的属性</td> </tr> <tr> <td class="name"><code>skipUndefined</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="description last">是否跳过值不存在的项,默认为true</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="obj_array_array.js.html">obj/array/array.js</a>, <a href="obj_array_array.js.html#line119">line 119</a> </li></ul></dd> </dl> <h4 class="name" id="callHandler"><span class="type-signature"></span>callHandler<span class="signature">(callHandlerData, name, data)</span><span class="type-signature"> &rarr; {*}</span></h4> <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>callHandlerData</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">n请求的方法</td> </tr> <tr> <td class="name"><code>data</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">请求时传的参数</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="plugins_jsBridge_index.js.html">plugins/jsBridge/index.js</a>, <a href="plugins_jsBridge_index.js.html#line47">line 47</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> function </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="camelize"><span class="type-signature"></span>camelize<span class="signature">(str)</span><span class="type-signature"> &rarr; {string}</span></h4> <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>str</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="transfer_regex.js.html">transfer/regex.js</a>, <a href="transfer_regex.js.html#line40">line 40</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id="checkInt"><span class="type-signature"></span>checkInt<span class="signature">(str, min, max)</span><span class="type-signature"></span></h4> <div class="description"> 判断是否是符合条件的整数 </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>str</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">number</span> </td> <td class="description last">要检测的字符串或数字</td> </tr> <tr> <td class="name"><code>min</code></td> <td class="type"> <span class="param-type">number</span> | <span class="param-type">undefined</span> </td> <td class="description last">允许的最小值</td> </tr> <tr> <td class="name"><code>max</code></td> <td class="type"> <span class="param-type">number</span> | <span class="param-type">undefined</span> </td> <td class="description last">允许的最大值</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="judgement_index.js.html">judgement/index.js</a>, <a href="judgement_index.js.html#line246">line 246</a> </li></ul></dd> </dl> <h4 class="name" id="checkNum"><span class="type-signature"></span>checkNum<span class="signature">(str, min, max, max_decimal_len)</span><span class="type-signature"></span></h4> <div class="description"> 判断是否是符合条件的数字 </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>str</code></td> <td class="type"> <span class="param-type">string</span> | <span class="param-type">number</span> </td> <td class="description last">要检测的字符串或数字</td> </tr> <tr> <td class="name"><code>min</code></td> <td class="type"> <span class="param-type">number</span> | <span class="param-type">undefined</span> </td> <td class="description last">允许的最小值</td> </tr> <tr> <td class="name"><code>max</code></td> <td class="type"> <span class="param-type">number</span> | <span class="param-type">undefined</span> </td> <td class="description last">允许的最大值</td> </tr> <tr> <td class="name"><code>max_decimal_len</code></td> <td class="type"> <span class="param-type">number</span> | <span class="param-type">undefined</span> </td> <td class="description last">最大小数位数</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="judgement_index.js.html">judgement/index.js</a>, <a href="judgement_index.js.html#line231">line 231</a> </li></ul></dd> </dl> <h4 class="name" id="compareSize"><span class="type-signature"></span>compareSize<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> 比较大小 </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="judgement_index.js.html">judgement/index.js</a>, <a href="judgement_index.js.html#line289">line 289</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> -1 0 1 </div> <h4 class="name" id="dasherize"><span class="type-signature"></span>dasherize<span class="signature">(str)</span><span class="type-signature"> &rarr; {string}</span></h4> <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>str</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="transfer_regex.js.html">transfer/regex.js</a>, <a href="transfer_regex.js.html#line55">line 55</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id="dateFormat1"><span class="type-signature"></span>dateFormat1<span class="signature">(value)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 日期格式化 时间规则: 今天显示:xx:xx 昨天显示:昨天 xx:xx 一周内显示:星期x xx:xx 一年内显示:xx月xx日 xx:xx 更早日期显示:xx年xx月xx日 xx:xx </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>value</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">时间戳,单位s</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="dateFormat_dateFormat1.js.html">dateFormat/dateFormat1.js</a>, <a href="dateFormat_dateFormat1.js.html#line20">line 20</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> 格式化后的日期 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="dateFormat2"><span class="type-signature"></span>dateFormat2<span class="signature">(dateTimeStamp)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 日期格式化 时间规则: 小于一分钟显示:刚刚 1分钟-60分钟内显示:xx分钟前 大于60分钟显示:xx小时前 昨天显示:昨天 xx:xx 更早日期显示:xx-xx-xx xx:xx </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>dateTimeStamp</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">时间戳,单位s</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="dateFormat_dateFormat2.js.html">dateFormat/dateFormat2.js</a>, <a href="dateFormat_dateFormat2.js.html#line20">line 20</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> 格式化后的日期 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="decode_url_param"><span class="type-signature"></span>decode_url_param<span class="signature">(param)</span><span class="type-signature"></span></h4> <div class="description"> 解码url参数值 eg:%E6%B5%8B%E8%AF%95 => 测试 </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>param</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">要解码的字符串 eg:%E6%B5%8B%E8%AF%95</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="transfer_jsonString.js.html">transfer/jsonString.js</a>, <a href="transfer_jsonString.js.html#line18">line 18</a> </li></ul></dd> </dl> <h4 class="name" id="def"><span class="type-signature"></span>def<span class="signature">(value, defValue)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> 若value不为undefine,则返回value;否则返回defValue </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>value</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>defValue</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last">value不存在时返回的值</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="judgement_index.js.html">judgement/index.js</a>, <a href="judgement_index.js.html#line143">line 143</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="elDateFormat"><span class="type-signature"></span>elDateFormat<span class="signature">(time, type)</span><span class="type-signature"> &rarr; {number|string|null}</span></h4> <div class="description"> 获取饿了么框架时间选择器时间戳 </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>time</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">时间</td> </tr> <tr> <td class="name"><code>type</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">类型 默认值 0 0 开始时间 1 结束时间</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="dateFormat_elDateFormat.js.html">dateFormat/elDateFormat.js</a>, <a href="dateFormat_elDateFormat.js.html#line15">line 15</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> 时间戳 </div> <dl> <dt> Type </dt> <dd> <span class="param-type">number</span> | <span class="param-type">string</span> | <span class="param-type">null</span> </dd> </dl> <h4 class="name" id="escapeHTML"><span class="type-signature"></span>escapeHTML<span class="signature">(str)</span><span class="type-signature"> &rarr; {string}</span></h4> <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>str</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="transfer_regex.js.html">transfer/regex.js</a>, <a href="transfer_regex.js.html#line68">line 68</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id="exportXls"><span class="type-signature"></span>exportXls<span class="signature">(data, name, callBack)</span><span class="type-signature"></span></h4> <div class="description"> 删除对象里面value值为null的键值对 </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">*</span> </td> <td class="description last">接口返回的blob数据</td> </tr> <tr> <td class="name"><code>name</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">excel名称</td> </tr> <tr> <td class="name"><code>callBack</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">导出成功/失败回调 回调返回{type:fail/success} fail情况下 返回{ type: "fail", code, msg }</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="export_exportXls.js.html">export/exportXls.js</a>, <a href="export_exportXls.js.html#line15">line 15</a> </li></ul></dd> </dl> <h4 class="name" id="extend"><span class="type-signature"></span>extend<span class="signature">(target, source, forced)</span><span class="type-signature"></span></h4> <div class="description"> 将源对象(source)的所有可枚举且目标对象(target)不存在的属性, 复制到目标对象 </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>target</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last">目标对象</td> </tr> <tr> <td class="name"><code>source</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last">源对象</td> </tr> <tr> <td class="name"><code>forced</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="description last">是否强制复制, 为true时将会覆盖目标对象同名属性, 默认为false</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="obj_index.js.html">obj/index.js</a>, <a href="obj_index.js.html#line94">line 94</a> </li></ul></dd> </dl> <h4 class="name" id="getBrowserModel"><span class="type-signature"></span>getBrowserModel<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> 获取浏览器类型和版本 </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="device_getBrowserModel.js.html">device/getBrowserModel.js</a>, <a href="device_getBrowserModel.js.html#line7">line 7</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>getBrowserModel() => "Chrome:70.0.3538.102"</code></pre> <h4 class="name" id="getChangedData"><span class="type-signature"></span>getChangedData<span class="signature">(target, source, skipProps, skipPrefix)</span><span class="type-signature"></span></h4> <div class="description"> 将目标对象中和源对象值不同的数据作为键值对返回 </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>target</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last">目标对象</td> </tr> <tr> <td class="name"><code>source</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="description last">源对象</td> </tr> <tr> <td class="name"><code>skipProps</code></td> <td class="type"> <span class="param-type">Array.&lt;string></span> </td> <td class="description last">要忽略比较的属性数组</td> </tr> <tr> <td class="name"><code>skipPrefix</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">要忽略的属性前缀</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="obj_index.js.html">obj/index.js</a>, <a href="obj_index.js.html#line173">line 173</a> </li></ul></dd> </dl> <h4 class="name" id="getChildren"><span class="type-signature"></span>getChildren<span class="signature">(data, result, pid)</span><span class="type-signature"> &rarr; {array}</span></h4> <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">*</span> </td> <td class="description last">要处理对象</td> </tr> <tr> <td class="name"><code>result</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">返回数组</td> </tr> <tr> <td class="name"><code>pid</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last">父id</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="transfer_array.js.html">transfer/array.js</a>, <a href="transfer_array.js.html#line73">line 73</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">array</span> </dd> </dl> <h4 class="name" id="getCookie"><span class="type-signature"></span>getCookie<span class="signature">(key)</span><span class="type-signature"> &rarr; {*}</span></h4> <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>key</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="store_index.js.html">store/index.js</a>, <a href="store_index.js.html#line25">line 25</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id="getDefaultAvatar"><span class="type-signature"></span>getDefaultAvatar<span class="signature">(userId)</span><span class="type-signature"></span></h4> <div class="description"> 获取默认头像 </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>userId</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="description last"></td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="oss_getDefaultAvatar.js.html">oss/getDefaultAvatar.js</a>, <a href="oss_getDefaultAvatar.js.html#line13">line 13</