A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bevry/getsetdeep below:

bevry/getsetdeep: Get or set nested variables of an object



Get and set nested variables of an object, includes support for Backbone Models

Complete API Documentation.

// Import
import { setDeep, getDeep } from 'getsetdeep'

// Prepare
const obj = {
    a: {
        b: {
            c: 3,
        },
    },
}

// Get
console.log(getDeep(obj, 'a.b.c')) // 3
console.log(setDeep(obj, 'a.b.c', 4)) // 4
console.log(getDeep(obj, 'a.b.c')) // 4

To satisfy the egos of some security researchers, just as you wouldn't do obj[prompt('some user input')] = 'value' don't do setDeep(obj, prompt('some user input'), 'value'), obviously. Rather than getsetdeep preventing __proto__ access, we assume the consumers of this library are intelligent enough to do what they intend.

import * as pkg from 'https://unpkg.com/getsetdeep@^5.6.0/edition-deno/index.ts'
<script type="module">
    import * as pkg from '//cdn.skypack.dev/getsetdeep@^5.6.0'
</script>
<script type="module">
    import * as pkg from '//unpkg.com/getsetdeep@^5.6.0'
</script>
<script type="module">
    import * as pkg from '//dev.jspm.io/getsetdeep@5.6.0'
</script>

This package is published with the following editions:

Discover the release history by heading on over to the HISTORY.md file.

Discover how to contribute via the CONTRIBUTING.md file.

Unless stated otherwise all works are:

and licensed under:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4