@meteor-it/utils
Advanced tools
Comparing version 1.3.22 to 1.3.24
@@ -16,3 +16,2 @@ /// <reference types="node" /> | ||
/** | ||
* | ||
* @deprecated Extremally slow on Proxy/getters | ||
@@ -90,3 +89,11 @@ * @param x | ||
export declare function loseCode(str: string): number; | ||
/** | ||
* Encodes bad html characters in string to codepoint format | ||
* @param str string to encode | ||
* @returns encoded string | ||
*/ | ||
export declare function encodeHtmlSpecials(str: string): string; | ||
/** | ||
* Returns global, for node it is just global, for browser it is window | ||
*/ | ||
export declare function getGlobal(): any; | ||
@@ -99,3 +106,9 @@ /** | ||
export declare function externalRequire(module: string): any; | ||
/** | ||
* Check if running in node | ||
*/ | ||
export declare function isNodeEnvironment(): any; | ||
/** | ||
* Check if running in browser | ||
*/ | ||
export declare function isBrowserEnvironment(): any; |
17
index.js
@@ -50,3 +50,2 @@ "use strict"; | ||
/** | ||
* | ||
* @deprecated Extremally slow on Proxy/getters | ||
@@ -268,2 +267,7 @@ * @param x | ||
exports.loseCode = loseCode; | ||
/** | ||
* Encodes bad html characters in string to codepoint format | ||
* @param str string to encode | ||
* @returns encoded string | ||
*/ | ||
// noinspection JSUnusedGlobalSymbols | ||
@@ -294,2 +298,5 @@ function encodeHtmlSpecials(str) { | ||
let cachedGlobal = null; | ||
/** | ||
* Returns global, for node it is just global, for browser it is window | ||
*/ | ||
function getGlobal() { | ||
@@ -332,2 +339,5 @@ if (cachedGlobal !== null) | ||
let isNodeEnvironmentCache = null; | ||
/** | ||
* Check if running in node | ||
*/ | ||
function isNodeEnvironment() { | ||
@@ -353,2 +363,5 @@ if (isNodeEnvironmentCache !== null) | ||
let isBrowserEnvironmentCache = null; | ||
/** | ||
* Check if running in browser | ||
*/ | ||
function isBrowserEnvironment() { | ||
@@ -361,2 +374,2 @@ if (isBrowserEnvironmentCache !== null) | ||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInhwcmVzcy9ub2RlX21vZHVsZXMv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cmVhZFN0cmVhbVRvQnVmZmVyKHN0cmVhbTogUmVhZGFibGUsIG1heFNpemU6IG51bWJlciA9IDApOiBQcm9taXNlPEJ1ZmZlcj4ge1xuICAgIHJldHVybiBuZXcgUHJvbWlzZSgocmVzLCByZWopID0+IHtcbiAgICAgICAgY29uc3QgYnVmczogYW55ID0gW107XG4gICAgICAgIGxldCBzaXplID0gMDtcbiAgICAgICAgc3RyZWFtLm9uKCdkYXRhJywgZCA9PiB7XG4gICAgICAgICAgICBpZiAoc2l6ZSArIGQubGVuZ3RoID4gbWF4U2l6ZSkge1xuICAgICAgICAgICAgICAgIHJlaihuZXcgRXJyb3IoJ01heCBidWZmZXIgc2l6ZSBleGNlZWRlZCcpKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBidWZzLnB1c2goZCk7XG4gICAgICAgICAgICBzaXplICs9IGQubGVuZ3RoO1xuICAgICAgICB9KTtcbiAgICAgICAgc3RyZWFtLm9uKCdlbmQnLCAoKSA9PiB7XG4gICAgICAgICAgICByZXMoQnVmZmVyLmNvbmNhdChidWZzKSk7XG4gICAgICAgIH0pO1xuICAgICAgICBzdHJlYW0ub24oJ2Vycm9yJywgcmVqKTtcbiAgICB9KTtcbn1cblxuZXhwb3J0IGludGVyZmFjZSBJTXVsdGlTdHJlYW1PcHRpb25zIHtcbiAgICBoaWdoV2F0ZXJNYXJrPzogbnVtYmVyO1xuICAgIGVuY29kaW5nPzogc3RyaW5nO1xufVxuXG5leHBvcnQgY2xhc3MgTXVsdGlTdHJlYW0gZXh0ZW5kcyBSZWFkYWJsZSB7XG4gICAgcHJpdmF0ZSBvYmplY3Q6IEJ1ZmZlciB8IG51bGw7XG4gICAgY29uc3RydWN0b3Iob2JqZWN0OiBCdWZmZXIsIG9wdGlvbnM6IElNdWx0aVN0cmVhbU9wdGlvbnMgPSB7fSkge1xuICAgICAgICBzdXBlcih7XG4gICAgICAgICAgICBoaWdoV2F0ZXJNY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RW52aXJvbm1lbnRDYWNoZSA9IF9pc05vZGVFbnZpcm9ubWVudCgpO1xufVxuZnVuY3Rpb24gX2lzQnJvd3NlckVudmlyb25tZW50KCk6IGJvb2xlYW4ge1xuICAgIGlmICh0eXBlb2YgX193ZWJwYWNrX3JlcXVpcmVfXyA9PT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICB0cnkge1xuICAgICAgICAgICAgLy8gRGlyZWN0IGJ5cGFzcyBmb3Igd2VicGFjayt0ZXJzZXJcbiAgICAgICAgICAgIGlmIChwcm9jZXNzLmVudi5CUk9XU0VSKVxuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICB9IGNhdGNoIChlKSB7IH1cbiAgICB9XG4gICAgaWYgKHR5cGVvZiB3aW5kb3cgIT09ICd1bmRlZmluZWQnICYmIHdpbmRvdy5kb2N1bWVudClcbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgcmV0dXJuICFpc05vZGVFbnZpcm9ubWVudCgpO1xufVxubGV0IGlzQnJvd3NlckVudmlyb25tZW50Q2FjaGUgPSBudWxsO1xuLyoqXG4gKiBDaGVjayBpZiBydW5uaW5nIGluIGJyb3dzZXJcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGlzQnJvd3NlckVudmlyb25tZW50KCkge1xuICAgIGlmIChpc0Jyb3dzZXJFbnZpcm9ubWVudENhY2hlICE9PSBudWxsKVxuICAgICAgICByZXR1cm4gaXNCcm93c2VyRW52aXJvbm1lbnRDYWNoZTtcbiAgICByZXR1cm4gaXNCcm93c2VyRW52aXJvbm1lbnRDYWNoZSA9IF9pc0Jyb3dzZXJFbnZpcm9ubWVudCgpO1xufVxuIl19 |
19
index.ts
@@ -57,3 +57,2 @@ import { Readable } from 'stream'; | ||
/** | ||
* | ||
* @deprecated Extremally slow on Proxy/getters | ||
@@ -278,2 +277,7 @@ * @param x | ||
/** | ||
* Encodes bad html characters in string to codepoint format | ||
* @param str string to encode | ||
* @returns encoded string | ||
*/ | ||
// noinspection JSUnusedGlobalSymbols | ||
@@ -302,2 +306,5 @@ export function encodeHtmlSpecials(str: string) { | ||
let cachedGlobal = null; | ||
/** | ||
* Returns global, for node it is just global, for browser it is window | ||
*/ | ||
export function getGlobal(): any { | ||
@@ -309,2 +316,3 @@ if (cachedGlobal !== null) | ||
declare var __non_webpack_require__: any; | ||
/** | ||
@@ -327,2 +335,3 @@ * Calls __non_webpack_require__ or plain require to work around webpack, | ||
declare var __webpack_require__: any; | ||
function _isNodeEnvironment(): boolean { | ||
@@ -336,5 +345,8 @@ if (typeof __webpack_require__ === 'function') { | ||
} | ||
return !!((typeof process !== 'undefined') && process.env && (process.env.NODE || ((typeof global !== 'undefined' && typeof global.require !== 'undefined')))); | ||
return !!((typeof process !== 'undefined') && process.env && (process.env.NODE || ((typeof global !== 'undefined' && typeof (global as any).require !== 'undefined')))); | ||
} | ||
let isNodeEnvironmentCache = null; | ||
/** | ||
* Check if running in node | ||
*/ | ||
export function isNodeEnvironment() { | ||
@@ -358,2 +370,5 @@ if (isNodeEnvironmentCache !== null) | ||
let isBrowserEnvironmentCache = null; | ||
/** | ||
* Check if running in browser | ||
*/ | ||
export function isBrowserEnvironment() { | ||
@@ -360,0 +375,0 @@ if (isBrowserEnvironmentCache !== null) |
{ | ||
"name": "@meteor-it/utils", | ||
"version": "1.3.22", | ||
"version": "1.3.24", | ||
"description": "Many useful utils", | ||
@@ -17,3 +17,3 @@ "module": "index.mjs", | ||
}, | ||
"gitHead": "ca54e003ba58f02983eadbc208e687aedc0d6a39" | ||
"gitHead": "82f6f921490028c45f95e559daf7cc410a792049" | ||
} |
Sorry, the diff of this file is not supported yet
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
85399
1368