Socket
Socket
Sign inDemoInstall

obtain-unicode

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

obtain-unicode - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

2

obtain-unicode.d.ts
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);
});
})();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc