UNPKG

uview-next

Version:

基于uView UI 2.0,110+高质量组件库,支持vue2和vue3,支持鸿蒙,支持多语言,搭配便捷工具助力,让开发更得心应手

21 lines (16 loc) 433 B
import { BINARIES } from './constants'; // Encode data string const encode = (data, structure, separator) => { let encoded = data .split('') .map((val, idx) => BINARIES[structure[idx]]) .map((val, idx) => val ? val[data[idx]] : ''); if (separator) { const last = data.length - 1; encoded = encoded.map((val, idx) => ( idx < last ? val + separator : val )); } return encoded.join(''); }; export default encode;