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

0.1.4 • Public • Published

safeGet

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

$ npm install @fengqiaogang/safe-get@latest


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"

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.4
    0
    • latest

Version History

Package Sidebar

Install

npm i @fengqiaogang/safe-get

Weekly Downloads

0

Version

0.1.4

License

ISC

Unpacked Size

6.09 kB

Total Files

6

Last publish

Collaborators

  • fengqiaogang