@frui.ts/helpers
Advanced tools
Comparing version 1.0.0-alpha.8 to 1.0.0-alpha.9
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function bound(target, propertyKey, descriptor) { | ||
var fn = descriptor.value; | ||
const fn = descriptor.value; | ||
if (typeof fn !== "function") { | ||
throw new Error("@bound decorator can only be applied to methods, not " + typeof fn); | ||
throw new Error(`@bound decorator can only be applied to methods, not ${typeof fn}`); | ||
} | ||
var definingProperty = false; | ||
let definingProperty = false; | ||
return { | ||
configurable: true, | ||
get: function () { | ||
get() { | ||
if (definingProperty || this === target.prototype || Object.prototype.hasOwnProperty.call(this, propertyKey)) { | ||
return fn; | ||
} | ||
var boundFn = fn.bind(this); | ||
const boundFn = fn.bind(this); | ||
definingProperty = true; | ||
@@ -17,0 +17,0 @@ Object.defineProperty(this, propertyKey, { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function combineClassNames(class1, class2, class3, class4) { | ||
var result = class1; | ||
let result = class1; | ||
if (class2) { | ||
@@ -6,0 +6,0 @@ result = result ? result + " " + class2 : class2; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function createMap(source, keySelector, valueSelector) { | ||
var getValue = valueSelector !== null && valueSelector !== void 0 ? valueSelector : (function (x) { return x; }); | ||
var result = new Map(); | ||
source.forEach(function (x) { return result.set(keySelector(x), getValue(x)); }); | ||
const getValue = valueSelector !== null && valueSelector !== void 0 ? valueSelector : ((x) => x); | ||
const result = new Map(); | ||
source.forEach(x => result.set(keySelector(x), getValue(x))); | ||
return result; | ||
@@ -8,0 +8,0 @@ } |
"use strict"; | ||
var __values = (this && this.__values) || function(o) { | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function groupBy(collection, selector) { | ||
var e_1, _a; | ||
var result = new Map(); | ||
try { | ||
for (var collection_1 = __values(collection), collection_1_1 = collection_1.next(); !collection_1_1.done; collection_1_1 = collection_1.next()) { | ||
var item = collection_1_1.value; | ||
var key = selector(item); | ||
var bucket = result.get(key); | ||
if (bucket) { | ||
bucket.push(item); | ||
} | ||
else { | ||
result.set(key, [item]); | ||
} | ||
const result = new Map(); | ||
for (const item of collection) { | ||
const key = selector(item); | ||
const bucket = result.get(key); | ||
if (bucket) { | ||
bucket.push(item); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (collection_1_1 && !collection_1_1.done && (_a = collection_1.return)) _a.call(collection_1); | ||
else { | ||
result.set(key, [item]); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
@@ -37,0 +15,0 @@ return result; |
@@ -12,39 +12,37 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var mobx_1 = require("mobx"); | ||
var ManualPromise = (function () { | ||
function ManualPromise() { | ||
var _this = this; | ||
const mobx_1 = require("mobx"); | ||
class ManualPromise { | ||
constructor() { | ||
this.status = "new"; | ||
this.promise = new Promise(function (resolve, reject) { | ||
_this.resolveCallback = resolve; | ||
_this.rejectCallback = reject; | ||
this.promise = new Promise((resolve, reject) => { | ||
this.resolveCallback = resolve; | ||
this.rejectCallback = reject; | ||
}); | ||
} | ||
ManualPromise.prototype.resolve = function (result) { | ||
resolve(result) { | ||
this.resolveCallback(result); | ||
this.status = "resolved"; | ||
}; | ||
ManualPromise.prototype.reject = function (reason) { | ||
} | ||
reject(reason) { | ||
this.rejectCallback(reason); | ||
this.status = "rejected"; | ||
}; | ||
__decorate([ | ||
mobx_1.observable, | ||
__metadata("design:type", String) | ||
], ManualPromise.prototype, "status", void 0); | ||
__decorate([ | ||
mobx_1.action.bound, | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], ManualPromise.prototype, "resolve", null); | ||
__decorate([ | ||
mobx_1.action.bound, | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], ManualPromise.prototype, "reject", null); | ||
return ManualPromise; | ||
}()); | ||
} | ||
} | ||
__decorate([ | ||
mobx_1.observable, | ||
__metadata("design:type", String) | ||
], ManualPromise.prototype, "status", void 0); | ||
__decorate([ | ||
mobx_1.action.bound, | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], ManualPromise.prototype, "resolve", null); | ||
__decorate([ | ||
mobx_1.action.bound, | ||
__metadata("design:type", Function), | ||
__metadata("design:paramtypes", [Object]), | ||
__metadata("design:returntype", void 0) | ||
], ManualPromise.prototype, "reject", null); | ||
exports.default = ManualPromise; | ||
//# sourceMappingURL=manualPromise.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.nameof = void 0; | ||
var nameof = function (name) { return name; }; | ||
const nameof = (name) => name; | ||
exports.nameof = nameof; | ||
//# sourceMappingURL=nameof.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ensureObservableProperty = void 0; | ||
var mobx_1 = require("mobx"); | ||
const mobx_1 = require("mobx"); | ||
function ensureObservableProperty(target, property, value) { | ||
@@ -6,0 +6,0 @@ if (!(0, mobx_1.isObservable)(target)) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isMap = exports.isSet = void 0; | ||
var mobx_1 = require("mobx"); | ||
const mobx_1 = require("mobx"); | ||
function isSet(item) { | ||
@@ -6,0 +6,0 @@ return !!item && (item instanceof Set || (0, mobx_1.isObservableSet)(item)); |
@@ -6,3 +6,3 @@ { | ||
}, | ||
"version": "1.0.0-alpha.8", | ||
"version": "1.0.0-alpha.9", | ||
"description": "Frui.ts helper functions", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "e774efd68e7bd49b83461fdcae0d110c2b69da90" | ||
"gitHead": "718298c96617555dd2121f87a2dfefb3ea16d039" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25258
232