@lppx/nlearn 1.1.10 → 1.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,14 +12,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.搜索字符串数组 = 搜索字符串数组;
16
- exports.搜索对象数组 = 搜索对象数组;
17
- exports.基础配置选项 = 基础配置选项;
18
- exports.嵌套对象搜索 = 嵌套对象搜索;
19
- exports.结果数量控制 = 结果数量控制;
15
+ exports.searchStringArray = searchStringArray;
16
+ exports.searchObjectArray = searchObjectArray;
17
+ exports.basicConfigOptions = basicConfigOptions;
18
+ exports.searchNestedObjects = searchNestedObjects;
19
+ exports.controlResultCount = controlResultCount;
20
20
  const fuse_js_1 = __importDefault(require("fuse.js"));
21
21
  // #region 示例1: 简单字符串数组搜索
22
- function 搜索字符串数组() {
22
+ function searchStringArray() {
23
23
  console.log('\n=== 示例1: 简单字符串数组搜索 ===');
24
24
  // 准备数据
25
25
  const fruits = ['Apple', 'Banana', 'Orange', 'Pineapple', 'Grape', 'Watermelon'];
@@ -36,7 +36,7 @@ function 搜索字符串数组() {
36
36
  }
37
37
  // #endregion
38
38
  // #region 示例2: 搜索对象数组
39
- function 搜索对象数组() {
39
+ function searchObjectArray() {
40
40
  console.log('\n=== 示例2: 搜索对象数组 ===');
41
41
  // 准备书籍数据
42
42
  const books = [
@@ -60,7 +60,7 @@ function 搜索对象数组() {
60
60
  }
61
61
  // #endregion
62
62
  // #region 示例3: 基础配置选项
63
- function 基础配置选项() {
63
+ function basicConfigOptions() {
64
64
  console.log('\n=== 示例3: 基础配置选项 ===');
65
65
  const languages = [
66
66
  'JavaScript',
@@ -90,7 +90,7 @@ function 基础配置选项() {
90
90
  }
91
91
  // #endregion
92
92
  // #region 示例4: 嵌套对象搜索
93
- function 嵌套对象搜索() {
93
+ function searchNestedObjects() {
94
94
  console.log('\n=== 示例4: 嵌套对象搜索 ===');
95
95
  // 准备嵌套结构的数据
96
96
  const users = [
@@ -130,7 +130,7 @@ function 嵌套对象搜索() {
130
130
  }
131
131
  // #endregion
132
132
  // #region 示例5: 获取所有结果与限制结果数量
133
- function 结果数量控制() {
133
+ function controlResultCount() {
134
134
  console.log('\n=== 示例5: 结果数量控制 ===');
135
135
  const countries = [
136
136
  'China', 'Canada', 'Chile', 'Colombia', 'Croatia',
@@ -153,11 +153,11 @@ if (require.main === module) {
153
153
  const args = process.argv.slice(2);
154
154
  const exampleNumber = args[0] ? parseInt(args[0]) : 0;
155
155
  const examples = [
156
- 搜索字符串数组,
157
- 搜索对象数组,
158
- 基础配置选项,
159
- 嵌套对象搜索,
160
- 结果数量控制
156
+ searchStringArray,
157
+ searchObjectArray,
158
+ basicConfigOptions,
159
+ searchNestedObjects,
160
+ controlResultCount
161
161
  ];
162
162
  if (exampleNumber > 0 && exampleNumber <= examples.length) {
163
163
  console.log(`\n运行示例 ${exampleNumber}:`);
@@ -11,15 +11,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
11
11
  return (mod && mod.__esModule) ? mod : { "default": mod };
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.扩展搜索精确匹配 = 扩展搜索精确匹配;
15
- exports.前缀后缀匹配 = 前缀后缀匹配;
16
- exports.包含排除搜索 = 包含排除搜索;
17
- exports.逻辑运算符搜索 = 逻辑运算符搜索;
18
- exports.权重搜索 = 权重搜索;
19
- exports.复杂查询组合 = 复杂查询组合;
14
+ exports.extendedSearchExactMatch = extendedSearchExactMatch;
15
+ exports.prefixSuffixMatch = prefixSuffixMatch;
16
+ exports.includeExcludeSearch = includeExcludeSearch;
17
+ exports.logicalOperatorSearch = logicalOperatorSearch;
18
+ exports.weightedSearch = weightedSearch;
19
+ exports.complexQueryCombination = complexQueryCombination;
20
20
  const fuse_js_1 = __importDefault(require("fuse.js"));
21
21
  // #region 示例1: 扩展搜索 - 精确匹配
22
- function 扩展搜索精确匹配() {
22
+ function extendedSearchExactMatch() {
23
23
  console.log('\n=== 示例1: 扩展搜索 - 精确匹配 ===');
24
24
  const languages = [
25
25
  { name: 'JavaScript' },
@@ -48,7 +48,7 @@ function 扩展搜索精确匹配() {
48
48
  }
49
49
  // #endregion
50
50
  // #region 示例2: 扩展搜索 - 前缀和后缀匹配
51
- function 前缀后缀匹配() {
51
+ function prefixSuffixMatch() {
52
52
  console.log('\n=== 示例2: 扩展搜索 - 前缀和后缀匹配 ===');
53
53
  const files = [
54
54
  { name: 'index.js' },
@@ -76,7 +76,7 @@ function 前缀后缀匹配() {
76
76
  }
77
77
  // #endregion
78
78
  // #region 示例3: 扩展搜索 - 包含和排除
79
- function 包含排除搜索() {
79
+ function includeExcludeSearch() {
80
80
  console.log('\n=== 示例3: 扩展搜索 - 包含和排除 ===');
81
81
  const frameworks = [
82
82
  { name: 'React', type: 'frontend' },
@@ -104,7 +104,7 @@ function 包含排除搜索() {
104
104
  }
105
105
  // #endregion
106
106
  // #region 示例4: 扩展搜索 - 逻辑运算符
107
- function 逻辑运算符搜索() {
107
+ function logicalOperatorSearch() {
108
108
  console.log('\n=== 示例4: 扩展搜索 - 逻辑运算符 ===');
109
109
  const products = [
110
110
  { name: 'iPhone 15 Pro', brand: 'Apple', price: 999 },
@@ -132,7 +132,7 @@ function 逻辑运算符搜索() {
132
132
  }
133
133
  // #endregion
134
134
  // #region 示例5: 权重搜索
135
- function 权重搜索() {
135
+ function weightedSearch() {
136
136
  console.log('\n=== 示例5: 权重搜索 ===');
137
137
  const articles = [
138
138
  {
@@ -170,7 +170,7 @@ function 权重搜索() {
170
170
  }
171
171
  // #endregion
172
172
  // #region 示例6: 复杂查询组合
173
- function 复杂查询组合() {
173
+ function complexQueryCombination() {
174
174
  console.log('\n=== 示例6: 复杂查询组合 ===');
175
175
  const employees = [
176
176
  { name: 'John Smith', department: 'Engineering', level: 'Senior' },
@@ -197,12 +197,12 @@ if (require.main === module) {
197
197
  const args = process.argv.slice(2);
198
198
  const exampleNumber = args[0] ? parseInt(args[0]) : 0;
199
199
  const examples = [
200
- 扩展搜索精确匹配,
201
- 前缀后缀匹配,
202
- 包含排除搜索,
203
- 逻辑运算符搜索,
204
- 权重搜索,
205
- 复杂查询组合
200
+ extendedSearchExactMatch,
201
+ prefixSuffixMatch,
202
+ includeExcludeSearch,
203
+ logicalOperatorSearch,
204
+ weightedSearch,
205
+ complexQueryCombination
206
206
  ];
207
207
  if (exampleNumber > 0 && exampleNumber <= examples.length) {
208
208
  console.log(`\n运行示例 ${exampleNumber}:`);
@@ -11,15 +11,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
11
11
  return (mod && mod.__esModule) ? mod : { "default": mod };
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.阈值配置对比 = 阈值配置对比;
15
- exports.位置距离配置 = 位置距离配置;
16
- exports.最小匹配长度 = 最小匹配长度;
17
- exports.排序配置 = 排序配置;
18
- exports.匹配详情配置 = 匹配详情配置;
19
- exports.完整配置示例 = 完整配置示例;
14
+ exports.thresholdConfigComparison = thresholdConfigComparison;
15
+ exports.locationDistanceConfig = locationDistanceConfig;
16
+ exports.minMatchCharLength = minMatchCharLength;
17
+ exports.sortingConfig = sortingConfig;
18
+ exports.matchDetailsConfig = matchDetailsConfig;
19
+ exports.completeConfigExample = completeConfigExample;
20
20
  const fuse_js_1 = __importDefault(require("fuse.js"));
21
21
  // #region 示例1: threshold 阈值配置
22
- function 阈值配置对比() {
22
+ function thresholdConfigComparison() {
23
23
  console.log('\n=== 示例1: threshold 阈值配置 ===');
24
24
  const words = ['apple', 'application', 'apply', 'appreciate'];
25
25
  // 严格匹配 (threshold = 0.0)
@@ -44,7 +44,7 @@ function 阈值配置对比() {
44
44
  }
45
45
  // #endregion
46
46
  // #region 示例2: location 和 distance 配置
47
- function 位置距离配置() {
47
+ function locationDistanceConfig() {
48
48
  console.log('\n=== 示例2: location 和 distance 配置 ===');
49
49
  const texts = [
50
50
  'The quick brown fox jumps over the lazy dog',
@@ -80,7 +80,7 @@ function 位置距离配置() {
80
80
  }
81
81
  // #endregion
82
82
  // #region 示例3: minMatchCharLength 最小匹配长度
83
- function 最小匹配长度() {
83
+ function minMatchCharLength() {
84
84
  console.log('\n=== 示例3: minMatchCharLength 最小匹配长度 ===');
85
85
  const codes = [
86
86
  'JavaScript',
@@ -114,7 +114,7 @@ function 最小匹配长度() {
114
114
  }
115
115
  // #endregion
116
116
  // #region 示例4: shouldSort 和 sortFn 排序配置
117
- function 排序配置() {
117
+ function sortingConfig() {
118
118
  console.log('\n=== 示例4: shouldSort 和排序配置 ===');
119
119
  const items = [
120
120
  { name: 'React', stars: 200000 },
@@ -146,7 +146,7 @@ function 排序配置() {
146
146
  }
147
147
  // #endregion
148
148
  // #region 示例5: includeMatches 匹配详情
149
- function 匹配详情配置() {
149
+ function matchDetailsConfig() {
150
150
  console.log('\n=== 示例5: includeMatches 匹配详情 ===');
151
151
  const books = [
152
152
  {
@@ -183,7 +183,7 @@ function 匹配详情配置() {
183
183
  }
184
184
  // #endregion
185
185
  // #region 示例6: 完整配置示例
186
- function 完整配置示例() {
186
+ function completeConfigExample() {
187
187
  console.log('\n=== 示例6: 完整配置示例 ===');
188
188
  const products = [
189
189
  {
@@ -246,12 +246,12 @@ if (require.main === module) {
246
246
  const args = process.argv.slice(2);
247
247
  const exampleNumber = args[0] ? parseInt(args[0]) : 0;
248
248
  const examples = [
249
- 阈值配置对比,
250
- 位置距离配置,
251
- 最小匹配长度,
252
- 排序配置,
253
- 匹配详情配置,
254
- 完整配置示例
249
+ thresholdConfigComparison,
250
+ locationDistanceConfig,
251
+ minMatchCharLength,
252
+ sortingConfig,
253
+ matchDetailsConfig,
254
+ completeConfigExample
255
255
  ];
256
256
  if (exampleNumber > 0 && exampleNumber <= examples.length) {
257
257
  console.log(`\n运行示例 ${exampleNumber}:`);
@@ -11,14 +11,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
11
11
  return (mod && mod.__esModule) ? mod : { "default": mod };
12
12
  };
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.用户搜索系统 = 用户搜索系统;
15
- exports.商品搜索与过滤 = 商品搜索与过滤;
16
- exports.文档搜索引擎 = 文档搜索引擎;
17
- exports.命令行工具搜索 = 命令行工具搜索;
18
- exports.智能联系人搜索 = 智能联系人搜索;
14
+ exports.userSearchSystem = userSearchSystem;
15
+ exports.productSearchAndFilter = productSearchAndFilter;
16
+ exports.documentSearchEngine = documentSearchEngine;
17
+ exports.commandLineToolSearch = commandLineToolSearch;
18
+ exports.smartContactSearch = smartContactSearch;
19
19
  const fuse_js_1 = __importDefault(require("fuse.js"));
20
20
  // #region 示例1: 用户搜索系统
21
- function 用户搜索系统() {
21
+ function userSearchSystem() {
22
22
  console.log('\n=== 示例1: 用户搜索系统 ===');
23
23
  const users = [
24
24
  {
@@ -76,7 +76,7 @@ function 用户搜索系统() {
76
76
  }
77
77
  // #endregion
78
78
  // #region 示例2: 商品搜索与过滤
79
- function 商品搜索与过滤() {
79
+ function productSearchAndFilter() {
80
80
  console.log('\n=== 示例2: 商品搜索与过滤 ===');
81
81
  const products = [
82
82
  {
@@ -158,7 +158,7 @@ function 商品搜索与过滤() {
158
158
  }
159
159
  // #endregion
160
160
  // #region 示例3: 文档搜索引擎
161
- function 文档搜索引擎() {
161
+ function documentSearchEngine() {
162
162
  console.log('\n=== 示例3: 文档搜索引擎 ===');
163
163
  const documents = [
164
164
  {
@@ -215,7 +215,7 @@ function 文档搜索引擎() {
215
215
  }
216
216
  // #endregion
217
217
  // #region 示例4: 命令行工具搜索
218
- function 命令行工具搜索() {
218
+ function commandLineToolSearch() {
219
219
  console.log('\n=== 示例4: 命令行工具搜索 ===');
220
220
  const commands = [
221
221
  {
@@ -278,7 +278,7 @@ function 命令行工具搜索() {
278
278
  }
279
279
  // #endregion
280
280
  // #region 示例5: 智能联系人搜索
281
- function 智能联系人搜索() {
281
+ function smartContactSearch() {
282
282
  console.log('\n=== 示例5: 智能联系人搜索 ===');
283
283
  const contacts = [
284
284
  {
@@ -339,11 +339,11 @@ if (require.main === module) {
339
339
  const args = process.argv.slice(2);
340
340
  const exampleNumber = args[0] ? parseInt(args[0]) : 0;
341
341
  const examples = [
342
- 用户搜索系统,
343
- 商品搜索与过滤,
344
- 文档搜索引擎,
345
- 命令行工具搜索,
346
- 智能联系人搜索
342
+ userSearchSystem,
343
+ productSearchAndFilter,
344
+ documentSearchEngine,
345
+ commandLineToolSearch,
346
+ smartContactSearch
347
347
  ];
348
348
  if (exampleNumber > 0 && exampleNumber <= examples.length) {
349
349
  console.log(`\n运行示例 ${exampleNumber}:`);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.1.10",
6
+ "version": "1.1.12",
7
7
  "description": "一个nodejs学习工具",
8
8
  "bin": {
9
9
  "nlearn": "dist/src/cli/index.js",
@@ -12,7 +12,8 @@
12
12
  "scripts": {
13
13
  "sync": "ts-node scripts/sync-repo.ts",
14
14
  "build": "tsc",
15
- "start": "node dist/src/cli/index.js"
15
+ "start": "node dist/src/cli/index.js",
16
+ "ccx": "npm version patch --force && npm run build && npm publish "
16
17
  },
17
18
  "author": "lipanpanx",
18
19
  "license": "MIT",