1.0.11 • Published 4 years ago

@eneropl/js-cookies v1.0.11

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago
npm i --save-dev @eneropl/js-cookies

To use package:

import cookies from '@eneropl/js-cookies'
const userDeail = {
  name: 'Alex',
  age: 20
};

cookies.set('user', userDetail, {
  // This cookie will be stored for 1 hour
  maxAge: 3600,
  path: '/;
}); // true

Getting the cookie value for the specified key. If the function finds a cookie with the specified key, the function will return a value, otherwise false.

// In cookie storage "name=Alex;"
cookies.get('name'); // Alex
cookies.get('someCookie'); // false

Removes the cookie for the given key. If there is access and the cookie was successfully deleted, the function will return true, otherwise false. Also, there are cases when, to delete a cookie, you need to specify additional defining cookie parameters that were specified when the cookie was created or defined in the cookie parameters (see developer console), in which case the options conditional parameter is used to explicitly indicate the cookie.

// In cookie storage "name=Alex; age=20", when age from different domain or httpOnly.
cookies.delete('name') // true. Cookie deleted successfully.
cookies.delete('age') // false. Available cookie with "age" doesn't exist to delete.
1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago