{"id":36501533,"url":"https://github.com/ahabra/data-bind","last_synced_at":"2026-01-12T02:22:16.976Z","repository":{"id":42636723,"uuid":"242049943","full_name":"ahabra/data-bind","owner":"ahabra","description":"Simple two-way data binding for JavaScript","archived":false,"fork":false,"pushed_at":"2025-05-25T00:05:37.000Z","size":504,"stargazers_count":9,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-19T22:59:17.928Z","etag":null,"topics":["data-binding","javascript-library"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ahabra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"zenodo":null}},"created_at":"2020-02-21T03:58:46.000Z","updated_at":"2025-08-31T16:29:41.000Z","dependencies_parsed_at":"2025-06-26T11:38:25.252Z","dependency_job_id":"519ec0df-f0cb-44dc-9d5d-23c4d27d319c","html_url":"https://github.com/ahabra/data-bind","commit_stats":{"total_commits":64,"total_committers":2,"mean_commits":32.0,"dds":0.078125,"last_synced_commit":"171e8551c36f3c0e9c11743a3e49623709588f6b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ahabra/data-bind","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahabra%2Fdata-bind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahabra%2Fdata-bind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahabra%2Fdata-bind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahabra%2Fdata-bind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahabra","download_url":"https://codeload.github.com/ahabra/data-bind/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahabra%2Fdata-bind/sbom","scorecard":{"id":171495,"data":{"date":"2025-08-11","repo":{"name":"github.com/ahabra/data-bind","commit":"344d2255abd87a874b0c647cef167864163ff8cb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"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":"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":"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":"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":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: 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":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"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":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"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-16T16:37:20.626Z","repository_id":42636723,"created_at":"2025-08-16T16:37:20.626Z","updated_at":"2025-08-16T16:37:20.626Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28332049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"online","status_checked_at":"2026-01-12T02:00:08.677Z","response_time":98,"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":["data-binding","javascript-library"],"created_at":"2026-01-12T02:22:16.222Z","updated_at":"2026-01-12T02:22:16.970Z","avatar_url":"https://github.com/ahabra.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data Bind\nEasy to use, two-way data binding library, light-weight, and with no dependencies.\n\n\n## What is Data Binding\nWe _bind_ a DOM element on a page to a variable or object in the JS code, such that when\none changes, the other will change automatically. \n\nFor example if we have an input box that we bind to the property `person.name`,\nif the user enters a value in the input box, `person.name` will change. If the programmer\nchanges the value in `person.name` the input box will also change.\n\n## Install\nYou can use this library as either an ES6 module or the old way as a script that \nyou include in your html file.\n\n### Install as NPM ES6 Module\nIf you plan to use this package as an NPM module, install it:\n\n    npm install @techexp/data-bind\n\n\n### Install as a Script\nIf you plan to use this package as a JS script library:\n\n```html\n\u003cscript src=\"https://raw.githubusercontent.com/ahabra/data-bind/master/dist/data-bind-script-min.js\"\u003e\u003c/script\u003e\n```\n\nAlternatively, you can download the file \n`https://github.com/ahabra/data-bind/blob/master/dist/data-bind-script-min.js` \nand use directly.\n\n## Usage\nIf you installed as an NPM module:\n```js\nimport bind from '@techexp/data-bind'\n```\n\nIf you installed it as Script, the bind function is available at `window.bind()`\n\n\n### Quick Code Demo\n```html\n     \u003cinput id=\"age\" type=\"text\" /\u003e\n```\n\n```js\nconst obj = {};\nbind({obj, prop:'age', sel:'#age'});\n\nobj.age = 10; // Notice how the view will change\n\n// Now manually edit the input box on the page\n// then from the browser's console tab:\nconsol.log(obj.age);\n```\n### API\nThere is a single function `bind()` that you can use. It takes a single argument\nobject with the following keys:\n\n1. `obj`: An existing object where a property will be bound. Optional. If missing, \n    a new object is created and returned by the `bind()` function.\n2. `prop`: The name of the property to be bound. It can be an existing\n        property or a new one. Required, string.\n3. `sel`: A CSS selector which selects an element on the page. Optional, string. If\n        ommitted, then an unbounded property will be created.\n4. `attr`: The name of an attribute on the selected element. Optional, string.\n5. `root`: The root DOM node which contains the bound element. If ommitted, then\n        `document` will be the root. Optional, DOM Element.\n6. `getter`: An optional function that returns the value of the bound property. This can be\n   used instead of the selector `sel`. The function takes no arguments and returns a value.\n7. `setter`: An optional function that takes a value argument and assigns it to the bound \n   property. This can be used instead of the selector `sel`. \n6. `onChange`: A callback which is invoked when the value of a property is changed through\n        an API invocation (_and not through UI interaction_). The callback function takes two \n        arguments `(oldValue, newValue)`.\n\nThe `bind()` function returns the bound object.\n\nWhen `attr` is given, the value of the attribute is bound to the property.\nFor example, you can bind the style attribute to a property.\n```js\nbind({obj, prop:'carColor', sel:'#carColor', attr:'style'});\n\n// then you can change the element's background color:\nobj.carColor = 'background-color:red';\n```\n\nWhen `attr` is __not__ given:\n* If the selected element is input-type element (`input`, `textarea`, or `select`), \n    the value of the element is bound.\n* Otherwise, the `innerHTML` of the element is bound.\n\n#### Using root\nThe `bind()` function can be called with an optional `root` argument. For example, consider this html fragment:\n\n```html\n    \u003cdiv id=\"container\"\u003e\n        \u003cinput class=\"name\" type=\"text\" /\u003e\n    \u003c/div\u003e\n```\nWe can bind the `name` as follows:\n\n```js\nconst obj = {};\nconst root = document.getElementById('container');\nbind({obj, prop:'name', sel:'.name', root});\n```\n\n\nLook at this repo's `example/example.html` for a fully working example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahabra%2Fdata-bind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahabra%2Fdata-bind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahabra%2Fdata-bind/lists"}