helper-js
Advanced tools
Comparing version 1.0.18 to 1.0.19
{ | ||
"name": "helper-js", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/helper-js.common.js", |
@@ -74,8 +74,8 @@ // local store | ||
return str | ||
.replace(/ /g, '-') | ||
.replace(/_/g, '-') | ||
.replace(/([^A-Z])([A-Z])/g, '$1-$2') | ||
.replace(/--+/g, '-') | ||
.replace(/^-|-$|/g, '') | ||
.toLowerCase() | ||
.replace(/ /g, '-') | ||
.replace(/_/g, '-') | ||
.replace(/([^A-Z])([A-Z])/g, '$1-$2') | ||
.replace(/--+/g, '-') | ||
.replace(/^-|-$|/g, '') | ||
.toLowerCase() | ||
} | ||
@@ -216,2 +216,9 @@ export function camelCase (str) { | ||
} | ||
// function | ||
export function executeWithCount(func, context) { | ||
let count = 0 | ||
return (...args) => { | ||
return func.apply(context, args.concat(count++)) | ||
} | ||
} | ||
// url | ||
@@ -301,3 +308,3 @@ /* eslint-disable */ | ||
if (el.classList) | ||
{ el.classList.add(className) } | ||
{ el.classList.add(className) } | ||
else | ||
@@ -310,3 +317,3 @@ { el.className += ' ' + className } | ||
if (el.classList) | ||
{ el.classList.remove(className) } | ||
{ el.classList.remove(className) } | ||
else | ||
@@ -372,5 +379,5 @@ { el.className = el.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ') } | ||
export function onDOM(el, name, handler) { | ||
if (el.addEventListener) { // 所有主流浏览器,除了 IE 8 及更早 IE版本 | ||
if (el.addEventListener) { // 所有主流浏览器,除了 IE 8 及更早 IE版本 | ||
el.addEventListener(name, handler) | ||
} else if (el.attachEvent) { // IE 8 及更早 IE 版本 | ||
} else if (el.attachEvent) { // IE 8 及更早 IE 版本 | ||
el.attachEvent(`on${name}`, handler) | ||
@@ -380,5 +387,5 @@ } | ||
export function offDOM(el, name, handler) { | ||
if (el.removeEventListener) { // 所有主流浏览器,除了 IE 8 及更早 IE版本 | ||
if (el.removeEventListener) { // 所有主流浏览器,除了 IE 8 及更早 IE版本 | ||
el.removeEventListener(name, handler) | ||
} else if (el.detachEvent) { // IE 8 及更早 IE 版本 | ||
} else if (el.detachEvent) { // IE 8 及更早 IE 版本 | ||
el.detachEvent(`on${name}`, handler) | ||
@@ -385,0 +392,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77543
2183