{"id":16293636,"url":"https://github.com/badsyntax/jquery-spellchecker","last_synced_at":"2026-02-26T03:05:09.394Z","repository":{"id":4975069,"uuid":"6132897","full_name":"badsyntax/jquery-spellchecker","owner":"badsyntax","description":"[not maintained] A lightweight jQuery plugin that can check the spelling of text within a form field or DOM tree.","archived":false,"fork":false,"pushed_at":"2018-01-15T11:15:23.000Z","size":7508,"stargazers_count":257,"open_issues_count":59,"forks_count":111,"subscribers_count":31,"default_branch":"master","last_synced_at":"2025-04-09T20:15:34.282Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://jquery-spellchecker.badsyntax.co","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"ssaunier/mergehook","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/badsyntax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-08T23:38:48.000Z","updated_at":"2024-11-22T18:09:24.000Z","dependencies_parsed_at":"2022-08-30T14:10:23.526Z","dependency_job_id":null,"html_url":"https://github.com/badsyntax/jquery-spellchecker","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Fjquery-spellchecker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Fjquery-spellchecker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Fjquery-spellchecker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/badsyntax%2Fjquery-spellchecker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/badsyntax","download_url":"https://codeload.github.com/badsyntax/jquery-spellchecker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103872,"owners_count":21048245,"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":[],"created_at":"2024-10-10T20:11:55.768Z","updated_at":"2026-02-26T03:05:04.348Z","avatar_url":"https://github.com/badsyntax.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# timespan\n\nA simple implementation of TimeSpans in Javascript.\n\n## Installation in node.js\n\n### Installing npm (node package manager)\n``` bash\n  $ curl http://npmjs.org/install.sh | sh\n```\n\n### Installing timespan\n``` bash\n  [sudo] npm install timespan\n```\n\n## Usage \nYou have two options when creating a new TimeSpan object: either explicitly instantiate it using the TimeSpan constructor function or use a helper method to create from a specific length of time.\n\n### Using the new constructor\n\n``` js\n  var timespan = require('timespan');\n  var ts = new timespan.TimeSpan();\n```\n\nThe constructor takes 5 parameters, all which are optional and which can be used to initialize the TimeSpan to a given value. These parameters are: `milliseconds`, `seconds`, `minutes`, `hours`, `days`.\n\n``` js\n  //\n  // Initializes the TimeSpan to 4 Minutes, 16 Seconds and 0 Milliseconds.\n  //\n  var ts = new TimeSpan(0,16,4)\n\n  //\n  // Initializes the TimeSpan to 3 hours, 4 minutes, 10 seconds and 0 msecs.\n  //\n  var ts = new TimeSpan(0,10,64,2);\n```\n\n### Using Construction Helper Method(s) \nYou can initialize a new TimeSpan by calling one of these Functions:\n\n``` js\n  timespan.FromSeconds(/* seconds */);\n  timespan.FromMinutes(/* minutes */);\n  timespan.FromHours(/* hours */);\n  timespan.FromDays(/* hours */);\n    \n  //\n  // This behaves differently, see below\n  //\n  timespan.FromDates(start, end);\n```\n\nThe first four helper methods take a single numeric parameter and create a new TimeSpan instance. e.g. `timespan.FromSeconds(45)` is equivalent to `new TimeSpan(0,45)`. If the parameter is invalid/not a number, it will just be treated as 0 no error will be thrown.\n\n`timespan.FromDates()` is different as it takes two dates. The TimeSpan will be the difference between these dates.\n\nIf the second date is earlier than the first date, the TimeSpan will have a negative value. You can pass in \"true\" as the third parameter to force the TimeSpan to be positive always.\n\n``` js\n  var date1 = new Date(2010, 3, 1, 10, 10, 5, 0);\n  var date2 = new Date(2010, 3, 1, 10, 10, 10, 0);\n  var ts = TimeSpan.FromDates(date2, date1);\n  var ts2 = TimeSpan.FromDates(date2, date1, true);\n  \n  //\n  // -5, because we put the later date first\n  //\n  console.log(ts.totalSeconds()); \n  \n  //\n  // 5, because we passed true as third parameter\n  //\n  console.log(ts2.totalSeconds()); \n```\n\n\n### Adding / Subtracting TimeSpans\nThere are several functions to add or subtract time:\n\n``` js\n  ts.addMilliseconds()\n  ts.addSeconds()\n  ts.addMinutes()\n  ts.addHours()\n  ts.addDays()\n  ts.subtractMilliseconds()\n  ts.subtractSeconds()\n  ts.subtractMinutes()\n  ts.subtractHours()\n  ts.subtractDays()\n```\n\nAll these functions take a single numeric parameter. If the parameter is invalid, not a number, or missing it will be ignored and no Error is thrown.\n\n``` js\n  var ts = new TimeSpan();\n  ts.addSeconds(30);\n  ts.addMinutes(2);\n  ts.subtractSeconds(60);\n  \n  //\n  // ts will now be a timespan of 1 minute and 30 seconds\n  //\n```\n\nThe parameter can be negative to negate the operation `ts.addSeconds(-30)` is equivalent to `ts.subtractSeconds(30)`.\n\n### Interacting with Other TimeSpan instances\nThese are the functions that interact with another TimeSpan:\n\n``` js\n  ts.add()\n  ts.subtract()\n  ts.equals()\n```\n\nadd and subtract add/subtract the other TimeSpan to the current one:\n\n``` js\n  var ts = TimeSpan.FromSeconds(30);\n  var ts2 = TimeSpan.FromMinutes(2);\n  ts.add(ts2);\n  \n  //\n  // ts is now a TimeSpan of 2 Minutes, 30 Seconds\n  // ts2 is unchanged\n  //\n```\n\nequals checks if two TimeSpans have the same time:\n\n``` js\n  var ts = TimeSpan.FromSeconds(30);\n  var ts2 = TimeSpan.FromSeconds(30);\n  var eq = ts.equals(ts2); // true\n  ts2.addSeconds(1);\n  var eq2 = ts.equals(ts2); // false\n```\n\n### Retrieving the Value of a TimeSpan\nThere are two sets of functions to retreive the function of the TimeSpan: those that deal with the full value in various measurements and another that gets the individual components.\n\n#### Retrieve the full value\n\n``` js\n  ts.totalMilliseconds()\n  ts.totalSeconds()\n  ts.totalMinutes()\n  ts.totalHours()\n  ts.totalDays()\n```\n\nThese functions convert the value to the given format and return it. The result can be a floating point number. These functions take a single parameter roundDown which can be set to true to round the value down to an Integer.\n\n``` js\n  var ts = TimeSpan.fromSeconds(90);\n  console.log(ts.totalMilliseconds()); // 90000\n  console.log(ts.totalSeconds());      // 90\n  console.log(ts.totalMinutes());      // 1.5\n  console.log(ts.totalMinutes(true));  // 1\n```\n\n#### Retrieve a component of the TimeSpan\n\n``` js\n  ts.milliseconds\n  ts.seconds\n  ts.minutes\n  ts.hours\n  ts.days\n```\n\nThese functions return a component of the TimeSpan that could be used to represent a clock. \n\n``` js\n  var ts = TimeSpan.FromSeconds(90);\n  console.log(ts.seconds()); // 30\n  console.log(ts.minutes()); // 1\n```\n\nBasically these value never \"overflow\" - seconds will only return 0 to 59, hours only 0 to 23 etc. Days could grow infinitely. All of these functions automatically round down the result:\n\n``` js\n  var ts = TimeSpan.FromDays(2);\n  ts.addHours(12);\n  console.log(ts.days());  // 2\n  console.log(ts.hours()); // 12\n```\n\n## Remark about Backwards Compatibility\nVersion 0.2.x was designed to work with [node.js][0] and backwards compatibility to the browser-based usage was not considered a high priority. This will be fixed in future versions, but for now if you need to use this in the browser, you can find the 0.1.x code under `/browser`.\n\n#### Author: [Michael Stum](http://www.stum.de)\n#### Contributors: [Charlie Robbins](http://github.com/indexzero)\n\n[0]: http://nodejs.org ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadsyntax%2Fjquery-spellchecker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadsyntax%2Fjquery-spellchecker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadsyntax%2Fjquery-spellchecker/lists"}