{"id":26844309,"url":"https://github.com/x-titan/utils","last_synced_at":"2025-09-10T21:14:53.390Z","repository":{"id":52525327,"uuid":"376583892","full_name":"x-titan/utils","owner":"x-titan","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-09T17:15:22.000Z","size":205,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T00:53:10.995Z","etag":null,"topics":["browser-js","javascript","js","utils"],"latest_commit_sha":null,"homepage":"https://x-titan.github.io/utils/index.js","language":"JavaScript","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/x-titan.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,"zenodo":null}},"created_at":"2021-06-13T15:58:44.000Z","updated_at":"2025-05-09T17:15:28.000Z","dependencies_parsed_at":"2025-06-12T00:38:56.652Z","dependency_job_id":null,"html_url":"https://github.com/x-titan/utils","commit_stats":{"total_commits":105,"total_committers":2,"mean_commits":52.5,"dds":0.4285714285714286,"last_synced_commit":"8325c762fbd5c2ccaae2b971e223b038ab866324"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/x-titan/utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-titan%2Futils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-titan%2Futils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-titan%2Futils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-titan%2Futils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/x-titan","download_url":"https://codeload.github.com/x-titan/utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-titan%2Futils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264674973,"owners_count":23647908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["browser-js","javascript","js","utils"],"created_at":"2025-03-30T19:19:44.689Z","updated_at":"2025-07-10T22:09:08.086Z","avatar_url":"https://github.com/x-titan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Utils\n\nXTitan_Utils is a JavaScript library for quick functions.\n\n## Features\n\n- Support Chrome, Safary, Opera browsers\n- Type kind parameters with `types`\n- The ability to use the function `Random` and `UUID` functionals\n- `Mixin` objects\n- Advanced `Math` functions\n\n## Usage\n\nAdding script an core html file.\n\n```html\n\u003cscript src=\"https://x-titan.github.io/utils/index.js\" type=\"module\" defer\u003e\u003c/script\u003e\n```\n\nImport all functions\n\n```javascript\nimport * from \"https://x-titan.github.io/utils/index.js\"\n```\n\n### Type definition\n\n\n## Examples\n\n### Type definition\n\nFunction `is`  \n\n```javascript\nis.str(value)       // String\nis.num(value)       // Number\nis.obj(value)       // Object\nis.bool(value)      // Boolean\nis.symbol(value)    // Symbol\nis.null(value)      // null\nis.defined(value)   // any\nis.undefined(value) // undefined\n// And more usability methods of type functions\n```\n\nUsing `is` for kind type arguments.\n\n```javascript\nimport { is } from \"https://x-titan.github.io/utils/index.js\"\n\nfunction fizz (a) {\n    if(is.str(a)){\n        // typeof a === \"string\"\n    }\n\n    if(is.num(a)){\n        // typeof a === \"number\"\n    }\n}\n```\n\n### Math\n\n```javascript\nimport { radianToDegree, degreeToRadian } from \"https://x-titan.github.io/utils/index.js\"\n\nvar angle = radianToDegree(Math.PI / 2) // return: 90\nvar radian = degreeToRadian(180)        // return: 3.14 (Math.PI)\n```\n\n`clamp` and `map`\n\n```javascript\nimport { clamp, map } from \"https://x-titan.github.io/utils/index.js\"\n\nvar result_1 = clamp(value, min, max)\nvar result_2 = map(value, fromLow, fromHigh, toLow, toHigh)\n```\n\n`gcd` - greatest common divisor\n\n```javascript\nimport { gcd } from \"https://x-titan.github.io/utils/index.js\"\n\nvar result_1 = gcd(a,b)\n```\n\n### Random\n\n\n```javascript\nimport \"https://x-titan.github.io/utils/index.js\"\n\nvar result = Math.random(min, max)\nvar int = Math.randInt(min, max)\n```\n\nCreate new random function\n\n```javascript\nvar rand = Math.newRandom(seed)\n\nrand()\nrand(min)\nrand(min, max)\n```\n\n### Object mixins\n\n\n```javascript\nimport { mixin, extend } from \"https://x-titan.github.io/utils/index.js\"\n\nvar obj = mixin(...objects)\n\nvar result = extend(obj, ...objects) // result === obj\n```\n\n### Mono\n\n\n```javascript\nimport { Mono } from \"https://x-titan.github.io/utils/index.js\"\n\nclass A extends Mono(...objects) {\n    constructor(){\n        super()\n    }\n}\n\nclass B {\n    constructor(){\n        Mono.mixin(this)\n    }\n}\n\nconst C = Mono.extend(class C { })\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-titan%2Futils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fx-titan%2Futils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-titan%2Futils/lists"}