@asphalt-react/helper
Advanced tools
Comparing version 1.13.0 to 1.14.1
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.14.1](https://source.golabs.io/asphalt/asphalt-react/compare/v1.14.0...v1.14.1) (2022-05-12) | ||
**Note:** Version bump only for package @asphalt-react/helper | ||
# [1.13.0](https://source.golabs.io/asphalt/asphalt-react/compare/v1.12.2...v1.13.0) (2022-03-30) | ||
@@ -8,0 +16,0 @@ |
@@ -1,24 +0,2 @@ | ||
import { TextEncoderLite } from 'text-encoder-lite'; | ||
/** | ||
* checks if environment is node or not | ||
* | ||
* @returns boolean | ||
*/ | ||
const isNode = () => typeof process !== "undefined"; | ||
/** | ||
* check if environment has native TextEncoder | ||
* | ||
* @returns boolean | ||
*/ | ||
const supportsTextEncoder = () => typeof TextEncoder !== "undefined"; | ||
var env = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
isNode: isNode, | ||
supportsTextEncoder: supportsTextEncoder | ||
}); | ||
/** | ||
* generates a random hash using Math.random() | ||
@@ -28,3 +6,2 @@ * | ||
*/ | ||
const randomHash = () => `${Math.random().toString(36).substring(2, 15)}`; | ||
@@ -62,2 +39,3 @@ /** | ||
return paddedHexString(buffer); | ||
/* eslint-disable-next-line no-else-return */ | ||
} | ||
@@ -74,6 +52,5 @@ }; | ||
const hash = async data => { | ||
const Encoder = supportsTextEncoder() ? TextEncoder : TextEncoderLite; | ||
const encoder = new Encoder("utf-8"); | ||
return await sha256(encoder.encode(data)); | ||
const hash = data => { | ||
const encoder = new TextEncoder("utf-8"); | ||
return sha256(encoder.encode(data)); | ||
}; | ||
@@ -90,2 +67,14 @@ | ||
/** | ||
* checks if environment is node or not | ||
* | ||
* @returns boolean | ||
*/ | ||
const isNode = () => typeof process !== "undefined"; | ||
var env = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
isNode: isNode | ||
}); | ||
/** | ||
* validate custom size prop | ||
@@ -92,0 +81,0 @@ * |
@@ -5,25 +5,3 @@ 'use strict'; | ||
var textEncoderLite = require('text-encoder-lite'); | ||
/** | ||
* checks if environment is node or not | ||
* | ||
* @returns boolean | ||
*/ | ||
const isNode = () => typeof process !== "undefined"; | ||
/** | ||
* check if environment has native TextEncoder | ||
* | ||
* @returns boolean | ||
*/ | ||
const supportsTextEncoder = () => typeof TextEncoder !== "undefined"; | ||
var env = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
isNode: isNode, | ||
supportsTextEncoder: supportsTextEncoder | ||
}); | ||
/** | ||
* generates a random hash using Math.random() | ||
@@ -33,3 +11,2 @@ * | ||
*/ | ||
const randomHash = () => `${Math.random().toString(36).substring(2, 15)}`; | ||
@@ -65,2 +42,11 @@ /** | ||
{ | ||
// this kind of `false` diversification is added because | ||
// node doesn't support the WebCrypto API yet. node 16 has experimental | ||
// support for the WebCrypto API. | ||
// once support is mature, it would be wise & safe to remove `false` | ||
// also would need to update the rollup config & package metadata accordingly | ||
/** | ||
* @see https://nodejs.org/dist/latest-v16.x/docs/api/webcrypto.html | ||
*/ | ||
const { | ||
@@ -84,6 +70,5 @@ createHash | ||
const hash = async data => { | ||
const Encoder = supportsTextEncoder() ? TextEncoder : textEncoderLite.TextEncoderLite; | ||
const encoder = new Encoder("utf-8"); | ||
return await sha256(encoder.encode(data)); | ||
const hash = data => { | ||
const encoder = new TextEncoder("utf-8"); | ||
return sha256(encoder.encode(data)); | ||
}; | ||
@@ -100,2 +85,14 @@ | ||
/** | ||
* checks if environment is node or not | ||
* | ||
* @returns boolean | ||
*/ | ||
const isNode = () => typeof process !== "undefined"; | ||
var env = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
isNode: isNode | ||
}); | ||
/** | ||
* validate custom size prop | ||
@@ -102,0 +99,0 @@ * |
@@ -1,24 +0,2 @@ | ||
import { TextEncoderLite } from 'text-encoder-lite'; | ||
/** | ||
* checks if environment is node or not | ||
* | ||
* @returns boolean | ||
*/ | ||
const isNode = () => typeof process !== "undefined"; | ||
/** | ||
* check if environment has native TextEncoder | ||
* | ||
* @returns boolean | ||
*/ | ||
const supportsTextEncoder = () => typeof TextEncoder !== "undefined"; | ||
var env = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
isNode: isNode, | ||
supportsTextEncoder: supportsTextEncoder | ||
}); | ||
/** | ||
* generates a random hash using Math.random() | ||
@@ -28,3 +6,2 @@ * | ||
*/ | ||
const randomHash = () => `${Math.random().toString(36).substring(2, 15)}`; | ||
@@ -60,2 +37,11 @@ /** | ||
{ | ||
// this kind of `false` diversification is added because | ||
// node doesn't support the WebCrypto API yet. node 16 has experimental | ||
// support for the WebCrypto API. | ||
// once support is mature, it would be wise & safe to remove `false` | ||
// also would need to update the rollup config & package metadata accordingly | ||
/** | ||
* @see https://nodejs.org/dist/latest-v16.x/docs/api/webcrypto.html | ||
*/ | ||
const { | ||
@@ -79,6 +65,5 @@ createHash | ||
const hash = async data => { | ||
const Encoder = supportsTextEncoder() ? TextEncoder : TextEncoderLite; | ||
const encoder = new Encoder("utf-8"); | ||
return await sha256(encoder.encode(data)); | ||
const hash = data => { | ||
const encoder = new TextEncoder("utf-8"); | ||
return sha256(encoder.encode(data)); | ||
}; | ||
@@ -95,2 +80,14 @@ | ||
/** | ||
* checks if environment is node or not | ||
* | ||
* @returns boolean | ||
*/ | ||
const isNode = () => typeof process !== "undefined"; | ||
var env = /*#__PURE__*/Object.freeze({ | ||
__proto__: null, | ||
isNode: isNode | ||
}); | ||
/** | ||
* validate custom size prop | ||
@@ -97,0 +94,0 @@ * |
{ | ||
"name": "@asphalt-react/helper", | ||
"version": "1.13.0", | ||
"version": "1.14.1", | ||
"description": "Common helper utilities for components", | ||
@@ -29,5 +29,2 @@ "keywords": [ | ||
"license": "UNLICENSED", | ||
"dependencies": { | ||
"text-encoder-lite": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
@@ -37,3 +34,3 @@ "@rollup/plugin-replace": "^3.0.1", | ||
}, | ||
"gitHead": "3f9cebe04eb753dc04819dd384e7b2c0bd6a74a9" | ||
"gitHead": "eed9dc0befa8f1f3d2d85683efccfa3fbc33247b" | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
28928
831
1
- Removedtext-encoder-lite@^2.0.0
- Removedtext-encoder-lite@2.0.0(transitive)