A lightweight browser cookie library for frontend applications
Library also supports special characters encoding
npm install @dbpkgs/cookieor
yarn add @dbpkgs/cookie
importcookiefrom'@dbpkgs/cookie';cookie.set('COOKIE_NAME','COOKIE_VALUE',options);//options are optional, check below for acceptable options{expires?: Date
path?: string
domain?: string
secure?: boolean}importcookiefrom'@dbpkgs/cookie';cookie.get('COOKIE_NAME');importcookiefrom'@dbpkgs/cookie';cookie.remove('COOKIE_NAME');importcookiefrom'@dbpkgs/cookie';cookie.set('session','Uxc70_67gGuHHvAmTy10a',{expires: newDate(2022,03,13),path: '',secure: true,});At the moment the library is being tested with jest unit testing library
importcookiefrom'@dbpkgs/cookie';test('Check if cookie is set to browser properly',()=>{expect(cookie.set('test_session','Ab7MNgGyql89hpPalIdgql01gTjkaGb5')).toBe('test_session=Ab7MNgGyql89hpPalIdgql01gTjkaGb5',);});MIT