intl-segmenter-polyfill
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -57,3 +57,3 @@ "use strict"; | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, WebAssembly.instantiateStreaming(wasm, { | ||
case 0: return [4 /*yield*/, WebAssembly.instantiate(wasm, { | ||
env: { | ||
@@ -97,2 +97,3 @@ push: function (start, end, segmentType) { | ||
var localePtr = allocStr(locale)[0]; | ||
console.log(this.options); | ||
exports.break_iterator(BREAK_TYPES[granularity], localePtr, inputPtr); | ||
@@ -99,0 +100,0 @@ exports.free(localePtr); |
{ | ||
"name": "intl-segmenter-polyfill", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "This repo builds .wasm module using icu4c for breaking text into words, so that we can polyfill [Intl Segmenter Proposal](https://github.com/tc39/proposal-intl-segmenter) with full compatibility, even on browsers that do not expose v8BreakIterator api.", | ||
@@ -8,3 +8,2 @@ "main": "dist/index.js", | ||
"dist/", | ||
"examples/", | ||
"src/" | ||
@@ -11,0 +10,0 @@ ], |
@@ -5,2 +5,3 @@ const BREAK_TYPES = { | ||
} | ||
const getSegmentType = (type: number) => { | ||
@@ -22,3 +23,6 @@ switch (type) { | ||
const response = await WebAssembly.instantiateStreaming(wasm, { | ||
// node env does not support instantiateStreaming | ||
// const instantiate = | ||
// WebAssembly.instantiateStreaming || WebAssembly.instantiate | ||
const response = await WebAssembly.instantiate(wasm, { | ||
env: { | ||
@@ -43,3 +47,3 @@ push: (start: number, end: number, segmentType: number) => { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const exports = (response.instance.exports as unknown) as any | ||
const exports = ((response as any).instance.exports as unknown) as any | ||
@@ -64,3 +68,3 @@ const ptr = exports.malloc(view.length) | ||
const granularity = this.options.granularity | ||
const exports = (response.instance.exports as unknown) as any | ||
const exports = ((response as any).instance.exports as unknown) as any | ||
@@ -70,3 +74,3 @@ breaks = [] | ||
const [localePtr] = allocStr(locale) | ||
console.log(this.options) | ||
exports.break_iterator(BREAK_TYPES[granularity], localePtr, inputPtr) | ||
@@ -73,0 +77,0 @@ |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
1150375
7
309