
Security News
Meet Socket at Black Hat Europe and BSides London 2025
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.
Get rid of if statements in your code by using convenient api
npm install ifless
or
yarn add ifless
import Ifless from 'ifless';
const ifless = new Ifless();
const result = ifless
.when(() => false, 'foo')
.when(() => true, 'bar)
.result;
console.log(result); // bar
import {IflessNumber} from 'ifless';
const iflessNumber = new IflessNumber(12);
const result = iflessNumber.whenLt(7, 'bar').whenGt(10, 'baz').result;
console.log(result); // baz
import {IflessString} from 'ifless';
const iflessString = new IflessString('O. Henry - The Remnants of the Code');
const result = iflessString
.whenStartsWith('Mark Twain', 'Author is Mark Twain')
.whenStartsWith('O. Henry', 'Author is O. Henry')
.whenStartsWith('Ernest Hemingway', 'Author is Ernest Hemingway').result;
console.log(result); // Author is O. Henry
// Reset previously performed conditions
// and run another ones without creating a new instance
const result2 = iflessString
.reset()
.whenEndsWith('Parade', 'Ends with "Parade"')
.whenEndsWith('Code', 'Ends with "Code"')
.whenEndsWith('Unfulfilment', 'Ends with "Unfulfilment"').result;
console.log(result2); // Ends with "Code"
import {IflessObject} from 'ifless';
const iflessString = new IflessObject({foo: 'bar'});
const result = iflessString
.when(source => source.foo === 'qux', 'foo is qux')
.when(source => source.foo === 'bar', 'foo is bar')
.when(source => source.foo === 'corge', 'foo is corge').result;
console.log(result); // foo is bar
MIT © Rushan Alyautdinov
FAQs
Get rid of if statements in your code by using convenient api
The npm package ifless receives a total of 1 weekly downloads. As such, ifless popularity was classified as not popular.
We found that ifless 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
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.