![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
inspect-property
Advanced tools
Inspects a Property and returns useful informations about it (e.g. nested properties, function inspection, property descriptor, value, type, constructor)
Readme
Inspects a Property and returns useful informations about it (e.g. nested properties, function inspection, property descriptor, value, type, constructor)
npm install inspect-property
inspectProperty(o, propertyName, { delimiter = '.', inspectFunction = true, inspectProperties = true, enumerability, inherited} = {} );
o: Object || Property || Value to be inspected.
propertyName:
When passing as inspectProperty(parentObject, 'childPropertyName')
, propertyDescriptor
will be returned. Note that childPropertyName
must be a string
.
delimiter
What will be used as a delimiter for the nested properties at properties
keys. Default is ','
e.g. 'a.b.c'
inspectFunction If functions should be inspected. See inspect-function for details about the function inspection.
inspectProperties
When set to false, properties
will be a simple {key: value}
object, without any inspection. The default value is true
, returning {key: inspectProperty(value)}
.
path
An array representing the current property path. e.g. from the above example it will be [ 'a', 'b', 'c' ]
for the 'c'
property
parent
The parent object of the current property. e.g. from the above example it will be the object { c: 'cValue' }
for the 'c'
property
enumerability:
When inspecting nested properties, defines how it should look up regarding enumerability
.
The options are:
'enumerable'
(default)'nonenumerable'
'all'
inherited: Determines if it should look up on the prototype chain when inspecting nested properties. The options are:
true
(default)false
const inspectProperty = require('../');
const data = {
a: {
b: {
c: (z = 'DefaultX', k) => z+k
},
d: 3,
f: {
g: 'h'
}
}
};
const result = inspectProperty(data);
////////////
// RESULT //
////////////
// Below is a JSON.stringify(result), so functions references are ommitted
{
"value": {
"a": {
"b": {},
"d": 3,
"f": {
"g": "h"
}
}
},
"type": "object",
"constructor": {
"name": "Object"
},
"properties": {
"a": {
"value": {
"b": {},
"d": 3,
"f": {
"g": "h"
}
},
"type": "object",
"constructor": {
"name": "Object"
},
"properties": {
"b": {},
"d": 3,
"f": {
"g": "h"
},
"f.g": "h"
}
},
"a.b": {
"value": {},
"type": "object",
"constructor": {
"name": "Object"
},
"properties": {}
},
"a.b.c": {
"type": "function",
"constructor": {
"name": "Function"
},
"functionInspection": {
"name": "c",
"signature": "c(z = 'DefaultX', k);",
"parameters": [
{
"parameter": "z",
"defaultValue": "DefaultX",
"declaration": "z = 'DefaultX'"
},
{
"parameter": "k",
"declaration": "k"
}
],
"parametersNames": [
"z",
"k"
]
},
"properties": {}
},
"a.d": {
"value": 3,
"type": "number",
"constructor": {
"name": "Number"
}
},
"a.f": {
"value": {
"g": "h"
},
"type": "object",
"constructor": {
"name": "Object"
},
"properties": {
"g": "h"
}
},
"a.f.g": {
"value": "h",
"type": "string",
"constructor": {
"name": "String"
}
}
}
}
FAQs
Inspects a Property and returns useful informations about it (e.g. nested properties, function inspection, property descriptor, value, type, constructor)
The npm package inspect-property receives a total of 58,870 weekly downloads. As such, inspect-property popularity was classified as popular.
We found that inspect-property demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.