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.
@batuhanw/haf
Advanced tools
Fully typed, modern, cross-platform persistent config solution for NodeJS projects
Haf is a fully typed 🔒, cross-platform, persistent 💾 config ⚙️ solution for your NodeJS projects with a great developer experience!
npm i @batuhanw/haf
OR
yarn add @batuhanw/haf
interface DogSchema {
name: string;
age: number;
toys: string[];
vaccines: { name: string; date: string; nextDate?: string }[];
appearance: {
eyeColor: string;
hairColor: {
primary: string;
secondary?: string;
otherColors: string[];
};
};
sterilizedAt?: string;
hasPuppies: boolean;
}
import Haf from '@batuhanw/haf'
const haf = new Haf<DogSchema>(
{
name: 'myDog',
defaultSchema: {
name: 'Pop',
age: 2,
toys: ['socks', 'toilet paper'],
vaccines: [
{ name: 'rabbies', date: '2020-01-01' },
{ name: 'parasite', date: '2020-01-01', next: '2020-01-03' },
],
appearance: {
eyeColor: 'brown',
hairColor: {
primary: 'white',
secondary: undefined,
otherColors: ['black'],
},
},
sterilizedAt: undefined,
hasPuppies: false,
}
}
)
const name = haf.get('name') // string
const age = haf.get('age') // number
const hasPuppies = haf.get('hasPuppies') // boolean
const vaccines = haf.get('vaccines') // { name: string; date: string; nextDate?: string }[]
const hairColor: haf.get('appearance.haircolor') // { primary: string; secondary?: string, otherColors: string[] }
const secondaryHairColor: haf.get('appearance.hairColor.secondary') // string | undefined
const invalid = haf.get('non-existent') // type error
haf.set('name', 'Pop');
haf.set('appearance.hairColor', { primary: 'white' });
haf.set('appearance.hairColor.secondary', 'brown');
haf.set('appearance.hairColor.secondary', undefined);
haf.set('appearance.hairColor.otherColors', ['black']) // This will overwrite existing array
haf.set('name', 1); // type error
haf.set('toys', [1, 2]); // type error
haf.set('appearance.haircolor', { primary: 1 }); //type error
haf.set('appearance.hairColor.primary', 1); // type error
haf.set('appearance.haircolor', { notExist: 'white' }); //type error
Appends given values to the existing array
haf.get('toys') // ['socks', 'toilet paper']
haf.append('toys', 'human hand', 'bone')
haf.get('toys') // ['socks', 'toilet paper', 'human hand', 'bone']
haf.delete('sterilizedAt');
haf.delete('appearance.hairColor.secondary');
haf.delete('name'); // type error
haf.delete('appearance.hairColor.primary'); // type error
FAQs
Fully typed, modern, cross-platform persistent JSON storage solution for NodeJS projects.
The npm package @batuhanw/haf receives a total of 0 weekly downloads. As such, @batuhanw/haf popularity was classified as not popular.
We found that @batuhanw/haf 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.