Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

widget-loader

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

widget-loader - npm Package Compare versions

Comparing version 0.3.0 to 1.0.0

4

index.js

@@ -1,3 +0,3 @@

"use strict"
// load main lib
module.exports = require('./lib/loader');
module.exports = require('./lib/loader');
"use strict";
const _ = require('lodash');
const sequence = require('when/sequence');
const path = require('path');

@@ -11,4 +9,2 @@ const fs = require('fs');

module.exports = function (App, opts) {

@@ -34,3 +30,3 @@

// Check for an actual class, catch just use whatever was returned
if (_.isFunction(AppClass)) {
if (typeof AppClass === 'function') {
app = new AppClass();

@@ -116,5 +112,5 @@ } else {

function sortWidgets (widgetCollection) {
let widgetPositions = _.keys(widgetCollection);
let widgetPositions = Object.keys(widgetCollection);
_.each(widgetPositions, function (key) {
widgetPositions.forEach(function (key) {
widgetCollection[key].sort(function (obj1, obj2) {

@@ -142,3 +138,3 @@ return obj1.config.order - obj2.config.order;

// filter and get widgets for only this specific page
filteredWidgets = _.filter(WidgetCollection, function (widget) {
filteredWidgets = WidgetCollection.filter(function (widget) {
return widget.config.active && matchRoute(widget.config.routes, req.path);

@@ -148,3 +144,3 @@ });

// execute widget request and extract return data
widgetOps = _.map(filteredWidgets, function (widget) {
widgetOps = filteredWidgets.map(function (widget) {
return function () {

@@ -165,3 +161,3 @@ return widget.exec(App)

if (!_.isArray(CurrentWidgetCollection[position])) {
if (!Array.isArray(CurrentWidgetCollection[position])) {
CurrentWidgetCollection[position] = [];

@@ -182,3 +178,3 @@ }

// when widgets are loaded, continue
sequence(widgetOps)
Promise.all(widgetOps)
.then(function () {

@@ -185,0 +181,0 @@ //console.timeEnd('middlware');

{
"name": "widget-loader",
"version": "0.3.0",
"version": "1.0.0",
"description": "Widget loader for WidGet CMS",

@@ -28,5 +28,3 @@ "main": "index.js",

"dependencies": {
"ghost-sandbox": "^0.1.1",
"lodash": "^4.13.1",
"when": "^3.7.3"
"ghost-sandbox": "^1.0.0"
},

@@ -33,0 +31,0 @@ "devDependencies": {

"use strict";
const config = require('./config.json');
const when = require('when');

@@ -9,3 +8,3 @@ module.exports.config = config;

module.exports.exec = function (App) {
return when(null);
return Promise.resolve(null);
};
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