obtain-unicode
Advanced tools
Comparing version 0.0.4 to 0.0.5
declare module ObtainUnicode { | ||
function ObtainUnicode(domstring: string): number[]; | ||
function obtainUnicode(domstring: string): number[]; | ||
} | ||
@@ -4,0 +4,0 @@ |
// http://www.w3.org/TR/WebIDL/#dfn-obtain-unicode | ||
function ObtainUnicode(domstring) { | ||
function obtainUnicode(domstring) { | ||
@@ -141,2 +141,5 @@ // following algorithm defines a way to convert a DOMString to a sequence of Unicode characters: | ||
this.ObtainUnicode = ObtainUnicode; | ||
// export to | ||
// - window in browser | ||
// - module.exports in node.js | ||
this.obtainUnicode = obtainUnicode; |
{ | ||
"name": "obtain-unicode", | ||
"description": "implementation of convert a DOMString to a sequence of Unicode characters at http://www.w3.org/TR/WebIDL/#dfn-obtain-unicode and shim for String.fromCodePoint()", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"author": "Jxck", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -24,5 +24,5 @@ # Isomorphic Unicode Codepoint to/from String converter | ||
```typescript | ||
var ObtainUnicode = ObtainUnicode || require('../obtain-unicode').ObtainUnicode; | ||
var obtainUnicode = obtainUnicode || require('../obtain-unicode').obtainUnicode; | ||
console.log(ObtainUnicode("beer!đť")); | ||
console.log(obtainUnicode('beer!đť')); | ||
// [98, 101, 101, 114, 33, 127867] | ||
@@ -29,0 +29,0 @@ console.log(String.fromCodePoint(98, 101, 101, 114, 33, 127867)); |
@@ -1,2 +0,2 @@ | ||
var ObtainUnicode = ObtainUnicode || require('../obtain-unicode').ObtainUnicode; | ||
var obtainUnicode = obtainUnicode || require('../obtain-unicode').obtainUnicode; | ||
@@ -10,3 +10,3 @@ // tests | ||
(function example() { | ||
console.log(ObtainUnicode("beer!đť")); | ||
console.log(obtainUnicode('beer!đť')); | ||
// [98, 101, 101, 114, 33, 127867] | ||
@@ -18,17 +18,19 @@ console.log(String.fromCodePoint(98, 101, 101, 114, 33, 127867)); | ||
(function test() { | ||
[ 'aAzZ09', | ||
'~`!@', | ||
'#$%^&', | ||
'*()_+-=', | ||
'{}|[]\:', | ||
';"<>?,./', | ||
"'", | ||
'ăäş', | ||
'ĺąđ Ž', | ||
'đť', | ||
'' | ||
[ | ||
'aAzZ09', | ||
'~`!@', | ||
'#$%^&', | ||
'*()_+-=', | ||
'{}|[]:', | ||
';"<>?,./', | ||
"'", | ||
'\\', | ||
'ăäş', | ||
'ĺąđ Ž', | ||
'đť', | ||
'' | ||
].forEach(function(expected) { | ||
var actual = String.fromCodePoint.apply(null, ObtainUnicode(expected)); | ||
var actual = String.fromCodePoint.apply(null, obtainUnicode(expected)); | ||
assert(actual, expected); | ||
}); | ||
})(); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8127
193