Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ret

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ret - npm Package Compare versions

Comparing version 0.3.2 to 0.4.0

dist/reconstruct.d.ts

1

dist/index.d.ts
import { types } from './types';
export * from './tokenizer';
export * from './reconstruct';
import { tokenizer } from './tokenizer';

@@ -4,0 +5,0 @@ export * from './types';

@@ -17,3 +17,5 @@ "use strict";

__exportStar(require("./tokenizer"), exports);
__exportStar(require("./reconstruct"), exports);
const tokenizer_1 = require("./tokenizer");
const reconstruct_1 = require("./reconstruct");
__exportStar(require("./types"), exports);

@@ -23,2 +25,3 @@ exports.default = tokenizer_1.tokenizer;

module.exports.types = types_1.types;
module.exports.reconstruct = reconstruct_1.reconstruct;
//# sourceMappingURL=index.js.map
export * from './tokens';
export * from './types';
export * from './set-lookup';

@@ -15,2 +15,3 @@ "use strict";

__exportStar(require("./types"), exports);
__exportStar(require("./set-lookup"), exports);
//# sourceMappingURL=index.js.map

2

package.json

@@ -11,3 +11,3 @@ {

],
"version": "0.3.2",
"version": "0.4.0",
"repository": {

@@ -14,0 +14,0 @@ "type": "git",

@@ -32,2 +32,23 @@ # Regular Expression Tokenizer

# Reconstructing Regular Expressions from Tokens
The `reconstruct` function accepts an *any* token and returns, as a string, the *component* of the regular expression that is associated with that token.
```ts
import { reconstruct, types } from 'ret'
const tokens = ret(/foo|bar/.source)
const setToken = {
"type": types.SET,
"set": [
{ "type": types.CHAR, "value": 97 },
{ "type": types.CHAR, "value": 98 },
{ "type": types.CHAR, "value": 99 }
],
"not": true
}
reconstruct(tokens) // 'foo|bar'
reconstruct({ "type": types.CHAR, "value": 102 }) // 'f'
reconstruct(setToken) // '^abc'
```
# Token Types

@@ -34,0 +55,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc