Skip to content

Commit 49846cb

Browse files
committed
refactor: refactor phc api
1 parent 303f3f5 commit 49846cb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/phc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const NAME_RE = /^[\da-z-]{1,32}$/,
1111
String.raw`$` );
1212

1313
// public
14-
export function encode ( { id, version, params, salt, hash, defaultParams, sortParams } = {} ) {
14+
export function toPhc ( { id, version, params, salt, hash, defaultParams, sortParams } = {} ) {
1515
if ( !NAME_RE.test( id ) ) throw "ID must be in the kebab-case";
1616

1717
var string = "$" + id;
@@ -100,7 +100,7 @@ export function encode ( { id, version, params, salt, hash, defaultParams, sortP
100100
return string;
101101
}
102102

103-
export function decode ( string, { defaultParams, decodeSalt = true, decodeHash = true } = {} ) {
103+
export function fromPhc ( string, { defaultParams, decodeSalt = true, decodeHash = true } = {} ) {
104104
const match = string.match( PHC_RE );
105105
if ( !match ) throw "PHC string is not valid";
106106

0 commit comments

Comments
 (0)