mathiasbynens / mathiasbynens/punycode.js

Add UMD definitions

Open
#89 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.7k
Forks
170
PR merge metrics
No merged PRs in 30d

Description

The code assumes that `module` is always available, which is not true (e.g. browser with requireJS). With the following UMD boilerplate it can be much friendlier to use in different environments.

The changes would be straightforward:

1. Remove the `module.exports = punycode;` line at the very end

2. Wrap remaining code like this:
```
;(function (root, factory) {

if (typeof define === 'function' && define.amd) {
define(factory);
} else if (typeof exports === 'object') {
module.exports = factory();
} else {
root.punycode = factory();
}

}(this, function () {

return punycode;
}));
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the source file containing the final module.exports = punycode line and the library code. Apply the requested UMD wrapper, preserving AMD, CommonJS, and browser-global paths, then verify that the library remains usable across those environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.