Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vueuse/math

Package Overview
Dependencies
Maintainers
3
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vueuse/math - npm Package Compare versions

Comparing version 9.0.0 to 9.0.1

13

index.d.ts

@@ -100,2 +100,13 @@ import { ComputedRef, Ref } from 'vue-demi';

/**
* Reactive `toFixed`
*
* @see https://vueuse.org/useToFixed
*/
interface FixedTypes {
type?: 'string' | 'number';
math?: 'floor' | 'ceil' | 'round';
}
declare function useToFixed(value: MaybeComputedRef<number | string>, digits: MaybeComputedRef<number>, options?: MaybeComputedRef<FixedTypes>): ComputedRef<number | string>;
/**
* Reactive `Math.trunc`.

@@ -107,2 +118,2 @@ *

export { ProjectorFunction, UseMathKeys, UseProjection, logicAnd as and, createGenericProjection, createProjection, logicAnd, logicNot, logicOr, logicNot as not, logicOr as or, useAbs, useAverage, useCeil, useClamp, useFloor, useMath, useMax, useMin, useProjection, useRound, useSum, useTrunc };
export { FixedTypes, ProjectorFunction, UseMathKeys, UseProjection, logicAnd as and, createGenericProjection, createProjection, logicAnd, logicNot, logicOr, logicNot as not, logicOr as or, useAbs, useAverage, useCeil, useClamp, useFloor, useMath, useMax, useMin, useProjection, useRound, useSum, useToFixed, useTrunc };

@@ -172,2 +172,11 @@ ;var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {

function useToFixed(value, digits, options) {
return vueDemi.computed(() => {
var _a, _b;
const floatValue = parseFloat(`${shared.resolveUnref(value)}`);
const outValue = Math[((_a = shared.resolveUnref(options)) == null ? void 0 : _a.math) || "round"](floatValue * 10 ** shared.resolveUnref(digits)) / 10 ** shared.resolveUnref(digits);
return ((_b = shared.resolveUnref(options)) == null ? void 0 : _b.type) === "string" ? shared.resolveUnref(digits) >= 0 ? outValue.toFixed(shared.resolveUnref(digits)) : `${outValue}` : outValue;
});
}
function useTrunc(value) {

@@ -196,2 +205,3 @@ return vueDemi.computed(() => Math.trunc(shared.resolveUnref(value)));

exports.useSum = useSum;
exports.useToFixed = useToFixed;
exports.useTrunc = useTrunc;

@@ -198,0 +208,0 @@

2

index.iife.min.js

@@ -1,1 +0,1 @@

var VueDemi=function(n,r,t){if(n.install)return n;if(r)if(r.version.slice(0,4)==="2.7."){for(var c in r)n[c]=r[c];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=r,n.Vue2=r,n.version=r.version}else if(r.version.slice(0,2)==="2.")if(t){for(var c in t)n[c]=t[c];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=r,n.Vue2=r,n.version=r.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(r.version.slice(0,2)==="3."){for(var c in r)n[c]=r[c];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=r,n.Vue2=void 0,n.version=r.version,n.set=function(i,f,l){return Array.isArray(i)?(i.length=Math.max(i.length,f),i.splice(f,1,l),l):(i[f]=l,l)},n.del=function(i,f){if(Array.isArray(i)){i.splice(f,1);return}delete i[f]}}else console.error("[vue-demi] Vue version "+r.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return n}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(n,r,t){"use strict";function c(e,o,u){return s=>r.computed(()=>u(t.resolveUnref(s),t.resolveUnref(e),t.resolveUnref(o)))}const i=(e,o,u)=>(e-o[0])/(o[1]-o[0])*(u[1]-u[0])+u[0];function f(e,o,u=i){return c(e,o,u)}function l(...e){return r.computed(()=>e.every(o=>t.resolveUnref(o)))}function v(e){return r.computed(()=>!t.resolveUnref(e))}function d(...e){return r.computed(()=>e.some(o=>t.resolveUnref(o)))}function U(e){return r.computed(()=>Math.abs(t.resolveUnref(e)))}function a(e){return e.flatMap(o=>{const u=t.resolveUnref(o);return Array.isArray(u)?u.map(s=>t.resolveUnref(s)):[u]})}function M(...e){return r.computed(()=>{const o=a(e);return o.reduce((u,s)=>u+=s,0)/o.length})}function p(e){return r.computed(()=>Math.ceil(t.resolveUnref(e)))}function A(e,o,u){const s=r.ref(e);return r.computed({get(){return s.value=t.clamp(s.value,t.resolveUnref(o),t.resolveUnref(u))},set(O){s.value=t.clamp(O,t.resolveUnref(o),t.resolveUnref(u))}})}function y(e){return r.computed(()=>Math.floor(t.resolveUnref(e)))}function P(e,...o){return t.reactify(Math[e])(...o)}function b(...e){return r.computed(()=>{const o=a(e);return Math.max(...o)})}function j(...e){return r.computed(()=>{const o=a(e);return Math.min(...o)})}function g(e,o,u,s){return f(o,u,s)(e)}function C(e){return r.computed(()=>Math.round(t.resolveUnref(e)))}function F(...e){return r.computed(()=>a(e).reduce((o,u)=>o+=u,0))}function N(e){return r.computed(()=>Math.trunc(t.resolveUnref(e)))}n.and=l,n.createGenericProjection=c,n.createProjection=f,n.logicAnd=l,n.logicNot=v,n.logicOr=d,n.not=v,n.or=d,n.useAbs=U,n.useAverage=M,n.useCeil=p,n.useClamp=A,n.useFloor=y,n.useMath=P,n.useMax=b,n.useMin=j,n.useProjection=g,n.useRound=C,n.useSum=F,n.useTrunc=N,Object.defineProperty(n,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueDemi,VueUse);
var VueDemi=function(n,r,t){if(n.install)return n;if(r)if(r.version.slice(0,4)==="2.7."){for(var l in r)n[l]=r[l];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=r,n.Vue2=r,n.version=r.version}else if(r.version.slice(0,2)==="2.")if(t){for(var l in t)n[l]=t[l];n.isVue2=!0,n.isVue3=!1,n.install=function(){},n.Vue=r,n.Vue2=r,n.version=r.version}else console.error("[vue-demi] no VueCompositionAPI instance found, please be sure to import `@vue/composition-api` before `vue-demi`.");else if(r.version.slice(0,2)==="3."){for(var l in r)n[l]=r[l];n.isVue2=!1,n.isVue3=!0,n.install=function(){},n.Vue=r,n.Vue2=void 0,n.version=r.version,n.set=function(f,i,s){return Array.isArray(f)?(f.length=Math.max(f.length,i),f.splice(i,1,s),s):(f[i]=s,s)},n.del=function(f,i){if(Array.isArray(f)){f.splice(i,1);return}delete f[i]}}else console.error("[vue-demi] Vue version "+r.version+" is unsupported.");else console.error("[vue-demi] no Vue instance found, please be sure to import `vue` before `vue-demi`.");return n}(this.VueDemi=this.VueDemi||(typeof VueDemi!="undefined"?VueDemi:{}),this.Vue||(typeof Vue!="undefined"?Vue:void 0),this.VueCompositionAPI||(typeof VueCompositionAPI!="undefined"?VueCompositionAPI:void 0));(function(n,r,t){"use strict";function l(e,o,u){return c=>r.computed(()=>u(t.resolveUnref(c),t.resolveUnref(e),t.resolveUnref(o)))}const f=(e,o,u)=>(e-o[0])/(o[1]-o[0])*(u[1]-u[0])+u[0];function i(e,o,u=f){return l(e,o,u)}function s(...e){return r.computed(()=>e.every(o=>t.resolveUnref(o)))}function d(e){return r.computed(()=>!t.resolveUnref(e))}function M(...e){return r.computed(()=>e.some(o=>t.resolveUnref(o)))}function p(e){return r.computed(()=>Math.abs(t.resolveUnref(e)))}function v(e){return e.flatMap(o=>{const u=t.resolveUnref(o);return Array.isArray(u)?u.map(c=>t.resolveUnref(c)):[u]})}function A(...e){return r.computed(()=>{const o=v(e);return o.reduce((u,c)=>u+=c,0)/o.length})}function y(e){return r.computed(()=>Math.ceil(t.resolveUnref(e)))}function P(e,o,u){const c=r.ref(e);return r.computed({get(){return c.value=t.clamp(c.value,t.resolveUnref(o),t.resolveUnref(u))},set(a){c.value=t.clamp(a,t.resolveUnref(o),t.resolveUnref(u))}})}function b(e){return r.computed(()=>Math.floor(t.resolveUnref(e)))}function j(e,...o){return t.reactify(Math[e])(...o)}function F(...e){return r.computed(()=>{const o=v(e);return Math.max(...o)})}function C(...e){return r.computed(()=>{const o=v(e);return Math.min(...o)})}function g(e,o,u,c){return i(o,u,c)(e)}function _(e){return r.computed(()=>Math.round(t.resolveUnref(e)))}function T(...e){return r.computed(()=>v(e).reduce((o,u)=>o+=u,0))}function N(e,o,u){return r.computed(()=>{var c,a;const G=parseFloat(`${t.resolveUnref(e)}`),U=Math[((c=t.resolveUnref(u))==null?void 0:c.math)||"round"](G*10**t.resolveUnref(o))/10**t.resolveUnref(o);return((a=t.resolveUnref(u))==null?void 0:a.type)==="string"?t.resolveUnref(o)>=0?U.toFixed(t.resolveUnref(o)):`${U}`:U})}function O(e){return r.computed(()=>Math.trunc(t.resolveUnref(e)))}n.and=s,n.createGenericProjection=l,n.createProjection=i,n.logicAnd=s,n.logicNot=d,n.logicOr=M,n.not=d,n.or=M,n.useAbs=p,n.useAverage=A,n.useCeil=y,n.useClamp=P,n.useFloor=b,n.useMath=j,n.useMax=F,n.useMin=C,n.useProjection=g,n.useRound=_,n.useSum=T,n.useToFixed=N,n.useTrunc=O,Object.defineProperty(n,"__esModule",{value:!0})})(this.VueUse=this.VueUse||{},VueDemi,VueUse);
{
"name": "@vueuse/math",
"version": "9.0.0",
"version": "9.0.1",
"description": "Math functions for VueUse",

@@ -38,5 +38,5 @@ "author": "Anthony Fu <https://github.com/antfu>",

"dependencies": {
"@vueuse/shared": "9.0.0",
"@vueuse/shared": "9.0.1",
"vue-demi": "*"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc