{"id":19514877,"url":"https://github.com/ndp/jsutils","last_synced_at":"2025-06-26T03:35:05.633Z","repository":{"id":1161227,"uuid":"1050122","full_name":"ndp/jsutils","owner":"ndp","description":"Javascript Utilities-- assorted utilities useful on their own","archived":false,"fork":false,"pushed_at":"2015-04-26T00:08:35.000Z","size":422,"stargazers_count":18,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-23T17:13:10.664Z","etag":null,"topics":[],"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/ndp.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-11-04T03:52:37.000Z","updated_at":"2025-06-10T02:33:40.000Z","dependencies_parsed_at":"2022-07-18T16:28:53.312Z","dependency_job_id":null,"html_url":"https://github.com/ndp/jsutils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ndp/jsutils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndp%2Fjsutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndp%2Fjsutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndp%2Fjsutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndp%2Fjsutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ndp","download_url":"https://codeload.github.com/ndp/jsutils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndp%2Fjsutils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261995472,"owners_count":23242202,"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-11-10T23:37:54.631Z","updated_at":"2025-06-26T03:35:05.613Z","avatar_url":"https://github.com/ndp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Various javascript utilities that don't (yet) warrant packaging on their own.\n\nCopyright (c) Andrew J. Peterson, NDP Software\n\n## jQuery Plugins\n\n### dataContext\njQuery plugin to collect multiple data attributes into an object, using the data attribute names as keys.\n Looks up the DOM and collects all data attributes, but the deepest ones win.\n\n **Usage:**\n  \u003cpre\u003e\n   $('\u0026lt;div data-product-id=\"1\"\u0026gt;\u0026lt;/div\u0026gt;').dataContext(); // =\u0026gt; {'product-id': '1'}\n   $('\u0026lt;div data-a=\"1\"\u0026gt;\u0026lt;span data-b=\"2\"\u0026gt;\u0026lt;/span\u0026gt;\u0026lt;/div\u0026gt;').find('span').dataContext()); // =\u0026gt; {a: '1', b: '2'}\n   \u003c/pre\u003e\n\n### delegateEvent\nSimple jQuery plugin to forward events from one element to a new\ntarget. Optionally provide a new event name.\n\n **Usage:**\n\u003cpre\u003e\n$('#id').bindAndDelegate('click',$('#other'));\n$('#id').bindAndDelegate('click',$('#other'),'id-clicked'); // new event\n\u003c/pre\u003e\n\n### columnize\n\nColumn level event triggering on a table. Handlers receive jQuery\nobjects with all the cells of a single table row, so that hover and click behavior\ncan be implemented on tables.\n **Usage:**\n\u003cpre\u003e\n $('table').columnize().bind('columnmouseenter',function(e, $cells) {\n     $cells.addClass('hover');\n }).bind('columnmouseleave',function(e, $cells) {\n     $cells.removeClass('hover');\n });\n\u003c/pre\u003e\nThis is a primitive version of various other plugins,\nbut generally all that is needed for most jobs.\n\n### .fixie\n\nMoved into its own repo, github.com/ndp/fixie\n\n## Jasmine Helpers\n\n### Simple Fixture\nThis is a lighter-weight alternative to jQuery-jasmine's fixture scheme. Provides a jQuery object\n`$fixture` that is in the DOM and cleaned out before each test.\n\nThis tool does **not** facilitate\nloading of file-based fixtures. I advise against this, but if you must, use jQuery-jasmine.\n\n **Usage:**\nInclude `simple_fixture.js`. Usually placing this in a spec_helper folder and restarting jasmine will do the trick.\n\n### Color Matchers\n`toBeDistinguishable` and `toBeVisuallyClose`\n\n\n## color_helpers.js\n\nUtilities to perform color math and manipulation (extracted from Csster).\n\n*  \u003ccode\u003e\"#ab342c\".darken(%)\u003c/code\u003e -- make color darker by given percent\n*  \u003ccode\u003e\"#ab342c\".lighten(%)\u003c/code\u003e -- make color lighter by given percent\n*  \u003ccode\u003e\"#ab342c\".saturate(%)\u003c/code\u003e  -- make color more saturated by given percent. To *desaturate*, use negative values for the percent. Note that \u003ccode\u003e\"#ab342c\".saturate(-100)\u003c/code\u003e renders in grayscale.\n\nThere are also color conversion routines if you want to build your own manipulation.\n\n*  \u003ccode\u003e\"blue\".toHexColor()\u003c/code\u003e\n*  \u003ccode\u003e\"#9cf\".toHexColor()\u003c/code\u003e\n*  \u003ccode\u003e\"#ab342c\".toHexColor()\u003c/code\u003e (no-op)\n*  \u003ccode\u003e\"#ab342c\".toRGB()\u003c/code\u003e  converts to array of three values, 0 - 255\n*  \u003ccode\u003e\"#ab342c\".toHSL()\u003c/code\u003e returns an array of hue, saturation and lightness. Hue is a range from 0-360, while the others are from 0 to 100.\n*  \u003ccode\u003eCsster.hslToHexColor(h,s,l)\u003c/code\u003e converts a triplet to a hex color\n\nOpacity is currently not supported by the color model.\n\n\n## color_factory.js\n\nGenerate color schemes appropriate to prototypes, visualizations and maps.\n\n### Standard colors\n\n* \u003ccode\u003eColorFactory.primaryColors()\u003c/code\u003e is yellow, red and blue.\n* \u003ccode\u003eColorFactory.primaryAndSecondaryColors()\u003c/code\u003e yellow, orange, red, violet, blue and green.\n\n### Random colors\n\n* \u003ccode\u003eColorFactory.random()\u003c/code\u003e a random color, somewhat evenly distributed.\n* \u003ccode\u003eColorFactory.randomGray()\u003c/code\u003e a random gray scale value.\n* \u003ccode\u003eColorFactory.randomHue()\u003c/code\u003e given a saturation and lightness returns a random color.\n\n\n### Related colors\n\n*  \u003ccode\u003eColorFactory.complementary(src)\u003c/code\u003e\n*  \u003ccode\u003eColorFactory.interpolate(color1, colorN, steps)\u003c/code\u003e fills in any number of colors \"between\" the two colors.\n*  \u003ccode\u003eColorFactory.analogous(src)\u003c/code\u003e returns colors near the given color on the color wheel, at an angle of 30°\n*  \u003ccode\u003eColorFactory.analogous(src, angle)\u003c/code\u003e returns colors near the given color on the color wheel, at the specified angle\n\n\n### Color Schemes\n\nColor scheme generation inspired by http://www.personal.psu.edu/cab38/ColorSch/Schemes.html\n\n* \u003ccode\u003eColorFactory.qualitative([refColor], count)\u003c/code\u003e returns a qualitative scheme. This scheme does not imply magnitude differences between colors, and hues are used to create the primary visual differences between classes. Qualitative schemes are best suited to representing nominal or categorical data.\n* \u003ccode\u003eColorFactory.sequential(startColor, [endColor], count)\u003c/code\u003e returns a sequential scheme. This is suited to ordered data that progress from low to high. Lightness steps dominate the look of these schemes, with light colors for low data values to dark colors for high data values.\n* \u003ccode\u003eColorFactory.binary(trueColor)\u003c/code\u003e returns an array or two colors. Element 0 is the true (darker) color, and element 1 is the false (lighter) color.\n\n\n## funks.js\n\n\"Functional\" helpers that contemplate different programming paradigms.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndp%2Fjsutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fndp%2Fjsutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndp%2Fjsutils/lists"}