Skip to content

Commit 34b8718

Browse files
committed
Replace type with _.isXXX
1 parent e7537ec commit 34b8718

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/av.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4469,7 +4469,7 @@
44694469
* @param {boolean} enable true to enable fetchWhenSave option.
44704470
*/
44714471
fetchWhenSave: function(enable){
4472-
if (typeof enable !== 'boolean'){
4472+
if (!_.isBoolean(enable)) {
44734473
throw "Expect boolean value for fetchWhenSave";
44744474
}
44754475
this._fetchWhenSave = enable;
@@ -6908,7 +6908,7 @@
69086908
if(!target){
69096909
throw "Invalid target user.";
69106910
}
6911-
var userObjectId = (typeof target === 'string') ? target: target.id;
6911+
var userObjectId = _.isString(target) ? target: target.id;
69126912
if(!userObjectId){
69136913
throw "Invalid target user.";
69146914
}
@@ -6932,7 +6932,7 @@
69326932
if(!target){
69336933
throw "Invalid target user.";
69346934
}
6935-
var userObjectId = (typeof target === 'string') ? target: target.id;
6935+
var userObjectId = _.isString(target) ? target: target.id;
69366936
if(!userObjectId){
69376937
throw "Invalid target user.";
69386938
}
@@ -7188,7 +7188,7 @@
71887188
* @since 0.3.0
71897189
*/
71907190
followerQuery: function(userObjectId) {
7191-
if(!userObjectId || typeof userObjectId !='string'){
7191+
if(!userObjectId || !_.isString(userObjectId)) {
71927192
throw "Invalid user object id.";
71937193
}
71947194
var query = new AV.FriendShipQuery('_Follower');
@@ -7203,7 +7203,7 @@
72037203
* @since 0.3.0
72047204
*/
72057205
followeeQuery: function(userObjectId) {
7206-
if(!userObjectId || typeof userObjectId !='string'){
7206+
if(!userObjectId || !_.isString(userObjectId)) {
72077207
throw "Invalid user object id.";
72087208
}
72097209
var query = new AV.FriendShipQuery('_Followee');
@@ -8907,7 +8907,7 @@
89078907
* of the function.
89088908
*/
89098909
requestSmsCode: function(data, options){
8910-
if(typeof data === 'string') {
8910+
if(_.isString(data)) {
89118911
data = { mobilePhoneNumber: data };
89128912
}
89138913
if(!data.mobilePhoneNumber) {
@@ -9010,7 +9010,7 @@
90109010
this.data = {};
90119011
this.inboxType = 'default';
90129012
this.query = null;
9013-
if(imageUrl && typeof imageUrl == 'object') {
9013+
if(imageUrl && typeof imageUrl === 'object') {
90149014
this.data = imageUrl;
90159015
} else {
90169016
if(imageUrl){
@@ -9194,7 +9194,7 @@
91949194
if(!target){
91959195
throw "Invalid target user.";
91969196
}
9197-
var userObjectId = (typeof target === 'string') ? target: target.id;
9197+
var userObjectId = _.isString(target) ? target: target.id;
91989198
if(!userObjectId){
91999199
throw "Invalid target user.";
92009200
}
@@ -9238,8 +9238,8 @@
92389238
throw 'Please signin an user or pass the owner objectId.';
92399239
}
92409240
owner = owner || AV.User.current();
9241-
var options = (typeof arguments[1] !== 'string') ? arguments[1] : arguments[2];
9242-
var inboxType = (typeof arguments[1] !== 'string') ? 'default' : arguments[1];
9241+
var options = !_.isString(arguments[1]) ? arguments[1] : arguments[2];
9242+
var inboxType = !_.isString(arguments[1]) ? 'default' : arguments[1];
92439243
var params = {};
92449244
params.inboxType = AV._encode(inboxType);
92459245
params.owner = AV._encode(owner);

0 commit comments

Comments
 (0)