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

@ts-common/property-set

Package Overview
Dependencies
Maintainers
4
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ts-common/property-set - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

12

dist/index.d.ts

@@ -1,12 +0,12 @@

export declare type MapFunc<T, R> = <K extends keyof T>(v: T[K], k: K) => R;
export type MapFunc<T, R> = <K extends keyof T>(v: T[K], k: K) => R;
export declare const forEach: <T>(source: T, func: MapFunc<T, void>) => void;
export declare type PropertyFactory<T, K extends keyof T> = (k: K) => T[K];
export declare type Factory<T> = {
export type PropertyFactory<T, K extends keyof T> = (k: K) => T[K];
export type Factory<T> = {
readonly [K in keyof T]-?: PropertyFactory<T, K>;
};
export declare const copyProperty: <T>(value: T) => <K extends keyof T>(k: K) => T[K];
export declare type Mutable<T> = {
export type Mutable<T> = {
-readonly [K in keyof T]: T[K];
};
export declare type MutableOptional<T> = {
export type MutableOptional<T> = {
[K in keyof T]?: T[K];

@@ -24,3 +24,3 @@ };

export declare const create: <T>(factory: Factory<T>) => T;
export declare type PartialFactory<T> = {
export type PartialFactory<T> = {
readonly [K in keyof T]?: (v: T[K], k: K) => T[K];

@@ -27,0 +27,0 @@ };

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.asMutable = exports.copyCreate = exports.create = exports.setMutableProperty = exports.copyProperty = exports.forEach = void 0;
exports.forEach = (source, func) => {
const forEach = (source, func) => {
// tslint:disable-next-line:forin

@@ -10,3 +10,5 @@ for (const key in source) {

};
exports.copyProperty = (value) => (k) => value[k];
exports.forEach = forEach;
const copyProperty = (value) => (k) => value[k];
exports.copyProperty = copyProperty;
const fromMutableOptional = (v) => v;

@@ -21,3 +23,3 @@ /**

*/
exports.setMutableProperty = (mutable, k, v) => {
const setMutableProperty = (mutable, k, v) => {
if (v !== undefined) {

@@ -31,14 +33,16 @@ mutable[k] = v;

};
exports.create = (factory) => {
exports.setMutableProperty = setMutableProperty;
const create = (factory) => {
const result = {};
exports.forEach(factory, (propertyFactory, k) => { exports.setMutableProperty(result, k, propertyFactory(k)); });
(0, exports.forEach)(factory, (propertyFactory, k) => { (0, exports.setMutableProperty)(result, k, propertyFactory(k)); });
return fromMutableOptional(result);
};
exports.copyCreate = (source, factory) => {
exports.create = create;
const copyCreate = (source, factory) => {
const result = {};
exports.forEach(source, (v, k) => {
exports.setMutableProperty(result, k, v);
(0, exports.forEach)(source, (v, k) => {
(0, exports.setMutableProperty)(result, k, v);
});
let changes = false;
exports.forEach(factory, (propertyFactory, k) => {
(0, exports.forEach)(factory, (propertyFactory, k) => {
// tslint:disable-next-line:strict-type-predicates

@@ -49,3 +53,3 @@ if (propertyFactory !== undefined) {

if (sourceValue !== newValue) {
exports.setMutableProperty(result, k, newValue);
(0, exports.setMutableProperty)(result, k, newValue);
changes = true;

@@ -57,3 +61,5 @@ }

};
exports.asMutable = (source) => source;
exports.copyCreate = copyCreate;
const asMutable = (source) => source;
exports.asMutable = asMutable;
//# sourceMappingURL=index.js.map
{
"name": "@ts-common/property-set",
"version": "1.1.1",
"version": "1.1.2",
"description": "A set of properties",

@@ -39,11 +39,11 @@ "main": "dist/index.js",

"devDependencies": {
"@types/chai": "^4.3.3",
"@types/mocha": "^9.1.1",
"chai": "^4.2.0",
"mocha": "^10.0.0",
"nyc": "^15.0.0",
"tslint": "^5.15.0",
"typescript": "^3.4.1"
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.0",
"chai": "^4.3.7",
"mocha": "^10.1.0",
"nyc": "^15.1.0",
"tslint": "^6.1.3",
"typescript": "^4.9.3"
},
"dependencies": {}
}

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