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
185 stars 55 forks source link

getKeys 方法引用的 Object.names #3

Closed jsonz1993 closed 7 years ago

jsonz1993 commented 7 years ago

Object.names 你应该是想用ES6提供的 Object.keys 手误写错吧。

jaywcjlove commented 7 years ago

@jsonz1993 如果Object.names不存在,就会使用后面的方法

var getKeys = Object.names || function (obj) {
        var names = [],name = '';
        for (name in obj) {
            if (obj.hasOwnProperty(name)) names.push(name);
        }
        return names;
    }
jsonz1993 commented 7 years ago

对啊。但是 Object 应该是没有 names 这个方法的

jaywcjlove commented 7 years ago

@jsonz1993 😯是的呢,谢谢