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

restream

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restream - npm Package Compare versions

Comparing version 3.5.0 to 3.5.1

externs.js

23

build/Replaceable.js

@@ -8,3 +8,4 @@ const { Transform } = require('stream');

* Replaceable class that extends Transform and pushes data when it's done replacing each incoming chunk. If the replacement is passed as a function, it will work in the same way as the replacer for `string.replace` method (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace), taking the `match` as the first argument, and matched `p1`, `p2`, _etc_ parameters as following arguments. The replacer can also be an async function.
* @param {Rule|Rule[]} rules A single replacement rule, or multiple rules.
* @param {(Rule|Array<Rule>)} rules A single replacement rule, or multiple rules.
* @param {TransformOptions=} [options] The options for the transform stream.
* @example

@@ -20,4 +21,4 @@ *

*/
constructor(rules) {
super()
constructor(rules, options) {
super(options)
const re = Array.isArray(rules) ? rules : [rules]

@@ -45,3 +46,3 @@ const fr = re.filter(checkRule)

} else {
/** @type {function} */
/** @type {(Replacer|AsyncReplacer)} */
const R = replacement.bind(this)

@@ -85,4 +86,4 @@ const promises = []

} catch (e) {
const s = cleanStack(e['stack'])
e['stack'] = s
const s = cleanStack(e.stack)
e.stack = s
next(e)

@@ -98,3 +99,3 @@ }

/**
* @param {Rule|Rule[]} rules
* @param {(Rule|Array<Rule>)} rules
*/

@@ -106,4 +107,4 @@ constructor(rules) {

addItem(fn) {
const pp = this['promise'].then(fn)
this['promise'] = pp
const pp = this.promise.then(fn)
this.promise = pp
return pp

@@ -113,2 +114,6 @@ }

/**
* @typedef {import('stream').TransformOptions} TransformOptions
*/
/* documentary types/rules.xml */

@@ -115,0 +120,0 @@ /**

@@ -0,1 +1,8 @@

## 28 March 2019
### [3.5.1](git+https://github.com/artdecocode/restream/compare/v3.5.0...v3.5.1)
- [fix] Allow to pass options to the _Transform_ constructor from _Replaceable_.
- [package] Add experimental externs file for _Depack_.
## 23 January 2019

@@ -2,0 +9,0 @@

{
"name": "restream",
"version": "3.5.0",
"version": "3.5.1",
"description": "Regular Expression Detection & Replacement streams.",

@@ -18,3 +18,4 @@ "main": "build/index.js",

"d4": "NODE_DEBUG=doc doc src/SyncReplaceable.js -g",
"d": "yarn-s d1 d2 d3",
"d5": "NODE_DEBUG=doc doc externs.js -g",
"d": "yarn-s d1 d2 d3 d4 d5",
"e": "node example",

@@ -33,4 +34,6 @@ "doc": "NODE_DEBUG=doc doc documentary -o README.md",

"build",
"src"
"src",
"externs.js"
],
"externs": "externs.js",
"repository": {

@@ -61,10 +64,9 @@ "type": "git",

"devDependencies": {
"alamode": "1.6.1",
"catchment": "3.2.1",
"documentary": "1.20.1",
"alamode": "1.8.6",
"catchment": "3.2.2",
"documentary": "1.23.0",
"eslint-config-artdeco": "1.0.1",
"snapshot-context": "2.0.4",
"spawncommand": "2.1.0",
"spawncommand": "2.1.1",
"yarn-s": "1.1.0",
"zoroaster": "3.6.6"
"zoroaster": "3.11.1"
},

@@ -71,0 +73,0 @@ "dependencies": {

@@ -35,3 +35,3 @@ # restream

* [`Async Function` Replacer](#async-function-replacer)
* [`constructor(rule: Rule|Rules[]): Replaceable`](#constructorrule-rulerules-replaceable)
* [`constructor(rule: Rule|Rules[], options?: TransformOptions): Replaceable`](#constructorrule-rulerulesoptions-transformoptions-replaceable)
* [`Replacer` Context](#replacer-context)

@@ -205,5 +205,5 @@ * [`brake()`](#brake-void)

### `constructor(`<br/>&nbsp;&nbsp;`rule: Rule|Rules[],`<br/>`): Replaceable`
### `constructor(`<br/>&nbsp;&nbsp;`rule: Rule|Rules[],`<br/>&nbsp;&nbsp;`options?: TransformOptions,`<br/>`): Replaceable`
Create a `Transform` stream which will make data available when an incoming chunk has been updated according to the specified rule or rules.
Create a _Transform_ stream which will make data available when an incoming chunk has been updated according to the specified rule or rules. The second argument will be passed as options to the _Transform_ constructor if specified.

@@ -269,3 +269,3 @@ Matches can be replaced using a string, function or async function. When multiple rules are passed as an array, the string will be replaced multiple times if the latter rules also modify the data.

Author: <strong>John</strong>
on <em>2019-1-23 22:59:49</em>
on <em>2019-3-28 13:40:38</em>
```

@@ -533,5 +533,5 @@

```
Test: serial 113ms, parallel 423ms,
Example: serial 217ms, parallel 423ms,
Total: serial 319ms, parallel 423ms,
Test: serial 114ms, parallel 425ms,
Example: serial 216ms, parallel 425ms,
Total: serial 320ms, parallel 425ms,
```

@@ -543,3 +543,3 @@

The _SyncReplaceable_ can be used when data is already stored on memory (for example, if you're running an Azure function with Node.js and it doesn't support streaming), and needs to be transformed using the synchronous flow. This implies that the asynchronous methods would not work also.
The _SyncReplaceable_ can be used when data is already stored on memory (for example, if you're running an Azure function with Node.JS and it doesn't support streaming), and needs to be transformed using the synchronous flow. This implies that the rules cannot contain asynchronous replacers.

@@ -752,3 +752,3 @@ ```js

_For example, given the following input_:
```md
```markdown
<a href="test_hello_world.html">Example</a>

@@ -938,20 +938,19 @@ ```

<table>
<tr>
<th>
<a href="https://artd.eco">
<img src="images/artdeco.png" alt="Art Deco">
</a>
</th>
<th>&copy; <a href="https://artd.eco">Art Deco</a> 2019</th>
<th>
<a href="https://www.technation.sucks" title="Tech Nation Visa">
<img src="images/technation.gif" alt="Tech Nation Visa">
</a>
</th>
<th>
<a href="https://www.technation.sucks">Tech Nation Visa Sucks</a>
</th>
</tr>
<tr>
<th>
<a href="https://artd.eco">
<img src="https://raw.githubusercontent.com/wrote/wrote/master/images/artdeco.png" alt="Art Deco" />
</a>
</th>
<th>© <a href="https://artd.eco">Art Deco</a> 2019</th>
<th>
<a href="https://www.technation.sucks" title="Tech Nation Visa">
<img src="https://raw.githubusercontent.com/artdecoweb/www.technation.sucks/master/anim.gif"
alt="Tech Nation Visa" />
</a>
</th>
<th><a href="https://www.technation.sucks">Tech Nation Visa Sucks</a></th>
</tr>
</table>
<p align="center"><a href="#table-of-contents"><img src=".documentary/section-breaks/-1.svg?sanitize=true"></a></p>

@@ -8,3 +8,4 @@ import { Transform } from 'stream'

* Replaceable class that extends Transform and pushes data when it's done replacing each incoming chunk. If the replacement is passed as a function, it will work in the same way as the replacer for `string.replace` method (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace), taking the `match` as the first argument, and matched `p1`, `p2`, _etc_ parameters as following arguments. The replacer can also be an async function.
* @param {Rule|Rule[]} rules A single replacement rule, or multiple rules.
* @param {(Rule|Array<Rule>)} rules A single replacement rule, or multiple rules.
* @param {TransformOptions=} [options] The options for the transform stream.
* @example

@@ -20,4 +21,4 @@ *

*/
constructor(rules) {
super()
constructor(rules, options) {
super(options)
const re = Array.isArray(rules) ? rules : [rules]

@@ -45,3 +46,3 @@ const fr = re.filter(checkRule)

} else {
/** @type {function} */
/** @type {(Replacer|AsyncReplacer)} */
const R = replacement.bind(this)

@@ -85,4 +86,4 @@ const promises = []

} catch (e) {
const s = cleanStack(e['stack'])
e['stack'] = s
const s = cleanStack(e.stack)
e.stack = s
next(e)

@@ -98,3 +99,3 @@ }

/**
* @param {Rule|Rule[]} rules
* @param {(Rule|Array<Rule>)} rules
*/

@@ -106,4 +107,4 @@ constructor(rules) {

addItem(fn) {
const pp = this['promise'].then(fn)
this['promise'] = pp
const pp = this.promise.then(fn)
this.promise = pp
return pp

@@ -113,2 +114,6 @@ }

/**
* @typedef {import('stream').TransformOptions} TransformOptions
*/
/* documentary types/rules.xml */

@@ -115,0 +120,0 @@ /**

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