Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

simple-const

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-const

常量定义

Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

constant

安装

npm安装

$ npm install simple-const

或者使用yarn

$ yarn add simple-const

使用

import constant, {parse} from 'simple-const'

//直接给constant赋值
constant.const_name = 'const_value';

//取值
console.log(constant.const_name);

// 不可以重复赋值
constant.const_name = 'new value'; // throw Error 'duplicate assignment'

// 不可以delete
delete constant.const_name; // false

// 不可以通过defineProperty修改
Object.defineProperty(constant, 'const_name', {
  value: 'new value'
}); // false


// 通过parse解析键值对常量
parse({
  new_const: 'new value'
});

console.log(constant.new_const); // new value

Keywords

proxy

FAQs

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