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

typescript-object-utils

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-object-utils - npm Package Compare versions

Comparing version 0.3.0 to 0.4.0

src/objectReduce/index.ts

4

dist/src/mergeDeep.d.ts

@@ -1,3 +0,3 @@

export declare const mergeDeep: Merge<{}, {}>;
export declare const shallowMergeDeep: Merge<{}, {}>;
export declare const mergeDeep: Merge<unknown, unknown>;
export declare const shallowMergeDeep: Merge<unknown, unknown>;
export declare type Merge<A, B> = <MA, MB>(a: MA, b: MB) => (MA & MB);

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

mrgDeep = function (a, b) {
var _a;
var r = a;

@@ -19,3 +20,2 @@ for (var p in b) {

return r;
var _a;
};

@@ -22,0 +22,0 @@ return mrgDeep;

"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", { value: true });
function objectMap(obj, cb) {
var keys = Object.keys(obj);
return keys
return Object.keys(obj)
.reduce(function (pV, currKey) {
return __assign({}, pV, (_a = {}, _a[currKey] = cb(obj[currKey], currKey, obj), _a));
var _a;
return __assign(__assign({}, pV), (_a = {}, _a[currKey] = cb(obj[currKey], currKey, obj), _a));
}, {});
}
exports.objectMap = objectMap;
{
"name": "typescript-object-utils",
"version": "0.3.0",
"version": "0.4.0",
"main": "dist/index.js",

@@ -18,3 +18,4 @@ "types": "dist/index.d.ts",

"shallow-merge",
"update"
"update",
"object-reduce"
],

@@ -25,3 +26,3 @@ "scripts": {

"test": "ts-node node_modules/tape/bin/tape src/*.test.ts src/**/*.test.ts",
"lint": "tslint -t verbose src/* src/**/*"
"lint": "tslint -t verbose src/*.ts src/**/*.ts"
},

@@ -33,5 +34,5 @@ "author": "Daniel Król",

"tape": "^4.6.3",
"ts-node": "^2.0.0",
"tslint": "^5.1.0",
"typescript": "~2.3.0"
"ts-node": "^8.0.0",
"tslint": "^6.1.0",
"typescript": "~3.8.0"
},

@@ -38,0 +39,0 @@ "repository": {

@@ -97,6 +97,15 @@ # typescript-object-utils

objectMap(a, v => String(v*2))
objectMap(obj, v => String(v*2))
//=> { a: '2', b: '4' }
```
#### objectMap
```typescript
import {objectReduce} from "typescript-object-utils";
const obj = {a: 1, b: 2};
objectReduce(obj, (acc, v) => acc + v, 0)
//=> 3
```
### [License (MIT)](LICENSE.md)

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