New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lanurite

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lanurite - npm Package Compare versions

Comparing version 1.0.26 to 1.0.27

11

example/test.js

@@ -29,3 +29,12 @@ /**

collection.on("reset", function () {
getCollectionDOM();
});
getCollectionDOM();
function getCollectionDOM() {
document.getElementById("collection").innerHTML = "";
});
collection.each((el) => {
document.getElementById("collection").innerHTML += el.get("name") + "<br>"
});
}

2

package.json

@@ -26,3 +26,3 @@ {

"typings": "src/lanurite.d.ts",
"version": "1.0.26",
"version": "1.0.27",
"license": "MIT",

@@ -29,0 +29,0 @@ "repository": {

@@ -19,2 +19,3 @@ import * as _ from "lodash";

if (this._isModel(object)) {
console.log("old model")
return this._models[object.get("l_id")] = object

@@ -38,3 +39,3 @@ }

if (!_.isUndefined(this._models[model.get("l_id")])) {
this._models[model.get("l_id")] = undefined;
delete this._models[model.get("l_id")]
this.trigger("remove", model);

@@ -52,15 +53,12 @@ return true

clear() {
this._clearCollection();
this.trigger("clear");
Object.keys(this._models).forEach((key) => {
this._models[key] = undefined;
})
}
filter(predicate: any): Array<any> {
return _.values(this._models).filter(predicate)
return this.getAll().filter(predicate)
}
map(predicate: any): Array<any> {
return _.values(this._models).map(predicate)
return this.getAll().map(predicate)
}

@@ -76,7 +74,7 @@

find(predicate: any, startIndex: number = 0): any {
return _.find(_.values(this._models), predicate, startIndex);
return _.find(this.getAll(), predicate, startIndex);
}
reduce(predicate: any, accum: any = 0): any {
return _.values(this._models).reduce(predicate, accum)
return this.getAll().reduce(predicate, accum)
}

@@ -92,2 +90,6 @@

each(predicate: any){
return this.getAll().forEach(predicate)
}
merge(collection: Array<any> | ICollection) {

@@ -110,9 +112,38 @@ if (_.isArray(collection)) {

reset(array: Array<any> = []) {
this._clearCollection();
this._init(array);
this.trigger("reset");
}
_clearCollection() {
Object.keys(this._models).forEach((key) => {
this._models[key] = undefined;
delete this._models[key]
});
}
this._init(array);
this.trigger("reset");
getLength(): number {
return Object.keys(this._models).length
}
toJSON(){
return this.map((el) =>{
return el.toJSON()
})
}
sortBy(predicate: any){
this.reset(this.getAll().sort(predicate))
}
toArray(): Array<any>{
return this.getAll()
}
chunk(size: number = 1): any{
return _.chunk(this.getAll(), size)
}
countBy(predicate: any){
return _.countBy(this.getAll(), predicate);
}
}

@@ -119,0 +150,0 @@

@@ -15,3 +15,3 @@ import * as _ from "lodash";

off(eventName: string) {
this._events[eventName] = undefined;
delete this._events[eventName];
}

@@ -18,0 +18,0 @@

@@ -10,3 +10,3 @@ import * as _ from "lodash";

super();
this._model = _.assign({}, {l_id: _.uniqueId("lr_"), collection: null}, obj)
this._model = _.assign({}, {l_id: _.uniqueId("lr_")}, obj)
}

@@ -34,3 +34,7 @@

toJSON(): any{
return _.clone(this._model);
}
}
export {Model}

@@ -17,2 +17,9 @@ import {IModel} from "./IModel";

reset(array: Array<any>): void
getLength(): number
each(predicate: any): void
toJSON(): any;
sortBy(predicate: any): any
toArray(): Array<any>
chunk(size: number): any
countBy(predicate: any): any
}

@@ -5,2 +5,3 @@ export interface IModel{

hasProperty(property: string | number): boolean
toJSON(): any
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc