New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-countup

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-countup - npm Package Compare versions

Comparing version 4.0.0-alpha.2 to 4.0.0-alpha.3

24

build/index.js

@@ -93,9 +93,18 @@ 'use strict';

var _this$props2 = _this.props,
delay = _this$props2.delay,
onEnd = _this$props2.onEnd,
onStart = _this$props2.onStart;
var run = function run() {
return _this.instance.start(function () {
return onEnd({ pauseResume: pauseResume, reset: reset, start: start, update: update });
});
};
_this.instance.start(function () {
return onEnd({ pauseResume: pauseResume, reset: reset, start: start, update: update });
});
// Delay start if delay prop is properly set
if (delay > 0) {
setTimeout(run, delay * 1000);
} else {
run();
}

@@ -126,10 +135,5 @@ onStart({ pauseResume: pauseResume, reset: reset, update: update });

// Delay start if delay prop is properly set
if (delay > 0) return setTimeout(this.start, delay * 1000);
// Don't invoke start if component is used as a render prop
if (typeof children === 'function') return;
// Don't invoke start if:
// - component is used as a render prop
// - and has a delay set
if (typeof children === 'function' && delay === null) return;
// Otherwise just start immediately

@@ -136,0 +140,0 @@ this.start();

{
"name": "react-countup",
"version": "4.0.0-alpha.2",
"version": "4.0.0-alpha.3",
"description": "A React component wrapper around CountUp.js",

@@ -5,0 +5,0 @@ "author": "Glenn Reyes <glenn@glennreyes.com> (https://twitter.com/glnnrys)",

@@ -21,3 +21,4 @@ # [React CountUp](https://react-countup.now.sh)

- [More examples](#more-examples)
- [Manually start](#manually-start)
- [Manually start with render prop](#manually-start-with-render-prop)
- [Autostart with render prop](#autostart-with-render-prop)
- [Delay start](#delay-start)

@@ -105,2 +106,15 @@ - [API](#api)

#### Manually start with render prop
```js
<CountUp start={0} end={100}>
{({ countUpRef, start }) => (
<div>
<span ref={countUpRef} />
<button onClick={start}>Start</button>
</div>
)}
</CountUp>
```
#### Autostart with render prop

@@ -107,0 +121,0 @@

@@ -50,10 +50,5 @@ import Count from 'countup.js';

// Delay start if delay prop is properly set
if (delay > 0) return setTimeout(this.start, delay * 1000);
// Don't invoke start if component is used as a render prop
if (typeof children === 'function') return;
// Don't invoke start if:
// - component is used as a render prop
// - and has a delay set
if (typeof children === 'function' && delay === null) return;
// Otherwise just start immediately

@@ -158,5 +153,12 @@ this.start();

const { pauseResume, reset, restart: start, update } = this;
const { onEnd, onStart } = this.props;
const { delay, onEnd, onStart } = this.props;
const run = () =>
this.instance.start(() => onEnd({ pauseResume, reset, start, update }));
this.instance.start(() => onEnd({ pauseResume, reset, start, update }));
// Delay start if delay prop is properly set
if (delay > 0) {
setTimeout(run, delay * 1000);
} else {
run();
}

@@ -163,0 +165,0 @@ onStart({ pauseResume, reset, update });

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