\href{https://travis-ci.org/es-shims/Object.getOwnPropertyDescriptors}{\texttt{ }} \href{https://david-dm.org/es-shims/object.getownpropertydescriptors}{\texttt{ }} \href{https://david-dm.org/es-shims/object.getownpropertydescriptors\#info=devDependencies}{\texttt{ }} \mbox{[}\mbox{]}\mbox{[}license-\/url\mbox{]} \href{http://npm-stat.com/charts.html?package=object.getownpropertydescriptors}{\texttt{ }}

\href{https://npmjs.org/package/object.getownpropertydescriptors}{\texttt{ }}

An ES2017 spec-\/compliant shim for {\ttfamily Object.\+get\+Own\+Property\+Descriptors} that works in ES5. Invoke its \char`\"{}shim\char`\"{} method to shim {\ttfamily Object.\+get\+Own\+Property\+Descriptors} if it is unavailable, and if {\ttfamily Object.\+get\+Own\+Property\+Descriptor} is available.

This package implements the \href{https://github.com/es-shims/api}{\texttt{ es-\/shim API}} interface. It works in an ES3-\/supported environment and complies with the \href{https://github.com/tc39/ecma262/pull/582}{\texttt{ spec}}.\hypertarget{md_sfcode_node_modules_object_getownpropertydescriptors_README_autotoc_md18967}{}\doxysection{Example}\label{md_sfcode_node_modules_object_getownpropertydescriptors_README_autotoc_md18967}

\begin{DoxyCode}{0}
\DoxyCodeLine{var getDescriptors = require('object.getownpropertydescriptors');}
\DoxyCodeLine{var assert = require('assert');}
\DoxyCodeLine{var obj = \{ normal: Infinity \};}
\DoxyCodeLine{var enumDescriptor = \{}
\DoxyCodeLine{    enumerable: false,}
\DoxyCodeLine{    writable: false,}
\DoxyCodeLine{    configurable: true,}
\DoxyCodeLine{    value: true}
\DoxyCodeLine{\};}
\DoxyCodeLine{var writableDescriptor = \{}
\DoxyCodeLine{    enumerable: true,}
\DoxyCodeLine{    writable: true,}
\DoxyCodeLine{    configurable: true,}
\DoxyCodeLine{    value: 42}
\DoxyCodeLine{\};}
\DoxyCodeLine{var symbol = Symbol();}
\DoxyCodeLine{var symDescriptor = \{}
\DoxyCodeLine{    enumerable: true,}
\DoxyCodeLine{    writable: true,}
\DoxyCodeLine{    configurable: false,}
\DoxyCodeLine{    value: [symbol]}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{Object.defineProperty(obj, 'enumerable', enumDescriptor);}
\DoxyCodeLine{Object.defineProperty(obj, 'writable', writableDescriptor);}
\DoxyCodeLine{Object.defineProperty(obj, 'symbol', symDescriptor);}
\DoxyCodeLine{}
\DoxyCodeLine{var descriptors = getDescriptors(obj);}
\DoxyCodeLine{}
\DoxyCodeLine{assert.deepEqual(descriptors, \{}
\DoxyCodeLine{    normal: \{}
\DoxyCodeLine{        enumerable: true,}
\DoxyCodeLine{        writable: true,}
\DoxyCodeLine{        configurable: true,}
\DoxyCodeLine{        value: Infinity}
\DoxyCodeLine{    \},}
\DoxyCodeLine{    enumerable: enumDescriptor,}
\DoxyCodeLine{    writable: writableDescriptor,}
\DoxyCodeLine{    symbol: symDescriptor}
\DoxyCodeLine{\}); }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{var getDescriptors = require('object.getownpropertydescriptors');}
\DoxyCodeLine{var assert = require('assert');}
\DoxyCodeLine{/* when Object.getOwnPropertyDescriptors is not present */}
\DoxyCodeLine{delete Object.getOwnPropertyDescriptors;}
\DoxyCodeLine{var shimmedDescriptors = getDescriptors.shim();}
\DoxyCodeLine{assert.equal(shimmedDescriptors, getDescriptors);}
\DoxyCodeLine{assert.deepEqual(shimmedDescriptors(obj), getDescriptors(obj)); }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{var getDescriptors = require('object.getownpropertydescriptors');}
\DoxyCodeLine{var assert = require('assert');}
\DoxyCodeLine{/* when Object.getOwnPropertyDescriptors is present */}
\DoxyCodeLine{var shimmedDescriptors = getDescriptors.shim();}
\DoxyCodeLine{assert.notEqual(shimmedDescriptors, getDescriptors);}
\DoxyCodeLine{assert.deepEqual(shimmedDescriptors(obj), getDescriptors(obj)); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_object_getownpropertydescriptors_README_autotoc_md18968}{}\doxysection{Tests}\label{md_sfcode_node_modules_object_getownpropertydescriptors_README_autotoc_md18968}
Simply clone the repo, {\ttfamily npm install}, and run {\ttfamily npm test} 