Skip to content

Commit 7e01d80

Browse files
authored
Merge pull request #18 from firstandthird/modern
Modernized
2 parents 288a809 + 62adc20 commit 7e01d80

30 files changed

+315
-1374
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
charset = utf-8
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
8+
indent_style = space
9+
indent_size = 2

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.DS_Store
22
node_modules
3-
bower_components
4-
reports
3+
dist/
4+
test/*.dist*
5+
npm-debug.log
6+
.idea

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.2.0

.npmignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test
2+
node_modules
3+
.git

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
before_script:
2+
- 'npm run build'
3+
language: node_js
4+
node_js:
5+
- "7"

Gruntfile.js

Lines changed: 0 additions & 134 deletions
This file was deleted.

HISTORY.md

Lines changed: 0 additions & 37 deletions
This file was deleted.

LICENSE

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
(The MIT License)
21

3-
Copyright (c) 2013 Greg Allen
2+
MIT License
43

5-
Permission is hereby granted, free of charge, to any person obtaining
6-
a copy of this software and associated documentation files (the
7-
'Software'), to deal in the Software without restriction, including
8-
without limitation the rights to use, copy, modify, merge, publish,
9-
distribute, sublicense, and/or sell copies of the Software, and to
10-
permit persons to whom the Software is furnished to do so, subject to
11-
the following conditions:
4+
Copyright (c) 2016 First+Third
125

13-
The above copyright notice and this permission notice shall be
14-
included in all copies or substantial portions of the Software.
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
1512

16-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

README.md

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,51 @@
11
# Cookie Monster
2-
A javascript libary to manage cookies
32

4-
## Installation
3+
[![Build Status](https://travis-ci.org/firstandthird/cookie-monster.svg?branch=master)](https://travis-ci.org/firstandthird/cookie-monster)
54

6-
download [monster.js](https://github.com/jgallen23/cookie-monster/raw/master/dist/cookie-monster.js) from dist directory.
5+
Cookie manager
76

8-
or
7+
## Installation
98

10-
bower install cookie-monster
9+
```
10+
npm install @firstandthird/cookie-monster --save
11+
```
1112

1213
## Usage
1314

14-
monster.set(name, value, days, path); //days and path are optional, value can be json
15-
monster.get(name);
16-
monster.remove(name);
17-
monster.increment(name, days); //days optional
18-
monster.decrement(name, days); //days optional
15+
```js
16+
import CookieMonster from '@firstandthird/cookie-monster';
17+
18+
const name = 'cookiename'; // required
19+
const value = 'somevalue'; // required - may also be an object
20+
const expires = 10; // optional - Days cookie is valid
21+
const path = '/test'; // optional - defaults to /
22+
const domain = 'blog.example.com'; // optional
23+
const isSecure = false; // optional - sets secure flag
24+
25+
// Set cookie
26+
CookieMonster.set(name, value, expires, path, domain, isSecure);
27+
28+
// Get cookie
29+
CookieMonster.get(name);
30+
31+
// Remove cookie
32+
33+
CookieMonster.remove(name);
34+
35+
// Increment a counter cookie
36+
CookieMonster.increment(name, expires);
37+
38+
// Decrement a counter cookie
39+
40+
CookieMonster.decrement(name, expires);
41+
```
42+
43+
Methods can also be imported as needed:
44+
45+
```js
46+
import { get, remove } from '@firstandthird/cookie-monster';
1947

20-
## Example
48+
get(name);
2149

22-
//set a cookie named 'cookiename' to '123' for 1 day then remove it
23-
var name = 'cookiename';
24-
var value = '123';
25-
var days = 1;
26-
monster.set(name, value, days);
27-
monster.remove(name);
50+
remove(name);
51+
```

bower.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)