First commit
This commit is contained in:
54
framework/unify/serializer.js
Normal file
54
framework/unify/serializer.js
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2020, 2023, The Unified Company.
|
||||
|
||||
This code is part of Unify.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the ESA Software Community License - Strong Copyleft LICENSE,
|
||||
as published by the ESA.
|
||||
See the ESA Software Community License - Strong Copyleft LICENSE, for more details.
|
||||
|
||||
https://unifyjs.org
|
||||
|
||||
*/
|
||||
|
||||
|
||||
import databaseSerializer from './serializer.database.js';
|
||||
|
||||
import databaseClean from './serializer.clean.js';
|
||||
|
||||
import databaseObject from './serializer.object.js';
|
||||
|
||||
|
||||
|
||||
export default class serializer {
|
||||
|
||||
clean( sourceObject, method ) {
|
||||
|
||||
return databaseClean.clean(sourceObject, method);
|
||||
|
||||
}
|
||||
|
||||
|
||||
serialize( sourceObject, targetObject, client ) {
|
||||
|
||||
if( !sourceObject ) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
if( sourceObject.serializationType == "object" ) {
|
||||
|
||||
return databaseObject.serialize( sourceObject, targetObject, client );
|
||||
|
||||
} else {
|
||||
|
||||
databaseSerializer.serialize( sourceObject, targetObject, client );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user