Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "fast-lei", | ||
"version": "1.0.0", | ||
"description": "Javascript tool to validate or generate control key for Legal Entity Identifier", | ||
"main": "index.js", | ||
"version": "1.1.0", | ||
"description": "Validation and control key generation for Legal Entity Identifier", | ||
"main": "./src/lei.js", | ||
"types": "./src/lei.d.ts", | ||
"scripts": { | ||
"lint": "eslint .", | ||
"test": "mocha --recursive test", | ||
"test-coverage": "istanbul cover ./node_modules/mocha/bin/_mocha test" | ||
"lint": "node_modules/.bin/eslint .", | ||
"test": "node_modules/.bin/mocha --recursive test", | ||
"test-coverage": "node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha test" | ||
}, | ||
@@ -18,3 +19,7 @@ "repository": { | ||
"Legal Entity Identifier", | ||
"ISO 17422" | ||
"ISO 17422", | ||
"LEI validation", | ||
"validation", | ||
"checksum", | ||
"check digit" | ||
], | ||
@@ -37,7 +42,3 @@ "author": "E. Dumont", | ||
"mocha": "4.0.1" | ||
}, | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"dependencies": {} | ||
} | ||
} |
@@ -1,5 +0,9 @@ | ||
# luhn | ||
[![npm version](https://badge.fury.io/js/fast-lei.svg)](https://badge.fury.io/js/fast-lei) | ||
[![Build Status](https://travis-ci.org/EDumdum/lei-js.svg?branch=master)](https://travis-ci.org/EDumdum/lei-js) | ||
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/Edumdum/lei-js/master/LICENSE) | ||
Javascript tool to validate or generate control key for Legal Entity Identifier | ||
# LEI | ||
Validation and control key generation for [Legal Entity Identifier (LEI)](https://en.wikipedia.org/wiki/Legal_Entity_Identifier). | ||
## Usage | ||
@@ -22,26 +26,31 @@ | ||
### isValid | ||
### `isValid(value)` -> `Boolean` | ||
Check input value, must be not null, not undefined and of type string. | ||
Check requirements. | ||
Returns if the LEI check digits are valid. | ||
The stringified value must respect LEI format (/^[0-9A-Z]{18}[0-9]{2}$/). | ||
*Required* | ||
- Value must be not `Null` | ||
- Value must be of type `String` | ||
- Value must respect format `^[0-9A-Z]{20}$` | ||
Check the value againt modulo 97 and must be equals to 1. | ||
### `generate(value)` -> `String` | ||
Returns boolean. | ||
Check requirements. | ||
Returns the LEI check digit appended to the value. | ||
### generate | ||
*Required* | ||
- Value must be not `Null` | ||
- Value must be of type `String` | ||
- Value must respect format `^[0-9A-Z]{18}$` | ||
Check input value, must be not null, not undefined and of type string. | ||
### `getMod97(value)` -> `Number` | ||
The stringified value must respect LEI forma0 without ending control digits (/^[0-9A-Z]{18}$/). | ||
Does **NOT** check requirements. | ||
Returns the module 97 remainder. | ||
Returns input value with check digits appended at the end. | ||
**Note:** `getMod97(value) === 1` is equivalent to `isValid(value)`. You may want to use this method instead of `isValid` if you ensure argument requirements on your side. | ||
### getMod97 | ||
Compute modulo 97 remainder. | ||
Fast entry: you must ensure that given rawValue is not null or empty and respect format /^[0-9A-Z]{1,}$/. | ||
Note: Remainder cannot be directly used as check digits. To generate check digits, please refer to method generate. | ||
*Required* | ||
- Value must be not `Null` | ||
- Value must be of type `String` |
@@ -5,5 +5,9 @@ 'use strict'; | ||
/** | ||
* Check input value, must be not null, not undefined and of type string. | ||
* The stringified value must respect LEI format (/^[0-9A-Z]{18}[0-9]{2}$/). | ||
* Check the value againt modulo 97 and must be equals to 1. | ||
* Check requirements. | ||
* Returns if the LEI check digits are valid. | ||
* | ||
* Requirements: | ||
* - rawValue must be not `Null` | ||
* - rawValue must be of type `String` | ||
* - rawValue must respect format `^[0-9A-Z]{20}$` | ||
* | ||
@@ -23,6 +27,10 @@ * @param {*} rawValue | ||
/** | ||
* Check input value, must be not null, not undefined and of type string. | ||
* The stringified value must respect LEI forma0 without ending control digits (/^[0-9A-Z]{18}$/). | ||
* Returns input value with check digits appended at the end. | ||
* Check requirements. | ||
* Returns the LEI check digit appended to the value. | ||
* | ||
* Requirements: | ||
* - rawValue must be not `Null` | ||
* - rawValue must be of type `String` | ||
* - rawValue must respest format `^[0-9A-Z]{18}$` | ||
* | ||
* @param {*} rawValue | ||
@@ -41,9 +49,13 @@ */ | ||
/** | ||
* Compute modulo 97 remainder. | ||
* Does NOT check requirements. | ||
* Returns the module 97 remainder. | ||
* Note: | ||
* `getMod97(value) === 1` is equivalent to `isValid(value)`. | ||
* You may want to use this method instead of `isValid` if you ensure argument | ||
* requirements on your side. | ||
* | ||
* Fast entry: you must ensure that given rawValue is not null or empty and | ||
* respect format /^[0-9A-Z]{1,}$/ | ||
* Requirements | ||
* - rawValue must be not `Null` | ||
* - rawValue must be of type `String` | ||
* | ||
* Note: Remainder cannot be directly used as check digits. To generate check digits, please refer to method generate. | ||
* | ||
* @param {*} rawValue | ||
@@ -50,0 +62,0 @@ */ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
55
7843
6
122
1