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 10.0.0-beta.2 to 10.0.0-beta.3

11

index.d.ts

@@ -107,12 +107,3 @@ import { ComputedRef, Ref } from 'vue-demi';

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

@@ -124,2 +115,2 @@ *

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

@@ -124,5 +124,5 @@ var VueDemi = (function (VueDemi, Vue, VueCompositionAPI) {

const defaultNumericProjector = (input, from, to) => {
function defaultNumericProjector(input, from, to) {
return (input - from[0]) / (from[1] - from[0]) * (to[1] - to[0]) + to[0];
};
}
function createProjection(fromDomain, toDomain, projector = defaultNumericProjector) {

@@ -226,11 +226,2 @@ return createGenericProjection(fromDomain, toDomain, projector);

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) {

@@ -260,5 +251,4 @@ return vueDemi.computed(() => Math.trunc(shared.resolveUnref(value)));

exports.useSum = useSum;
exports.useToFixed = useToFixed;
exports.useTrunc = useTrunc;
})(this.VueUse = this.VueUse || {}, VueDemi, VueUse);

2

index.iife.min.js

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

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

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

"dependencies": {
"@vueuse/shared": "10.0.0-beta.2",
"@vueuse/shared": "10.0.0-beta.3",
"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