
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
ember-set-helper
Advanced tools
A better mut
helper!
{{this.greeting}}
<button {{on "click" (set this "greeting" "Hello!")}}>
English
</button>
<button {{on "click" (fn (set this "greeting") "Hola!")}}>
Español
</button>
The {{set}}
helper returns a function that sets a value. This can be used in
combination with Ember's {{on}}
modifier or component actions to update state
without having to write your own custom action. For simple cases, this is pretty
handy:
<button {{on "click" (set this "greeting" "Hello!")}}>
English
</button>
If you do not provide a value to the set
helper, it will set the value that is
provided to it when called. For example:
<!-- app/components/counter.hbs -->
{{this.count}}
<button {{on "click" this.updateCount}}>Add 1</button>
// app/components/counter.js
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
export default class Counter extends Component {
@tracked count = 0;
@action
updateCount() {
this.count++;
if (this.args.onClick) {
this.args.onClick(this.count);
}
}
}
<!-- usage -->
<Counter @onClick={{set this "currentCount"}} />
This will set the value of this.currentCount
to whatever value is passed to it
when it is called (in this case the count
of the counter component whenever a
user clicks the button).
You can pass a path dynamically using to the helper as well:
<button {{on "click" (set this this.greetingPath "Hello!")}}>
English
</button>
ember-composable-helpers
With the {{action}}
helper and modifier, you could specify a value path using
the value
named argument:
<input {{on "input" (action (mut this.value) value="target.value"))}}/>
You can accomplish the same thing with {{set}}
by using the {{pick}}
helper
from ember-composable-helpers
to first pick the value off of the event, and then pass it to {{set}}
:
<input {{on "input" (pick "target.value" (set this "value"))}}>
mut
(set this "foo")
=== (fn (mut this.foo))
)(set this "foo" "bar")
=== (fn (mut this.foo) "bar")
)ember install ember-set-helper
See the Contributing guide for details.
This project is licensed under the MIT License.
FAQs
A better `mut` helper!
The npm package ember-set-helper receives a total of 23,892 weekly downloads. As such, ember-set-helper popularity was classified as popular.
We found that ember-set-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.