{"_id":"hof-behaviour-hooks","_rev":"58-c9c4ee3430d9f771a9bfef43d044e386","name":"hof-behaviour-hooks","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"hof-behaviour-hooks","version":"1.0.0","author":{"name":"UKHomeOfficeForms"},"license":"MIT","_id":"hof-behaviour-hooks@1.0.0","maintainers":[{"name":"joefitter","email":"hello@joefitter.com"}],"homepage":"https://github.com/UKHomeOfficeForms/hof-behaviour-hooks#readme","bugs":{"url":"https://github.com/UKHomeOfficeForms/hof-behaviour-hooks/issues"},"dist":{"shasum":"ed57621c4b6338530e557ef923437d11abd0e6e5","tarball":"https://registry.npmjs.org/hof-behaviour-hooks/-/hof-behaviour-hooks-1.0.0.tgz","integrity":"sha512-FVKHy+nSnuE7wB3nxvSeatglODuK3xfKq2IkkM8gym270titacLxnC0mVem7tVYojaDklXNOqhXIFFCBkb1UBA==","signatures":[{"sig":"MEQCIHOno9oan3HqeYxo1SiTLxBx+/vWxgFonGE4v4iqq3viAiAc7lzMT4Is7uk32xMciRI72xuUqPs4u7qYpzzUa1zYHg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"ed57621c4b6338530e557ef923437d11abd0e6e5","gitHead":"30b0bcf93c910bc21bf8cd650171ef0baa03293b","scripts":{"test":"npm run test:lint && npm run test:unit","test:lint":"eslint .","test:unit":"istanbul cover _mocha"},"_npmUser":{"name":"joefitter","email":"hello@joefitter.com"},"repository":{"url":"git+https://github.com/UKHomeOfficeForms/hof-behaviour-hooks.git","type":"git"},"_npmVersion":"3.10.10","description":"HOF Behaviour for running lifecycle hooks","directories":{},"_nodeVersion":"6.2.2","dependencies":{"lodash":"^4.17.4","express":"^4.14.1"},"devDependencies":{"chai":"^3.5.0","mocha":"^3.2.0","sinon":"^1.17.7","eslint":"^3.15.0","reqres":"^1.2.2","mixwith":"^0.1.1","istanbul":"^0.4.5","sinon-chai":"^2.8.0","mocha-sandbox":"^1.0.0","hof-form-controller":"^2.0.0","eslint-config-homeoffice":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/hof-behaviour-hooks-1.0.0.tgz_1486651897873_0.0633477468509227","host":"packages-18-east.internal.npmjs.com"}},"1.0.1":{"name":"hof-behaviour-hooks","version":"1.0.1","author":{"name":"UKHomeOfficeForms"},"license":"MIT","_id":"hof-behaviour-hooks@1.0.1","maintainers":[{"name":"joefitter","email":"hello@joefitter.com"}],"homepage":"https://github.com/UKHomeOfficeForms/hof-behaviour-hooks#readme","bugs":{"url":"https://github.com/UKHomeOfficeForms/hof-behaviour-hooks/issues"},"dist":{"shasum":"b2fd9c33a0584a5f93da1a3447879aa75d797ee1","tarball":"https://registry.npmjs.org/hof-behaviour-hooks/-/hof-behaviour-hooks-1.0.1.tgz","integrity":"sha512-+F/4ayXioIR1VK+ruPOb9dQ9fV3bDNP2lxmVxV8qd99hOnPDnp0rVkoELz8vimRw9u/sXD0Vh+hCAzbpfL7KqQ==","signatures":[{"sig":"MEQCIGwbnYYBvI06tL2IIi62QajGACASANh/F8+qZlelguEWAiBpeZ6jB1Ts8piYNrrnzoE31SVc/WcgQ/XKOHDEb5okPw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"b2fd9c33a0584a5f93da1a3447879aa75d797ee1","gitHead":"80f77861a7ef95c673cd1f9a58efc7091c8a3ace","scripts":{"test":"npm run test:lint && npm run test:unit","test:lint":"eslint .","test:unit":"istanbul cover _mocha"},"_npmUser":{"name":"joefitter","email":"hello@joefitter.com"},"repository":{"url":"git+https://github.com/UKHomeOfficeForms/hof-behaviour-hooks.git","type":"git"},"_npmVersion":"3.10.10","description":"HOF Behaviour for running lifecycle hooks","directories":{},"_nodeVersion":"6.2.2","dependencies":{"lodash":"^4.17.4","express":"^4.14.1"},"devDependencies":{"chai":"^3.5.0","mocha":"^3.2.0","sinon":"^1.17.7","eslint":"^3.15.0","reqres":"^1.2.2","mixwith":"^0.1.1","istanbul":"^0.4.5","sinon-chai":"^2.8.0","mocha-sandbox":"^1.0.0","hof-form-controller":"^2.0.0","eslint-config-homeoffice":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/hof-behaviour-hooks-1.0.1.tgz_1487584038284_0.00044264551252126694","host":"packages-12-west.internal.npmjs.com"}},"1.0.2":{"name":"hof-behaviour-hooks","version":"1.0.2","author":{"name":"UKHomeOfficeForms"},"license":"MIT","_id":"hof-behaviour-hooks@1.0.2","maintainers":[{"name":"joefitter","email":"hello@joefitter.com"}],"homepage":"https://github.com/UKHomeOfficeForms/hof-behaviour-hooks#readme","bugs":{"url":"https://github.com/UKHomeOfficeForms/hof-behaviour-hooks/issues"},"dist":{"shasum":"6dd3e0740f030e5c965f8e443cbc735af729403f","tarball":"https://registry.npmjs.org/hof-behaviour-hooks/-/hof-behaviour-hooks-1.0.2.tgz","integrity":"sha512-rpcTHJ8G8HHg9gPzVGFXUE789wyRcoO8AslIn2FC0OkXEba2hYKcP3BBElfiYMRkLsY6NIz7TcPL7eWTDMxvYA==","signatures":[{"sig":"MEUCICL/2xaD9S2wlx5chGTnwbrv6k70sTapOtzaEQtnZtEGAiEAkZIDSegUDNBgjQlepiqCcjWL6QJv+eb8vwEK2jyZHO4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"6dd3e0740f030e5c965f8e443cbc735af729403f","gitHead":"973b5bdbedbab0e8fe4bc433b229648461e5be13","scripts":{"test":"npm run test:lint && npm run test:unit","test:lint":"eslint .","test:unit":"istanbul cover _mocha"},"_npmUser":{"name":"lennym","email":"leonard.martin@gmail.com"},"repository":{"url":"git+https://github.com/UKHomeOfficeForms/hof-behaviour-hooks.git","type":"git"},"_npmVersion":"4.5.0","description":"HOF Behaviour for running lifecycle hooks","directories":{},"_nodeVersion":"6.9.4","dependencies":{"lodash":"^4.17.4","express":"^4.15.2"},"devDependencies":{"chai":"^3.5.0","mocha":"^3.2.0","sinon":"^1.17.7","eslint":"^3.15.0","reqres":"^1.2.2","mixwith":"^0.1.1","istanbul":"^0.4.5","sinon-chai":"^2.8.0","mocha-sandbox":"^1.0.0","hof-form-controller":"^2.0.0","eslint-config-homeoffice":"^2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/hof-behaviour-hooks-1.0.2.tgz_1493319260205_0.571143833687529","host":"packages-18-east.internal.npmjs.com"}}},"time":{"created":"2017-02-09T14:51:38.442Z","modified":"2026-09-21T15:12:45.326Z","1.0.0":"2017-02-09T14:51:38.442Z","1.0.1":"2017-02-20T09:47:20.104Z","1.0.2":"2017-04-27T18:54:20.765Z"},"bugs":{"url":"https://github.com/UKHomeOfficeForms/hof-behaviour-hooks/issues"},"author":{"name":"UKHomeOfficeForms"},"license":"MIT","homepage":"https://github.com/UKHomeOfficeForms/hof-behaviour-hooks#readme","repository":{"url":"git+https://github.com/UKHomeOfficeForms/hof-behaviour-hooks.git","type":"git"},"description":"HOF Behaviour for running lifecycle hooks","maintainers":[{"email":"aaron.russell@digital.homeoffice.gov.uk","name":"aaronrussellho"},{"email":"sas-hof-test@digital.homeoffice.gov.uk","name":"hof-bot-user"},{"email":"dk4g.blob@gmail.com","name":"dk4g"},{"email":"gregory.wolverson@digital.homeoffice.gov.uk","name":"greg_wolverson_ho"},{"email":"vinodha.samiyappan@digital.homeoffice.gov.uk","name":"vinodha.s"},{"email":"megan.john@digital.homeoffice.gov.uk","name":"meganjohn"},{"email":"nese.zorba@digital.homeoffice.gov.uk","name":"nzorba"},{"email":"rayhannur.rohman@digital.homeoffice.gov.uk","name":"rayhannurrohmanho"},{"email":"vivek.kumar1@digital.homeoffice.gov.uk","name":"vivekkumar-ho"},{"email":"hello@joefitter.com","name":"joefitter"}],"readme":"#hof-behaviour-hooks\n\nHOF Behaviour enabling lifecycle hooks for extending functionality in main form pipeline.\n\n##Usage\n\n###With [mixwith.js](https://github.com/justinfagnani/mixwith.js)\n\n```js\nconst mix = require('mixwith').mix;\nconst Hooks = require('hof-behaviour-hooks');\nconst BaseController = require('hof-form-controller');\n\nclass MyController extends mix(BaseController).with(Hooks) {\n  ...\n}\n```\n`MyController` now extends `hof-form-controller` and has `hof-behaviour-hooks` functionality mixed in.\n\n##Functionality\n\nThe following hooks are currently supported, the methods are GET/POST pipeline methods from `hof-form-controller`:\n\n####GET\n* `_getErrors` - `'pre-getErrors', 'post-getErrors'`\n* `_getValues` - `'pre-getValues', 'post-getValues'`\n* `_locals` - `'pre-locals', 'post-locals'`\n* `render` - `'pre-render', 'post-render'`\n\n####POST\n* `_process` - `'pre-process', 'post-process'`\n* `_validate` - `'pre-validate', 'post-validate'`\n* `saveValues` - `'pre-saveValues', 'post-saveValues'`\n* `successHandler` - `'pre-successHandler', 'post-successHandler'`\n\n###In field config\n\nfields.js\n```js\nmodule.exports = {\n  'field-1': {\n    hooks: {\n      'post-locals': (req, res, next) => {\n        Object.assign(res.locals, {\n          foo: 'bar'\n        });\n        next();\n      },\n      'pre-process': (req, res, next) => {\n        req.body['field-1'] = req.body['field-1'].toUpperCase();\n        next();\n      }\n    }\n  }\n}\n```\n","readmeFilename":"README.md"}