npm

npm modules

npm package description
accounting accounting
async sema rate limiting
babel-plugin-module-resolver resolves imports
common-tags string templates tags
dataloader caching for HTTP requests
date-fns like momentJS but modern
dinero currency library
faker generates mock data
fast-cli Netflix speedtest
fast-csv parse CVS
feather-icons svg icons
flatorize Linear algebra library that supports intensive computations in JS
frappe-charts charts
google-libphonenumber phoneNumber library
html-pdf convert html to pdf
inquirer CLI GUI tools
jimp image processor for nodejs
mathJS evaluate mathematical expressions
node-uuid generate UUID
npm-license generates a flat list of npm modules and their licenses
oy E-mail templates with React
progress Progress bar for CLI
nps scripts for package json
react-vis charts from Uber. In react
rough Build handdrawn-like shapes
serve-favicon to serve dynamic favicons
strapdown markdown renderer
tesseract OCR in 62 languages
ua-parser to parse UA Clients
webtorrent torrents on the browser

How to write a UMD module

UMD (Universal Module Definition) patterns for JavaScript modules that work everywhere.

  1. // Uses Node, AMD or browser globals to create a module.
  2. // If you want something that will work in other stricter CommonJS environments,
  3. // or if you need to create a circular dependency, see commonJsStrict.js
  4. // Defines a module "returnExports" that depends another module called "b".
  5. // Note that the name of the module is implied by the file name. It is best
  6. // if the file name and the exported global have matching names.
  7. // If the 'b' module also uses this type of boilerplate, then
  8. // in the browser, it will create a global .b that is used below.
  9. // If you do not want to support the browser global path, then you
  10. // can remove the `root` use and the passing `this` as the first arg to
  11. // the top function.
  12. (function (root, factory) {
  13. if (typeof define === 'function' && define.amd) {
  14. // AMD. Register as an anonymous module.
  15. define(['b'], factory);
  16. } else if (typeof module === 'object' && module.exports) {
  17. // Node. Does not work with strict CommonJS, but
  18. // only CommonJS-like environments that support module.exports,
  19. // like Node.
  20. module.exports = factory(require('b'));
  21. } else {
  22. // Browser globals (root is window)
  23. root.returnExports = factory(root.b);
  24. }
  25. }(this, function (b) {
  26. //use b in some fashion.
  27. // Just return a value to define the module export.
  28. // This example returns an object, but the module
  29. // can return a function as the exported value.
  30. return {};
  31. }));
  32. // if the module has no dependencies, the above pattern can be simplified to
  33. (function (root, factory) {
  34. if (typeof define === 'function' && define.amd) {
  35. // AMD. Register as an anonymous module.
  36. define([], factory);
  37. } else if (typeof module === 'object' && module.exports) {
  38. // Node. Does not work with strict CommonJS, but
  39. // only CommonJS-like environments that support module.exports,
  40. // like Node.
  41. module.exports = factory();
  42. } else {
  43. // Browser globals (root is window)
  44. root.returnExports = factory();
  45. }
  46. }(this, function () {
  47. // Just return a value to define the module export.
  48. // This example returns an object, but the module
  49. // can return a function as the exported value.
  50. return {};
  51. }));

Easter Eggs

  • npm xmas
  • npm visnup
  • npm substack