File size: 444 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import type { UserLicenseApi, UserLicense } from './types';

export const mapSingleLicenseApiToLicense = ( license: UserLicenseApi ): UserLicense => ( {
	licenseKey: license.license_key,
	product: license.product,
	productId: license.product_id,
	subscriptionId: license.subscription_id,
} );

export const mapManyLicenseApiToLicense = ( licenses: UserLicenseApi[] ): UserLicense[] => {
	return licenses.map( mapSingleLicenseApiToLicense );
};