@platform/util.value
Advanced tools
Comparing version 0.9.10 to 0.9.13
@@ -1,1 +0,1 @@ | ||
export * from './dispose'; | ||
export * from './Dispose'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./dispose"), exports); | ||
tslib_1.__exportStar(require("./Dispose"), exports); |
@@ -23,7 +23,7 @@ "use strict"; | ||
var _events$ = new rxjs_1.Subject(); | ||
var events$ = _events$.pipe(operators_1.takeUntil(dispose$), operators_1.share()); | ||
var changing$ = events$.pipe(operators_1.filter(function (e) { return e.type === 'PROP/setting'; }), operators_1.map(function (e) { return e.payload; }), operators_1.share()); | ||
var changed$ = events$.pipe(operators_1.filter(function (e) { return e.type === 'PROP/set'; }), operators_1.map(function (e) { return e.payload; }), operators_1.share()); | ||
var events$ = _events$.pipe((0, operators_1.takeUntil)(dispose$), (0, operators_1.share)()); | ||
var changing$ = events$.pipe((0, operators_1.filter)(function (e) { return e.type === 'PROP/setting'; }), (0, operators_1.map)(function (e) { return e.payload; }), (0, operators_1.share)()); | ||
var changed$ = events$.pipe((0, operators_1.filter)(function (e) { return e.type === 'PROP/set'; }), (0, operators_1.map)(function (e) { return e.payload; }), (0, operators_1.share)()); | ||
var obj = { | ||
$: { dispose$: dispose$.pipe(operators_1.share()), events$: events$ }, | ||
$: { dispose$: dispose$.pipe((0, operators_1.share)()), events$: events$ }, | ||
changing$: changing$, | ||
@@ -30,0 +30,0 @@ changed$: changed$, |
import * as t from '@platform/types'; | ||
import { Subject } from 'rxjs'; | ||
import { Pump } from './rx.pump'; | ||
declare type E = t.Event; | ||
export declare function bus<T extends E = E>(input?: Subject<any> | t.EventBus<any>): t.EventBus<T>; | ||
export declare function isBus(input: any): boolean; | ||
export declare function busAsType<T extends E>(bus: t.EventBus<any>): t.EventBus<T>; | ||
declare type BusFactory = <T extends E = E>(input?: Subject<any> | t.EventBus<any>) => t.EventBus<T>; | ||
declare type Bus = BusFactory & { | ||
isBus(input: any): boolean; | ||
asType<T extends E>(bus: t.EventBus<any>): t.EventBus<T>; | ||
instance(bus: t.EventBus<any>): string; | ||
pump: typeof Pump; | ||
}; | ||
export declare const bus: Bus; | ||
export {}; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.busAsType = exports.isBus = exports.bus = void 0; | ||
var util_is_1 = require("@platform/util.is"); | ||
exports.bus = void 0; | ||
var rxjs_1 = require("rxjs"); | ||
var operators_1 = require("rxjs/operators"); | ||
var id_1 = require("../id"); | ||
var rx_event_1 = require("./rx.event"); | ||
function bus(input) { | ||
if (isBus(input)) | ||
var rx_bus_util_1 = require("./rx.bus.util"); | ||
var rx_pump_1 = require("./rx.pump"); | ||
var factory = function (input) { | ||
if ((0, rx_bus_util_1.isBus)(input)) | ||
return input; | ||
var subject$ = input || new rxjs_1.Subject(); | ||
var res = { | ||
$: subject$.pipe(operators_1.filter(function (e) { return rx_event_1.isEvent(e); })), | ||
$: subject$.pipe((0, operators_1.filter)(function (e) { return (0, rx_event_1.isEvent)(e); })), | ||
fire: function (e) { return subject$.next(e); }, | ||
}; | ||
res._instance = "bus.".concat(id_1.id.slug()); | ||
return res; | ||
} | ||
exports.bus = bus; | ||
function isBus(input) { | ||
if (typeof input !== 'object' || input === null) | ||
return false; | ||
return util_is_1.is.observable(input.$) && typeof input.fire === 'function'; | ||
} | ||
exports.isBus = isBus; | ||
function busAsType(bus) { | ||
return bus; | ||
} | ||
exports.busAsType = busAsType; | ||
}; | ||
factory.isBus = rx_bus_util_1.isBus; | ||
factory.asType = rx_bus_util_1.busAsType; | ||
factory.instance = rx_bus_util_1.instance; | ||
factory.pump = rx_pump_1.Pump; | ||
exports.bus = factory; |
@@ -1,4 +0,9 @@ | ||
export * from './rx.event'; | ||
import { Observable, Subject, BehaviorSubject } from 'rxjs'; | ||
export { Observable, Subject, BehaviorSubject }; | ||
export { Pump as pump } from './rx.pump'; | ||
export * from './rx.bus'; | ||
export * from './rx.bus.util'; | ||
export * from './rx.debounce'; | ||
export * from './rx.bus'; | ||
export * from './rx.disposable'; | ||
export * from './rx.event'; | ||
export * from './rx.promise'; |
@@ -7,5 +7,5 @@ "use strict"; | ||
if (debounce === void 0) { debounce = 0; } | ||
var shared$ = ob$.pipe(operators_1.publishReplay(1), operators_1.refCount()); | ||
return shared$.pipe(operators_1.buffer(shared$.pipe(operators_1.debounceTime(debounce)))); | ||
var shared$ = ob$.pipe((0, operators_1.publishReplay)(1), (0, operators_1.refCount)()); | ||
return shared$.pipe((0, operators_1.buffer)(shared$.pipe((0, operators_1.debounceTime)(debounce)))); | ||
} | ||
exports.debounceBuffer = debounceBuffer; |
@@ -1,3 +0,4 @@ | ||
import { IDisposable } from '@platform/types'; | ||
import { Observable } from 'rxjs'; | ||
export declare function disposable(until$?: Observable<any>): IDisposable; | ||
import { Disposable } from '@platform/types'; | ||
import { Observable, Subject } from 'rxjs'; | ||
export declare function disposable(until$?: Observable<any> | Observable<any>[]): Disposable; | ||
export declare function done(dispose$: Subject<void>): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.disposable = void 0; | ||
exports.done = exports.disposable = void 0; | ||
var dispose_1 = require("../dispose"); | ||
function disposable(until$) { | ||
return dispose_1.dispose.create(until$); | ||
return dispose_1.Dispose.create(until$); | ||
} | ||
exports.disposable = disposable; | ||
function done(dispose$) { | ||
dispose_1.Dispose.done(dispose$); | ||
} | ||
exports.done = done; |
@@ -6,7 +6,7 @@ "use strict"; | ||
function event(ob$, type) { | ||
return ob$.pipe(operators_1.filter(function (e) { return e.type === type; }), operators_1.map(function (e) { return e; })); | ||
return ob$.pipe((0, operators_1.filter)(function (e) { return e.type === type; }), (0, operators_1.map)(function (e) { return e; })); | ||
} | ||
exports.event = event; | ||
function payload(ob$, type) { | ||
return ob$.pipe(operators_1.filter(function (e) { return e.type === type; }), operators_1.map(function (e) { return e.payload; })); | ||
return ob$.pipe((0, operators_1.filter)(function (e) { return e.type === type; }), (0, operators_1.map)(function (e) { return e.payload; })); | ||
} | ||
@@ -13,0 +13,0 @@ exports.payload = payload; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.pump = exports.BehaviorSubject = exports.Subject = exports.Observable = void 0; | ||
var tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./rx.event"), exports); | ||
var rxjs_1 = require("rxjs"); | ||
Object.defineProperty(exports, "Observable", { enumerable: true, get: function () { return rxjs_1.Observable; } }); | ||
Object.defineProperty(exports, "Subject", { enumerable: true, get: function () { return rxjs_1.Subject; } }); | ||
Object.defineProperty(exports, "BehaviorSubject", { enumerable: true, get: function () { return rxjs_1.BehaviorSubject; } }); | ||
var rx_pump_1 = require("./rx.pump"); | ||
Object.defineProperty(exports, "pump", { enumerable: true, get: function () { return rx_pump_1.Pump; } }); | ||
tslib_1.__exportStar(require("./rx.bus"), exports); | ||
tslib_1.__exportStar(require("./rx.bus.util"), exports); | ||
tslib_1.__exportStar(require("./rx.debounce"), exports); | ||
tslib_1.__exportStar(require("./rx.bus"), exports); | ||
tslib_1.__exportStar(require("./rx.disposable"), exports); | ||
tslib_1.__exportStar(require("./rx.event"), exports); | ||
tslib_1.__exportStar(require("./rx.promise"), exports); |
@@ -47,3 +47,3 @@ "use strict"; | ||
return new Promise(function (resolve) { | ||
msecs.pipe(operators_1.take(1)).subscribe(function () { return resolve(); }); | ||
msecs.pipe((0, operators_1.take)(1)).subscribe(function () { return resolve(); }); | ||
}); | ||
@@ -50,0 +50,0 @@ } |
@@ -8,6 +8,6 @@ import * as t from './types'; | ||
static to: { | ||
sec: (msec: number, precision?: number | undefined) => number; | ||
min: (msec: number, precision?: number | undefined) => number; | ||
hour: (msec: number, precision?: number | undefined) => number; | ||
day: (msec: number, precision?: number | undefined) => number; | ||
sec: (msec: number, precision?: number) => number; | ||
min: (msec: number, precision?: number) => number; | ||
hour: (msec: number, precision?: number) => number; | ||
day: (msec: number, precision?: number) => number; | ||
date: (input: t.DateInput) => Date; | ||
@@ -14,0 +14,0 @@ }; |
@@ -27,17 +27,17 @@ "use strict"; | ||
case 'msec': | ||
return msec + "ms"; | ||
return "".concat(msec, "ms"); | ||
case 's': | ||
case 'sec': | ||
return to.sec(msec, round) + "s"; | ||
return "".concat(to.sec(msec, round), "s"); | ||
case 'm': | ||
case 'min': | ||
return to.min(msec, round) + "m"; | ||
return "".concat(to.min(msec, round), "m"); | ||
case 'h': | ||
case 'hour': | ||
return to.hour(msec, round) + "h"; | ||
return "".concat(to.hour(msec, round), "h"); | ||
case 'd': | ||
case 'day': | ||
return to.day(msec, round) + "d"; | ||
return "".concat(to.day(msec, round), "d"); | ||
default: | ||
throw new Error("Unit '" + unit + "' not supported "); | ||
throw new Error("Unit '".concat(unit, "' not supported ")); | ||
} | ||
@@ -53,3 +53,3 @@ }; | ||
var matchedDigits = input.match(/(\d*\.?)\d*/); | ||
var digits = matchedDigits && matchedDigits[0] ? value_to_1.toNumber(matchedDigits[0]) : -1; | ||
var digits = matchedDigits && matchedDigits[0] ? (0, value_to_1.toNumber)(matchedDigits[0]) : -1; | ||
if (digits < 0) { | ||
@@ -138,6 +138,6 @@ return done(-1); | ||
Duration.to = { | ||
sec: function (msec, precision) { return value_math_1.round(msec / 1000, precision); }, | ||
min: function (msec, precision) { return value_math_1.round(msec / 1000 / 60, precision); }, | ||
hour: function (msec, precision) { return value_math_1.round(msec / 1000 / 60 / 60, precision); }, | ||
day: function (msec, precision) { return value_math_1.round(msec / 1000 / 60 / 60 / 24, precision); }, | ||
sec: function (msec, precision) { return (0, value_math_1.round)(msec / 1000, precision); }, | ||
min: function (msec, precision) { return (0, value_math_1.round)(msec / 1000 / 60, precision); }, | ||
hour: function (msec, precision) { return (0, value_math_1.round)(msec / 1000 / 60 / 60, precision); }, | ||
day: function (msec, precision) { return (0, value_math_1.round)(msec / 1000 / 60 / 60 / 24, precision); }, | ||
date: function (input) { return day(input).toDate(); }, | ||
@@ -144,0 +144,0 @@ }; |
@@ -18,4 +18,7 @@ "use strict"; | ||
utc: utc_1.utc, | ||
get timezone() { | ||
return Intl.DateTimeFormat().resolvedOptions().timeZone; | ||
}, | ||
get now() { | ||
return utc_1.utc(); | ||
return (0, utc_1.utc)(); | ||
}, | ||
@@ -22,0 +25,0 @@ duration: function (msec, options) { |
@@ -26,2 +26,3 @@ /// <reference types="node" /> | ||
now: IDate; | ||
timezone: string; | ||
utc(input?: Date | number): IDate; | ||
@@ -28,0 +29,0 @@ timer(start?: Date, options?: { |
export * from '@platform/types/lib/types.json'; | ||
export * from './props/types'; | ||
export * from './time/types'; |
@@ -6,1 +6,2 @@ "use strict"; | ||
tslib_1.__exportStar(require("./props/types"), exports); | ||
tslib_1.__exportStar(require("./time/types"), exports); |
@@ -18,3 +18,4 @@ "use strict"; | ||
} | ||
if (prot.hasOwnProperty('isPrototypeOf') === false) { | ||
var hasOwnPropery = prot.hasOwnProperty('isPrototypeOf'); | ||
if (hasOwnPropery === false) { | ||
return false; | ||
@@ -55,3 +56,3 @@ } | ||
} | ||
if (Array.isArray(value) && value_array_1.compact(value).length === 0) { | ||
if (Array.isArray(value) && (0, value_array_1.compact)(value).length === 0) { | ||
return true; | ||
@@ -119,2 +120,2 @@ } | ||
exports.isEmail = isEmail; | ||
var emailRegEx = new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/); | ||
var emailRegEx = new RegExp(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/); |
@@ -34,6 +34,6 @@ "use strict"; | ||
else { | ||
path = path ? path + "." + key : key; | ||
path = path ? "".concat(path, ".").concat(key) : key; | ||
var level = current[key] !== undefined ? current[key] : {}; | ||
if (!common_1.R.is(Object, level)) { | ||
throw new Error("Cannot build object '" + keyPath + "' as it will overwrite value '" + level + "' at '" + path + "'."); | ||
throw new Error("Cannot build object '".concat(keyPath, "' as it will overwrite value '").concat(level, "' at '").concat(path, "'.")); | ||
} | ||
@@ -84,3 +84,3 @@ current[key] = tslib_1.__assign({}, level); | ||
if (isWildcard(key) && !isDeepest) { | ||
throw new Error("Wild card can only be used at end of path (error: '" + keyPath + "')"); | ||
throw new Error("Wild card can only be used at end of path (error: '".concat(keyPath, "')")); | ||
} | ||
@@ -109,3 +109,3 @@ var shouldDelete = false; | ||
default: | ||
throw new Error("Type '" + type + "' not supported."); | ||
throw new Error("Type '".concat(type, "' not supported.")); | ||
} | ||
@@ -140,5 +140,5 @@ } | ||
if (keyPath.startsWith('.') || keyPath.endsWith('.')) { | ||
throw new Error("The keyPath cannot start or end with a period (.): \"" + keyPath + "\""); | ||
throw new Error("The keyPath cannot start or end with a period (.): \"".concat(keyPath, "\"")); | ||
} | ||
return value_array_1.compact(keyPath.replace(/\s/g, '').split('.')); | ||
return (0, value_array_1.compact)(keyPath.replace(/\s/g, '').split('.')); | ||
} |
@@ -30,5 +30,5 @@ "use strict"; | ||
function plural(count, singular, plural) { | ||
plural = plural ? plural : singular + "s"; | ||
plural = plural ? plural : "".concat(singular, "s"); | ||
return count === 1 || count === -1 ? singular : plural; | ||
} | ||
exports.plural = plural; |
{ | ||
"name": "@platform/util.value", | ||
"version": "0.9.10", | ||
"version": "0.9.13", | ||
"description": "Helpers for working with, transforming, and formatting values.", | ||
@@ -15,11 +15,11 @@ "main": "lib/index", | ||
"dependencies": { | ||
"@platform/libs": "0.2.14", | ||
"@platform/types": "0.5.25", | ||
"@platform/util.is": "0.0.162", | ||
"@platform/libs": "0.3.2", | ||
"@platform/types": "0.5.27", | ||
"@platform/util.is": "0.0.165", | ||
"cuid": "2.1.8", | ||
"dayjs": "1.10.6" | ||
"dayjs": "1.11.4" | ||
}, | ||
"devDependencies": { | ||
"@platform/test": "0.2.10", | ||
"@platform/ts": "4.1.23" | ||
"@platform/test": "0.3.2", | ||
"@platform/ts": "4.7.7" | ||
}, | ||
@@ -26,0 +26,0 @@ "files": [ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
145971
114
3503
1
+ Added@platform/libs@0.3.2(transitive)
+ Added@platform/types@0.5.27(transitive)
+ Added@platform/util.is@0.0.165(transitive)
+ Added@types/ramda@0.28.15(transitive)
+ Addeddayjs@1.11.4(transitive)
+ Addedramda@0.28.0(transitive)
+ Addedrxjs@7.5.6(transitive)
+ Addedtslib@2.6.3(transitive)
- Removed@platform/libs@0.2.14(transitive)
- Removed@platform/types@0.5.25(transitive)
- Removed@platform/util.is@0.0.162(transitive)
- Removed@types/ramda@0.27.44(transitive)
- Removeddayjs@1.10.6(transitive)
- Removedramda@0.27.1(transitive)
- Removedrxjs@7.3.0(transitive)
- Removedtslib@2.1.0(transitive)
Updated@platform/libs@0.3.2
Updated@platform/types@0.5.27
Updated@platform/util.is@0.0.165
Updateddayjs@1.11.4