Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@molejs/global-helper

Package Overview
Dependencies
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@molejs/global-helper

``` /** * 获取BSGlobal中值 */ getBSGlobal(key: string, defaultV?: any) { return BSGlobal[key] || defaultV; }, /** * 获取租户信息 */ getTenantInfo(key?: string) { return this.getBSGlobal(key || 'tenantInfo'); }, /** * 获取用户信息 */

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

标准BSGlobal 操作API

 /**
   * 获取BSGlobal中值
   */
  getBSGlobal(key: string, defaultV?: any) {
    return BSGlobal[key] || defaultV;
  },
  /**
   * 获取租户信息
   */
  getTenantInfo(key?: string) {
    return this.getBSGlobal(key || 'tenantInfo');
  },
  /**
   * 获取用户信息
   */
  getUserInfo(key?: string): any {
    return this.getBSGlobal(key || 'loginUserInfo');
  },
  /**
   * 获取用户Id
   */
  getUserId() {
    const user = this.getUserInfo()
    return user.Id || user.UserId || user.id;
  },
  /**
   * 用户租户Id
   */
  getTenantId() {
    const tenant = this.getTenantInfo();
    return tenant.Id || tenant.tenant_id || tenant.tenantId;
  },
  /**
   * 获取环境标识
   */
  getEnv() {
    const env = this.getBSGlobal('env');
    return {
      get isProduction() {
        return  /production/ig.test(env);
      },
      get isDevelopment() {
        return /development/ig.test(env) || /develop/ig.test(env);
      },
      get isTesting() {
        return /test/ig.test(env) 
      }
    };
  },
  // 获取协议
  getProtocol() {
    return window.location.protocol;
  },

FAQs

Package last updated on 05 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc