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

@semantic-ui/reactivity

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@semantic-ui/reactivity - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

10

package.json
{
"name": "@semantic-ui/reactivity",
"version": "0.0.1",
"version": "0.0.2",
"type": "module",

@@ -9,2 +9,10 @@ "main": "src/index.js",

"license": "ISC",
"scripts": {
"publish": "wireit"
},
"wireit": {
"publish": {
"command": "npm publish"
}
},
"dependencies": {

@@ -11,0 +19,0 @@ "@semantic-ui/utils": "^0.0.1"

@@ -24,2 +24,3 @@ # @semantic-ui/reactivity

- [Helper Functions](#helper-functions)
* [Number Helpers](#numbers)
* [Array Mutation Helpers](#array-mutation-helpers)

@@ -361,2 +362,37 @@ * [Array of Objects](#array-of-objects)

### Numbers
`ReactiveVar` includes a couple helpers numbers
```javascript
let count = new ReactiveVar(0);
count.increment(); // set to 1
```
```javascript
let count = new ReactiveVar(0);
count.increment(2); // set to 2
```
```javascript
let count = new ReactiveVar(2);
count.decrement(); // set to 1
```
```javascript
let count = new ReactiveVar(0);
count.decrement(2); // set to 1
```
### Date
`ReactiveVar` includes a helper to make dates asier
```javascript
let date = new ReactiveVar(new Date()); // initializes as now
setTimeout(() => {
date.now(); // now 1 second later
}, 1000);
```
### Array Mutation Helpers

@@ -368,15 +404,15 @@

let items = new ReactiveVar([0,1,2]);
tpl.items.removeIndex(1); // outputs 0, 2
items.removeIndex(1); // outputs 0, 2
```
```javascript
let items = new ReactiveVar([0,2,2]);
tpl.items.setIndex(1); // outputs 0, 1, 2
items.setIndex(1); // outputs 0, 1, 2
```
```javascript
let items = new ReactiveVar([0,1,2]);
tpl.items.unshift(); // outputs 1, 2
items.unshift(); // outputs 1, 2
```
```javascript
let items = new ReactiveVar([0,1,2]);
tpl.items.push(3); // outputs 0, 1, 2, 3
items.push(3); // outputs 0, 1, 2, 3
```

@@ -383,0 +419,0 @@

6

src/index.js

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

import { ReactiveVar } from './reactive-var';
import { Reaction } from './reaction';
import { Dependency } from './dependency';
import { ReactiveVar } from './reactive-var.js';
import { Reaction } from './reaction.js';
import { Dependency } from './dependency.js';

@@ -5,0 +5,0 @@ export {

@@ -117,2 +117,13 @@ import { clone, isObject, isEqual, wrapFunction, findIndex, unique, isNumber } from '@semantic-ui/utils';

increment(amount = 1) {
return this.set(this.value + amount);
}
decrement(amount = 1) {
return this.set(this.value - amount);
}
now() {
return this.set(new Date());
}
getIDs(item) {

@@ -119,0 +130,0 @@ if(isObject(item)) {

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