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

map2tree

Package Overview
Dependencies
Maintainers
4
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

map2tree - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

lib/index.d.ts

49

package.json
{
"name": "map2tree",
"version": "3.0.0",
"version": "4.0.0",
"description": "Utility for mapping maps to trees",

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

],
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"types": "lib/types/index.d.ts",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"type": "module",
"sideEffects": false,

@@ -32,35 +32,26 @@ "repository": {

"dependencies": {
"@babel/runtime": "^7.20.6",
"lodash": "^4.17.21"
"lodash-es": "^4.17.21"
},
"devDependencies": {
"@babel/cli": "^7.19.3",
"@babel/core": "^7.20.5",
"@babel/eslint-parser": "^7.19.1",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@types/jest": "^29.2.4",
"@types/lodash": "^4.14.191",
"@typescript-eslint/eslint-plugin": "^5.47.0",
"@typescript-eslint/parser": "^5.47.0",
"eslint": "^8.30.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^27.1.7",
"immutable": "^4.1.0",
"jest": "^29.3.1",
"rimraf": "^3.0.2",
"ts-jest": "^29.0.3",
"typescript": "~4.9.4"
"@types/jest": "^29.5.12",
"@types/lodash-es": "^4.17.12",
"@typescript-eslint/eslint-plugin": "^7.4.0",
"@typescript-eslint/parser": "^7.4.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^27.9.0",
"immutable": "^4.3.5",
"jest": "^29.7.0",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.2",
"typescript": "~5.3.3"
},
"scripts": {
"build": "pnpm run build:cjs && pnpm run build:esm && pnpm run build:types",
"build:cjs": "babel src --extensions \".ts\" --out-dir lib/cjs",
"build:esm": "babel src --config-file ./babel.config.esm.json --extensions \".ts\" --out-dir lib/esm",
"build:types": "tsc --emitDeclarationOnly",
"build": "tsc",
"clean": "rimraf lib",
"test": "jest",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"lint": "eslint . --ext .ts",
"type-check": "tsc --noEmit",
"prepublish": "pnpm run type-check && pnpm run lint && pnpm run test"
"prepublish": "pnpm run lint && pnpm run test"
}
}

@@ -16,3 +16,3 @@ A pure function to convert a map into a tree structure. Created by [@romseguy](https://github.com/romseguy) and merged from [`romseguy/map2tree`](https://github.com/romseguy/map2tree).

pushMethod: 'push', // use 'unshift' to change the order children nodes are added
})
}),
);

@@ -19,0 +19,0 @@ ```

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

import isArray from 'lodash/isArray';
import isPlainObject from 'lodash/isPlainObject';
import mapValues from 'lodash/mapValues';
import { isArray, isPlainObject, mapValues } from 'lodash-es';

@@ -15,3 +13,3 @@ export interface Node {

visitFn: (parent: Node) => void,
childrenFn: (parent: Node) => Node[] | undefined | null
childrenFn: (parent: Node) => Node[] | undefined | null,
) {

@@ -41,3 +39,3 @@ if (!parent) return;

},
(d) => d.children
(d) => d.children,
);

@@ -51,3 +49,3 @@

options: { key?: string; pushMethod?: 'push' | 'unshift' } = {},
tree: Node = { name: options.key || 'state', children: [] }
tree: Node = { name: options.key || 'state', children: [] },
// eslint-disable-next-line @typescript-eslint/ban-types

@@ -100,3 +98,3 @@ ): Node | {} {

map2tree(value, { key, pushMethod }, tree);
}
},
);

@@ -103,0 +101,0 @@

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