New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tank-utils-browser

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tank-utils-browser

tank-browser

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

说明

类似于 lodash 的_.get, 链式引用出错低返回默认值; 使用回调的形式, 具有更好的可读性和代码提示

安装

npm i tank-utils / yarn add tank-utils

使用

函数签名:

/**
 * @description 链式调用,出错保护
 * @author anthhub
 * @date 2019-05-25
 * @export
 * @template T
 * @param {T} target
 * @param {(target: T) => any} fn
 * @param {*} [defaultValue=null]
 * @returns {*}
 */
function _get<T>(target: T, fn: (target: T) => any, defaultValue?: any): any;

使用方式:

import {_get} from "../dist/index";

const obj = { a: { b: "1111" } };

_get(obj, obj => obj.a.b.c.d, null);

FAQs

Package last updated on 26 May 2019

Did you know?

Socket

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.

Install

Related posts