@chaoswise/intl 1.0.0 → 1.2.0

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.
Files changed (41) hide show
  1. package/bin/chaoswise-intl.js +5 -1
  2. package/bin/scripts/collect.js +38 -18
  3. package/bin/scripts/conf/default.js +40 -2
  4. package/bin/scripts/conf/getCustomConfig.js +8 -0
  5. package/bin/scripts/conf/index.js +2 -25
  6. package/bin/scripts/conf/initConfig.js +37 -0
  7. package/bin/scripts/initConfig.js +3 -0
  8. package/bin/scripts/service/index.js +2 -2
  9. package/bin/scripts/update.js +5 -5
  10. package/bin/scripts/util/FormPath/contexts.d.ts +10 -0
  11. package/bin/scripts/util/FormPath/contexts.js +23 -0
  12. package/bin/scripts/util/FormPath/destructor.d.ts +15 -0
  13. package/bin/scripts/util/FormPath/destructor.js +124 -0
  14. package/bin/scripts/util/FormPath/index.d.ts +49 -0
  15. package/bin/scripts/util/FormPath/index.js +536 -0
  16. package/bin/scripts/util/FormPath/lru.d.ts +1 -0
  17. package/bin/scripts/util/FormPath/lru.js +246 -0
  18. package/bin/scripts/util/FormPath/matcher.d.ts +33 -0
  19. package/bin/scripts/util/FormPath/matcher.js +216 -0
  20. package/bin/scripts/util/FormPath/parser.d.ts +28 -0
  21. package/bin/scripts/util/FormPath/parser.js +302 -0
  22. package/bin/scripts/util/FormPath/tokenizer.d.ts +26 -0
  23. package/bin/scripts/util/FormPath/tokenizer.js +280 -0
  24. package/bin/scripts/util/FormPath/tokens.d.ts +26 -0
  25. package/bin/scripts/util/FormPath/tokens.js +212 -0
  26. package/bin/scripts/util/FormPath/types.d.ts +76 -0
  27. package/bin/scripts/util/FormPath/types.js +17 -0
  28. package/bin/scripts/util/FormPath/utils.d.ts +10 -0
  29. package/bin/scripts/util/FormPath/utils.js +63 -0
  30. package/bin/scripts/util/downloadJson.js +10 -1
  31. package/bin/scripts/util/file.js +31 -0
  32. package/bin/scripts/util/getGroupName.js +15 -0
  33. package/bin/scripts/util/getWord.js +13 -0
  34. package/bin/scripts/util/log.js +25 -4
  35. package/bin/scripts/util/makeVisitorCollect.js +351 -46
  36. package/bin/scripts/util/makeVisitorUpdate.js +38 -1
  37. package/bin/scripts/util/specialMatch.js +14 -0
  38. package/bin/scripts/util/transformAst.js +30 -22
  39. package/bin/scripts/util/writeNewWordsFile.js +30 -0
  40. package/lib/index.js +2 -1
  41. package/package.json +7 -5
@@ -1,9 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  const runCollect = require('./scripts/collect');
3
3
  const runUpdate = require('./scripts/update');
4
+ const runInitConfig = require('./scripts/initConfig');
4
5
 
5
6
  // 可执行的指令
6
- const SCRIPTS = ['collect', 'update'];
7
+ const SCRIPTS = ['intl', 'collect', 'update'];
7
8
 
8
9
  const args = process.argv.slice(2);
9
10
 
@@ -14,6 +15,9 @@ const scriptIndex = args.findIndex(arg => {
14
15
 
15
16
  const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
16
17
 
18
+ if(script === 'init') {
19
+ runInitConfig();
20
+ }
17
21
  if(script === 'collect') {
18
22
  runCollect();
19
23
  }
@@ -5,11 +5,29 @@ const getTargetFiles = require('./util/getTargetFiles');
5
5
  const transformAst = require('./util/transformAst');
6
6
  const log = require('./util/log');
7
7
  const file = require('./util/file');
8
+ const writeNewWordsFile = require('./util/writeNewWordsFile');
9
+ const { readWordJson } = require('./util/getWord');
8
10
 
9
11
  const service = require('./service');
10
12
 
11
- async function init() {
13
+ async function collect() {
14
+ log.info('词条扫描中...')
12
15
  const conf = getConf();
16
+ const newWordsFileType = conf.newWordsFileType || 'excel';
17
+
18
+ // 检查newWordsFileType
19
+ if (!['json', 'excel'].includes(newWordsFileType)) {
20
+ log.error(`配置:newWordsFileType 只能为json或者excel`);
21
+ process.exit(1);
22
+ }
23
+
24
+ // 读取wordJson
25
+ if (conf.localWordPath && !readWordJson(conf.localWordPath)) {
26
+ log.error('localWordPath配置有误');
27
+ process.exit(1);
28
+ }
29
+
30
+ // 获取需要遍历的文件
13
31
  const files = getTargetFiles(conf);
14
32
 
15
33
  // 遍历文件,并对代码进行ast处理的方法:transformAst(type, files, conf, replaceWords)
@@ -18,19 +36,25 @@ async function init() {
18
36
 
19
37
  // 在国际化平台中获取所有已存在中文信息
20
38
  const res = await service.searchByZh(info.allWords);
39
+
40
+ if (res.code !== 10000) {
41
+ log.error('请求数据出错:' + res.msg);
42
+ process.exit(1);
43
+ }
44
+
21
45
  const wordsMap = res.data;
22
46
 
23
47
  const replaceWords = {}; // { zh: id } 需要在代码中替换的词条id
24
48
  const newWords = {}; // { zh1: '待翻译', zh2: '请选择:中文1/中文2' }
25
- Object.entries(wordsMap).forEach(([zh, value]) => {
49
+ Object.entries(wordsMap).forEach(([word, value]) => {
26
50
  // 如果当前中文词条在平台中存在,且对应英文翻译有且只有一条,那么直接替换代码中的中文为当前id,否则生成临时key,让开发者手动确认
27
51
  if (value.length === 1) {
28
- replaceWords[zh] = value[0].key;
52
+ replaceWords[word] = value[0].key;
29
53
  } else {
30
54
  const id = uuidv4();
31
- replaceWords[zh] = id;
55
+ replaceWords[word] = id;
32
56
  newWords[id] = {
33
- zh,
57
+ zh: word,
34
58
  en:
35
59
  value.length === 0
36
60
  ? '待翻译'
@@ -48,20 +72,16 @@ async function init() {
48
72
  log.success('自定义配置文件在项目根目录的.intlconfig.js中');
49
73
  // 本次扫描出新的待翻译词条,写入到newWords中
50
74
  if (Object.keys(newWords).length) {
51
- const newWordsJsonPath = 'newWords.json';
52
-
53
- let oldNewWords = file.readJson(newWordsJsonPath) || {};
54
- file.write(
55
- newWordsJsonPath,
56
- JSON.stringify({ ...oldNewWords, ...newWords }, null, 2)
57
- );
75
+ writeNewWordsFile(newWordsFileType, newWords);
76
+ }
58
77
 
59
- // 先注释掉,开始做指标时,会用到
60
- // const package = file.read('package.json');
61
- // file.write(newWordsJsonPath, JSON.stringify({ ...oldNewWords, ...newWords, projectName: package.name }, null, 2));
62
- log.success(`需要翻译的文件在项目根目录的newWords.json中`);
78
+ const warnLogs = log.logs.warn;
79
+ if (warnLogs.length) {
80
+ const fileName = `intl.logs.warn.${(new Date).toLocaleString().replace(/[\/ ]/g, '_')}.txt`;
81
+ file.write(fileName, JSON.stringify(warnLogs, null, 2));
82
+ log.warnToLog(`警告日志文件:${fileName}`);
63
83
  }
64
84
  }
65
85
 
66
- // init();
67
- module.exports = init;
86
+ // collect();
87
+ module.exports = collect;
@@ -8,7 +8,6 @@ module.exports = function (excludes = []) {
8
8
  // exclude pattern, <string array>
9
9
  // e.g. ['**/dist/**', '**/*.config.js', '**/*.data.js']
10
10
  exclude: [
11
- '**/router.config.js',
12
11
  '**/src/public/**',
13
12
  '**/_MOCK_/**'
14
13
  ],
@@ -19,7 +18,7 @@ module.exports = function (excludes = []) {
19
18
 
20
19
  // ignored components, <string array>
21
20
  // e.g. ['EventTracker']
22
- ignoreComponents: [],
21
+ ignoreComponents: ['style', 'svg'],
23
22
 
24
23
  // ignored methods, <string array>
25
24
  // e.g. ['MirrorTrack']
@@ -41,6 +40,8 @@ module.exports = function (excludes = []) {
41
40
  // e.g. 't'
42
41
  i18nMethod: 'get',
43
42
 
43
+ i18nDefaultFunctionKey: 'd',
44
+
44
45
  // babel配置项
45
46
  babelPresets: [],
46
47
  babelPlugins: [],
@@ -54,6 +55,43 @@ module.exports = function (excludes = []) {
54
55
  endOfLine: 'lf',
55
56
  },
56
57
 
58
+ // <Tag id={{ key: 'id' }} defaultMessage='中文' />
59
+ // intlTag 是 'Tag'
60
+ // intlTagIdPath 是 'id.key'
61
+ // intlTagDefaultWordPath 是 'defaultMessage',并且如果不配置,默认是'defaultMessage'
62
+ intlTag: '',
63
+ intlTagIdPath: '',
64
+ intlTagDefaultWordPath: '',
65
+
66
+ // intl.formatMessage({
67
+ // key: 'id',
68
+ // defaultMessage: '默认值',
69
+ // })
70
+ // intlFunctionName 是 intl.formatMessage
71
+ // intlFunctionIdPath 是 '0.key'。 如果 配置成 'key' 也行,intlFunctionIdPath如果不以数字开头,会在前面加上'0.' 'key' 就会变成 '0.key'
72
+ // intlFunctionDefaultWordPath 是 '0.defaultMessage',其他的说明同intlFunctionIdPath
73
+ intlFunctionName: '',
74
+ intlFunctionIdPath: '',
75
+ intlFunctionDefaultWordPath: '',
76
+
77
+ // 做过国际化的项目,中文config的路径。例如:'src/local/zh.json'
78
+ localWordPath: '',
79
+
80
+ // 配置 需要被脚本删除的依赖包的名字
81
+ removePkgName: [],
82
+
83
+ // 需要删除的函数和装饰器 的名称
84
+ removeFunctionName: ['injectIntl'],
85
+
86
+ // package.json中项目名称的key
87
+ groupNameKey: 'packageName',
88
+
89
+ // 特殊文件处理的正则 这里默认匹配router.config.js
90
+ specialFileReg: [/src\/config\/router\.config\.js/],
91
+
92
+ // newWords文件的类型 json或者excel
93
+ newWordsFileType: 'excel',
94
+
57
95
  // 国际化平台地址
58
96
  baseURL: 'http://10.0.1.133:18000',
59
97
  };
@@ -0,0 +1,8 @@
1
+ const file = require('../util/file');
2
+
3
+ module.exports = function () {
4
+ // 获取用户自定义配置文件
5
+ const customConfig = file.readJs('.intlconfig.js');
6
+
7
+ return customConfig;
8
+ };
@@ -1,25 +1,5 @@
1
1
  const getDefaultConfig = require('./default');
2
- const file = require('../util/file');
3
- const prettier = require('prettier');
4
-
5
- function createCustomConfig() {
6
- // 默认生成的配置文件,不需要给出全量可配置属性
7
- const ignoreAttributes = [
8
- 'primaryRegx',
9
- 'importCode',
10
- 'i18nObject',
11
- 'i18nMethod',
12
- 'baseURL',
13
- ];
14
- const defaultConfig = getDefaultConfig(ignoreAttributes);
15
-
16
- const code = `module.exports = ${JSON.stringify(defaultConfig, null, 2)};`;
17
-
18
- file.write(
19
- '.intlconfig.js',
20
- prettier.format(code, { ...defaultConfig.prettier, parser: 'babel' })
21
- );
22
- }
2
+ const getCustomConfig = require('./getCustomConfig');
23
3
 
24
4
  // 内置一些,不需要被扫描的函数
25
5
  const ignoreMethods = [
@@ -28,11 +8,8 @@ Object.keys(console).forEach(key => ignoreMethods.push(`console.${key}`))
28
8
 
29
9
  module.exports = function () {
30
10
  // 获取用户自定义配置文件
31
- const customConfig = file.readJs('.intlconfig.js');
11
+ const customConfig = getCustomConfig() || {};
32
12
 
33
- if (!customConfig) {
34
- createCustomConfig();
35
- }
36
13
  // 合并配置文件
37
14
  const finalyConf = { ...getDefaultConfig(), ...customConfig };
38
15
 
@@ -0,0 +1,37 @@
1
+ const getCustomConfig = require('./getCustomConfig');
2
+ const getDefaultConfig = require('./default');
3
+ const file = require('../util/file');
4
+ const prettier = require('prettier');
5
+ const log = require('../util/log');
6
+
7
+ module.exports = function initConfig() {
8
+ const customConfigName = '.intlconfig.js'
9
+
10
+ const customConfig = getCustomConfig();
11
+
12
+ if (customConfig) {
13
+ console.log(`${customConfigName}已存在,请手动删除本地已经有的配置文件再重新执行 npm run intl-init`);
14
+ return;
15
+ }
16
+
17
+ // 默认生成的配置文件,不需要给出全量可配置属性
18
+ const ignoreAttributes = [
19
+ 'primaryRegx',
20
+ 'importCode',
21
+ 'i18nObject',
22
+ 'i18nMethod',
23
+ 'i18nDefaultFunctionKey',
24
+ 'specialFileReg',
25
+ 'baseURL',
26
+ ];
27
+ const defaultConfig = getDefaultConfig(ignoreAttributes);
28
+
29
+ const code = `module.exports = ${JSON.stringify(defaultConfig, null, 2)};`;
30
+
31
+ file.write(
32
+ customConfigName,
33
+ prettier.format(code, { ...defaultConfig.prettier, parser: 'babel' })
34
+ );
35
+
36
+ log.success(`初始化配置文件成功:.intlconfig.js`);
37
+ }
@@ -0,0 +1,3 @@
1
+ const initConfig = require('./conf/initConfig');
2
+
3
+ module.exports = initConfig;
@@ -24,6 +24,6 @@ exports.searchByZh = (zhs) => {
24
24
  };
25
25
 
26
26
  // 根据词条id获取所有数据库词条信息
27
- exports.getJson = (ids) => {
28
- return axios.post('/getJson', ids);
27
+ exports.getJson = ({ groupName, downloadIds }) => {
28
+ return axios.post('/getJson', { groupName, downloadIds });
29
29
  };
@@ -5,7 +5,7 @@ const downloadJson = require('./util/downloadJson');
5
5
  const log = require('./util/log');
6
6
  const file = require('./util/file');
7
7
 
8
- async function replace() {
8
+ async function update() {
9
9
  const conf = getConf();
10
10
  const files = getTargetFiles(conf);
11
11
 
@@ -13,7 +13,7 @@ async function replace() {
13
13
  const relationKey = file.readJson('relationKey.json') || {};
14
14
 
15
15
  const info = transformAst('update', files, conf, relationKey);
16
- downloadJson(info.downloadIds);
16
+ await downloadJson(info.downloadIds);
17
17
 
18
18
  const needDelete = Boolean(Object.keys(relationKey).length);
19
19
  if (needDelete) {
@@ -23,10 +23,10 @@ async function replace() {
23
23
  log.success('newWords.json和relationKey.json 已删除');
24
24
  }
25
25
 
26
- log.success('脚本执行成功2222');
26
+ log.success('脚本执行成功');
27
27
  }
28
28
 
29
- // replace();
30
- module.exports = replace;
29
+ // update();
30
+ module.exports = update;
31
31
 
32
32
 
@@ -0,0 +1,10 @@
1
+ export declare type Context = {
2
+ flag: string;
3
+ [key: string]: any;
4
+ };
5
+ export declare const bracketContext: Context;
6
+ export declare const bracketArrayContext: Context;
7
+ export declare const bracketDContext: Context;
8
+ export declare const parenContext: Context;
9
+ export declare const braceContext: Context;
10
+ export declare const destructorContext: Context;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.destructorContext = exports.braceContext = exports.parenContext = exports.bracketDContext = exports.bracketArrayContext = exports.bracketContext = void 0;
15
+ var ContextType = function (flag, props) {
16
+ return __assign({ flag: flag }, props);
17
+ };
18
+ exports.bracketContext = ContextType("[]");
19
+ exports.bracketArrayContext = ContextType("[\\d]");
20
+ exports.bracketDContext = ContextType("[[]]");
21
+ exports.parenContext = ContextType("()");
22
+ exports.braceContext = ContextType("{}");
23
+ exports.destructorContext = ContextType("{x}");
@@ -0,0 +1,15 @@
1
+ import { Segments, Node, DestrcutorRules } from './types';
2
+ declare type Mutatators = {
3
+ getIn: (segments: Segments, source: any) => any;
4
+ setIn: (segments: Segments, source: any, value: any) => void;
5
+ deleteIn?: (segments: Segments, source: any) => any;
6
+ existIn?: (segments: Segments, source: any, start: number) => boolean;
7
+ };
8
+ export declare const getDestructor: (source: string) => any;
9
+ export declare const setDestructor: (source: string, rules: DestrcutorRules) => void;
10
+ export declare const parseDestructorRules: (node: Node) => DestrcutorRules;
11
+ export declare const setInByDestructor: (source: any, rules: DestrcutorRules, value: any, mutators: Mutatators) => void;
12
+ export declare const getInByDestructor: (source: any, rules: DestrcutorRules, mutators: Mutatators) => {};
13
+ export declare const deleteInByDestructor: (source: any, rules: DestrcutorRules, mutators: Mutatators) => void;
14
+ export declare const existInByDestructor: (source: any, rules: DestrcutorRules, start: number, mutators: Mutatators) => boolean;
15
+ export {};
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.existInByDestructor = exports.deleteInByDestructor = exports.getInByDestructor = exports.setInByDestructor = exports.parseDestructorRules = exports.setDestructor = exports.getDestructor = void 0;
4
+ var types_1 = require("./types");
5
+ var utils_1 = require("./utils");
6
+ var DestrcutorCache = new Map();
7
+ var isValid = function (val) { return val !== undefined && val !== null; };
8
+ exports.getDestructor = function (source) {
9
+ return DestrcutorCache.get(source);
10
+ };
11
+ exports.setDestructor = function (source, rules) {
12
+ DestrcutorCache.set(source, rules);
13
+ };
14
+ exports.parseDestructorRules = function (node) {
15
+ var rules = [];
16
+ if (types_1.isObjectPattern(node)) {
17
+ var index_1 = 0;
18
+ node.properties.forEach(function (child) {
19
+ rules[index_1] = {
20
+ path: []
21
+ };
22
+ rules[index_1].key = child.key.value;
23
+ rules[index_1].path.push(child.key.value);
24
+ if (types_1.isIdentifier(child.value)) {
25
+ rules[index_1].key = child.value.value;
26
+ }
27
+ var basePath = rules[index_1].path;
28
+ var childRules = exports.parseDestructorRules(child.value);
29
+ var k = index_1;
30
+ childRules.forEach(function (rule) {
31
+ if (rules[k]) {
32
+ rules[k].key = rule.key;
33
+ rules[k].path = basePath.concat(rule.path);
34
+ }
35
+ else {
36
+ rules[k] = {
37
+ key: rule.key,
38
+ path: basePath.concat(rule.path)
39
+ };
40
+ }
41
+ k++;
42
+ });
43
+ if (k > index_1) {
44
+ index_1 = k;
45
+ }
46
+ else {
47
+ index_1++;
48
+ }
49
+ });
50
+ return rules;
51
+ }
52
+ else if (types_1.isArrayPattern(node)) {
53
+ var index_2 = 0;
54
+ node.elements.forEach(function (child, key) {
55
+ rules[index_2] = {
56
+ path: []
57
+ };
58
+ rules[index_2].key = key;
59
+ rules[index_2].path.push(key);
60
+ if (types_1.isIdentifier(child)) {
61
+ rules[index_2].key = child.value;
62
+ }
63
+ var basePath = rules[index_2].path;
64
+ var childRules = exports.parseDestructorRules(child);
65
+ var k = index_2;
66
+ childRules.forEach(function (rule) {
67
+ if (rules[k]) {
68
+ rules[k].key = rule.key;
69
+ rules[k].path = basePath.concat(rule.path);
70
+ }
71
+ else {
72
+ rules[k] = {
73
+ key: rule.key,
74
+ path: basePath.concat(rule.path)
75
+ };
76
+ }
77
+ k++;
78
+ });
79
+ if (k > index_2) {
80
+ index_2 = k;
81
+ }
82
+ else {
83
+ index_2++;
84
+ }
85
+ });
86
+ return rules;
87
+ }
88
+ if (types_1.isDestructorExpression(node)) {
89
+ return exports.parseDestructorRules(node.value);
90
+ }
91
+ return rules;
92
+ };
93
+ exports.setInByDestructor = function (source, rules, value, mutators) {
94
+ rules.forEach(function (_a) {
95
+ var key = _a.key, path = _a.path;
96
+ mutators.setIn([key], source, mutators.getIn(path, value));
97
+ });
98
+ };
99
+ exports.getInByDestructor = function (source, rules, mutators) {
100
+ var response = {};
101
+ if (rules.length) {
102
+ if (utils_1.isNum(rules[0].path[0])) {
103
+ response = [];
104
+ }
105
+ }
106
+ source = isValid(source) ? source : {};
107
+ rules.forEach(function (_a) {
108
+ var key = _a.key, path = _a.path;
109
+ mutators.setIn(path, response, source[key]);
110
+ });
111
+ return response;
112
+ };
113
+ exports.deleteInByDestructor = function (source, rules, mutators) {
114
+ rules.forEach(function (_a) {
115
+ var key = _a.key;
116
+ mutators.deleteIn([key], source);
117
+ });
118
+ };
119
+ exports.existInByDestructor = function (source, rules, start, mutators) {
120
+ return rules.every(function (_a) {
121
+ var key = _a.key;
122
+ return mutators.existIn([key], source, start);
123
+ });
124
+ };
@@ -0,0 +1,49 @@
1
+ import { Segments, Node, Pattern } from './types';
2
+ export * from './types';
3
+ export declare class Path {
4
+ entire: string;
5
+ segments: Segments;
6
+ isMatchPattern: boolean;
7
+ isWildMatchPattern: boolean;
8
+ haveExcludePattern: boolean;
9
+ matchScore: number;
10
+ tree: Node;
11
+ private matchCache;
12
+ private includesCache;
13
+ constructor(input: Pattern);
14
+ toString(): string;
15
+ toArray(): Segments;
16
+ get length(): number;
17
+ private parse;
18
+ private parseString;
19
+ concat: (...args: Pattern[]) => Path;
20
+ slice: (start?: number, end?: number) => Path;
21
+ push: (item: Pattern) => this;
22
+ pop: () => void;
23
+ splice: (start: number, deleteCount?: number, ...items: Array<string | number>) => this;
24
+ forEach: (callback: (key: string | number) => any) => void;
25
+ map: (callback: (key: string | number) => any) => any[];
26
+ reduce: <T>(callback: (buf: T, item: string | number, index: number) => T, initial: T) => T;
27
+ getNearestChildPathBy: (target?: Pattern) => Path;
28
+ parent: () => Path;
29
+ includes: (pattern: Pattern) => any;
30
+ transform: <T>(regexp: string | RegExp, callback: (...args: string[]) => T) => string | T;
31
+ match: (pattern: Pattern) => boolean;
32
+ matchAliasGroup: (name: Pattern, alias: Pattern) => boolean;
33
+ existIn: (source?: any, start?: number | Path) => boolean;
34
+ getIn: (source?: any) => any;
35
+ setIn: (source?: any, value?: any) => any;
36
+ deleteIn: (source?: any) => any;
37
+ static match(pattern: Pattern): {
38
+ (target: any): boolean;
39
+ path: Path;
40
+ };
41
+ static transform<T>(pattern: Pattern, regexp: string | RegExp, callback: (...args: string[]) => T): any;
42
+ static parse(path?: Pattern): Path;
43
+ static getPath(path?: Pattern): Path;
44
+ static getIn: (source: any, pattern: Pattern) => any;
45
+ static setIn: (source: any, pattern: Pattern, value: any) => any;
46
+ static deleteIn: (source: any, pattern: Pattern) => any;
47
+ static existIn: (source: any, pattern: Pattern, start?: number | Path) => boolean;
48
+ }
49
+ export default Path;