New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ebflat9/fp

Package Overview
Dependencies
Maintainers
1
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ebflat9/fp - npm Package Compare versions

Comparing version 1.1.77 to 1.1.78

2

package.json
{
"name": "@ebflat9/fp",
"version": "1.1.77",
"version": "1.1.78",
"description": "my fp utils",

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

@@ -1,3 +0,2 @@

import { curry } from '../combinators.js'
import { withNext } from './utils.js'
import { placeholder, withNext } from './utils.js'

@@ -10,3 +9,3 @@ /**

*/
export const buffer = curry((count, stream) => {
export const buffer = placeholder((count, stream) => {
const internalStorage = []

@@ -13,0 +12,0 @@ return new Observable(observer => {

@@ -1,2 +0,2 @@

import { curry } from '../combinators.js'
import { placeholder } from './utils.js'

@@ -9,3 +9,3 @@ /**

*/
export const catchError = curry((handler, stream) => {
export const catchError = placeholder((handler, stream) => {
const sub = []

@@ -12,0 +12,0 @@ return new Observable(observer => {

import { values } from '../combinators.js'
import { placeholder } from './utils.js'

@@ -9,3 +10,3 @@ /**

*/
export const combine = (...streams) => {
export const combine = placeholder((...streams) => {
let done = 0

@@ -35,2 +36,2 @@ const store = Object.fromEntries(streams.map((_, i) => [i, []]))

})
}
})

@@ -0,1 +1,2 @@

import { placeholder } from './utils.js'
/**

@@ -6,3 +7,3 @@ * Concat, append streams

*/
export const concat = (...streams) => {
export const concat = placeholder((...streams) => {
const subs = []

@@ -13,3 +14,3 @@ return new Observable(observer => {

})
}
})

@@ -16,0 +17,0 @@ function subNextStream(streams, i, subs, observer) {

@@ -1,2 +0,3 @@

import { curry, last } from '../combinators.js'
import { last } from '../combinators.js'
import { placeholder } from './utils.js'

@@ -9,3 +10,3 @@ /**

*/
export const debounce = curry((limit, stream) => {
export const debounce = placeholder((limit, stream) => {
const stack = []

@@ -12,0 +13,0 @@ let lastInterval = 0

import { deepEqual } from '../combinators.js'
import { withNext } from './utils.js'
import { withNext, placeholder } from './utils.js'

@@ -9,3 +9,3 @@ /**

*/
export const distinct = (fn, stream) => {
export const distinct = placeholder((fn, stream) => {
let lastSent = null

@@ -29,2 +29,2 @@ return new Observable(observer => {

})
}
})

@@ -1,3 +0,2 @@

import { curry } from '../combinators.js'
import { withNext } from './utils.js'
import { withNext, placeholder } from './utils.js'

@@ -10,3 +9,3 @@ /**

*/
export const effect = curry(
export const effect = placeholder(
(fn, stream) =>

@@ -13,0 +12,0 @@ new Observable(observer => {

@@ -1,3 +0,2 @@

import { curry } from '../combinators.js'
import { withNext } from './utils.js'
import { withNext, placeholder } from './utils.js'

@@ -10,3 +9,3 @@ /**

*/
export const filter = curry(
export const filter = placeholder(
(predicate, stream) =>

@@ -13,0 +12,0 @@ new Observable(observer => {

@@ -1,2 +0,2 @@

import { curry } from '../combinators.js'
import { placeholder } from './utils.js'

@@ -9,3 +9,3 @@ /**

*/
export const finallyEffect = curry(
export const finallyEffect = placeholder(
(fn, stream) =>

@@ -12,0 +12,0 @@ new Observable(observer => {

@@ -1,2 +0,2 @@

import { curry } from '../combinators.js'
import { placeholder } from './utils.js'

@@ -9,3 +9,3 @@ /**

*/
export const flatMap = curry(
export const flatMap = placeholder(
(fn, stream) =>

@@ -12,0 +12,0 @@ new Observable(observer => {

@@ -0,1 +1,2 @@

import { placeholder } from './utils.js'
/**

@@ -7,20 +8,12 @@ * Interval

*/
export const interval = time =>
new Proxy(
{},
{
get(_, prop) {
return (...args) => {
let n = 0
return new Observable(observer => {
const id = setInterval(() => observer.next(++n), time)
observer.next(++n)
return () => {
observer.complete()
clearInterval(id)
}
})[prop](...args)
}
},
export const interval = placeholder(time => {
let n = 0
return new Observable(observer => {
const id = setInterval(() => observer.next(++n), time)
observer.next(++n)
return () => {
observer.complete()
clearInterval(id)
}
)
})
})

@@ -1,2 +0,2 @@

import { curry } from '../combinators.js'
import { placeholder } from './utils.js'
/**

@@ -8,3 +8,3 @@ * Listen

*/
export const listen = curry((eventName, element) => {
export const listen = placeholder((eventName, element) => {
return new Observable(observer => {

@@ -11,0 +11,0 @@ const handler = event => observer.next(event)

@@ -1,3 +0,2 @@

import { curry } from '../combinators.js'
import { withNext } from './utils.js'
import { withNext, placeholder } from './utils.js'

@@ -10,3 +9,3 @@ /**

*/
export const map = curry(
export const map = placeholder(
(fn, stream) =>

@@ -13,0 +12,0 @@ new Observable(observer => {

@@ -1,3 +0,2 @@

import { curry } from '../combinators.js'
import { withNext } from './utils.js'
import { withNext, placeholder } from './utils.js'

@@ -10,3 +9,3 @@ /**

*/
export const mapTo = curry(
export const mapTo = placeholder(
(value, stream) =>

@@ -13,0 +12,0 @@ new Observable(observer => {

@@ -0,1 +1,2 @@

import { placeholder } from './utils.js'
/**

@@ -7,3 +8,3 @@ * Merge, interleave two streams

*/
export const merge = (...streams) => {
export const merge = placeholder((...streams) => {
let done = 0

@@ -20,2 +21,2 @@ return new Observable(observer => {

})
}
})

@@ -1,3 +0,3 @@

import { curry, deepProp } from '../combinators.js'
import { withNext } from './utils.js'
import { deepProp } from '../combinators.js'
import { withNext, placeholder } from './utils.js'

@@ -10,3 +10,3 @@ /**

*/
export const pick = curry(
export const pick = placeholder(
(key, stream) =>

@@ -13,0 +13,0 @@ new Observable(observer => {

@@ -1,2 +0,2 @@

import { curry } from '../combinators.js'
import { placeholder } from './utils.js'

@@ -10,3 +10,3 @@ /**

*/
export const reduce = curry((reducer, initialValue, stream) => {
export const reduce = placeholder((reducer, initialValue, stream) => {
let accumulator = initialValue ?? {}

@@ -13,0 +13,0 @@ return new Observable(observer => {

@@ -1,2 +0,3 @@

import { curry, isNumber } from '../combinators.js'
import { isNumber } from '../combinators.js'
import { placeholder } from './utils.js'

@@ -17,3 +18,3 @@ // Defaults: method 'expo' for exponential time increase, anything else for

*/
export const retry = curry((config, stream) => {
export const retry = placeholder((config, stream) => {
if (isNumber(config)) {

@@ -20,0 +21,0 @@ config = Object.assign(defaultConfig, { retries: config })

@@ -1,3 +0,2 @@

import { curry } from '../combinators.js'
import { withNext } from './utils.js'
import { withNext, placeholder } from './utils.js'

@@ -10,3 +9,3 @@ /**

*/
export const skip = curry((count, stream) => {
export const skip = placeholder((count, stream) => {
let skipped = 0

@@ -13,0 +12,0 @@ return new Observable(observer => {

@@ -0,1 +1,2 @@

import { placeholder } from './utils.js'
/**

@@ -6,21 +7,23 @@ * Switch, switch to a mapped Observable

*/
export const switchStream = stream =>
new Observable(observer => {
let done = false
let subs = stream.subscribe({
next: nextStream =>
queueMicrotask(() => {
if (!done) {
subs.unsubscribe()
subs = nextStream.subscribe({
next: value => observer.next(value),
complete: () => observer.complete(),
})
}
}),
export const switchStream = placeholder(
stream =>
new Observable(observer => {
let done = false
let subs = stream.subscribe({
next: nextStream =>
queueMicrotask(() => {
if (!done) {
subs.unsubscribe()
subs = nextStream.subscribe({
next: value => observer.next(value),
complete: () => observer.complete(),
})
}
}),
})
return () => {
done = true
subs.unsubscribe()
}
})
return () => {
done = true
subs.unsubscribe()
}
})
)

@@ -1,3 +0,2 @@

import { curry } from '../combinators.js'
import { withNext } from './utils.js'
import { withNext, placeholder } from './utils.js'

@@ -10,3 +9,3 @@ /**

*/
export const take = curry((numberToTake, stream) => {
export const take = placeholder((numberToTake, stream) => {
let taken = 0

@@ -13,0 +12,0 @@ return new Observable(observer => {

@@ -1,3 +0,2 @@

import { curry } from '../combinators.js'
import { withNext } from './utils.js'
import { withNext, placeholder } from './utils.js'

@@ -10,3 +9,3 @@ /**

*/
export const throttle = curry((limit, stream) => {
export const throttle = placeholder((limit, stream) => {
let lastRan = 0

@@ -13,0 +12,0 @@ let lastInterval = 0

@@ -1,2 +0,2 @@

import { curry } from '../combinators.js'
import { placeholder } from './utils.js'

@@ -9,3 +9,3 @@ /**

*/
export const until = curry(
export const until = placeholder(
(comparator, stream) =>

@@ -12,0 +12,0 @@ new Observable(observer => {

@@ -6,1 +6,13 @@ export const withNext = observer => next => ({

})
export const placeholder =
creator =>
(...initialArgs) =>
new Proxy(
{},
{
get(_, prop) {
return (...args) => creator(...initialArgs)[prop](...args)
},
}
)
import { isFunction, head, values } from '../combinators.js'
import { placeholder } from './utils.js'

@@ -8,3 +9,3 @@ /**

*/
export const zip = (...streams) => {
export const zip = placeholder((...streams) => {
let zipper = (...args) => args

@@ -40,2 +41,2 @@ if (isFunction(head(streams))) {

})
}
})

@@ -750,2 +750,36 @@ import { EventEmitter } from '../src/reactivize.js'

})
describe('buffer', function () {
it('should buffer streams', function (done) {
const values = []
Observable.from([1, 2, 3, 4])
.buffer(2)
.subscribe({
next: value => values.push(value),
complete() {
assert.deepEqual(values, [
[1, 2],
[3, 4],
])
done()
},
})
})
it('should buffer streams async', function (done) {
const values = []
createAsyncStream([1, 2, 3, 4])
.buffer(2)
.subscribe({
next: value => values.push(value),
complete() {
assert.deepEqual(values, [
[1, 2],
[3, 4],
])
done()
},
})
})
})
})

Sorry, the diff of this file is too big to display

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