chore: export all utils
This commit is contained in:
parent
b613d8e77c
commit
f56068e76e
6 changed files with 25 additions and 27 deletions
16
package.json
16
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "web-component-base",
|
"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",
|
"description": "A zero-dependency, ~600 Bytes (minified & gzipped), JS base class for creating reactive custom elements easily",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
@ -8,18 +8,18 @@
|
||||||
"types": "./index.d.ts",
|
"types": "./index.d.ts",
|
||||||
"import": "./index.js"
|
"import": "./index.js"
|
||||||
},
|
},
|
||||||
"./WebComponent": {
|
"./*": {
|
||||||
"types": "./WebComponent.d.ts",
|
"types": "./*.d.ts",
|
||||||
"import": "./WebComponent.js"
|
"import": "./*.js"
|
||||||
},
|
|
||||||
"./attach-effect": {
|
|
||||||
"types": "./attach-effect.d.ts",
|
|
||||||
"import": "./attach-effect.js"
|
|
||||||
},
|
},
|
||||||
"./utils": {
|
"./utils": {
|
||||||
"types": "./utils/index.d.ts",
|
"types": "./utils/index.d.ts",
|
||||||
"import": "./utils/index.js"
|
"import": "./utils/index.js"
|
||||||
},
|
},
|
||||||
|
"./utils/*": {
|
||||||
|
"types": "./utils/*.d.ts",
|
||||||
|
"import": "./utils/*.js"
|
||||||
|
},
|
||||||
"./WebComponent.min.js": {
|
"./WebComponent.min.js": {
|
||||||
"types": "./WebComponent.d.ts",
|
"types": "./WebComponent.d.ts",
|
||||||
"import": "./WebComponent.min.js"
|
"import": "./WebComponent.min.js"
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import { getKebabCase } from "./utils/get-kebab-case";
|
import { getKebabCase, getCamelCase, serialize, deserialize } from "./utils";
|
||||||
import { getCamelCase } from "./utils/get-camel-case";
|
|
||||||
import { serialize, deserialize } from "./utils/parse";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A minimal base class to reduce the complexity of creating reactive custom elements
|
* A minimal base class to reduce the complexity of creating reactive custom elements
|
||||||
|
|
11
src/utils/deserialize.js
Normal file
11
src/utils/deserialize.js
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -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";
|
||||||
|
|
|
@ -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) {
|
export function serialize(value) {
|
||||||
switch (typeof value) {
|
switch (typeof value) {
|
||||||
case "number":
|
case "number":
|
|
@ -8,8 +8,6 @@
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/*",
|
"src/*",
|
||||||
|
"src/utils/*"
|
||||||
],
|
],
|
||||||
"exclude": [
|
|
||||||
"src/utils"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue