Path: csiph.com!.POSTED.204-73-239-109.cust.centrio.cz!not-for-mail From: Cezary Tomczyk Newsgroups: comp.lang.javascript Subject: Object.defineProperties Date: Wed, 3 May 2017 08:36:47 +0200 Organization: csiph.com Internet News Service Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 3 May 2017 06:36:48 +0000 (UTC) Injection-Info: csiph.com; posting-host="204-73-239-109.cust.centrio.cz:109.239.73.204"; logging-data="71713"; mail-complaints-to="admin@kev009.com" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 X-Mozilla-News-Host: news://nntpswitch.blueworldhosting.com:119 Xref: csiph.com comp.lang.javascript:33169 "The Object.defineProperties() method defines new or modifies existing properties directly on an object, returning the object." https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties However, in the polyfill https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties#Polyfill I see: if (typeof obj !== 'object' || obj === null) throw new TypeError('bad obj'); I think here it should be check for null and all primitive types https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures Native built-in Object.defineProperties method allows me to add properties to a function as the function is an object. Am I thinking correctly that mentioned polyfill has a bug? -- Cezary Tomczyk http://www.ctomczyk.pl/ https://www.aslint.org/ - Accessibility validation tool