Socket
Socket
Sign inDemoInstall

abbrev-kindof

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

abbrev-kindof - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

CHANGELOG.md

27

index.js

@@ -8,21 +8,20 @@ /**

'use strict';
'use strict'
var abbrev = require('map-types');
var kindOf = require('kind-of');
var abbrev = require('map-types')
var kindOf = require('kind-of')
module.exports = function abbrevKindof(val, type) {
var abbrs = abbrev(type);
var len = abbrs.length;
var i = -1;
module.exports = function abbrevKindof (val, type) {
var abbrs = abbrev(type)
var len = abbrs.length
var i = -1
while (i < len) {
i = i + 1;
type = abbrs[i];
var next = abbrs[i + 1];
while (i++ < len) {
type = abbrs[i]
var next = abbrs[i + 1]
if (next) {
return !(val && kindOf(val) !== type && kindOf(val) !== next);
return !(val && kindOf(val) !== type && kindOf(val) !== next)
}
return !(val && kindOf(val) !== type);
return !(val && kindOf(val) !== type)
}
};
}
{
"name": "abbrev-kindof",
"version": "1.0.0",
"version": "1.0.1",
"description": "`kind-of` with single letter abbreviations to javascript native types, like `kindof(val, 'soa')` will return true if `val` is string, object or array.",
"scripts": {
"lint": "jshint index.js && jscs index.js --reporter inline",
"test": "node test.js",
"test-cov": "istanbul cover test.js",
"test-travis": "istanbul cover test.js --report lcovonly"
"test": "standard && node test.js",
"travis": "standard && istanbul cover test.js --report lcovonly"
},

@@ -41,3 +39,3 @@ "author": {

"type": "MIT",
"url": "https://github.com/tunnckoCore/abbrev-kindof/blob/master/license.md"
"url": "https://github.com/tunnckoCore/abbrev-kindof/blob/master/LICENSE.md"
},

@@ -50,4 +48,5 @@ "dependencies": {

"assertit": "^0.1.0",
"istanbul-harmony": "~0.3.1"
"istanbul": "^0.3.9",
"standard": "^3.7.3"
}
}
}

@@ -8,25 +8,25 @@ /**

'use strict';
'use strict'
var test = require('assertit');
var abbrevKindof = require('./index');
var test = require('assertit')
var abbrevKindof = require('./index')
test('abbrev-kindof:', function() {
test('should work with single abbrev', function(done) {
test.equal(abbrevKindof(123, 's'), false);
test.equal(abbrevKindof(123, 'n'), true);
done();
});
test('should work with multiple abbrevs', function(done) {
var foobar_object = {foo: 'bar'};
var foobar_regexp = /(foo|bar)/g;
var foobar_string = 'foo bar';
var foobar_array = ['foo', 'bar'];
test('abbrev-kindof:', function () {
test('should work with single abbrev', function (done) {
test.equal(abbrevKindof(123, 's'), false)
test.equal(abbrevKindof(123, 'n'), true)
done()
})
test('should work with multiple abbrevs', function (done) {
var foobar_object = {foo: 'bar'}
var foobar_regexp = /(foo|bar)/g
var foobar_string = 'foo bar'
var foobar_array = ['foo', 'bar']
test.equal(abbrevKindof(foobar_object, 'sa'), false);
test.equal(abbrevKindof(foobar_regexp, 'sa'), false);
test.equal(abbrevKindof(foobar_string, 'sa'), true);
test.equal(abbrevKindof(foobar_array, 'sa'), true);
done();
});
});
test.equal(abbrevKindof(foobar_object, 'sa'), false)
test.equal(abbrevKindof(foobar_regexp, 'sa'), false)
test.equal(abbrevKindof(foobar_string, 'sa'), true)
test.equal(abbrevKindof(foobar_array, 'sa'), true)
done()
})
})

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