Skip to content

Commit 0d59ddb

Browse files
committed
Stop using jQuery.isFunction since it's deprecated
As of jQuery 3.3, jQuery.isFunction() has been deprecated. In most cases, its use can be replaced by typeof x === "function". See https://api.jquery.com/jquery.isfunction/
1 parent 948eeb9 commit 0d59ddb

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# CHANGELOG
22

3+
## 3.0.10dev
4+
5+
- Update dev dependencies.
6+
- Stop using deprecated $.isFunction.
7+
38
## 3.0.9
49

510
- Add jsdelivr entry in package.json.

src/methods.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ var methods = {};
5151
} else {
5252
score = rulesEngine.executeRules(options, word);
5353
}
54-
if ($.isFunction(options.common.onScore)) {
54+
if (typeof options.common.onScore === 'function') {
5555
score = options.common.onScore(options, word, score);
5656
}
5757
}
@@ -64,7 +64,7 @@ var methods = {};
6464
console.log(score + ' - ' + verdictText);
6565
}
6666

67-
if ($.isFunction(options.common.onKeyUp)) {
67+
if (typeof options.common.onKeyUp === 'function') {
6868
options.common.onKeyUp(event, {
6969
score: score,
7070
verdictText: verdictText,
@@ -115,7 +115,7 @@ var methods = {};
115115
ui.initUI(localOptions, $el);
116116
$el.trigger('keyup');
117117

118-
if ($.isFunction(localOptions.common.onLoad)) {
118+
if (typeof localOptions.common.onLoad === 'function') {
119119
localOptions.common.onLoad();
120120
}
121121
});
@@ -180,10 +180,10 @@ var methods = {};
180180
ruleFunction = rulesEngine.validation[rule],
181181
result;
182182

183-
if (!$.isFunction(ruleFunction)) {
183+
if (typeof ruleFunction !== 'function') {
184184
ruleFunction = options.rules.extra[rule];
185185
}
186-
if ($.isFunction(ruleFunction)) {
186+
if (typeof ruleFunction === 'function') {
187187
result = ruleFunction(options, $(el).val(), 1);
188188
if ($.isNumeric(result)) {
189189
rulesMetCnt += result;

src/rules.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,11 @@ try {
228228
score = options.rules.scores[rule];
229229
funct = rulesEngine.validation[rule];
230230

231-
if (!$.isFunction(funct)) {
231+
if (typeof funct !== 'function') {
232232
funct = options.rules.extra[rule];
233233
}
234234

235-
if ($.isFunction(funct)) {
235+
if (typeof funct === 'function') {
236236
result = funct(options, word, score);
237237
if (result) {
238238
totalScore += result;

0 commit comments

Comments
 (0)