jaywcjlove / cookie.js

:cookie: A simple, lightweight JavaScript API for handling browser cookies , it is easy to pick up and use, has a reasonable footprint(~2kb, gzipped: 0.95kb), and has no dependencies. It should not interfere with any JavaScript libraries or frameworks. https://jaywcjlove.github.io/cookie.js/
https://jaywcjlove.github.io/cookie.js
184 stars 55 forks source link

cookie("test",null)错误 #1

Closed Marinerer closed 8 years ago

Marinerer commented 8 years ago
cookie("test",null)         //删除cookie test

这句应该是执行了 cookie.clear() ,删除所有吧

var cookie = function(name, value, options) {
        var argm = arguments;
        if (argm.length === 0) return Cookie().clear();
        if (argm.length === 2 && !value) return Cookie().clear(name);
        if (typeof name == "string" && !value) return Cookie().get(name);
        if (isPlainObject(name) || argm.length > 1 && name && value) return Cookie().set(name, value, options);
        if (value === null) return Cookie().remove(name);
        return Cookie().all();
    };

还有

cookie("test","tank",1800)  //设置 cookie 的值,生存时间半个小时

这个也有问题

jaywcjlove commented 8 years ago

@mengqing723

cookie("test",null)

这个方法确实有问题。已经修复了。下载新版本 cookiejs@1.0.10

cookie("test","tank",1800)  //设置 cookie 的值,生存时间半个小时

这个是完全是文档错误,我代码里面是以天为单位,下面有,上面的没有改过来。已经修正了。