string-left-right 2.3.28 → 2.3.32

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2015-2020 Roy Revelt and other contributors
3
+ Copyright (c) 2010-2020 Roy Revelt and other contributors
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -1,8 +1,28 @@
1
1
  # string-left-right
2
2
 
3
- > Look what's to the left or the right of a given index within a string
3
+ > Looks up the first non-whitespace character to the left/right of a given index
4
4
 
5
- <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center">
5
+ <div class="package-badges">
6
+ <a href="https://www.npmjs.com/package/string-left-right" rel="nofollow noreferrer noopener">
7
+ <img src="https://img.shields.io/badge/-npm-blue?style=flat-square" alt="page on npm">
8
+ </a>
9
+ <a href="https://codsen.com/os/string-left-right" rel="nofollow noreferrer noopener">
10
+ <img src="https://img.shields.io/badge/-Codsen-blue?style=flat-square" alt="page on npm">
11
+ </a>
12
+ <a href="https://gitlab.com/codsen/codsen/tree/master/packages/string-left-right" rel="nofollow noreferrer noopener">
13
+ <img src="https://img.shields.io/badge/-GitLab-blue?style=flat-square" alt="page on GitLab">
14
+ </a>
15
+ <a href="https://npmcharts.com/compare/string-left-right?interval=30" rel="nofollow noreferrer noopener" target="_blank">
16
+ <img src="https://img.shields.io/npm/dm/string-left-right.svg?style=flat-square" alt="Downloads per month">
17
+ </a>
18
+ <a href="https://prettier.io" rel="nofollow noreferrer noopener" target="_blank">
19
+ <img src="https://img.shields.io/badge/code_style-prettier-brightgreen.svg?style=flat-square" alt="Code style: prettier">
20
+ </a>
21
+ <img src="https://img.shields.io/badge/licence-MIT-brightgreen.svg?style=flat-square" alt="MIT License">
22
+ <a href="https://liberamanifesto.com" rel="nofollow noreferrer noopener" target="_blank">
23
+ <img src="https://img.shields.io/badge/libera-manifesto-lightgrey.svg?style=flat-square" alt="libera manifesto">
24
+ </a>
25
+ </div>
6
26
 
7
27
  ## Install
8
28
 
@@ -10,18 +30,43 @@
10
30
  npm i string-left-right
11
31
  ```
12
32
 
13
- <img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center">
33
+ ## Quick Take
14
34
 
15
- ## Documentation
35
+ ```js
36
+ import { strict as assert } from "assert";
37
+ import {
38
+ left,
39
+ right,
40
+ leftSeq,
41
+ rightSeq,
42
+ chompLeft,
43
+ chompRight,
44
+ leftStopAtNewLines,
45
+ rightStopAtNewLines,
46
+ } from "string-left-right";
47
+
48
+ // get the closest non-whitespace character to the left of "d" (which itself
49
+ // is at string index 6)
50
+ const str = "abc def";
51
+ // | |
52
+ // 012345678
16
53
 
17
- Please [visit our documentation](https://codsen.com/os/string-left-right/) for a full description of the API and examples.
54
+ assert.equal(
55
+ `next non-whitespace character to the left of ${str[6]} (index 6) is ${
56
+ str[left(str, 6)]
57
+ } (index ${left(str, 6)})`,
58
+ "next non-whitespace character to the left of d (index 6) is c (index 2)"
59
+ );
60
+ ```
61
+
62
+ ## Documentation
18
63
 
19
- <img src="https://codsen.com/images/png-codsen-star.png" width="42" alt="star" align="center">
64
+ Please [visit codsen.com](https://codsen.com/os/string-left-right/) for a full description of the API and examples.
20
65
 
21
66
  ## Licence
22
67
 
23
68
  MIT License
24
69
 
25
- Copyright (c) 2015-2020 Roy Revelt and other contributors
70
+ Copyright (c) 2010-2020 Roy Revelt and other contributors
26
71
 
27
- <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
72
+ <img src="https://codsen.com/images/png-codsen-ok.png" width="98" alt="ok" align="center"> <img src="https://codsen.com/images/png-codsen-1.png" width="148" alt="codsen" align="center"> <img src="https://codsen.com/images/png-codsen-star-small.png" width="32" alt="star" align="center">
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * string-left-right
3
- * Look what's to the left or the right of a given index within a string
4
- * Version: 2.3.28
3
+ * Looks up the first non-whitespace character to the left/right of a given index
4
+ * Version: 2.3.32
5
5
  * Author: Roy Revelt, Codsen Ltd
6
6
  * License: MIT
7
7
  * Homepage: https://codsen.com/os/string-left-right/
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * string-left-right
3
- * Look what's to the left or the right of a given index within a string
4
- * Version: 2.3.28
3
+ * Looks up the first non-whitespace character to the left/right of a given index
4
+ * Version: 2.3.32
5
5
  * Author: Roy Revelt, Codsen Ltd
6
6
  * License: MIT
7
7
  * Homepage: https://codsen.com/os/string-left-right/
@@ -261,11 +261,11 @@
261
261
 
262
262
  function createCommonjsModule(fn, basedir, module) {
263
263
  return module = {
264
- path: basedir,
265
- exports: {},
266
- require: function (path, base) {
267
- return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
268
- }
264
+ path: basedir,
265
+ exports: {},
266
+ require: function (path, base) {
267
+ return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
268
+ }
269
269
  }, fn(module, module.exports), module.exports;
270
270
  }
271
271
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * string-left-right
3
- * Look what's to the left or the right of a given index within a string
4
- * Version: 2.3.28
3
+ * Looks up the first non-whitespace character to the left/right of a given index
4
+ * Version: 2.3.32
5
5
  * Author: Roy Revelt, Codsen Ltd
6
6
  * License: MIT
7
7
  * Homepage: https://codsen.com/os/string-left-right/
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * string-left-right
3
- * Look what's to the left or the right of a given index within a string
4
- * Version: 2.3.28
3
+ * Looks up the first non-whitespace character to the left/right of a given index
4
+ * Version: 2.3.32
5
5
  * Author: Roy Revelt, Codsen Ltd
6
6
  * License: MIT
7
7
  * Homepage: https://codsen.com/os/string-left-right/
@@ -0,0 +1,28 @@
1
+ /* eslint import/extensions:0, no-unused-vars:0 */
2
+
3
+ // Quick Take
4
+
5
+ import { strict as assert } from "assert";
6
+ import {
7
+ left,
8
+ right,
9
+ leftSeq,
10
+ rightSeq,
11
+ chompLeft,
12
+ chompRight,
13
+ leftStopAtNewLines,
14
+ rightStopAtNewLines,
15
+ } from "../dist/string-left-right.esm.js";
16
+
17
+ // get the closest non-whitespace character to the left of "d" (which itself
18
+ // is at string index 6)
19
+ const str = "abc def";
20
+ // | |
21
+ // 012345678
22
+
23
+ assert.equal(
24
+ `next non-whitespace character to the left of ${str[6]} (index 6) is ${
25
+ str[left(str, 6)]
26
+ } (index ${left(str, 6)})`,
27
+ "next non-whitespace character to the left of d (index 6) is c (index 2)"
28
+ );
@@ -0,0 +1 @@
1
+ {"_quickTake.js":{"title":"Quick Take","content":"import &#x7B; strict as assert &#x7D; from \"assert\";\nimport &#x7B;\n left,\n right,\n leftSeq,\n rightSeq,\n chompLeft,\n chompRight,\n leftStopAtNewLines,\n rightStopAtNewLines,\n&#x7D; from \"string-left-right\";\n\n// get the closest non-whitespace character to the left of \"d\" (which itself\n// is at string index 6)\nconst str = \"abc def\";\n// | |\n// 012345678\n\nassert.equal(\n `next non-whitespace character to the left of $&#x7B;str[6]&#x7D; (index 6) is $&#x7B;\n str[left(str, 6)]\n &#x7D; (index $&#x7B;left(str, 6)&#x7D;)`,\n \"next non-whitespace character to the left of d (index 6) is c (index 2)\"\n);"}}
package/package.json CHANGED
@@ -1,15 +1,7 @@
1
1
  {
2
2
  "name": "string-left-right",
3
- "version": "2.3.28",
4
- "description": "Look what's to the left or the right of a given index within a string",
5
- "license": "MIT",
6
- "repository": "https://gitlab.com/codsen/codsen/",
7
- "homepage": "https://codsen.com/os/string-left-right/",
8
- "author": {
9
- "email": "roy@codsen.com",
10
- "name": "Roy Revelt",
11
- "url": "codsen.com"
12
- },
3
+ "version": "2.3.32",
4
+ "description": "Looks up the first non-whitespace character to the left/right of a given index",
13
5
  "keywords": [
14
6
  "check",
15
7
  "left",
@@ -25,6 +17,14 @@
25
17
  "traversal",
26
18
  "traverse"
27
19
  ],
20
+ "homepage": "https://codsen.com/os/string-left-right/",
21
+ "repository": "https://gitlab.com/codsen/codsen/",
22
+ "license": "MIT",
23
+ "author": {
24
+ "name": "Roy Revelt",
25
+ "email": "roy@codsen.com",
26
+ "url": "https://codsen.com"
27
+ },
28
28
  "main": "dist/string-left-right.cjs.js",
29
29
  "module": "dist/string-left-right.esm.js",
30
30
  "browser": "dist/string-left-right.umd.js",
@@ -43,7 +43,8 @@
43
43
  "republish": "npm publish || :",
44
44
  "tap": "tap",
45
45
  "pretest": "npm run build",
46
- "test": "npm run lint && npm run unittest && npm run clean_cov && npm run format",
46
+ "test": "npm run lint && npm run unittest && npm run test:examples && npm run clean_cov && npm run format",
47
+ "test:examples": "../../scripts/test-examples.js && npm run lect && npm run prettier",
47
48
  "tsd": "tsd",
48
49
  "unittest": "./node_modules/.bin/tap --no-only --output-file=testStats.md && npm run clean_cov && npm run perf",
49
50
  "version": "npm run build && git add ."
@@ -53,6 +54,17 @@
53
54
  "pre-commit": "npm run format && npm test"
54
55
  }
55
56
  },
57
+ "tap": {
58
+ "coverage-report": [
59
+ "json-summary",
60
+ "text"
61
+ ],
62
+ "nyc-arg": [
63
+ "--exclude=**/*.cjs.js",
64
+ "--exclude=**/*.umd.js"
65
+ ],
66
+ "timeout": 0
67
+ },
56
68
  "lect": {
57
69
  "defaultExported": false,
58
70
  "files": {
@@ -82,44 +94,32 @@
82
94
  "goodFolders": []
83
95
  },
84
96
  "req": "{ left, right, leftSeq, rightSeq, chompLeft, chompRight, leftStopAtNewLines, rightStopAtNewLines }",
85
- "typeSriptDefinitions": false,
86
97
  "various": {
87
98
  "devDependencies": []
88
99
  }
89
100
  },
90
- "tap": {
91
- "coverage-report": [
92
- "json-summary",
93
- "text"
94
- ],
95
- "nyc-arg": [
96
- "--exclude=**/*.cjs.js",
97
- "--exclude=**/*.umd.js"
98
- ],
99
- "timeout": 0
100
- },
101
101
  "dependencies": {
102
102
  "lodash.clonedeep": "^4.5.0",
103
103
  "lodash.isplainobject": "^4.0.6"
104
104
  },
105
105
  "devDependencies": {
106
- "@babel/core": "^7.11.6",
107
- "@babel/plugin-proposal-class-properties": "^7.10.4",
108
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.10.4",
109
- "@babel/plugin-proposal-object-rest-spread": "^7.11.0",
110
- "@babel/plugin-proposal-optional-chaining": "^7.11.0",
111
- "@babel/preset-env": "^7.11.5",
112
- "@rollup/plugin-babel": "^5.2.0",
113
- "@rollup/plugin-commonjs": "^15.0.0",
114
- "@rollup/plugin-node-resolve": "^9.0.0",
106
+ "@babel/core": "^7.12.3",
107
+ "@babel/plugin-proposal-class-properties": "^7.12.1",
108
+ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
109
+ "@babel/plugin-proposal-object-rest-spread": "^7.12.1",
110
+ "@babel/plugin-proposal-optional-chaining": "^7.12.1",
111
+ "@babel/preset-env": "^7.12.1",
112
+ "@rollup/plugin-babel": "^5.2.1",
113
+ "@rollup/plugin-commonjs": "^16.0.0",
114
+ "@rollup/plugin-node-resolve": "^10.0.0",
115
115
  "@rollup/plugin-strip": "^2.0.0",
116
116
  "benchmark": "^2.1.4",
117
- "eslint": "^7.8.1",
118
- "lect": "^0.13.11",
119
- "rollup": "^2.26.10",
117
+ "eslint": "^7.13.0",
118
+ "lect": "^0.14.8",
119
+ "rollup": "^2.33.1",
120
120
  "rollup-plugin-ascii": "^0.0.3",
121
121
  "rollup-plugin-banner": "^0.2.1",
122
- "rollup-plugin-cleanup": "^3.1.1",
122
+ "rollup-plugin-cleanup": "^3.2.1",
123
123
  "rollup-plugin-terser": "^7.0.2",
124
124
  "tap": "^14.10.8",
125
125
  "tsd": "^0.13.1"