Skip to content

Commit

Permalink
Update example usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
lapo-luchini committed Mar 26, 2024
1 parent 1b3078e commit ae4458e
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,40 +12,34 @@ This package can be installed with either npm or yarn via the following commands

```sh
npm install @lapo/asn1js
# or with yarn
# or other tools
npm install @lapo/asn1js
yarn add @lapo/asn1js
```

Assuming a standard javascript bundler is setup you can import it like so:

```js
const ASN1 = require('@lapo/asn1js');
// or with ES modules
import ASN1 from '@lapo/asn1js';
```

A submodule of this package can also be imported:

```js
const Hex = require('@lapo/asn1js/hex');
// or with ES modules
import Hex from '@lapo/asn1js/hex';
```

Usage with RequireJS
Usage on the web
--------------------

Can be [tested on JSFiddle](https://jsfiddle.net/lapo/tmdq35ug/).
Can be [tested on JSFiddle](https://jsfiddle.net/lapo/y6t2wo7q/).

```html
<script type="text/javascript" src="https://unpkg.com/requirejs/require.js"></script>
<script>
require([
'https://unpkg.com/@lapo/asn1js/asn1.js',
'https://unpkg.com/@lapo/asn1js/hex.js'
], function(ASN1, Hex) {
document.body.innerText = ASN1.decode(Hex.decode('06032B6570')).content();
});
import { ASN1} from 'https://unpkg.com/@lapo/[email protected]/asn1.js';
import { Hex } from 'https://unpkg.com/@lapo/[email protected]/hex.js';
document.body.innerText = ASN1.decode(Hex.decode('06032B6570')).content();
</script>
```

Expand Down

0 comments on commit ae4458e

Please sign in to comment.