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.2.56 to 1.2.57

2

CHANGELOG.md
# 1.2.50
Added MIT license, as well as starting this changelog file.
Added MIT license, in addition to starting this change-log file.
import { EventEmitter as } from "events";
import { Transform as } from "stream";
/**

@@ -611,3 +610,2 @@ * IsNumber, checks if x is a Number

fromEvent(emitter: any, event: string, handler: _GenericFunction2): Observable;
fromGenerator(generator: GeneratorFunction): Observable;
fromPromise<X>(promise: Promise<X>): Observable;

@@ -1142,35 +1140,2 @@ fromStream(stream: any): Observable;

export function multi(...initialMethods: IHandler[]): MultiMethod;
export function createFilterStream(fn: (value: any) => boolean): any;
export function createMapStream(fn: (value: any) => any): any;
export function createReduceStream(reducer: (accumulator: any, value: any) => any, initialValue: any): any;
export interface ParallelStream {
emit(event: string, ...args: any): any;
push(value: any): any;
}
export class ParallelStream extends Transform {
userTransform: (chunk: any, encoding: string, push: (value: any) => any, onComplete: (err: Error) => any) => void;
running: number;
terminate: (() => void) | null;
constructor(userTransform: (chunk: any, encoding: string, push: (value: any) => any, onComplete: (err: Error) => any) => void, options?: {});
_transform(chunk: any, encoding: string, callback: () => void): void;
_flush(callback: () => void): void;
_onComplete(err: Error): void;
}
export interface LimitedParallelStream {
emit(event: string, ...args: any): any;
push(chunk: any): any;
}
export class LimitedParallelStream extends Transform {
concurrency: number;
userTransform: (chunk: any, encoding: string, push: (value: any) => any, onComplete: (err: Error) => any) => void;
running: number;
continue: (() => void) | null;
terminate: (() => void) | null;
constructor(concurrency: number, userTransform: (chunk: any, encoding: string, push: (value: any) => any, onComplete: (err: Error) => any) => void, options?: {});
_transform(chunk: any, encoding: string, callback: () => void): void;
_flush(callback: () => void): void;
_onComplete(err: Error): void;
}
export function createFork(stream: any): (...streams: any[]) => void;
export function createMerge(...sources: any[]): (dest: any) => any[];
/**

@@ -1177,0 +1142,0 @@ * Checks to see if something appears to be a plain object

{
"name": "@ebflat9/fp",
"version": "1.2.56",
"version": "1.2.57",
"description": "my fp utils",
"source": "src/index.ts",
"main": "dist/index.js",
"includeNodeModules": [
"core-js",
"events",
"stream-browserify"
],
"types": "dist/index.d.ts",

@@ -8,0 +13,0 @@ "type": "module",

@@ -219,3 +219,3 @@ import * as rx from './observable/Observable'

export {
/* export {
createFilterStream,

@@ -228,3 +228,3 @@ createFork,

ParallelStream,
} from './streams/streams'
} from './streams/streams' */

@@ -231,0 +231,0 @@ export { actionListener } from './store/actionListener'

@@ -9,3 +9,3 @@ /* eslint-disable no-redeclare */

import { Readable } from 'stream'
// import { Readable } from 'stream'
import { buffer } from './methods/buffer'

@@ -51,3 +51,3 @@ import { catchError } from './methods/catch'

fromEvent(emitter: any, event: string, handler: GenericFunction): Observable
fromGenerator(generator: GeneratorFunction): Observable
// fromGenerator(generator: GeneratorFunction): Observable
fromPromise<X>(promise: Promise<X>): Observable

@@ -114,3 +114,3 @@ fromStream(stream: any): Observable

),
fromGenerator: placeholder(
/* fromGenerator: placeholder(
(generator: GeneratorFunction) =>

@@ -123,3 +123,3 @@ new Observable((observer: Observer) => {

}),
),
), */
fromPromise: placeholder(

@@ -126,0 +126,0 @@ <X>(promise: Promise<X>) =>

@@ -8,3 +8,3 @@ /* eslint func-names: 0 */

function createAsyncStream(from) {
return new Observable(observer => {
return new Observable((observer) => {
function recur(from, i) {

@@ -24,3 +24,3 @@ if (i < from.length) {

describe('Observable', function () {
describe('fromGenerator', function () {
/* describe('fromGenerator', function () {
it('should create an Observable from a generator', function (done) {

@@ -34,3 +34,3 @@ const gen = function* gen() {

stream.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -46,3 +46,3 @@ try {

stream.subscribe({
next: value => {
next: (value) => {
values2.push(value)

@@ -61,10 +61,12 @@ },

})
*/
describe('from EventEmitter', function () {
it('should create an Observable from an EventEmitter', function (done) {
const emitter = new EventEmitter()
const stream = Observable.fromEvent(emitter, 'test', (...args) => [...args])
const stream = Observable.fromEvent(emitter, 'test', (...args) => [
...args,
])
const values = []
stream.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -90,3 +92,3 @@ try {

stream.throttle(50).subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -107,3 +109,3 @@ try {

stream.throttle(50).subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -127,3 +129,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -145,5 +147,5 @@ try {

Observable.from([1, 2, 3])
.map(x => x * x)
.map((x) => x * x)
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -162,5 +164,5 @@ try {

createAsyncStream([1, 2, 3])
.map(x => x * x)
.map((x) => x * x)
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -182,5 +184,5 @@ try {

Observable.from([1, 2, 3, 4, 5, 6])
.filter(x => x % 2 === 0)
.filter((x) => x % 2 === 0)
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -199,5 +201,5 @@ try {

createAsyncStream([1, 2, 3, 4, 5, 6])
.filter(x => x % 2 === 0)
.filter((x) => x % 2 === 0)
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -221,3 +223,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -238,3 +240,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -258,3 +260,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -275,3 +277,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -295,3 +297,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -309,3 +311,3 @@ try {

const values = []
const streamA = new Observable(observer => {
const streamA = new Observable((observer) => {
let n = 0

@@ -326,6 +328,20 @@ let to = null

streamA.concat(streamB).subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {
try {
assert.deepEqual(values, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'a', 'b', 'c'])
assert.deepEqual(values, [
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
'a',
'b',
'c',
])
done()

@@ -346,3 +362,3 @@ } catch (err) {

streamA.combine(streamB).subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -363,3 +379,3 @@ try {

streamA.combine(streamB).subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -403,3 +419,3 @@ try {

Observable.merge(streamA, streamB).subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -420,3 +436,3 @@ try {

Observable.merge(streamA, streamB).subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -438,9 +454,9 @@ try {

const streamA = Observable.fromPromise(
new Promise(resolve => setTimeout(() => resolve('hello'), 10))
new Promise((resolve) => setTimeout(() => resolve('hello'), 10)),
)
const streamB = Observable.fromPromise(
new Promise(resolve => setTimeout(() => resolve('world'), 15))
new Promise((resolve) => setTimeout(() => resolve('world'), 15)),
)
Observable.merge(streamA, streamB).subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -467,3 +483,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -482,3 +498,3 @@ try {

const values2 = []
const stream1 = new Observable(observer => {
const stream1 = new Observable((observer) => {
setTimeout(() => observer.next(), 10)

@@ -492,3 +508,3 @@ setTimeout(() => observer.complete(), 20)

.subscribe({
next: value => values2.push(value),
next: (value) => values2.push(value),
complete: () => {

@@ -511,5 +527,5 @@ try {

streamA
.flatMap(x => Observable.from([x + x, x]))
.flatMap((x) => Observable.from([x + x, x]))
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -533,3 +549,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -551,5 +567,5 @@ try {

.flatMap(() => Observable.of('hi', 'hello'))
.flatMap(value => Observable.of(value + 'there'))
.flatMap((value) => Observable.of(value + 'there'))
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete: () => {

@@ -568,11 +584,15 @@ try {

const values = []
Observable.fromPromise(new Promise(resolve => setTimeout(() => resolve('hi'), 10)))
.flatMap(str =>
Observable.fromPromise(
new Promise((resolve) => setTimeout(() => resolve('hi'), 10)),
)
.flatMap((str) =>
Observable.fromPromise(
new Promise(resolve => setTimeout(() => resolve(str + 'there'), 50))
)
new Promise((resolve) =>
setTimeout(() => resolve(str + 'there'), 50),
),
),
)
.flatMap(result => Observable.of(result))
.flatMap((result) => Observable.of(result))
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -596,3 +616,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -613,3 +633,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -633,3 +653,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -650,3 +670,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -670,5 +690,5 @@ try {

])
.distinct(x => x.age)
.distinct((x) => x.age)
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -696,5 +716,5 @@ try {

])
.distinct(x => x.age)
.distinct((x) => x.age)
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -720,5 +740,5 @@ try {

Observable.from([1, 2, 3, 4, 5])
.until(n => n > 3)
.until((n) => n > 3)
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -737,5 +757,5 @@ try {

createAsyncStream([1, 2, 3, 4, 5])
.until(n => n > 3)
.until((n) => n > 3)
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -755,3 +775,3 @@ try {

it('should catch error', function (done) {
new Observable(observer => {
new Observable((observer) => {
let n = 0

@@ -764,5 +784,5 @@ if (n < 1) {

})
.catch(err => `Error: ${err.message}`)
.catch((err) => `Error: ${err.message}`)
.subscribe({
next: value => {
next: (value) => {
try {

@@ -780,3 +800,3 @@ assert.equal(value, 'Error: Uh oh')

let n = 0
new Observable(observer => {
new Observable((observer) => {
if (n < 1) {

@@ -790,3 +810,3 @@ n++

.subscribe({
next: value => {
next: (value) => {
try {

@@ -809,3 +829,3 @@ assert.equal(value, 1)

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -830,3 +850,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -851,6 +871,6 @@ try {

(...args) => args.reduce((acc, cv) => acc + cv, 0),
Observable.from([2, 3, 4])
Observable.from([2, 3, 4]),
)
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -871,6 +891,6 @@ try {

(...args) => args.reduce((acc, cv) => acc + cv, 0),
createAsyncStream([2, 3, 4])
createAsyncStream([2, 3, 4]),
)
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -892,3 +912,3 @@ try {

let n = 0
new Observable(observer => {
new Observable((observer) => {
if (n === 1) {

@@ -903,3 +923,3 @@ observer.next('hello')

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -919,3 +939,3 @@ try {

let n = 0
new Observable(observer => {
new Observable((observer) => {
if (n === 3) {

@@ -930,3 +950,3 @@ observer.next('hello')

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -947,3 +967,3 @@ try {

const values = []
new Observable(observer => {
new Observable((observer) => {
observer.next('hi')

@@ -954,3 +974,3 @@ throw new Error('test')

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -974,3 +994,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -995,3 +1015,3 @@ try {

.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -1020,3 +1040,3 @@ try {

stream.subscribe({
next: value => {
next: (value) => {
values.push(value)

@@ -1030,3 +1050,3 @@ },

stream.subscribe({
next: value => values2.push(value),
next: (value) => values2.push(value),
complete() {

@@ -1056,5 +1076,5 @@ completed++

stream
.map(x => x * x)
.map((x) => x * x)
.subscribe({
next: value => {
next: (value) => {
values.push(value)

@@ -1068,5 +1088,5 @@ },

stream
.filter(n => n % 2 === 0)
.filter((n) => n % 2 === 0)
.subscribe({
next: value => values2.push(value),
next: (value) => values2.push(value),
complete() {

@@ -1096,3 +1116,3 @@ completed++

stream.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -1104,3 +1124,3 @@ completed++

stream.subscribe({
next: value => values2.push(value),
next: (value) => values2.push(value),
complete() {

@@ -1129,3 +1149,3 @@ completed++

Observable.fromStream(stream).subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -1148,3 +1168,3 @@ try {

stream.subscribe({
next: value => {
next: (value) => {
values.push(value)

@@ -1171,5 +1191,5 @@ },

stream
.map(x => x * x)
.map((x) => x * x)
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -1194,6 +1214,6 @@ try {

stream
.map(x => x * x)
.filter(x => x % 2 === 0)
.map((x) => x * x)
.filter((x) => x % 2 === 0)
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -1215,6 +1235,6 @@ try {

stream
.map(x => x.toUpperCase())
.flatMap(x => Observable.from([1, 2].map(n => x + n)))
.map((x) => x.toUpperCase())
.flatMap((x) => Observable.from([1, 2].map((n) => x + n)))
.subscribe({
next: value => values.push(value),
next: (value) => values.push(value),
complete() {

@@ -1237,3 +1257,3 @@ try {

observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
assert.deepEqual(value, { name: 'john' })

@@ -1249,3 +1269,3 @@ done()

observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
assert.deepEqual(value, { name: 'tim', age: 5 })

@@ -1261,3 +1281,3 @@ done()

observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
assert.deepEqual(value, { name: 'tim' })

@@ -1273,3 +1293,3 @@ done()

observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
assert.deepEqual(value, [1, 2, 3, 4])

@@ -1289,3 +1309,3 @@ done()

observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
assert.equal(value.name, 'john')

@@ -1307,3 +1327,3 @@ done()

observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
called++

@@ -1328,3 +1348,3 @@ assert.deepEqual(value.name, 'john')

observed.observe(['setName', 'name']).subscribe(value => {
observed.observe(['setName', 'name']).subscribe((value) => {
called++

@@ -1356,3 +1376,3 @@ if (called === 1 || called === 3) {

observed.observe(['name', 'setName']).subscribe(value => {
observed.observe(['name', 'setName']).subscribe((value) => {
done(new Error('Should not have been called'))

@@ -1370,3 +1390,3 @@ })

const observed = Observable.wrap(obj)
observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
called++

@@ -1391,3 +1411,3 @@ done(new Error('Expected not to be called'))

const observed = Observable.wrap(obj)
observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
assert.notDeepEqual(value.name, 'tim')

@@ -1406,4 +1426,4 @@ assert.equal(called, 1)

called++
return new Promise(resolve =>
setTimeout(() => resolve((this.name = newName)), 1)
return new Promise((resolve) =>
setTimeout(() => resolve((this.name = newName)), 1),
)

@@ -1413,3 +1433,3 @@ },

const observed = Observable.wrap(obj)
observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
assert.deepEqual(value.name, 'john')

@@ -1428,4 +1448,4 @@ assert.equal(called, 1)

called++
const newName = await new Promise(resolve =>
setTimeout(() => resolve(Math.random() * 10000))
const newName = await new Promise((resolve) =>
setTimeout(() => resolve(Math.random() * 10000)),
)

@@ -1436,3 +1456,3 @@ while (true) yield (this.name = newName)

const observed = Observable.wrap(obj)
observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
assert.notEqual(value.name, 'tim')

@@ -1449,3 +1469,3 @@ assert.equal(called, 1)

get unfinishedTodosCount() {
return this.todos.filter(todo => !todo.finished).length
return this.todos.filter((todo) => !todo.finished).length
},

@@ -1455,3 +1475,3 @@ }

observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
assert.deepEqual(value.todos, [{ name: 'Clean cat', finished: false }])

@@ -1474,3 +1494,3 @@ assert.equal(value.unfinishedTodosCount, 1)

observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
assert.deepEqual(value.people, new Map([['kevin', { age: 15 }]]))

@@ -1489,4 +1509,6 @@ done()

observed.observe().subscribe(value => {
assert.deepEqual(value, { people: [{ name: 'tim', likes: ['cats', 'dogs'] }] })
observed.observe().subscribe((value) => {
assert.deepEqual(value, {
people: [{ name: 'tim', likes: ['cats', 'dogs'] }],
})
done()

@@ -1504,3 +1526,3 @@ })

const observed = Observable.wrap(obj)
observed.observe().subscribe(value => {
observed.observe().subscribe((value) => {
called++

@@ -1507,0 +1529,0 @@ if (called === 1) {

Sorry, the diff of this file is not supported yet

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

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