PageRenderTime 64ms CodeModel.GetById 33ms RepoModel.GetById 1ms app.codeStats 0ms

/docs/html/api/seed/lang/unique.html

https://github.com/YuhangGe/kissyteam.github.com
HTML | 246 lines | 204 code | 23 blank | 19 comment | 0 complexity | a90b5001be1930c0fee9ef56b858b632 MD5 | raw file
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <title>unique &mdash; KISSY Docs valpha documentation</title>
  6. <link rel="stylesheet" href="../../../static/reset.css"/>
  7. <link rel="stylesheet" href="../../../static/kissy.css"/>
  8. <link rel="stylesheet" href="../../../static/pygments.css"/>
  9. <link rel="shortcut icon" href="../../../static/favicon.ico"/>
  10. <link href='http://fonts.googleapis.com/css?family=Philosopher' rel='stylesheet' type='text/css'>
  11. <script>
  12. var DOCUMENTATION_OPTIONS = {
  13. URL_ROOT: '../../../',
  14. VERSION: 'alpha',
  15. COLLAPSE_INDEX: false,
  16. FILE_SUFFIX: '.html',
  17. HAS_SOURCE: true
  18. };
  19. if(window.location.href.indexOf("localhost/kissy_git/")!=-1){
  20. document.write('<script src="http://localhost/kissy_git/kissy/build/kissy.js"'+'><'+'/script>');
  21. } else{
  22. document.write('<script src="http://yiminghe.github.com/kissy/build/kissy.js"'+'>'+'<'+'/script>');
  23. }
  24. </script>
  25. <script type="text/javascript" src="../../../static/jquery.js"></script>
  26. <script type="text/javascript" src="../../../static/underscore.js"></script>
  27. <script type="text/javascript" src="../../../static/doctools.js"></script>
  28. </head>
  29. <body><div id="header">
  30. <h1 class="logo"><a alt="KISSY" href="http://docs.kissyui.com"><img src="../../../static/logo.png"/></a></h1>
  31. <p class="desc">小巧灵活简洁实用愉悦编码快乐开发</p>
  32. <ul class="navigation">
  33. <li><a href="../../../../html/quickstart/index.html">快速上手</a></li>
  34. <li><a href="../../../../html/api/index.html">API</a></li>
  35. <li><a href="../../../../html/demo/index.html">DEMO</a></li>
  36. <li><a href="http://blog.kissyui.com/">博客</a></li>
  37. <!--<li><a href="mailto:all@kissyui.com">论坛</a></li>-->
  38. <li><a href="http://www.github.com/kissyteam">源码</a></li>
  39. </ul>
  40. <div id="searchbox" style="display: none" class="searchbox">
  41. <form class="search" action="../../../search.html" method="get">
  42. <input type="text" name="q" size="28" class="ipt"/>
  43. <input type="submit" value="Go" class="btn"/>
  44. <input type="hidden" name="check_keywords" value="yes" />
  45. <input type="hidden" name="area" value="default" />
  46. </form>
  47. </div>
  48. <script type="text/javascript">$('#searchbox').show(0);</script>
  49. </div>
  50. <div id="content">
  51. <div class="layout grid-s6m0">
  52. <div class="col-main">
  53. <div class="main-wrap">
  54. <div class='related'>
  55. <h3>Navigation</h3>
  56. <ul>
  57. <li class="right" style="margin-right: 10px">
  58. <a href="../../../genindex.html" title="General Index"
  59. accesskey="I">index</a></li>
  60. <li class="right" >
  61. <a href="../../../py-modindex.html" title="Python Module Index"
  62. >modules</a> | </li>
  63. <li class="right" >
  64. <a href="isArray.html" title="isArray"
  65. accesskey="N">next</a> | </li>
  66. <li class="right" >
  67. <a href="lastIndexOf.html" title="lastIndexOf"
  68. accesskey="P">previous</a> | </li>
  69. <li><a href="../../../index.html">KISSY Docs</a> &#187; </li>
  70. <li><a href="../../index.html" >API文档</a> &#187; </li>
  71. <li><a href="../index.html" >Seed</a> &#187; </li>
  72. <li><a href="index.html" accesskey="U">lang</a> &#187; </li>
  73. </ul>
  74. </div>
  75. <div class="section" id="unique">
  76. <h1>unique<a class="headerlink" href="#unique" title="Permalink to this headline"></a></h1>
  77. <div class="section" id="module">
  78. <h2>Module<a class="headerlink" href="#module" title="Permalink to this headline"></a></h2>
  79. <blockquote>
  80. <div><a class="reference internal" href="index.html#module-Lang" title="Lang"><tt class="xref py py-mod docutils literal"><span class="pre">Lang</span></tt></a></div></blockquote>
  81. </div>
  82. <div class="section" id="methods">
  83. <h2>Methods<a class="headerlink" href="#methods" title="Permalink to this headline"></a></h2>
  84. <dl class="function">
  85. <dt id="Lang.KISSY.unique">
  86. <tt class="descclassname">KISSY.</tt><tt class="descname">unique</tt><big>(</big><big>)</big><a class="headerlink" href="#Lang.KISSY.unique" title="Permalink to this definition"></a></dt>
  87. <dd><div class="line-block">
  88. <div class="line">Array <strong>KISSY.unique</strong> (arr[,keepLast=false])</div>
  89. <div class="line">返回一个新数组, 仅包含 arr 去重后的值</div>
  90. </div>
  91. <table class="docutils field-list" frame="void" rules="none">
  92. <col class="field-name" />
  93. <col class="field-body" />
  94. <tbody valign="top">
  95. <tr class="field"><th class="field-name" colspan="2">Parameters:</th></tr>
  96. <tr><td>&nbsp;</td><td class="field-body"><ul class="first simple">
  97. <li><strong>arr</strong> (<em>Array</em>) &#8211; 包含重复元素的数组</li>
  98. <li><strong>keepLast</strong> (<em>boolean</em>) &#8211; 遇到重复值是保留第一次出现还是保留最后一次出现的元素</li>
  99. </ul>
  100. </td>
  101. </tr>
  102. <tr class="field"><th class="field-name" colspan="2">Returns:</th></tr>
  103. <tr><td>&nbsp;</td><td class="field-body"><p class="first">包含 arr 去重后的数组</p>
  104. </td>
  105. </tr>
  106. <tr class="field"><th class="field-name" colspan="2">Return type:</th></tr>
  107. <tr><td>&nbsp;</td><td class="field-body"><p class="first last">Array</p>
  108. </td>
  109. </tr>
  110. </tbody>
  111. </table>
  112. <p>例如</p>
  113. <div class="highlight-javascript"><div class="highlight"><pre><span class="nx">KISSY</span><span class="p">.</span><span class="nx">unique</span><span class="p">([</span><span class="nx">a</span><span class="p">,</span> <span class="nx">b</span><span class="p">,</span> <span class="nx">a</span><span class="p">],</span><span class="kc">true</span><span class="p">)</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="nx">b</span><span class="p">,</span> <span class="nx">a</span><span class="p">]</span>
  114. <span class="nx">KISSY</span><span class="p">.</span><span class="nx">unique</span><span class="p">([</span><span class="nx">a</span><span class="p">,</span> <span class="nx">b</span><span class="p">,</span> <span class="nx">a</span><span class="p">])</span> <span class="o">=&gt;</span> <span class="p">[</span><span class="nx">a</span><span class="p">,</span> <span class="nx">b</span><span class="p">]</span>
  115. </pre></div>
  116. </div>
  117. </dd></dl>
  118. </div>
  119. </div>
  120. <div>
  121. <label>
  122. 评论
  123. <select id='openComment'>
  124. <option value='1'>打开</option>
  125. <option value='0'>关闭</option>
  126. </select>
  127. </label>
  128. <script>
  129. if(!window.localStorage){
  130. KISSY.one("#openComment").attr("disabled",true);
  131. }else{
  132. KISSY.one("#openComment").val(window.localStorage.getItem("kissy-commment")||"1");
  133. KISSY.one("#openComment").on("change",function(){
  134. window.localStorage.setItem("kissy-commment",KISSY.one("#openComment").val());
  135. window.location.reload();
  136. });
  137. }
  138. </script>
  139. </div>
  140. <div id="disqus_thread"></div>
  141. <script>
  142. if((window.location.hostname.indexOf("kissyui.com")!=-1 )&& window.localStorage.getItem("kissy-commment")!="0"){
  143. /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
  144. var disqus_shortname = 'kissy-docs'; // required: replace example with your forum shortname
  145. // The following are highly recommended additional parameters. Remove the slashes in front to use.
  146. //var disqus_identifier = '/anim';
  147. //var disqus_url = window.location;
  148. /* * * DON'T EDIT BELOW THIS LINE * * */
  149. (function() {
  150. var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
  151. dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
  152. (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  153. })();
  154. }
  155. </script>
  156. <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  157. <a href="http://disqus.com" class="dsq-brlink">blog comments powered by <span class="logo-disqus">Disqus</span></a>
  158. <!--<div id="google-search-box">
  159. <div id="cse" style="width: 100%;">Loading</div>
  160. <script>
  161. if(window.location.hostname.indexOf("kissyui.com")!=-1){
  162. document.write('<script src="http://www.google.com/jsapi" type="text/javascript"><'+'/script>');
  163. }
  164. </script>
  165. <script>
  166. if(window.location.hostname.indexOf("kissyui.com")!=-1){
  167. google.load('search', '1', {language : 'zh-CN', style : google.loader.themes.MINIMALIST});
  168. google.setOnLoadCallback(function() {
  169. var customSearchControl = new google.search.CustomSearchControl('012347804910294994683:n4uzb24gqdm');
  170. customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
  171. customSearchControl.draw('cse');
  172. }, true);
  173. }
  174. </script>
  175. </div>-->
  176. </div>
  177. </div>
  178. <div class="col-sub"><ul class="s-box api-toctree">
  179. <h2 class="s-box-hd">Seed</h2>
  180. <ul class="s-box-bd">
  181. <li><a href="../loader/index.html">Loader</a></li>
  182. <li><a href="../kissy/index.html">kissy</a></li>
  183. <li><a href="index.html">lang</a></li>
  184. <li><a href="../web/index.html">web</a></li>
  185. </ul>
  186. </ul>
  187. <ul class="s-box core-toctree">
  188. <h2 class="s-box-hd">Core</h2>
  189. <ul class="s-box-bd">
  190. <li><a href="../../core/ua/index.html">ua</a></li>
  191. <li><a href="../../core/dom/index.html">DOM</a></li>
  192. <li><a href="../../core/event/index.html">event</a></li>
  193. <li><a href="../../core/node/index.html">node</a></li>
  194. <li><a href="../../core/json/index.html">json</a></li>
  195. <li><a href="../../core/ajax/index.html">ajax</a></li>
  196. <li><a href="../../core/cookie/index.html">cookie</a></li>
  197. <li><a href="../../core/base/index.html">base</a></li>
  198. <li><a href="../../core/anim/index.html">anim</a></li>
  199. </ul>
  200. </ul>
  201. <ul class="s-box component-toctree">
  202. <h2 class="s-box-hd">Component</h2>
  203. <ul class="s-box-bd">
  204. <li><a href="https://github.com/jquery/sizzle/wiki/Sizzle-Home">sizzle</a></li>
  205. <li><a href="../../component/template/index.html">template</a></li>
  206. <li><a href="../../component/datalazyload/index.html">datalazyload</a></li>
  207. <li><a href="../../component/flash/index.html">flash</a></li>
  208. <li><a href="../../component/dd/index.html">dd</a></li>
  209. <li><a href="../../component/switchable/index.html">switchable</a></li>
  210. <li><a href="../../component/suggest/index.html">suggest</a></li>
  211. <li><a href="../../component/calendar/index.html">calendar</a></li>
  212. <li><a href="../../component/imagezoom/index.html">imagezoom</a></li>
  213. <li><a href="../../component/overlay/index.html">overlay</a></li>
  214. </ul>
  215. </ul>
  216. </div>
  217. </div>
  218. </div>
  219. <div id="footer">
  220. &copy; Copyright 2010~2011, KISSY Team. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>
  221. </div>
  222. </body>
  223. </html>