Commit 85064870 authored by 张九刚's avatar 张九刚

素材分页面

parent 198a0e11
{ {
"name": "psd-parse-web", "name": "psd-parse-web",
"version": "1.0.4", "version": "2.0.0",
"main": "src/index.js", "main": "src/index.js",
"module": "dist/index.es.js", "module": "dist/index.es.js",
"license": "MIT", "license": "MIT",
......
This diff is collapsed.
/**
* Created by rockyl on 2019-08-10.
*/
async function walkNode(node, callback, includeSelf = false) { async function walkNode(node, callback) {
if (includeSelf) {
await callback(node, null);
}
if (node.children && node.children.length > 0) { if (node.children && node.children.length > 0) {
for (let childNode of node.children) { for (let childNode of node.children) {
await callback(childNode, node); await callback(childNode, node);
...@@ -18,7 +12,7 @@ async function walkNode(node, callback, includeSelf = false) { ...@@ -18,7 +12,7 @@ async function walkNode(node, callback, includeSelf = false) {
} }
async function walkObject(obj, callback) { async function walkObject(obj, callback) {
if(typeof obj === "object"){ if (typeof obj === "object") {
for (let key of Object.keys(obj)) { for (let key of Object.keys(obj)) {
const value = obj[key]; const value = obj[key];
await callback(key, value, obj); await callback(key, value, obj);
...@@ -29,7 +23,7 @@ async function walkObject(obj, callback) { ...@@ -29,7 +23,7 @@ async function walkObject(obj, callback) {
} }
} }
} }
module.exports={ module.exports = {
walkNode, walkNode,
walkObject walkObject
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment