{"action":"created","issue":{"url":"https://api.github.com/repos/imbrn/v8n/issues/37","repository_url":"https://api.github.com/repos/imbrn/v8n","labels_url":"https://api.github.com/repos/imbrn/v8n/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/imbrn/v8n/issues/37/comments","events_url":"https://api.github.com/repos/imbrn/v8n/issues/37/events","html_url":"https://github.com/imbrn/v8n/issues/37","id":342433835,"node_id":"MDU6SXNzdWUzNDI0MzM4MzU=","number":37,"title":"Better sharable extending","user":{"login":"olstenlarck","id":5038030,"node_id":"MDQ6VXNlcjUwMzgwMzA=","avatar_url":"https://avatars3.githubusercontent.com/u/5038030?v=4","gravatar_id":"","url":"https://api.github.com/users/olstenlarck","html_url":"https://github.com/olstenlarck","followers_url":"https://api.github.com/users/olstenlarck/followers","following_url":"https://api.github.com/users/olstenlarck/following{/other_user}","gists_url":"https://api.github.com/users/olstenlarck/gists{/gist_id}","starred_url":"https://api.github.com/users/olstenlarck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olstenlarck/subscriptions","organizations_url":"https://api.github.com/users/olstenlarck/orgs","repos_url":"https://api.github.com/users/olstenlarck/repos","events_url":"https://api.github.com/users/olstenlarck/events{/privacy}","received_events_url":"https://api.github.com/users/olstenlarck/received_events","type":"User","site_admin":false},"labels":[{"id":997913636,"node_id":"MDU6TGFiZWw5OTc5MTM2MzY=","url":"https://api.github.com/repos/imbrn/v8n/labels/Note:%20Needs%20Discussion","name":"Note: Needs Discussion","color":"006b75","default":false},{"id":997912252,"node_id":"MDU6TGFiZWw5OTc5MTIyNTI=","url":"https://api.github.com/repos/imbrn/v8n/labels/Scope:%20API","name":"Scope: API","color":"7ee5ba","default":false},{"id":997909097,"node_id":"MDU6TGFiZWw5OTc5MDkwOTc=","url":"https://api.github.com/repos/imbrn/v8n/labels/Type:%20Change","name":"Type: Change","color":"bfdadc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-07-18T18:03:50Z","updated_at":"2018-07-18T19:47:42Z","closed_at":null,"author_association":"NONE","body":"Currently you can use `v8n.extend` but it does not return anything, i think a lot more better would be to return and then pass it where it is needed.\r\n\r\nFor example\r\n\r\ncustomRules.js\r\n```js\r\nconst v8n = require('v8n')\r\n\r\nmodule.exports = v8n.extend({\r\n  one: (expected) => (actual) => actual === 1\r\n})\r\n```\r\n\r\nso later we can pass it for example to the `v8n()` or to new `v8n().use()`?\r\n\r\n```js\r\nconst v8n = require('v8n')\r\nconst customRules = require('./customRules')\r\n\r\nv8n(customRules)\r\n  .one()\r\n  .test(123) // => false\r\n```"},"comment":{"url":"https://api.github.com/repos/imbrn/v8n/issues/comments/406052142","html_url":"https://github.com/imbrn/v8n/issues/37#issuecomment-406052142","issue_url":"https://api.github.com/repos/imbrn/v8n/issues/37","id":406052142,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjA1MjE0Mg==","user":{"login":"imbrn","id":1906977,"node_id":"MDQ6VXNlcjE5MDY5Nzc=","avatar_url":"https://avatars1.githubusercontent.com/u/1906977?v=4","gravatar_id":"","url":"https://api.github.com/users/imbrn","html_url":"https://github.com/imbrn","followers_url":"https://api.github.com/users/imbrn/followers","following_url":"https://api.github.com/users/imbrn/following{/other_user}","gists_url":"https://api.github.com/users/imbrn/gists{/gist_id}","starred_url":"https://api.github.com/users/imbrn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imbrn/subscriptions","organizations_url":"https://api.github.com/users/imbrn/orgs","repos_url":"https://api.github.com/users/imbrn/repos","events_url":"https://api.github.com/users/imbrn/events{/privacy}","received_events_url":"https://api.github.com/users/imbrn/received_events","type":"User","site_admin":false},"created_at":"2018-07-18T19:47:42Z","updated_at":"2018-07-18T19:47:42Z","author_association":"OWNER","body":"You can also export multiple rules all together:\r\n\r\n```javascript\r\n// myCustomRules.js\r\nexport default {\r\n  ruleOne: () => value => value === \"something\",\r\n  ruleTwo: () => value => value === \"another thing\"\r\n};\r\n```\r\n\r\n```javascript\r\n// myApp.ja\r\nimport myCustomRules from \"./myCustomRules\";\r\n\r\nv8n.extend(myCustomRules);\r\n```"}}
{"actor":{"display_login":"imbrn"}}