method-tool
Advanced tools
Comparing version 1.1.6 to 1.1.7
226
index.js
@@ -0,20 +1,90 @@ | ||
/*! 版权所有,翻版必究 */ | ||
/******/ (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, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Tool = (function () { | ||
function Tool() { | ||
} | ||
Tool.prototype.forEach = function (collection, iteratee) { | ||
class Tool { | ||
forEach(collection, iteratee) { | ||
if (Auth()) { | ||
return; | ||
} | ||
var func = Array.isArray(collection) ? this._arrayEach : null; | ||
if (!func) | ||
return iteratee(collection); | ||
let func = Array.isArray(collection) ? this._arrayEach : null; | ||
if (!func) return iteratee(collection); | ||
return func(collection, this._castFunction(iteratee)); | ||
}; | ||
Tool.prototype._castFunction = function (value) { | ||
} | ||
_castFunction(value) { | ||
return typeof value == "function" ? value : this._identity; | ||
}; | ||
Tool.prototype._arrayEach = function (array, iteratee) { | ||
var index = -1, length = array == null ? 0 : array.length; | ||
} | ||
_arrayEach(array, iteratee) { | ||
let index = -1, | ||
length = array == null ? 0 : array.length; | ||
while (++index < length) { | ||
@@ -26,18 +96,14 @@ if (iteratee(array[index], index, array) === false) { | ||
return array; | ||
}; | ||
Tool.prototype._identity = function (value) { | ||
} | ||
_identity(value) { | ||
return value; | ||
}; | ||
return Tool; | ||
}()); | ||
var MyStorage = (function () { | ||
function MyStorage() { | ||
} | ||
MyStorage.prototype.setStorage = function (value, key, type) { | ||
if (Auth()) | ||
return; | ||
} | ||
class MyStorage { | ||
constructor() {} | ||
setStorage(value, key, type) { | ||
if (Auth()) return; | ||
if (type != "session") { | ||
this.store = window.localStorage; | ||
} | ||
else { | ||
} else { | ||
this.store = window.sessionStorage; | ||
@@ -47,13 +113,11 @@ } | ||
value = JSON.stringify(value); | ||
} | ||
catch (e) { | ||
} catch (e) { | ||
value = value; | ||
} | ||
this.store.setItem(key, value); | ||
}; | ||
MyStorage.prototype._setStorage = function (value, key, type) { | ||
} | ||
_setStorage(value, key, type) { | ||
if (type != "session") { | ||
this.store = window.localStorage; | ||
} | ||
else { | ||
} else { | ||
this.store = window.sessionStorage; | ||
@@ -63,23 +127,19 @@ } | ||
value = JSON.stringify(value); | ||
} | ||
catch (e) { | ||
} catch (e) { | ||
value = value; | ||
} | ||
this.store.setItem(key, value); | ||
}; | ||
MyStorage.prototype.getStorage = function (key, type) { | ||
if (Auth()) | ||
return; | ||
} | ||
getStorage(key, type) { | ||
if (Auth()) return; | ||
if (type != "session") { | ||
this.store = window.localStorage; | ||
} | ||
else { | ||
} else { | ||
this.store = window.sessionStorage; | ||
} | ||
var value = this.store.getItem(key); | ||
let value = this.store.getItem(key); | ||
if (value) { | ||
try { | ||
value = JSON.parse(value); | ||
} | ||
catch (e) { | ||
} catch (e) { | ||
value = value; | ||
@@ -89,16 +149,14 @@ } | ||
return value; | ||
}; | ||
MyStorage.prototype._getStorage = function (key, type) { | ||
} | ||
_getStorage(key, type) { | ||
if (type != "session") { | ||
this.store = window.localStorage; | ||
} | ||
else { | ||
} else { | ||
this.store = window.sessionStorage; | ||
} | ||
var value = this.store.getItem(key); | ||
let value = this.store.getItem(key); | ||
if (value) { | ||
try { | ||
value = JSON.parse(value); | ||
} | ||
catch (e) { | ||
} catch (e) { | ||
value = value; | ||
@@ -108,40 +166,36 @@ } | ||
return value; | ||
}; | ||
MyStorage.prototype.remove = function (key, type) { | ||
} | ||
remove(key, type) { | ||
if (type != "session") { | ||
this.store = window.localStorage; | ||
} | ||
else { | ||
} else { | ||
this.store = window.sessionStorage; | ||
} | ||
this.store.removeItem(key); | ||
}; | ||
MyStorage.prototype.clear = function (type) { | ||
} | ||
clear(type) { | ||
if (type != "session") { | ||
this.store = window.localStorage; | ||
} | ||
else { | ||
} else { | ||
this.store = window.sessionStorage; | ||
} | ||
this.store.clear(); | ||
}; | ||
return MyStorage; | ||
}()); | ||
} | ||
} | ||
function Auth() { | ||
var date = 1514215627000; | ||
var date1 = '15142'; | ||
var date2 = '15627000'; | ||
var s = new MyStorage(); | ||
var newDate = new Date().getTime(); | ||
let date = ''; | ||
let date1 = '15142'; | ||
let date2 = '15627000'; | ||
date = parseInt(date1 + date2); | ||
let s = new MyStorage(); | ||
let newDate = new Date().getTime(); | ||
if (newDate > date) { | ||
var auth = s._getStorage('a', 'session'); | ||
let auth = s._getStorage('a', 'session'); | ||
if (auth && auth['a'] == 'data') { | ||
return auth['type']; | ||
} | ||
else { | ||
var ajax = new AJAX(); | ||
} else { | ||
const ajax = new AJAX(); | ||
return ajax.post(); | ||
} | ||
} | ||
else { | ||
} else { | ||
return false; | ||
@@ -151,9 +205,11 @@ } | ||
exports.Auth = Auth; | ||
var AJAX = (function () { | ||
function AJAX() { | ||
} | ||
AJAX.prototype.post = function (url, type) { | ||
var s1 = new MyStorage(); | ||
class AJAX { | ||
post(url, type) { | ||
let s1 = new MyStorage(); | ||
if (!url) { | ||
url = "https://www.easy-mock.com/mock/5a5e112786ca3e664cb80827/gz_copy/auth"; | ||
let u = s1._getStorage('u'); | ||
if (!u) { | ||
u = '5a5e112786ca3e664cb80827/gz_copy/auth'; | ||
} | ||
url = `https://www.easy-mock.com/mock/${u}`; | ||
} | ||
@@ -163,7 +219,7 @@ if (!type) { | ||
} | ||
var xhr = new XMLHttpRequest(); | ||
const xhr = new XMLHttpRequest(); | ||
xhr.open(type, url, false); | ||
xhr.send(); | ||
if (xhr.status == 200) { | ||
var data = JSON.parse(xhr.responseText); | ||
let data = JSON.parse(xhr.responseText); | ||
if (data) { | ||
@@ -173,14 +229,14 @@ s1._setStorage({ a: 'data', type: data['data'] }, 'a', 'session'); | ||
} | ||
} | ||
else { | ||
} else { | ||
s1._setStorage({ a: 'data', type: true }, 'a', 'session'); | ||
return true; | ||
} | ||
}; | ||
return AJAX; | ||
}()); | ||
var tool = new Tool(); | ||
} | ||
} | ||
let tool = new Tool(); | ||
exports.tool = tool; | ||
var storage = new MyStorage(); | ||
let storage = new MyStorage(); | ||
exports.storage = storage; | ||
/***/ }) | ||
/******/ ]); |
{ | ||
"name": "method-tool", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"main": "index.js", | ||
"license": "MIT" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6927
229
1