@opendesign/octopus-common
Advanced tools
Comparing version 3.0.0-rc.33 to 3.0.0-rc.34
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.asFiniteNumber = exports.asNumber = exports.asString = exports.asBoolean = exports.asArray = void 0; | ||
const common_1 = require("./common"); | ||
function asArray(value, defaultValue) { | ||
@@ -46,6 +45,6 @@ if (Array.isArray(value)) { | ||
function asFiniteNumber(value, defaultValue) { | ||
if ((0, common_1.isFiniteNumber)(value)) { | ||
if (typeof value === 'number' && Number.isFinite(value)) { | ||
return value; | ||
} | ||
if ((0, common_1.isFiniteNumber)(defaultValue)) { | ||
if (typeof defaultValue === 'number' && Number.isFinite(defaultValue)) { | ||
return defaultValue; | ||
@@ -52,0 +51,0 @@ } |
@@ -5,4 +5,2 @@ import type { GetPromiseValue } from '../utility-types'; | ||
export declare function isObject(anyValue: unknown): anyValue is Record<string, unknown>; | ||
export declare function isFiniteNumber(value: unknown): value is number; | ||
export declare function isString(value: unknown): value is string; | ||
export declare function getMapped<T, U>(value: unknown, map: { | ||
@@ -9,0 +7,0 @@ [key: string]: T; |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.uniqueIdFactory = exports.compareStrings = exports.push = exports.keys = exports.traverseAndFind = exports.getConvertedAsync = exports.getConverted = exports.getPresentProps = exports.getMapped = exports.isString = exports.isFiniteNumber = exports.isObject = exports.deepInspect = exports.JSONFromTypedArray = void 0; | ||
exports.uniqueIdFactory = exports.compareStrings = exports.push = exports.keys = exports.traverseAndFind = exports.getConvertedAsync = exports.getConverted = exports.getPresentProps = exports.getMapped = exports.isObject = exports.deepInspect = exports.JSONFromTypedArray = void 0; | ||
const util_1 = __importDefault(require("util")); | ||
@@ -22,10 +22,2 @@ const isObjectLike_1 = __importDefault(require("lodash/isObjectLike")); | ||
exports.isObject = isObject; | ||
function isFiniteNumber(value) { | ||
return Number.isFinite(value); | ||
} | ||
exports.isFiniteNumber = isFiniteNumber; | ||
function isString(value) { | ||
return typeof value === 'string'; | ||
} | ||
exports.isString = isString; | ||
function getMapped(value, map, defaultValue) { | ||
@@ -32,0 +24,0 @@ if (typeof value !== 'string') |
@@ -5,3 +5,3 @@ "use strict"; | ||
describe('mod', () => { | ||
function testExample(N, modulo, result) { | ||
function testModulo(N, modulo, result) { | ||
test(`mod(${N}, ${modulo}) to be ${result}`, () => { | ||
@@ -22,6 +22,6 @@ expect((0, math_1.mod)(N, modulo)).toBe(result); | ||
]; | ||
examples.forEach((example) => testExample(...example)); | ||
examples.forEach((example) => testModulo(...example)); | ||
}); | ||
describe('sin', () => { | ||
function testExample(N, result) { | ||
function testTan(N, result) { | ||
test(`sin(${N}) to be ${result}`, () => { | ||
@@ -41,6 +41,6 @@ expect((0, math_1.sin)(N)).toBe(result); | ||
]; | ||
examples.forEach((example) => testExample(...example)); | ||
examples.forEach((example) => testTan(...example)); | ||
}); | ||
describe('cos', () => { | ||
function testExample(N, result) { | ||
function testTan(N, result) { | ||
test(`cos(${N}) to be ${result}`, () => { | ||
@@ -61,6 +61,6 @@ expect((0, math_1.cos)(N)).toBe(result); | ||
]; | ||
examples.forEach((example) => testExample(...example)); | ||
examples.forEach((example) => testTan(...example)); | ||
}); | ||
describe('tan', () => { | ||
function testExample(N, result) { | ||
function testTan(N, result) { | ||
test(`tan(${N}) to be ${result}`, () => { | ||
@@ -80,6 +80,6 @@ expect((0, math_1.tan)(N)).toBe(result); | ||
]; | ||
examples.forEach((example) => testExample(...example)); | ||
examples.forEach((example) => testTan(...example)); | ||
}); | ||
describe('lerp', () => { | ||
function testExample(x, y, ratio, result) { | ||
function testTan(x, y, ratio, result) { | ||
test(`lerp(${x}, ${y}, ${ratio}) to be ${result}`, () => { | ||
@@ -97,6 +97,6 @@ expect((0, math_1.lerp)(x, y, ratio)).toBe(result); | ||
]; | ||
examples.forEach((example) => testExample(...example)); | ||
examples.forEach((example) => testTan(...example)); | ||
}); | ||
describe('invLerp', () => { | ||
function testExample(x, y, ratio, result) { | ||
function testTan(x, y, ratio, result) { | ||
test(`invLerp(${x}, ${y}, ${ratio}) to be ${result}`, () => { | ||
@@ -114,3 +114,3 @@ expect((0, math_1.invLerp)(x, y, ratio)).toBe(result); | ||
]; | ||
examples.forEach((example) => testExample(...example)); | ||
examples.forEach((example) => testTan(...example)); | ||
}); |
{ | ||
"name": "@opendesign/octopus-common", | ||
"version": "3.0.0-rc.33", | ||
"version": "3.0.0-rc.34", | ||
"description": "General utility functions for Octopus 3 common cases.", | ||
@@ -16,3 +16,3 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@opendesign/octopus-ts": "3.0.2", | ||
"@opendesign/octopus-ts": "3.0.1", | ||
"@types/lodash": "^4.14.178", | ||
@@ -19,0 +19,0 @@ "@types/uuid": "^8.3.1", |
45590
41
909
+ Added@opendesign/octopus-ts@3.0.1(transitive)
- Removed@opendesign/octopus-ts@3.0.2(transitive)
Updated@opendesign/octopus-ts@3.0.1