
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
ember-option
Advanced tools
Ever wanted to use Options in ember, well this addon gives you exactly that ability. Say goodbye to null checking your data, and hello to monadic composition.
Simply import this addon, and it will add getAsOption('key') to the Ember.Object class.
const Obj = Ember.Object.extend({
foo: 'foo',
bar: 'bar',
baz: 'baz',
/**
* @returns {null|string}
*/
someFunction() {
const foo = this.get('foo');
const bar = this.get('bar');
const baz = this.get('baz');
const qux = '';
if (foo !== null && bar !== null && this.get('baz'){
qux = foo + bar + baz;
}
return qux;
}
});
Obj.create({
foo: 'foo',
bar: 'bar',
baz: 'baz',
}).someFunction() // returns a string
Obj.create({
foo: null,
bar: null,
baz: null,
}).someFunction() // likely returns a NPE
The above code encourages propgation of nulls, which can lead to all kinds of trouble.
// using options (I'd kill for a for comprehension)
Ember.Object.extend({
foo: 'foo',
bar: 'bar',
baz: 'baz',
/**
* @returns {Option.<string>}
*/
someFunction() {
return this.getAsOption('foo')
.flatMap(foo =>
this.getAsOption('bar')
.flatMap(bar =>
this.getAsOption('baz').map(baz => foo + bar + baz)
)
)
}
});
let maybeString Obj.create({
foo: 'foo',
bar: 'bar',
baz: 'baz',
}).someFunction(); // returns Option.<string>
maybeString.valueOrElse('foo') // foobarbaz
let maybeString2 = Obj.create({
foo: null,
bar: null,
baz: null,
}).someFunction() // None
maybeString2.valueOrElse('something went wrong') // something went wrong
FAQs
An Ember Addon to allow for the use of the Option Data type
The npm package ember-option receives a total of 0 weekly downloads. As such, ember-option popularity was classified as not popular.
We found that ember-option 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.