react-use-cookie
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -6,6 +6,9 @@ # useCookie Changelog | ||
## [1.1.0](https://github.com/tylerwolff/useCookie/compare/7273486214108568046772a6f7c3dc855609d2bd...24ec23bb2f92d3fe3b124cddba49213232583a84) (2020-06-17) | ||
## [v1.2.0](https://github.com/tylerwolff/useCookie/releases/tag/v1.2.0) (2020-10-05) | ||
- Added SSR support [@natterstefan](https://github.com/natterstefan) | ||
## [v1.1.0](https://github.com/tylerwolff/useCookie/compare/7273486214108568046772a6f7c3dc855609d2bd...24ec23bb2f92d3fe3b124cddba49213232583a84) (2020-06-17) | ||
### Features | ||
- Expose the `getCookie` and `setCookie` function |
@@ -22,8 +22,8 @@ // Type definitions for react-use-cookie | ||
export function getCookie(name: string, initialValue: string): string; | ||
export function getCookie(name: string, initialValue?: string): string; | ||
export default function( | ||
key: string, | ||
initialValue: string | ||
initialValue?: string | ||
): [string, updateItem]; | ||
} |
@@ -41,3 +41,4 @@ "use strict"; | ||
var getCookie = function getCookie(name, initialValue) { | ||
var getCookie = function getCookie(name) { | ||
var initialValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
return isBrowser && document.cookie.split('; ').reduce(function (r, v) { | ||
@@ -44,0 +45,0 @@ var parts = v.split('='); |
@@ -22,8 +22,8 @@ // Type definitions for react-use-cookie | ||
export function getCookie(name: string, initialValue: string): string; | ||
export function getCookie(name: string, initialValue?: string): string; | ||
export default function( | ||
key: string, | ||
initialValue: string | ||
initialValue?: string | ||
): [string, updateItem]; | ||
} |
@@ -28,3 +28,3 @@ import { useState } from 'react'; | ||
export const getCookie = (name, initialValue) => { | ||
export const getCookie = (name, initialValue = '') => { | ||
return ( | ||
@@ -31,0 +31,0 @@ (isBrowser && |
{ | ||
"name": "react-use-cookie", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "A React hook for managing cookies with no dependencies.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9189
139