Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@ngbites/reactive-enum
Advanced tools
A tool to automatically generate a typed reactive enum with Rx
Not yet production ready.
npm i @ngbites/reactive-enum
This utility is particularly useful with framework such as Angular to automatically generate a set of reactive streams, so that you can use them in your template effortlessly.
This basically replaces using a BehaviorSubject
property followed by auxiliary
methods such as:
import { BehaviorSubject } from 'rxjs';
class MyComponent {
private readonly status$ = new BehaviorSubject<Status>(Status.Initial);
private readonly initial$ = this.status$.pipe(map(status => status ===
Status.Initial));
private readonly pending$ = this.status$.pipe(map(status => status ===
Status.Pending));
}
// declare an enum
enum Status {
Initial,
Pending,
Success,
Error
}
// pass your enum to "reactiveEnum"
const status = reactiveEnum(Status);
// "status" has now autmatically generated a method for each value of the enum
status.initial$.subscribe(); // false ... // true
status.pending$.subscribe(); // false
status.success$.subscribe(); // false
status.error$.subscribe(); // false
status.set(Status.Initial);
const status = reactiveEnum(Status, {
initialValue: Status.Initial,
});
status.value$.subscribe(console.log); // Status.Initial
const status = reactiveEnum(Status);
status.value$.subscribe(console.log); // Status.Success
status.set(Status.Success);
const status = reactiveEnum(Status, {
initialValue: Status.Initial
});
status.value$.subscribe(console.log);
// 1. Status.Initial
// 2. Status.Success
// 3. Status.Initial
status.set(Status.Success);
status.reset();
FAQs
A tool to automatically generate a typed reactive enum with Rx
The npm package @ngbites/reactive-enum receives a total of 83 weekly downloads. As such, @ngbites/reactive-enum popularity was classified as not popular.
We found that @ngbites/reactive-enum 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.