{"_id":"mongoose-email-address-manager","_rev":"29-b9b3ca3e3cade01af7c4c8921cab8b81","name":"mongoose-email-address-manager","description":"Manage multiple email addresses per user (or other model/doc) with this mongoose schema plugin.","dist-tags":{"latest":"2.0.0"},"versions":{"0.0.1":{"name":"mongoose-email-address-manager","version":"0.0.1","description":"Manage multiple email addresses per user (or other model/doc) with this mongoose schema plugin.","main":"./index.js","scripts":{"test":"./node_modules/mocha/bin/mocha ./tests -R spec"},"repository":{"type":"git","url":"git://github.com/larron/mongoose-email-address-manager.git"},"keywords":["address","addresses","email","manager","model","mongodb","mongoose","plugin","schema"],"author":{"name":"Larron Armstead","email":"me@larronarmstead.com"},"license":"MIT","devDependencies":{"mocha":"~1.10.0","mongoose":"~3.6.11","should":"~1.2.2"},"_id":"mongoose-email-address-manager@0.0.1","dist":{"shasum":"a2c572fb1d4ff272dbbdabb5a5a210aa412f246c","tarball":"https://registry.npmjs.org/mongoose-email-address-manager/-/mongoose-email-address-manager-0.0.1.tgz","integrity":"sha512-SAL9upE0L6ttgZpMqVnc/CdU22REwJSZE+cg1Tn9pUbAh4eKrAGsePozUTu48rXDXSG+j3Cbmymx0uUnBs27rA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCW+7aCvDJzev29kRulMixRHa0hIiFmeNtvO4V0pnVQZAIhAOdlQKgi2FumMCHyOuIcWJZKa4/rN7YrM8pZrQMDVDtS"}]},"_from":".","_npmVersion":"1.2.10","_npmUser":{"name":"larron","email":"larron@cultlogic.com"},"maintainers":[{"name":"larron","email":"larron@cultlogic.com"}],"directories":{}},"0.0.2":{"name":"mongoose-email-address-manager","version":"0.0.2","description":"Manage multiple email addresses per user (or other model/doc) with this mongoose schema plugin.","main":"./index.js","scripts":{"test":"./node_modules/mocha/bin/mocha ./tests -R spec"},"repository":{"type":"git","url":"git://github.com/larron/mongoose-email-address-manager.git"},"keywords":["address","addresses","email","manager","model","mongodb","mongoose","plugin","schema"],"author":{"name":"Larron Armstead","email":"me@larronarmstead.com"},"license":"MIT","devDependencies":{"mocha":"~1.10.0","mongoose":"~3.6.11","should":"~1.2.2"},"_id":"mongoose-email-address-manager@0.0.2","dist":{"shasum":"1a5340b62afdfb17b0fd93e4c4599ebcf344de89","tarball":"https://registry.npmjs.org/mongoose-email-address-manager/-/mongoose-email-address-manager-0.0.2.tgz","integrity":"sha512-9gpX2/q860f3RAkZ0Cd5VDpCXFpztqGOwMu3PHwEG5+nAE9EpabuVBQeqb2qYcCi9Lsh7kL3D4LiYxFP3xIflw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDaY88LOORizY7RAID2XRQ2MiuZPB/X7xCB6Lg0VwTs5AiEAmRc+ydhmZ2DFROHJEJ1QFI+jDod7NP0JeeZDXcDQvHg="}]},"_from":".","_npmVersion":"1.2.10","_npmUser":{"name":"larron","email":"larron@cultlogic.com"},"maintainers":[{"name":"larron","email":"larron@cultlogic.com"}],"directories":{}},"0.0.3":{"name":"mongoose-email-address-manager","version":"0.0.3","description":"Manage multiple email addresses per user (or other model/doc) with this mongoose schema plugin.","main":"./index.js","scripts":{"test":"./node_modules/mocha/bin/mocha ./tests -R spec"},"repository":{"type":"git","url":"git://github.com/larron/mongoose-email-address-manager.git"},"keywords":["address","addresses","email","manager","model","mongodb","mongoose","plugin","schema"],"author":{"name":"Larron Armstead","email":"me@larronarmstead.com"},"license":"MIT","devDependencies":{"mocha":"~1.10.0","mongoose":"~3.6.11","should":"~1.2.2"},"_id":"mongoose-email-address-manager@0.0.3","dist":{"shasum":"6b2ccba0575b110f83cbb2f57ce5ebbd7d2ac7c2","tarball":"https://registry.npmjs.org/mongoose-email-address-manager/-/mongoose-email-address-manager-0.0.3.tgz","integrity":"sha512-tBNZvpKbCOQwsbA4DQ4eo6RHudgicsG9CigZbQhyIKYm7I44xC3tBQt7LZg8oVCrdixhyXuA4P/cCaU8JFz46Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD3khKP9GMxb/885UeFZxIzuUJYVBrddhQUEqIu0oU2UQIhAJ0uCftiWAY72d301ijqY0+xYBfmiw/WYmYVvCmyEKgg"}]},"_from":".","_npmVersion":"1.2.10","_npmUser":{"name":"larron","email":"larron@cultlogic.com"},"maintainers":[{"name":"larron","email":"larron@cultlogic.com"}]},"0.0.4":{"name":"mongoose-email-address-manager","version":"0.0.4","description":"Manage multiple email addresses per user (or other model/doc) with this mongoose schema plugin.","main":"./index.js","scripts":{"test":"./node_modules/mocha/bin/mocha ./tests -R spec"},"repository":{"type":"git","url":"git://github.com/larron/mongoose-email-address-manager.git"},"keywords":["address","addresses","email","manager","model","mongodb","mongoose","plugin","schema"],"author":{"name":"Larron Armstead","email":"me@larronarmstead.com"},"license":"MIT","devDependencies":{"mocha":"~1.10.0","mongoose":"~3.6.11","should":"~1.2.2"},"_id":"mongoose-email-address-manager@0.0.4","dist":{"shasum":"ea889957692517c254a398c5b7ce65b8fa6829b8","tarball":"https://registry.npmjs.org/mongoose-email-address-manager/-/mongoose-email-address-manager-0.0.4.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"larron","email":"larron@cultlogic.com"},"maintainers":[{"name":"larron","email":"larron@cultlogic.com"}]},"0.0.5":{"name":"mongoose-email-address-manager","version":"0.0.5","description":"Manage multiple email addresses per user (or other model/doc) with this mongoose schema plugin.","main":"./index.js","scripts":{"test":"./node_modules/mocha/bin/mocha ./tests -R spec"},"repository":{"type":"git","url":"git://github.com/larron/mongoose-email-address-manager.git"},"keywords":["address","addresses","email","manager","model","mongodb","mongoose","plugin","schema"],"author":{"name":"Larron Armstead","email":"me@larronarmstead.com"},"contributors":[{"name":"Casey Capps","email":"crcapps@gmail.com"}],"license":"MIT","devDependencies":{"mocha":"^2.2.1","mockgoose":"^1.10.7","mongoose":"^3.8.25","should":"^5.2.0"},"gitHead":"b1d89737659c37e0c5fd59b5944b9a9c8650faea","bugs":{"url":"https://github.com/larron/mongoose-email-address-manager/issues"},"homepage":"https://github.com/larron/mongoose-email-address-manager","_id":"mongoose-email-address-manager@0.0.5","_shasum":"9f80b7a8c0034aba8aec80be7eb2cbd6001e13ed","_from":".","_npmVersion":"2.1.18","_nodeVersion":"0.10.35","_npmUser":{"name":"larron","email":"me@larronarmstead.com"},"maintainers":[{"name":"larron","email":"larron@cultlogic.com"}],"dist":{"shasum":"9f80b7a8c0034aba8aec80be7eb2cbd6001e13ed","tarball":"https://registry.npmjs.org/mongoose-email-address-manager/-/mongoose-email-address-manager-0.0.5.tgz","integrity":"sha512-Mr7Zs9d1nPYV7NYf8SIg1l4tU9OW/wCX4PtZPs6wbo+Vwi+Wc9ad6VCbcBsRWc3RtFErlGlfOpaI1IAP+iCWkA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDsWm27YIyrJ7RYSNPLRQYmI2O3JgYfnzv/lb2mIzqXlAIgZ84H25VftDnJ+mLGbMDiU0YC3LDm6hBCR/WnLZxz1Ms="}]}},"0.0.6":{"name":"mongoose-email-address-manager","version":"0.0.6","description":"Manage multiple email addresses per user (or other model/doc) with this mongoose schema plugin.","main":"./index.js","scripts":{"test":"./node_modules/mocha/bin/mocha ./tests -R spec"},"repository":{"type":"git","url":"git://github.com/larron/mongoose-email-address-manager.git"},"keywords":["address","addresses","email","manager","model","mongodb","mongoose","plugin","schema"],"author":{"name":"Larron Armstead","email":"me@larronarmstead.com"},"contributors":[{"name":"Casey Capps","email":"crcapps@gmail.com"}],"license":"MIT","devDependencies":{"mocha":"^2.2.1","mockgoose":"^1.10.7","mongoose":"^3.8.25","should":"^5.2.0"},"gitHead":"db119f9dc6c13f17f6ff26d5967bedca3b947c36","bugs":{"url":"https://github.com/larron/mongoose-email-address-manager/issues"},"homepage":"https://github.com/larron/mongoose-email-address-manager#readme","_id":"mongoose-email-address-manager@0.0.6","_shasum":"4c3f294ef7f726c8f8e5c4505eb01282dda8401a","_from":".","_npmVersion":"2.11.2","_nodeVersion":"0.12.5","_npmUser":{"name":"larron","email":"larron@cultlogic.com"},"dist":{"shasum":"4c3f294ef7f726c8f8e5c4505eb01282dda8401a","tarball":"https://registry.npmjs.org/mongoose-email-address-manager/-/mongoose-email-address-manager-0.0.6.tgz","integrity":"sha512-NvlhygtViXdxn0KS5IFJksaKx03H3JP0b3D7+TrDqa0Tq4oE83+LjZ90NOlzquReJo/HfugAEThCzJL8/JL29w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCO8HGyV3ArbDJH7Bl+nWguQbpKOGWifk1PTTFFyFv/zAIhAP14o471qbHv3ADRwSQ+91yLVMC7l8K6LqDCJn67CjAU"}]},"maintainers":[{"name":"larron","email":"larron@cultlogic.com"}]},"0.0.7":{"name":"mongoose-email-address-manager","version":"0.0.7","description":"Manage multiple email addresses per user (or other model/doc) with this mongoose schema plugin.","main":"./index.js","scripts":{"test":"./node_modules/mocha/bin/mocha ./tests -R spec"},"repository":{"type":"git","url":"git://github.com/larron/mongoose-email-address-manager.git"},"keywords":["address","addresses","email","manager","model","mongodb","mongoose","plugin","schema"],"author":{"name":"Larron Armstead","email":"me@larronarmstead.com"},"contributors":[{"name":"Casey Capps","email":"crcapps@gmail.com"}],"license":"MIT","devDependencies":{"mocha":"^2.2.1","mockgoose":"^1.10.7","mongoose":"^3.8.25","should":"^5.2.0"},"gitHead":"ba8f009872998971683cc8f34aec322ee8d4097e","bugs":{"url":"https://github.com/larron/mongoose-email-address-manager/issues"},"homepage":"https://github.com/larron/mongoose-email-address-manager#readme","_id":"mongoose-email-address-manager@0.0.7","_shasum":"cbfb0f6a0382c61c1197aac440571f48173adb5b","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.1","_npmUser":{"name":"larron","email":"larron@cultlogic.com"},"dist":{"shasum":"cbfb0f6a0382c61c1197aac440571f48173adb5b","tarball":"https://registry.npmjs.org/mongoose-email-address-manager/-/mongoose-email-address-manager-0.0.7.tgz","integrity":"sha512-w5pz8sdf6prbcf1nPCXovP2w/Kur7Swj+rzlzdE3kuU5QRxRCIl0wMCAH5i0veeBIfWb96irADd1UGid0T+B2A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDbDQT3ZeitJJns7BZ46gIRCmDrK7bDev9IJ8xqwegA8AIgJDKMP4YojVBS0TtaJm3i8N5Y++YCWNsbaxXiUGrpfhQ="}]},"maintainers":[{"name":"larron","email":"larron@cultlogic.com"}]},"0.0.8":{"name":"mongoose-email-address-manager","version":"0.0.8","description":"Manage multiple email addresses per user (or other model/doc) with this mongoose schema plugin.","main":"./index.js","scripts":{"test":"./node_modules/mocha/bin/mocha ./tests -R spec"},"repository":{"type":"git","url":"git://github.com/larron/mongoose-email-address-manager.git"},"keywords":["address","addresses","email","manager","model","mongodb","mongoose","plugin","schema"],"author":{"name":"Larron Armstead","email":"me@larronarmstead.com"},"contributors":[{"name":"Casey Capps","email":"crcapps@gmail.com"}],"license":"MIT","devDependencies":{"mocha":"^2.2.1","mockgoose":"^1.10.7","mongoose":"^3.8.25","should":"^5.2.0"},"gitHead":"072d0969e6e43bf9094ad8dacae7336b4deba93b","bugs":{"url":"https://github.com/larron/mongoose-email-address-manager/issues"},"homepage":"https://github.com/larron/mongoose-email-address-manager#readme","_id":"mongoose-email-address-manager@0.0.8","_shasum":"f4477a9e449ff8282f2e7488c7833701d8308e94","_from":".","_npmVersion":"3.4.0","_nodeVersion":"5.0.0","_npmUser":{"name":"larron","email":"larron@cultlogic.com"},"dist":{"shasum":"f4477a9e449ff8282f2e7488c7833701d8308e94","tarball":"https://registry.npmjs.org/mongoose-email-address-manager/-/mongoose-email-address-manager-0.0.8.tgz","integrity":"sha512-njNz0yDuXS4EppzqyGEXO+KdbXQkrMiy4O9ydIRiSfUOmcYWNsuSq48syvH2XgWeaIpO4p/m+1WKTnFYXeoEAw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICpRmzc4700HtV9c7MvtrqbpzQGYv6wjeME70XrrcRHHAiEAyb5MBTwHGLWs/7JrzD7AJ4xK3CzNhaYfmuzKPU2dUFo="}]},"maintainers":[{"name":"larron","email":"larron@cultlogic.com"}]},"2.0.0":{"name":"mongoose-email-address-manager","version":"2.0.0","description":"Manage multiple email addresses per user (or other model/doc) with this mongoose schema plugin.","main":"./lib","scripts":{"start":"npm run test:unit:watch & npm run lint:watch","clean":"rm -rf build && mkdir build","build":"npm run clean && ./node_modules/.bin/babel ./src -d ./lib --ignore __tests__","lint":"eslint .","lint:fix":"eslint --fix .","lint:watch":"esw -w .","test":"npm run test:unit","test:unit":"mocha --opts ./mocha.opts './*/__tests__/*.spec.js'","test:unit:watch":"mocha -w --opts ./mocha.opts './*/__tests__/*.spec.js'"},"repository":{"type":"git","url":"git://github.com/larron/mongoose-email-address-manager.git"},"keywords":["address","addresses","email","manager","model","mongodb","mongoose","plugin","schema"],"author":{"name":"Larron Armstead","email":"me@larronarmstead.com"},"contributors":[{"name":"Casey Capps","email":"crcapps@gmail.com"}],"license":"MIT","devDependencies":{"babel":"^6.5.2","babel-cli":"^6.18.0","babel-polyfill":"^6.16.0","babel-preset-bluebird":"^1.0.1","babel-preset-latest":"^6.16.0","babel-preset-stage-0":"^6.16.0","bluebird":"^3.4.6","chai":"^3.5.0","chai-as-promised":"^6.0.0","dirty-chai":"^1.2.2","eslint":"^3.11.0","eslint-config-airbnb":"^13.0.0","eslint-plugin-import":"^2.2.0","eslint-plugin-jsx-a11y":"2.2.3","eslint-plugin-react":"^6.7.1","eslint-watch":"^2.1.14","lodash":"^4.17.2","mocha":"^3.2.0","mockgoose":"^6.0.8","mongoose":"^4.7.0"},"gitHead":"41b1043365cf702de6d75392910caf827f63f202","bugs":{"url":"https://github.com/larron/mongoose-email-address-manager/issues"},"homepage":"https://github.com/larron/mongoose-email-address-manager#readme","_id":"mongoose-email-address-manager@2.0.0","_shasum":"1a2d6f083693bd2536aed691247c789072dae7ca","_from":".","_npmVersion":"3.10.9","_nodeVersion":"7.1.0","_npmUser":{"name":"larron","email":"me@larronarmstead.com"},"dist":{"shasum":"1a2d6f083693bd2536aed691247c789072dae7ca","tarball":"https://registry.npmjs.org/mongoose-email-address-manager/-/mongoose-email-address-manager-2.0.0.tgz","integrity":"sha512-3nHbb4FaY1c7xFtfkWczEE951p+NG1LtamQDLtcEpMcm7L7Xh0iPE2ZtoNgbIftAu/FBubk5KQzEKLVyqYdQiA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAPUO4AlMq0yqsvXVUW43MbvI11qWCTc/b7q9BGK8/PdAiEA8635GXvG8IcBZTB4T+E4jVtoCaQsZFiTG+NxgTnPZDQ="}]},"maintainers":[{"name":"larron","email":"larron@cultlogic.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/mongoose-email-address-manager-2.0.0.tgz_1480636584978_0.38931352482177317"}}},"readme":"# Mongoose Email Address Manager #\n\nManage multiple email addresses per user (or other model/doc) with this mongoose schema plugin.\n\nSomething like...\n\n    {\n        email_addresses: [\n            {\n                email_address: {type: String, unique: unique},\n                primary: Date,\n                verification: {\n                    date: Date,\n                    code: String,\n                    code_expiration: Date\n                }\n            }\n        ]\n    }\n\nInstall it...\n\n    npm install mongoose-email-address-manager\n\nPlug it in... (defaults are shown)\n\n    var db = require('mongoose'),\n        emailAddressManagerPlugin = require('mongoose-email-address-manager'),\n        UserSchema = db.Schema(),\n        options = {\n            _id: true, // removes _id fields from email_address sub docs when set to false\n            index: true, // sets indexes on emails and verification code\n            unique: true, // throws a mongo error if emails are not unique\n            sparse: true, // sparse or not\n            required: false, // verifies that at least one email sub doc exists\n            verificationCodePrefix: 'emvc-', // useful for web pages that deal with more than one type of access code / validation code (like mobile numbers)\n            verificationCodeExpiration: 0, // the amount of hours to add to the expiration date of validation code, defaults to never expire (0)\n            emailValidationRegex: /^.+@.+$/, // very simple regex validator for email addresses, overwrite if you want something more powerful :)\n            style: function (key) { // keeping you inline with your style guide, if you require camelCase or Snake_Case or so be it... override your keys with this function, default being under_score\n              return key\n            }\n        };\n\n        UserSchema.plugin(emailAddressManagerPlugin, options);\n\nMake the model...\n\n    var User = db.model('user', UserSchema);\n\nMake the instance or find the instance with the statics below ...\n\n    var user = new User({\n        email_addresses: [{\n            email_address: 'me@larron.com'\n        }]\n    });\n\nUse the statics...\n\n    User.findOneByEmail - like mongooses findOne except the first arg is an email_address instead of a condition\n    User.findByEmail - same here... this is useful if unique is set to false and more than one doc has the same email\n    User.findByEmailVerificationCode - find the doc by one of it's email verification codes\n    User.emailExists - use this to check if email exists within entire collection so you can quickly throw that \"email already exists\" error on your signup forms or something with that cool new API\n\nEmpower your self with easy methods on the instance...\n\n    user.addEmail // add a new email\n    user.addEmailAndSave\n    user.getEmail // find the email object within the doc\n    user.getPrimaryEmail // returns the email object\n    user.setPrimaryEmail // changes or sets the primary email address (will not save)\n    user.setPrimaryEmailAndSave // sets the primary email and saves the doc\n    user.isPrimaryEmail // is it?\n    user.removeEmail // removes an email address (will not save)\n    user.removeEmailAndSave\n    user.emailExists // do we have the email in the doc? It's always a yes or no answer\n    user.startEmailVerificationProcess // this configures and saves some stuff like a verification code and expiration date for the email (will not save)\n    user.startEmailVerificationProcessAndSave\n    user.getEmailByVerificationCode // if you don't have the doc in memory find it first with the static: findByEmailVerificationCode\n    user.setVerifiedEmail // set an email as verified (will not save)\n    user.setVerifiedEmailAndSave\n    user.isVerifiedEmail // returns boolean on rather or not that email address has been verified\n\nUse the one and only extremely powerful virtual field that hands down that primary email address at all times unless it's undefined\n\n    user.email; // the primary email or equivalent of user.getPrimaryEmail().email_address\n\nMisc Notes\n\nOn creation/save the first email will become primary pre save if there is not a current primary email address unless there are no email addresses.\nOn removal of an email address a new primary will be elected\nMethods that interact with the DB are Async/Await/Promise compatible (callbacks not currently supported)\n\nPlease refer to the tests for further use.\n\nFound a bug? Let me know or submit a PR...\n\nMIT\n","maintainers":[{"email":"me@larronarmstead.com","name":"larron"}],"time":{"modified":"2022-07-13T14:21:53.089Z","created":"2013-06-09T16:58:52.517Z","0.0.1":"2013-06-09T16:58:52.892Z","0.0.2":"2013-06-15T12:36:20.964Z","0.0.3":"2013-06-16T01:54:46.202Z","0.0.4":"2014-02-26T18:13:11.625Z","0.0.5":"2015-03-17T04:03:28.491Z","0.0.6":"2015-09-12T04:31:08.112Z","0.0.7":"2015-10-09T22:14:44.935Z","0.0.8":"2016-01-15T08:54:49.434Z","2.0.0":"2016-12-01T23:56:25.197Z"},"author":{"name":"Larron Armstead","email":"me@larronarmstead.com"},"repository":{"type":"git","url":"git://github.com/larron/mongoose-email-address-manager.git"},"keywords":["address","addresses","email","manager","model","mongodb","mongoose","plugin","schema"],"license":"MIT","readmeFilename":"README.md","homepage":"https://github.com/larron/mongoose-email-address-manager#readme","contributors":[{"name":"Casey Capps","email":"crcapps@gmail.com"}],"bugs":{"url":"https://github.com/larron/mongoose-email-address-manager/issues"}}