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

@ts-common/string-map

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ts-common/string-map - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

17

index.d.ts

@@ -8,4 +8,4 @@ import { Tuple2 } from "@ts-common/tuple";

export declare const entry: <T>(key: string, value: T) => Entry<T>;
export declare function entryKey<T>(e: Entry<T>): string;
export declare function entryValue<T>(e: Entry<T>): T;
export declare const entryKey: <T>(e: Tuple2<string, T>) => string;
export declare const entryValue: <T>(e: Tuple2<string, T>) => T;
export interface StringMap<T> {

@@ -18,8 +18,9 @@ readonly [key: string]: T;

export declare type StringMapItem<T> = T extends StringMap<infer I> ? I : never;
export declare function allKeys<T>(input: StringMap<T | undefined>): Iterable<string>;
export declare function entries<T>(input: StringMap<T | undefined>): Iterable<Entry<T>>;
export declare function keys<T>(input: StringMap<T>): Iterable<string>;
export declare function values<T>(input: StringMap<T | undefined>): Iterable<T>;
export declare function groupBy<T>(input: Iterable<Entry<T>>, reduceFunc: (a: T, b: T) => T): StringMap<T>;
export declare function stringMap<T>(input: Iterable<Entry<T>>): StringMap<T>;
export declare const allKeys: <T>(input: StringMap<T | undefined>) => Iterable<string>;
export declare const entries: <T>(input: StringMap<T | undefined>) => Iterable<Tuple2<string, T>>;
export declare const keys: <T>(input: StringMap<T>) => Iterable<string>;
export declare const values: <T>(input: StringMap<T | undefined>) => Iterable<T>;
export declare const groupBy: <T>(input: Iterable<Tuple2<string, T>>, reduceFunc: (a: T, b: T) => T) => StringMap<T>;
export declare const stringMap: <T>(input: Iterable<Tuple2<string, T>>) => StringMap<T>;
export declare const map: <S, R>(source: StringMap<S>, f: (s: Tuple2<string, S>) => Tuple2<string, R>) => StringMap<R>;
export declare const equals: <A, B>(a: StringMap<A>, b: StringMap<B>) => boolean;

@@ -7,11 +7,5 @@ "use strict";

exports.entry = tuple_1.tuple2;
function entryKey(e) {
return e[0 /* Key */];
}
exports.entryKey = entryKey;
function entryValue(e) {
return e[1 /* Value */];
}
exports.entryValue = entryValue;
function allKeys(input) {
exports.entryKey = (e) => e[0 /* Key */];
exports.entryValue = (e) => e[1 /* Value */];
exports.allKeys = (input) => {
function* iterator() {

@@ -24,20 +18,12 @@ /* tslint:disable-next-line:no-loop-statement */

return _.iterable(iterator);
}
exports.allKeys = allKeys;
function entries(input) {
return _.filterMap(allKeys(input), key => {
};
exports.entries = (input) => {
return _.filterMap(exports.allKeys(input), key => {
const value = input[key];
return value !== undefined ? exports.entry(key, value) : undefined;
});
}
exports.entries = entries;
function keys(input) {
return _.map(entries(input), entryKey);
}
exports.keys = keys;
function values(input) {
return _.map(entries(input), entryValue);
}
exports.values = values;
function groupBy(input, reduceFunc) {
};
exports.keys = (input) => _.map(exports.entries(input), exports.entryKey);
exports.values = (input) => _.map(exports.entries(input), exports.entryValue);
exports.groupBy = (input, reduceFunc) => {
/* tslint:disable-next-line:readonly-keyword */

@@ -51,8 +37,6 @@ const result = {};

return result;
}
exports.groupBy = groupBy;
function stringMap(input) {
return groupBy(input, v => v);
}
exports.stringMap = stringMap;
exports.map = (source, f) => stringMap(_.map(entries(source), f));
};
exports.stringMap = (input) => exports.groupBy(input, v => v);
exports.map = (source, f) => exports.stringMap(_.map(exports.entries(source), f));
const isSubset = (set, subset) => _.every(exports.entries(subset), ([key, value]) => set[key] === value);
exports.equals = (a, b) => isSubset(a, b) && isSubset(b, a);
{
"name": "@ts-common/string-map",
"version": "0.0.7",
"version": "0.0.8",
"description": "",

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

"dependencies": {
"@ts-common/iterator": "0.0.30",
"@ts-common/iterator": "0.0.31",
"@ts-common/tuple": "0.0.0"
}
}
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