Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tiny-cookie

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-cookie - npm Package Compare versions

Comparing version 2.1.2 to 2.2.0

types/index.d.ts

21

CHANGELOG.md

@@ -1,8 +0,19 @@

### v2.0.2
### v2.2.0
2017-11-19
- **Feature**: Add typescript types.
- **Document**: Add Chinese document.
### v2.1.2
- **Fix**: Fix `es` directory missing bug #22.
### v2.1.1
- **Fix**: Fix bug when passing options as the third parameter to set method the encoder is null #18.
### v2.1.0
- **Feature**: The `remove()` method supports configuring the domain parameter.
2017-08-21
### v2.0.2

@@ -13,4 +24,2 @@ - **Fix**: Fix the es modules build [#16](https://github.com/Alex1990/tiny-cookie/issues/16)

2017-07-12
- **Fix**: Fix the "main" entry in package.json [#13](https://github.com/Alex1990/tiny-cookie/issues/13)

@@ -22,4 +31,2 @@

2017-07-06
- **Breaking change**: Do not support the `Cookie` as a function.

@@ -26,0 +33,0 @@ - **Breaking change**: There is not a default export. That is, `import cookie from 'tiny-cookie` doesn't work. The reason why it hasn't a default export is it will prevent the webpack tree-shaking working. You can do it like this `import * as cookie from 'tiny-cookie'`.[#14](https://github.com/Alex1990/tiny-cookie/issues/14)

@@ -136,11 +136,11 @@ (function (global, factory) {

var encoder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : encodeURIComponent;
var attrs = arguments[3];
var options = arguments[3];
if ((typeof encoder === 'undefined' ? 'undefined' : _typeof(encoder)) === 'object' && encoder !== null) {
/* eslint-disable no-param-reassign */
attrs = encoder;
options = encoder;
encoder = encodeURIComponent;
/* eslint-enable no-param-reassign */
}
var attrsStr = convert(attrs || {});
var attrsStr = convert(options || {});
var valueStr = typeof encoder === 'function' ? encoder(value) : value;

@@ -168,4 +168,4 @@ var newCookie = key + '=' + valueStr + attrsStr;

// Set a cookie without encoding the value.
function setRaw(key, value, opts) {
return set(key, value, null, opts);
function setRaw(key, value, options) {
return set(key, value, null, options);
}

@@ -172,0 +172,0 @@

@@ -61,11 +61,11 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var encoder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : encodeURIComponent;
var attrs = arguments[3];
var options = arguments[3];
if ((typeof encoder === 'undefined' ? 'undefined' : _typeof(encoder)) === 'object' && encoder !== null) {
/* eslint-disable no-param-reassign */
attrs = encoder;
options = encoder;
encoder = encodeURIComponent;
/* eslint-enable no-param-reassign */
}
var attrsStr = convert(attrs || {});
var attrsStr = convert(options || {});
var valueStr = typeof encoder === 'function' ? encoder(value) : value;

@@ -93,6 +93,6 @@ var newCookie = key + '=' + valueStr + attrsStr;

// Set a cookie without encoding the value.
function setRaw(key, value, opts) {
return set(key, value, null, opts);
function setRaw(key, value, options) {
return set(key, value, null, options);
}
export { isEnabled, get, getAll, set, getRaw, setRaw, remove, isEnabled as isCookieEnabled, get as getCookie, getAll as getAllCookies, set as setCookie, getRaw as getRawCookie, setRaw as setRawCookie, remove as removeCookie };

@@ -66,11 +66,11 @@ 'use strict';

var encoder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : encodeURIComponent;
var attrs = arguments[3];
var options = arguments[3];
if ((typeof encoder === 'undefined' ? 'undefined' : _typeof(encoder)) === 'object' && encoder !== null) {
/* eslint-disable no-param-reassign */
attrs = encoder;
options = encoder;
encoder = encodeURIComponent;
/* eslint-enable no-param-reassign */
}
var attrsStr = (0, _util.convert)(attrs || {});
var attrsStr = (0, _util.convert)(options || {});
var valueStr = typeof encoder === 'function' ? encoder(value) : value;

@@ -98,4 +98,4 @@ var newCookie = key + '=' + valueStr + attrsStr;

// Set a cookie without encoding the value.
function setRaw(key, value, opts) {
return set(key, value, null, opts);
function setRaw(key, value, options) {
return set(key, value, null, options);
}

@@ -102,0 +102,0 @@

{
"name": "tiny-cookie",
"version": "2.1.2",
"version": "2.2.0",
"description": "A tiny cookie manipulation plugin",

@@ -8,2 +8,3 @@ "main": "lib/index.js",

"jsnext:main": "es/index.js",
"typings": "types/index.d.ts",
"files": [

@@ -13,3 +14,4 @@ "dist",

"es",
"src"
"src",
"types"
],

@@ -16,0 +18,0 @@ "scripts": {

@@ -8,2 +8,4 @@ # tiny-cookie

**English | [简体中文](README_zh-CN.md)**
A tiny cookie manipulation plugin for browser.

@@ -13,3 +15,3 @@

## Packages
## Install

@@ -69,3 +71,3 @@ **NPM:**

Set a cookie with encoding the value, using `encodeURIComponent`. The `options` parameter is an object. And its property can be a valid cookie option, such as `path`(default: root path `/`), `domain`, `expires`/`max-age`, `SameSite` or `secure` (Note: the `secure` flag will be set if it is an truthy value, such as `true`, or it will be not set). For example, you can set the expiration:
Set a cookie with encoding the value, using `encodeURIComponent`. The `options` parameter is an object. And its property can be a valid cookie option, such as `path`(default: root path `/`), `domain`, `expires`/`max-age`, `samesite` or `secure` (Note: the `secure` flag will be set if it is an truthy value, such as `true`, or it will be not set). For example, you can set the expiration:

@@ -72,0 +74,0 @@ ```js

@@ -53,10 +53,10 @@ import { escapeRe, convert } from './util';

// Set a cookie.
function set(key, value, encoder = encodeURIComponent, attrs) {
function set(key, value, encoder = encodeURIComponent, options) {
if (typeof encoder === 'object' && encoder !== null) {
/* eslint-disable no-param-reassign */
attrs = encoder;
options = encoder;
encoder = encodeURIComponent;
/* eslint-enable no-param-reassign */
}
const attrsStr = convert(attrs || {});
const attrsStr = convert(options || {});
const valueStr = typeof encoder === 'function' ? encoder(value) : value;

@@ -84,4 +84,4 @@ const newCookie = `${key}=${valueStr}${attrsStr}`;

// Set a cookie without encoding the value.
function setRaw(key, value, opts) {
return set(key, value, null, opts);
function setRaw(key, value, options) {
return set(key, value, null, options);
}

@@ -88,0 +88,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc