1
0
mirror of synced 2025-12-09 07:08:17 +08:00

Merge branch 'master' of github.com:liriliri/eruda

This commit is contained in:
redhoodsu
2020-09-17 11:14:43 +08:00
5 changed files with 62 additions and 188 deletions

View File

@@ -1,6 +1,13 @@
## 2.4.0 (14 Sep 2020)
* feat: default settings [#141](https://github.com/liriliri/eruda/issues/141)
* fix(elements): highlight
* fix(console): blinks frequently as it scroll to the border
* refactor: use chobitsu
## 2.3.3 (3 May 2020)
* fix: unsafe-eval CSP violation #140
* fix: unsafe-eval CSP violation [#140](https://github.com/liriliri/eruda/issues/140)
## v2.3.2 (29 Apr 2020)
@@ -66,7 +73,7 @@
## v1.10.3 (8 Nov 2019)
* fix(info): escape location #127
* fix(info): escape location [#127](https://github.com/liriliri/eruda/issues/127)
* chore: update refresh icon
* chore: update timing plugin version

View File

@@ -119,6 +119,7 @@ If you want to create a plugin yourself, follow the guides [here](./doc/PLUGIN.m
## Related Projects
* [chii](https://github.com/liriliri/chii): Remote debugging tool.
* [chobitsu](https://github.com/liriliri/chobitsu): Chrome devtools protocol JavaScript implementation.
* [licia](https://github.com/liriliri/licia): Utility library used by eruda.
* [eruda-webpack-plugin](https://github.com/huruji/eruda-webpack-plugin): Eruda webpack plugin.

View File

@@ -1281,23 +1281,6 @@ const str =
extractUrls(str); // -> ['http://eustia.liriliri.io']
```
## fileSize
Turn bytes into human readable file size.
|Name |Desc |
|------|------------------|
|bytes |File bytes |
|return|Readable file size|
```javascript
fileSize(5); // -> '5'
fileSize(1500); // -> '1.46K'
fileSize(1500000); // -> '1.43M'
fileSize(1500000000); // -> '1.4G'
fileSize(1500000000000); // -> '1.36T'
```
## filter
Iterates over elements of collection, returning an array of all the values that pass a truth test.
@@ -1346,10 +1329,6 @@ a.b = 2;
console.log(a); // -> {b: 1}
```
## fullUrl
Add origin to url if needed.
## getFileName
Extract file name from url.
@@ -1704,20 +1683,6 @@ isNaN(0); // -> false
isNaN(NaN); // -> true
```
## isNative
Check if value is a native function.
|Name |Desc |
|------|----------------------------------|
|val |Value to check |
|return|True if value is a native function|
```javascript
isNative(function() {}); // -> false
isNative(Math.min); // -> true
```
## isNil
Check if value is null or undefined, the same as value == null.

View File

@@ -1,6 +1,6 @@
{
"name": "eruda",
"version": "2.3.3",
"version": "2.4.0",
"description": "Console for Mobile Browsers",
"main": "eruda.js",
"scripts": {

View File

@@ -1074,59 +1074,6 @@ export var escapeRegExp = _.escapeRegExp = (function (exports) {
return exports;
})({});
/* ------------------------------ fileSize ------------------------------ */
export var fileSize = _.fileSize = (function (exports) {
/* Turn bytes into human readable file size.
*
* |Name |Desc |
* |------|------------------|
* |bytes |File bytes |
* |return|Readable file size|
*/
/* example
* fileSize(5); // -> '5'
* fileSize(1500); // -> '1.46K'
* fileSize(1500000); // -> '1.43M'
* fileSize(1500000000); // -> '1.4G'
* fileSize(1500000000000); // -> '1.36T'
*/
/* typescript
* export declare function fileSize(bytes: number): string;
*/
exports = function(bytes) {
if (bytes <= 0) return '0';
var suffixIdx = Math.floor(Math.log(bytes) / Math.log(1024));
var val = bytes / Math.pow(2, suffixIdx * 10);
return +val.toFixed(2) + suffixList[suffixIdx];
};
var suffixList = ['', 'K', 'M', 'G', 'T'];
return exports;
})({});
/* ------------------------------ fullUrl ------------------------------ */
export var fullUrl = _.fullUrl = (function (exports) {
/* Add origin to url if needed.
*/
let link = document.createElement('a')
exports = function (href) {
link.href = href
return (
link.protocol + '//' + link.host + link.pathname + link.search + link.hash
)
}
return exports;
})({});
/* ------------------------------ upperFirst ------------------------------ */
export var upperFirst = _.upperFirst = (function (exports) {
@@ -2446,98 +2393,6 @@ export var isNil = _.isNil = (function (exports) {
return exports;
})({});
/* ------------------------------ toSrc ------------------------------ */
export var toSrc = _.toSrc = (function (exports) {
/* Convert function to its source code.
*
* |Name |Desc |
* |------|-------------------|
* |fn |Function to convert|
* |return|Source code |
*/
/* example
* toSrc(Math.min); // -> 'function min() { [native code] }'
* toSrc(function() {}); // -> 'function () { }'
*/
/* typescript
* export declare function toSrc(fn: types.AnyFn): string;
*/
/* dependencies
* isNil types
*/
exports = function(fn) {
if (isNil(fn)) return '';
try {
return fnToStr.call(fn);
/* eslint-disable no-empty */
} catch (e) {}
try {
return fn + '';
/* eslint-disable no-empty */
} catch (e) {}
return '';
};
var fnToStr = Function.prototype.toString;
return exports;
})({});
/* ------------------------------ isNative ------------------------------ */
export var isNative = _.isNative = (function (exports) {
/* Check if value is a native function.
*
* |Name |Desc |
* |------|----------------------------------|
* |val |Value to check |
* |return|True if value is a native function|
*/
/* example
* isNative(function() {}); // -> false
* isNative(Math.min); // -> true
*/
/* typescript
* export declare function isNative(val: any): boolean;
*/
/* dependencies
* isObj isFn toSrc
*/
exports = function(val) {
if (!isObj(val)) return false;
if (isFn(val)) return regIsNative.test(toSrc(val)); // Detect host constructors (Safari > 4; really typed array specific)
return regIsHostCtor.test(toSrc(val));
};
var hasOwnProperty = Object.prototype.hasOwnProperty;
var regIsNative = new RegExp(
'^' +
toSrc(hasOwnProperty)
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
.replace(
/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,
'$1.*?'
) +
'$'
);
var regIsHostCtor = /^\[object .+?Constructor\]$/;
return exports;
})({});
/* ------------------------------ isNull ------------------------------ */
export var isNull = _.isNull = (function (exports) {
@@ -6016,12 +5871,13 @@ export var Emitter = _.Emitter = (function (exports) {
return this;
},
off: function(event, listener) {
if (!has(this._events, event)) return;
var events = this._events;
if (!has(events, event)) return;
var idx = events[event].indexOf(listener);
this._events[event].splice(
this._events[event].indexOf(listener),
1
);
if (idx > -1) {
events[event].splice(idx, 1);
}
return this;
},
@@ -8069,6 +7925,51 @@ export var LocalStore = _.LocalStore = (function (exports) {
return exports;
})({});
/* ------------------------------ toSrc ------------------------------ */
export var toSrc = _.toSrc = (function (exports) {
/* Convert function to its source code.
*
* |Name |Desc |
* |------|-------------------|
* |fn |Function to convert|
* |return|Source code |
*/
/* example
* toSrc(Math.min); // -> 'function min() { [native code] }'
* toSrc(function() {}); // -> 'function () { }'
*/
/* typescript
* export declare function toSrc(fn: types.AnyFn): string;
*/
/* dependencies
* isNil types
*/
exports = function(fn) {
if (isNil(fn)) return '';
try {
return fnToStr.call(fn);
/* eslint-disable no-empty */
} catch (e) {}
try {
return fn + '';
/* eslint-disable no-empty */
} catch (e) {}
return '';
};
var fnToStr = Function.prototype.toString;
return exports;
})({});
/* ------------------------------ stringifyAll ------------------------------ */
export var stringifyAll = _.stringifyAll = (function (exports) {