{"_id":"@agutierrezt9410/mapper","_rev":"8-9ae0d2c1ae1235160a21401ab4661bc6","name":"@agutierrezt9410/mapper","dist-tags":{"latest":"1.0.6"},"versions":{"0.0.1":{"name":"@agutierrezt9410/mapper","version":"0.0.1","description":"A project to transform models to DTOs and vice versa using functions and generics","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint && npm run test","version":"npm run format && npm run build && git add -A src","postversion":"git push && git push --tags","lint":"eslint src --ext .ts --fix","prebuild":"npm run lint","build":"tsc && tsc-alias","prestart":"npm run format && npm run build","start":"node dist/index.js","watch":"./node_modules/nodemon/bin/nodemon.js","test":"jest --coverage","format":"prettier --write \"src/**/*.ts\""},"repository":{"type":"git","url":"git+ssh://git@github.com/Andres930410/mapper.git"},"keywords":["ts","mapper","generics"],"author":{"name":"Andres Gutierrez","email":"agutierrezt@slabcode.com"},"license":"ISC","bugs":{"url":"https://github.com/Andres930410/mapper/issues"},"homepage":"https://github.com/Andres930410/mapper#readme","devDependencies":{"@types/jest":"^28.1.3","@types/node":"^18.0.0","@typescript-eslint/eslint-plugin":"^5.29.0","eslint":"^8.18.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.0.0","jest":"^28.1.1","jest-module-name-mapper":"^0.1.5","nodemon":"^2.0.18","prettier":"^2.7.1","ts-jest":"^28.0.5","ts-node":"^10.8.1","tsc-alias":"^1.6.11","typescript":"^4.7.4"},"gitHead":"3c46140cb7d1be9199b1594a8916bccdd86b0fc0","_id":"@agutierrezt9410/mapper@0.0.1","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-fZNpEVUtWXWMxmJ0KDKvd5dxG/KbA3wHTPGBpG0dX7hnAZet1F7pyURlERoqipegLAQH9nKxdkwaBW7QsneujQ==","shasum":"9df28d60e26433edfc22deca699547c95088628a","tarball":"https://registry.npmjs.org/@agutierrezt9410/mapper/-/mapper-0.0.1.tgz","fileCount":23,"unpackedSize":71588,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDabAx0H9HSwh0PQv0dQVWAzTiQwhhETCkaCe9i16pFcAIhALqrkL0RcV+v9Djl+nOO1Hc55Birtjv3XGiSVfzcPM+2"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiuNRhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpD4g/+KedMCi4aLjfd1Jwi1kZYDFmgGir+jd6SXks2fzCa6tRPWEU0\r\nAU/ly7nppl5kejO5NHkVNkULBg2p4almA/NJP6gRyuGkYpU+1TbzA4zPEdgk\r\nwkTmbU0xcVVtyK+XHsxLVz2uTOQKVQ2SfBXvsEBA8gd6cz2Jcoqs0v2LSsxT\r\nyvKTnMcUDXGMF8PF0R5pEYRKgpjq4qyjwYlPAGgFhmgPdEGYFxGbK+d2mhHL\r\ngEJ0sb3XmEeorkCAvc5kgniNX16tr/36GBECe6zDdI6at5kDiK1EhmSXKeFX\r\nVsKHs1/ZGJfzQGD7VuDo6Q/VXLhoDLwNeqB+Xn1hUUraI+ISQ75c7y2nBOeU\r\nlqQHrNeRENYTlnDBK716mMoDH62uIjjCrDUfe3SeuCt1SX/nBSKreskOXHIE\r\n4rDzsnBPx4IIerMjqg4eC0qaouuBaRobMwGCG8Q2FlDKKhdziZcKH+hVBviw\r\nF9D2XHfYnS5QM9R2hIpJO+1N1wP29aRBSkhDCA2eycmkystmMDquKa4OMHYN\r\npntMBr/vkhy12udILl93y+Q5jRSD/dn5CX0zHCK56iG+YzG7Fbo7CJ5L3WUA\r\nBl+1BOY3XaxAVLi0KGrFVaHOMDZi3rmWD0zbBAcODvF7SOzRzyMJksU3Eaei\r\nhAWLy4vSWyjuWJcoxal3C1dc4Qa+GZIf3cI=\r\n=KzHU\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"},"directories":{},"maintainers":[{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mapper_0.0.1_1656280161369_0.4524802043007219"},"_hasShrinkwrap":false},"0.0.2":{"name":"@agutierrezt9410/mapper","version":"0.0.2","description":"A project to transform models to DTOs and vice versa using functions and generics","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint && npm run test","version":"npm run format && npm run build && git add -A src","postversion":"git push && git push --tags","lint":"eslint src --ext .ts --fix","prebuild":"npm run lint","build":"tsc && tsc-alias","prestart":"npm run format && npm run build","start":"node dist/index.js","watch":"./node_modules/nodemon/bin/nodemon.js","test":"jest --coverage","format":"prettier --write \"src/**/*.ts\""},"repository":{"type":"git","url":"git+ssh://git@github.com/Andres930410/mapper.git"},"keywords":["ts","mapper","generics"],"author":{"name":"Andres Gutierrez","email":"agutierrezt@slabcode.com"},"license":"ISC","bugs":{"url":"https://github.com/Andres930410/mapper/issues"},"homepage":"https://github.com/Andres930410/mapper#readme","devDependencies":{"@types/jest":"^28.1.3","@types/node":"^18.0.0","@typescript-eslint/eslint-plugin":"^5.29.0","eslint":"^8.18.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.0.0","jest":"^28.1.1","jest-module-name-mapper":"^0.1.5","nodemon":"^2.0.18","prettier":"^2.7.1","ts-jest":"^28.0.5","ts-node":"^10.8.1","tsc-alias":"^1.6.11","typescript":"^4.7.4"},"gitHead":"a444a23270064db9bf8bac8ba5975293fe6ce7cc","_id":"@agutierrezt9410/mapper@0.0.2","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-Ib4ZVXd98ZkZYjQoMOB6nbvtpMP/tnYGmQsdPxJ7p80scViFeYZvXXT/vd1D/YhwJTYuPoNJnI2YAMY3/Rb1Dg==","shasum":"be6d51ff7f38cbdc2218cd35d3c963bc2a73d3c2","tarball":"https://registry.npmjs.org/@agutierrezt9410/mapper/-/mapper-0.0.2.tgz","fileCount":23,"unpackedSize":76764,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDPCZ3dGrJ0mqD53wp+1kW/bAW/MXhEaWokjqmmg7/X8AiEAuP/cM41ebusw0B5PdqIE68l5sE+SVGUAQtW831ELrg0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiua+cACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqB3hAAlM3nq8WHZcGpY8BL+ob7hNRW4JDGi0l6SNbIyXGkR/dTBMtX\r\nFjlbvBhqXwHAi9PfBP2kQBO86MyO+2rXmkk952a5OUu5xdui+P1sWMEDKcUL\r\nOdmMEZareezFvmE++OChi5EFjXVJ6QNnJIf35hNl3Z1++ZmUFR68TlVpqR5n\r\nnNX0q3KT1sSMKh9v4ZJtsNF7DzJcPW41QbI5Y9d4G7qorUhknUy+zmpxqXCp\r\nKL96GRsrSj0mfbgVJdgH32fWBTsAGUQdEqa8DVkevVpJx3ACz+UF+LMP8R9L\r\npaiE4HvwNzHW9xKi56EczEBTQ8ARdVlHOHR3zLJvz4xMRZzS32so2TAB0bvK\r\nQiYvYXSXq5/62Qpa7yiuYrxnl7KZjpaDmmKDXk4KmedsYjxkbkFti/04a/x2\r\ncjv+PF9NeHV4C1cHiUe9VLmPUP0BU7u4g13gsY1qr7nUJsoMVoryTEEtF1vH\r\nxaLLwHMO8oUwZOcprrdaOwxdbrRUcYtMZIECNFA4Ki07y1nIuzWRo2ODCLKD\r\n/jtx4v8T4DfwRsk0ultkDwGdFb/+iRsWt7ljyRiweyCUG3cVaaBeM+RLe4W1\r\nAfh630p4ytX+EM/a4yDemvi3lNhshqhmz0uiOlEwWKjuP5kMOAx9x4sWhZXK\r\nwwUVs1RycpnVXiCop/fPrhD2GviLitsAikY=\r\n=DPwF\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"},"directories":{},"maintainers":[{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mapper_0.0.2_1656336284628_0.48745673150695423"},"_hasShrinkwrap":false},"1.0.1":{"name":"@agutierrezt9410/mapper","version":"1.0.1","description":"A project to transform models to DTOs and vice versa using functions and generics","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint && npm run test","version":"npm run format && npm run build && git add -A src","postversion":"git push && git push --tags","lint":"eslint src --ext .ts --fix","prebuild":"npm run lint","build":"tsc && tsc-alias","prestart":"npm run format && npm run build","start":"node dist/index.js","watch":"./node_modules/nodemon/bin/nodemon.js","test":"jest --coverage","format":"prettier --write \"src/**/*.ts\""},"repository":{"type":"git","url":"git+ssh://git@github.com/Andres930410/mapper.git"},"keywords":["ts","mapper","generics"],"author":{"name":"Andres Gutierrez","email":"agutierrezt@slabcode.com"},"license":"ISC","bugs":{"url":"https://github.com/Andres930410/mapper/issues"},"homepage":"https://github.com/Andres930410/mapper#readme","devDependencies":{"@types/jest":"^28.1.3","@types/node":"^18.0.0","@typescript-eslint/eslint-plugin":"^5.29.0","eslint":"^8.18.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.0.0","jest":"^28.1.1","jest-module-name-mapper":"^0.1.5","nodemon":"^2.0.18","prettier":"^2.7.1","ts-jest":"^28.0.5","ts-node":"^10.8.1","tsc-alias":"^1.6.11","typescript":"^4.7.4"},"dependencies":{"class-transformer":"^0.5.1","class-validator":"^0.14.0"},"gitHead":"b318c84c7ea5e3d106d119fa3c3476f63bd1427e","_id":"@agutierrezt9410/mapper@1.0.1","_nodeVersion":"16.15.0","_npmVersion":"9.7.1","dist":{"integrity":"sha512-zw8xBSpN15x6uTVFfEvpA6eeM51VMvG6Nn/cuuAilE+X2z6f1wLyKqBfXHSu/ZwH5gaoojXKQoRKllmQT5enig==","shasum":"596db59760a8d07484985f955f08a0abb9881300","tarball":"https://registry.npmjs.org/@agutierrezt9410/mapper/-/mapper-1.0.1.tgz","fileCount":23,"unpackedSize":106170,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCvsFE2j+YtEBmhfhu5OIcjmjgNH3Lnp5vxdiXAFxVS9AIhAIYNfdJ1tIQHtfEbZTneQPluTq/Ikt4uZ9rY+vt9PB6C"}]},"_npmUser":{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"},"directories":{},"maintainers":[{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mapper_1.0.1_1687555639374_0.5736373012822968"},"_hasShrinkwrap":false},"1.0.2":{"name":"@agutierrezt9410/mapper","version":"1.0.2","description":"A project to transform models to DTOs and vice versa using functions and generics","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint && npm run test","version":"npm run format && npm run build && git add -A src","postversion":"git push && git push --tags","lint":"eslint src --ext .ts --fix","prebuild":"npm run lint","build":"tsc && tsc-alias","prestart":"npm run format && npm run build","start":"node dist/index.js","watch":"./node_modules/nodemon/bin/nodemon.js","test":"jest --coverage","format":"prettier --write \"src/**/*.ts\""},"repository":{"type":"git","url":"git+ssh://git@github.com/Andres930410/mapper.git"},"keywords":["ts","mapper","generics"],"author":{"name":"Andres Gutierrez","email":"agutierrezt@slabcode.com"},"license":"ISC","bugs":{"url":"https://github.com/Andres930410/mapper/issues"},"homepage":"https://github.com/Andres930410/mapper#readme","devDependencies":{"@types/jest":"^28.1.3","@types/node":"^18.0.0","@typescript-eslint/eslint-plugin":"^5.29.0","eslint":"^8.18.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.0.0","jest":"^28.1.1","jest-module-name-mapper":"^0.1.5","nodemon":"^2.0.18","prettier":"^2.7.1","ts-jest":"^28.0.5","ts-node":"^10.8.1","tsc-alias":"^1.6.11","typescript":"^4.7.4"},"dependencies":{"class-transformer":"^0.5.1","class-validator":"^0.14.0"},"gitHead":"49388c356ffa08e20d56bc82b9b324856e084547","_id":"@agutierrezt9410/mapper@1.0.2","_nodeVersion":"18.9.0","_npmVersion":"8.19.1","dist":{"integrity":"sha512-tYNQ3ilg67UW2GVpP7PEICwEbeU8T4eYk6YyoAeNBi89Gemap3nPjIeHDI1BVRDYzrhQE0v6WLRAPB43LUtdNQ==","shasum":"d9b8cf6e86c3e10afe0bb41f1aa2623a774cddfe","tarball":"https://registry.npmjs.org/@agutierrezt9410/mapper/-/mapper-1.0.2.tgz","fileCount":23,"unpackedSize":106150,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE1/Y/7xqAJL92ypzfCGjeknqcwt3TI6ri6i9qbFYGxMAiEA7AossoXaUjMhyeXvmi4EYcJ9eS0zD1MoWWRLuFrRwDI="}]},"_npmUser":{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"},"directories":{},"maintainers":[{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mapper_1.0.2_1687639778106_0.26609694624290636"},"_hasShrinkwrap":false},"1.0.3":{"name":"@agutierrezt9410/mapper","version":"1.0.3","description":"A project to transform models to DTOs and vice versa using functions and generics","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prepare":"npm run build","prepublishOnly":"npm test && npm run lint","preversion":"npm run lint && npm run test","version":"npm run format && npm run build && git add -A src","postversion":"git push && git push --tags","lint":"eslint src --ext .ts --fix","prebuild":"npm run lint","build":"tsc && tsc-alias","prestart":"npm run format && npm run build","start":"node dist/index.js","watch":"./node_modules/nodemon/bin/nodemon.js","test":"jest --coverage","format":"prettier --write \"src/**/*.ts\""},"repository":{"type":"git","url":"git+ssh://git@github.com/Andres930410/mapper.git"},"keywords":["ts","mapper","generics"],"author":{"name":"Andres Gutierrez","email":"agutierrezt@slabcode.com"},"license":"ISC","bugs":{"url":"https://github.com/Andres930410/mapper/issues"},"homepage":"https://github.com/Andres930410/mapper#readme","devDependencies":{"@types/jest":"^28.1.3","@types/node":"^18.0.0","@typescript-eslint/eslint-plugin":"^5.29.0","eslint":"^8.18.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.0.0","jest":"^28.1.1","jest-module-name-mapper":"^0.1.5","nodemon":"^2.0.18","prettier":"^2.7.1","ts-jest":"^28.0.5","ts-node":"^10.8.1","tsc-alias":"^1.6.11","typescript":"^4.7.4"},"dependencies":{"class-transformer":"^0.5.1","class-validator":"^0.14.0"},"gitHead":"e7953ae5d706efa4b11e6e70808b5626dde51115","_id":"@agutierrezt9410/mapper@1.0.3","_nodeVersion":"18.9.0","_npmVersion":"8.19.1","dist":{"integrity":"sha512-r/5i1jcxMqrfUGSqetImku8YUHeNdNbw7NGcZ3xsu3AnRGAHJ2bt+vXKDmRGb2u88yj7NPfUZDA10k7CrWPZ1Q==","shasum":"4e93329453ebfb493f17c5e08ed3a7167b5a12d1","tarball":"https://registry.npmjs.org/@agutierrezt9410/mapper/-/mapper-1.0.3.tgz","fileCount":23,"unpackedSize":109173,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHZ/9/LHBhIulRgdzs9ynMZptxvrOQo0+ujaPwmTQS9fAiBUXiYxOipF+VoDG8snWS77LTOhfg6iiN8DDlYqSLWSfw=="}]},"_npmUser":{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"},"directories":{},"maintainers":[{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mapper_1.0.3_1713395847287_0.7874118447513625"},"_hasShrinkwrap":false},"1.0.5":{"name":"@agutierrezt9410/mapper","version":"1.0.5","description":"A project to transform models to DTOs and vice versa using functions and generics","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"preversion":"npm run test && npm run format && npm run build","lint":"eslint src --ext .ts --fix","prebuild":"npm run lint","build":"tsc && tsc-alias","prestart":"npm run format && npm run build","start":"node dist/index.js","watch":"./node_modules/nodemon/bin/nodemon.js","test":"jest --coverage","format":"prettier --write \"src/**/*.ts\""},"repository":{"type":"git","url":"git+ssh://git@github.com/Andres930410/mapper.git"},"keywords":["ts","mapper","generics"],"author":{"name":"Andres Gutierrez","email":"agutierrezt@slabcode.com"},"license":"ISC","bugs":{"url":"https://github.com/Andres930410/mapper/issues"},"homepage":"https://github.com/Andres930410/mapper#readme","devDependencies":{"@types/jest":"^28.1.3","@types/node":"^18.0.0","@typescript-eslint/eslint-plugin":"^5.29.0","eslint":"^8.18.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.0.0","jest":"^28.1.1","jest-module-name-mapper":"^0.1.5","nodemon":"^2.0.18","prettier":"^2.7.1","ts-jest":"^28.0.5","ts-node":"^10.8.1","tsc-alias":"^1.6.11","typescript":"^4.7.4"},"dependencies":{"class-transformer":"^0.5.1","class-validator":"^0.14.0"},"gitHead":"87544f986526fdc9cbb33c362abe23a4aa1e609c","_id":"@agutierrezt9410/mapper@1.0.5","_nodeVersion":"18.9.0","_npmVersion":"8.19.1","dist":{"integrity":"sha512-lodL3hS1GOlVKBHIOFWlulOHvI65HwDNn33PKiHwsoNS1vLj0QG0ARp1foCTZkZEHpIV7nnzq845jTQSle9iXw==","shasum":"18654d9684edabeb7506bcd06f983a7e08e9862c","tarball":"https://registry.npmjs.org/@agutierrezt9410/mapper/-/mapper-1.0.5.tgz","fileCount":23,"unpackedSize":109071,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCloPWIiQgcV6MsIOe1wi17h3NAncXmzYCsvdvlZqx9IAIgQMY2QG7z4TEhzQM8bdNphXPH6lX0UW8Zt+A32VJDQjw="}]},"_npmUser":{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"},"directories":{},"maintainers":[{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mapper_1.0.5_1713396446941_0.5297935167504102"},"_hasShrinkwrap":false},"1.0.6":{"name":"@agutierrezt9410/mapper","version":"1.0.6","description":"A project to transform models to DTOs and vice versa using functions and generics","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"preversion":"npm test && npm run format","version":"npm run build && git add -A","postversion":"git push && git push --tags","lint":"eslint src --ext .ts --fix","prebuild":"npm run lint","build":"tsc && tsc-alias","prestart":"npm run format && npm run build","start":"node dist/index.js","watch":"./node_modules/nodemon/bin/nodemon.js","test":"jest --coverage","format":"prettier --write \"src/**/*.ts\""},"repository":{"type":"git","url":"git+ssh://git@github.com/Andres930410/mapper.git"},"keywords":["ts","mapper","generics"],"author":{"name":"Andres Gutierrez","email":"agutierrezt@slabcode.com"},"license":"ISC","bugs":{"url":"https://github.com/Andres930410/mapper/issues"},"homepage":"https://github.com/Andres930410/mapper#readme","devDependencies":{"@types/jest":"^28.1.3","@types/node":"^18.0.0","@typescript-eslint/eslint-plugin":"^5.29.0","eslint":"^8.18.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.0.0","jest":"^28.1.1","jest-module-name-mapper":"^0.1.5","nodemon":"^2.0.18","prettier":"^2.7.1","ts-jest":"^28.0.5","ts-node":"^10.8.1","tsc-alias":"^1.6.11","typescript":"^4.7.4"},"dependencies":{"class-transformer":"^0.5.1","class-validator":"^0.14.0"},"gitHead":"2928aaae6e6e391d6bf7f55f70df25d0f3dfb999","_id":"@agutierrezt9410/mapper@1.0.6","_nodeVersion":"18.9.0","_npmVersion":"8.19.1","dist":{"integrity":"sha512-XwOlaYjKZjau7od3bCnJa9WiZw1DSJkwSpFLIv2LUqqiAd91iKNdFc3I2C6gbYphD3/rS+2B0l9L4PAwuxIm6A==","shasum":"d6d260f93c77eec1a08859867fe27cc844058d1a","tarball":"https://registry.npmjs.org/@agutierrezt9410/mapper/-/mapper-1.0.6.tgz","fileCount":23,"unpackedSize":109224,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCEgjGe17SUAl/VVlNA/B0oxIIVi3+6ULG6inxvwNtbJwIgNPuJ6CKVe0+zdnA74+q+03jV83Qo4OASLxDO39w0HLM="}]},"_npmUser":{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"},"directories":{},"maintainers":[{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mapper_1.0.6_1717621471811_0.745691152770817"},"_hasShrinkwrap":false}},"time":{"created":"2022-06-26T21:49:21.315Z","0.0.1":"2022-06-26T21:49:21.559Z","modified":"2024-06-05T21:04:32.192Z","0.0.2":"2022-06-27T13:24:44.835Z","1.0.0":"2023-06-23T20:57:59.677Z","1.0.1":"2023-06-23T21:27:19.558Z","1.0.2":"2023-06-24T20:49:38.330Z","1.0.3":"2024-04-17T23:17:27.488Z","1.0.5":"2024-04-17T23:27:27.092Z","1.0.6":"2024-06-05T21:04:32.010Z"},"maintainers":[{"name":"agutierrezt9410","email":"agutierrezt@slabcode.com"}],"description":"A project to transform models to DTOs and vice versa using functions and generics","homepage":"https://github.com/Andres930410/mapper#readme","keywords":["ts","mapper","generics"],"repository":{"type":"git","url":"git+ssh://git@github.com/Andres930410/mapper.git"},"author":{"name":"Andres Gutierrez","email":"agutierrezt@slabcode.com"},"bugs":{"url":"https://github.com/Andres930410/mapper/issues"},"license":"ISC","readme":"## Table of Contents\n- [Mapper](#mapper)\n- [Installing](#installing)\n- [How to use](#how-to-use)\n- [Example](#example)\n    - [For Object](#for-object)\n    - [For Array](#for-array)\n- [Changelog](#changelog)\n- [Acknowledgments](#acknowledgments)\n\n# Mapper\n\nThis library used to transform objects using functions and sub-mappers. It is inspired by Automapper, a library written in C#.\n\nThe library heavily uses generics in order to have a strong typing of which properties can be transformed and which types each property should have, this new version only work with class types.\n\n# Installing\n\nUsing npm:\n\n```bash\n$ npm install @agutierrezt9410/mapper\n```\n\n# How to use\nIn order to use the library you need to create a new mapper as follows:\n\n```ts\nconst mapper = new Mapper<FromModel, ToModel>(FromModel,ToModel);\n```\n\nIf you are familiar with object oriented design you can use subclassing in order to create custom mappers which can be reused as follows:\n\n```ts\nclass MyCustomMapper extendes Mapper<FromModel, ToModel> {\n    constructor() {\n        super(FromModel,ToModel);\n    }\n}\n\nconst mapper = new MyCustomMapper();\n```\n\nOnce the mapper is created you can add steps to the mapping process for each property, those instructions can be done using functions or other mappers.\n\nWhen using functions your method can receive any property from **FromModel** using destructuring syntax.\n\nEach mapper can have additonal contextual information, which can be used to create custom mapping logic, the context of the mapper can be set as follows:\n\n```ts\nmapper.context = {\n    role: \"ADMIN\"\n}\n```\n\nThe context is always passed to each transformation function as an optional parameter and it can be used in this way:\n\n```ts\nmapper.addMapping(\"toModelProperty\", ({ args1, args2 }, ctx): propertyType => {\n  // Mapping logic\n  if (ctx?.role === 'ADMIN') return '';\n  return value;\n});\n\nconst otherMapper = new Mapper<FromOtherModel, ToOtherModel>(FromOtherModel,ToOtherModel);\n\nmapper.addMapping(\"toOtherModelProperty\", ({ args1, args2 }): propertyType => {\n  return value;\n});\nmapper.addMapper(\"toModelProperty\", \"fromModelProperty\", otherMapper);\n```\n\nIt's important to also notice that when a submapper is configured then the context of the sub mapper will be combined with the context of its parent mapper in order to have better contextual information. However, when the mapper is used in isolation then its contextual information will be only the one defined by the mapper itself.\n\nAlso some mapping and mappers can be removed during the mapping process as follows:\n\n```ts\nmapper.removeMapping(\"toModelProper\");\n```\n\nAfter your mapper is configured you can get the resulting object using the transform method in the main mapper. This function will return **toModel | toModel[]** based on if you are transforming an object or an array of objects, no casting is needed.\n\n```ts\n// For getting an object\nconst data = {}; // Object type defined in mapper declaration\nconst result = mapper.transform(data);\n\n// For getting an array\nconst data = []; // Array of object types defined in mapper declaration\nconst result = mapper.transform(data);\n\n// For getting an object and validate using class validator\nconst data = {}; // Object type defined in mapper declaration\nconst result = mapper.transformAndValidate(data);\n\n// For getting an array and validate using class validator\nconst data = []; // Array of object types defined in mapper declaration\nconst result = mapper.transformAndValidate(data);\n```\n\n# Example\n\nAccording the following models with the following data, we present an use case of the mapper, next we show a POO design that will be used as **FromModel**:\n\n```ts\nclass User {\n  name: string;\n  lastName: string;\n  email: string\n}\n\nclass Address {\n  address: string\n  city: string,\n  country: string\n}\n\nclass UserAddress extends User {\n  addresses: Address[]\n}\n\nconst data: UserAddress = {\n  name: \"Name 1\",\n  lastName: \"Lastname 1\",\n  email: \"email@test.com\",\n  addresses: [\n    {\n      address: \"Fake address\"\n      city: \"Fake city\",\n      country: \"Fake country\"\n    },\n    {\n      address: \"another fake address\"\n      city: \"another fake city\",\n      country: \"another fake country\"\n    }\n  ]\n};\n\nconst arrayData: UserAddress[] = [\n  {\n    name: \"Name 1\",\n    lastName: \"Lastname 1\",\n    email: \"email@test.com\",\n    addresses: [\n      {\n        address: \"Fake address\"\n        city: \"Fake city\",\n        country: \"Fake country\"\n      },\n      {\n        address: \"another fake address\"\n        city: \"another fake city\",\n        country: \"another fake country\"\n      }\n    ]\n  }\n];\n\n```\n\nNext we show a POO design, which will be used as **ToModel**:\n\n```ts\nclass UserDto {\n  fullName: string;\n  @IsEmail() // class transformer decorator\n  email: string\n}\n\nclass AddressDto {\n  text: string\n}\n\nclass UserAddressDto extends User {\n  addresses: AddressDto[]\n}\n```\n\n### For Object\n```ts\nconst mapper = new Mapper<UserAddress, UserAddressDto>(UserAddressDto);\n\nmapper.addMapping(\"fullName\", ({ name, lastName }): string => {\n  return `${name} ${lastName}`;\n});\nmapper.addMapping(\"email\", ({ email }): string => {\n  return email;\n});\n\nconst addressMapper = new Mapper<Address, AddressDto>(Address,AddressDto);\n\naddressMapper.addMapping(\"text\", ({ address, city, country }): string => {\n  return `${address}, ${city}, ${country}`;\n});\n\nmapper.addMapper(\"addresses\", \"addresses\", addressMapper);\n//  You can also do it this way:\n//  mapper.addMapping(\"addresses\", ({addresses}): AddressDto => {\n//    return addresses.map(x => {\n//      return {\n//        text: `${x.address}, ${x.city}, ${x.country}`;\n//      }\n//    });\n//  });\n\n// This function will create a new object using the transformation logic\n// The resulting object will be an instance of UserAddressDto\nconst result = mapper.transform(data);\n\nconsole.log(result);\n//  Console log output:\n//  {\n//    \"fullName\": \"Name1 Lastname 1\",\n//    \"email\": \"email@test.com\"\n//    \"addresses\": [\n//      { text: \"Fake address, Fake city, Fake country\" },\n//      { text: \"Another fake address, Another fake city, Another fake country\" },\n//    ]\n//  }\n\n// This function will not only create a new object based on the transformation logic but also check if the properties satisfy the validations. For instance if the email property is not a valid email, the function will generate an exception.\nconst resultValidated = mapper.transformAndValidate(data);\n```\n\n### For Array\n```ts\nconst mapper = new Mapper<UserAddress, UserAddressDto>(UserAddress,UserAddressDto);\n\nmapper.addMapping(\"fullName\", ({name, lastName}): string => {\n  return `${name} ${lastName}`\n});\nmapper.addMapping(\"email\", ({email}): string => {\n  return email\n});\n\nconst addressMapper = new Mapper<Address ,AddressDto>();\n\naddressMapper.addMapping(\"text\", ({address,city,country}): string => {\n  return `${address}, ${city}, ${country}`\n});\nmapper.addMapper(\"addresses\",\"addresses\",addressMapper);\n// You can also do it this way:\n// mapper.addMapping(\"addresses\", ({addresses}): AddressDto => {\n//   return (addresses).map(x => {\n//     return {\n//       text: `${x.address}, ${x.city}, ${x.country}`\n//     }\n//   })\n// })\n\nconst result: UserAddressDto[] = mapper.transform(data);\n\nconsole.log(result);\n//  Console log output:\n//  [\n//    {\n//      \"fullName\": \"Name1 Lastname 1\",\n//      \"email\": \"email@test.com\"\n//      \"addresses\": [\n//        { text: \"Fake address, Fake city, Fake country\" },\n//        { text: \"Another fake address, Another fake city, Another fake country\" },\n//      ]\n//    }\n//  ]\n\n// The validate function can be used also with an array, if any object of the objects present in the array doesn't satisfy the validations, then the method will generate an exception and indicate the position of the first object which doesn't satisfy the validations.\nconst resultValidated = mapper.transformAndValidate(data);\n```\n\n# Changelog\n- 0.0.1: Initial version\n- 0.0.2: Reusable mapper, type safety for return type on the transform function and remove mapping.\n- 1.0.1: Now the mapper uses class transformer and class validator for validations and to guarantee that class types are returned instead of plain JavaScript objects.\n    - Added:\n        - Context can be added to the mappers, the context will be passed to each transformation function and it could be used for adding custom logic into the mappings.\n        - Use class transformer for returning an specific class type instead of a plain javascript object.\n        - New method for not only transforming but also validating if the information satisfies with some validation, this feature uses class validator.\n- 1.0.2: The type is passed on the constructor instead of in the transform method and in the add mapper method.\n- 1.0.3: Now the constructor receives two types, one for the model and other for the dto, with this small change now the getters from the model are recognized.\n- 1.0.4: Update README.\n- 1.0.6: Fixes on the add mapping function, now the data arrives with the right type instead of being \"type | undefined\"\n\n\n# Acknowledgments\nI would like to thanks Trammel May. After a small discussion he pointed to me some problems that my library could have, those problems were addressed and solved.","readmeFilename":"README.md"}