{"id":19273895,"url":"https://github.com/rintoj/tsds-tools","last_synced_at":"2026-06-15T12:31:30.126Z","repository":{"id":63321523,"uuid":"566741063","full_name":"rintoj/tsds-tools","owner":"rintoj","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-01T14:16:47.000Z","size":145,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-02T22:42:08.392Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rintoj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-16T10:17:48.000Z","updated_at":"2022-11-16T12:20:15.000Z","dependencies_parsed_at":"2025-01-05T14:27:08.860Z","dependency_job_id":"7e49346a-6e13-47c4-9190-314fb512290d","html_url":"https://github.com/rintoj/tsds-tools","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"72a5453b94847fe867d86774135d81ccaf0c73ae"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/rintoj/tsds-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rintoj%2Ftsds-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rintoj%2Ftsds-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rintoj%2Ftsds-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rintoj%2Ftsds-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rintoj","download_url":"https://codeload.github.com/rintoj/tsds-tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rintoj%2Ftsds-tools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34363537,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-15T02:00:07.085Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T20:44:24.362Z","updated_at":"2026-06-15T12:31:30.090Z","avatar_url":"https://github.com/rintoj.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tsds-tools\n\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\n**tsds-tools** is a collection of TypeScript tools designed to enhance the development process.\n\n## Installation\n\n### Yarn\n\n```sh\nyarn add tsds-tools\n```\n\n### NPM\n\n```sh\nnpm install tsds-tools\n```\n\n## Types\n\n### AllRequired\\\u003cT\u003e\n\nEnsures all optional properties in a type are required.\n\n```typescript\nimport { AllRequired } from 'tsds-tools'\n\ninterface User {\n  id: string\n  name?: string\n  age?: number\n}\n\ntype UserRecord = AllRequired\u003cUser\u003e\n/* Produces:\n * interface UserRecord {\n *   id: string;\n *   name: string;\n *   age: number;\n * }\n */\n```\n\n### ById\\\u003cT\u003e\n\nCreates a type where keys are IDs and values are objects of type T.\n\n```typescript\nimport { ById } from 'tsds-tools'\n\ntype UsersById = ById\u003cUser\u003e\n/* Produces:\n * interface UsersById {\n *   [id: string]: User;\n * }\n */\n```\n\n### ClassType\\\u003cT\u003e\n\nSpecifies that a variable only accepts classes that extend from the specified class.\n\n```typescript\nimport { ClassType } from 'tsds-tools'\n\nfunction someFunction(var1: ClassType\u003cRepository\u003e) {\n  // var1 only accepts classes that extend from the \"Repository\" class\n}\n```\n\n### Flatten\\\u003cT\u003e\n\nFlattens a nested type structure by converting nested properties into flat, dotted notation.\n\n```typescript\nimport { Flatten } from 'tsds-tools'\n\ninterface User {\n  id: string\n  name?: string\n  profile?: UserProfile\n}\n\ninterface UserProfile {\n  bio?: string\n  age?: number\n  picture?: URL\n}\n\ninterface URL {\n  url?: string\n}\n\ntype FlattenedUser = Flatten\u003cUser\u003e\n/* Produces:\n * interface FlattenedUser {\n *   id: string;\n *   name?: string;\n *   'profile.bio': string;\n *   'profile.age': number;\n *   'profile.picture.url': string;\n * }\n */\n```\n\n### InferredType\\\u003cEntity, Key\u003e\n\nInfers the type of a specific property within an entity.\n\n```typescript\nimport { InferredType } from 'tsds-tools'\n\ninterface User {\n  id: string\n  roles?: number[]\n  tags?: string[]\n}\n\ntype Type1 = InferredType\u003cUser, 'id'\u003e // string\ntype Type2 = InferredType\u003cUser, 'roles'\u003e // number\ntype Type3 = InferredType\u003cUser, 'tags'\u003e // string\n```\n\n### KeysOf\\\u003cEntity, Type = any\u003e\n\nReturns keys of an entity based on the specified type.\n\n```typescript\nimport { KeysOf, Primitive } from 'tsds-tools'\n\ninterface User {\n  id: string\n  name?: string\n  age?: number\n  alias?: string[]\n  limits?: number[]\n  profile?: UserProfile\n}\n\ninterface UserProfile {\n  bio?: string\n}\n\ntype NumberKeys = KeysOf\u003cUser, number\u003e // \"age\"\ntype NumberArrayKeys = KeysOf\u003cUser, number[]\u003e // \"limits\"\ntype StringKeys = KeysOf\u003cUser, string\u003e // \"id\" | \"name\"\ntype StringArrayKeys = KeysOf\u003cUser, string[]\u003e // \"alias\"\ntype AllPrimitiveTypes = KeysOf\u003cUser, Primitive\u003e // \"id\" | \"name\" | \"age\" | \"alias\" | \"limits\"\ntype AllArrayKeys = KeysOf\u003cUser, any[]\u003e // \"alias\" | \"limits\"\ntype AllKeys = KeysOf\u003cUser\u003e // \"id\" | \"name\" | \"age\" | \"alias\" | \"limits\" | \"profile\"\n```\n\n### KeysOfNonPrimitives\\\u003cEntity, Type = any\u003e\n\nReturns keys of an entity that have non-primitive types.\n\n```typescript\nimport { KeysOfNonPrimitives } from 'tsds-tools'\n\ninterface User {\n  id: string\n  name?: string\n  age?: number\n  alias?: string[]\n  limits?: number[]\n  profile?: UserProfile\n  otherProfiles?: UserProfile[]\n}\n\ninterface UserProfile {\n  bio?: string\n}\n\ntype Keys = KeysOfNonPrimitives\u003cUser\u003e // \"profile\"\ntype NumberArrayKeys = KeysOf\u003cUser, number[]\u003e // \"limits\"\ntype StringKeys = KeysOf\u003cUser, string\u003e // \"id\" | \"name\"\ntype StringArrayKeys = KeysOf\u003cUser, string[]\u003e // \"alias\"\ntype AllPrimitiveTypes = KeysOf\u003cUser, Primitive\u003e // \"id\" | \"name\" | \"age\" | \"alias\" | \"limits\"\ntype AllArrayKeys = KeysOf\u003cUser, any[]\u003e // \"alias\" | \"limits\"\ntype AllKeys = KeysOf\u003cUser\u003e // \"id\" | \"name\" | \"age\" | \"alias\" | \"limits\" | \"profile\"\n```\n\n### TypeOf\\\u003cEntity, Key\u003e\n\nExtracts the type of a specific property within an entity.\n\n```typescript\nimport { TypeOf } from './type-of'\n\ninterface User {\n  id: string\n  name?: string\n  age?: number\n  alias?: string[]\n  limits?: number[]\n  profile?: UserProfile\n}\n\ninterface UserProfile {\n  bio?: string\n}\n\ntype Type1 = TypeOf\u003cUser, 'age'\u003e // number\ntype Type2 = TypeOf\u003cUser, 'name'\u003e // string\ntype Type3 = TypeOf\u003cUser, 'alias'\u003e // string[]\ntype Type4 = TypeOf\u003cUser, 'profile'\u003e // UserProfile\n```\n\n### Primitive\n\nDefines types that are either non-array primitives or array primitives.\n\n```typescript\ntype NonArrayPrimitive = boolean | number | string | Date | null\n\ntype ArrayPrimitive = Array\u003cNonArrayPrimitive\u003e\n\ntype Primitive = NonArrayPrimitive | ArrayPrimitive\n```\n\n## Utils\n\n### deepClone(value: Array | Object)\n\nCreates a deep clone of an array or object.\n\n### flatten(value: Array | Object)\n\nFlattens an array or object into a one-dimensional object with dotted notation keys.\n\n```typescript\nimport { flatten } from 'tsds-tools'\n\nconst result = flatten({ a: 'a', b: { c: [1, 2, 3], d: 'd' } })\n/*\n * \"result\" will be :\n * {\n *   'a': 'a',\n *   'b.d': 'd',\n *   'b.c.0': 1,\n *   'b.c.1': 2,\n *   'b.c.2': 3,\n * }\n *\n */\n```\n\n### filterAsync(items: T[], callback: (item: T, index: number) =\u003e Promise\u003cboolean\u003e)\n\nAsynchronously filters an array based on a provided callback function.\n\n```typescript\nimport { filterAsync } from 'tsds-tools';\n\nconst result = await filterAsync(array, async callback(i) =\u003e true);\n```\n\n### mapAsync(items: T[], callback: (item: T, index: number) =\u003e Promise\u003cT\u003e)\n\nAsynchronously maps an array based on a provided callback function.\n\n```typescript\nimport { mapAsync } from 'tsds-tools';\n\nconst result = await mapAsync(array, async callback(i) =\u003e Promise.resolve(/* value */));\n```\n\n### flatMapAsync(items: T[], callback: (item: T, index: number) =\u003e Promise\u003cT\u003e)\n\nAsynchronously performs a flatMap operation on an array based on a provided callback function.\n\n```typescript\nimport { flatMapAsync } from 'tsds-tools';\n\nconst result = await flatMapAsync(array, async callback(i) =\u003e Promise.resolve(/* value */));\n```\n\n### reduceAsync(items: T[], callback: (accumulator: O, item: T, index: number) =\u003e Promise\u003cO\u003e)\n\nAsynchronously reduces an array based on a provided callback function.\n\n```typescript\nimport { reduceAsync } from 'tsds-tools';\n\nconst reducedValue = await reduceAsync(array, async callback(accumulator, i) =\u003e Promise.resolve(accumulator + i));\n```\n\n### getProperty(key: string, entity: Object)\n\nRetrieves a nested property value from an object using a dot-separated key.\n\n```typescript\nimport { getProperty } from 'tsds-tools'\n\nconst object = {\n  a: 'A',\n  b: 1,\n  c: {\n    d: {\n      e: 'E',\n      f: 2,\n      h: [1, 2],\n    },\n    g: 'G',\n  },\n}\n\ngetProperty('c.d.e', object) // returns 'E'\ngetProperty('c.d.h', object) // returns [1, 2]\ngetProperty('3.2.1', [0, 1, 2, [1, 2, [4, 5, 6]], 4] as const) // returns 5\n```\n\n### isDefined\\\u003cT\u003e(value: T | null | undefined)\n\nFilters out null and undefined values from an array.\n\n```typescript\nimport { isDefined } from 'tsds-tools'\n\nconst result = [1, 2, 'x', null, undefined, 0].filter(isDefined)\n// result = [1, 2, 'x', 0]\n```\n\n### reconstruct\\\u003cE\u003e(record: Flatten\u003cE\u003e)\n\nReconstructs an object from its flattened representation.\n\n```typescript\nimport { reconstruct } from 'tsds-tools'\n\nconst result = reconstruct({ a: 'a', 'b.d': 'd', 'b.c.0': 1, 'b.c.1': 2, 'b.c.2': 3 })\n// result = { a: 'a', b: { c: [1, 2, 3], d: 'd' } }\n```\n\n### removeNullKeys\\\u003cE, O\u003e(record: Flatten\u003cE\u003e, prefix?: string)\n\nRemoves keys with null values from a flattened object.\n\n```typescript\nimport { removeNullKeys } from 'tsds-tools'\n\nconst result = removeNullKeys({\n  id: '1',\n  value: 0,\n  key1: [\n    {\n      key1: 'key1',\n      key2: undefined,\n    },\n    {\n      key1: null,\n      key2: 'key2',\n    },\n  ],\n  key2: undefined,\n  other: 'other',\n})\n// result = {\n//   id: '1',\n//   value: 0,\n//   key1: [{ key1: 'key1' }, { key2: 'key2' }],\n//   other: 'other',\n// }\n```\n\n### setProperty(key: any, value: any, entity: Object)\n\nSets a nested property value in an object using a dot-separated key.\n\n```typescript\nimport { setProperty } from 'tsds-tools'\n\nsetProperty('a.b', 'B') // returns { a: { b: 'B' } }\nsetProperty('a.b', 'B', { a: { c: 'C' }, z: 1 }) // returns { a: { b: 'B', c: 'C' }, z: 1 }\n```\n\n### toByProperty\\\u003cT\u003e(array: T[], property: keyof T = 'id' as any)\n\nConverts an array of objects into an object where keys are values of a specified property.\n\n```typescript\nimport { toByProperty } from 'tsds-tools'\n\nconst array = [\n  { id: 1, name: 'User 1' },\n  { id: 2, name: 'User 2' },\n  { id: 3, name: 'User 3' },\n]\n\ntoByProperty(array)\n// {\n//   1: { id: 1, name: 'User 1' },\n//   2: { id: 2, name: 'User 2' },\n//   3: { id: 3, name: 'User 3' },\n// })\n```\n\n### toArrayByProperty\\\u003cT\u003e(array: T[], property: keyof T = 'id' as any)\n\nConverts an array of objects into an object where keys are values of a specified property, and\nvalues are arrays of objects.\n\n```typescript\nimport { toArrayByProperty } from 'tsds-tools'\n\nconst array = [\n  { id: 1, name: 'User 1' },\n  { id: 2, name: 'User 1' },\n  { id: 3, name: 'User 3' },\n]\n\ntoArrayByProperty(array, 'name')\n// {\n//   'User 1': [{ id: 1, name: 'User 1' }, { id: 2, name: 'User 1' }],\n//   'User 3': [{ id: 3, name: 'User 3' }],\n// }\n```\n\n### toNonNullArray\\\u003cT\u003e(array: Array\u003cT | undefined | null\u003e)\n\nFilters out null and undefined values from an array.\n\n```typescript\nimport { toNonNullArray } from 'tsds-tools'\n\ntoNonNullArray([1, 2, 'x', null, undefined, 0]) // returns [1, 2, 'x', 0]\n```\n\n## Automatic Release\n\nThe table below shows the release types based on commit messages:\n\n| Commit message      | Release type          |\n| ------------------- | --------------------- |\n| fix: [comment]      | Patch Release         |\n| feat: [comment]     | Minor Feature Release |\n| perf: [comment]     | Major Feature Release |\n| doc: [comment]      | No Release            |\n| refactor: [comment] | No Release            |\n| chore: [comment]    | No Release            |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frintoj%2Ftsds-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frintoj%2Ftsds-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frintoj%2Ftsds-tools/lists"}