@zhengxs/js.tree
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -1,6 +0,9 @@ | ||
# [0.4.0](https://github.com/zhengxs2018/js.tree/compare/v0.3.0...v0.4.0) (2021-07-12) | ||
# CHANGELOG | ||
## [0.5.0](https://github.com/zhengxs2018/js.tree/compare/v0.3.0...v0.5.0) (2022-07-28) | ||
### Features | ||
* **operators:** 添加 repairWith 方法 ([a361756](https://github.com/zhengxs2018/js.tree/commit/a361756b8309e819951f7c6447728cb61b574ff8)) | ||
* 优先从转换后的数据中获取 id ([70ff07c](https://github.com/zhengxs2018/js.tree/commit/70ff07cfffbe739b7fda2cd7b6bdd9efc4efc69f)) | ||
@@ -10,3 +13,3 @@ | ||
# [0.3.0](https://github.com/zhengxs2018/js.tree/compare/v0.2.0...v0.3.0) (2021-06-14) | ||
## [0.3.0](https://github.com/zhengxs2018/js.tree/compare/v0.2.0...v0.3.0) (2021-06-14) | ||
@@ -20,3 +23,3 @@ | ||
# [0.2.0](https://github.com/zhengxs2018/js.tree/compare/v0.1.1...v0.2.0) (2021-05-19) | ||
## [0.2.0](https://github.com/zhengxs2018/js.tree/compare/v0.1.1...v0.2.0) (2021-05-19) | ||
@@ -23,0 +26,0 @@ |
@@ -6,2 +6,3 @@ export type { ID, None, Row, Node, Exporter, Transform, Predicate } from './types'; | ||
export { exclude } from './operators/exclude'; | ||
export { repairWith } from './operators/repairWith'; | ||
export { toTree } from './transform/toTree'; | ||
@@ -19,3 +20,3 @@ export type { ToTreeOptions } from './transform/toTree'; | ||
*/ | ||
export declare const version = "0.4.0"; | ||
export declare const version = "0.5.0"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -170,3 +170,56 @@ 'use strict'; | ||
const resolveRepairWithOptions = ({ idKey = ID_KEY, parentKey = PARENT_ID_KEY, childrenKey = CHILDREN_KEY, resolve, insert = (list, node) => list.push(node), }) => ({ | ||
idKey, | ||
parentKey, | ||
childrenKey, | ||
resolve, | ||
insert, | ||
}); | ||
/** | ||
* 根据列表修复缺失的节点数据 | ||
* | ||
* @param list - 不完整列表数据 | ||
* @param config - 配置参数 | ||
* @returns 已修复好的数结构 | ||
*/ | ||
const repairWith = (list, config) => { | ||
const { idKey, parentKey, childrenKey, resolve, insert } = resolveRepairWithOptions(config); | ||
const rootNodes = []; | ||
const parents = {}; | ||
const createNode = (data) => { | ||
const children = []; | ||
const current = Object.assign(Object.assign({}, data), { [childrenKey]: children }); | ||
parents[data[idKey]] = current; | ||
return current; | ||
}; | ||
const repairNodeLinks = (current) => { | ||
const parentId = current[parentKey]; | ||
const parent = parents[parentId]; | ||
// 查找本地是否存在上级 | ||
if (parent) { | ||
insert(parent[childrenKey], current); | ||
return; | ||
} | ||
// 查找外部是存在上级 | ||
const data = resolve(parentId); | ||
if (!data) { | ||
insert(rootNodes, current); | ||
return; | ||
} | ||
const target = createNode(data); | ||
// 插入当前节点 | ||
insert(target[childrenKey], current); | ||
// 继续向上修复 | ||
repairNodeLinks(target); | ||
}; | ||
list.forEach((item) => { | ||
const data = resolve(item[idKey]); | ||
if (!data) | ||
return; | ||
repairNodeLinks(createNode(data)); | ||
}); | ||
return rootNodes; | ||
}; | ||
/** | ||
* 和 isNil 结果相反 | ||
@@ -510,3 +563,3 @@ * | ||
*/ | ||
const version = '0.4.0'; | ||
const version = '0.5.0'; | ||
@@ -523,4 +576,5 @@ exports.CHILDREN_KEY = CHILDREN_KEY; | ||
exports.parse = parse; | ||
exports.repairWith = repairWith; | ||
exports.toRows = toRows; | ||
exports.toTree = toTree; | ||
exports.version = version; |
@@ -138,3 +138,56 @@ 'use strict'; | ||
const resolveRepairWithOptions = ({ idKey = ID_KEY, parentKey = PARENT_ID_KEY, childrenKey = CHILDREN_KEY, resolve, insert = (list, node) => list.push(node), }) => ({ | ||
idKey, | ||
parentKey, | ||
childrenKey, | ||
resolve, | ||
insert, | ||
}); | ||
/** | ||
* 根据列表修复缺失的节点数据 | ||
* | ||
* @param list - 不完整列表数据 | ||
* @param config - 配置参数 | ||
* @returns 已修复好的数结构 | ||
*/ | ||
const repairWith = (list, config) => { | ||
const { idKey, parentKey, childrenKey, resolve, insert } = resolveRepairWithOptions(config); | ||
const rootNodes = []; | ||
const parents = {}; | ||
const createNode = (data) => { | ||
const children = []; | ||
const current = Object.assign(Object.assign({}, data), { [childrenKey]: children }); | ||
parents[data[idKey]] = current; | ||
return current; | ||
}; | ||
const repairNodeLinks = (current) => { | ||
const parentId = current[parentKey]; | ||
const parent = parents[parentId]; | ||
// 查找本地是否存在上级 | ||
if (parent) { | ||
insert(parent[childrenKey], current); | ||
return; | ||
} | ||
// 查找外部是存在上级 | ||
const data = resolve(parentId); | ||
if (!data) { | ||
insert(rootNodes, current); | ||
return; | ||
} | ||
const target = createNode(data); | ||
// 插入当前节点 | ||
insert(target[childrenKey], current); | ||
// 继续向上修复 | ||
repairNodeLinks(target); | ||
}; | ||
list.forEach((item) => { | ||
const data = resolve(item[idKey]); | ||
if (!data) | ||
return; | ||
repairNodeLinks(createNode(data)); | ||
}); | ||
return rootNodes; | ||
}; | ||
/** | ||
* 和 isNil 结果相反 | ||
@@ -478,3 +531,3 @@ * | ||
*/ | ||
const version = '0.4.0'; | ||
const version = '0.5.0'; | ||
@@ -491,4 +544,5 @@ exports.CHILDREN_KEY = CHILDREN_KEY; | ||
exports.parse = parse; | ||
exports.repairWith = repairWith; | ||
exports.toRows = toRows; | ||
exports.toTree = toTree; | ||
exports.version = version; |
@@ -158,2 +158,19 @@ | ||
/** | ||
* 根据列表修复缺失的节点数据 | ||
* | ||
* @param list - 不完整列表数据 | ||
* @param config - 配置参数 | ||
* @returns 已修复好的数结构 | ||
*/ | ||
export declare const repairWith: <T extends Row = Row, U extends Node_2 = Node_2>(list: T[], config: RepairWithConfig<T, U>) => U[]; | ||
declare type RepairWithConfig<T extends Row = Row, U extends Node_2 = Node_2> = { | ||
idKey?: string; | ||
parentKey?: string; | ||
childrenKey?: string; | ||
resolve: (id: ID) => T; | ||
insert?: (list: U[], node: U) => void; | ||
}; | ||
/** | ||
* 根ID | ||
@@ -170,3 +187,3 @@ * | ||
*/ | ||
export declare type Row = Record<string | number, unknown>; | ||
export declare type Row = Record<string | number | symbol, unknown>; | ||
@@ -398,4 +415,4 @@ /** | ||
*/ | ||
export declare const version = "0.4.0"; | ||
export declare const version = "0.6.0"; | ||
export { } |
@@ -166,3 +166,56 @@ /** | ||
const resolveRepairWithOptions = ({ idKey = ID_KEY, parentKey = PARENT_ID_KEY, childrenKey = CHILDREN_KEY, resolve, insert = (list, node) => list.push(node), }) => ({ | ||
idKey, | ||
parentKey, | ||
childrenKey, | ||
resolve, | ||
insert, | ||
}); | ||
/** | ||
* 根据列表修复缺失的节点数据 | ||
* | ||
* @param list - 不完整列表数据 | ||
* @param config - 配置参数 | ||
* @returns 已修复好的数结构 | ||
*/ | ||
const repairWith = (list, config) => { | ||
const { idKey, parentKey, childrenKey, resolve, insert } = resolveRepairWithOptions(config); | ||
const rootNodes = []; | ||
const parents = {}; | ||
const createNode = (data) => { | ||
const children = []; | ||
const current = Object.assign(Object.assign({}, data), { [childrenKey]: children }); | ||
parents[data[idKey]] = current; | ||
return current; | ||
}; | ||
const repairNodeLinks = (current) => { | ||
const parentId = current[parentKey]; | ||
const parent = parents[parentId]; | ||
// 查找本地是否存在上级 | ||
if (parent) { | ||
insert(parent[childrenKey], current); | ||
return; | ||
} | ||
// 查找外部是存在上级 | ||
const data = resolve(parentId); | ||
if (!data) { | ||
insert(rootNodes, current); | ||
return; | ||
} | ||
const target = createNode(data); | ||
// 插入当前节点 | ||
insert(target[childrenKey], current); | ||
// 继续向上修复 | ||
repairNodeLinks(target); | ||
}; | ||
list.forEach((item) => { | ||
const data = resolve(item[idKey]); | ||
if (!data) | ||
return; | ||
repairNodeLinks(createNode(data)); | ||
}); | ||
return rootNodes; | ||
}; | ||
/** | ||
* 和 isNil 结果相反 | ||
@@ -506,4 +559,4 @@ * | ||
*/ | ||
const version = '0.4.0'; | ||
const version = '0.5.0'; | ||
export { CHILDREN_KEY, ID_KEY, PARENT_ID_KEY, ROOT_ID, each, exclude, exporter, filter, map, parse, toRows, toTree, version }; | ||
export { CHILDREN_KEY, ID_KEY, PARENT_ID_KEY, ROOT_ID, each, exclude, exporter, filter, map, parse, repairWith, toRows, toTree, version }; |
@@ -134,3 +134,56 @@ import { defaultTo, isNil, get } from 'lodash-es'; | ||
const resolveRepairWithOptions = ({ idKey = ID_KEY, parentKey = PARENT_ID_KEY, childrenKey = CHILDREN_KEY, resolve, insert = (list, node) => list.push(node), }) => ({ | ||
idKey, | ||
parentKey, | ||
childrenKey, | ||
resolve, | ||
insert, | ||
}); | ||
/** | ||
* 根据列表修复缺失的节点数据 | ||
* | ||
* @param list - 不完整列表数据 | ||
* @param config - 配置参数 | ||
* @returns 已修复好的数结构 | ||
*/ | ||
const repairWith = (list, config) => { | ||
const { idKey, parentKey, childrenKey, resolve, insert } = resolveRepairWithOptions(config); | ||
const rootNodes = []; | ||
const parents = {}; | ||
const createNode = (data) => { | ||
const children = []; | ||
const current = Object.assign(Object.assign({}, data), { [childrenKey]: children }); | ||
parents[data[idKey]] = current; | ||
return current; | ||
}; | ||
const repairNodeLinks = (current) => { | ||
const parentId = current[parentKey]; | ||
const parent = parents[parentId]; | ||
// 查找本地是否存在上级 | ||
if (parent) { | ||
insert(parent[childrenKey], current); | ||
return; | ||
} | ||
// 查找外部是存在上级 | ||
const data = resolve(parentId); | ||
if (!data) { | ||
insert(rootNodes, current); | ||
return; | ||
} | ||
const target = createNode(data); | ||
// 插入当前节点 | ||
insert(target[childrenKey], current); | ||
// 继续向上修复 | ||
repairNodeLinks(target); | ||
}; | ||
list.forEach((item) => { | ||
const data = resolve(item[idKey]); | ||
if (!data) | ||
return; | ||
repairNodeLinks(createNode(data)); | ||
}); | ||
return rootNodes; | ||
}; | ||
/** | ||
* 和 isNil 结果相反 | ||
@@ -474,4 +527,4 @@ * | ||
*/ | ||
const version = '0.4.0'; | ||
const version = '0.5.0'; | ||
export { CHILDREN_KEY, ID_KEY, PARENT_ID_KEY, ROOT_ID, each, exclude, exporter, filter, map, parse, toRows, toTree, version }; | ||
export { CHILDREN_KEY, ID_KEY, PARENT_ID_KEY, ROOT_ID, each, exclude, exporter, filter, map, parse, repairWith, toRows, toTree, version }; |
@@ -134,3 +134,56 @@ import { defaultTo, isNil, get } from 'lodash'; | ||
const resolveRepairWithOptions = ({ idKey = ID_KEY, parentKey = PARENT_ID_KEY, childrenKey = CHILDREN_KEY, resolve, insert = (list, node) => list.push(node), }) => ({ | ||
idKey, | ||
parentKey, | ||
childrenKey, | ||
resolve, | ||
insert, | ||
}); | ||
/** | ||
* 根据列表修复缺失的节点数据 | ||
* | ||
* @param list - 不完整列表数据 | ||
* @param config - 配置参数 | ||
* @returns 已修复好的数结构 | ||
*/ | ||
const repairWith = (list, config) => { | ||
const { idKey, parentKey, childrenKey, resolve, insert } = resolveRepairWithOptions(config); | ||
const rootNodes = []; | ||
const parents = {}; | ||
const createNode = (data) => { | ||
const children = []; | ||
const current = Object.assign(Object.assign({}, data), { [childrenKey]: children }); | ||
parents[data[idKey]] = current; | ||
return current; | ||
}; | ||
const repairNodeLinks = (current) => { | ||
const parentId = current[parentKey]; | ||
const parent = parents[parentId]; | ||
// 查找本地是否存在上级 | ||
if (parent) { | ||
insert(parent[childrenKey], current); | ||
return; | ||
} | ||
// 查找外部是存在上级 | ||
const data = resolve(parentId); | ||
if (!data) { | ||
insert(rootNodes, current); | ||
return; | ||
} | ||
const target = createNode(data); | ||
// 插入当前节点 | ||
insert(target[childrenKey], current); | ||
// 继续向上修复 | ||
repairNodeLinks(target); | ||
}; | ||
list.forEach((item) => { | ||
const data = resolve(item[idKey]); | ||
if (!data) | ||
return; | ||
repairNodeLinks(createNode(data)); | ||
}); | ||
return rootNodes; | ||
}; | ||
/** | ||
* 和 isNil 结果相反 | ||
@@ -474,4 +527,4 @@ * | ||
*/ | ||
const version = '0.4.0'; | ||
const version = '0.5.0'; | ||
export { CHILDREN_KEY, ID_KEY, PARENT_ID_KEY, ROOT_ID, each, exclude, exporter, filter, map, parse, toRows, toTree, version }; | ||
export { CHILDREN_KEY, ID_KEY, PARENT_ID_KEY, ROOT_ID, each, exclude, exporter, filter, map, parse, repairWith, toRows, toTree, version }; |
@@ -123,2 +123,48 @@ (function (global, factory) { | ||
var resolveRepairWithOptions = function (_a) { | ||
var _b = _a.idKey, idKey = _b === void 0 ? ID_KEY : _b, _c = _a.parentKey, parentKey = _c === void 0 ? PARENT_ID_KEY : _c, _d = _a.childrenKey, childrenKey = _d === void 0 ? CHILDREN_KEY : _d, resolve = _a.resolve, _e = _a.insert, insert = _e === void 0 ? function (list, node) { return list.push(node); } : _e; | ||
return ({ | ||
idKey: idKey, | ||
parentKey: parentKey, | ||
childrenKey: childrenKey, | ||
resolve: resolve, | ||
insert: insert, | ||
}); | ||
}; | ||
var repairWith = function (list, config) { | ||
var _a = resolveRepairWithOptions(config), idKey = _a.idKey, parentKey = _a.parentKey, childrenKey = _a.childrenKey, resolve = _a.resolve, insert = _a.insert; | ||
var rootNodes = []; | ||
var parents = {}; | ||
var createNode = function (data) { | ||
var _a; | ||
var children = []; | ||
var current = __assign(__assign({}, data), (_a = {}, _a[childrenKey] = children, _a)); | ||
parents[data[idKey]] = current; | ||
return current; | ||
}; | ||
var repairNodeLinks = function (current) { | ||
var parentId = current[parentKey]; | ||
var parent = parents[parentId]; | ||
if (parent) { | ||
insert(parent[childrenKey], current); | ||
return; | ||
} | ||
var data = resolve(parentId); | ||
if (!data) { | ||
insert(rootNodes, current); | ||
return; | ||
} | ||
var target = createNode(data); | ||
insert(target[childrenKey], current); | ||
repairNodeLinks(target); | ||
}; | ||
list.forEach(function (item) { | ||
var data = resolve(item[idKey]); | ||
if (!data) | ||
return; | ||
repairNodeLinks(createNode(data)); | ||
}); | ||
return rootNodes; | ||
}; | ||
function isNotNil(value) { | ||
@@ -211,3 +257,3 @@ return isNil(value) === false; | ||
var version = '0.4.0'; | ||
var version = '0.5.0'; | ||
@@ -224,2 +270,3 @@ exports.CHILDREN_KEY = CHILDREN_KEY; | ||
exports.parse = parse; | ||
exports.repairWith = repairWith; | ||
exports.toRows = toRows; | ||
@@ -226,0 +273,0 @@ exports.toTree = toTree; |
@@ -15,3 +15,3 @@ !function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((n="undefined"!=typeof globalThis?globalThis:n||self).jsTree={})}(this,(function(n){"use strict"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var r=function(){return(r=Object.assign||function(n){for(var r,e=1,t=arguments.length;e<t;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o]);return n}).apply(this,arguments)};function e(n){return null==n}function t(n,r){return e(n)?r:n}function o(n,r,e){return t(n[r],e)}var i="__root__",u="parentId",f="children";function c(n,r){var e=n.childNodes;return"function"==typeof r?r(e,n)||[]:e[t(r,i)]||[]}function a(n,r){void 0===r&&(r={});var o=t(r.idKey,"id"),c=t(r.parentKey,u),a=t(r.childrenKey,f),s=t(r.transform,(function(n){return n})),h=t(r.insert,(function(n,r){return n.push(r)})),v={},l={};return n.forEach((function(n,r){var u=s(n,r);if(!e(u)){var f,p=d(u,n,o);!function(n,r){if(!n){if(r instanceof Error)throw r;throw new Error(r)}}((f=p,!1===e(f)),"id is required, in "+r+".");var y=l[p];y?u[a]=y:l[p]=u[a]=[];var E=t(d(u,n,c),i),_=l[E];h(_||(l[E]=[]),u),v[p]=u}})),{idKey:o,parentKey:c,childrenKey:a,nodes:v,childNodes:l}}function d(n,r,t){var i=o(n,t);return e(i)?o(r,t):i}n.CHILDREN_KEY=f,n.ID_KEY="id",n.PARENT_ID_KEY=u,n.ROOT_ID=i,n.each=function(n,r,e){return void 0===e&&(e=f),function n(o,i){return o.forEach((function(o,u){r(o,u,i)||n(t(o[e],[]),i.concat(o))})),[]}(n,[])},n.exclude=function(n,e,o){return void 0===o&&(o=f),function n(i,u){var f=[];return i.forEach((function(i,c){var a;if(!e(i,c,u)){var d=t(i[o],[]);if(0!==d.length){var s=n(d,u.concat(i));s.length>0&&f.push(r(r({},i),((a={})[o]=s,a)))}else f.push(i)}})),f}(n,[])},n.exporter=c,n.filter=function(n,e,o){return void 0===o&&(o=f),function n(i,u){var f=[];return i.forEach((function(i,c){var a;if(e(i,c,u))f.push(r({},i));else{var d=n(t(i[o],[]),u.concat(i));d.length>0&&f.push(r(r({},i),((a={})[o]=d,a)))}})),f}(n,[])},n.map=function(n,e,o){return void 0===o&&(o=f),function n(i,u){return i.map((function(i,f){var c,a=e(r({},i),f,u),d=n(t(a[o],[]),u.concat(i));return d.length>0?r(r({},a),((c={})[o]=d,c)):a}))}(n,[])},n.parse=a,n.toRows=function(n,e){void 0===e&&(e=f);var o=[];return n.forEach((function n(i){var u,f,c,a,d=r({},i),s=(c=[],a=(u=d)[f=e],delete u[f],t(a,c));o.push(d),s.forEach(n)})),o},n.toTree=function(n,r){return void 0===r&&(r={}),c(a(n,r),r.root)},n.version="0.4.0",Object.defineProperty(n,"__esModule",{value:!0})})); | ||
***************************************************************************** */var r=function(){return(r=Object.assign||function(n){for(var r,e=1,t=arguments.length;e<t;e++)for(var o in r=arguments[e])Object.prototype.hasOwnProperty.call(r,o)&&(n[o]=r[o]);return n}).apply(this,arguments)};function e(n){return null==n}function t(n,r){return e(n)?r:n}function o(n,r,e){return t(n[r],e)}var i="__root__",u="id",c="parentId",f="children";function a(n,r){var e=n.childNodes;return"function"==typeof r?r(e,n)||[]:e[t(r,i)]||[]}function d(n,r){void 0===r&&(r={});var o=t(r.idKey,u),a=t(r.parentKey,c),d=t(r.childrenKey,f),s=t(r.transform,(function(n){return n})),h=t(r.insert,(function(n,r){return n.push(r)})),l={},p={};return n.forEach((function(n,r){var u=s(n,r);if(!e(u)){var c,f=v(u,n,o);!function(n,r){if(!n){if(r instanceof Error)throw r;throw new Error(r)}}((c=f,!1===e(c)),"id is required, in "+r+".");var y=p[f];y?u[d]=y:p[f]=u[d]=[];var K=t(v(u,n,a),i),E=p[K];h(E||(p[K]=[]),u),l[f]=u}})),{idKey:o,parentKey:a,childrenKey:d,nodes:l,childNodes:p}}function v(n,r,t){var i=o(n,t);return e(i)?o(r,t):i}n.CHILDREN_KEY=f,n.ID_KEY=u,n.PARENT_ID_KEY=c,n.ROOT_ID=i,n.each=function(n,r,e){return void 0===e&&(e=f),function n(o,i){return o.forEach((function(o,u){r(o,u,i)||n(t(o[e],[]),i.concat(o))})),[]}(n,[])},n.exclude=function(n,e,o){return void 0===o&&(o=f),function n(i,u){var c=[];return i.forEach((function(i,f){var a;if(!e(i,f,u)){var d=t(i[o],[]);if(0!==d.length){var v=n(d,u.concat(i));v.length>0&&c.push(r(r({},i),((a={})[o]=v,a)))}else c.push(i)}})),c}(n,[])},n.exporter=a,n.filter=function(n,e,o){return void 0===o&&(o=f),function n(i,u){var c=[];return i.forEach((function(i,f){var a;if(e(i,f,u))c.push(r({},i));else{var d=n(t(i[o],[]),u.concat(i));d.length>0&&c.push(r(r({},i),((a={})[o]=d,a)))}})),c}(n,[])},n.map=function(n,e,o){return void 0===o&&(o=f),function n(i,u){return i.map((function(i,c){var f,a=e(r({},i),c,u),d=n(t(a[o],[]),u.concat(i));return d.length>0?r(r({},a),((f={})[o]=d,f)):a}))}(n,[])},n.parse=d,n.repairWith=function(n,e){var t=function(n){var r=n.idKey,e=void 0===r?u:r,t=n.parentKey,o=void 0===t?c:t,i=n.childrenKey,a=void 0===i?f:i,d=n.resolve,v=n.insert;return{idKey:e,parentKey:o,childrenKey:a,resolve:d,insert:void 0===v?function(n,r){return n.push(r)}:v}}(e),o=t.idKey,i=t.parentKey,a=t.childrenKey,d=t.resolve,v=t.insert,s=[],h={},l=function(n){var e,t=r(r({},n),((e={})[a]=[],e));return h[n[o]]=t,t},p=function(n){var r=n[i],e=h[r];if(e)v(e[a],n);else{var t=d(r);if(t){var o=l(t);v(o[a],n),p(o)}else v(s,n)}};return n.forEach((function(n){var r=d(n[o]);r&&p(l(r))})),s},n.toRows=function(n,e){void 0===e&&(e=f);var o=[];return n.forEach((function n(i){var u,c,f,a,d=r({},i),v=(f=[],a=(u=d)[c=e],delete u[c],t(a,f));o.push(d),v.forEach(n)})),o},n.toTree=function(n,r){return void 0===r&&(r={}),a(d(n,r),r.root)},n.version="0.5.0",Object.defineProperty(n,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=js.tree.min.js.map |
@@ -19,3 +19,3 @@ import type { ParseResult } from './common/parse'; | ||
*/ | ||
export declare type Row = Record<string | number, unknown>; | ||
export declare type Row = Record<string | number | symbol, unknown>; | ||
/** | ||
@@ -22,0 +22,0 @@ * 默认的节点对象 |
{ | ||
"name": "@zhengxs/js.tree", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "快速,轻量,无依赖的树结构数据处理函数库", | ||
@@ -34,3 +34,2 @@ "main": "./dist/js.tree.common.js", | ||
"postversion": "git push --follow-tags", | ||
"prepublishOnly": "npm run build && npm run api", | ||
"postpublish": "typedoc && gh-pages -d ./dist-doc -t" | ||
@@ -37,0 +36,0 @@ }, |
@@ -73,6 +73,4 @@ <div align="center"> | ||
[国内镜像](https://gitee.com/zhengxs2018/js.tree) | ||
### 文档 | ||
@@ -88,2 +86,3 @@ | ||
- [exclude 排除内容](./docs/operators/exclude.md) | ||
- [repairWith 修复关系](./docs/operators/repairWith.md) | ||
- [二次封装](./docs/advanced/custom.md) | ||
@@ -196,3 +195,2 @@ | ||
[Try in runkit](https://npm.runkit.com/@zhengxs/js.tree) | ||
@@ -244,4 +242,8 @@ | ||
## 其他 | ||
- [tiny-tree](https://github.com/zhengxs2018/tiny-tree) | ||
## License | ||
- MIT |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
137837
38
3797
246