Skip to content

Commit

Permalink
Clean up some files
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiasbynens committed Jul 15, 2016
1 parent d8cffa4 commit 42a382d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 46 deletions.
8 changes: 0 additions & 8 deletions Gruntfile.js
Expand Up @@ -7,9 +7,6 @@ module.exports = function(grunt) {
'stderr': true,
'failOnError': true
},
'fetch': {
'command': 'curl https://encoding.spec.whatwg.org/index-windows-1258.txt > data/index.txt'
},
'transform-data': {
'command': 'npm run build'
},
Expand Down Expand Up @@ -83,11 +80,6 @@ module.exports = function(grunt) {
'shell:test-browser'
]);

grunt.registerTask('fetch', [
'shell:fetch',
'build'
]);

grunt.registerTask('build', [
'shell:transform-data',
'default'
Expand Down
28 changes: 4 additions & 24 deletions README.md
Expand Up @@ -12,18 +12,6 @@ Via [npm](https://www.npmjs.com/):
npm install windows-1258
```

Via [Bower](http://bower.io/):

```bash
bower install windows-1258
```

Via [Component](https://github.com/component/component):

```bash
component install mathiasbynens/windows-1258
```

In a browser:

```html
Expand Down Expand Up @@ -73,13 +61,13 @@ An array of strings, each representing a [label](https://encoding.spec.whatwg.or
This function takes a plain text string (the `input` parameter) and encodes it according to windows-1258. The return value is a ‘byte string’, i.e. a string of which each item represents an octet as per windows-1258.

```js
var encodedData = windows1258.encode(text);
const encodedData = windows1258.encode(text);
```

The optional `options` object and its `mode` property can be used to set the [error mode](https://encoding.spec.whatwg.org/#error-mode). For encoding, the error mode can be `'fatal'` (the default) or `'html'`.

```js
var encodedData = windows1258.encode(text, {
const encodedData = windows1258.encode(text, {
'mode': 'html'
});
// If `text` contains a symbol that cannot be represented in windows-1258,
Expand All @@ -91,13 +79,13 @@ var encodedData = windows1258.encode(text, {
This function takes a byte string (the `input` parameter) and decodes it according to windows-1258.

```js
var text = windows1258.decode(encodedData);
const text = windows1258.decode(encodedData);
```

The optional `options` object and its `mode` property can be used to set the [error mode](https://encoding.spec.whatwg.org/#error-mode). For decoding, the error mode can be `'replacement'` (the default) or `'fatal'`.

```js
var text = windows1258.decode(encodedData, {
const text = windows1258.decode(encodedData, {
'mode': 'fatal'
});
// If `encodedData` contains an invalid byte for the windows-1258 encoding,
Expand All @@ -110,14 +98,6 @@ For decoding a buffer (e.g. from `fs.readFile`) use `buffer.toString('binary')`

_windows-1258_ is designed to work in at least Node.js v0.10.0, io.js v1.0.0, Narwhal 0.3.2, RingoJS 0.8-0.11, PhantomJS 1.9.0, Rhino 1.7RC4, as well as old and modern versions of Chrome, Firefox, Safari, Opera, Edge, and Internet Explorer.

## Unit tests & code coverage

After cloning this repository, run `npm install` to install the dependencies needed for development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.

Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, and web browsers as well, use `grunt test`.

To generate the code coverage report, use `grunt cover`.

## Notes

[Similar modules for other single-byte legacy encodings are available.](https://www.npmjs.com/browse/keyword/legacy-encoding)
Expand Down
27 changes: 15 additions & 12 deletions data/index.txt
@@ -1,19 +1,22 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
# https://creativecommons.org/publicdomain/zero/1.0/
#
# For details on index-windows-1258.txt see the Encoding Standard
# For details on index index-windows-1258.txt see the Encoding Standard
# https://encoding.spec.whatwg.org/
#
# Identifier: 198bacedfcf24390e219240a7b776b6cec34cff070330b08a601a69c67f7eb24
# Date: 2016-01-20

0 0x20AC € (EURO SIGN)
1 0x0081  (<control>)
2 0x201A ‚ (SINGLE LOW-9 QUOTATION MARK)
3 0x0192 ƒ (LATIN SMALL LETTER F WITH HOOK)
4 0x201E „ (DOUBLE LOW-9 QUOTATION MARK)
5 0x2026 … (HORIZONTAL ELLIPSIS)
6 0x2020 † (DAGGER)
7 0x2021 ‡ (DOUBLE DAGGER)
8 0x02C6 ˆ (MODIFIER LETTER CIRCUMFLEX ACCENT)
9 0x2030 ‰ (PER MILLE SIGN)
0 0x20AC € (EURO SIGN)
1 0x0081  (<control>)
2 0x201A ‚ (SINGLE LOW-9 QUOTATION MARK)
3 0x0192 ƒ (LATIN SMALL LETTER F WITH HOOK)
4 0x201E „ (DOUBLE LOW-9 QUOTATION MARK)
5 0x2026 … (HORIZONTAL ELLIPSIS)
6 0x2020 † (DAGGER)
7 0x2021 ‡ (DOUBLE DAGGER)
8 0x02C6 ˆ (MODIFIER LETTER CIRCUMFLEX ACCENT)
9 0x2030 ‰ (PER MILLE SIGN)
10 0x008A Š (<control>)
11 0x2039 ‹ (SINGLE LEFT-POINTING ANGLE QUOTATION MARK)
12 0x0152 Π(LATIN CAPITAL LIGATURE OE)
Expand Down
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -31,8 +31,9 @@
"windows-1258.js"
],
"scripts": {
"test": "node tests/tests.js",
"build": "node scripts/transform-data.js"
"download": "curl https://encoding.spec.whatwg.org/index-windows-1258.txt > data/index.txt",
"build": "node scripts/transform-data.js",
"test": "node tests/tests.js"
},
"devDependencies": {
"coveralls": "^2.11.6",
Expand Down

0 comments on commit 42a382d

Please sign in to comment.