@typedly/collection
v6.2.0
Published
A TypeScript type definitions package for data collections with customizable storage.
Maintainers
Readme
@typedly/collection
A TypeScript type definitions package for data collections with customizable storage.
Features
- Adapter: The default interface for adapters in collections.
- Constructor: The constructor type for initialization with custom storage (e.g.
Set,Array). - Shape: The shape of element-based collection built on @typedly/data.
- Customizable Storage: Support for various storage types (
Set<T>,T[], etc.) via generics with add/remove/iterate. - Iteration & Symbols: Built-in
[Symbol.iterator]for spread/for-of, with[Symbol.toStringTag]for debugging. - TypeScript-Only: Zero runtime, pure type definitions for type-safe collections.
Table of contents
Related packages
Peer dependencies
- @typedly/data-traits: A TypeScript type definitions package for configurable data traits, providing various kinds of configurable data interfaces.
- @typedly/data: A TypeScript type definitions for
@typescript-package/data.
General
- @typedly/adaptable-data: A TypeScript type definitions for data adapter.
- @typedly/adaptable-collection: A TypeScript type definitions package for adaptable collections with configuration and adapter support.
- @typedly/configurable-collection: A TypeScript type definitions package for configurable collections with configuration.
- @typedly/collection: A TypeScript type definitions package for data collections with customizable storage.
- @typescript-package/data: A lightweight TypeScript library for basic data management.
- @typescript-package/collection: A lightweight TypeScript library for data collection.
Installation
npm install @typedly/collection --save-peerApi
import {
// Adapter.
CollectionAdapter,
// Constructor.
CollectionAdapterConstructor,
CollectionConstructor,
// Inference.
InferCollectionType,
InferElementFromSettings,
InferElement,
// Interface.
CollectionSettings,
CollectionShape,
// Type
CollectionConfig,
} from '@typedly/collection';Interface
Adapter
CollectionAdapter
The adapter interface for collections.
import { CollectionAdapter } from '@typedly/collection';CollectionAdapterConstructor
The interface of adapter constructor.
import { CollectionAdapterConstructor } from '@typedly/collection';Inference
InferCollectionType
Infer the collection type from the collection settings or adapter.
import { InferCollectionType } from '@typedly/collection';InferElementFromSettings
Type to infer the element type from collection settings or adapter.
import { InferElementFromSettings } from '@typedly/collection';InferElement
Type to infer the element type from collection settings or adapter, with special handling for common collection types like Set, Array, and Map.
import { InferElement } from '@typedly/collection';Main
CollectionConfig
The configuration type for collections, which extends the generic DataConfig type from @typedly/data with specific parameters related to collection settings, collection type, element type, and async behavior.
import { CollectionConfig } from '@typedly/collection';CollectionConstructor
The constructor type for CollectionShape.
import { CollectionConstructor } from '@typedly/collection';CollectionSettings
Represents the settings for a collection.
import { CollectionSettings } from '@typedly/collection';CollectionShape
The CollectionShape interface defines the structure and behavior of a collection data structure, which can be implemented by various types of collections such as sets, arrays, or maps.
import { CollectionShape } from '@typedly/collection';Contributing
Your contributions are valued! If you'd like to contribute, please feel free to submit a pull request. Help is always appreciated.
Support
If you find this package useful and would like to support its and general development, you can contribute through one of the following payment methods. Your support helps maintain the packages and continue adding new.
Support via:
or via Trust Wallet
Code of Conduct
By participating in this collection, you agree to follow Code of Conduct.
GIT
Commit
Versioning
Given a version number MAJOR.MINOR.PATCH, increment the:
- MAJOR version when you make incompatible API changes,
- MINOR version when you add functionality in a backwards-compatible manner, and
- PATCH version when you make backwards-compatible bug fixes.
Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
FAQ How should I deal with revisions in the 0.y.z initial development phase?
The simplest thing to do is start your initial development release at 0.1.0 and then increment the minor version for each subsequent release.
How do I know when to release 1.0.0?
If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backwards compatibility, you should probably already be 1.0.0.
License
MIT © typedly (license)
Packages
- @typedly/array: A TypeScript type definitions package to handle array-related operations.
- @typedly/callback: A TypeScript type definitions package for asynchronous and synchronous callback functions of various types.
- @typedly/character: A TypeScript type definitions package for various character types.
- @typedly/context: A TypeScript type definitions package for context data structures.
- @typedly/descriptor: A TypeScript type definitions package for property descriptor.
- @typedly/digit: A TypeScript type definitions package for digit types.
- @typedly/letter: A TypeScript type definitions package for handling letter types.
- @typedly/object: A TypeScript type definitions package to handle object-related operations.
- @typedly/payload: A TypeScript type definitions package for payload data structures.
- @typedly/property: A TypeScript type definitions package to handle object property-related operations.
- @typedly/regexp: A TypeScript type definitions package for
RegExp. - @typedly/symbol: A TypeScript type definitions package for various symbols.
