Skip to content

Removes obsoleted closure APIs #2737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions packages/auth/src/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ fireauth.args.string = function(opt_name, opt_optional) {
name: opt_name || '',
typeLabel: 'a valid string',
optional: !!opt_optional,
validator: goog.isString
validator: x => typeof x === 'string'
};
};

Expand All @@ -256,7 +256,7 @@ fireauth.args.bool = function(opt_name, opt_optional) {
name: opt_name || '',
typeLabel: 'a boolean',
optional: !!opt_optional,
validator: goog.isBoolean
validator: x => typeof x === 'boolean'
};
};

Expand All @@ -273,7 +273,7 @@ fireauth.args.number = function(opt_name, opt_optional) {
name: opt_name || '',
typeLabel: 'a valid number',
optional: !!opt_optional,
validator: goog.isNumber
validator: x => typeof x === 'number'
};
};

Expand Down Expand Up @@ -324,7 +324,7 @@ fireauth.args.null = function(opt_name, opt_optional) {
name: opt_name || '',
typeLabel: 'null',
optional: !!opt_optional,
validator: goog.isNull
validator: x => x === null
};
};

Expand Down Expand Up @@ -527,7 +527,7 @@ fireauth.args.phoneInfoOptions = function(name, optional) {
return fireauth.args.validateMultiFactorSession_(
phoneInfoOptions['session'],
fireauth.MultiFactorSession.Type.ENROLL) &&
goog.isString(phoneInfoOptions['phoneNumber']);
typeof phoneInfoOptions['phoneNumber'] === 'string';
// For multi-factor sign-in, phone multi-factor hint and MFA session
// are provided.
} else if (phoneInfoOptions['session'] &&
Expand All @@ -544,10 +544,10 @@ fireauth.args.phoneInfoOptions = function(name, optional) {
return fireauth.args.validateMultiFactorSession_(
phoneInfoOptions['session'],
fireauth.MultiFactorSession.Type.SIGN_IN) &&
goog.isString(phoneInfoOptions['multiFactorUid']);
typeof phoneInfoOptions['multiFactorUid'] === 'string';
// For single-factor sign-in, only phone number needs to be provided.
} else if (phoneInfoOptions['phoneNumber']) {
return goog.isString(phoneInfoOptions['phoneNumber']);
return typeof phoneInfoOptions['phoneNumber'] === 'string';
}
return false;
})
Expand All @@ -562,7 +562,7 @@ fireauth.args.phoneInfoOptions = function(name, optional) {
* @private
*/
fireauth.args.validateMultiFactorSession_ = function(session, type) {
return goog.isObject(session) && goog.isString(session.type) &&
return goog.isObject(session) && typeof session.type === 'string' &&
session.type === type &&
goog.isFunction(session.getRawSession);
};
Expand All @@ -574,7 +574,7 @@ fireauth.args.validateMultiFactorSession_ = function(session, type) {
* @private
*/
fireauth.args.validateMultiFactorInfo_ = function(info) {
return goog.isObject(info) && goog.isString(info['uid']);
return goog.isObject(info) && typeof info['uid'] === 'string';
};


Expand Down Expand Up @@ -612,7 +612,7 @@ fireauth.args.applicationVerifier = function(opt_optional) {
/** @type {function(!firebase.auth.ApplicationVerifier) : boolean} */ (
function(applicationVerifier) {
return !!(applicationVerifier &&
goog.isString(applicationVerifier.type) &&
typeof applicationVerifier.type === 'string' &&
goog.isFunction(applicationVerifier.verify));
})
});
Expand Down
4 changes: 2 additions & 2 deletions packages/auth/src/authcredential.js
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,7 @@ fireauth.PhoneAuthProvider.prototype.verifyPhoneNumber =
// time after sending the token to the server.
return goog.Promise.resolve(applicationVerifier['verify']())
.then(function(assertion) {
if (!goog.isString(assertion)) {
if (typeof assertion !== 'string') {
throw new fireauth.AuthError(fireauth.authenum.Error.ARGUMENT_ERROR,
'An implementation of firebase.auth.ApplicationVerifier' +
'.prototype.verify() must return a firebase.Promise ' +
Expand Down Expand Up @@ -1565,7 +1565,7 @@ fireauth.AuthProvider.getCredentialFromResponse = function(response) {
* @return {?fireauth.AuthCredential} The corresponding AuthCredential.
*/
fireauth.AuthProvider.getCredentialFromJSON = function(json) {
var obj = goog.isString(json) ? JSON.parse(json) : json;
var obj = typeof json === 'string' ? JSON.parse(json) : json;
var credential;
var fromJSON = [
fireauth.OAuthCredential.fromJSON,
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/multifactoruser.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ fireauth.MultiFactorUser.prototype.enroll = function(assertion, displayName) {
*/
fireauth.MultiFactorUser.prototype.unenroll = function(target) {
var self = this;
var uid = goog.isString(target) ? target : target['uid'];
var uid = typeof target === 'string' ? target : target['uid'];
var rpcHandler = this.user_.getRpcHandler();
return this.user_.getIdToken().then(function(idToken) {
return rpcHandler.withdrawMfa(idToken, uid);
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/storage/localstorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fireauth.storage.LocalStorage.prototype.set = function(key, value) {
return goog.Promise.resolve()
.then(function() {
var obj = fireauth.util.stringifyJSON(value);
if (goog.isNull(obj)) {
if (obj === null) {
self.remove(key);
} else {
self.storage_.setItem(key, obj);
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/storage/sessionstorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fireauth.storage.SessionStorage.prototype.set = function(key, value) {
return goog.Promise.resolve()
.then(function() {
var obj = fireauth.util.stringifyJSON(value);
if (goog.isNull(obj)) {
if (obj === null) {
self.remove(key);
} else {
self.storage_.setItem(key, obj);
Expand Down
4 changes: 2 additions & 2 deletions packages/auth/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ fireauth.util.EMAIL_ADDRESS_REGEXP_ = /^[^@]+@[^@]+$/;
* @return {boolean} Whether the email address is valid.
*/
fireauth.util.isValidEmailAddress = function(email) {
return goog.isString(email) &&
return typeof email === 'string' &&
fireauth.util.EMAIL_ADDRESS_REGEXP_.test(email);
};

Expand Down Expand Up @@ -1140,7 +1140,7 @@ fireauth.util.removeEntriesWithKeys = function(obj, keys) {
* @return {*} The raw object.
*/
fireauth.util.parseJSON = function(json) {
if (goog.isNull(json)) {
if (json === null) {
return undefined;
}

Expand Down