mapper-factory 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/class.decorator.js +1 -1
- package/dist/example.js +1 -0
- package/dist/functions.d.ts +1 -1
- package/dist/functions.js +4 -4
- package/package.json +1 -1
package/dist/class.decorator.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.MapClass = void 0;
|
|
|
4
4
|
const functions_1 = require("./functions");
|
|
5
5
|
function MapClass() {
|
|
6
6
|
return function (constructor) {
|
|
7
|
-
constructor.prototype.from = functions_1.
|
|
7
|
+
constructor.prototype.from = functions_1.from;
|
|
8
8
|
constructor.prototype.toMap = functions_1.toMap;
|
|
9
9
|
constructor.prototype.toModel = functions_1.objToModel;
|
|
10
10
|
constructor.prototype.empty = functions_1.empty;
|
package/dist/example.js
CHANGED
package/dist/functions.d.ts
CHANGED
package/dist/functions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.from = exports.copy = exports.set = exports.get = exports.filled = exports.empty = exports.objToModel = exports.toMap = void 0;
|
|
4
4
|
const field_decorator_1 = require("./field.decorator");
|
|
5
5
|
/**
|
|
6
6
|
* Convert the instance of this class to JSON Object.
|
|
@@ -200,7 +200,7 @@ exports.set = set;
|
|
|
200
200
|
* Deep copy of the object caller
|
|
201
201
|
*/
|
|
202
202
|
function copy() {
|
|
203
|
-
return this.
|
|
203
|
+
return this.from(this.toMap());
|
|
204
204
|
}
|
|
205
205
|
exports.copy = copy;
|
|
206
206
|
/**
|
|
@@ -208,7 +208,7 @@ exports.copy = copy;
|
|
|
208
208
|
*
|
|
209
209
|
* @param object object to be mapped considering metadata "src", "transformer" and "reverser"
|
|
210
210
|
*/
|
|
211
|
-
function
|
|
211
|
+
function from(object) {
|
|
212
212
|
const metadataList = (0, field_decorator_1.getMapFieldMetadataList)(this);
|
|
213
213
|
object && Object.keys(object).forEach(propertyName => {
|
|
214
214
|
let metaKeys = metadataList && Object.keys(metadataList).filter(metadata => metadataList[metadata]?.src?.split('.')?.includes(propertyName));
|
|
@@ -297,4 +297,4 @@ function constructorMap(object) {
|
|
|
297
297
|
});
|
|
298
298
|
return this;
|
|
299
299
|
}
|
|
300
|
-
exports.
|
|
300
|
+
exports.from = from;
|