{"id":21262422,"url":"https://github.com/finom/defi","last_synced_at":"2025-10-09T01:40:24.434Z","repository":{"id":40867441,"uuid":"116431861","full_name":"finom/defi","owner":"finom","description":"A bunch of utilities that enable accessor-based reactivity for JavaScript objects","archived":false,"fork":false,"pushed_at":"2024-02-27T15:13:31.000Z","size":10560,"stargazers_count":51,"open_issues_count":5,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-06T13:35:56.528Z","etag":null,"topics":["javascript","reactive-programming","two-way-data-binding"],"latest_commit_sha":null,"homepage":"https://defi.js.org/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/finom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-05T22:12:28.000Z","updated_at":"2025-02-21T18:09:37.000Z","dependencies_parsed_at":"2024-06-19T02:48:51.055Z","dependency_job_id":"2847d7e9-31bf-4b0a-8c9b-adb1469dfbfc","html_url":"https://github.com/finom/defi","commit_stats":{"total_commits":264,"total_committers":3,"mean_commits":88.0,"dds":0.007575757575757569,"last_synced_commit":"0b12e42b3c01556645bd67f934520ed96880f31b"},"previous_names":[],"tags_count":109,"template":false,"template_full_name":null,"purl":"pkg:github/finom/defi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finom%2Fdefi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finom%2Fdefi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finom%2Fdefi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finom%2Fdefi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/finom","download_url":"https://codeload.github.com/finom/defi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finom%2Fdefi/sbom","scorecard":{"id":400423,"data":{"date":"2025-08-11","repo":{"name":"github.com/finom/defi","commit":"0b12e42b3c01556645bd67f934520ed96880f31b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.5,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.0.17 not signed: https://api.github.com/repos/finom/defi/releases/10658495","Warn: release artifact v0.0.17 does not have provenance: https://api.github.com/repos/finom/defi/releases/10658495"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":0,"reason":"132 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-hxwm-x553-x359","Warn: Project is vulnerable to: GHSA-h5c3-5r3r-rr8q","Warn: Project is vulnerable to: GHSA-rmvr-2pp2-xj38","Warn: Project is vulnerable to: GHSA-xx4v-prfh-6cgc","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-w8qv-6jwh-64r5","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-vh7m-p724-62c2","Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-j4f2-536g-r55m","Warn: Project is vulnerable to: GHSA-r7qp-cfhv-p84w","Warn: Project is vulnerable to: GHSA-74fj-2j2h-c42q","Warn: Project is vulnerable to: GHSA-pw2r-vq6v-hr8c","Warn: Project is vulnerable to: GHSA-jchw-25xp-jwwc","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-78xj-cgh5-2h22","Warn: Project is vulnerable to: GHSA-2p57-rm9w-gvfp","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-282f-qqgm-c34q","Warn: Project is vulnerable to: GHSA-7x7c-qm48-pq9c","Warn: Project is vulnerable to: GHSA-rc3x-jf5g-xvc5","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-82v2-mx6x-wq7q","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-hxm2-r34f-qmc5","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-w7rc-rwvf-8q5r","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-px4h-xg32-q955","Warn: Project is vulnerable to: GHSA-jmqm-f2gx-4fjv","Warn: Project is vulnerable to: GHSA-3j8f-xvm3-ffx4","Warn: Project is vulnerable to: GHSA-4p35-cfcx-8653","Warn: Project is vulnerable to: GHSA-7f3x-x4pr-wqhj","Warn: Project is vulnerable to: GHSA-jpp7-7chh-cf67","Warn: Project is vulnerable to: GHSA-q6wq-5p59-983w","Warn: Project is vulnerable to: GHSA-j9fq-vwqv-2fm2","Warn: Project is vulnerable to: GHSA-pqw5-jmp5-px4v","Warn: Project is vulnerable to: GHSA-6fx8-h7jm-663j","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx","Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch","Warn: Project is vulnerable to: GHSA-h9rv-jmmf-4pgx","Warn: Project is vulnerable to: GHSA-hxcc-f52p-wc94","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-fxwf-4rqh-v8g3","Warn: Project is vulnerable to: GHSA-25hc-qcg6-38wj","Warn: Project is vulnerable to: GHSA-xfhh-g9f5-x4m4","Warn: Project is vulnerable to: GHSA-qm95-pgcg-qqfq","Warn: Project is vulnerable to: GHSA-cqmj-92xf-r6r9","Warn: Project is vulnerable to: GHSA-vx3p-948g-6vhq","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-29xr-v42j-r956","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-xc7v-wxcw-j472","Warn: Project is vulnerable to: GHSA-662x-fhqg-9p8v","Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx","Warn: Project is vulnerable to: GHSA-78cj-fxph-m83p","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3","Warn: Project is vulnerable to: GHSA-wr3j-pwj9-hqq6","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q","Warn: Project is vulnerable to: GHSA-72mh-269x-7mh5","Warn: Project is vulnerable to: GHSA-h4j5-c7cj-74xg","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-4gw3-8f77-f72c"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T19:57:39.018Z","repository_id":40867441,"created_at":"2025-08-18T19:57:39.019Z","updated_at":"2025-08-18T19:57:39.019Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000781,"owners_count":26082851,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","reactive-programming","two-way-data-binding"],"created_at":"2024-11-21T04:58:24.290Z","updated_at":"2025-10-09T01:40:24.406Z","avatar_url":"https://github.com/finom.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\n\u003ca href=\"https://defi.js.org\"\u003e\n  \u003cimg src=\"https://defi.js.org/logo/logo.svg\" /\u003e\n\u003c/a\u003e\n\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003eData binding without framework: a bunch of utilities that enable accessor-based reactivity for JavaScript objects.\u003c/p\u003e\n\n\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://defi.js.org/img/defi_demo.gif\" width=\"570\" /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://badge.fury.io/js/defi\" rel=\"nofollow\"\u003e\u003cimg alt=\"npm version\" src=\"https://badge.fury.io/js/defi.svg\" style=\"max-width:100%;\"\u003e\u003c/a\u003e \u003ca href=\"https://coveralls.io/github/finom/defi?branch=master\" rel=\"nofollow\"\u003e\u003cimg alt=\"Coverage Status\" src=\"https://coveralls.io/repos/github/finom/defi/badge.svg?branch=master\" style=\"max-width:100%;\"\u003e\u003c/a\u003e\n\n\n\u003c/p\u003e\n\n*If you're looking for **defi-react** [get its README here](https://github.com/finom/defi/tree/master/packages/react).*\n\n\nIt can be installed via NPM:\n```\nnpm i defi\n```\n```js\nconst { bindNode, calc } = require('defi');\n\nbindNode(obj, 'key', node)\n```\n\nOr [downloaded to use as a global variable](https://github.com/finom/defi/tree/gh-pages)\n\n```js\n// use defi as a global variable\ndefi.bindNode(obj, 'key', node)\n```\n\n\n\n## How would I use it?\n\n*Skip this section if you're using **defi-react** because React handles DOM rendering by its own.*\n\nAs a simple task let's say you want to define a simple form with first name and last name input, where while you type a greeting appears.\n\n```html\n\u003cinput class=\"first\"\u003e\n\u003cinput class=\"last\"\u003e\n\u003coutput class=\"greeting\"\u003e\u003c/output\u003e\n```\n\n```js\n// default data\nconst obj = {\n  first: 'John',\n  last: 'Doe'\n};\n\n// let's listen for first and last name changes\ndefi.on(obj, 'change:first', () =\u003e console.log('First name is changed'));\ndefi.on(obj, 'change:last', () =\u003e console.log('Last name is changed'));\n\n// we would like to re-calculate 'greeting' property every time\n// when the first or last are changed\ndefi.calc(obj, 'greeting', ['first', 'last'], (first, last) =\u003e `Hello, ${first} ${last}`);\n\n// and we want to set up a two-way data binding between the props\n// and corresponding DOM nodes\ndefi.bindNode(obj, {\n  first: '.first',\n  last: '.last',\n  greeting: '.greeting'\n});\n```\n\nIf `first` or `last` is changed then event handlers print info about that to console, `greeting` property is updated, `.greeting` element is populated by calculated data (by default \"Hello, John Doe\"). And it happens every time when these properties are changed and it doesn't matter which way. You can do `obj.first = 'Jane'` or you can type text into its field, and everything will happen immediately.\n\nThat's the real accessor-based reactiveness! Check the example above [here](https://jsbin.com/hakunotaqo/edit?html,js,console,output) and try to type `obj.first = 'Jane'` at the \"Console\" tab.\n\nNote that if you want to use a custom HTML element (at the example above we use ``\u003coutput\u003e`` tag) to update its innerHTML you will need to pass so-called \"binder\" as a rule of how the bound element should behave. By default ``defi.bindNode`` doesn't know how to interact with non-form elements.\n\n\n```js\nconst htmlBinder = {\n  setValue: (value, binding) =\u003e binding.node.innerHTML = value,\n};\n// this will update innerHTML for any element when obj.greeting is changed\ndefi.bindNode(obj, 'greeting', '.greeting', htmlBinder)\n```\n\nAlso you can use ``html`` from [common-binders](https://github.com/finom/defi/tree/master/packages/common-binders) (a collection of binders of general purpose).\n\n```js\nconst { html } = require('common-binders');\ndefi.bindNode(obj, 'greeting', '.greeting', html())\n```\n\nNote that there is also a routing library for defi.js - [defi-router](https://github.com/finom/defi/tree/master/packages/router).\n\n## Quick API ref\n\nFull reference with all variations, flags and tutorials live at [defi.js.org](http://defi.js.org).\n\n\n- [bindNode](https://defi.js.org/#!defi.bindNode) - Binds a property of an object to HTML node, implementing two-way data binding.\n\n```js\n// basic use (for standard HTML5 elements)\ndefi.bindNode(obj, 'myKey', '.my-element');\n\n// custom use (for any custom element)\ndefi.bindNode(obj, 'myKey', '.my-element', {\n    // when is element state changed?\n    // (that's a DOM event; a function can be used to listen to any non-DOM events)\n    on: 'click',\n    // how to extract element state?\n    getValue: ({ node }) =\u003e someLibraryGetValue(node),\n    // how to set element state?\n    setValue: (v, { node }) =\u003e someLibrarySetValue(node, v),\n    // how to initialize the widget?\n    // it can be initialized in any way,\n    // but 'initialize' function provides some syntactic sugar\n    initialize: ({ node }) =\u003e someLibraryInit(node),\n});\n\nobj.myKey = 'some value'; // updates the element\n```\n\n- [calc](https://defi.js.org/#!defi.calc) - Creates a dependency of one property value on values of other properties (including other objects).\n\n```js\ndefi.calc(obj, 'a', ['b', 'c'], (b, c) =\u003e b + c);\nobj.b = 1;\nobj.c = 2;\nconsole.log(obj.a); // 3\n```\n\n- [mediate](https://defi.js.org/#!defi.mediate) - Transforms property value on its changing.\n\n```js\ndefi.mediate(obj, 'x', value =\u003e String(value));\n\nobj.x = 1;\n\nconsole.log(obj.x); // \"1\"\nconsole.log(typeof obj.x); // \"string\"\n```\n\n\n- [on](https://defi.js.org/#!defi.on) - Adds an event handler. Detailed information about all possible events you can get at the [\"Events\" section](https://defi.js.org/#!events) of the website.\n\n```js\ndefi.on(obj, 'change:x', () =\u003e {\n\talert(`obj.x now equals ${obj.x}`);\n});\n\nobj.x = 1;\n```\n\n- [off](https://defi.js.org/#!defi.off) - Deletes an event handler.\n\n```js\ndefi.off(obj, ['change:x', 'bind']);\n```\n\n- [trigger](https://defi.js.org/#!defi.trigger) - Fires an event.\n\n```js\ndefi.on(obj, ['foo', 'bar'], (a, b, c) =\u003e {\n\talert(a + b + c);\n});\ndefi.trigger(obj, 'foo', 1, 2, 3); // alerts 6\n```\n\n- [unbindNode](https://defi.js.org/#!defi.unbindNode) - Disables a binding.\n\n```js\ndefi.bindNode(obj, 'myKey', '.my-element');\n\ndefi.unbindNode(obj, 'myKey', '.my-element');\n```\n\n- [bound](https://defi.js.org/#!defi.bound) - Returns a bound element.\n\n```js\ndefi.bindNode(obj, 'myKey', '.my-element');\nconst node = defi.bound(obj, 'myKey'); // will return document.querySelector('.my-element')\n```\n\n- [chain](https://defi.js.org/#!defi.chain) - Allows chained calls of defi.js functions.\n\n```js\ndefi.chain(obj)\n    .calc('a', 'b', b =\u003e b * 2)\n    .set('b', 3)\n    .bindNode('c', '.node');\n```\n\n- [defaultBinders](https://defi.js.org/#!defi.defaultBinders) - An array of functions which return a corresponding binder or a falsy value. This makes ``bindNode`` to detect how to bind a node if the binder argument isn't given.\n\n```js\ndefi.defaultBinders.unshift(element =\u003e {\n\t// check if the element has \"foo\" class name\n\tif(element.classList.contains('foo')) {\n\t\t// if checking is OK, return a new binder\n\t\treturn {\n\t\t\ton: ...,\n\t\t\tgetValue: ...,\n\t\t\tsetValue: ...\n\t\t};\n\t}\n});\n\n// ...\n\ndefi.bindNode(obj, 'myKey', '.foo.bar');\n\n```\n\n- [lookForBinder](https://defi.js.org/#!defi.lookForBinder) - Returns a binder corresponding to an element.\n\n```js\nconst element = document.createElement('input');\nelement.type = 'text';\n\nconsole.log(defi.lookForBinder(element));\n```\n\n- [remove](https://defi.js.org/#!defi.remove) - Deletes a property and removes attached change handlers.\n\n```js\ndefi.remove(obj, 'myKey');\n```\n\n- [set](https://defi.js.org/#!defi.set) - Sets a property value allowing to pass an event options object.\n\n```js\ndefi.set(obj, 'myKey', 3, { silent: true });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinom%2Fdefi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffinom%2Fdefi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinom%2Fdefi/lists"}