{"_id":"o-mapper","_rev":"11-8bed140b313399b75ce8960cb5f1df91","name":"o-mapper","description":"Object mapper","dist-tags":{"latest":"1.0.0"},"versions":{"0.1.0":{"name":"o-mapper","version":"0.1.0","description":"Object mapper","main":"lib/o-mapper.js","scripts":{"test":"gulp test"},"repository":{"type":"git","url":"https://github.com/opedromiranda/o-mapper.git"},"keywords":["object","mapper","schema"],"author":{"name":"Pedro Miranda"},"license":"MIT","bugs":{"url":"https://github.com/opedromiranda/o-mapper/issues"},"homepage":"https://github.com/opedromiranda/o-mapper","devDependencies":{"chai":"^3.0.0","gulp":"^3.9.0","gulp-coverage":"^0.3.36","gulp-istanbul":"^0.9.0","gulp-mocha":"^2.1.1"},"gitHead":"fad69a821c9333a3dc4a992e209077f4f1102e4c","_id":"o-mapper@0.1.0","_shasum":"22def89f11d6c3483659d341f31c8f8a73352997","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"},"dist":{"shasum":"22def89f11d6c3483659d341f31c8f8a73352997","tarball":"https://registry.npmjs.org/o-mapper/-/o-mapper-0.1.0.tgz","integrity":"sha512-KRoneYNThbu/izXWmUrlh24xS/acbmX3Er8r4F2AbKpLm/RtMXxvWKhVsyRV0jQZyTVaG/J9501zbN+102sXjQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD0QSq7BnTjGLsgTdRvhK2AjVG3Medgf+8iuD6VmLPvWgIgc4jgQT31oy9b5PDdUWw1pfJ4fNivtlnrQ0DZ22WArPw="}]},"maintainers":[{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"}],"directories":{}},"0.1.1":{"name":"o-mapper","version":"0.1.1","description":"Object mapper","main":"lib/o-mapper.js","scripts":{"test":"gulp test"},"repository":{"type":"git","url":"https://github.com/opedromiranda/o-mapper.git"},"keywords":["object","mapper","schema"],"author":{"name":"Pedro Miranda"},"license":"MIT","bugs":{"url":"https://github.com/opedromiranda/o-mapper/issues"},"homepage":"https://github.com/opedromiranda/o-mapper","devDependencies":{"chai":"^3.0.0","gulp":"^3.9.0","gulp-coverage":"^0.3.36","gulp-istanbul":"^0.9.0","gulp-mocha":"^2.1.1"},"gitHead":"dd46d9001293b2859b97dac7fb8b7c7faf5ec893","_id":"o-mapper@0.1.1","_shasum":"96ef7187456eb8fc11e9a9ca41c24e2b401b2f85","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"},"dist":{"shasum":"96ef7187456eb8fc11e9a9ca41c24e2b401b2f85","tarball":"https://registry.npmjs.org/o-mapper/-/o-mapper-0.1.1.tgz","integrity":"sha512-Yp6UwoG8Igs0Qrret+2mZH6Y5y51PmmiE24cvnkRAh6tu7+M20aIMOyzLaoWZrNA0POFZO01PfIrefofJCiE+Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCHvnYd51X/0vkjPbFF7k9G6VILwM+sd4LawFikrhBuOQIhAKMCEtVt/CoZ7bNJJSwfA8Y15CqUi7upw58x4MBMhCpl"}]},"maintainers":[{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"}],"directories":{}},"0.1.2":{"name":"o-mapper","version":"0.1.2","description":"Object mapper","main":"lib/o-mapper.js","scripts":{"test":"gulp test"},"repository":{"type":"git","url":"git+https://github.com/opedromiranda/o-mapper.git"},"keywords":["object","mapper","schema"],"author":{"name":"Pedro Miranda"},"license":"MIT","bugs":{"url":"https://github.com/opedromiranda/o-mapper/issues"},"homepage":"https://github.com/opedromiranda/o-mapper","devDependencies":{"chai":"^3.0.0","gulp":"^3.9.0","gulp-istanbul":"^0.9.0","gulp-mocha":"^2.1.1"},"gitHead":"8f02f4b38c4224dbdda685ae1130f127c7628f59","_id":"o-mapper@0.1.2","_shasum":"deb20d5e59a6322f915b4aaf8974ffb98e92e4e3","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"},"dist":{"shasum":"deb20d5e59a6322f915b4aaf8974ffb98e92e4e3","tarball":"https://registry.npmjs.org/o-mapper/-/o-mapper-0.1.2.tgz","integrity":"sha512-JZb3NoMUhfpL5OSZDCanpJA24aRSkK3h6pDlLjOyOoxPizsVrQFMBoZKW/+nzwQq94D0cUXOhLNzEPRqcwbcCg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCX+a4ndY9cJKHK1SF7lTt03oAFnlBU8DRgVNJynWO2RQIhANDzXke+OXX0Qe3LVm2PW+1yXIjhvnO5zl6WKb5cwGHq"}]},"maintainers":[{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"}],"directories":{}},"0.1.3":{"name":"o-mapper","version":"0.1.3","description":"Object mapper","main":"lib/o-mapper.js","scripts":{"test":"gulp test"},"repository":{"type":"git","url":"git+https://github.com/opedromiranda/o-mapper.git"},"keywords":["object","mapper","schema"],"author":{"name":"Pedro Miranda"},"license":"MIT","bugs":{"url":"https://github.com/opedromiranda/o-mapper/issues"},"homepage":"https://github.com/opedromiranda/o-mapper","devDependencies":{"chai":"^3.0.0","gulp":"^3.9.0","gulp-istanbul":"^0.9.0","gulp-mocha":"^2.1.1"},"gitHead":"1fc01a8f9200744bf0fab5452bc3dc378e3ed424","_id":"o-mapper@0.1.3","_shasum":"6788de34c3f3f96321c6adb09d6d193f8e172ef7","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.6.0","_npmUser":{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"},"dist":{"shasum":"6788de34c3f3f96321c6adb09d6d193f8e172ef7","tarball":"https://registry.npmjs.org/o-mapper/-/o-mapper-0.1.3.tgz","integrity":"sha512-xo3pvXdUNQNn8V+STlzOoI3rOlCZKZmv5DDsnrtiwgVHAtT8KlNFVcmDJnHeS8KPpUNP1yhuBJSIq9n8lL927g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIExzxBxyzxH4w0wNn6OMc2iI8xEC0uvWtLu0gNYUUWpGAiEA18f72hYpENMn2cz1tZMGX3czpumh+45jaSzqRENsSiQ="}]},"maintainers":[{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"}],"_npmOperationalInternal":{"host":"packages-9-west.internal.npmjs.com","tmp":"tmp/o-mapper-0.1.3.tgz_1456057487821_0.09409104636870325"},"directories":{}},"0.1.4":{"name":"o-mapper","version":"0.1.4","description":"Object mapper","main":"lib/o-mapper.js","scripts":{"test":"gulp test"},"repository":{"type":"git","url":"git+https://github.com/opedromiranda/o-mapper.git"},"keywords":["object","mapper","schema"],"author":{"name":"Pedro Miranda"},"license":"MIT","bugs":{"url":"https://github.com/opedromiranda/o-mapper/issues"},"homepage":"https://github.com/opedromiranda/o-mapper","devDependencies":{"chai":"^3.0.0","gulp":"^3.9.0","gulp-istanbul":"^0.9.0","gulp-mocha":"^2.1.1"},"gitHead":"8b75a2069499fdd460205d5bfceb1294201a0402","_id":"o-mapper@0.1.4","_npmVersion":"5.6.0","_nodeVersion":"8.11.1","_npmUser":{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"},"dist":{"integrity":"sha512-IrpojChTQnf+OB6oJHU4XWH5pWdUM+rZh3n/W5uoK2fB1V9H2hZnSPf3mCtAj9V7tKM6xyCjHDOTsam8/f9l7A==","shasum":"e88120059131460a309db935636591d715d14377","tarball":"https://registry.npmjs.org/o-mapper/-/o-mapper-0.1.4.tgz","fileCount":14,"unpackedSize":55163,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbTjZhCRA9TVsSAnZWagAAzIoP/2DTYrVy/UQPjKBlfILf\nsrY/MwTIlM3ZJrnE3gEYxElWujjww85IDYftn9w1HpPwnIKlucvNu9zpyw47\n2nxCZ5Os8tXGpwWV2QAsNptq1mERBhP4obcHY72u68NWgZZBSqv61kym7etd\n3zoDrTmo1SBxR+a3YoRFHvspGjxqwu1QYqEYKQFiYk6A9ULBgRJJw3t7ItTe\nx4j9uR0Q8gW5daUWUx6MPkl7tFysT72IYt4PUrHxxhzNAkkacJ5PaAX/wUQr\nmHLCRRTJhR588Rbp0fhGmswQvjj+4IRtUoVQEWpMFnAGINoI1r+Ts5B80+/y\no1nMAeEO7qe3Tt7kwbFH+lUMAMP/rvkPLzEYsumZP8h0kFnEugwaPWlbtjQk\ntS0KGx2sDLc69RmGeZ6RuZ7d39YDtNgmlEOpUWts45Q3kk4brAGwfQySWtix\n/FAoBMni+aRZk0TcDMMM/rpNcAQMGv2L7jh87uniU3eUlXCCLdhGLt7s0786\njx7SZIEcCtF2TkvWcvSYXKw5MbslFyyWfTulRFpbNoOmuminKvOZ95qxpW64\nRfAVos0WLLAKIfRVm2TJ8wWx7iNbBTpnhZxzyEWzhaSMyegx7/9Jf+ghDIY7\nALmMvoMl3qLFwdPuzChwO47tpFjupXSgRxpFgG/gztpAwEQr9f1/MhcpcQS3\nMBde\r\n=AGnB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDNZGj1WV595vH2aFmozL8I9s5ldSprzNbyPeSzkH2TwAIgNDf7U2JuS+JluOn/lWrGzAyKrQfWKxaB/RQw3xzeatI="}]},"maintainers":[{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-mapper_0.1.4_1531852385528_0.4267381626757989"},"_hasShrinkwrap":false},"1.0.0":{"name":"o-mapper","version":"1.0.0","description":"Object mapper","main":"lib/o-mapper.js","scripts":{"test":"gulp test","lint":"eslint lib"},"repository":{"type":"git","url":"git+https://github.com/opedromiranda/o-mapper.git"},"keywords":["object","mapper","schema"],"engines":{"node":">=6.4.0"},"author":{"name":"Pedro Miranda"},"license":"MIT","bugs":{"url":"https://github.com/opedromiranda/o-mapper/issues"},"homepage":"https://github.com/opedromiranda/o-mapper","devDependencies":{"chai":"^3.0.0","eslint":"^5.3.0","eslint-config-airbnb-base":"^13.1.0","eslint-plugin-import":"^2.14.0","gulp":"^3.9.0","gulp-istanbul":"^0.9.0","gulp-mocha":"^2.1.1"},"gitHead":"f20e2aa59ffd17339a187f217492a4571a64ee9d","_id":"o-mapper@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.4","_npmUser":{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"},"dist":{"integrity":"sha512-gADMK7WrUGAOrrmqU+5S7iFu0GwY7Bwi2vlbCZAlwXTAkqi4gKg3tspeEF/gSwHEh4vxvOsdUNgYrwHRm+8FyQ==","shasum":"d269dc86842ecba290e68cba6cea2f379a12435b","tarball":"https://registry.npmjs.org/o-mapper/-/o-mapper-1.0.0.tgz","fileCount":5,"unpackedSize":5519,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbdtroCRA9TVsSAnZWagAAQJkP+gPfzz/wqixMkwJk5GX5\nryR0ageuYv0FzRCFQCWvhifbtrK7h3kzuDrJj+EYG97zYLDeox06gRMSWRA5\nhPeiBa5/Syydr2qW76Ari6BN0LPpUhdSjk7jMW6qSLa3QqG4hM3qSLgjoruF\n185voSpWMpmyKYc9fgURQ85a8TfMJinVzS7Y8NEMAzVCbF26HKwSjpqczSFK\nu3ph/wlGBd7VM5yyd4OwQRzGPPK2mjj7yW3+XxeeEAlyi/b8hzv/KAsE5MaF\n0db0d75f28wzbvDSPh6IwdhBjfQfhA4K8hYA1j/zW9eoOrsJTBsmkHOIMRd7\nRr9NWXG5fHdCuUoPR+0SDCHOmi7wLW6e2STp7Euv2gru78FwpKnWj/wpSVbQ\nUcBs8OVSCI1T6HwgpBMQCUvZPC5EDRmbHDDavtiMPQ0MEmVt5W3LNa6CAwRa\niYkcm3qTMdowr52ATMic5myaEVGix9f/ul5uoHc6N5Ln6KsOc3ADVIbINQM2\ncS0EGBhHKgXYvY1jD4rB1BDn1wRsWwmCF5MqaPyIMXELIUS1jHEbxQPsQST7\nt/i9uPkjAoI1cihYa5mLD+EqUOzfv8r89lZy7Z4OhcJ+vyeJ2t7EX6eJCdHq\nTBHVuGhvZNZh5AEAtpJOlYuMazabjbPcfieiLGaP27ism6egGRPuR/ZVA4hg\nC779\r\n=i+O/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD1luqb9juMFSdzo7eKUrWUrr989mSB226cC7EZ2/8hUAIhAI+W0FTSjimFQ6dU2I8+eYZrQ7D/C2n3f4fdAPE2Jwrh"}]},"maintainers":[{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/o-mapper_1.0.0_1534515944252_0.9451170147569516"},"_hasShrinkwrap":false}},"readme":"# O-Mapper\n[![Build Status](https://travis-ci.org/opedromiranda/o-mapper.svg)](https://travis-ci.org/opedromiranda/o-mapper)\n\n\n## What\nValidation and conversion of a given object to another.\n\nLike this:\n```json\n{\n    \"first_name\": \"Toby\",\n    \"last_name\": \"Flenderson\",\n    \"birth_date\": \"1971-04-01\",\n    \"job_name\": \"HR\",\n    \"extra_data\": {\n        \"orders\": []\n    }\n}\n```\nto this:\n```javascript\n{\n    \"full_name\": \"Toby Flenderson\",\n    \"job\": \"HR\",\n    \"birth_date\": new Date(\"1971-04-01\"),\n    \"orders\": []\n}\n```\n\n\n## How\n```javascript\nconst omapper = require('o-mapper');\n\nconst schema = { ... };\nconst input = { ... };\n\nconst result = omapper(input, schema);\n```\n\n## Schema\nSchemas are objects that will dictate what the final object will contain and where to get the values from the source object.\nEach key from the schema represents a key of the final object.\n\n```javascript\nconst schema = {\n\n    // key property specifies what key to look for in the source object\n    job: {\n        key: 'job_name',\n    },\n\n    // when multiple keys are selected, an handler is required to process the multiple values\n    full_name: {\n        key: ['fist_name', 'last_name'],\n        handler: (first, last) => `${first} ${last}`,\n    },\n\n    // handlers can also be used for single values\n    // the key property can be omitted if it matches the final object\n    // a property can be set as required\n    birth_date: {\n        handler: bd => new Date(bd),\n        required: true,\n    },\n\n    // dot notation can also be used\n    // default values can be set in case property doesn't exist\n    orders: {\n        key: 'data.orders',\n        default: [],\n    },\n};\n```\n\nLicense\n----\n\nMIT\n","maintainers":[{"name":"opedromiranda","email":"p.miguel.tr@gmail.com"}],"time":{"modified":"2022-06-22T15:07:19.673Z","created":"2015-06-04T23:19:19.024Z","0.1.0":"2015-06-04T23:19:19.024Z","0.1.1":"2015-06-05T19:23:47.125Z","0.1.2":"2015-06-07T17:06:11.140Z","0.1.3":"2016-02-21T12:24:52.546Z","0.1.4":"2018-07-17T18:33:05.632Z","0.1.5":"2018-08-17T14:17:00.481Z","1.0.0":"2018-08-17T14:25:44.513Z"},"homepage":"https://github.com/opedromiranda/o-mapper","keywords":["object","mapper","schema"],"repository":{"type":"git","url":"git+https://github.com/opedromiranda/o-mapper.git"},"author":{"name":"Pedro Miranda"},"bugs":{"url":"https://github.com/opedromiranda/o-mapper/issues"},"license":"MIT","readmeFilename":"README.md"}