Skip to content

Commit

Permalink
fix(useToFixed): deprecated in favor of usePrecision
Browse files Browse the repository at this point in the history
close #2015 close #2024
  • Loading branch information
antfu committed Aug 4, 2022
1 parent 49c8ac4 commit 790ef40
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
10 changes: 8 additions & 2 deletions packages/.vitepress/theme/components/FunctionBadge.vue
Expand Up @@ -29,8 +29,14 @@ const link = computed(() => {
</script>

<template>
<div text="sm" flex="~ gap1" items-center>
<a v-bind="link" bg="gray-400/5" p="x-1.5 y-0.5" class="rounded items-center" flex="inline gap-1 none" my-auto>
<div
text="sm" flex="~ gap1" items-center
:class="fn.deprecated ? 'op80 saturate-0' : ''"
>
<a
v-bind="link" bg="gray-400/5" p="x-1.5 y-0.5" class="rounded items-center" flex="inline gap-1 none" my-auto
:class="fn.deprecated ? 'line-through !decoration-solid' : ''"
>
<span v-html="styledName(fn.name)" />
<i v-if="fn.external" i-carbon-launch class="opacity-80 text-xs" />
</a>
Expand Down
1 change: 1 addition & 0 deletions packages/math/index.ts
Expand Up @@ -11,6 +11,7 @@ export * from './useFloor'
export * from './useMath'
export * from './useMax'
export * from './useMin'
export * from './usePrecision'
export * from './useProjection'
export * from './useRound'
export * from './useSum'
Expand Down
5 changes: 5 additions & 0 deletions packages/math/useToFixed/index.md
@@ -1,7 +1,12 @@
---
category: '@Math'
deprecated: true
---

::: warning
**Deprecated**. Please use `usePrecision` instead.
:::

# useToFixed

Reactive `toFixed`.
Expand Down
8 changes: 3 additions & 5 deletions packages/math/useToFixed/index.ts
Expand Up @@ -3,16 +3,14 @@ import { computed } from 'vue-demi'
import type { MaybeComputedRef } from '@vueuse/shared'
import { resolveUnref } from '@vueuse/shared'

/**
* Reactive `toFixed`
*
* @see https://vueuse.org/useToFixed
*/
export interface FixedTypes {
type?: 'string' | 'number'
math?: 'floor' | 'ceil' | 'round'
}

/**
* @deprecated use `usePrecision` instead
*/
export function useToFixed(
value: MaybeComputedRef<number | string>,
digits: MaybeComputedRef<number>,
Expand Down
2 changes: 1 addition & 1 deletion packages/metadata/scripts/update.ts
Expand Up @@ -104,7 +104,7 @@ export async function readMetadata() {
fn.category = ['core', 'shared'].includes(pkg.name) ? category : `@${pkg.display}`
fn.description = description

if (description.includes('DEPRECATED'))
if (description.includes('DEPRECATED') || frontmatter.deprecated)
fn.deprecated = true

if (alias?.length)
Expand Down

0 comments on commit 790ef40

Please sign in to comment.