juliangruber / balanced-match Goto Github PK
View Code? Open in Web Editor NEWMatch balanced character pairs, like { and }
License: MIT License
Match balanced character pairs, like { and }
License: MIT License
https://github.com/juliangruber/balanced-match/blob/master/index.js#L13
If a and b are null, then an error will be throw
npm ERR! notarget No compatible version found: balanced-match@^1.0.0
npm ERR! notarget Valid install targets:
npm ERR! notarget 0.4.2, 0.4.1, 0.4.0, 0.3.0, 0.2.1, 0.2.0, 0.1.0, 0.0.1, 0.0.0
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'brace-expansion'
npm ERR! notarget
As of a few hours ago, v1.0.0 of this no longer exists on NPM. Not sure if NPM issues or if someone deleted the version from NPM.
EDIT: This maybe a NPM proxy issues.. Will update I know for sure. Was nexus proxy issue.
When attempting to build a Jekyll site on Github, I'm getting this error:
I'm getting this error Your site is having problems building: The variable {{a} on line 50 in node_modules/balanced-match/README.md was not properly closed with }}. For more information, see https://help.github.com/articles/page-build-failed-tag-not-properly-terminated/.
Hi,
I'm using balanced-match to isolate the body of a function (all between brackets)
So, I assume during my test that a function is begining by the same pattern (scope function name params {) and finishing by a bracket (with positive lookahead to see if the next caracters are a new function)
Here is my two regex :
firstRegex : /(override)?\s?(public|private|protected)\s(?:function)\s(get)?\s?(\w*)\s?\((.*)\)\s?:?\s?(\w*)\s*{/
secondRegex : /}(\s)*(?=override|public|private|protected|(}\s*}))/
It's working fine except for the last function who is not followed by a new function but by two brackets (for the end of the class and the end of package)
I have tested my two regex on regex101 and it's working fine (https://regex101.com/r/A7jQDr/1) but when I test with balanced-match it didn't match the same way regex101 does.
Here is my test on RunKit : https://runkit.com/59c0dc7528f14c00126b4314/59c0dc7662f5730012fd1760
As you can see, the match.post contains a extra bracket ..
If someone can tell me what's wrong.
As of v2.0.0, many projects will inadvertently bundle ES6 source from balanced-match
in their ES5 bundles. This is a result of 1) balanced-match
v2.0.0 being written in ES6 but not offering a separate ES5 version as well, and 2) most build processes being configured to ignore files in the node_modules
folder when transpiring to ES5 (e.g. babel).
To address this issue, this library should offer ES5 and ES6 versions (minified and unminified) to accommodate all JavaScript environments. This will allow projects to use balanced-match
without having to worry about transpilation to ES5. The build process would be trivial (compared to larger apps / libraries) and would likely prevent a lot of frustration.
Happy to create a PR with proposed changes.
Thanks!
I'm creating a very lightweight module that can potentially run several millions of times per second.
Right now, I don't use this module because it slices the data automatically... But I would like to use this module because of it's efficient balanced matching.
When you slice the data over and over millions of times when I don't need it, the nanosecond tasks start adding up into several hundreds of millisecond delays, and possibly even seconds.
For my module, I am purely interested in the positions of the matches... I can develop my own highly efficient slicing pattern specific to the data instead of this module doing it automatically when it is not what I need.
My github build pipline is failing and giving me this error:
Is this in fact caused by your module? or is that a red herring?
The page build failed for the `master` branch with the following error:
The variable `{{a}` on line 50 in `site_generator/node_modules/balanced-match/README.md` was not properly closed with `}}`. For more information, see https://docs.github.com/github/working-with-github-pages/troubleshooting-jekyll-build-errors-for-github-pages-sites#tag-not-properly-terminated.
For information on troubleshooting Jekyll see:
https://docs.github.com/articles/troubleshooting-jekyll-builds
I would expect matching delimiters to work. Ie: code fences in Markdown.
```js
const foo = bar => baz
```
It seems imposible to balance matching delimiters with balanced-match
.
Is this expected?
Example:
const balanced = require('balanced-match')
const contents = 'PRE ___BODY___ POST'
const result = balanced('___', '___', contents)
console.log(result)
Result:
(Where is the body?)
{ start: 11, end: 11, pre: 'PRE ___BODY', body: '', post: ' POST' }
Expected:
(I was thinking we should see this)
{ start: 4, end: 11, pre: 'PRE ', body: 'BODY', post: ' POST' }
I know you have the license as part of the Readme.md file, but would you please consider making it a separate file called LICENSE or LICENSE.md or LICENSE.txt? It's fairly standard practice to make the license a separate file so that it's easier for people (and packagers for distributions such as Fedora) to easily find the license.
Thanks!
Hi,
Since the launch of the new version today I get the following error:
/node_modules/balanced-match/index.js:7 const r = range(a, b, str) ^^^^^
SyntaxError: Use of const in strict mode.
What do I need to do?
Kind Regards
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.