Skip to content

Commit

Permalink
Merge 8e0be42 into 853ae41
Browse files Browse the repository at this point in the history
  • Loading branch information
papandreou committed Feb 9, 2019
2 parents 853ae41 + 8e0be42 commit dc2a659
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## Features

- Simple API
- Ultra-light (**409 bytes** gzipped)
- Ultra-light (**414 bytes** gzipped)
- Encoding of forbidden characters
- Use as a [module](#module) or add to your [browser](#browser)

Expand Down
16 changes: 16 additions & 0 deletions __tests__/hardtack.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ describe('set', () => {
expect(hardtack.set('name', user.name)).toBe(`name=${user.name}`);
});

test('set with false flag', () => {
expect(
hardtack.set('name', user.name, {
secure: false,
})
).toBe(`name=${user.name}`);
});

test('set with undefined flag', () => {
expect(
hardtack.set('name', user.name, {
secure: undefined,
})
).toBe(`name=${user.name}`);
});

test('set with iterable options', () => {
expect(
hardtack.set('name', user.name, {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hardtack",
"description": "An ultra-light (409 bytes) library for working with cookies in JavaScript",
"description": "An ultra-light (414 bytes) library for working with cookies in JavaScript",
"version": "4.0.1",
"main": "dist/hardtack.cjs.js",
"module": "dist/hardtack.esm.js",
Expand All @@ -20,7 +20,7 @@
"size-limit": [
{
"path": "dist/hardtack.min.js",
"limit": "409 B",
"limit": "414 B",
"webpack": false
}
],
Expand Down
3 changes: 3 additions & 0 deletions src/hardtack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export default {
.map(optionName => {
const optionValue = options[optionName];

if (!optionValue) {
return '';
}
if (optionValue === true) {
return `;${optionName}`;
}
Expand Down

0 comments on commit dc2a659

Please sign in to comment.