Skip to content

Commit

Permalink
feat: v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
surmon-china committed Sep 5, 2024
1 parent 936dd68 commit d867e84
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 992 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "veact",
"version": "1.0.0-rc.1",
"version": "1.0.0",
"description": "Mutable state enhancer library for React by @vue/reactivity",
"keywords": [
"React",
Expand Down Expand Up @@ -50,7 +50,7 @@
"react-dom": "^16.8.0 || ^17 || ^18 || ^19"
},
"dependencies": {
"@vue/reactivity": "^3.5.0-rc.1"
"@vue/reactivity": ">=3.5"
},
"devDependencies": {
"@eslint/js": "^9.x",
Expand All @@ -64,14 +64,14 @@
"eslint-config-prettier": "^9.x",
"eslint-plugin-prettier": "^5.x",
"globals": "^15.9.0",
"jsdom": "^25.x",
"happy-dom": "^15.x",
"prettier": "^3.x",
"react": "^18.x",
"react-dom": "^18.x",
"typescript": "^5.5.4",
"typescript-eslint": "^8.x",
"vite": "^5.x",
"vite-plugin-dts": "^4.0.3",
"vite-plugin-dts": "^4.1.0",
"vitest": "^2.x"
}
}
570 changes: 141 additions & 429 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

45 changes: 0 additions & 45 deletions src/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,3 @@ export type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N

export const increment = (s: number) => s + 1
export const useForceUpdate = () => useReducer(increment, 0)[1]

// compare whether a value has changed, accounting for NaN.
export const hasChanged = (value: any, oldValue: any): boolean => {
return value !== oldValue && (value === value || oldValue === oldValue)
}

export const isArray = Array.isArray
export const objectToString = Object.prototype.toString
export const toTypeString = (value: unknown): string => {
return objectToString.call(value)
}
export const isMap = (value: unknown): value is Map<any, any> => {
return toTypeString(value) === '[object Map]'
}
export const isSet = (value: unknown): value is Set<any> => {
return toTypeString(value) === '[object Set]'
}
export const isDate = (value: unknown): value is Date => {
return value instanceof Date
}
export const isFunction = (value: unknown): value is (...args: any[]) => any => {
return typeof value === 'function'
}
export const isString = (value: unknown): value is string => {
return typeof value === 'string'
}
export const isSymbol = (value: unknown): value is symbol => {
return typeof value === 'symbol'
}
export const isObject = (value: unknown): value is Record<any, any> => {
return value !== null && typeof value === 'object'
}
export const isPlainObject = (value: unknown): value is object => {
return toTypeString(value) === '[object Object]'
}
export const isPromise = <T = any>(value: unknown): value is Promise<T> => {
return isObject(value) && isFunction(value.then) && isFunction(value.catch)
}

export const removeArrayItem = <T>(array: T[], element: T) => {
const i = array.indexOf(element)
if (i > -1) {
array.splice(i, 1)
}
}
83 changes: 0 additions & 83 deletions src/watch-bak/patch.ts

This file was deleted.

21 changes: 0 additions & 21 deletions src/watch-bak/type.ts

This file was deleted.

Loading

0 comments on commit d867e84

Please sign in to comment.