Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@batuhanw/haf
Advanced tools
Fully typed, modern, cross-platform persistent JSON storage solution for NodeJS projects.
Haf is a fully typed 🔒, cross-platform, persistent 💾 JSON storage ⚙️ 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', nextDate: '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 healthy version release cadence and project activity because the last version was released less than 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.