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

@flock/kotlin-ts

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flock/kotlin-ts - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

3

collection/Array.spec.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tsplus_module_1 = require("./Array");
const tsplus_module_2 = require("./Iterable");
describe("Array", () => {

@@ -11,3 +10,3 @@ const numbers = [1, 2, 3];

test("average", () => {
expect(tsplus_module_2.average(numbers)).toMatchInlineSnapshot(`2`);
expect(tsplus_module_1.average(numbers)).toMatchInlineSnapshot(`2`);
});

@@ -14,0 +13,0 @@ test("distinct", () => {

import { Sequence } from "./Sequence.js";
declare global {
/** @tsplus type Iterable */
export interface Iterable<T> {
export interface Object {
}
/** @tsplus type Iterable */
export interface IterableIterator<T> {
export interface String {
}
/** @tsplus type Iterable */
export interface Map<K, V> {
export interface Iterable<T> {
}
/** @tsplus type Iterable */
export interface Set<T> extends Iterable<T> {
export interface IterableIterator<T> {
}
/** @tsplus type Iterable */
export interface Array<T> {
}
}

@@ -171,2 +167,11 @@ /**

/**
* Returns a new map containing all key-value pairs from the given collection of pairs.
*
* The returned map preserves the entry iteration order of the original collection.
* If any of two pairs would have the same key the last one gets added to the map.
*
* @tsplus fluent Iterable toMap
*/
export declare const toMap: <K, V>(self: Iterable<readonly [K, V]>) => Map<K, V>;
/**
* Returns an iterator over the elements of this object.

@@ -180,3 +185,2 @@ * @tsplus fluent Iterable iterator

* @tsplus fluent Iterable contains
* @tsplus fluent Array contains
*/

@@ -183,0 +187,0 @@ export declare const contains: <T>(self: Iterable<T>, element: T) => boolean;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.withIndex = exports.zip = exports.indexOf_ = exports.isEmpty = exports.first = exports.indexOf = exports.elementAt = exports.contains = exports.iterator = exports.toArray = exports.map = exports.average = exports.associateWithTo = exports.associateWith = exports.associateTo = exports.associateByTo_ = exports.associateByTo = exports.associateBy_ = exports.associateBy = exports.associate = exports.asSequence = exports.asIterable = exports.any_ = exports.any = exports.all = exports.naturals = exports.iterableOf = exports.Iterable = exports.find = exports.createIterable = void 0;
exports.withIndex = exports.zip = exports.indexOf_ = exports.isEmpty = exports.first = exports.indexOf = exports.elementAt = exports.contains = exports.iterator = exports.toMap = exports.toArray = exports.map = exports.average = exports.associateWithTo = exports.associateWith = exports.associateTo = exports.associateByTo_ = exports.associateByTo = exports.associateBy_ = exports.associateBy = exports.associate = exports.asSequence = exports.asIterable = exports.any_ = exports.any = exports.all = exports.naturals = exports.iterableOf = exports.Iterable = exports.find = exports.createIterable = void 0;
const tsplus_module_1 = require("./Sequence");

@@ -86,8 +86,3 @@ exports.createIterable = createIterable_1;

*/
const associate_1 = (self, transform) => {
const map = new Map();
for (const it of self)
map.set(...transform(it));
return map;
};
const associate_1 = (self, transform) => toMap_1(map_1(self, transform));
exports.associate = associate_1;

@@ -171,6 +166,5 @@ /**

*/
const associateWith = (self, valueSelector) => {
const result = new Map();
return associateWithTo_1(self, result, valueSelector);
};
const associateWith = (self, valueSelector) =>
// TODO change to as const in next tsplus release
toMap_1(map_1(self, (it) => [it, valueSelector(it)]));
exports.associateWith = associateWith;

@@ -185,3 +179,3 @@ /**

*/
const associateWithTo_1 = (self, destination, valueSelector) => {
const associateWithTo = (self, destination, valueSelector) => {
for (const it of self)

@@ -191,3 +185,3 @@ destination.set(it, valueSelector(it));

};
exports.associateWithTo = associateWithTo_1;
exports.associateWithTo = associateWithTo;
/**

@@ -214,6 +208,7 @@ * Returns an average value of elements in the collection.

*/
exports.map = createIterable_1(function* (self, transform) {
const map_1 = createIterable_1(function* (self, transform) {
for (const it of self)
yield transform(it);
});
exports.map = map_1;
/**

@@ -226,2 +221,12 @@ * Returns an iterator over the elements of this object.

/**
* Returns a new map containing all key-value pairs from the given collection of pairs.
*
* The returned map preserves the entry iteration order of the original collection.
* If any of two pairs would have the same key the last one gets added to the map.
*
* @tsplus fluent Iterable toMap
*/
const toMap_1 = (self) => new Map(self);
exports.toMap = toMap_1;
/**
* Returns an iterator over the elements of this object.

@@ -236,3 +241,2 @@ * @tsplus fluent Iterable iterator

* @tsplus fluent Iterable contains
* @tsplus fluent Array contains
*/

@@ -239,0 +243,0 @@ const contains = (self, element) => indexOf_1(self, element) !== -1;

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

const tsplus_module_3 = require("./Map");
const tsplus_module_4 = require("./Number");
const tsplus_module_4 = require("./Array");
const tsplus_module_5 = require("./Number");
const Iterable_js_1 = require("./Iterable.js");

@@ -25,3 +26,3 @@ describe("Iterable", () => {

test("associate", () => {
const names = ["Grace Hopper", "Jacob Bernoulli", "Johann Bernoulli"];
const names = tsplus_module_1.iterableOf("Grace Hopper", "Jacob Bernoulli", "Johann Bernoulli");
const byLastName = tsplus_module_1.associate(names, (it) => tsplus_module_2.let_(it.split(" "), ([firstName, lastName]) => [lastName, firstName]));

@@ -138,8 +139,8 @@ expect(tsplus_module_3.asString(byLastName)).toBe("{Hopper=Grace, Bernoulli=Johann}");

test("average", () => {
expect(tsplus_module_1.average([])).toBeNaN();
expect(tsplus_module_1.average([1, 2, 5, 8, 3])).toBe(3.8);
expect(tsplus_module_4.average([])).toBeNaN();
expect(tsplus_module_4.average([1, 2, 5, 8, 3])).toBe(3.8);
expect(tsplus_module_1.average(tsplus_module_1.iterableOf(1.6, 2.6, 3.6, 0.6))).toBe(2.1);
expect(tsplus_module_1.average(tsplus_module_1.iterableOf(1.6, 2.6, 3.6, 0.6))).toBe(2.1);
const n = 100;
const range = tsplus_module_4.rangeTo((0), n);
const range = tsplus_module_5.rangeTo((0), n);
expect(tsplus_module_1.average(range)).toBe(n / 2);

@@ -146,0 +147,0 @@ });

@@ -5,2 +5,3 @@ /**

export interface Sequence<T> extends Iterable<T> {
readonly _tag: "Sequence";
}

@@ -16,10 +17,6 @@ /**

*/
export declare const sequenceCreate: <T>(iterator: () => Iterator<T, any, undefined>) => {
[Symbol.iterator]: () => Iterator<T, any, undefined>;
};
export declare const sequenceCreate: <T>(iterator: () => Iterator<T, any, undefined>) => Sequence<T>;
/**
* @tsplus static SequenceOps of
*/
export declare const sequenceOf: <T>(...elements: T[]) => {
[Symbol.iterator]: () => Iterator<T, any, undefined>;
};
export declare const sequenceOf: <T>(...elements: T[]) => Sequence<T>;

@@ -9,13 +9,12 @@ "use strict";

*/
const sequenceCreate = (iterator) => ({
const sequenceCreate_1 = (iterator) => ({
_tag: "Sequence",
[Symbol.iterator]: iterator,
});
exports.sequenceCreate = sequenceCreate;
exports.sequenceCreate = sequenceCreate_1;
/**
* @tsplus static SequenceOps of
*/
const sequenceOf = (...elements) => ({
[Symbol.iterator]: () => tsplus_module_1.iterator(elements),
});
const sequenceOf = (...elements) => sequenceCreate_1(() => tsplus_module_1.iterator(elements));
exports.sequenceOf = sequenceOf;
//# sourceMappingURL=Sequence.js.map
import * as tsplus_module_1 from "./Array.js";
import * as tsplus_module_2 from "./Iterable.js";
describe("Array", () => {

@@ -9,3 +8,3 @@ const numbers = [1, 2, 3];

test("average", () => {
expect(tsplus_module_2.average(numbers)).toMatchInlineSnapshot(`2`);
expect(tsplus_module_1.average(numbers)).toMatchInlineSnapshot(`2`);
});

@@ -12,0 +11,0 @@ test("distinct", () => {

import { Sequence } from "./Sequence.js";
declare global {
/** @tsplus type Iterable */
export interface Iterable<T> {
export interface Object {
}
/** @tsplus type Iterable */
export interface IterableIterator<T> {
export interface String {
}
/** @tsplus type Iterable */
export interface Map<K, V> {
export interface Iterable<T> {
}
/** @tsplus type Iterable */
export interface Set<T> extends Iterable<T> {
export interface IterableIterator<T> {
}
/** @tsplus type Iterable */
export interface Array<T> {
}
}

@@ -171,2 +167,11 @@ /**

/**
* Returns a new map containing all key-value pairs from the given collection of pairs.
*
* The returned map preserves the entry iteration order of the original collection.
* If any of two pairs would have the same key the last one gets added to the map.
*
* @tsplus fluent Iterable toMap
*/
export declare const toMap: <K, V>(self: Iterable<readonly [K, V]>) => Map<K, V>;
/**
* Returns an iterator over the elements of this object.

@@ -180,3 +185,2 @@ * @tsplus fluent Iterable iterator

* @tsplus fluent Iterable contains
* @tsplus fluent Array contains
*/

@@ -183,0 +187,0 @@ export declare const contains: <T>(self: Iterable<T>, element: T) => boolean;

@@ -77,8 +77,3 @@ import * as tsplus_module_1 from "./Sequence.js";

*/
const associate_1 = (self, transform) => {
const map = new Map();
for (const it of self)
map.set(...transform(it));
return map;
};
const associate_1 = (self, transform) => toMap_1(map_1(self, transform));
export const associate = associate_1;

@@ -157,6 +152,5 @@ /**

*/
export const associateWith = (self, valueSelector) => {
const result = new Map();
return associateWithTo_1(self, result, valueSelector);
};
export const associateWith = (self, valueSelector) =>
// TODO change to as const in next tsplus release
toMap_1(map_1(self, (it) => [it, valueSelector(it)]));
/**

@@ -170,3 +164,3 @@ * Populates and returns the [destination] mutable map with key-value pairs for each element of the given collection,

*/
const associateWithTo_1 = (self, destination, valueSelector) => {
export const associateWithTo = (self, destination, valueSelector) => {
for (const it of self)

@@ -176,3 +170,2 @@ destination.set(it, valueSelector(it));

};
export const associateWithTo = associateWithTo_1;
/**

@@ -198,6 +191,7 @@ * Returns an average value of elements in the collection.

*/
export const map = createIterable_1(function* (self, transform) {
const map_1 = createIterable_1(function* (self, transform) {
for (const it of self)
yield transform(it);
});
export const map = map_1;
/**

@@ -209,2 +203,12 @@ * Returns an iterator over the elements of this object.

/**
* Returns a new map containing all key-value pairs from the given collection of pairs.
*
* The returned map preserves the entry iteration order of the original collection.
* If any of two pairs would have the same key the last one gets added to the map.
*
* @tsplus fluent Iterable toMap
*/
const toMap_1 = (self) => new Map(self);
export const toMap = toMap_1;
/**
* Returns an iterator over the elements of this object.

@@ -219,3 +223,2 @@ * @tsplus fluent Iterable iterator

* @tsplus fluent Iterable contains
* @tsplus fluent Array contains
*/

@@ -222,0 +225,0 @@ export const contains = (self, element) => indexOf_1(self, element) !== -1;

import * as tsplus_module_1 from "./Iterable.js";
import * as tsplus_module_2 from "../util/Standard.js";
import * as tsplus_module_3 from "./Map.js";
import * as tsplus_module_4 from "./Number.js";
import * as tsplus_module_4 from "./Array.js";
import * as tsplus_module_5 from "./Number.js";
import { naturals } from "./Iterable.js";

@@ -22,3 +23,3 @@ describe("Iterable", () => {

test("associate", () => {
const names = ["Grace Hopper", "Jacob Bernoulli", "Johann Bernoulli"];
const names = tsplus_module_1.iterableOf("Grace Hopper", "Jacob Bernoulli", "Johann Bernoulli");
const byLastName = tsplus_module_1.associate(names, (it) => tsplus_module_2.let_(it.split(" "), ([firstName, lastName]) => [lastName, firstName]));

@@ -135,8 +136,8 @@ expect(tsplus_module_3.asString(byLastName)).toBe("{Hopper=Grace, Bernoulli=Johann}");

test("average", () => {
expect(tsplus_module_1.average([])).toBeNaN();
expect(tsplus_module_1.average([1, 2, 5, 8, 3])).toBe(3.8);
expect(tsplus_module_4.average([])).toBeNaN();
expect(tsplus_module_4.average([1, 2, 5, 8, 3])).toBe(3.8);
expect(tsplus_module_1.average(tsplus_module_1.iterableOf(1.6, 2.6, 3.6, 0.6))).toBe(2.1);
expect(tsplus_module_1.average(tsplus_module_1.iterableOf(1.6, 2.6, 3.6, 0.6))).toBe(2.1);
const n = 100;
const range = tsplus_module_4.rangeTo((0), n);
const range = tsplus_module_5.rangeTo((0), n);
expect(tsplus_module_1.average(range)).toBe(n / 2);

@@ -143,0 +144,0 @@ });

@@ -5,2 +5,3 @@ /**

export interface Sequence<T> extends Iterable<T> {
readonly _tag: "Sequence";
}

@@ -16,10 +17,6 @@ /**

*/
export declare const sequenceCreate: <T>(iterator: () => Iterator<T, any, undefined>) => {
[Symbol.iterator]: () => Iterator<T, any, undefined>;
};
export declare const sequenceCreate: <T>(iterator: () => Iterator<T, any, undefined>) => Sequence<T>;
/**
* @tsplus static SequenceOps of
*/
export declare const sequenceOf: <T>(...elements: T[]) => {
[Symbol.iterator]: () => Iterator<T, any, undefined>;
};
export declare const sequenceOf: <T>(...elements: T[]) => Sequence<T>;

@@ -6,11 +6,11 @@ import * as tsplus_module_1 from "./Iterable.js";

*/
export const sequenceCreate = (iterator) => ({
const sequenceCreate_1 = (iterator) => ({
_tag: "Sequence",
[Symbol.iterator]: iterator,
});
export const sequenceCreate = sequenceCreate_1;
/**
* @tsplus static SequenceOps of
*/
export const sequenceOf = (...elements) => ({
[Symbol.iterator]: () => tsplus_module_1.iterator(elements),
});
export const sequenceOf = (...elements) => sequenceCreate_1(() => tsplus_module_1.iterator(elements));
//# sourceMappingURL=Sequence.js.map
{
"name": "@flock/kotlin-ts",
"version": "0.0.8",
"version": "0.0.9",
"author": "Kasper Peulen",

@@ -29,10 +29,11 @@ "license": "MIT",

"build:clean": "rimraf build",
"preinstall": "update-ruecksichtslos --caret",
"update": "update-ruecksichtslos --caret",
"postinstall": "tsplus-install",
"test": "jest --all"
"test": "jest --all",
"tsc": "tsc"
},
"devDependencies": {
"@tsplus/installer": "^0.0.41",
"@tsplus/installer": "^0.0.45",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.21",
"@types/node": "^17.0.22",
"jest": "^27.5.1",

@@ -39,0 +40,0 @@ "prettier": "^2.6.0",

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