Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Transform.transformToParseObject = (className, mongoObject, schema) => {
const object = Transform.mongoObjectToParseObject(className, mongoObject, schema);
if (object instanceof Object) {
Object.keys(schema.fields|| {}).forEach(k => {
if ((schema.fields[k].type || '').toLowerCase() == 'date' && typeof object[k] == 'string' && ['createdAt', 'updatedAt'].indexOf(k) == -1) {
object[k] = Parse._encode(new Date(object[k]));
}
});
if (className == '_User') {
if (object['_password_changed_at']) {
object['_password_changed_at'] = Parse._encode(new Date(object['_password_changed_at']));
}
if (object['_email_verify_token_expires_at']) {
object['_email_verify_token_expires_at'] = Parse._encode(new Date(object['_email_verify_token_expires_at']));
}
}