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.2 to 0.0.3

17

index.d.ts
export interface StringMap<T> {
readonly [key: string]: T;
}
export declare type Entry<T> = Readonly<[string, T]>;
export declare const enum EntryIndex {
Name = 0,
Value = 1
}
export interface Entry<T> {
readonly [EntryIndex.Name]: string;
readonly [EntryIndex.Value]: T;
/**
* The property is required for destruction.
*/
readonly [Symbol.iterator]: () => IterableIterator<string | T>;
}
export declare function entries<T>(input: StringMap<T | undefined>): Iterable<Entry<T>>;

@@ -9,6 +20,2 @@ export declare function names<T>(input: StringMap<T>): Iterable<string>;

export declare function entry<T>(name: string, value: T): Entry<T>;
export declare const enum EntryIndex {
Name = 0,
Value = 1
}
export declare function entryName<T>(e: Entry<T>): string;

@@ -15,0 +22,0 @@ export declare function entryValue<T>(e: Entry<T>): T;

@@ -7,2 +7,3 @@ "use strict";

function* iterator() {
/* tslint:disable-next-line:no-loop-statement */
for (const name in input) {

@@ -42,9 +43,7 @@ const value = input[name];

const result = {};
for (const nv of input) {
const n = entryName(nv);
const v = entryValue(nv);
const prior = result[n];
i.forEach(input, ([name, value]) => {
const prior = result[name];
/* tslint:disable-next-line:no-object-mutation no-expression-statement */
result[n] = prior === undefined ? v : reduceFunc(prior, v);
}
result[name] = prior === undefined ? value : reduceFunc(prior, value);
});
return result;

@@ -54,4 +53,4 @@ }

function stringMap(input) {
return groupBy(input, a => a);
return groupBy(input, v => v);
}
exports.stringMap = stringMap;
{
"name": "@ts-common/string-map",
"version": "0.0.2",
"version": "0.0.3",
"description": "",

@@ -36,4 +36,4 @@ "main": "index.js",

"dependencies": {
"@ts-common/iterator": "0.0.20"
"@ts-common/iterator": "0.0.21"
}
}
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