Socket
Socket
Sign inDemoInstall

include-folder

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

include-folder - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

include-folder.sublime-project

7

lib/include-folder.js

@@ -44,2 +44,5 @@ /*

function stripExtension(fileName) {
if (fileName.charAt(0) === ".")
fileName = fileName.substring(1);
return fileName.replace(/\.[^/.]+$/, "");

@@ -73,3 +76,5 @@ }

includeFolder._testHook = {
buildSource: buildSource
buildSource: buildSource,
normalize: normalize,
stripExtension: stripExtension
};

@@ -76,0 +81,0 @@

2

package.json
{
"name": "include-folder",
"description": "expose the content of each file in a folder as an object property.",
"version": "0.5.0",
"version": "0.6.0",
"homepage": "https://github.com/parroit/include-folder",

@@ -6,0 +6,0 @@ "author": {

@@ -8,8 +8,29 @@ 'use strict';

describe("include_folder", function () {
it("is defined", function () {
describe("normalize", function() {
it("handles .DS_Store",function() {
var normalized = includeFolder._testHook.normalize(".DS_Store");
expect(normalized).to.be.equal("DS_Store");
});
});
describe("stripExtension", function() {
it("remove extension",function() {
var normalized = includeFolder._testHook.stripExtension("test.txt");
expect(normalized).to.be.equal("test");
});
it("handles hidden files",function() {
var normalized = includeFolder._testHook.stripExtension(".txt");
expect(normalized).to.be.equal("txt");
});
});
describe("include_folder", function() {
it("is defined", function() {
expect(includeFolder).to.be.an('function');
});
it("has test hook", function () {
it("has test hook", function() {
expect(includeFolder._testHook).to.be.an('object');

@@ -19,3 +40,3 @@ });

function moduleCheck(folderModule) {
it("is an object", function () {
it("is an object", function() {
expect(folderModule).to.be.an('object');

@@ -25,19 +46,19 @@ });

it("has a property for each file", function () {
expect(_.keys(folderModule).length).to.be.equal(3);
it("has a property for each file", function() {
expect(_.keys(folderModule).length).to.be.equal(4);
});
it("extension is stripped from file names", function () {
it("extension is stripped from file names", function() {
expect("file1" in folderModule).to.be.equal(true);
});
it("duplicated file names properties are incremented", function () {
it("duplicated file names properties are incremented", function() {
expect("file1_1" in folderModule).to.be.equal(true);
});
it("properties names are normalized", function () {
it("properties names are normalized", function() {
expect("file3OtherFile" in folderModule).to.be.equal(true);
});
it("properties values are file content", function () {
it("properties values are file content", function() {
expect(folderModule.file1).to.be.equal("this is file1 content");

@@ -47,6 +68,9 @@ });

describe ("generated source code",function(){
var source = includeFolder._testHook.buildSource("./test/files"),
folderModule = (new Function("require","__dirname",source))(require,__dirname+"/files/");
describe("generated source code", function() {
var source,
folderModule;
source = includeFolder._testHook.buildSource("./test/files"),
console.log(source)
folderModule = (new Function("require", "__dirname", source))(require, __dirname + "/files/");

@@ -56,5 +80,6 @@ moduleCheck(folderModule);

describe ("returned object",function(){
describe("returned object", function() {
var folderModule = includeFolder("./test/files");

@@ -61,0 +86,0 @@

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