Socket
Socket
Sign inDemoInstall

babel-preset-wxs

Package Overview
Dependencies
53
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-preset-wxs

Babel plugin for [wxs](https://developers.weixin.qq.com/miniprogram/dev/framework/view/wxs/) environment.


Version published
Weekly downloads
2
Maintainers
1
Install size
2.63 MB
Created
Weekly downloads
 

Readme

Source

babel-plugin-transform-wxs

Babel plugin for wxs environment.

Example

Normalize variable name

In

var $var = val;

Out

var _var = val;

Transform constructors

In

new Date(timestamp)
new RegExp('pattern', 'i')

Out

getDate(timestamp)
getRegExp('pattern', 'i')

Inject exports automatically

In

exports.value = val;

Out

var exports = module.exports;

exports.value = val;

Normalize for statements

In

for (var i = 0, ii = array.length; i < ii; i++) {
  // body
}

Out

var i = 0, ii = array.length;
for (; i < ii; i++) {
  // body
}

Transform instanceof

In

value instanceof Function
value instanceof Array
value instanceof Date
value instanceof RegExp

Out

value && value.constructor === 'Function'
value && value.constructor === 'Array'
value && value.constructor === 'Date'
value && value.constructor === 'RegExp'

Transform Array.isArray call

In

Array.isArray(value)

Out

value && value.constructor === 'Array'

Transform regexp

In

regex1 = /pattern/
regex2 = /pattern/i

Out

regex1 = getRegExp('pattern')
regex2 = getRegExp('pattern', 'i')

FAQs

Last updated on 22 May 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc