{"id":19562474,"url":"https://github.com/inpassor/jquery-common","last_synced_at":"2026-03-04T05:02:31.191Z","repository":{"id":58222080,"uuid":"62624480","full_name":"Inpassor/jquery-common","owner":"Inpassor","description":"Common functions library","archived":false,"fork":false,"pushed_at":"2017-03-23T06:37:13.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-27T04:10:47.562Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Inpassor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-05T09:41:46.000Z","updated_at":"2017-03-23T06:36:44.000Z","dependencies_parsed_at":"2022-08-31T02:51:46.963Z","dependency_job_id":null,"html_url":"https://github.com/Inpassor/jquery-common","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Inpassor/jquery-common","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inpassor%2Fjquery-common","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inpassor%2Fjquery-common/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inpassor%2Fjquery-common/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inpassor%2Fjquery-common/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Inpassor","download_url":"https://codeload.github.com/Inpassor/jquery-common/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Inpassor%2Fjquery-common/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30071896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T03:25:38.285Z","status":"ssl_error","status_checked_at":"2026-03-04T03:25:05.086Z","response_time":59,"last_error":"SSL_read: 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":[],"created_at":"2024-11-11T05:14:43.567Z","updated_at":"2026-03-04T05:02:31.170Z","avatar_url":"https://github.com/Inpassor.png","language":null,"readme":"Common functions library\n========================\n\nAuthor: Inpassor \u003cinpassor@yandex.com\u003e\n\nGitHub repository: https://github.com/Inpassor/jquery-common\n\nThis package is the set of common functions, that missing in jQuery, to my mind.\n\n\n## Installation\n\n### Using bower:\n\n```\nbower install inpassor-jquery-common\n```\n\n### Using composer asset plugin:\n\n```\ncomposer require bower-asset/inpassor-jquery-common\n```\n\n\n## Functions\n\nAll the functions are extending jQuery. So you can call them as\n**jQuery.someFunction()** or **$.someFunction()**.\n\nThe list of available functions that this package contains:\n\n\n### .isUndefined()\n\n.isUndefined(variable) | Returns: boolean\n--- | ---:\n**Description**: Checks if **variable** is undefined.\n\n\n### .isBool() / .isBoolean()\n\n.isBool(variable) | Returns: boolean\n--- | ---:\n**Description**: Checks if **variable** is boolean.\n\n\n### .isInt() / .isInteger()\n\n.isInt(variable) | Returns: boolean\n--- | ---:\n**Description**: Checks if **variable** is integer.\n\n\n### .isFloat()\n\n.isFloat(variable) | Returns: boolean\n--- | ---:\n**Description**: Checks if **variable** is float.\n\n\n### .isString()\n\n.isString(variable) | Returns: boolean\n--- | ---:\n**Description**: Checks if **variable** is string.\n\n\n### .isArray()\n\n.isArray(variable) | Returns: boolean\n--- | ---:\n**Description**: Checks if **variable** is array.\n\n\n### .getRandomString()\n\n.getRandomString() | Returns: string\n--- | ---:\n**Description**: Generates a random string.\n\n\n### .toFloat()\n\n.toFloat(variable) | Returns: float\n--- | ---:\n**Description**: Tries to convert **variable** to float. Return float value on success,\n0 on fail.\n\n\n### .numberFormat()\n\n.numberFormat(number[, decimals[, decPoint, thousandSep]]) | Returns: string\n--- | ---:\n**Description**: Format a number with grouped thousands.\n\nThis function accepts either one, two, or four parameters (not three):\n\nIf only one parameter is given, **number** will be formatted without decimals, but with\na comma (\",\") between every group of thousands.\n\nIf two parameters are given, **number** will be formatted with **decimals**\ndecimals with a dot (\".\") in front, and a comma (\",\") between every group of thousands.\n\nIf all four parameters are given, **number** will be formatted with **decimals**\ndecimals, **decPoint** instead of a dot (\".\") before the decimals and **thousandSep**\ninstead of a comma (\",\") between every group of thousands.\n\nParameter | Description\n--- | ---\n**number** | The number being formatted.\n**decimals** | Sets the number of decimal points.\n**decPoint** | Sets the separator for the decimal point.\n**thousandSep** | Sets the thousands separator.\n\n\n### .toMoney()\n\n.toMoney(number[, decPoint[, thousandSep]]) | Returns: string\n--- | ---:\n**Description**: Converts **number** to money format with 2 decimals after dot.\n\nThis function accepts either one, two, or three parameters:\n\nIf only one parameter is given, **number** will be formatted with dot (\".\") in front of decimals\nand with a space (\" \") between every group of thousands.\n\nIf two parameters are given, **number** will be formatted with **decPoint**\ninstead of a dot (\".\") before the decimals and with a space (\" \") between every group\nof thousands.\n\nIf all three parameters are given, **number** will be formatted with **decPoint**\ninstead of a dot (\".\") before the decimals and **thousandSep**\ninstead of a space (\" \") between every group of thousands.\n\nParameter | Description\n--- | ---\n**number** | The number being formatted.\n**decPoint** | Sets the separator for the decimal point.\n**thousandSep** | Sets the thousands separator.\n\n\n### .prefixZero()\n\n.prefixZero(number[, length]) | Returns: string\n--- | ---:\n**Description**: Returns **number** with prefix zeros. The total length of the\nreturned string equals to **length**.\n\nParameter | Description\n--- | ---\n**number** | The number being formatted.\n**length** | Length of the returned string.\n\n\n### .db()\n\n**Description**: The function that combines everything you need to work with\nlocalStorage.\n\n.db() | Returns: bool\n--- | ---:\n**Description**: Returns true if localStorage is avalable. Otherwise returns false.\n\n.db('clear') | Returns: bool\n--- | ---:\n**Description**: Clears all the contents of the localStorage.\n\n.db(key) | Returns: mixed\n--- | ---:\n**Description**: Gets a value of **key** from then localStorage. If **key** was not found\nreturns *undefined*.\n\n.db('remove', key) | Returns: bool\n--- | ---:\n**Description**: Removes **key** and its value from the localStorage.\n\n.db('removeAll', keySubstr) | Returns: bool\n--- | ---:\n**Description**: Removes all data from the localStorage that keys contain **keySubstr**\nsubstring.\n\n.db(key, value) | Returns: bool\n--- | ---:\n**Description**: Sets **key** and its **value** to the localStorage.\n\n\n### .getQueryParams()\n\n.getQueryParams([queryString]) | Returns: object\n--- | ---:\n**Description**: Parses query string of the current URL or **queryString**\nif given. Returns object with keys and values corresponding to query parameters\nand its values.\n\nParameter | Description\n--- | ---\n**queryString** | The string being parsed. If not given, query string of the current URL will be used instead.\n\n\n### .toQueryString()\n\n.toQueryString(object) | Returns: string\n--- | ---:\n**Description**: Converts object to query string.\n\nParameter | Description\n--- | ---\n**object** | The object being converted.\n\n\n### .getScriptParams()\n\n.getScriptParams(filename) | Returns: object\n--- | ---:\n**Description**: Finds a sript file in DOM srtucture by its **filename** and\nparses query parameters ot this file using **.getQueryParams()** function.\n\nParameter | Description\n--- | ---\n**filename** | The name of sript file without extension \".js\".\n\n\n### .getHashParams()\n\n.getHashParams() | Returns: object\n--- | ---:\n**Description**: Parses hash of the current URL using **.getQueryParams()** function.\n\n\n### .hashRemove()\n\n**Description**: Removes hash from query string of the current URL preserving\ncurrent scroll position.\n\n\n### .waitFor()\n\n.waitFor(globalObjectName[, period[, interval]]) | Returns: $.Deferred\n--- | ---:\n**Description**: Looks for window global variable.\n\nParameter | Default | Description\n--- | --- | ---\n**globalObjectName** | | The name of a variable in window.\n**period** | 1000 | The period in miliseconds to wait for variable.\n**interval** | 10 | The inverval of iterations.\n\n#### Example:\n\n```\n$.waitFor('App')\n    .done(function(){\n        // window.App successfully appeared.\n    })\n    .fail(function(){\n        // 1 second past, window.App did not appear.\n    });\n```\n\n\n### .render()\n\n.render(template[, data]) | Returns: string\n--- | ---:\n**Description**: Renders a string **template** using **data**.\nAll the **template** constructions of the form \"{{...}}\" will be\nreplaced by **data** values.\n\nParameter | Description\n--- | ---\n**template** | A string template.\n**data** | Object, which values will be substituted to the **template**.\n \n#### Examples:\n\nAll the examples below will return the same string\n\"The server time: 12:30:41\".\n\n```\n$.render(\"The server time: {{time}}\", {\n    time: '12:30:41'\n});\n```\n\n```\n$.render(\"The server time: {{time[0]}}:{{time[1]}}:{{time[2]}}\", {\n    time: [12, 30, 41]\n});\n```\n\n```\n$.render(\"The server time: {{time.hour}}:{{time.min}}:{{time.sec}}\", {\n    time: {\n        hour: 12,\n        min: 30,\n        sec: 41\n     }\n});\n```\n\n```\n$.render(\"{{dummy}}The server time: {{hour}}:{{min}}:{{sec}}\", {\n    hour: 12,\n    min: 30,\n    sec: 41\n});\n```\n\nNote that \"{{dummy}}\" in the example above will be substituted by empty\nstring beacuse of \"dummy\" parameter is missing in data object.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finpassor%2Fjquery-common","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finpassor%2Fjquery-common","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finpassor%2Fjquery-common/lists"}