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

babel-preset-wxs

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

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.

  • 0.2.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
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

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