1.1.2 • Published 6 years ago

js-to-beautify v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

js-to-beautify

npm

npm star npm.io

格式化js代码

Install npm i js-to-beautify(安装)

$ npm install js-to-beautify --save

Use (如何引入)

/**
 * Created by shangri-la on 25/07/2018.
 * You are free to use this in any way you want, in case you find this useful or working for you.
 *
 * Usage:
 * js_source_text   :  需要格式化的内容
 * indent_size      :  默认是4个缩进,
 * indent_character :  默认是 " "
 * indent_level     :  代码距离左侧的距离 默认是 0
 *
 * jsToBeautify(js_source_text,[indent_size, indent_character, indent_level]);
 */
Script tag
   //  引入jsToBeautify.js
   <script src="node_modules/js-to-beautify/src/jsToBeautify.js"></script>
Babel

Babel is a next generation JavaScript compiler. One of the features is the ability to use ES6/ES2015 modules now, even though browsers do not yet support this feature natively.

  import jsToBeautify from "js-to-beautify";
Browserify/Webpack

There are several ways to use Browserify and Webpack. For more information on using these tools, please refer to the corresponding project's documention. In the script, including jQuery will usually look like this...

  var jsToBeautify = require("js-to-beautify");
  var jtb = jsToBeautify(js_source_text,[indent_size, indent_character, indent_level]); // []里是可选项可以不写
  console.log(jtb) // 格式好的数据

[indent_size, indent_character, indent_level]里是可选项可以不写

Collaborators(合作者)

Licence (证书)

Copyright (c) 2017 Shangri-la

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago