string-match-left-right 8.0.0 → 8.0.4

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 8.0.3 (2021-11-02)
7
+
8
+ ### Bug Fixes
9
+
10
+ - bump TS and separate ESLint plugins away from this monorepo ([b1ebce1](https://github.com/codsen/codsen/commit/b1ebce1637d8c41c2d848fc24b0ba4058865bd5d))
11
+
12
+ ### Features
13
+
14
+ - migrate to ES Modules ([c579dff](https://github.com/codsen/codsen/commit/c579dff3b23205e383035ca10ddcec671e35d0fe))
15
+
16
+ ### BREAKING CHANGES
17
+
18
+ - programs now are in ES Modules and won't work with Common JS require()
19
+
20
+ ## 8.0.1 (2021-09-13)
21
+
22
+ ### Bug Fixes
23
+
24
+ - bump TS and separate ESLint plugins away from this monorepo ([2e07d42](https://github.com/codsen/codsen/commit/2e07d424222b6ffedf5fb45c83ad453627ec2904))
25
+
6
26
  ## 8.0.0 (2021-09-09)
7
27
 
8
28
  ### Features
package/README.md CHANGED
@@ -26,10 +26,14 @@
26
26
 
27
27
  ## Install
28
28
 
29
+ This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required:
30
+
29
31
  ```bash
30
32
  npm i string-match-left-right
31
33
  ```
32
34
 
35
+ If you need a legacy version which works with `require`, use version 7.1.0
36
+
33
37
  ## Quick Take
34
38
 
35
39
  ```js
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @name string-match-left-right
3
3
  * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
4
- * @version 8.0.0
4
+ * @version 8.0.4
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-match-left-right/}
@@ -106,7 +106,8 @@ function march(str, position, whatToMatchVal, originalOpts, special = false, get
106
106
  for (let y = 0; y <= patience; y++) {
107
107
  const nextCharToCompareAgainst = nextIdx > i ? whatToMatchVal[whatToMatchVal.length - charsToCheckCount + 1 + y] : whatToMatchVal[charsToCheckCount - 2 - y];
108
108
  const nextCharInSource = str[getNextIdx(i)];
109
- if (nextCharToCompareAgainst && (!opts.i && str[i] === nextCharToCompareAgainst || opts.i && str[i].toLowerCase() === nextCharToCompareAgainst.toLowerCase()) && (!opts.firstMustMatch || charsToCheckCount !== whatToMatchVal.length)) {
109
+ if (nextCharToCompareAgainst && (!opts.i && str[i] === nextCharToCompareAgainst || opts.i && str[i].toLowerCase() === nextCharToCompareAgainst.toLowerCase()) && (
110
+ !opts.firstMustMatch || charsToCheckCount !== whatToMatchVal.length)) {
110
111
  charsMatchedTotal++;
111
112
  if (whitespaceInFrontOfFirstChar()) {
112
113
  return false;
@@ -114,7 +115,8 @@ function march(str, position, whatToMatchVal, originalOpts, special = false, get
114
115
  charsToCheckCount -= 2;
115
116
  somethingFound = true;
116
117
  break;
117
- } else if (nextCharInSource && nextCharToCompareAgainst && (!opts.i && nextCharInSource === nextCharToCompareAgainst || opts.i && nextCharInSource.toLowerCase() === nextCharToCompareAgainst.toLowerCase()) && (!opts.firstMustMatch || charsToCheckCount !== whatToMatchVal.length)) {
118
+ } else if (nextCharInSource && nextCharToCompareAgainst && (!opts.i && nextCharInSource === nextCharToCompareAgainst || opts.i && nextCharInSource.toLowerCase() === nextCharToCompareAgainst.toLowerCase()) && (
119
+ !opts.firstMustMatch || charsToCheckCount !== whatToMatchVal.length)) {
118
120
  if (!charsMatchedTotal && !opts.hungry) {
119
121
  return false;
120
122
  }
@@ -201,7 +203,9 @@ function main(mode, str, position, originalWhatToMatch, originalOpts) {
201
203
  })) {
202
204
  throw new Error(`string-match-left-right/${mode}(): [THROW_ID_07] the fourth argument, options object contains trimCharsBeforeMatching. It was meant to list the single characters but one of the entries at index ${culpritsIndex} is longer than 1 character, ${culpritsVal.length} (equals to ${culpritsVal}). Please split it into separate characters and put into array as separate elements.`);
203
205
  }
204
- if (!whatToMatch || !Array.isArray(whatToMatch) || Array.isArray(whatToMatch) && !whatToMatch.length || Array.isArray(whatToMatch) && whatToMatch.length === 1 && isStr(whatToMatch[0]) && !whatToMatch[0].trim()
206
+ if (!whatToMatch || !Array.isArray(whatToMatch) ||
207
+ Array.isArray(whatToMatch) && !whatToMatch.length ||
208
+ Array.isArray(whatToMatch) && whatToMatch.length === 1 && isStr(whatToMatch[0]) && !whatToMatch[0].trim()
205
209
  ) {
206
210
  if (typeof opts.cb === "function") {
207
211
  let firstCharOutsideIndex;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @name string-match-left-right
3
3
  * @fileoverview Match substrings on the left or right of a given index, ignoring whitespace
4
- * @version 8.0.0
4
+ * @version 8.0.4
5
5
  * @author Roy Revelt, Codsen Ltd
6
6
  * @license MIT
7
7
  * {@link https://codsen.com/os/string-match-left-right/}
@@ -11,7 +11,7 @@
11
11
  /**
12
12
  * @name arrayiffy-if-string
13
13
  * @fileoverview Put non-empty strings into arrays, turn empty-ones into empty arrays. Bypass everything else.
14
- * @version 4.0.0
14
+ * @version 4.0.4
15
15
  * @author Roy Revelt, Codsen Ltd
16
16
  * @license MIT
17
17
  * {@link https://codsen.com/os/arrayiffy-if-string/}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-match-left-right",
3
- "version": "8.0.0",
3
+ "version": "8.0.4",
4
4
  "description": "Match substrings on the left or right of a given index, ignoring whitespace",
5
5
  "keywords": [
6
6
  "left",
@@ -32,11 +32,13 @@
32
32
  "types": "types/index.d.ts",
33
33
  "scripts": {
34
34
  "build": "rollup -c",
35
- "esbuild": "node '../../scripts/esbuild.js'",
36
- "esbuild_dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
37
35
  "ci_test": "npm run build && npm run format && tap --no-only --reporter=silent --output-file=testStats.md && npm run clean_cov",
36
+ "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
37
+ "clean_types": "../../scripts/cleanTypes.js",
38
38
  "dev": "rollup -c --dev",
39
39
  "devunittest": "npm run dev && tap --only -R 'base'",
40
+ "esbuild": "node '../../scripts/esbuild.js'",
41
+ "esbuild_dev": "cross-env MODE=dev node '../../scripts/esbuild.js'",
40
42
  "format": "npm run lect && npm run prettier && npm run lint",
41
43
  "lect": "lect",
42
44
  "lint": "../../node_modules/eslint/bin/eslint.js . --ext .js --ext .ts --fix --config \"../../.eslintrc.json\" --quiet",
@@ -44,13 +46,11 @@
44
46
  "prettier": "../../node_modules/prettier/bin-prettier.js '*.{js,css,scss,vue,md,ts}' --write --loglevel silent",
45
47
  "republish": "npm publish || :",
46
48
  "tap": "tap",
47
- "tsc": "tsc",
48
49
  "pretest": "npm run build",
49
50
  "test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
50
51
  "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
51
- "unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf",
52
- "clean_cov": "../../scripts/leaveCoverageTotalOnly.js",
53
- "clean_types": "../../scripts/cleanTypes.js"
52
+ "tsc": "tsc",
53
+ "unittest": "tap --no-only --output-file=testStats.md --reporter=terse && tsc -p tsconfig.json --noEmit && npm run clean_cov && npm run perf"
54
54
  },
55
55
  "tap": {
56
56
  "check-coverage": false,
@@ -79,48 +79,48 @@
79
79
  }
80
80
  },
81
81
  "dependencies": {
82
- "@babel/runtime": "^7.15.4",
83
- "arrayiffy-if-string": "^4.0.0",
82
+ "@babel/runtime": "^7.16.0",
83
+ "arrayiffy-if-string": "^4.0.4",
84
84
  "lodash.isplainobject": "^4.0.6",
85
- "string-character-is-astral-surrogate": "^2.0.0"
85
+ "string-character-is-astral-surrogate": "^2.0.4"
86
86
  },
87
87
  "devDependencies": {
88
- "@babel/cli": "^7.15.4",
89
- "@babel/core": "^7.15.5",
90
- "@babel/node": "^7.15.4",
91
- "@babel/plugin-external-helpers": "^7.14.5",
92
- "@babel/plugin-proposal-class-properties": "^7.14.5",
93
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
94
- "@babel/plugin-proposal-object-rest-spread": "^7.15.6",
95
- "@babel/plugin-proposal-optional-chaining": "^7.14.5",
96
- "@babel/plugin-transform-runtime": "^7.15.0",
97
- "@babel/preset-env": "^7.15.6",
98
- "@babel/preset-typescript": "^7.15.0",
99
- "@babel/register": "^7.15.3",
88
+ "@babel/cli": "^7.16.0",
89
+ "@babel/core": "^7.16.0",
90
+ "@babel/node": "^7.16.0",
91
+ "@babel/plugin-external-helpers": "^7.16.0",
92
+ "@babel/plugin-proposal-class-properties": "^7.16.0",
93
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
94
+ "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
95
+ "@babel/plugin-proposal-optional-chaining": "^7.16.0",
96
+ "@babel/plugin-transform-runtime": "^7.16.0",
97
+ "@babel/preset-env": "^7.16.0",
98
+ "@babel/preset-typescript": "^7.16.0",
99
+ "@babel/register": "^7.16.0",
100
100
  "@istanbuljs/esm-loader-hook": "^0.1.2",
101
101
  "@rollup/plugin-babel": "^5.3.0",
102
- "@rollup/plugin-commonjs": "^20.0.0",
103
- "@rollup/plugin-node-resolve": "^13.0.4",
102
+ "@rollup/plugin-commonjs": "^21.0.1",
103
+ "@rollup/plugin-node-resolve": "^13.0.6",
104
104
  "@rollup/plugin-strip": "^2.1.0",
105
- "@rollup/plugin-typescript": "^8.2.5",
105
+ "@rollup/plugin-typescript": "^8.3.0",
106
106
  "@types/lodash.isplainobject": "^4.0.6",
107
- "@types/node": "^16.9.1",
107
+ "@types/node": "^16.11.6",
108
108
  "@types/tap": "^15.0.5",
109
- "@typescript-eslint/eslint-plugin": "^4.31.0",
110
- "@typescript-eslint/parser": "^4.31.0",
111
- "core-js": "^3.17.3",
109
+ "@typescript-eslint/eslint-plugin": "^5.3.0",
110
+ "@typescript-eslint/parser": "^5.3.0",
111
+ "core-js": "^3.19.1",
112
112
  "cross-env": "^7.0.3",
113
- "eslint": "^7.32.0",
114
- "lect": "^0.18.0",
115
- "rollup": "^2.56.3",
113
+ "eslint": "^8.1.0",
114
+ "lect": "^0.18.4",
115
+ "rollup": "^2.59.0",
116
116
  "rollup-plugin-ascii": "^0.0.3",
117
117
  "rollup-plugin-banner": "^0.2.1",
118
118
  "rollup-plugin-cleanup": "^3.2.1",
119
119
  "rollup-plugin-dts": "^4.0.0",
120
120
  "rollup-plugin-terser": "^7.0.2",
121
- "tap": "^15.0.9",
121
+ "tap": "^15.0.10",
122
122
  "tslib": "^2.3.1",
123
- "typescript": "^4.4.2"
123
+ "typescript": "^4.4.4"
124
124
  },
125
125
  "engines": {
126
126
  "node": ">=12"