reactive-di
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -19,9 +19,19 @@ 'use strict'; | ||
var _BaseCollection = require('./utils/BaseCollection'); | ||
var _BaseCollection2 = _interopRequireDefault(_BaseCollection); | ||
var _merge = require('./utils/merge'); | ||
var _merge2 = _interopRequireDefault(_merge); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = { | ||
BaseCollection: _BaseCollection2.default, | ||
createPureStateDi: _createPureStateDi2.default, | ||
createAnnotations: _createAnnotations2.default, | ||
getFunctionName: _getFunctionName2.default | ||
getFunctionName: _getFunctionName2.default, | ||
merge: _merge2.default | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -38,10 +38,13 @@ 'use strict'; | ||
/*:: type MapFn<T, V> = (v: T, index?: number) => V;*/ | ||
/*:: type FilterFn<T> = (v: T, index?: number) => boolean;*/ | ||
/*:: type SortFn<T> = (a: T, b: T) => number;*/ | ||
/*:: type FindFn<T> = (element: T, index?: number, arr?: Array<T>, thisArg?: Object) => boolean;*/ | ||
/*:: export type Id = string;*/ | ||
/*:: export type CollectionItem = { | ||
id: Id; | ||
}*/ | ||
/*:: import type { | ||
Collection, | ||
Id, | ||
ItemRec, | ||
CollectionItem, // eslint-disable-line | ||
MapFn, | ||
SortFn, | ||
UpdateFn, | ||
FindFn, | ||
FilterFn | ||
} from '../interfaces/collectionInterfaces'*/ | ||
/*:: type DeletedItems<T> = {[id: Id]: [T, number]};*/ | ||
@@ -52,22 +55,2 @@ /*:: type CollectionRec<T> = { | ||
}*/ | ||
/*:: type UpdateFn<V> = (oldItem: V) => V;*/ | ||
/*:: type ItemRec = {};*/ | ||
/*:: export type Collection<Item: CollectionItem> = { | ||
length: number; | ||
createItem(rec: ItemRec): Item; | ||
fromArray(items: Array<ItemRec>): Collection<Item>; | ||
add(item: Item): Collection<Item>; | ||
remove(id: Id): Collection<Item>; | ||
softRemove(id: Id): Collection<Item>; | ||
restore(id: Id): Collection<Item>; | ||
get(id: Id): Item; | ||
set(id: Id, item: Item): Collection<Item>; | ||
update(id: Id, updateFn: UpdateFn<Item>): Collection<Item>; | ||
find(findFn: FindFn<Item>): Item; | ||
map<V>(mapFn: MapFn<Item, V>): Array<V>; // eslint-disable-line | ||
filter(filterFn: FilterFn<Item>): Collection<Item>; | ||
sort(sortFn: SortFn<Item>): Collection<Item>; | ||
toJS(): Array<Item>; | ||
toJSON(): string; | ||
}*/ | ||
@@ -107,7 +90,7 @@ | ||
for (var i = 0, l = oldItems.length; i < l; i++) { | ||
var _item = oldItems[i]; | ||
if (_item.id !== id) { | ||
items.push(_item); | ||
var item = oldItems[i]; | ||
if (item.id !== id) { | ||
items.push(item); | ||
} else { | ||
deleted[id] = [_item, i]; | ||
deleted[id] = [item, i]; | ||
} | ||
@@ -124,5 +107,5 @@ } | ||
for (var i = 0, l = recs.length; i < l; i++) { | ||
var _item2 /*: Item*/ = this.createItem(recs[i]); | ||
itemsMap[_item2.id] = _item2; | ||
items.push(_item2); | ||
var item /*: Item*/ = this.createItem(recs[i]); | ||
itemsMap[item.id] = item; | ||
items.push(item); | ||
} | ||
@@ -206,9 +189,9 @@ | ||
for (var i = 0, l = oldItems.length; i < l; i++) { | ||
var _item3 = oldItems[i]; | ||
if (_item3.id !== id) { | ||
items.push(_item3); | ||
var item = oldItems[i]; | ||
if (item.id !== id) { | ||
items.push(item); | ||
} else { | ||
isFound = true; | ||
var newItem /*: Item*/ = updateFn(_item3); | ||
if (_item3 !== newItem) { | ||
var newItem /*: Item*/ = updateFn(item); | ||
if (item !== newItem) { | ||
isChanged = true; | ||
@@ -273,2 +256,3 @@ } | ||
(BaseCollection.prototype /*: Object*/)[_iterator2.default] = function iterator() { | ||
// eslint-disable-line | ||
return { | ||
@@ -275,0 +259,0 @@ next: function next() { |
{ | ||
"name": "reactive-di", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Reactive dependency injection", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
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
333787
135
4008