json-crawl
Advanced tools
Comparing version 0.2.6 to 0.3.0
{ | ||
"name": "json-crawl", | ||
"version": "0.2.6", | ||
"version": "0.3.0", | ||
"description": "Async and sync crawler for json object", | ||
"module": "dist/esm/index.js", | ||
"main": "dist/cjs/index.js", | ||
"types": "dist/cjs/index.d.ts", | ||
"module": "dist/index.mjs", | ||
"main": "dist/index.cjs", | ||
"browser": "dist/index.iife.js", | ||
"typings": "dist/index.d.ts", | ||
"files": [ | ||
"dist", | ||
"browser" | ||
"dist" | ||
], | ||
"browser": { | ||
"./dist/cjs/index.js": "./browser/json-crawl.umd.js" | ||
}, | ||
"exports": { | ||
".": { | ||
"import": "./browser/json-crawl.es.js", | ||
"require": "./browser/json-crawl.umd.js" | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.cjs" | ||
} | ||
}, | ||
"scripts": { | ||
"build": "tsc && tsc --module commonjs --outDir dist/cjs && vite build", | ||
"test": "jest --verbose --runInBand", | ||
"prepublish": "rm -r dist || true && npm run build && npm run test", | ||
"test:coverage": "jest --verbose --coverage", | ||
"build:web": "vite build" | ||
"prebuild": "rimraf ./dist", | ||
"build": "rollup -c", | ||
"test": "jest --verbose", | ||
"test:coverage": "jest --verbose --coverage" | ||
}, | ||
@@ -39,11 +35,19 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/jest": "^26.0.0", | ||
"@rollup/plugin-babel": "^6.0.4", | ||
"@rollup/plugin-commonjs": "^25.0.7", | ||
"@rollup/plugin-json": "^6.0.1", | ||
"@rollup/plugin-node-resolve": "^15.2.3", | ||
"@rollup/plugin-terser": "^0.4.4", | ||
"@rollup/plugin-typescript": "^11.1.5", | ||
"@types/jest": "^29.5.2", | ||
"@types/node": "^18.0.0", | ||
"jest": "^26.0.1", | ||
"ts-jest": "^26.1.0", | ||
"rimraf": "^5.0.5", | ||
"rollup": "^2.79.1", | ||
"rollup-plugin-filesize": "^9.1.0", | ||
"rollup-plugin-progress": "^1.1.2", | ||
"jest": "^29.5.2", | ||
"ts-jest": "^29.1.0", | ||
"ts-node": "^10.7.0", | ||
"tslint": "^6.1.2", | ||
"typescript": "^4.6.2", | ||
"vite": "^4.0.1", | ||
"vite-plugin-dts": "^2.0.2" | ||
"typescript": "^5.1.3" | ||
}, | ||
@@ -50,0 +54,0 @@ "engines": { |
@@ -6,3 +6,2 @@ # json-crawl | ||
## Purpose | ||
@@ -38,6 +37,15 @@ | ||
const hooks = [ | ||
(value, { path, key, state }) => { | ||
({ value, path, key, state, rules }) => { | ||
// Custom logic for each node | ||
// Modify value, state, or perform any desired operations | ||
return { value, state } | ||
return { | ||
value: newValue, // updated value of current node for next crawl steps | ||
state: newState, // updated state for next crawl step | ||
rules: newRules // updated rules for next crawl step | ||
exitHook, // on exit hook for current node | ||
terminate: true, // crawl should be terminated | ||
done: true // crawl of current node should be terminated | ||
} | ||
// return void - if no operations are required | ||
}, | ||
@@ -48,8 +56,8 @@ // Array of hooks for custom operations during cloning | ||
const params = { | ||
state: { | ||
state?: { | ||
// Initial state object for hooks (optional) | ||
}, | ||
rules: { | ||
// Crawl rules map | ||
rules?: { | ||
// Crawl rules map (optional) | ||
} | ||
@@ -56,0 +64,0 @@ }; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
79
82851
17
17
137
1