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

use-count-up

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-count-up - npm Package Compare versions

Comparing version 2.1.4 to 2.2.4

lib/index.js.map

18

CHANGELOG.md
# Change Log
## 2.2.4 (June 11th, 2020)
**Implemented enhancements:**
- feat: use Rollup instead of Webpack to bundle the package, which enables ES module bundles.
## 2.1.4 (June 8th, 2020)
**Implemented enhancements:**
- chore: update list of keywords in package.json
## 2.1.3 (June 3rd, 2020)

@@ -7,3 +19,3 @@

- Fix: upgrade use-elapsed-time to 2.1.4 which fixes an issue where pausing the animation once it is completed, resetting the timer and playing again it did not work.
- fix: upgrade use-elapsed-time to 2.1.4 which fixes an issue where pausing the animation once it is completed, resetting the timer and playing again it did not work.

@@ -14,3 +26,3 @@ ## 2.1.2 (June 1st, 2020)

- Upgrade `use-elapsed-time` package to v2.1.3 which replaces `useLayoutEffect` with `useEffect` when the environment is node for SSR and removes side effects from `useState` so React.StrictMode works as expected in development
- fix: upgrade `use-elapsed-time` package to v2.1.3 which replaces `useLayoutEffect` with `useEffect` when the environment is node for SSR and removes side effects from `useState` so React.StrictMode works as expected in development

@@ -21,3 +33,3 @@ ## 2.1.1 (May 21st, 2020)

- Fix an issue where rounding numbers with bitwise shifting `number | 0` caused the last number to jump
- fix: fix an issue where rounding numbers with bitwise shifting `number | 0` caused the last number to jump

@@ -24,0 +36,0 @@ ## 2.1.0 (May 19th, 2020)

3

lib/index.js

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

module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=3)}([function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("react")},function(e,t,r){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t){e.exports=r(1)},function(e,t,r){"use strict";r.r(t),r.d(t,"useElapsedTime",(function(){return i}));var n=r(0);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,u=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw u}}return r}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.duration,u=t.onComplete,i=t.startAt,c=void 0===i?0:i,f=t.autoResetKey,l=Object(n.useState)(c),s=o(l,2),d=s[0],p=s[1],m=Object(n.useRef)(-1e3*c),b=Object(n.useRef)(null),y=Object(n.useRef)(null),v=Object(n.useRef)(null),g=Object(n.useRef)(!0),O=Object(n.useRef)(!1),S=Object(n.useRef)(0),j=Object(n.useCallback)((function(e){S.current+=1,p("number"==typeof e?e:c)}),[]),x=function e(t){var n=t/1e3;if(null===y.current)return y.current=n,void(b.current=requestAnimationFrame(e));var o=n-y.current;if(y.current=n,p((function(e){var t=e+o;return"number"!=typeof r||t<r?t:(O.current=!0,r)})),O.current){if("function"==typeof u){m.current+=1e3*r;var i=m.current/1e3,a=u(i)||{},c=a.shouldRepeat,f=void 0!==c&&c,l=a.delay,s=void 0===l?0:l,d=a.newStartAt;f&&(v.current=setTimeout((function(){j(d)}),1e3*s))}}else b.current=requestAnimationFrame(e)},h=function(){cancelAnimationFrame(b.current),clearTimeout(v.current),y.current=null};return a((function(){return e&&(b.current=requestAnimationFrame(x)),h}),[e]),a((function(){e&&!g.current&&(h(),b.current=requestAnimationFrame(x))}),[r]),a((function(){g.current||j()}),[f]),a((function(){e&&O.current&&(h(),b.current=requestAnimationFrame(x)),O.current=!1}),[S.current]),a((function(){g.current=!1}),[]),{elapsedTime:d,reset:j}},a="undefined"==typeof window?n.useEffect:n.useLayoutEffect}])},function(e,t,r){"use strict";r.r(t),r.d(t,"useCountUp",(function(){return a})),r.d(t,"CountUp",(function(){return y}));var n=r(2),o={easeInCubic:function(e,t,r,n){return r*(e/=n)*e*e+t},easeOutCubic:function(e,t,r,n){return e/=n,r*(--e*e*e+1)+t},linear:function(e,t,r,n){return r*e/n+t}},u=o.easeOutCubic,i=function(){var e=function(){try{(0).toLocaleString("i")}catch(e){return"RangeError"===e.name}return!1}(),t=!("object"!=typeof Intl||!Intl||"function"!=typeof Intl.NumberFormat);return e&&t},a=function(e){var t,r=e.isCounting,i=void 0!==r&&r,a=e.start,c=void 0===a?0:a,f=e.end,l=e.duration,s=e.easing,d=void 0===s?u:s,m=e.onComplete,b=e.autoResetKey,y=function(e,t){if("number"==typeof e)return"number"==typeof t?t:2}(f,l),v=Object(n.useElapsedTime)(i,{duration:y,onComplete:m,autoResetKey:b}),g=v.elapsedTime,O=v.reset;if(0===y&&"number"==typeof f)t=f;else if("number"==typeof f&&"number"==typeof y){t=function(e){return"function"==typeof e?e:o[e]}(d)(g<y?g:y,c,f-c,y)}else t=c+g;return{value:p(t,e),reset:O}},c=r(1),f=r.n(c),l=function(e,t){return e.replace(/\B(?=(\d{3})+(?!\d))/g,t)},s=function(e,t,r){return""+e+t+r},d=function(e){return(e.toString().split(".")[1]||"").length},p=function(e,t){var r=t.start,n=void 0===r?0:r,o=t.end,u=t.decimalPlaces,a=void 0===u?function(e,t){var r=d(e),n=d(t||1);return r>=n?r:n}(n,o):u,f=t.formatter,p=t.decimalSeparator,m=void 0===p?".":p,b=t.thousandsSeparator,y=void 0===b?"":b,v=t.prefix,g=void 0===v?"":v,O=t.suffix,S=void 0===O?"":O,j=t.shouldUseToLocaleString,x=void 0!==j&&j,h=t.toLocaleStringParams,T=t.fallbackPrefix,P=void 0===T?"":T,A=t.fallbackSuffix,C=void 0===A?"":A,R=Object(c.useMemo)((function(){return i()}),[]),M=function(){if(0===a){var t=Math.round(e).toString();return l(t,y)}var r=e.toFixed(a).split("."),n=r[0],o=r[1];return""+l(n,y)+m+o};if("function"==typeof f)return f(e);if(x){var _=function(e,t){return 0===t?Math.round(e):parseFloat(e.toFixed(t))}(e,a);if(void 0===h){var F=_.toLocaleString();return s(g,F,S)}if(R)try{var w=h.locale,L=h.options,q=_.toLocaleString(w,L);return s(g,q,S)}catch(e){console.error(e.message)}var E=M();return s(P,E,C)}var I=M();return s(g,I,S)},m=r(0),b=r.n(m),y=function(e){var t=e.children,r=a(e);return f.a.createElement(f.a.Fragment,null,"function"==typeof t?t(r):r.value)};y.displayName="CountUp",y.propTypes={isCounting:b.a.bool,start:b.a.number,end:b.a.number,duration:b.a.number,decimalPlaces:b.a.number,decimalSeparator:b.a.string,thousandsSeparator:b.a.string,prefix:b.a.string,suffix:b.a.string,shouldUseToLocaleString:b.a.bool,toLocaleStringParams:b.a.shape({locale:b.a.oneOfType([b.a.string,b.a.arrayOf(b.a.string)]),options:b.a.object}),fallbackPrefix:b.a.string,fallbackSuffix:b.a.string,autoResetKey:b.a.oneOfType([b.a.string,b.a.number]),easing:b.a.oneOfType([b.a.string,b.a.func]),onComplete:b.a.func,formatter:b.a.func,children:b.a.func}}]);
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react"),r=e(t),n=e(require("prop-types"));function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u=o(function(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}((function(e){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t){e.exports=r},function(e,t,r){r.r(t),r.d(t,"useElapsedTime",(function(){return i}));var n=r(0);function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,o=!1,u=void 0;try{for(var i,a=e[Symbol.iterator]();!(n=(i=a.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw u}}return r}}(e,t)||function(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.duration,u=t.onComplete,i=t.startAt,c=void 0===i?0:i,f=t.autoResetKey,l=Object(n.useState)(c),s=o(l,2),p=s[0],d=s[1],m=Object(n.useRef)(-1e3*c),y=Object(n.useRef)(null),b=Object(n.useRef)(null),v=Object(n.useRef)(null),g=Object(n.useRef)(!0),h=Object(n.useRef)(!1),O=Object(n.useRef)(0),S=Object(n.useCallback)((function(e){O.current+=1,d("number"==typeof e?e:c)}),[]),j=function e(t){var n=t/1e3;if(null===b.current)return b.current=n,void(y.current=requestAnimationFrame(e));var o=n-b.current;if(b.current=n,d((function(e){var t=e+o;return"number"!=typeof r||t<r?t:(h.current=!0,r)})),h.current){if("function"==typeof u){m.current+=1e3*r;var i=m.current/1e3,a=u(i)||{},c=a.shouldRepeat,f=void 0!==c&&c,l=a.delay,s=void 0===l?0:l,p=a.newStartAt;f&&(v.current=setTimeout((function(){S(p)}),1e3*s))}}else y.current=requestAnimationFrame(e)},x=function(){cancelAnimationFrame(y.current),clearTimeout(v.current),b.current=null};return a((function(){return e&&(y.current=requestAnimationFrame(j)),x}),[e]),a((function(){e&&!g.current&&(x(),y.current=requestAnimationFrame(j))}),[r]),a((function(){g.current||S()}),[f]),a((function(){e&&h.current&&(x(),y.current=requestAnimationFrame(j)),h.current=!1}),[O.current]),a((function(){g.current=!1}),[]),{elapsedTime:p,reset:S}},a="undefined"==typeof window?n.useEffect:n.useLayoutEffect}])}))),i={easeInCubic:function(e,t,r,n){return r*(e/=n)*e*e+t},easeOutCubic:function(e,t,r,n){return e/=n,r*(--e*e*e+1)+t},linear:function(e,t,r,n){return r*e/n+t}},a=i.easeOutCubic,c=function(){var e=function(){try{(0).toLocaleString("i")}catch(e){return"RangeError"===e.name}return!1}(),t=!("object"!=typeof Intl||!Intl||"function"!=typeof Intl.NumberFormat);return e&&t},f=function(e){var t,r=e.isCounting,n=void 0!==r&&r,o=e.start,c=void 0===o?0:o,f=e.end,l=e.duration,s=e.easing,p=void 0===s?a:s,m=e.onComplete,y=e.autoResetKey,b=function(e,t){if("number"==typeof e)return"number"==typeof t?t:2}(f,l),v=u.useElapsedTime(n,{duration:b,onComplete:m,autoResetKey:y}),g=v.elapsedTime,h=v.reset;if(0===b&&"number"==typeof f)t=f;else if("number"==typeof f&&"number"==typeof b){t=function(e){return"function"==typeof e?e:i[e]}(p)(g<b?g:b,c,f-c,b)}else t=c+g;return{value:d(t,e),reset:h}},l=function(e,t){return e.replace(/\B(?=(\d{3})+(?!\d))/g,t)},s=function(e,t,r){return""+e+t+r},p=function(e){return(e.toString().split(".")[1]||"").length},d=function(e,r){var n=r.start,o=void 0===n?0:n,u=r.end,i=r.decimalPlaces,a=void 0===i?function(e,t){var r=p(e),n=p(t||1);return r>=n?r:n}(o,u):i,f=r.formatter,d=r.decimalSeparator,m=void 0===d?".":d,y=r.thousandsSeparator,b=void 0===y?"":y,v=r.prefix,g=void 0===v?"":v,h=r.suffix,O=void 0===h?"":h,S=r.shouldUseToLocaleString,j=void 0!==S&&S,x=r.toLocaleStringParams,T=r.fallbackPrefix,A=void 0===T?"":T,C=r.fallbackSuffix,P=void 0===C?"":C,R=t.useMemo((function(){return c()}),[]),w=function(){if(0===a){var t=Math.round(e).toString();return l(t,b)}var r=e.toFixed(a).split("."),n=r[0],o=r[1];return""+l(n,b)+m+o};if("function"==typeof f)return f(e);if(j){var F=function(e,t){return 0===t?Math.round(e):parseFloat(e.toFixed(t))}(e,a);if(void 0===x){var M=F.toLocaleString();return s(g,M,O)}if(R)try{var _=x.locale,q=x.options,E=F.toLocaleString(_,q);return s(g,E,O)}catch(e){console.error(e.message)}var L=w();return s(A,L,P)}var I=w();return s(g,I,O)},m=function(e){var t=e.children,n=f(e);return r.createElement(r.Fragment,null,"function"==typeof t?t(n):n.value)};m.displayName="CountUp",m.propTypes={isCounting:n.bool,start:n.number,end:n.number,duration:n.number,decimalPlaces:n.number,decimalSeparator:n.string,thousandsSeparator:n.string,prefix:n.string,suffix:n.string,shouldUseToLocaleString:n.bool,toLocaleStringParams:n.shape({locale:n.oneOfType([n.string,n.arrayOf(n.string)]),options:n.object}),fallbackPrefix:n.string,fallbackSuffix:n.string,autoResetKey:n.oneOfType([n.string,n.number]),easing:n.oneOfType([n.string,n.func]),onComplete:n.func,formatter:n.func,children:n.func},exports.CountUp=m,exports.useCountUp=f;
//# sourceMappingURL=index.js.map

@@ -8,2 +8,2 @@ import { Easing } from '../types';

export declare const defaultEasing: (t: number, b: number, c: number, d: number) => number;
export declare const getEasing: (easing: Easing) => import("../types").EasingFn;
export declare const getEasing: (easing: Easing) => (t: number, b: number, c: number, d: number) => number;
{
"name": "use-count-up",
"version": "2.1.4",
"version": "2.2.4",
"description": "React/React Native component and hook to animate counting up or down to a number",
"main": "./lib/index.js",
"main": "lib/index.js",
"module": "lib/index.module.js",
"source": "src/index.ts",
"scripts": {
"build": "webpack",
"build": "rollup -c",
"prepublish": "yarn build",

@@ -20,2 +22,3 @@ "dev:push": "yarn build && yalc push",

"react",
"reactjs",
"react-native",

@@ -55,2 +58,4 @@ "animate-numerical-value",

"devDependencies": {
"@rollup/plugin-commonjs": "^13.0.0",
"@rollup/plugin-node-resolve": "^8.0.1",
"@testing-library/jest-dom": "^4.2.4",

@@ -66,3 +71,2 @@ "@testing-library/react": "^9.4.0",

"jest": "^25.2.1",
"path": "^0.12.7",
"prettier": "^1.19.1",

@@ -73,8 +77,9 @@ "prop-types": "15.7.1",

"react-test-renderer": "16.8.0",
"source-map-loader": "^0.2.4",
"rollup": "^2.15.0",
"rollup-plugin-peer-deps-external": "^2.2.2",
"rollup-plugin-terser": "^6.1.0",
"rollup-plugin-typescript2": "^0.27.1",
"ts-jest": "^25.2.1",
"ts-loader": "^6.2.1",
"typescript": "^3.8.3",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
"tslib": "^2.0.0",
"typescript": "^3.8.3"
},

@@ -81,0 +86,0 @@ "files": [

@@ -42,3 +42,4 @@ <div align="center">

&nbsp;:iphone:&nbsp; React Native support for iOS and Android
:zap: Built with TypeScript
:deciduous_tree: Tree-shakable (minified size further reduced by ~ 0.4kB when only the hook is used)
&nbsp;:file_cabinet: Server-side rendering (SSR) compatibility

@@ -45,0 +46,0 @@ ## Installation

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