Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A minimalist two-way data-binding library for those who don't need big fat frameworks like Angular.js.
A minimalist two-way data-binding library for those that are looking for something leaner than big fat frameworks like Angular.js.
bower install --save doobie
Or if you're using npm:
npm install --save doobie
Just include it in your HTML file. You will also need to include jQuery before including this library:
<script src="jquery.js" />
<script src="doobie.js" />
Then all that you have to do is invoke $.doobie()
and pass your model to the library:
$.doobie({
firstName: 'Foo',
lastName: 'von Bar',
fullName: function(firstName, lastName) {
return this.firstName + ' ' + this.lastName;
}
});
And then, in your HTML, reference your model using doobie
attributes. See below.
For instance:
<p doobie="firstName"></p>
The <p>
element's content will immediately be filled with the value from firstName
and every time it changes. It
works with every element that is a container.
If you bind it to an <input>
tag, it will work as a two-way binding. Any update to the <input>
will also trigger
an update to the property, and vice-versa:
<input type="text" doobie="lastName" />
It works for textarea
elements too. select
is on the roadmap yet.
For cases that you want to bind to the DOM some processed version of the model you have, you should use a computed property. It allows you to specify a function that will be called every time some of its dependencies change. For example, say you have the following model:
$.doobie({
firstName: 'Foo',
lastName: 'von Bar',
fullName: function(firstName, lastName) {
return this.firstName + ' ' + this.lastName;
}
});
And then your HTML has a div
like this:
Your name is <span doobie="fullName"></span>.
Doobie watches for those function's parameters and parses them as properties of your model. So, every time at least one of those properties change, your function is called to update DOM elements that are bound to it.
It is a very common pattern to map an array to rows in a table in HTML. In general, you may want to map an array to a
list of any element type. To be able to do that, you can the same attribute doobie
that you use for other bindings.
The DOM will be kept up to date with the array every time an item is added, updated or removed from it.
Array elements themselves can contain other objects, even other arrays, and the binding will still work as expected.
FAQs
A minimalist two-way data-binding library for those who don't need big fat frameworks like Angular.js.
The npm package doobie receives a total of 1 weekly downloads. As such, doobie popularity was classified as not popular.
We found that doobie demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.