@jhqn/utils-core 0.5.0 → 1.0.0

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/dist/index.d.ts CHANGED
@@ -508,10 +508,10 @@ export declare function parseJSON<T = any>(str: string, reviverFn?: (this: any,
508
508
  export declare function stringifyJSON(value: any, replacerFn?: (this: any, key: string, value: any) => any): string;
509
509
  /**
510
510
  * JSON.stringify() second param
511
- * @param _key
511
+ * @param key
512
512
  * @param value
513
513
  */
514
- export declare function replacer(_key: any, value: any): any;
514
+ export declare function replacer(this: any, key: any, value: any): any;
515
515
  /**
516
516
  * JSON.parse() second param
517
517
  * @param _key
package/dist/index.js CHANGED
@@ -780,10 +780,15 @@ function stringifyJSON(value, replacerFn = replacer) {
780
780
  }
781
781
  /**
782
782
  * JSON.stringify() second param
783
- * @param _key
783
+ * @param key
784
784
  * @param value
785
785
  */
786
- function replacer(_key, value) {
786
+ function replacer(key, value) {
787
+ const rawValue = this === void 0 ? value : this[key];
788
+ if (isDate(rawValue)) return {
789
+ dataType: "Date",
790
+ value: rawValue.toISOString()
791
+ };
787
792
  if (isMap(value)) return {
788
793
  dataType: "Map",
789
794
  value: [...value]
@@ -792,10 +797,6 @@ function replacer(_key, value) {
792
797
  dataType: "Set",
793
798
  value: [...value]
794
799
  };
795
- if (isDate(value)) return {
796
- dataType: "Date",
797
- value: value.toISOString()
798
- };
799
800
  return value;
800
801
  }
801
802
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jhqn/utils-core",
3
- "version": "0.5.0",
3
+ "version": "1.0.0",
4
4
  "keywords": [
5
5
  "jade",
6
6
  "utils"