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

ts-enum-util

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-enum-util - npm Package Compare versions

Comparing version 4.0.2 to 4.1.0

1

dist/commonjs/$enum.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.$enum = void 0;
var EnumWrapper_1 = require("./EnumWrapper");

@@ -4,0 +5,0 @@ var symbols = require("./symbols");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createUnhandledEntryError = void 0;
function createUnhandledEntryError(unhandledValue) {

@@ -4,0 +5,0 @@ return new Error("Unhandled value: " + unhandledValue);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnumValueMappeeWithUndefined = exports.EnumValueMappeeWithNull = exports.EnumValueMappee = void 0;
var createUnhandledEntryError_1 = require("./createUnhandledEntryError");

@@ -4,0 +5,0 @@ var symbols_1 = require("./symbols");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnumValueVisiteeWithUndefined = exports.EnumValueVisiteeWithNull = exports.EnumValueVisitee = void 0;
var symbols_1 = require("./symbols");

@@ -4,0 +5,0 @@ var createUnhandledEntryError_1 = require("./createUnhandledEntryError");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnumWrapper = void 0;
var objectKeysUtil_1 = require("./objectKeysUtil");

@@ -189,2 +190,13 @@ var EnumWrapper = (function () {

};
EnumWrapper.prototype.createEnumSubset = function () {
var _this = this;
var keys = [];
for (var _i = 0; _i < arguments.length; _i++) {
keys[_i] = arguments[_i];
}
return keys.reduce(function (result, key) {
result[key] = _this.enumObj[key];
return result;
}, {});
};
return EnumWrapper;

@@ -191,0 +203,0 @@ }());

29

dist/commonjs/index.js
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./EnumWrapper"));
__export(require("./EnumValueVisitee"));
__export(require("./EnumValueMappee"));
__export(require("./$enum"));
__export(require("./mapEnumValue"));
__export(require("./visitEnumValue"));
__export(require("./symbols"));
__exportStar(require("./EnumWrapper"), exports);
__exportStar(require("./EnumValueVisitor"), exports);
__exportStar(require("./EnumValueVisitee"), exports);
__exportStar(require("./EnumValueMapper"), exports);
__exportStar(require("./EnumValueMappee"), exports);
__exportStar(require("./$enum"), exports);
__exportStar(require("./mapEnumValue"), exports);
__exportStar(require("./visitEnumValue"), exports);
__exportStar(require("./symbols"), exports);
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapEnumValue = void 0;
var EnumValueMappee_1 = require("./EnumValueMappee");

@@ -4,0 +5,0 @@ function mapEnumValue(value) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getOwnEnumerableNonNumericKeys = exports.getOwnEnumerableNonNumericKeysES3 = exports.getOwnEnumerableNonNumericKeysES5 = exports.getOwnEnumerableNonNumericKeysES6 = exports.isNonNumericKey = void 0;
function isNonNumericKey(key) {

@@ -29,7 +30,7 @@ return key !== String(parseFloat(key));

exports.getOwnEnumerableNonNumericKeysES3 = getOwnEnumerableNonNumericKeysES3;
exports.getOwnEnumerableNonNumericKeys = Object.getOwnPropertyNames
exports.getOwnEnumerableNonNumericKeys = !!Object.getOwnPropertyNames
? getOwnEnumerableNonNumericKeysES6
: Object.keys
: !!Object.keys
? getOwnEnumerableNonNumericKeysES5
: getOwnEnumerableNonNumericKeysES3;
//# sourceMappingURL=objectKeysUtil.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.handleUnexpected = exports.handleUndefined = exports.handleNull = exports.unhandledEntry = void 0;
exports.unhandledEntry = Symbol("ts-enum-util:unhandledEntry");

@@ -4,0 +5,0 @@ exports.handleNull = Symbol("ts-enum-util:handleNull");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.visitEnumValue = void 0;
var EnumValueVisitee_1 = require("./EnumValueVisitee");

@@ -4,0 +5,0 @@ function visitEnumValue(value) {

@@ -187,2 +187,13 @@ import { isNonNumericKey, getOwnEnumerableNonNumericKeys } from "./objectKeysUtil";

};
EnumWrapper.prototype.createEnumSubset = function () {
var _this = this;
var keys = [];
for (var _i = 0; _i < arguments.length; _i++) {
keys[_i] = arguments[_i];
}
return keys.reduce(function (result, key) {
result[key] = _this.enumObj[key];
return result;
}, {});
};
return EnumWrapper;

@@ -189,0 +200,0 @@ }());

export * from "./EnumWrapper";
export * from "./EnumValueVisitor";
export * from "./EnumValueVisitee";
export * from "./EnumValueMapper";
export * from "./EnumValueMappee";

@@ -4,0 +6,0 @@ export * from "./$enum";

@@ -23,7 +23,7 @@ export function isNonNumericKey(key) {

}
export var getOwnEnumerableNonNumericKeys = Object.getOwnPropertyNames
export var getOwnEnumerableNonNumericKeys = !!Object.getOwnPropertyNames
? getOwnEnumerableNonNumericKeysES6
: Object.keys
: !!Object.keys
? getOwnEnumerableNonNumericKeysES5
: getOwnEnumerableNonNumericKeysES3;
//# sourceMappingURL=objectKeysUtil.js.map

@@ -0,1 +1,2 @@

export {};
//# sourceMappingURL=types.js.map

@@ -339,2 +339,9 @@ import { StringKeyOf } from "./types";

getValueOrDefault(key: string | null | undefined, defaultValue: V | undefined): V | undefined;
/**
* Creates an enum-like object that contains a subset of entries of the
* original enum.
* @param keys - The keys to include in the new enum-like object.
* @returns A new enum-like object.
*/
createEnumSubset<K extends StringKeyOf<T>>(...keys: readonly K[]): Pick<T, K>;
}

@@ -341,0 +348,0 @@ export declare namespace EnumWrapper {

{
"name": "ts-enum-util",
"version": "4.0.2",
"version": "4.1.0",
"description": "TypeScript Enum Utilities",

@@ -37,3 +37,3 @@ "repository": {

"jest:coverage": "npm run clean:coverage && jest --coverage",
"dtslint:v2_9_plus": "dtslint --expectOnly type_tests/v2_9_plus",
"dtslint:v2_9_plus": "dtslint --expectOnly --localTs node_modules/typescript/lib type_tests/v2_9_plus",
"dtslint": "run-s clean:dist build:types dtslint:v2_9_plus",

@@ -51,13 +51,13 @@ "test": "run-s compile prettier:test lint dtslint jest",

"devDependencies": {
"@types/jest": "24.0.23",
"coveralls": "3.0.9",
"dtslint": "2.0.2",
"jest": "24.9.0",
"@types/jest": "26.0.18",
"coveralls": "3.1.0",
"dtslint": "4.0.7",
"jest": "26.6.3",
"npm-run-all": "4.1.5",
"prettier": "1.19.1",
"rimraf": "3.0.0",
"ts-jest": "24.2.0",
"rimraf": "3.0.2",
"ts-jest": "26.4.4",
"tslint": "5.20.1",
"tslint-config-prettier": "1.18.0",
"typescript": "3.7.2"
"typescript": "4.1.2"
},

@@ -64,0 +64,0 @@ "keywords": [

@@ -682,2 +682,17 @@ import { StringKeyOf } from "./types";

}
/**
* Creates an enum-like object that contains a subset of entries of the
* original enum.
* @param keys - The keys to include in the new enum-like object.
* @returns A new enum-like object.
*/
public createEnumSubset<K extends StringKeyOf<T>>(
...keys: readonly K[]
): Pick<T, K> {
return keys.reduce<Record<string, T[K]>>((result, key) => {
result[key] = this.enumObj[key];
return result;
}, {}) as Pick<T, K>;
}
}

@@ -684,0 +699,0 @@

@@ -84,6 +84,6 @@ import { StringKeyOf } from "./types";

*/
export const getOwnEnumerableNonNumericKeys = Object.getOwnPropertyNames
export const getOwnEnumerableNonNumericKeys = !!Object.getOwnPropertyNames
? getOwnEnumerableNonNumericKeysES6
: Object.keys
: !!Object.keys
? getOwnEnumerableNonNumericKeysES5
: getOwnEnumerableNonNumericKeysES3;

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

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