JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 78
  • Score
    100M100P100Q48311F
  • License MIT

Package Exports

  • gb2312-hex
  • gb2312-hex/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gb2312-hex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

按ieee754标准进行10进制和16进制的互相转换

import { encodeToGb2312HexList, decodeFromGb2312HexList } from 'gb2312-hex';
const txt = `
    我爱你中国...
    Abcd12345.
    拉  ¡  拉
`;
console.log(encodeToGb2312HexList(txt)); 
/* 
 [
  '0A', '20', '20', '20', '20', '20', '20',
  '20', '20', 'CE', 'D2', 'B0', 'AE', 'C4',
  'E3', 'D6', 'D0', 'B9', 'FA', '2E', '2E',
  '2E', '0A', '20', '20', '20', '20', '20',
  '20', '20', '20', '41', '62', '63', '64',
  '31', '32', '33', '34', '35', '2E', '0A',
  '20', '20', '20', '20', '20', '20', '20',
  '20', 'C0', 'AD', '20', '20', '20', '20',
  'C0', 'AD', '0A', '20', '20', '20', '20'
]
*/ 
console.log(decodeFromGb2312HexList(encodeToGb2312HexList(txt)));
/* 

        我爱你中国...
        Abcd12345.
        拉  ¡  拉

*/