chore: export all utils

This commit is contained in:
Ayo 2023-12-08 15:05:27 +01:00
parent b613d8e77c
commit f56068e76e
6 changed files with 25 additions and 27 deletions

View file

@ -1,6 +1,6 @@
{
"name": "web-component-base",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.4",
"description": "A zero-dependency, ~600 Bytes (minified & gzipped), JS base class for creating reactive custom elements easily",
"type": "module",
"exports": {
@ -8,18 +8,18 @@
"types": "./index.d.ts",
"import": "./index.js"
},
"./WebComponent": {
"types": "./WebComponent.d.ts",
"import": "./WebComponent.js"
},
"./attach-effect": {
"types": "./attach-effect.d.ts",
"import": "./attach-effect.js"
"./*": {
"types": "./*.d.ts",
"import": "./*.js"
},
"./utils": {
"types": "./utils/index.d.ts",
"import": "./utils/index.js"
},
"./utils/*": {
"types": "./utils/*.d.ts",
"import": "./utils/*.js"
},
"./WebComponent.min.js": {
"types": "./WebComponent.d.ts",
"import": "./WebComponent.min.js"

View file

@ -1,6 +1,4 @@
import { getKebabCase } from "./utils/get-kebab-case";
import { getCamelCase } from "./utils/get-camel-case";
import { serialize, deserialize } from "./utils/parse";
import { getKebabCase, getCamelCase, serialize, deserialize } from "./utils";
/**
* A minimal base class to reduce the complexity of creating reactive custom elements

11
src/utils/deserialize.js Normal file
View file

@ -0,0 +1,11 @@
export function deserialize(value, type) {
switch (type) {
case "number":
case "boolean":
case "object":
case "undefined":
return JSON.parse(value);
default:
return value;
}
}

View file

@ -1 +1,4 @@
export {serialize, deserialize} from './parse.js';
export { serialize } from "./serialize.js";
export { deserialize } from "./deserialize.js";
export { getCamelCase } from "./get-camel-case.js";
export { getKebabCase } from "./get-kebab-case.js";

View file

@ -1,15 +1,3 @@
export function deserialize(value, type) {
switch (type) {
case "number":
case "boolean":
case "object":
case "undefined":
return JSON.parse(value);
default:
return value;
}
}
export function serialize(value) {
switch (typeof value) {
case "number":

View file

@ -8,8 +8,6 @@
},
"include": [
"src/*",
"src/utils/*"
],
"exclude": [
"src/utils"
]
}