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

@wixc3/common

Package Overview
Dependencies
Maintainers
70
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wixc3/common - npm Package Compare versions

Comparing version 12.0.3 to 12.1.0

dist/cjs/iterables-gen.d.ts

1

dist/cjs/chain.d.ts

@@ -94,3 +94,4 @@ import { Flat, Mapping, Predicate } from './iterables';

iterable: Iterable<T>;
get array(): T[];
};
//# sourceMappingURL=chain.d.ts.map

@@ -25,2 +25,5 @@ "use strict";

iterable,
get array() {
return [...iterable];
},
...boundToIter,

@@ -27,0 +30,0 @@ ...boundToElm,

3

dist/cjs/iterables.js

@@ -59,4 +59,3 @@ "use strict";

if (index < 0) {
const iterAsArray = Array.from(iterable);
return iterAsArray[iterAsArray.length + index];
return Array.from(iterable).at(index);
}

@@ -63,0 +62,0 @@ let i = 0;

@@ -14,3 +14,3 @@ import { Nullable } from './types';

export declare function has<K>(obj: Map<K, unknown>, key: K): boolean;
export declare function has(obj: null | undefined, key: unknown | never): false;
export declare function has(obj: null | undefined, key: unknown): false;
export type MapValue<T> = T extends Map<infer _, infer V> ? V : never;

@@ -31,3 +31,3 @@ export type ObjValue<O extends object, K extends keyof O = keyof O> = O[K];

export declare function getValue<K, V, T extends Map<K, V>>(map: T, key: K, errorMessage?: string): MapValue<T>;
export declare function getValue<T extends null | undefined>(map: T, key: unknown | never, errorMessage?: string): never;
export declare function getValue<T extends null | undefined>(map: T, key: unknown, errorMessage?: string): never;
/**

@@ -34,0 +34,0 @@ * @see Map.keys

@@ -94,3 +94,4 @@ import { Flat, Mapping, Predicate } from './iterables';

iterable: Iterable<T>;
get array(): T[];
};
//# sourceMappingURL=chain.d.ts.map

@@ -21,2 +21,5 @@ import { at, concat, every, filter, find, first, flat, flatMap, forEach, includes, isEmpty, join, last, map, next, prev, reduce, size, skip, some, sort, unique, } from './iterables';

iterable,
get array() {
return [...iterable];
},
...boundToIter,

@@ -23,0 +26,0 @@ ...boundToElm,

@@ -52,4 +52,3 @@ import { isDefined } from './types';

if (index < 0) {
const iterAsArray = Array.from(iterable);
return iterAsArray[iterAsArray.length + index];
return Array.from(iterable).at(index);
}

@@ -56,0 +55,0 @@ let i = 0;

@@ -14,3 +14,3 @@ import { Nullable } from './types';

export declare function has<K>(obj: Map<K, unknown>, key: K): boolean;
export declare function has(obj: null | undefined, key: unknown | never): false;
export declare function has(obj: null | undefined, key: unknown): false;
export type MapValue<T> = T extends Map<infer _, infer V> ? V : never;

@@ -31,3 +31,3 @@ export type ObjValue<O extends object, K extends keyof O = keyof O> = O[K];

export declare function getValue<K, V, T extends Map<K, V>>(map: T, key: K, errorMessage?: string): MapValue<T>;
export declare function getValue<T extends null | undefined>(map: T, key: unknown | never, errorMessage?: string): never;
export declare function getValue<T extends null | undefined>(map: T, key: unknown, errorMessage?: string): never;
/**

@@ -34,0 +34,0 @@ * @see Map.keys

{
"name": "@wixc3/common",
"version": "12.0.3",
"version": "12.1.0",
"description": "Common utils, usable in all environments",

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

@@ -126,2 +126,5 @@ import {

iterable,
get array() {
return [...iterable];
},
...boundToIter,

@@ -172,2 +175,3 @@ ...boundToElm,

iterable: Iterable<T>;
get array(): T[];
};

@@ -61,4 +61,3 @@ import { isDefined, Nullable } from './types';

if (index < 0) {
const iterAsArray = Array.from(iterable);
return iterAsArray[iterAsArray.length + index];
return Array.from(iterable).at(index);
}

@@ -65,0 +64,0 @@ let i = 0;

@@ -15,3 +15,3 @@ import { isMap, Nullable } from './types';

export function has<K>(obj: Map<K, unknown>, key: K): boolean;
export function has(obj: null | undefined, key: unknown | never): false;
export function has(obj: null | undefined, key: unknown): false;
export function has(obj: Nullable<object | Map<unknown, unknown>>, key: any): boolean {

@@ -51,3 +51,3 @@ return (

export function getValue<K, V, T extends Map<K, V>>(map: T, key: K, errorMessage?: string): MapValue<T>;
export function getValue<T extends null | undefined>(map: T, key: unknown | never, errorMessage?: string): never;
export function getValue<T extends null | undefined>(map: T, key: unknown, errorMessage?: string): never;
export function getValue<T extends Map<K, V> | object, K, V>(map: Nullable<T>, key: KeyOf<T>, errorMessage?: string) {

@@ -54,0 +54,0 @@ // @ts-expect-error hmm

@@ -39,3 +39,3 @@ import { getIn } from './objects';

export function isValidNamingConvention(namingConvention: string): namingConvention is NamingConvention {
return Object.values(NamingConvention).some((value) => value === namingConvention);
return Object.values(NamingConvention).some((value) => value === (namingConvention as NamingConvention));
}

@@ -42,0 +42,0 @@

@@ -5,2 +5,3 @@ import { expect } from 'chai';

import gc from 'expose-gc/function';
import { times } from '../iterables-gen';
const forceGc = gc as () => void;

@@ -10,3 +11,3 @@

describe('performance', () => {
describe('chain', () => {
it('it faster than the array equivalent function for large iterables', () => {

@@ -45,2 +46,12 @@ const veryLargeArray = Array.from(new Array(2 ** 18)).map((_, i) => i % 2 ** 32);

});
it('can chain all of the iterable functions', () => {
expect(
chain(times(10))
.skip(2)
.map((i) => [i, 2 * i])
.flatMap((i) => i)
.filter((i) => i < 10).array
).to.eql([2, 4, 3, 6, 4, 8, 5, 6, 7, 8, 9]);
});
});

@@ -105,4 +105,17 @@ import { expect } from 'chai';

it(`size`, () => {
expect(size([])).to.eql(0);
expect(size([0, 1])).to.eql(2);
expect(size([]), 'size of empty array').to.eql(0);
expect(size([0, 1]), 'size of array').to.eql(2);
expect(size(undefined), 'size of undefined').to.eql(0);
expect(size(null), 'size of null').to.eql(0);
expect(size(''), 'size of empty string').to.eql(0);
expect(size('hello'), 'size of string string').to.eql(5);
expect(
size(
(function* () {
yield 1;
yield 1;
})()
),
'generated iterator'
).to.eql(2);
});

@@ -109,0 +122,0 @@ it(`map`, () => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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