escape_javascript
Advanced tools
+29
| # escape_javascript.js | ||
| # Getting Started | ||
| ## Installation | ||
| ``` | ||
| npm install escape_javascript | ||
| ``` | ||
| - ES6 Module | ||
| ``` | ||
| import escape_javascript from 'escape_javascript'; | ||
| ``` | ||
| - Or Just copy it from the dist/escape_javascript.js | ||
| ``` | ||
| <script src='escape/dist/escape_javascript.js'></script> | ||
| //This would create window.escape_javascript method . | ||
| ``` | ||
| ## Usage | ||
| ``` | ||
| escape_javascript('<'); | ||
| ``` |
@@ -1,1 +0,95 @@ | ||
| !function(t){var r={};function e(n){if(r[n])return r[n].exports;var u=r[n]={i:n,l:!1,exports:{}};return t[n].call(u.exports,u,u.exports,e),u.l=!0,u.exports}e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=1)}([function(t,r,e){"use strict";r.a=((t="")=>{if(!t)return"";var r={lt:"<",gt:">",nbsp:" ",amp:"&",quot:'"'};return t.replace(/&(lt|gt|nbsp|amp|quot);/gi,function(t,e){return r[e]})})},function(t,r,e){"use strict";e.r(r);var n=e(0);window.escape_javascript=n.a}]); | ||
| /******/ (function(modules) { // webpackBootstrap | ||
| /******/ // The module cache | ||
| /******/ var installedModules = {}; | ||
| /******/ | ||
| /******/ // The require function | ||
| /******/ function __webpack_require__(moduleId) { | ||
| /******/ | ||
| /******/ // Check if module is in cache | ||
| /******/ if(installedModules[moduleId]) { | ||
| /******/ return installedModules[moduleId].exports; | ||
| /******/ } | ||
| /******/ // Create a new module (and put it into the cache) | ||
| /******/ var module = installedModules[moduleId] = { | ||
| /******/ i: moduleId, | ||
| /******/ l: false, | ||
| /******/ exports: {} | ||
| /******/ }; | ||
| /******/ | ||
| /******/ // Execute the module function | ||
| /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
| /******/ | ||
| /******/ // Flag the module as loaded | ||
| /******/ module.l = true; | ||
| /******/ | ||
| /******/ // Return the exports of the module | ||
| /******/ return module.exports; | ||
| /******/ } | ||
| /******/ | ||
| /******/ | ||
| /******/ // expose the modules object (__webpack_modules__) | ||
| /******/ __webpack_require__.m = modules; | ||
| /******/ | ||
| /******/ // expose the module cache | ||
| /******/ __webpack_require__.c = installedModules; | ||
| /******/ | ||
| /******/ // define getter function for harmony exports | ||
| /******/ __webpack_require__.d = function(exports, name, getter) { | ||
| /******/ if(!__webpack_require__.o(exports, name)) { | ||
| /******/ Object.defineProperty(exports, name, { | ||
| /******/ configurable: false, | ||
| /******/ enumerable: true, | ||
| /******/ get: getter | ||
| /******/ }); | ||
| /******/ } | ||
| /******/ }; | ||
| /******/ | ||
| /******/ // getDefaultExport function for compatibility with non-harmony modules | ||
| /******/ __webpack_require__.n = function(module) { | ||
| /******/ var getter = module && module.__esModule ? | ||
| /******/ function getDefault() { return module['default']; } : | ||
| /******/ function getModuleExports() { return module; }; | ||
| /******/ __webpack_require__.d(getter, 'a', getter); | ||
| /******/ return getter; | ||
| /******/ }; | ||
| /******/ | ||
| /******/ // Object.prototype.hasOwnProperty.call | ||
| /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
| /******/ | ||
| /******/ // __webpack_public_path__ | ||
| /******/ __webpack_require__.p = ""; | ||
| /******/ | ||
| /******/ // Load entry module and return exports | ||
| /******/ return __webpack_require__(__webpack_require__.s = 0); | ||
| /******/ }) | ||
| /************************************************************************/ | ||
| /******/ ([ | ||
| /* 0 */ | ||
| /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
| "use strict"; | ||
| Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | ||
| /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__index__ = __webpack_require__(1); | ||
| window.escape_javascript = __WEBPACK_IMPORTED_MODULE_0__index__["a" /* default */]; | ||
| /***/ }), | ||
| /* 1 */ | ||
| /***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
| "use strict"; | ||
| const escape_javascript = (str='') => { | ||
| if(!str){ | ||
| return ''; | ||
| } | ||
| var arrEntities = {'lt': '<', 'gt': '>', 'nbsp': ' ', 'amp': '&', 'quot': '"'}; | ||
| return str.replace(/&(lt|gt|nbsp|amp|quot);/ig, function (all, t) { | ||
| return arrEntities[t]; | ||
| }); | ||
| }; | ||
| /* harmony default export */ __webpack_exports__["a"] = (escape_javascript); | ||
| /***/ }) | ||
| /******/ ]); |
+1
-1
| { | ||
| "name": "escape_javascript", | ||
| "version": "1.4.1", | ||
| "version": "1.5.0", | ||
| "description": "escape javascript", | ||
@@ -5,0 +5,0 @@ "main": "dist/escape_javascript_common.js", |
@@ -6,12 +6,8 @@ const path = require('path'); | ||
| entry: { | ||
| escape_javascript_common: './es_module.js', | ||
| escape_javascript: './normal' | ||
| }, | ||
| //出口文件的配置项 | ||
| output: { | ||
| //打包的路径文职 | ||
| path: path.resolve(__dirname,'dist'), | ||
| //打包的文件名称 | ||
| filename: '[name].js' | ||
| } | ||
| }; |
Sorry, the diff of this file is not supported yet
| !function(t){var r={};function e(n){if(r[n])return r[n].exports;var u=r[n]={i:n,l:!1,exports:{}};return t[n].call(u.exports,u,u.exports,e),u.l=!0,u.exports}e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=2)}([function(t,r,e){"use strict";r.a=((t="")=>{if(!t)return"";var r={lt:"<",gt:">",nbsp:" ",amp:"&",quot:'"'};return t.replace(/&(lt|gt|nbsp|amp|quot);/gi,function(t,e){return r[e]})})},,function(t,r,e){"use strict";e.r(r);var n=e(0);r.default=n.a}]); |
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | ||
| <title>Document</title> | ||
| </head> | ||
| <body> | ||
| <script src="./escape_javascript.js"></script> | ||
| <script> | ||
| console.log(escape_javascript); | ||
| </script> | ||
| </body> | ||
| </html> |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
4949
45.09%108
332%2
-50%1
-50%29
Infinity%7
-22.22%