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

dekko

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dekko - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

17

index.js

@@ -8,7 +8,12 @@ 'use strict';

function Dekko(pattern, options) {
const filenames = glob.sync(pattern, options);
if (filenames.length === 0) {
throw new Error(`There is not file that matches pattern \`${pattern}.\``);
if (Array.isArray(pattern) && !options) {
// Private
this.filenames = pattern;
} else {
const filenames = glob.sync(pattern, options);
if (filenames.length === 0) {
throw new Error(`There is not file that matches pattern \`${pattern}\`.`);
}
this.filenames = filenames;
}
this.filenames = filenames;
}

@@ -52,2 +57,6 @@

},
filter(cond) {
const filenames = this.filenames.filter(cond);
return new Dekko(filenames);
},
});

@@ -54,0 +63,0 @@

{
"name": "dekko",
"version": "0.1.0",
"version": "0.2.0",
"description": "To test whether files and directory structure are valid.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -59,4 +59,8 @@ # dekko

### .filter(cond): Object
`.filter` works like `Array.prototype.filter`, and it return a new `dekko` object with filtered items.
## License
MIT

@@ -76,2 +76,9 @@ 'use strict';

});
describe('#filter', () => {
it('should work like Array.prototype.filter', () => {
const o = $('test/fixtures/*').filter(filename => /a$/.test(filename));
assert.deepEqual(o.filenames, [ 'test/fixtures/a' ]);
});
});
});
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