Selaa lähdekoodia

babel ES6 code

pull/342/head
Guillaume Vincent 8 vuotta sitten
vanhempi
commit
345b6f58a5
2 muutettua tiedostoa jossa 17 lisäystä ja 18 poistoa
  1. +6
    -3
      package.json
  2. +11
    -15
      tests/node.js

+ 6
- 3
package.json Näytä tiedosto

@@ -3,14 +3,16 @@
"version": "4.0.3",
"author": "Guillaume Vincent <guillaume@oslab.fr>",
"description": "LessPass javascript module to generate idempotent passwords",
"main": "index",
"main": "lib/index.js",
"jsnext:main": "index.js",
"repository": "lesspass/core",
"homepage": "https://github.com/lesspass/core#readme",
"bugs": "https://github.com/lesspass/core/issues",
"scripts": {
"test-node": "cd tests && babel-node --presets es2015 node.js && cd ..",
"test": "ava --require babel-core/register",
"prepublish": "npm test"
"build": "rimraf lib && babel index.js -d lib",
"prepublish": "npm test && npm run build"
},
"keywords": [
"password",
@@ -22,7 +24,8 @@
"ava": "^0.16.0",
"babel-cli": "^6.16.0",
"babel-core": "^6.17.0",
"babel-preset-es2015": "^6.16.0"
"babel-preset-es2015": "^6.16.0",
"rimraf": "^2.5.4"
},
"babel": {
"presets": [


+ 11
- 15
tests/node.js Näytä tiedosto

@@ -1,10 +1,10 @@
import lesspass from '../index';
import assert from 'assert';
var lesspass = require('../lib/index');
var assert = require('assert');

const site = 'lesspass.com';
const login = 'contact@lesspass.com';
const masterPassword = 'password';
const options = {
var site = 'lesspass.com';
var login = 'contact@lesspass.com';
var masterPassword = 'password';
var options = {
counter: 1,
length: 12,
lowercase: true,
@@ -12,12 +12,8 @@ const options = {
numbers: true,
symbols: true
};
lesspass.encryptLogin(login, masterPassword)
.then(encryptedLogin => {
var generatedPassword = lesspass.renderPassword(encryptedLogin, site, options);
assert.equal(generatedPassword, 'azYS7,olOL2]');
console.log('test node ES6 ok');
})
.catch(err => {
console.log(err);
});

lesspass.encryptLogin(login, masterPassword).then(function (encryptedLogin) {
var generatedPassword = lesspass.deriveEncryptedLogin(encryptedLogin, site, options);
assert(generatedPassword, 'azYS7,olOL2]');
});

Ladataan…
Peruuta
Tallenna