Permalink
Browse files

Running example JS file through JSHint and fixed a few minor things.

  • Loading branch information...
1 parent eb03f8a commit ed5e133d12d6567824fc3fdddb45c2465839008b @walling committed Aug 27, 2012
Showing with 7 additions and 7 deletions.
  1. +7 −7 example.js
View
@@ -1,4 +1,4 @@
-unorm = require('unorm');
+var unorm = require('unorm');
// Function to display Unicode codepoints of a string.
function codepoints(string) {
@@ -11,29 +11,29 @@ function codepoints(string) {
}
// Scientific Ångström symbol is converted to Scandinavian letter Å.
-angstrom = '\u212B';
+var angstrom = '\u212B';
console.log('- Example 1 -');
console.log(codepoints(angstrom));
console.log(codepoints(unorm.nfc(angstrom)));
// German ä and ü decomposed into a and u with Combining Diaeresis character.
-letters = '\u00E4\u00FC'
+var letters = '\u00E4\u00FC';
console.log('- Example 2 -');
console.log(codepoints(letters));
console.log(codepoints(unorm.nfd(letters)));
// String optimized for compatibility, ie. CO₂ becomes CO2.
-scientific = 'CO\u2082 and E=mc\u00B2'
+var scientific = 'CO\u2082 and E=mc\u00B2';
console.log('- Example 3 -');
-console.log(scientific)
+console.log(scientific);
console.log(unorm.nfkc(scientific));
// NOTE: Rest of the example requires XRegExp: npm install xregexp
// Remove combining characters / marks from Swedish name, ie. ö becomes o.
// This is useful for indexing and searching internationalized text.
-XRegExp = require('xregexp').XRegExp;
-name = '\u00C5ngstr\u00F6m';
+var XRegExp = require('xregexp').XRegExp;
+var name = '\u00C5ngstr\u00F6m';
console.log('- Example 4 -');
console.log(unorm.nfkd(name));
console.log(unorm.nfkd(name).replace(XRegExp('\\p{M}', 'g'), ''));

0 comments on commit ed5e133

Please sign in to comment.