Socket
Socket
Sign inDemoInstall

@pnp/common

Package Overview
Dependencies
Maintainers
13
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnp/common - npm Package Compare versions

Comparing version 2.1.0-beta1 to 2.1.0-beta10

2

collections.d.ts

@@ -19,3 +19,3 @@ /**

*/
export declare function mergeMaps<K, V>(target: Map<K, V>, ...maps: Map<K, V>[]): Map<K, V>;
export declare function mergeMaps<K = string, V = any>(target: Map<K, V>, ...maps: Map<K, V>[]): Map<K, V>;
//# sourceMappingURL=collections.d.ts.map

@@ -1,6 +0,6 @@

import { isFunc } from "./util";
import { isFunc, objectDefinedNotNull } from "./util.js";
/**
* Used to calculate the object properties, with polyfill if needed
*/
var objectEntries = isFunc(Object.entries) ? Object.entries : function (o) { return Object.keys(o).map(function (k) { return [k, o[k]]; }); };
const objectEntries = isFunc(Object.entries) ? Object.entries : (o) => Object.keys(o).map((k) => [k, o[k]]);
/**

@@ -12,3 +12,3 @@ * Converts the supplied object to a map

export function objectToMap(o) {
if (o !== undefined && o !== null) {
if (objectDefinedNotNull(o)) {
return new Map(objectEntries(o));

@@ -24,10 +24,13 @@ }

*/
export function mergeMaps(target) {
var maps = [];
for (var _i = 1; _i < arguments.length; _i++) {
maps[_i - 1] = arguments[_i];
}
for (var i = 0; i < maps.length; i++) {
maps[i].forEach(function (v, k) {
target.set(k, v);
export function mergeMaps(target, ...maps) {
for (let i = 0; i < maps.length; i++) {
maps[i].forEach((v, k) => {
// let's not run the spfx context through Object.assign :)
if ((typeof k === "string" && k !== "spfxContext") && Object.prototype.toString.call(v) === "[object Object]") {
// we only handle one level of deep object merging
target.set(k, Object.assign({}, target.get(k) || {}, v));
}
else {
target.set(k, v);
}
});

@@ -34,0 +37,0 @@ }

@@ -1,8 +0,8 @@

export * from "./collections";
export * from "./libconfig";
export * from "./net";
export * from "./spfxcontextinterface";
export * from "./storage";
export * from "./util";
export * from "./safe-global";
export * from "./collections.js";
export * from "./libconfig.js";
export * from "./net.js";
export * from "./spfxcontextinterface.js";
export * from "./storage.js";
export * from "./util.js";
export * from "./safe-global.js";
//# sourceMappingURL=index.d.ts.map

@@ -1,8 +0,8 @@

export * from "./collections";
export * from "./libconfig";
export * from "./net";
export * from "./spfxcontextinterface";
export * from "./storage";
export * from "./util";
export * from "./safe-global";
export * from "./collections.js";
export * from "./libconfig.js";
export * from "./net.js";
export * from "./spfxcontextinterface.js";
export * from "./storage.js";
export * from "./util.js";
export * from "./safe-global.js";
//# sourceMappingURL=index.js.map

@@ -1,3 +0,3 @@

import { ITypedHash } from "./collections";
import { ISPFXContext } from "./spfxcontextinterface";
import { ITypedHash } from "./collections.js";
import { ISPFXContext } from "./spfxcontextinterface.js";
export interface ILibraryConfiguration {

@@ -54,3 +54,3 @@ /**

}
export declare let DefaultRuntime: Runtime;
export declare const DefaultRuntime: Runtime;
//# sourceMappingURL=libconfig.d.ts.map

@@ -1,9 +0,7 @@

import { __read, __values } from "tslib";
import { mergeMaps, objectToMap } from "./collections";
export function setup(config, runtime) {
if (runtime === void 0) { runtime = DefaultRuntime; }
import { mergeMaps, objectToMap } from "./collections.js";
export function setup(config, runtime = DefaultRuntime) {
runtime.assign(config);
}
// lable mapping for known config values
var s = [
const s = [
"defaultCachingStore",

@@ -17,3 +15,3 @@ "defaultCachingTimeoutSeconds",

];
var runtimeCreateHooks = [];
const runtimeCreateHooks = [];
export function onRuntimeCreate(hook) {

@@ -26,16 +24,19 @@ if (runtimeCreateHooks.indexOf(hook) < 0) {

}
var Runtime = /** @class */ (function () {
function Runtime(_v) {
var _this = this;
if (_v === void 0) { _v = new Map(); }
export class Runtime {
constructor(_v = new Map()) {
this._v = _v;
const defaulter = (key, def) => {
if (!this._v.has(key)) {
this._v.set(key, def);
}
};
// setup defaults
this._v.set(s[0], "session");
this._v.set(s[1], 60);
this._v.set(s[2], false);
this._v.set(s[3], false);
this._v.set(s[4], 750);
this._v.set(s[5], null);
this._v.set(s[6], false);
runtimeCreateHooks.forEach(function (hook) { return hook(_this); });
defaulter(s[0], "session");
defaulter(s[1], 60);
defaulter(s[2], false);
defaulter(s[3], false);
defaulter(s[4], 750);
defaulter(s[5], null);
defaulter(s[6], false);
runtimeCreateHooks.forEach(hook => hook(this));
}

@@ -46,5 +47,5 @@ /**

*/
Runtime.prototype.assign = function (config) {
assign(config) {
this._v = mergeMaps(this._v, objectToMap(config));
};
}
/**

@@ -55,34 +56,21 @@ * Gets a runtime value using T to define the available keys, and R to define the type returned by that key

*/
Runtime.prototype.get = function (key) {
get(key) {
return this._v.get(key);
};
}
/**
* Exports the internal Map representing this runtime
*/
Runtime.prototype.export = function () {
var e_1, _a;
var expt = new Map();
try {
for (var _b = __values(this._v), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
if (key !== "__isDefault__") {
expt.set(key, value);
}
export() {
const expt = new Map();
for (const [key, value] of this._v) {
if (key !== "__isDefault__") {
expt.set(key, value);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return expt;
};
return Runtime;
}());
export { Runtime };
}
}
// default runtime used globally
var _runtime = new Runtime(new Map([["__isDefault__", true]]));
export var DefaultRuntime = _runtime;
const _runtime = new Runtime(new Map([["__isDefault__", true]]));
export const DefaultRuntime = _runtime;
//# sourceMappingURL=libconfig.js.map

@@ -1,2 +0,2 @@

import { ISPFXContext } from "./spfxcontextinterface";
import { ISPFXContext } from "./spfxcontextinterface.js";
export interface IConfigOptions {

@@ -3,0 +3,0 @@ headers?: string[][] | {

@@ -1,8 +0,8 @@

import { __awaiter, __extends, __generator } from "tslib";
import { assign, objectDefinedNotNull } from "./util";
import { safeGlobal } from "./safe-global";
import { __awaiter } from "tslib";
import { assign, objectDefinedNotNull } from "./util.js";
import { safeGlobal } from "./safe-global.js";
export function mergeHeaders(target, source) {
if (objectDefinedNotNull(source)) {
var temp = new Request("", { headers: source });
temp.headers.forEach(function (value, name) {
const temp = new Request("", { headers: source });
temp.headers.forEach((value, name) => {
target.append(name, value);

@@ -14,3 +14,3 @@ });

if (objectDefinedNotNull(source)) {
var headers = assign(target.headers || {}, source.headers);
const headers = assign(target.headers || {}, source.headers);
target = assign(target, source);

@@ -26,4 +26,4 @@ target.headers = headers;

export function getADALResource(url) {
var u = new URL(url);
return u.protocol + "//" + u.hostname;
const u = new URL(url);
return `${u.protocol}//${u.hostname}`;
}

@@ -33,47 +33,33 @@ /**

*/
var FetchClient = /** @class */ (function () {
function FetchClient() {
export class FetchClient {
fetch(url, options) {
return safeGlobal.fetch(url, options);
}
FetchClient.prototype.fetch = function (url, options) {
return safeGlobal.fetch(url, options);
};
return FetchClient;
}());
export { FetchClient };
}
/**
* Makes requests using the fetch API adding the supplied token to the Authorization header
*/
var BearerTokenFetchClient = /** @class */ (function (_super) {
__extends(BearerTokenFetchClient, _super);
function BearerTokenFetchClient(_token) {
var _this = _super.call(this) || this;
_this._token = _token;
return _this;
export class BearerTokenFetchClient extends FetchClient {
constructor(_token) {
super();
this._token = _token;
}
Object.defineProperty(BearerTokenFetchClient.prototype, "token", {
get: function () {
return this._token || "";
},
set: function (token) {
this._token = token;
},
enumerable: false,
configurable: true
});
BearerTokenFetchClient.prototype.fetch = function (url, options) {
if (options === void 0) { options = {}; }
var headers = new Headers();
get token() {
return this._token || "";
}
set token(token) {
this._token = token;
}
fetch(url, options = {}) {
const headers = new Headers();
mergeHeaders(headers, options.headers);
headers.set("Authorization", "Bearer " + this._token);
headers.set("Authorization", `Bearer ${this._token}`);
options.headers = headers;
return _super.prototype.fetch.call(this, url, options);
};
return BearerTokenFetchClient;
}(FetchClient));
export { BearerTokenFetchClient };
return super.fetch(url, options);
}
}
/**
* Client wrapping the aadTokenProvider available from SPFx >= 1.6
*/
var SPFxAdalClient = /** @class */ (function (_super) {
__extends(SPFxAdalClient, _super);
export class SPFxAdalClient extends BearerTokenFetchClient {
/**

@@ -83,6 +69,5 @@ *

*/
function SPFxAdalClient(context) {
var _this = _super.call(this, null) || this;
_this.context = context;
return _this;
constructor(context) {
super(null);
this.context = context;
}

@@ -95,16 +80,12 @@ /**

*/
SPFxAdalClient.prototype.fetch = function (url, options) {
return __awaiter(this, void 0, void 0, function () {
var token;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getToken(getADALResource(url))];
case 1:
token = _a.sent();
this.token = token;
return [2 /*return*/, _super.prototype.fetch.call(this, url, options)];
}
});
fetch(url, options) {
const _super = Object.create(null, {
fetch: { get: () => super.fetch }
});
};
return __awaiter(this, void 0, void 0, function* () {
const token = yield this.getToken(getADALResource(url));
this.token = token;
return _super.fetch.call(this, url, options);
});
}
/**

@@ -115,18 +96,9 @@ * Gets an AAD token for the provided resource using the SPFx AADTokenProvider

*/
SPFxAdalClient.prototype.getToken = function (resource) {
return __awaiter(this, void 0, void 0, function () {
var provider;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.context.aadTokenProviderFactory.getTokenProvider()];
case 1:
provider = _a.sent();
return [2 /*return*/, provider.getToken(resource)];
}
});
getToken(resource) {
return __awaiter(this, void 0, void 0, function* () {
const provider = yield this.context.aadTokenProviderFactory.getTokenProvider();
return provider.getToken(resource);
});
};
return SPFxAdalClient;
}(BearerTokenFetchClient));
export { SPFxAdalClient };
}
}
//# sourceMappingURL=net.js.map
{
"name": "@pnp/common",
"version": "2.1.0-beta1",
"version": "2.1.0-beta10",
"description": "pnp - provides shared functionality across all pnp libraries",

@@ -8,3 +8,3 @@ "main": "./index.js",

"dependencies": {
"tslib": "2.0.0"
"tslib": "2.0.3"
},

@@ -11,0 +11,0 @@ "author": {

@@ -0,0 +0,0 @@ ![SharePoint Patterns and Practices](https://devofficecdn.azureedge.net/media/Default/PnP/sppnp.png)

// export either window or global
export var safeGlobal = typeof global === "undefined" ? window : global;
export const safeGlobal = typeof global === "undefined" ? window : global;
//# sourceMappingURL=safe-global.js.map

@@ -1,4 +0,4 @@

import { __awaiter, __generator } from "tslib";
import { dateAdd, getCtxCallback, jsS, objectDefinedNotNull } from "./util";
import { DefaultRuntime } from "./libconfig";
import { __awaiter } from "tslib";
import { dateAdd, getCtxCallback, jsS, objectDefinedNotNull } from "./util.js";
import { DefaultRuntime } from "./libconfig.js";
/**

@@ -8,3 +8,3 @@ * A wrapper class to provide a consistent interface to browser based storage

*/
var PnPClientStorageWrapper = /** @class */ (function () {
export class PnPClientStorageWrapper {
/**

@@ -15,4 +15,3 @@ * Creates a new instance of the PnPClientStorageWrapper class

*/
function PnPClientStorageWrapper(store, defaultTimeoutMinutes) {
if (defaultTimeoutMinutes === void 0) { defaultTimeoutMinutes = -1; }
constructor(store, defaultTimeoutMinutes = -1) {
this.store = store;

@@ -27,5 +26,5 @@ this.defaultTimeoutMinutes = defaultTimeoutMinutes;

}
PnPClientStorageWrapper.bind = function (store) {
static bind(store) {
return new PnPClientStorageWrapper(typeof (store) === "undefined" ? new MemoryStorage() : store);
};
}
/**

@@ -36,11 +35,11 @@ * Get a value from storage, or null if that value does not exist

*/
PnPClientStorageWrapper.prototype.get = function (key) {
get(key) {
if (!this.enabled) {
return null;
}
var o = this.store.getItem(key);
const o = this.store.getItem(key);
if (!objectDefinedNotNull(o)) {
return null;
}
var persistable = JSON.parse(o);
const persistable = JSON.parse(o);
if (new Date(persistable.expiration) <= new Date()) {

@@ -53,3 +52,3 @@ this.delete(key);

}
};
}
/**

@@ -62,7 +61,7 @@ * Adds a value to the underlying storage

*/
PnPClientStorageWrapper.prototype.put = function (key, o, expire) {
put(key, o, expire) {
if (this.enabled) {
this.store.setItem(key, this.createPersistable(o, expire));
}
};
}
/**

@@ -73,7 +72,7 @@ * Deletes a value from the underlying storage

*/
PnPClientStorageWrapper.prototype.delete = function (key) {
delete(key) {
if (this.enabled) {
this.store.removeItem(key);
}
};
}
/**

@@ -86,61 +85,40 @@ * Gets an item from the underlying storage, or adds it if it does not exist using the supplied getter function

*/
PnPClientStorageWrapper.prototype.getOrPut = function (key, getter, expire) {
return __awaiter(this, void 0, void 0, function () {
var o;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.enabled) {
return [2 /*return*/, getter()];
}
o = this.get(key);
if (!(o === null)) return [3 /*break*/, 2];
return [4 /*yield*/, getter()];
case 1:
o = _a.sent();
this.put(key, o, expire);
_a.label = 2;
case 2: return [2 /*return*/, o];
}
});
getOrPut(key, getter, expire) {
return __awaiter(this, void 0, void 0, function* () {
if (!this.enabled) {
return getter();
}
let o = this.get(key);
if (o === null) {
o = yield getter();
this.put(key, o, expire);
}
return o;
});
};
}
/**
* Deletes any expired items placed in the store by the pnp library, leaves other items untouched
*/
PnPClientStorageWrapper.prototype.deleteExpired = function () {
return __awaiter(this, void 0, void 0, function () {
var i, key;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!this.enabled) {
return [2 /*return*/];
}
i = 0;
_a.label = 1;
case 1:
if (!(i < this.store.length)) return [3 /*break*/, 4];
key = this.store.key(i);
if (!(key !== null)) return [3 /*break*/, 3];
if (!/["|']?pnp["|']? ?: ?1/i.test(this.store.getItem(key))) return [3 /*break*/, 3];
deleteExpired() {
return __awaiter(this, void 0, void 0, function* () {
if (!this.enabled) {
return;
}
for (let i = 0; i < this.store.length; i++) {
const key = this.store.key(i);
if (key !== null) {
// test the stored item to see if we stored it
if (/["|']?pnp["|']? ?: ?1/i.test(this.store.getItem(key))) {
// get those items as get will delete from cache if they are expired
return [4 /*yield*/, this.get(key)];
case 2:
// get those items as get will delete from cache if they are expired
_a.sent();
_a.label = 3;
case 3:
i++;
return [3 /*break*/, 1];
case 4: return [2 /*return*/];
yield this.get(key);
}
}
});
}
});
};
}
/**
* Used to determine if the wrapped storage is available currently
*/
PnPClientStorageWrapper.prototype.test = function () {
var str = "t";
test() {
const str = "t";
try {

@@ -154,10 +132,10 @@ this.store.setItem(str, str);

}
};
}
/**
* Creates the persistable to store
*/
PnPClientStorageWrapper.prototype.createPersistable = function (o, expire) {
createPersistable(o, expire) {
if (expire === undefined) {
// ensure we are by default inline with the global library setting
var defaultTimeout = DefaultRuntime.get("defaultCachingTimeoutSeconds");
let defaultTimeout = DefaultRuntime.get("defaultCachingTimeoutSeconds");
if (this.defaultTimeoutMinutes > 0) {

@@ -169,55 +147,46 @@ defaultTimeout = this.defaultTimeoutMinutes * 60;

return jsS({ pnp: 1, expiration: expire, value: o });
};
}
/**
* Deletes expired items added by this library in this.store and sets a timeout to call itself
*/
PnPClientStorageWrapper.prototype.cacheExpirationHandler = function () {
var _this = this;
cacheExpirationHandler() {
if (!this.enabled) {
return;
}
this.deleteExpired().then(function (_) {
this.deleteExpired().then(() => {
// call ourself in the future
setTimeout(getCtxCallback(_this, _this.cacheExpirationHandler), DefaultRuntime.get("cacheExpirationIntervalMilliseconds"));
setTimeout(getCtxCallback(this, this.cacheExpirationHandler), DefaultRuntime.get("cacheExpirationIntervalMilliseconds"));
}).catch(console.error);
};
return PnPClientStorageWrapper;
}());
export { PnPClientStorageWrapper };
}
}
/**
* A thin implementation of in-memory storage for use in nodejs
*/
var MemoryStorage = /** @class */ (function () {
function MemoryStorage(_store) {
if (_store === void 0) { _store = new Map(); }
class MemoryStorage {
constructor(_store = new Map()) {
this._store = _store;
}
Object.defineProperty(MemoryStorage.prototype, "length", {
get: function () {
return this._store.size;
},
enumerable: false,
configurable: true
});
MemoryStorage.prototype.clear = function () {
get length() {
return this._store.size;
}
clear() {
this._store.clear();
};
MemoryStorage.prototype.getItem = function (key) {
}
getItem(key) {
return this._store.get(key);
};
MemoryStorage.prototype.key = function (index) {
}
key(index) {
return Array.from(this._store)[index][0];
};
MemoryStorage.prototype.removeItem = function (key) {
}
removeItem(key) {
this._store.delete(key);
};
MemoryStorage.prototype.setItem = function (key, data) {
}
setItem(key, data) {
this._store.set(key, data);
};
return MemoryStorage;
}());
}
}
/**
* A class that will establish wrappers for both local and session storage
*/
var PnPClientStorage = /** @class */ (function () {
export class PnPClientStorage {
/**

@@ -228,37 +197,25 @@ * Creates a new instance of the PnPClientStorage class

*/
function PnPClientStorage(_local, _session) {
if (_local === void 0) { _local = null; }
if (_session === void 0) { _session = null; }
constructor(_local = null, _session = null) {
this._local = _local;
this._session = _session;
}
Object.defineProperty(PnPClientStorage.prototype, "local", {
/**
* Provides access to the local storage of the browser
*/
get: function () {
if (this._local === null) {
this._local = new PnPClientStorageWrapper(typeof (localStorage) === "undefined" ? new MemoryStorage() : localStorage);
}
return this._local;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PnPClientStorage.prototype, "session", {
/**
* Provides access to the session storage of the browser
*/
get: function () {
if (this._session === null) {
this._session = new PnPClientStorageWrapper(typeof (sessionStorage) === "undefined" ? new MemoryStorage() : sessionStorage);
}
return this._session;
},
enumerable: false,
configurable: true
});
return PnPClientStorage;
}());
export { PnPClientStorage };
/**
* Provides access to the local storage of the browser
*/
get local() {
if (this._local === null) {
this._local = new PnPClientStorageWrapper(typeof (localStorage) === "undefined" ? new MemoryStorage() : localStorage);
}
return this._local;
}
/**
* Provides access to the session storage of the browser
*/
get session() {
if (this._session === null) {
this._session = new PnPClientStorageWrapper(typeof (sessionStorage) === "undefined" ? new MemoryStorage() : sessionStorage);
}
return this._session;
}
}
//# sourceMappingURL=storage.js.map

@@ -1,2 +0,2 @@

import { ITypedHash } from "./collections";
import { ITypedHash } from "./collections.js";
/**

@@ -3,0 +3,0 @@ * Gets a callback function which will maintain context across async calls.

@@ -9,7 +9,4 @@ /**

*/
export function getCtxCallback(context, method) {
var params = [];
for (var _i = 2; _i < arguments.length; _i++) {
params[_i - 2] = arguments[_i];
}
// eslint-disable-next-line @typescript-eslint/ban-types
export function getCtxCallback(context, method, ...params) {
return function () {

@@ -29,3 +26,3 @@ method.apply(context, params);

export function dateAdd(date, interval, units) {
var ret = new Date(date.toString()); // don't change original date
let ret = new Date(date.toString()); // don't change original date
switch (interval.toLowerCase()) {

@@ -67,10 +64,6 @@ case "year":

*/
export function combine() {
var paths = [];
for (var _i = 0; _i < arguments.length; _i++) {
paths[_i] = arguments[_i];
}
export function combine(...paths) {
return paths
.filter(function (path) { return !stringIsNullOrEmpty(path); })
.map(function (path) { return path.replace(/^[\\|\/]/, "").replace(/[\\|\/]$/, ""); })
.filter(path => !stringIsNullOrEmpty(path))
.map(path => path.replace(/^[\\|/]/, "").replace(/[\\|/]$/, ""))
.join("/")

@@ -87,4 +80,4 @@ .replace(/\\/g, "/");

export function getRandomString(chars) {
var text = new Array(chars);
for (var i = 0; i < chars; i++) {
const text = new Array(chars);
for (let i = 0; i < chars; i++) {
text[i] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(Math.random() * 62));

@@ -99,7 +92,7 @@ }

*/
/* tslint:disable no-bitwise */
/* eslint-disable no-bitwise */
export function getGUID() {
var d = Date.now();
let d = Date.now();
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
var r = (d + Math.random() * 16) % 16 | 0;
const r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);

@@ -109,3 +102,3 @@ return (c === "x" ? r : (r & 0x3 | 0x8)).toString(16);

}
/* tslint:enable */
/* eslint-enable no-bitwise */
/**

@@ -141,5 +134,3 @@ * Determines if a given value is a function

*/
export function assign(target, source, noOverwrite, filter) {
if (noOverwrite === void 0) { noOverwrite = false; }
if (filter === void 0) { filter = function () { return true; }; }
export function assign(target, source, noOverwrite = false, filter = () => true) {
if (!objectDefinedNotNull(source)) {

@@ -149,8 +140,8 @@ return target;

// ensure we don't overwrite things we don't want overwritten
var check = noOverwrite ? function (o, i) { return !(i in o); } : function () { return true; };
const check = noOverwrite ? (o, i) => !(i in o) : () => true;
// final filter we will use
var f = function (v) { return check(target, v) && filter(v); };
const f = (v) => check(target, v) && filter(v);
return Object.getOwnPropertyNames(source)
.filter(f)
.reduce(function (t, v) {
.reduce((t, v) => {
t[v] = source[v];

@@ -185,3 +176,3 @@ return t;

}
var matches = /([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})/i.exec(guid);
const matches = /([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})/i.exec(guid);
return matches === null ? guid : matches[1];

@@ -211,10 +202,10 @@ }

*/
// tslint:disable:no-bitwise
/* eslint-disable no-bitwise */
export function getHashCode(s) {
var hash = 0;
let hash = 0;
if (s.length === 0) {
return hash;
}
for (var i = 0; i < s.length; i++) {
var chr = s.charCodeAt(i);
for (let i = 0; i < s.length; i++) {
const chr = s.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;

@@ -225,3 +216,3 @@ hash |= 0; // Convert to 32bit integer

}
// tslint:enable:no-bitwise
/* eslint-enable no-bitwise */
//# sourceMappingURL=util.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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