'use strict'; var AmeMiniFunc; (function (AmeMiniFunc) { class Some { constructor(value) { this.value = value; } get() { return this.value; } isDefined() { return true; } isEmpty() { return false; } nonEmpty() { return true; } map(f) { return new Some(f(this.value)); } flatMap(f) { return f(this.value); } filter(f) { return f(this.value) ? this : AmeMiniFunc.none; } forEach(f) { f(this.value); } orElse(alternative) { return this; } getOrElse(alternative) { return this.value; } toArray() { return [this.value]; } orNull() { return this.value; } } class None { map(f) { return this; } get() { throw new Error('Cannot get value from None'); } isDefined() { return false; } isEmpty() { return true; } nonEmpty() { return false; } filter(f) { return this; } forEach(f) { } orElse(alternative) { return alternative(); } getOrElse(alternative) { return alternative(); } orNull() { return null; } flatMap(f) { return this; } toArray() { return []; } } AmeMiniFunc.none = new None(); function some(value) { return new Some(value); } AmeMiniFunc.some = some; function lift(options, f) { const areAllDefined = options.every((opt) => opt.isDefined()); if (areAllDefined) { const unwrappedValues = options.map((opt) => opt.get()); return some(f(...unwrappedValues)); } else { return AmeMiniFunc.none; } } AmeMiniFunc.lift = lift; //endregion //region Either class Either { map(f) { if (this.isRight()) { return new Right(f(this.value)); } else { return this; //Should be safe. } } flatMap(f) { if (this.isRight()) { return f(this.value); } else { return this; } } toOption() { if (this.isRight()) { return some(this.value); } else { return AmeMiniFunc.none; } } static left(value) { return new Left(value); } static right(value) { return new Right(value); } } AmeMiniFunc.Either = Either; class Left extends Either { constructor(value) { super(); this.value = value; } isLeft() { return true; } isRight() { return false; } getOrElse(defaultValue) { return defaultValue(); } } AmeMiniFunc.Left = Left; class Right extends Either { constructor(value) { super(); this.value = value; } isLeft() { return false; } isRight() { return true; } getOrElse(defaultValue) { return this.value; } } AmeMiniFunc.Right = Right; //endregion //region Misc function sanitizeNumericString(str) { if (str === '') { return ''; } let sanitizedString = str //Replace commas with periods. .replace(/,/g, '.') //Remove all non-numeric characters. .replace(/[^0-9.-]/g, '') //Remove all but the last period. .replace(/\.(?=.*\.)/g, ''); //Keep a minus sign only if it's the first character. Remove all other occurrences. const hasMinusSign = (sanitizedString.charAt(0) === '-'); sanitizedString = sanitizedString.replace(/-/g, ''); if (hasMinusSign) { sanitizedString = '-' + sanitizedString; } return sanitizedString; } AmeMiniFunc.sanitizeNumericString = sanitizeNumericString; function forEachObjectKey(collection, callback) { for (const k in collection) { if (!collection.hasOwnProperty(k)) { continue; } callback(k, collection[k]); } } AmeMiniFunc.forEachObjectKey = forEachObjectKey; //endregion })(AmeMiniFunc || (AmeMiniFunc = {})); //# sourceMappingURL=mini-func.js.map
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
actor-manager.js | File | 32.62 KB | 0644 |
|
actor-manager.js.map | File | 24.64 KB | 0644 |
|
actor-manager.ts | File | 32.81 KB | 0644 |
|
admin-helpers.js | File | 2.78 KB | 0644 |
|
common.d.ts | File | 2.72 KB | 0644 |
|
jquery-json.d.ts | File | 109 B | 0644 |
|
jquery.biscuit.d.ts | File | 455 B | 0644 |
|
jquery.biscuit.js | File | 5.37 KB | 0644 |
|
jquery.color.d.ts | File | 5.06 KB | 0644 |
|
jquery.d.ts | File | 146.39 KB | 0644 |
|
jquery.form.d.ts | File | 804 B | 0644 |
|
jquery.form.js | File | 40.93 KB | 0644 |
|
jquery.json.js | File | 5.13 KB | 0644 |
|
jquery.qtip.js | File | 100.34 KB | 0644 |
|
jquery.qtip.min.js | File | 43.23 KB | 0644 |
|
jquery.sort.js | File | 1.92 KB | 0644 |
|
jqueryui.d.ts | File | 77.89 KB | 0644 |
|
knockout-sortable.js | File | 22.49 KB | 0644 |
|
knockout.d.ts | File | 42.65 KB | 0644 |
|
knockout.js | File | 66.65 KB | 0644 |
|
lazyload.d.ts | File | 10.2 KB | 0644 |
|
lazyload.min.js | File | 8.1 KB | 0644 |
|
lodash4.min.js | File | 71.54 KB | 0644 |
|
menu-editor.d.ts | File | 662 B | 0644 |
|
menu-editor.js | File | 185.29 KB | 0644 |
|
menu-highlight-fix.js | File | 11.12 KB | 0644 |
|
mini-func.js | File | 4.75 KB | 0644 |
|
mini-func.js.map | File | 4.1 KB | 0644 |
|
mini-func.ts | File | 5.02 KB | 0644 |
|
tab-utils.js | File | 2.25 KB | 0644 |
|