@keyv/serialize 1.0.2 → 1.1.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.cjs CHANGED
@@ -18,13 +18,13 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  defaultDeserialize: () => defaultDeserialize,
24
24
  defaultSerialize: () => defaultSerialize
25
25
  });
26
- module.exports = __toCommonJS(src_exports);
27
- var import_buffer = require("buffer");
26
+ module.exports = __toCommonJS(index_exports);
27
+ var import_node_buffer = require("buffer");
28
28
  var defaultSerialize = (data) => {
29
29
  if (data === void 0 || data === null) {
30
30
  return "null";
@@ -32,7 +32,7 @@ var defaultSerialize = (data) => {
32
32
  if (typeof data === "string") {
33
33
  return JSON.stringify(data.startsWith(":") ? ":" + data : data);
34
34
  }
35
- if (import_buffer.Buffer.isBuffer(data)) {
35
+ if (import_node_buffer.Buffer.isBuffer(data)) {
36
36
  return JSON.stringify(":base64:" + data.toString("base64"));
37
37
  }
38
38
  if (data?.toJSON) {
@@ -45,7 +45,7 @@ var defaultSerialize = (data) => {
45
45
  let first = true;
46
46
  for (const k in data) {
47
47
  const ignore = typeof data[k] === "function" || !array && data[k] === void 0;
48
- if (!data.hasOwnProperty(k) || ignore) {
48
+ if (!Object.hasOwn(data, k) || ignore) {
49
49
  continue;
50
50
  }
51
51
  if (!first) {
@@ -66,7 +66,7 @@ var defaultSerialize = (data) => {
66
66
  var defaultDeserialize = (data) => JSON.parse(data, (_, value) => {
67
67
  if (typeof value === "string") {
68
68
  if (value.startsWith(":base64:")) {
69
- return import_buffer.Buffer.from(value.slice(8), "base64");
69
+ return import_node_buffer.Buffer.from(value.slice(8), "base64");
70
70
  }
71
71
  return value.startsWith(":") ? value.slice(1) : value;
72
72
  }
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ var defaultSerialize = (data) => {
20
20
  let first = true;
21
21
  for (const k in data) {
22
22
  const ignore = typeof data[k] === "function" || !array && data[k] === void 0;
23
- if (!data.hasOwnProperty(k) || ignore) {
23
+ if (!Object.hasOwn(data, k) || ignore) {
24
24
  continue;
25
25
  }
26
26
  if (!first) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keyv/serialize",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "Serialization for Keyv",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -12,26 +12,6 @@
12
12
  "import": "./dist/index.js"
13
13
  }
14
14
  },
15
- "xo": {
16
- "rules": {
17
- "import/no-named-as-default": "off",
18
- "unicorn/prefer-module": "off",
19
- "unicorn/prefer-event-target": "off",
20
- "unicorn/no-array-reduce": "off",
21
- "n/prefer-global/process": "off",
22
- "node/prefer-global/process": "off",
23
- "unicorn/prefer-object-from-entries": "off",
24
- "unicorn/prefer-node-protocol": "off",
25
- "@typescript-eslint/consistent-type-imports": "off",
26
- "@typescript-eslint/consistent-type-definitions": "off",
27
- "@typescript-eslint/no-empty-function": "off",
28
- "import/extensions": "off",
29
- "no-promise-executor-return": "off",
30
- "import/no-extraneous-dependencies": "off",
31
- "@typescript-eslint/no-unsafe-call": "off",
32
- "@typescript-eslint/no-unsafe-assignment": "off"
33
- }
34
- },
35
15
  "repository": {
36
16
  "type": "git",
37
17
  "url": "git+https://github.com/jaredwray/keyv.git"
@@ -49,17 +29,15 @@
49
29
  "url": "https://github.com/jaredwray/keyv/issues"
50
30
  },
51
31
  "homepage": "https://github.com/jaredwray/keyv",
52
- "dependencies": {
53
- "buffer": "^6.0.3"
54
- },
55
32
  "devDependencies": {
33
+ "@vitest/coverage-v8": "^3.2.4",
56
34
  "rimraf": "^6.0.1",
57
- "ts-node": "^10.9.2",
58
- "tsd": "^0.31.2",
59
- "typescript": "^5.7.2",
60
- "xo": "^0.60.0",
61
- "@keyv/test-suite": "^2.0.3",
62
- "keyv": "^5.2.2"
35
+ "tsd": "^0.32.0",
36
+ "typescript": "^5.8.3",
37
+ "vitest": "^3.2.4",
38
+ "xo": "^1.2.1",
39
+ "@keyv/test-suite": "^2.0.9",
40
+ "keyv": "^5.3.4"
63
41
  },
64
42
  "tsd": {
65
43
  "directory": "test"
@@ -71,7 +49,7 @@
71
49
  "scripts": {
72
50
  "build": "rimraf ./dist && tsup src/index.ts --format cjs,esm --dts --clean",
73
51
  "test": "xo --fix && vitest run --coverage",
74
- "test:ci": "xo && vitest --run --sequence.setupFiles=list",
52
+ "test:ci": "xo && vitest --run --sequence.setupFiles=list --coverage",
75
53
  "clean": "rimraf ./node_modules ./coverage ./dist"
76
54
  }
77
55
  }