tools-min-ns 1.9.9 → 1.9.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,6 +5,13 @@ cnpm i tools-min-ns --save
5
5
  ```
6
6
 
7
7
  # updates
8
+ ## v1.9.11
9
+
10
+ > uniRequest withCredentials参数默认false
11
+ ## v1.9.10
12
+
13
+ > NumberUtil correctNumberInput错误bug修复
14
+
8
15
  ## v1.9.9
9
16
 
10
17
  > DateUtil getDatesOfMonth日期错误bug修复
@@ -65,7 +65,7 @@ declare namespace Me {
65
65
  function invertedColors(): boolean | undefined;
66
66
  function forcedColors(): boolean | undefined;
67
67
  function monochrome(): number | undefined;
68
- function contrast(): 0 | 1 | 10 | -1 | undefined;
68
+ function contrast(): 0 | 10 | 1 | -1 | undefined;
69
69
  function reducedMotion(): boolean | undefined;
70
70
  function reducedTransparency(): boolean | undefined;
71
71
  function hdr(): boolean | undefined;
@@ -137,12 +137,9 @@ var NumberUtil;
137
137
  if (n === void 0) {
138
138
  n = 2;
139
139
  }
140
- if (undefined == val || null == val || '' == val || isNaN(val)) {
141
- return 0;
142
- }
143
- var lastChar = val[val.length - 1] === '.' ? '.' : '';
144
- var str = (isNaN(parseFloat(val)) ? '' : parseInt("".concat(Math.round(parseFloat(val) * Math.pow(10, n)))) / Math.pow(10, n)) + lastChar;
145
- return Number(str);
140
+ if (!NumberUtil.isaFinite(Number(val))) return 0;
141
+ var num = parseInt("".concat(Math.round(parseFloat(val) * Math.pow(10, n)))) / Math.pow(10, n);
142
+ return NumberUtil.isaFinite(num) ? num : 0;
146
143
  }
147
144
  NumberUtil.correctNumberInput = correctNumberInput;
148
145
  /**
@@ -28,6 +28,7 @@ export interface JsonpOptions {
28
28
  export interface RequestOptions {
29
29
  url: string;
30
30
  headers?: AsObject;
31
+ withCredentials?: boolean;
31
32
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD';
32
33
  data?: AsObject;
33
34
  timeout?: number;
@@ -2,10 +2,10 @@ import { ERROR_REQUEST_TIMEOUT, ERROR_REQUEST_ABORT } from '../types';
2
2
  import { applyParamToURL, object2json, checkIsApplyDataToURL, isObject, isPlainObject } from '../utils';
3
3
  export default function requestXHR(options) {
4
4
  options.headers = Object.assign({
5
- 'Accept': 'application/json, text/plain, */*'
5
+ Accept: 'application/json, text/plain, */*'
6
6
  }, options.headers);
7
7
  var _a = Object.assign({
8
- withCredentials: true,
8
+ withCredentials: false,
9
9
  method: 'GET',
10
10
  validateStatus: function validateStatus(status) {
11
11
  return status >= 200 && status < 300 || status === 304;
@@ -65,7 +65,7 @@ declare namespace Me {
65
65
  function invertedColors(): boolean | undefined;
66
66
  function forcedColors(): boolean | undefined;
67
67
  function monochrome(): number | undefined;
68
- function contrast(): 0 | 1 | 10 | -1 | undefined;
68
+ function contrast(): 0 | 10 | 1 | -1 | undefined;
69
69
  function reducedMotion(): boolean | undefined;
70
70
  function reducedTransparency(): boolean | undefined;
71
71
  function hdr(): boolean | undefined;
@@ -147,12 +147,9 @@ var NumberUtil;
147
147
  if (n === void 0) {
148
148
  n = 2;
149
149
  }
150
- if (undefined == val || null == val || '' == val || isNaN(val)) {
151
- return 0;
152
- }
153
- var lastChar = val[val.length - 1] === '.' ? '.' : '';
154
- var str = (isNaN(parseFloat(val)) ? '' : parseInt("".concat(Math.round(parseFloat(val) * Math.pow(10, n)))) / Math.pow(10, n)) + lastChar;
155
- return Number(str);
150
+ if (!NumberUtil.isaFinite(Number(val))) return 0;
151
+ var num = parseInt("".concat(Math.round(parseFloat(val) * Math.pow(10, n)))) / Math.pow(10, n);
152
+ return NumberUtil.isaFinite(num) ? num : 0;
156
153
  }
157
154
  NumberUtil.correctNumberInput = correctNumberInput;
158
155
  /**
@@ -28,6 +28,7 @@ export interface JsonpOptions {
28
28
  export interface RequestOptions {
29
29
  url: string;
30
30
  headers?: AsObject;
31
+ withCredentials?: boolean;
31
32
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD';
32
33
  data?: AsObject;
33
34
  timeout?: number;
@@ -7,10 +7,10 @@ var types_1 = require("../types");
7
7
  var utils_1 = require("../utils");
8
8
  function requestXHR(options) {
9
9
  options.headers = Object.assign({
10
- 'Accept': 'application/json, text/plain, */*'
10
+ Accept: 'application/json, text/plain, */*'
11
11
  }, options.headers);
12
12
  var _a = Object.assign({
13
- withCredentials: true,
13
+ withCredentials: false,
14
14
  method: 'GET',
15
15
  validateStatus: function validateStatus(status) {
16
16
  return status >= 200 && status < 300 || status === 304;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tools-min-ns",
3
3
  "description": "工具包适用于前端以及node",
4
- "version": "1.9.9",
4
+ "version": "1.9.11",
5
5
  "main": "lib/index.js",
6
6
  "license": "MIT",
7
7
  "author": "nanshen",