\begin{quote}
Get, set, or delete a property from a nested object using a dot path \end{quote}
\hypertarget{md_sfcode_node_modules_dot_prop_readme_autotoc_md8274}{}\doxysection{Install}\label{md_sfcode_node_modules_dot_prop_readme_autotoc_md8274}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install dot-\/prop }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_dot_prop_readme_autotoc_md8275}{}\doxysection{Usage}\label{md_sfcode_node_modules_dot_prop_readme_autotoc_md8275}

\begin{DoxyCode}{0}
\DoxyCodeLine{const dotProp = require('dot-\/prop');}
\DoxyCodeLine{}
\DoxyCodeLine{// Getter}
\DoxyCodeLine{dotProp.get(\{foo: \{bar: 'unicorn'\}\}, 'foo.bar');}
\DoxyCodeLine{//=> 'unicorn'}
\DoxyCodeLine{}
\DoxyCodeLine{dotProp.get(\{foo: \{bar: 'a'\}\}, 'foo.notDefined.deep');}
\DoxyCodeLine{//=> undefined}
\DoxyCodeLine{}
\DoxyCodeLine{dotProp.get(\{foo: \{bar: 'a'\}\}, 'foo.notDefined.deep', 'default value');}
\DoxyCodeLine{//=> 'default value'}
\DoxyCodeLine{}
\DoxyCodeLine{dotProp.get(\{foo: \{'dot.dot': 'unicorn'\}\}, 'foo.dot\(\backslash\)\(\backslash\).dot');}
\DoxyCodeLine{//=> 'unicorn'}
\DoxyCodeLine{}
\DoxyCodeLine{// Setter}
\DoxyCodeLine{const object = \{foo: \{bar: 'a'\}\};}
\DoxyCodeLine{dotProp.set(object, 'foo.bar', 'b');}
\DoxyCodeLine{console.log(object);}
\DoxyCodeLine{//=> \{foo: \{bar: 'b'\}\}}
\DoxyCodeLine{}
\DoxyCodeLine{const foo = dotProp.set(\{\}, 'foo.bar', 'c');}
\DoxyCodeLine{console.log(foo);}
\DoxyCodeLine{//=> \{foo: \{bar: 'c'\}\}}
\DoxyCodeLine{}
\DoxyCodeLine{dotProp.set(object, 'foo.baz', 'x');}
\DoxyCodeLine{console.log(object);}
\DoxyCodeLine{//=> \{foo: \{bar: 'b', baz: 'x'\}\}}
\DoxyCodeLine{}
\DoxyCodeLine{// Has}
\DoxyCodeLine{dotProp.has(\{foo: \{bar: 'unicorn'\}\}, 'foo.bar');}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{// Deleter}
\DoxyCodeLine{const object = \{foo: \{bar: 'a'\}\};}
\DoxyCodeLine{dotProp.delete(object, 'foo.bar');}
\DoxyCodeLine{console.log(object);}
\DoxyCodeLine{//=> \{foo: \{\}\}}
\DoxyCodeLine{}
\DoxyCodeLine{object.foo.bar = \{x: 'y', y: 'x'\};}
\DoxyCodeLine{dotProp.delete(object, 'foo.bar.x');}
\DoxyCodeLine{console.log(object);}
\DoxyCodeLine{//=> \{foo: \{bar: \{y: 'x'\}\}\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_dot_prop_readme_autotoc_md8276}{}\doxysection{API}\label{md_sfcode_node_modules_dot_prop_readme_autotoc_md8276}
\hypertarget{md_sfcode_node_modules_dot_prop_readme_autotoc_md8277}{}\doxysubsection{get(object, path, default\+Value?)}\label{md_sfcode_node_modules_dot_prop_readme_autotoc_md8277}
\hypertarget{md_sfcode_node_modules_dot_prop_readme_autotoc_md8278}{}\doxysubsection{set(object, path, value)}\label{md_sfcode_node_modules_dot_prop_readme_autotoc_md8278}
Returns the object.\hypertarget{md_sfcode_node_modules_dot_prop_readme_autotoc_md8279}{}\doxysubsection{has(object, path)}\label{md_sfcode_node_modules_dot_prop_readme_autotoc_md8279}
\hypertarget{md_sfcode_node_modules_dot_prop_readme_autotoc_md8280}{}\doxysubsection{delete(object, path)}\label{md_sfcode_node_modules_dot_prop_readme_autotoc_md8280}
Returns a boolean of whether the property existed before being deleted.\hypertarget{md_sfcode_node_modules_dot_prop_readme_autotoc_md8281}{}\doxysubsubsection{object}\label{md_sfcode_node_modules_dot_prop_readme_autotoc_md8281}
Type\+: {\ttfamily object}

Object to get, set, or delete the {\ttfamily path} value.

You are allowed to pass in {\ttfamily undefined} as the object to the {\ttfamily get} and {\ttfamily has} functions.\hypertarget{md_sfcode_node_modules_dot_prop_readme_autotoc_md8282}{}\doxysubsubsection{path}\label{md_sfcode_node_modules_dot_prop_readme_autotoc_md8282}
Type\+: {\ttfamily string}

Path of the property in the object, using {\ttfamily .} to separate each nested key.

Use {\ttfamily \textbackslash{}\textbackslash{}.} if you have a {\ttfamily .} in the key.

The following path components are invalid and results in {\ttfamily undefined} being returned\+: {\ttfamily \+\_\+\+\_\+proto\+\_\+\+\_\+}, {\ttfamily prototype}, {\ttfamily constructor}.\hypertarget{md_sfcode_node_modules_dot_prop_readme_autotoc_md8283}{}\doxysubsubsection{value}\label{md_sfcode_node_modules_dot_prop_readme_autotoc_md8283}
Type\+: {\ttfamily unknown}

Value to set at {\ttfamily path}.\hypertarget{md_sfcode_node_modules_dot_prop_readme_autotoc_md8284}{}\doxysubsubsection{default\+Value}\label{md_sfcode_node_modules_dot_prop_readme_autotoc_md8284}
Type\+: {\ttfamily unknown}

Default value.

\DoxyHorRuler{0}


 {\bfseries{ \href{https://tidelift.com/subscription/pkg/npm-dot-prop?utm_source=npm-dot-prop&utm_medium=referral&utm_campaign=readme}{\texttt{ Get professional support for this package with a Tidelift subscription}} }} ~\newline
 \textsubscript{ Tidelift helps make open source sustainable for maintainers while giving companies~\newline
assurances about security, maintenance, and licensing for their dependencies. }  