Socket
Socket
Sign inDemoInstall

@typed/common

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@typed/common - npm Package Compare versions

Comparing version 1.0.0-alpha.159 to 1.0.0

.rpt2_cache/rpt2_40094c4a914627975077d5379a2d150a94563b81/code/cache/194f2d056a1991b4818ba93d0eafb3d356cf3fa4

14

cjs/addQueryParameters.js

@@ -11,5 +11,3 @@ "use strict";

if (queryParams === undefined) {
return function (queryParams) {
return __addQueryParameters(url, queryParams);
};
return (queryParams) => __addQueryParameters(url, queryParams);
}

@@ -20,14 +18,14 @@ return __addQueryParameters(url, queryParams);

function __addQueryParameters(url, queryParams) {
var params = Object.keys(queryParams)
const params = Object.keys(queryParams)
.sort()
.map(queryParam(queryParams))
.join('&');
return encodeURI("" + url + (params ? "?" + params : ''));
return encodeURI(`${url}${params ? `?${params}` : ''}`);
}
function queryParam(queryParams) {
return function (key) {
var value = queryParams[key];
return value ? key + "=" + value : key;
return (key) => {
const value = queryParams[key];
return value ? `${key}=${value}` : key;
};
}
//# sourceMappingURL=addQueryParameters.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var typeOf_1 = require("./typeOf");
const typeOf_1 = require("./typeOf");
function clone(value, refFrom, refTo, deep) {
function copy(copiedValue) {
var length = refFrom.length;
var i = 0;
const length = refFrom.length;
let i = 0;
for (; i < length; ++i) {

@@ -15,3 +15,3 @@ if (value === refFrom[i]) {

refTo[i + 1] = copiedValue;
for (var key in value) {
for (const key in value) {
if (!value.hasOwnProperty(key)) {

@@ -18,0 +18,0 @@ continue;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var functionName_1 = require("./functionName");
var includesWith_1 = require("./includesWith");
var typeOf_1 = require("./typeOf");
function equals(a, b, stackA, stackB) {
if (stackA === void 0) { stackA = []; }
if (stackB === void 0) { stackB = []; }
const functionName_1 = require("./functionName");
const includesWith_1 = require("./includesWith");
const typeOf_1 = require("./typeOf");
function equals(a, b, stackA = [], stackB = []) {
if (Object.is(a, b)) {
return true;
}
var typeA = typeOf_1.typeOf(a);
const typeA = typeOf_1.typeOf(a);
if (typeA !== typeOf_1.typeOf(b)) {

@@ -52,3 +50,3 @@ return false;

}
var idx = stackA.length - 1;
let idx = stackA.length - 1;
while (idx >= 0) {

@@ -95,11 +93,11 @@ if (stackA[idx] === a) {

}
var keysA = Object.keys(a);
const keysA = Object.keys(a);
if (keysA.length !== Object.keys(b).length) {
return false;
}
var extendedStackA = stackA.concat([a]);
var extendedStackB = stackB.concat([b]);
const extendedStackA = stackA.concat([a]);
const extendedStackB = stackB.concat([b]);
idx = keysA.length - 1;
while (idx >= 0) {
var key = keysA[idx];
const key = keysA[idx];
if (!(Object.prototype.hasOwnProperty.call(b, key) &&

@@ -115,4 +113,4 @@ equals(b[key], a[key], extendedStackA, extendedStackB))) {

function _uniqContentEquals(aIterable, bIterable, stackA, stackB) {
var a = Array.from(aIterable);
var b = Array.from(bIterable);
const a = Array.from(aIterable);
const b = Array.from(bIterable);
// tslint:disable-next-line:variable-name

@@ -124,4 +122,4 @@ function eq(_a, _b) {

// tslint:disable-next-line:no-shadowed-variable
return !includesWith_1.includesWith(function (b, aItem) { return !includesWith_1.includesWith(eq, aItem, b); }, b, a);
return !includesWith_1.includesWith((b, aItem) => !includesWith_1.includesWith(eq, aItem, b), b, a);
}
//# sourceMappingURL=equals.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isBrowser = (function () {
return typeof window !== 'undefined' && typeof document !== 'undefined';
})();
// Very loose definition of a browser environment
exports.isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
//# sourceMappingURL=executionEnvironment.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var FUNCTION_NAME_REGEX = /^function\s*([\w$]+)/;
var DEFAULT_MATCH = ['', ''];
const FUNCTION_NAME_REGEX = /^function\s*([\w$]+)/;
const DEFAULT_MATCH = ['', ''];
/**

@@ -14,3 +13,3 @@ * Returns the name of a function.

}
var _a = tslib_1.__read(String(fn).match(FUNCTION_NAME_REGEX) || DEFAULT_MATCH, 2), name = _a[1];
const [, name] = String(fn).match(FUNCTION_NAME_REGEX) || DEFAULT_MATCH;
return name;

@@ -17,0 +16,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function includesWith(pred, x, list) {
var idx = 0;
var len = list.length;
let idx = 0;
const len = list.length;
while (idx < len) {

@@ -7,0 +7,0 @@ if (pred(x, list[idx], idx)) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./addQueryParameters"), exports);

@@ -5,0 +5,0 @@ tslib_1.__exportStar(require("./clone"), exports);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var equals_1 = require("./equals");
function indexOf(list, a, idx) {
if (idx === void 0) { idx = 0; }
const equals_1 = require("./equals");
function indexOf(list, a, idx = 0) {
// Array.prototype.indexOf doesn't exist below IE9

@@ -10,4 +9,4 @@ if (typeof list.indexOf === 'function') {

case 'number':
var inf = void 0;
var item = void 0;
let inf;
let item;
if (a === 0) {

@@ -14,0 +13,0 @@ // manually crawl the list to distinguish between +0 and -0

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function mapArrayLike(fn, functor) {
var idx = 0;
var len = functor.length;
var result = Array(len);
let idx = 0;
const len = functor.length;
const result = Array(len);
while (idx < len) {

@@ -8,0 +8,0 @@ result[idx] = fn(functor[idx]);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function mapObj(fn, obj) {
var newObj = {};
const newObj = {};
// tslint:disable-next-line:forin
for (var key in obj) {
for (const key in obj) {
newObj[key] = fn(key, obj[key]);

@@ -8,0 +8,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var DUPLICATE_PATH_SEPARATOR_REGEX = /\/{2,}/g;
var PATH_SEPARATOR = "/";
var isString = function (x) { return typeof x === 'string'; };
const DUPLICATE_PATH_SEPARATOR_REGEX = /\/{2,}/g;
const PATH_SEPARATOR = `/`;
const isString = (x) => typeof x === 'string';
/**

@@ -11,5 +11,4 @@ *

*/
function pathJoin(paths, trailingSlash) {
if (trailingSlash === void 0) { trailingSlash = false; }
var path = ("/" + paths.filter(isString).join(PATH_SEPARATOR)).replace(DUPLICATE_PATH_SEPARATOR_REGEX, PATH_SEPARATOR);
function pathJoin(paths, trailingSlash = false) {
const path = `/${paths.filter(isString).join(PATH_SEPARATOR)}`.replace(DUPLICATE_PATH_SEPARATOR_REGEX, PATH_SEPARATOR);
return !trailingSlash || path[path.length - 1] === '/' ? path : path + '/';

@@ -16,0 +15,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var STEPS = [
const STEPS = [
[/\\/g, '\\\\'],

@@ -13,5 +13,5 @@ [/[\b]/g, '\\b'],

];
var LAST_STEP = [/"/g, '\\"'];
const LAST_STEP = [/"/g, '\\"'];
function quote(s) {
var escaped = STEPS.reduce(applyStep, s);
const escaped = STEPS.reduce(applyStep, s);
return '"' + applyStep(escaped, LAST_STEP) + '"';

@@ -18,0 +18,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var indexOf_1 = require("./indexOf");
var mapArrayLike_1 = require("./mapArrayLike");
var quote_1 = require("./quote");
const indexOf_1 = require("./indexOf");
const mapArrayLike_1 = require("./mapArrayLike");
const quote_1 = require("./quote");
/**

@@ -11,10 +11,10 @@ * Convert anything into a string

*/
exports.toString = function (x) { return _toString(x, []); };
exports.toString = (x) => _toString(x, []);
function _toString(x, seen) {
var recur = function (y) {
var xs = seen.concat([x]);
const recur = (y) => {
const xs = seen.concat([x]);
return indexOf_1.indexOf(xs, y) > -1 ? '<Circular>' : _toString(y, xs);
};
var mapPairs = function (obj, keys) {
return mapArrayLike_1.mapArrayLike(function (k) {
const mapPairs = (obj, keys) => {
return mapArrayLike_1.mapArrayLike((k) => {
return quote_1.quote(k) + ': ' + recur(obj[k]);

@@ -29,3 +29,3 @@ }, keys.slice().sort());

mapArrayLike_1.mapArrayLike(recur, x)
.concat(mapPairs(x, Object.keys(x).filter(function (k) { return !/^\d+$/.test(k); })))
.concat(mapPairs(x, Object.keys(x).filter(k => !/^\d+$/.test(k))))
.join(', ') +

@@ -51,3 +51,3 @@ ']');

if (typeof x.toString === 'function') {
var repr = x.toString();
const repr = x.toString();
if (repr !== '[object Object]') {

@@ -54,0 +54,0 @@ return repr;

@@ -8,3 +8,3 @@ "use strict";

if (value === void 0) {
return "Undefined";
return `Undefined`;
}

@@ -11,0 +11,0 @@ return Object.prototype.toString.call(value).slice(8, -1);

@@ -9,5 +9,3 @@ /**

if (queryParams === undefined) {
return function (queryParams) {
return __addQueryParameters(url, queryParams);
};
return (queryParams) => __addQueryParameters(url, queryParams);
}

@@ -17,14 +15,14 @@ return __addQueryParameters(url, queryParams);

function __addQueryParameters(url, queryParams) {
var params = Object.keys(queryParams)
const params = Object.keys(queryParams)
.sort()
.map(queryParam(queryParams))
.join('&');
return encodeURI("" + url + (params ? "?" + params : ''));
return encodeURI(`${url}${params ? `?${params}` : ''}`);
}
function queryParam(queryParams) {
return function (key) {
var value = queryParams[key];
return value ? key + "=" + value : key;
return (key) => {
const value = queryParams[key];
return value ? `${key}=${value}` : key;
};
}
//# sourceMappingURL=addQueryParameters.js.map
import { typeOf } from './typeOf';
export function clone(value, refFrom, refTo, deep) {
function copy(copiedValue) {
var length = refFrom.length;
var i = 0;
const length = refFrom.length;
let i = 0;
for (; i < length; ++i) {

@@ -13,3 +13,3 @@ if (value === refFrom[i]) {

refTo[i + 1] = copiedValue;
for (var key in value) {
for (const key in value) {
if (!value.hasOwnProperty(key)) {

@@ -16,0 +16,0 @@ continue;

import { functionName } from './functionName';
import { includesWith } from './includesWith';
import { typeOf } from './typeOf';
export function equals(a, b, stackA, stackB) {
if (stackA === void 0) { stackA = []; }
if (stackB === void 0) { stackB = []; }
export function equals(a, b, stackA = [], stackB = []) {
if (Object.is(a, b)) {
return true;
}
var typeA = typeOf(a);
const typeA = typeOf(a);
if (typeA !== typeOf(b)) {

@@ -50,3 +48,3 @@ return false;

}
var idx = stackA.length - 1;
let idx = stackA.length - 1;
while (idx >= 0) {

@@ -93,11 +91,11 @@ if (stackA[idx] === a) {

}
var keysA = Object.keys(a);
const keysA = Object.keys(a);
if (keysA.length !== Object.keys(b).length) {
return false;
}
var extendedStackA = stackA.concat([a]);
var extendedStackB = stackB.concat([b]);
const extendedStackA = stackA.concat([a]);
const extendedStackB = stackB.concat([b]);
idx = keysA.length - 1;
while (idx >= 0) {
var key = keysA[idx];
const key = keysA[idx];
if (!(Object.prototype.hasOwnProperty.call(b, key) &&

@@ -112,4 +110,4 @@ equals(b[key], a[key], extendedStackA, extendedStackB))) {

function _uniqContentEquals(aIterable, bIterable, stackA, stackB) {
var a = Array.from(aIterable);
var b = Array.from(bIterable);
const a = Array.from(aIterable);
const b = Array.from(bIterable);
// tslint:disable-next-line:variable-name

@@ -121,4 +119,4 @@ function eq(_a, _b) {

// tslint:disable-next-line:no-shadowed-variable
return !includesWith(function (b, aItem) { return !includesWith(eq, aItem, b); }, b, a);
return !includesWith((b, aItem) => !includesWith(eq, aItem, b), b, a);
}
//# sourceMappingURL=equals.js.map

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

export var isBrowser = (function () {
return typeof window !== 'undefined' && typeof document !== 'undefined';
})();
// Very loose definition of a browser environment
export const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
//# sourceMappingURL=executionEnvironment.js.map

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

import * as tslib_1 from "tslib";
var FUNCTION_NAME_REGEX = /^function\s*([\w$]+)/;
var DEFAULT_MATCH = ['', ''];
const FUNCTION_NAME_REGEX = /^function\s*([\w$]+)/;
const DEFAULT_MATCH = ['', ''];
/**

@@ -12,5 +11,5 @@ * Returns the name of a function.

}
var _a = tslib_1.__read(String(fn).match(FUNCTION_NAME_REGEX) || DEFAULT_MATCH, 2), name = _a[1];
const [, name] = String(fn).match(FUNCTION_NAME_REGEX) || DEFAULT_MATCH;
return name;
}
//# sourceMappingURL=functionName.js.map
export function includesWith(pred, x, list) {
var idx = 0;
var len = list.length;
let idx = 0;
const len = list.length;
while (idx < len) {

@@ -5,0 +5,0 @@ if (pred(x, list[idx], idx)) {

import { equals } from './equals';
export function indexOf(list, a, idx) {
if (idx === void 0) { idx = 0; }
export function indexOf(list, a, idx = 0) {
// Array.prototype.indexOf doesn't exist below IE9

@@ -8,4 +7,4 @@ if (typeof list.indexOf === 'function') {

case 'number':
var inf = void 0;
var item = void 0;
let inf;
let item;
if (a === 0) {

@@ -12,0 +11,0 @@ // manually crawl the list to distinguish between +0 and -0

export function mapArrayLike(fn, functor) {
var idx = 0;
var len = functor.length;
var result = Array(len);
let idx = 0;
const len = functor.length;
const result = Array(len);
while (idx < len) {

@@ -6,0 +6,0 @@ result[idx] = fn(functor[idx]);

export function mapObj(fn, obj) {
var newObj = {};
const newObj = {};
// tslint:disable-next-line:forin
for (var key in obj) {
for (const key in obj) {
newObj[key] = fn(key, obj[key]);

@@ -6,0 +6,0 @@ }

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

var DUPLICATE_PATH_SEPARATOR_REGEX = /\/{2,}/g;
var PATH_SEPARATOR = "/";
var isString = function (x) { return typeof x === 'string'; };
const DUPLICATE_PATH_SEPARATOR_REGEX = /\/{2,}/g;
const PATH_SEPARATOR = `/`;
const isString = (x) => typeof x === 'string';
/**

@@ -9,7 +9,6 @@ *

*/
export function pathJoin(paths, trailingSlash) {
if (trailingSlash === void 0) { trailingSlash = false; }
var path = ("/" + paths.filter(isString).join(PATH_SEPARATOR)).replace(DUPLICATE_PATH_SEPARATOR_REGEX, PATH_SEPARATOR);
export function pathJoin(paths, trailingSlash = false) {
const path = `/${paths.filter(isString).join(PATH_SEPARATOR)}`.replace(DUPLICATE_PATH_SEPARATOR_REGEX, PATH_SEPARATOR);
return !trailingSlash || path[path.length - 1] === '/' ? path : path + '/';
}
//# sourceMappingURL=pathJoin.js.map

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

var STEPS = [
const STEPS = [
[/\\/g, '\\\\'],

@@ -11,5 +11,5 @@ [/[\b]/g, '\\b'],

];
var LAST_STEP = [/"/g, '\\"'];
const LAST_STEP = [/"/g, '\\"'];
export function quote(s) {
var escaped = STEPS.reduce(applyStep, s);
const escaped = STEPS.reduce(applyStep, s);
return '"' + applyStep(escaped, LAST_STEP) + '"';

@@ -16,0 +16,0 @@ }

@@ -9,10 +9,10 @@ import { indexOf } from './indexOf';

*/
export var toString = function (x) { return _toString(x, []); };
export const toString = (x) => _toString(x, []);
function _toString(x, seen) {
var recur = function (y) {
var xs = seen.concat([x]);
const recur = (y) => {
const xs = seen.concat([x]);
return indexOf(xs, y) > -1 ? '<Circular>' : _toString(y, xs);
};
var mapPairs = function (obj, keys) {
return mapArrayLike(function (k) {
const mapPairs = (obj, keys) => {
return mapArrayLike((k) => {
return quote(k) + ': ' + recur(obj[k]);

@@ -27,3 +27,3 @@ }, keys.slice().sort());

mapArrayLike(recur, x)
.concat(mapPairs(x, Object.keys(x).filter(function (k) { return !/^\d+$/.test(k); })))
.concat(mapPairs(x, Object.keys(x).filter(k => !/^\d+$/.test(k))))
.join(', ') +

@@ -49,3 +49,3 @@ ']');

if (typeof x.toString === 'function') {
var repr = x.toString();
const repr = x.toString();
if (repr !== '[object Object]') {

@@ -52,0 +52,0 @@ return repr;

@@ -6,3 +6,3 @@ export function typeOf(value) {

if (value === void 0) {
return "Undefined";
return `Undefined`;
}

@@ -9,0 +9,0 @@ return Object.prototype.toString.call(value).slice(8, -1);

{
"name": "@typed/common",
"version": "1.0.0-alpha.159+189311f",
"version": "1.0.0",
"description": "Assortment of shared functions & types for Typed libraries",

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

},
"gitHead": "189311f2ad5d188801331492947e2cfb74745076"
"peerDependencies": {
"tslib": "^1.10.0"
},
"sideEffects": false,
"gitHead": "44de53576265995c67a5f4b5a2bdb72cfd3456ae",
"unpkg": "./umd/index.js"
}

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

export const isBrowser: boolean = ((): boolean =>
typeof window !== 'undefined' && typeof document !== 'undefined')()
// Very loose definition of a browser environment
export const isBrowser: boolean = typeof window !== 'undefined' && typeof document !== 'undefined'

@@ -16,5 +16,6 @@ {

"./source/**/*.browser-test.ts",
"./source/**/*.test.ts"
"./source/**/*.test.ts",
"./umd/**"
],
"extends": "../tsconfig.base.json"
}
}

@@ -13,3 +13,4 @@ {

"./source/**/*.browser-test.ts",
"./source/**/*.test.ts"
"./source/**/*.test.ts",
"./umd/**"
],

@@ -20,2 +21,2 @@ "include": [

"extends": "../tsconfig.base.json"
}
}

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

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