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

@simplism/core

Package Overview
Dependencies
Maintainers
1
Versions
224
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@simplism/core - npm Package Compare versions

Comparing version 10.1.48 to 10.2.2

1

dist/extension/ArrayExt.d.ts

@@ -42,2 +42,3 @@ import { Type } from "../type/Type";

single(predicate?: (item: T, index: number) => boolean): T | undefined;
single(key: keyof T, checkValue: T): T | undefined;
last(predicate?: (item: T, index: number) => boolean): T | undefined;

@@ -44,0 +45,0 @@ sum(): T | undefined;

22

dist/index.js

@@ -826,8 +826,20 @@ (function webpackUniversalModuleDefinition(root, factory) {

};
Array.prototype.single = function (predicate) {
var filtered = predicate ? this.filter(predicate.bind(this)) : this;
if (filtered.length > 1) {
throw new Error("복수의 결과물이 있습니다.");
Array.prototype.single = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return filtered[0];
if (args.length === 1) {
var predicate = args[0];
var filtered = predicate ? this.filter(predicate.bind(this)) : this;
if (filtered.length > 1) {
throw new Error("복수의 결과물이 있습니다.");
}
return filtered[0];
}
else {
var key_1 = args[0];
var checkValue_1 = args[1];
return this.single(function (item) { return item[key_1] === checkValue_1; });
}
};

@@ -834,0 +846,0 @@ Array.prototype.last = function (predicate) {

{
"name": "@simplism/core",
"version": "10.1.48",
"version": "10.2.2",
"description": "Simplism Core Package",

@@ -5,0 +5,0 @@ "repository": "github:kslhunter/simplism",

@@ -27,2 +27,4 @@ import {Type} from "../type/Type";

single(key: keyof T, checkValue: T): T | undefined;
last(predicate?: (item: T, index: number) => boolean): T | undefined;

@@ -134,8 +136,17 @@

Array.prototype.single = function (predicate?: (item: any, index: number) => boolean): any {
const filtered = predicate ? this.filter(predicate.bind(this)) : this;
if (filtered.length > 1) {
throw new Error("복수의 결과물이 있습니다.");
Array.prototype.single = function (...args: any[]): any {
if (args.length === 1) {
const predicate: ((item: any, index: number) => boolean) = args[0];
const filtered = predicate ? this.filter(predicate.bind(this)) : this;
if (filtered.length > 1) {
throw new Error("복수의 결과물이 있습니다.");
}
return filtered[0];
}
return filtered[0];
else {
const key = args[0];
const checkValue = args[1];
return this.single(item => item[key] === checkValue);
}
};

@@ -142,0 +153,0 @@

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