update tsconfig
This commit is contained in:
parent
c016f187c0
commit
8917a9f768
@ -5,17 +5,26 @@
|
|||||||
"githost": "code.foss.global",
|
"githost": "code.foss.global",
|
||||||
"gitscope": "push.rocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "smartobject",
|
"gitrepo": "smartobject",
|
||||||
"description": "work with objects",
|
"description": "A library to simplify and enhance object manipulation and traversal.",
|
||||||
"npmPackagename": "@push.rocks/smartobject",
|
"npmPackagename": "@push.rocks/smartobject",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"projectDomain": "push.rocks"
|
"projectDomain": "push.rocks",
|
||||||
|
"keywords": [
|
||||||
|
"object manipulation",
|
||||||
|
"deep traversal",
|
||||||
|
"typescript",
|
||||||
|
"object comparison",
|
||||||
|
"property matching",
|
||||||
|
"dynamic property access",
|
||||||
|
"object flattening"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
},
|
},
|
||||||
"tsdocs": {
|
"tsdoc": {
|
||||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
13
package.json
13
package.json
@ -2,7 +2,7 @@
|
|||||||
"name": "@push.rocks/smartobject",
|
"name": "@push.rocks/smartobject",
|
||||||
"version": "1.0.12",
|
"version": "1.0.12",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "work with objects",
|
"description": "A library to simplify and enhance object manipulation and traversal.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
@ -39,5 +39,14 @@
|
|||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
],
|
],
|
||||||
"type": "module"
|
"type": "module",
|
||||||
|
"keywords": [
|
||||||
|
"object manipulation",
|
||||||
|
"deep traversal",
|
||||||
|
"typescript",
|
||||||
|
"object comparison",
|
||||||
|
"property matching",
|
||||||
|
"dynamic property access",
|
||||||
|
"object flattening"
|
||||||
|
]
|
||||||
}
|
}
|
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
143
readme.md
143
readme.md
@ -1,37 +1,130 @@
|
|||||||
# @push.rocks/smartobject
|
# @push.rocks/smartobject
|
||||||
work with objects
|
work with objects
|
||||||
|
|
||||||
## Availabililty and Links
|
## Install
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartobject)
|
To install `@push.rocks/smartobject`, use the following npm command. It's recommended to install this package in a TypeScript project to make full use of its functionalities and type definitions.
|
||||||
* [gitlab.com (source)](https://gitlab.com/push.rocks/smartobject)
|
|
||||||
* [github.com (source mirror)](https://github.com/push.rocks/smartobject)
|
|
||||||
* [docs (typedoc)](https://push.rocks.gitlab.io/smartobject/)
|
|
||||||
|
|
||||||
## Status for master
|
```
|
||||||
|
npm install @push.rocks/smartobject --save
|
||||||
|
```
|
||||||
|
|
||||||
Status Category | Status Badge
|
This command will add `@push.rocks/smartobject` to your project's `package.json` file and download the package to the `node_modules` directory.
|
||||||
-- | --
|
|
||||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartobject/badges/master/pipeline.svg)](https://lossless.cloud)
|
|
||||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartobject/badges/master/coverage.svg)](https://lossless.cloud)
|
|
||||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartobject)](https://lossless.cloud)
|
|
||||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartobject)](https://lossless.cloud)
|
|
||||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
|
||||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
|
||||||
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
|
||||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/smartobject)](https://lossless.cloud)
|
|
||||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartobject)](https://lossless.cloud)
|
|
||||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartobject)](https://lossless.cloud)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
This module provides a convenient way to work with JavaScript objects, offering utilities for deep object manipulation, comparison, and more. Below are detailed examples of how to utilize `@push.rocks/smartobject` in a variety of use cases. Always use ESM syntax in combination with TypeScript for the best developer experience.
|
||||||
|
|
||||||
use TypeScript for best in class intellisense
|
### Importing the Module
|
||||||
|
|
||||||
## Contribution
|
Before you can use the functionalities provided by `smartobject`, you need to import the required classes or functions into your TypeScript file.
|
||||||
|
|
||||||
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
```typescript
|
||||||
|
import {
|
||||||
|
SmartObject,
|
||||||
|
fastDeepEqual,
|
||||||
|
smartGet,
|
||||||
|
smartAdd,
|
||||||
|
compareObjects,
|
||||||
|
forEachMinimatch
|
||||||
|
} from '@push.rocks/smartobject';
|
||||||
|
```
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
### Working with SmartObject
|
||||||
|
|
||||||
## Legal
|
The `SmartObject` class is a wrapper around a standard JavaScript object that provides additional capabilities for manipulating and querying the object.
|
||||||
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
#### Creating a SmartObject
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Original JavaScript object
|
||||||
|
const originalObject = {
|
||||||
|
level1: {
|
||||||
|
level2: 'value',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Creating a SmartObject
|
||||||
|
const smartObj = new SmartObject(originalObject);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Adding and Retrieving Values
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Adding a new value
|
||||||
|
smartObj.addValueAtFlatPathString('level1.newKey', 'newValue');
|
||||||
|
|
||||||
|
// Retrieving a value
|
||||||
|
const value = smartObj.getValueAtFlatPathString('level1.level2');
|
||||||
|
console.log(value); // Output: 'value'
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Converting to a Flat Object
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const flatObject = smartObj.toFlatObject();
|
||||||
|
console.log(flatObject); // Output: { 'level1.level2': 'value', 'level1.newKey': 'newValue' }
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deep Object Comparison
|
||||||
|
|
||||||
|
`compareObjects` allows you to compare two objects and get detailed information about their differences.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const obj1 = {name: 'John', age: 30};
|
||||||
|
const obj2 = {name: 'John', age: 31};
|
||||||
|
|
||||||
|
const comparisonResult = compareObjects(obj1, obj2);
|
||||||
|
console.log(comparisonResult);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deep Object Manipulation
|
||||||
|
|
||||||
|
`smartAdd` and `smartGet` enable deep manipulation and querying of objects using dot notation paths.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// Using smartAdd to add a deep-nested property
|
||||||
|
const obj = {};
|
||||||
|
smartAdd(obj, 'user.info.name', 'Jane Doe');
|
||||||
|
|
||||||
|
// Using smartGet to retrieve a deep-nested property
|
||||||
|
const name = smartGet(obj, 'user.info.name');
|
||||||
|
console.log(name); // Output: Jane Doe
|
||||||
|
```
|
||||||
|
|
||||||
|
### Iterating over Object Properties with Minimatch Patterns
|
||||||
|
|
||||||
|
`forEachMinimatch` provides a way to execute a function for each object property that matches a given minimatch pattern.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const userObj = {
|
||||||
|
'user.name': 'John Doe',
|
||||||
|
'user.age': 30,
|
||||||
|
'config.theme': 'dark',
|
||||||
|
};
|
||||||
|
|
||||||
|
forEachMinimatch(userObj, 'user.*', (value, key) => {
|
||||||
|
console.log(key, value);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
This module leverages the power of TypeScript to offer robust typing and intelligent auto-completion, making it easier to work with complex objects and avoid common pitfalls. Whether you are manipulating deeply nested properties, comparing object differences, or iterating over specific object keys, `@push.rocks/smartobject` provides a versatile toolkit to streamline your object handling logic.
|
||||||
|
|
||||||
|
For a complete list of features and functionalities, including additional utility functions not covered in these examples, please refer to the module's documentation and type definitions.
|
||||||
|
|
||||||
|
## License and Legal Information
|
||||||
|
|
||||||
|
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||||
|
|
||||||
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
### Trademarks
|
||||||
|
|
||||||
|
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||||
|
|
||||||
|
### Company Information
|
||||||
|
|
||||||
|
Task Venture Capital GmbH
|
||||||
|
Registered at District court Bremen HRB 35230 HB, Germany
|
||||||
|
|
||||||
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||||
|
|
||||||
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||||
|
Loading…
Reference in New Issue
Block a user