3 Star 4 Fork 2

薛定谔的代码/openStack

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Countable.min.js 1.85 KB
一键复制 编辑 原始数据 按行查看 历史
薛定谔的代码 提交于 2023-03-07 15:43 +08:00 . 20230307
!function(t){let n=[];const e=Array.prototype.forEach;function r(t){const n=[];let e=0;const r=t.length;for(;e<r;){const o=t.charCodeAt(e++);if(o>=55296&&o<=56319&&e<r){const r=t.charCodeAt(e++);56320==(64512&r)?n.push(((1023&o)<<10)+(1023&r)+65536):(n.push(o),e--)}else n.push(o)}return n}function o(t,n){const e=Object.prototype.toString.call(t),r="string"==typeof t||"[object NodeList]"===e||"[object HTMLCollection]"===e||1===t.nodeType,o="function"==typeof n;return r||console.error("Countable: Not a valid target"),o||console.error("Countable: Not a valid callback function"),r&&o}function c(t,n){let o=""+("string"==typeof t?t:"value"in t?t.value:t.textContent);(n=n||{}).stripTags&&(o=o.replace(/<\/?[a-z][^>]*>/gi,"")),n.ignore&&e.call(n.ignore,function(t){o=o.replace(t,"")});const c=o.trim();return{paragraphs:c?(c.match(n.hardReturns?/\n{2,}/g:/\n+/g)||[]).length+1:0,sentences:c?(c.match(/[.?!…]+./g)||[]).length+1:0,words:c?(c.replace(/['";:,.?¿\-]+/g,"").match(/\S+/g)||[]).length:0,characters:c?r(c.replace(/\s/g,"")).length:0,all:r(o).length}}const i={on:function(t,r,i){if(o(t,r))return Array.isArray(t)||(t=[t]),e.call(t,function(t){const e=function(){r.call(t,c(t,i))};n.push({element:t,handler:e}),e(),t.addEventListener("input",e)}),this},off:function(t){if(o(t,function(){}))return Array.isArray(t)||(t=[t]),n.filter(function(n){return-1!==t.indexOf(n.element)}).forEach(function(t){t.element.removeEventListener("input",t.handler)}),n=n.filter(function(n){return-1===t.indexOf(n.element)}),this},count:function(t,n,r){if(o(t,n))return Array.isArray(t)||(t=[t]),e.call(t,function(t){n.call(t,c(t,r))}),this},enabled:function(t){return void 0===t.length&&(t=[t]),n.filter(function(n){return-1!==t.indexOf(n.element)}).length===t.length}};"object"==typeof exports?module.exports=i:"function"==typeof define&&define.amd?define(function(){return i}):t.Countable=i}(this);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/ispace-code/openStack.git
git@gitee.com:ispace-code/openStack.git
ispace-code
openStack
openStack
master

搜索帮助