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

kennitala

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kennitala - npm Package Compare versions

Comparing version 1.2.5 to 1.2.6

2

bower.json
{
"name": "kennitala",
"main": "dist/kennitala.min.js",
"version": "1.2.5",
"version": "1.2.6",
"homepage": "https://github.com/HermannBjorgvin/Kennitala",

@@ -6,0 +6,0 @@ "authors": [

@@ -1,2 +0,2 @@

!function(n,r){!function(){function n(n,r){var t=i(n);if(10!==t.length)return!1;if(r&&!r(t))return!1;var e=t.split("").reduce(function(n,r,t){return n+r*f[t]},0),a=11-e%11,u=parseInt(t.substr(8,1),0);return 11==a&&0===u||a===u}function r(n){var r=parseInt(n.substr(0,2),10);return r>0&&r<=31}function t(n){var r=parseInt(n.substr(0,2),10);return r>40&&r<=71}function e(n,t){function e(n){var t=""+Math.floor(10*Math.random()),a=""+Math.floor(10*Math.random());r(n)&&(t=""+Math.floor(8*Math.random()+2));for(var u=n+t+a,i=0,o=0;o<8;o++)i+=u[o]*f[o];return i=11-i%11,i=11==i?0:i,10==i?e(n):t+a+i}var a="",u=n.getDate();u<10&&(u="0"+u),u=""+u,u=t(u),a+=u;var i=n.getMonth();i+=1,i<10&&(i="0"+i),i=""+i,a+=i;var o=n.getFullYear();return o=""+o,o=o[2]+o[3],a+=o,a+=e(a),o=n.getFullYear(),o=""+o,a+=o[1]}function a(n){return n}function u(n){return""+(parseInt(n,10)+40)}function i(n){var r=""+n;return r=r.replace(/(\D)+/g,"")}var o={};o.isValid=function(e){var a=n(e,r),u=n(e,t);return a||u},o.isPerson=function(t){return n(t,r)},o.isCompany=function(r){return n(r,t)},o.clean=function(n){return i(n)},o.format=function(n,r){var t=i(n);return r=void 0!==r?r:"-",t=t.substring(0,6)+r+t.substring(6,10)},o.generatePerson=function(n){return e(n,a)},o.generateCompany=function(n){return e(n,u)},o.info=function(e){var a={};a.kt=i(e);var u=n(e,r),o=n(e,t);if(u||o){a.valid=!0,a.type=!0===u?"person":"company";var f=i(e),s=f.substring(0,2);s>31&&(s-=40);var c=f.substring(2,4),l=(0==f.substring(9,10)?20:19)+f.substring(4,6),v=new Date(l,c-1,s);a.birthday=v,a.birthdayReadable=v.toDateString();var d=new Date,g=d.getFullYear(),p=new Date(v);p.setFullYear(g);var m=g-v.getFullYear();return p>d&&m--,m<0?m+=100:m=m<1?(d.getTime()-v.getTime())/1e3/60/60/24/365.2422:m,a.age=m,a}return a.valid=!1,a};var f=[3,2,7,6,5,4,3,2,0,0];"undefined"!=typeof module&&module.exports?module.exports=o:"function"==typeof define&&define.amd?define(o):window&&(window.kennitala=o)}(),r[""]=n}({},function(){return this}());
!function(r,n){!function(){function r(r,n){var t=i(r);if(10!==t.length)return!1;if(n&&!n(t))return!1;var e=t.split("").reduce(function(r,n,t){return r+n*s[t]},0),a=11-e%11,u=parseInt(t.substr(8,1),0);return 11==a&&0===u||a===u}function n(r){var n=parseInt(r.substr(0,2),10),t=parseInt(r.substr(2,2),10);return n>0&&n<=31&&t>0&&t<=12}function t(r){var n=parseInt(r.substr(0,2),10),t=parseInt(r.substr(2,2),10);return n>40&&n<=71&&t>0&&t<=12}function e(r,t){function e(r){var t=""+Math.floor(10*Math.random()),a=""+Math.floor(10*Math.random());n(r)&&(t=""+Math.floor(8*Math.random()+2));for(var u=r+t+a,i=0,o=0;o<8;o++)i+=u[o]*s[o];return i=11-i%11,i=11==i?0:i,10==i?e(r):t+a+i}var a="",u=r.getDate();u<10&&(u="0"+u),u=""+u,u=t(u),a+=u;var i=r.getMonth();i+=1,i<10&&(i="0"+i),i=""+i,a+=i;var o=r.getFullYear();return o=""+o,o=o[2]+o[3],a+=o,a+=e(a),o=r.getFullYear(),o=""+o,a+=o[1]}function a(r){return r}function u(r){return""+(parseInt(r,10)+40)}function i(r){var n=""+r;return n=n.replace(/(\D)+/g,"")}var o={};o.isValid=function(e){var a=r(e,n),u=r(e,t);return a||u},o.isPerson=function(t){return r(t,n)},o.isCompany=function(n){return r(n,t)},o.clean=function(r){return i(r)},o.format=function(r,n){var t=i(r);return n=void 0!==n?n:"-",t=t.substring(0,6)+n+t.substring(6,10)},o.generatePerson=function(r){return e(r,a)},o.generateCompany=function(r){return e(r,u)},o.info=function(e){var a={};a.kt=i(e);var u=r(e,n),o=r(e,t);if(u||o){a.valid=!0,a.type=!0===u?"person":"company";var s=i(e),f=s.substring(0,2);f>31&&(f-=40);var c=s.substring(2,4),l=(0==s.substring(9,10)?20:19)+s.substring(4,6),v=new Date(l,c-1,f);a.birthday=v,a.birthdayReadable=v.toDateString();var d=new Date,g=d.getFullYear(),p=new Date(v);p.setFullYear(g);var b=g-v.getFullYear();return p>d&&b--,b<0?b+=100:b=b<1?(d.getTime()-v.getTime())/1e3/60/60/24/365.2422:b,a.age=b,a}return a.valid=!1,a};var s=[3,2,7,6,5,4,3,2,0,0];"undefined"!=typeof module&&module.exports?module.exports=o:"function"==typeof define&&define.amd?define(o):window&&(window.kennitala=o)}(),n[""]=r}({},function(){return this}());
//# sourceMappingURL=kennitala.min.js.map

@@ -152,4 +152,5 @@ (function(){

var d = parseInt(kt.substr(0, 2), 10);
var m = parseInt(kt.substr(2, 2), 10);
return d > 0 && d <= 31;
return d > 0 && d <= 31 && m > 0 && m <= 12;
}

@@ -160,4 +161,5 @@

var d = parseInt(kt.substr(0, 2), 10);
var m = parseInt(kt.substr(2, 2), 10);
return d > 40 && d <= 71;
return d > 40 && d <= 71 && m > 0 && m <= 12;
}

@@ -164,0 +166,0 @@

{
"name": "kennitala",
"version": "1.2.5",
"version": "1.2.6",
"description": "Icelandic social security number (kennitölur) utilities for servers and clients",

@@ -18,3 +18,2 @@ "main": "dist/kennitala.min.js",

},
"dependencies": {},
"devDependencies": {

@@ -21,0 +20,0 @@ "chai": "*",

@@ -17,2 +17,6 @@ var kennitala = require('../kennitala.js');

});
it("should not validate kennitala with 13th month", function () {
kennitala.isPerson('1337991337').should.equal(false);
});
});

@@ -43,2 +47,2 @@

});
});
});

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