{"id":45211379,"url":"https://github.com/pmeisen/js-misc","last_synced_at":"2026-02-20T16:32:15.985Z","repository":{"id":30041226,"uuid":"33590320","full_name":"pmeisen/js-misc","owner":"pmeisen","description":"JavaScript with several miscellaneous stuff. The library provides for example: utilities to simplify dates usage, utilities to work with intervals, utilities to format and work with numbers.","archived":false,"fork":false,"pushed_at":"2017-02-28T19:18:25.000Z","size":93,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-14T04:46:30.935Z","etag":null,"topics":["dates","formats","formatting","intervals","javascript","numbers"],"latest_commit_sha":null,"homepage":"","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/pmeisen.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}},"created_at":"2015-04-08T07:00:21.000Z","updated_at":"2017-03-06T10:03:22.000Z","dependencies_parsed_at":"2022-08-31T00:01:58.811Z","dependency_job_id":null,"html_url":"https://github.com/pmeisen/js-misc","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/pmeisen/js-misc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmeisen%2Fjs-misc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmeisen%2Fjs-misc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmeisen%2Fjs-misc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmeisen%2Fjs-misc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmeisen","download_url":"https://codeload.github.com/pmeisen/js-misc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmeisen%2Fjs-misc/sbom","scorecard":{"id":738745,"data":{"date":"2025-08-11","repo":{"name":"github.com/pmeisen/js-misc","commit":"b76164f9475ed7af99f21c3e20d6032c0b1fa867"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-22T16:42:56.705Z","repository_id":30041226,"created_at":"2025-08-22T16:42:56.705Z","updated_at":"2025-08-22T16:42:56.705Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29656958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["dates","formats","formatting","intervals","javascript","numbers"],"created_at":"2026-02-20T16:32:15.397Z","updated_at":"2026-02-20T16:32:15.979Z","avatar_url":"https://github.com/pmeisen.png","language":"JavaScript","readme":"# js-misc\n[![Bower version](https://badge.fury.io/bo/js-misc.svg)](https://badge.fury.io/bo/js-misc)\n[![npm version](https://badge.fury.io/js/js-misc.svg)](https://badge.fury.io/js/js-misc)\n[![Build Status](https://travis-ci.org/pmeisen/js-misc.svg?branch=master)](https://travis-ci.org/pmeisen/js-misc)\n\nJavaScript with several miscellaneous stuff. The library provides for example:\n\n- utilities to simplify dates usage\n- utilities to work with intervals\n- utilities to format and work with numbers\n\n## How to Install\n\nThe library can be used with `bower`, `nodeJs (npm)`, `requireJs` or as individual `JavaScript Import`. The following paragraphs \nexplain how to use the library in the different scenarios.\n\n### Using js-misc with `bower`\n\n```\nbower install --save js-misc\n```\n\nThe library will be added to your `bower-components`. By default the `js-misc.js` is selected as single main file, which is the\nnot minified version of the library (the minified/uglified version is `js-misc.min.hs`). If used within a browser, the different \nlibraries are bound to the `window` instance as:\n\n- `window.Utility`\n- `window.DateLibrary`\n- `window.NumberLibrary`\n- `window.IntervalCollection`\n\nThus, they can be simple used by just using `Utility.isEventSupported('click');` or `var intervalCollection = new IntervalCollection();`. \nFurther examples on how to use the different libraries can be found [here](#usage-examples).\n\n### Using js-misc with `nodeJs (npm)`\n\nTo use the library within a node project, simple install it using `npm`:\n\n```\nnpm install --save js-misc\n```\n\nThe different libraries are combined in one single object, which is exported by the module, i.e., the different libraries are\navailable like:\n\n- \u003cvar\u003e.Utility\n- \u003cvar\u003e.DateLibrary\n- \u003cvar\u003e.NumberLibrary\n- \u003cvar\u003e.IntervalCollection\n\nFor example:\n\n```javascript\nvar Misc = require('js-misc');\n\nvar Interval = Misc.IntervalCollection.Interval;\nvar intervalCollection = new Misc.IntervalCollection();\n\nintervalCollection.insert(new Interval(6, 6, {id: 1}));\nvar overlaps = intervalCollection.overlap(new Interval(5, 8));\n```\n\nFurther examples can be found [here](#usage-examples).\n\n### Using js-misc with `requireJs`\n\nIf you are building larger web-applications and you want to enjoy the advantage of [requireJs](http://requirejs.org/), you\nneed to include the sources (and not the optimized libraries). To do so, you may download the tarball or a zip-archive from \nGitHub and place it into your `scripts` folder. You can then require the needed library as following:\n\n```javascript\nrequire([\n    'net/meisen/general/Utility',\n    'net/meisen/general/date/DateLibrary',\n    'net/meisen/general/number/NumberLibrary',\n    'net/meisen/general/interval/IntervalCollection',\n    'net/meisen/general/interval/Interval'\n], function (Utility,\n             DateLibrary,\n             NumberLibrary,\n             IntervalCollection,\n             Interval) {\n    \n    // do whatever needed\n    \n});\n```\n\n### Using js-misc with `JavaScript Import`\n\nIf you simple want to use the library within your web-site, you can easily do so by downloading it, deploying it on your\nserver and adding `\u003cscript\u003e...\u003c/script\u003e` tags:\n\n```html\n\u003cscript src=\"/js/js-misc.min.js\"\u003e\u003c/script\u003e\n```\n\nThe different libraries are bound to the `window` instance and are directly available for any other script:\n\n```html\n\u003cscript src=\"/js/js-misc.min.js\"\u003e\u003c/script\u003e\n\u003cscript type=\"text/javascript\"\u003e\n    var intervalCollection = new IntervalCollection();\n    \n    intervalCollection.insert(new Interval(6, 6, {id: 1}));\n    var overlaps = intervalCollection.overlap(new Interval(5, 8));\n\u003c/script\u003e\n```\n\nIf you'd like to have this library available through a CDN, please **Star** the project.\n\n## Usage Examples\n\nCurrently this library offers just a couple of functions, which I needed within my dissertation project. Nevertheless, in \nthe future I plan to add more and more general functions, whenever I have the chance to make code available to the public \nand or have some time to write private code, useful code-snippets. Currently, one of the main functionalities available is\nthe `Interval` stuff. Thus, I give a some examples on how to use this part of the library. Examples can be found also within \nthe test folder, i.e., [test](/test/net/meisen/general) and [specs](/specs/net/meisen/general).\n\n**Note (nodeJs users only):** \n\nUsing the module within nodeJs means that the libraries and data-types cannot be accessed directly (i.e., be just typing\nthe libraries or data-types name). For the examples, I assume that the following code was used:\n\n```javascript\nvar Misc = require('js-misc');\n\nvar Utility = Misc.Utility;\nvar DateLibrary = Misc.DateLibrary;\nvar NumberLibrary = Misc.NumberLibrary;\nvar IntervalCollection = Misc.IntervalCollection;\n```\n\n### Formatting Numbers\n\nThe `NumberLibrary` offers an easy way to format numbers using the symbols `#`, `0`, `.`, and `,` \nas described, e.g., [here](https://msdn.microsoft.com/en-us/library/0c899ak8(v=vs.110).aspx).\n\n```javascript\nconsole.log(NumberLibrary.format(3.54, '#'));\nconsole.log(NumberLibrary.format(3.54, '00'));\nconsole.log(NumberLibrary.format(2.657, '#000.00'));\nconsole.log(NumberLibrary.format(15005, '###,###,###,###,##0.####'));\nconsole.log(NumberLibrary.format(15005, '###,###,##0.00', ',', '.'));\n```\n\nCreates the output:\n\n```\n4\n04\n002.66\n15,005\n15.005,00\n```\n\n### Handling Intervals\n\nThe `IntervalLibrary` offers some implementations to work with intervals, e.g., to find overlapping intervals within a collection,\ncompare intervals within a collections, or find the position to add an interval. \n\n```javascript\n// find overlapping intervals\nvar intervalCollection = new IntervalCollection();\nintervalCollection.insert(new Interval(6, 6, {id: 1}));\nintervalCollection.insert(new Interval(7, 8, {id: 2}));\n\nvar result = intervalCollection.overlap(new Interval(5, 6);\nconsole.log('Found ' + result.length + ' overlapping intervals in collection');\nif (result.length \u003e 0) {\n    console.log('The id of the first overlapping interval is: ' + result[0].get('id'));\n}\n```\n\n```javascript\n// find the position to insert a value, so that the collection stays sorted\nvar intervalCollection = new IntervalCollection();\n\nvar list = [\n    new IntervalCollection.Interval(1, 5), //  0\n    new IntervalCollection.Interval(1, 6), //  1\n    new IntervalCollection.Interval(1, 7), //  2\n    new IntervalCollection.Interval(2, 3), //  3\n    new IntervalCollection.Interval(2, 4), //  4\n    new IntervalCollection.Interval(2, 4), //  5\n    new IntervalCollection.Interval(2, 6), //  6\n    new IntervalCollection.Interval(5, 7), //  7\n    new IntervalCollection.Interval(5, 7), //  8\n    new IntervalCollection.Interval(5, 8), //  9\n    new IntervalCollection.Interval(6, 6)  // 10\n];\n\nintervalCollection.findPosition(list, new Interval(-2, 2)); // returns 0\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmeisen%2Fjs-misc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmeisen%2Fjs-misc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmeisen%2Fjs-misc/lists"}