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

fastrx

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastrx - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

75

index.js

@@ -34,9 +34,9 @@ const {

exports.subscribe = (n, e = noop, c = noop) => source => {
const sink = new Sink()
sink.next = n
sink.complete = err => err ? e(err) : c()
source(sink)
return sink
}
// UTILITY
const sink = new Sink()
sink.next = n
sink.complete = err => err ? e(err) : c()
source(sink)
return sink
}
// UTILITY
class Tap extends Sink {

@@ -59,3 +59,3 @@ init(f) {

this.buffer = []
this.timeoutId = [clearTimeout, ,]
this.timeoutId = [clearTimeout, , ]
this.defer(this.timeoutId)

@@ -102,3 +102,30 @@ }

if(Proxy){
if (typeof Proxy == 'undefined') {
const prototype = {};
//将一个Observable函数的原型修改为具有所有operator的方法
const rx = f => Object.setPrototypeOf(f, prototype);
//提供动态添加Obserable以及operator的方法
rx.set = ext => {
for (let key in ext) {
const f = ext[key]
switch (key) {
case 'Sink':
case 'pipe':
case 'reusePipe':
break
case 'subscribe':
prototype[key] = function(...args) { return f(...args)(this) }
break
case 'toPromise':
prototype[key] = function() { return f(this) }
break
default:
prototype[key] = function(...args) { return rx(f(...args)(this)) }
rx[key] = (...args) => rx(f(...args))
}
}
}
rx.set(exports)
exports.rx = rx
} else {
//该代理可以实现将pipe模式转成链式编程

@@ -112,32 +139,2 @@ const rxProxy = {

})
}
else{
const keys = Object.keys(exports).filter(key=>{
switch(key){
case 'Sink':
case 'pipe':
case 'reusePipe':
return false
default: return true
}
})
function setProps(t){
keys.forEach(key=>{
Object.defineProperty(t,key,{
get(){
return (...args) =>setProps(exports[key](...args)(t))
}
})
})
return t
}
const rx = f => setProps(f)
keys.forEach(key=>{
Object.defineProperty(rx,key,{
get(){
return (...args) =>setProps(exports[key](...args))
}
})
})
exports.rx = rx
}
{
"name": "fastrx",
"version": "1.0.3",
"version": "1.0.4",
"description": "fast rxjs implemention",

@@ -5,0 +5,0 @@ "main": "index.js",

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