Skip to content

Commit b1aa52b

Browse files
Removes obsoleted closure APIs: goog.isString, goog.isNull, goog.isNumber, goog.isBoolean, etc. (#2737)
1 parent f86f954 commit b1aa52b

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

packages/auth/src/args.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fireauth.args.string = function(opt_name, opt_optional) {
239239
name: opt_name || '',
240240
typeLabel: 'a valid string',
241241
optional: !!opt_optional,
242-
validator: goog.isString
242+
validator: x => typeof x === 'string'
243243
};
244244
};
245245

@@ -256,7 +256,7 @@ fireauth.args.bool = function(opt_name, opt_optional) {
256256
name: opt_name || '',
257257
typeLabel: 'a boolean',
258258
optional: !!opt_optional,
259-
validator: goog.isBoolean
259+
validator: x => typeof x === 'boolean'
260260
};
261261
};
262262

@@ -273,7 +273,7 @@ fireauth.args.number = function(opt_name, opt_optional) {
273273
name: opt_name || '',
274274
typeLabel: 'a valid number',
275275
optional: !!opt_optional,
276-
validator: goog.isNumber
276+
validator: x => typeof x === 'number'
277277
};
278278
};
279279

@@ -324,7 +324,7 @@ fireauth.args.null = function(opt_name, opt_optional) {
324324
name: opt_name || '',
325325
typeLabel: 'null',
326326
optional: !!opt_optional,
327-
validator: goog.isNull
327+
validator: x => x === null
328328
};
329329
};
330330

@@ -527,7 +527,7 @@ fireauth.args.phoneInfoOptions = function(name, optional) {
527527
return fireauth.args.validateMultiFactorSession_(
528528
phoneInfoOptions['session'],
529529
fireauth.MultiFactorSession.Type.ENROLL) &&
530-
goog.isString(phoneInfoOptions['phoneNumber']);
530+
typeof phoneInfoOptions['phoneNumber'] === 'string';
531531
// For multi-factor sign-in, phone multi-factor hint and MFA session
532532
// are provided.
533533
} else if (phoneInfoOptions['session'] &&
@@ -544,10 +544,10 @@ fireauth.args.phoneInfoOptions = function(name, optional) {
544544
return fireauth.args.validateMultiFactorSession_(
545545
phoneInfoOptions['session'],
546546
fireauth.MultiFactorSession.Type.SIGN_IN) &&
547-
goog.isString(phoneInfoOptions['multiFactorUid']);
547+
typeof phoneInfoOptions['multiFactorUid'] === 'string';
548548
// For single-factor sign-in, only phone number needs to be provided.
549549
} else if (phoneInfoOptions['phoneNumber']) {
550-
return goog.isString(phoneInfoOptions['phoneNumber']);
550+
return typeof phoneInfoOptions['phoneNumber'] === 'string';
551551
}
552552
return false;
553553
})
@@ -562,7 +562,7 @@ fireauth.args.phoneInfoOptions = function(name, optional) {
562562
* @private
563563
*/
564564
fireauth.args.validateMultiFactorSession_ = function(session, type) {
565-
return goog.isObject(session) && goog.isString(session.type) &&
565+
return goog.isObject(session) && typeof session.type === 'string' &&
566566
session.type === type &&
567567
goog.isFunction(session.getRawSession);
568568
};
@@ -574,7 +574,7 @@ fireauth.args.validateMultiFactorSession_ = function(session, type) {
574574
* @private
575575
*/
576576
fireauth.args.validateMultiFactorInfo_ = function(info) {
577-
return goog.isObject(info) && goog.isString(info['uid']);
577+
return goog.isObject(info) && typeof info['uid'] === 'string';
578578
};
579579

580580

@@ -612,7 +612,7 @@ fireauth.args.applicationVerifier = function(opt_optional) {
612612
/** @type {function(!firebase.auth.ApplicationVerifier) : boolean} */ (
613613
function(applicationVerifier) {
614614
return !!(applicationVerifier &&
615-
goog.isString(applicationVerifier.type) &&
615+
typeof applicationVerifier.type === 'string' &&
616616
goog.isFunction(applicationVerifier.verify));
617617
})
618618
});

packages/auth/src/authcredential.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ fireauth.PhoneAuthProvider.prototype.verifyPhoneNumber =
13631363
// time after sending the token to the server.
13641364
return goog.Promise.resolve(applicationVerifier['verify']())
13651365
.then(function(assertion) {
1366-
if (!goog.isString(assertion)) {
1366+
if (typeof assertion !== 'string') {
13671367
throw new fireauth.AuthError(fireauth.authenum.Error.ARGUMENT_ERROR,
13681368
'An implementation of firebase.auth.ApplicationVerifier' +
13691369
'.prototype.verify() must return a firebase.Promise ' +
@@ -1565,7 +1565,7 @@ fireauth.AuthProvider.getCredentialFromResponse = function(response) {
15651565
* @return {?fireauth.AuthCredential} The corresponding AuthCredential.
15661566
*/
15671567
fireauth.AuthProvider.getCredentialFromJSON = function(json) {
1568-
var obj = goog.isString(json) ? JSON.parse(json) : json;
1568+
var obj = typeof json === 'string' ? JSON.parse(json) : json;
15691569
var credential;
15701570
var fromJSON = [
15711571
fireauth.OAuthCredential.fromJSON,

packages/auth/src/multifactoruser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ fireauth.MultiFactorUser.prototype.enroll = function(assertion, displayName) {
201201
*/
202202
fireauth.MultiFactorUser.prototype.unenroll = function(target) {
203203
var self = this;
204-
var uid = goog.isString(target) ? target : target['uid'];
204+
var uid = typeof target === 'string' ? target : target['uid'];
205205
var rpcHandler = this.user_.getRpcHandler();
206206
return this.user_.getIdToken().then(function(idToken) {
207207
return rpcHandler.withdrawMfa(idToken, uid);

packages/auth/src/storage/localstorage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fireauth.storage.LocalStorage.prototype.set = function(key, value) {
136136
return goog.Promise.resolve()
137137
.then(function() {
138138
var obj = fireauth.util.stringifyJSON(value);
139-
if (goog.isNull(obj)) {
139+
if (obj === null) {
140140
self.remove(key);
141141
} else {
142142
self.storage_.setItem(key, obj);

packages/auth/src/storage/sessionstorage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ fireauth.storage.SessionStorage.prototype.set = function(key, value) {
136136
return goog.Promise.resolve()
137137
.then(function() {
138138
var obj = fireauth.util.stringifyJSON(value);
139-
if (goog.isNull(obj)) {
139+
if (obj === null) {
140140
self.remove(key);
141141
} else {
142142
self.storage_.setItem(key, obj);

packages/auth/src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ fireauth.util.EMAIL_ADDRESS_REGEXP_ = /^[^@]+@[^@]+$/;
482482
* @return {boolean} Whether the email address is valid.
483483
*/
484484
fireauth.util.isValidEmailAddress = function(email) {
485-
return goog.isString(email) &&
485+
return typeof email === 'string' &&
486486
fireauth.util.EMAIL_ADDRESS_REGEXP_.test(email);
487487
};
488488

@@ -1140,7 +1140,7 @@ fireauth.util.removeEntriesWithKeys = function(obj, keys) {
11401140
* @return {*} The raw object.
11411141
*/
11421142
fireauth.util.parseJSON = function(json) {
1143-
if (goog.isNull(json)) {
1143+
if (json === null) {
11441144
return undefined;
11451145
}
11461146

0 commit comments

Comments
 (0)