get-props
gets exactly those property names that you need
Install
npm i get-props
Usage
const getProps = ; ;
obj - object whose properties you want to receive
options - object with following fields:
-
enums (Boolean, default:
true
) - iffalse
only enumerable properties ofobj
will found. -
protos (Boolean, default:
false
) - iftrue
properties of objects (but not classes) in prototype chain ofobj
will found too. -
symbols (Boolean, default:
false
) - iftrue
properties ofobj
with symbol key will found too.
Returns array of property names.
Example
const s = Symbol;const o1 = {};o1s = 1; const o2 = {};Reflect; const F = {thisfield = 1};FprototypestaticField = 1;const o3 = ; Reflect;Reflect; console;//[Symbol(""), "notEnum", "field"] console;//[]
License
MIT