Neoclassical Philosophic Musings

    @fengqiaogang/safe-get
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.1 • Public • Published

    safeGet

    一个很容易从对象中安全获取对象的工具

    $ npm install @fengqiaogang/safe-get

    
    const safeGet = require("@fengqiaogang/safe-get");
    
    const data = {
      "a": {
        "b": {
          "c": [
            null,
            {
              "d": "hello world"
            }
          ]
        }
      }
    };
    
    const value = safeGet(data, "a.b.c[1].d");
    // value = "hello world"
    

    Keywords

    Install

    npm i @fengqiaogang/safe-get

    DownloadsWeekly Downloads

    17

    Version

    0.1.1

    License

    ISC

    Unpacked Size

    2.87 kB

    Total Files

    5

    Last publish

    Collaborators

    • fengqiaogang