Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Readme
Chainable if
!
Akua
is a very useful tools! It can solve your nested if-tree
, make it become
chainable if
!
Akua
can help you code maintainable if!
npm install akua --save
normal nested if-tree
let normalIf = '';
const normailIfStart = new Date().getTime();
if (conditionA) {
const tempA = 'tempA';
normalIf += 'a';
if (conditionB) {
normalIf += 'b';
normalIf += tempA;
if (conditionC) {
normalIf += 'c';
if (conditionD) {
normalIf += 'd';
if (conditionE) {
normalIf += 'e';
}
}
}
} else {
normalIf += '!b';
}
if (conditionF) {
normalIf += 'f';
if (conditionG) {
normalIf += 'g';
}
}
} else {
normalIf += '!a';
}
akua if
let akuaIf = '';
const ifTree = new akua();
ifTree
.inject(conditionA, 'a', (obj) => {
obj.tempA = 'tempA';
akuaIf += 'a';
})
.inject(!conditionA, '!a', (obj) => {
akuaIf += '!a';
})
.inject(conditionB, 'a->b', (obj) => {
akuaIf += 'b';
akuaIf += obj.tempA;
})
.inject(!conditionB, 'a->!b', (obj) => {
akuaIf += '!b';
})
.inject(conditionC, 'b->c', () => {
akuaIf += 'c';
})
.inject(conditionD, 'c->d', () => {
akuaIf += 'd';
})
.inject(conditionE, 'd->e', () => {
akuaIf += 'e';
})
.inject(conditionF, 'a->f', () => {
akuaIf += 'f';
})
.inject(conditionG, 'f->g', () => {
akuaIf += 'g';
})
.parse();
Finally, normalIf === akuaIf
, you can git clone this project and npm run test
if you doubt!
npm run test
test: 1000, success: 1000, fail: 0
normal-if cost time: 2ms
akua-if cost time: 7ms
test: 100000, success: 100000, fail: 0
normal-if cost time: 19ms
akua-if cost time: 175ms
FAQs
make if more elegant
The npm package akua receives a total of 0 weekly downloads. As such, akua popularity was classified as not popular.
We found that akua 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.