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

mobx-keystone

Package Overview
Dependencies
Maintainers
1
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mobx-keystone - npm Package Compare versions

Comparing version 0.60.1 to 0.60.2

4

CHANGELOG.md
# Change Log
## 0.60.2
- Added `swap` to array actions.
## 0.60.1

@@ -4,0 +8,0 @@

3

dist/standardActions/arrayActions.d.ts

@@ -16,3 +16,4 @@ export declare const arrayActions: {

unshift: <T_14>(array: T_14[], ...items: T_14[]) => number;
create: <T_15>(data: T_15[]) => T_15[];
swap: <T_15>(array: T_15[], index1: number, index2: number) => boolean;
create: <T_16>(data: T_16[]) => T_16[];
};
{
"name": "mobx-keystone",
"version": "0.60.1",
"version": "0.60.2",
"description": "A MobX powered state management solution based on data trees with first class support for Typescript, snapshots, patches and much more",

@@ -5,0 +5,0 @@ "keywords": [

@@ -88,3 +88,22 @@ import { remove, set } from "mobx"

swap: standaloneAction(
`${namespace}::swap`,
<T>(array: T[], index1: number, index2: number): boolean => {
if (index1 < 0 || index2 < 0 || index1 >= array.length || index2 >= array.length) {
return false
}
if (index2 < index1) {
;[index1, index2] = [index2, index1]
}
// since a same node cannot be in two places at once we will remove
// both then reinsert them
const [v1] = array.splice(index1, 1)
const [v2] = array.splice(index2 - 1, 1)
array.splice(index1, 0, v2)
array.splice(index2, 0, v1)
return true
}
),
create: <T>(data: T[]): T[] => toTreeNode(data),
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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