Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@58fe/58tjfrom-util

Package Overview
Dependencies
Maintainers
11
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@58fe/58tjfrom-util - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

dist/main.js

@@ -1,1 +0,1 @@

!function(e,o){if("object"==typeof exports&&"object"==typeof module)module.exports=o();else if("function"==typeof define&&define.amd)define([],o);else{var r=o();for(var t in r)("object"==typeof exports?exports:e)[t]=r[t]}}(global,(function(){return e={667:(e,o,r)=>{var t=r(73);e.exports=function(e,o){if(e)if("string"==typeof e){if("Object"==t.getDataType(o)){var r={slot_name:e},s={v:1,t:2,r:{},w:{slot_from:o&&Object.assign(o,r)||Object.assign({},r)}};return`${e}__${JSON.stringify(s)}`}console.error("slotFrom不是json格式")}else console.error("slot值不是字符串");else console.error("未传slot值")}},37:(e,o,r)=>{var t=r(73),s=r(667);e.exports=function(e,o){if(e)if("Object"==t.getDataType(o)){var r=e.split("__");if(r.length<=1)console.warn("tjfrom格式可能有误");else try{var n=JSON.parse(r[r.length-1]);if(n&&n.w){var{slot_from:f}=n.w;if(o.slot_name=r[0],f){var a=Object.assign(f,o);n.w.slot_from=a}else console.warn("tjfrom中取不到slot_from"),n.w.slot_from=o;return r[r.length-1]=JSON.stringify(n),r.join("__")}return s(r[0],o)}catch(e){console.warn("tjfrom中的slotFrom格式有误")}}else console.error("slotFrom不是json格式");else console.error("未接收到tjfrom值")}},138:(e,o,r)=>{e.exports={createTJFrom:r(667),updateTJFrom:r(37)}},73:e=>{e.exports={getDataType:function(e){return e instanceof Array?"Array":e instanceof Object?"Object":"param is no object type"}}}},o={},function r(t){var s=o[t];if(void 0!==s)return s.exports;var n=o[t]={exports:{}};return e[t](n,n.exports,r),n.exports}(138);var e,o}));
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(global,(function(){return e={575:function(e){"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global&&global,e.exports=function(){"use strict";const e="3.6.1",t="function"==typeof atob,r="function"==typeof btoa,o="function"==typeof Buffer,n="function"==typeof TextDecoder?new TextDecoder:void 0,a="function"==typeof TextEncoder?new TextEncoder:void 0,i=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],f=(e=>{let t={};return e.forEach(((e,r)=>t[e]=r)),t})(i),s=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),u="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,t=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(t)),l=e=>e.replace(/[+\/]/g,(e=>"+"==e?"-":"_")).replace(/=+$/m,""),d=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),p=e=>{let t,r,o,n,a="";const f=e.length%3;for(let f=0;f<e.length;){if((r=e.charCodeAt(f++))>255||(o=e.charCodeAt(f++))>255||(n=e.charCodeAt(f++))>255)throw new TypeError("invalid character found");t=r<<16|o<<8|n,a+=i[t>>18&63]+i[t>>12&63]+i[t>>6&63]+i[63&t]}return f?a.slice(0,f-3)+"===".substring(f):a},h=r?e=>btoa(e):o?e=>Buffer.from(e,"binary").toString("base64"):p,y=o?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,o=e.length;r<o;r+=4096)t.push(c.apply(null,e.subarray(r,r+4096)));return h(t.join(""))},b=(e,t=!1)=>t?l(y(e)):y(e),g=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?c(192|t>>>6)+c(128|63&t):c(224|t>>>12&15)+c(128|t>>>6&63)+c(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return c(240|t>>>18&7)+c(128|t>>>12&63)+c(128|t>>>6&63)+c(128|63&t)},A=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,m=e=>e.replace(A,g),x=o?e=>Buffer.from(e,"utf8").toString("base64"):a?e=>y(a.encode(e)):e=>h(m(e)),w=(e,t=!1)=>t?l(x(e)):x(e),B=e=>w(e,!0),v=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,j=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return c(55296+(t>>>10))+c(56320+(1023&t));case 3:return c((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return c((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},_=e=>e.replace(v,j),C=e=>{if(e=e.replace(/\s+/g,""),!s.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r,o,n="";for(let a=0;a<e.length;)t=f[e.charAt(a++)]<<18|f[e.charAt(a++)]<<12|(r=f[e.charAt(a++)])<<6|(o=f[e.charAt(a++)]),n+=64===r?c(t>>16&255):64===o?c(t>>16&255,t>>8&255):c(t>>16&255,t>>8&255,255&t);return n},E=t?e=>atob(d(e)):o?e=>Buffer.from(e,"base64").toString("binary"):C,F=o?e=>u(Buffer.from(e,"base64")):e=>u(E(e),(e=>e.charCodeAt(0))),O=e=>F(U(e)),S=o?e=>Buffer.from(e,"base64").toString("utf8"):n?e=>n.decode(F(e)):e=>_(E(e)),U=e=>d(e.replace(/[-_]/g,(e=>"-"==e?"+":"/"))),D=e=>S(U(e)),T=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),J=function(){const e=(e,t)=>Object.defineProperty(String.prototype,e,T(t));e("fromBase64",(function(){return D(this)})),e("toBase64",(function(e){return w(this,e)})),e("toBase64URI",(function(){return w(this,!0)})),e("toBase64URL",(function(){return w(this,!0)})),e("toUint8Array",(function(){return O(this)}))},N=function(){const e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,T(t));e("toBase64",(function(e){return b(this,e)})),e("toBase64URI",(function(){return b(this,!0)})),e("toBase64URL",(function(){return b(this,!0)}))},R={version:e,VERSION:"3.6.1",atob:E,atobPolyfill:C,btoa:h,btoaPolyfill:p,fromBase64:D,toBase64:w,encode:w,encodeURI:B,encodeURL:B,utob:m,btou:_,decode:D,isValid:e=>{if("string"!=typeof e)return!1;const t=e.replace(/\s+/g,"").replace(/=+$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},fromUint8Array:b,toUint8Array:O,extendString:J,extendUint8Array:N,extendBuiltins:()=>{J(),N()},Base64:{}};return Object.keys(R).forEach((e=>R.Base64[e]=R[e])),R}()},667:(e,t,r)=>{var{getDataType:o,base64Encode:n}=r(73);e.exports=function(e,t){try{if(!e)throw new Error("未传slot值");if("string"!=typeof e)throw new Error("slot值不是字符串");if("Object"!=o(t))throw new Error("slotFrom不是json格式");var r={slot_name:e},a={v:1,t:2,r:{},w:{slot_from:t&&Object.assign({},t,r)}};return`${e}__${n(JSON.stringify(a))}`}catch(e){console.error(e)}}},37:(e,t,r)=>{var{getDataType:o,isJSON:n,base64Decode:a,base64Encode:i}=r(73),f=r(667);e.exports=function(e,t){try{if(!e)throw new Error("未接收到tjfrom值");if(!t)throw new Error("未接收到slotFrom值");if("Object"!=o(t))throw new Error("slotFrom不是json格式");var r=e.split("__");if(r.length<=1)throw new Error("tjfrom格式有误");const l=a(r[r.length-1]);if(!n(l)){const e=f(r[0],t).split("__")[1];return r.push(e),r.join("__")}var s=JSON.parse(l);if(s&&s.w){var{slot_from:c}=s.w;if(t.slot_name=r[0],c){var u=Object.assign(c,t);s.w.slot_from=u}else s.w.slot_from=t;return r[r.length-1]=i(JSON.stringify(s)),r.join("__")}return s.w={slot_from:t},r[r.length-1]=i(JSON.stringify(s)),r.join("__")}catch(e){console.error(e)}}},138:(e,t,r)=>{e.exports={createTJFrom:r(667),updateTJFrom:r(37)}},73:(e,t,r)=>{const{Base64:o}=r(575);e.exports={isJSON:function(e){if("string"==typeof e)try{var t=JSON.parse(e);return console.log("转换成功:"+t),!0}catch(e){return!1}else new Error(e+" is not a string!")},getDataType:function(e){return e instanceof Array?"Array":e instanceof Object?"Object":"param is no object type"},base64Encode:function(e){return o.encode(e)},base64Decode:function(e){return o.decode(e)}}}},t={},function r(o){var n=t[o];if(void 0!==n)return n.exports;var a=t[o]={exports:{}};return e[o].call(a.exports,a,a.exports,r),a.exports}(138);var e,t}));
{
"name": "@58fe/58tjfrom-util",
"version": "1.0.0",
"version": "1.0.1",
"description": "provide create or update 58tjfrom util.",

@@ -25,3 +25,6 @@ "keywords": [

"webpack-cli": "^4.7.2"
},
"dependencies": {
"js-base64": "^3.6.1"
}
}
}

@@ -1,2 +0,1 @@

# 提供创建或更新58tjfrom工具方法

@@ -12,3 +11,3 @@ ![npm version](https://img.shields.io/npm/v/@58fe/58tjfrom-util.svg?style=flat-square&logo=npm)

## 使用
> 该工具包提供2个工具方法,分别是创建tjfrom(createTJFrom),和生成tjfrom(updateTJFrom)
> 该工具包提供2个工具方法,分别是创建tjfrom(createTJFrom),和更新tjfrom(updateTJFrom)

@@ -24,8 +23,9 @@ ### createTJFrom

#### ex:
#### eg:
```js
const { createTJFrom } = require("@58fe/58tjfrom-util");
const slot = "jl";
const slotFrom = {'jl_qd': 1, 'jl_hd': 2};
const slot = "jianli";
const slotFrom = {"jl_hd": 'huodong', "jl_qd": 812};
createTJFrom(slot, slotFrom)
// jianli__eyJ2IjoxLCJ0IjoyLCJyIjp7fSwidyI6eyJzbG90X2Zyb20iOnsiamxfaGQiOiJodW9kb25nIiwiamxfcWQiOjgxMiwic2xvdF9uYW1lIjoiamlhbmxpIn19fQ==
```

@@ -35,2 +35,3 @@

> 在`tjfrom`中追加`slotFrom`并生成新的`tjfrom`
#### 参数

@@ -42,8 +43,14 @@ |参数|说明|类型|默认值|备注

#### ex:
#### eg:
```js
const { updateTJFrom } = require("@58fe/58tjfrom-util");
const tjfrom = "slot__{...}";
const newSlotFrom = {};
updateTJFrom(tjfrom, newSlotFrom)
const tjfrom = "lm_list_cpt__adtypes__1__null__c61a1b93-1a94-4757-b482-da8c6602cadf";
const slotFrom = {jl_hd: "chaozhiji", jl_qd: 93};
updateTJFrom(tjfrom, slotFrom)
// lm_list_cpt__adtypes__1__null__c61a1b93-1a94-4757-b482-da8c6602cadf__eyJ2IjoxLCJ0IjoyLCJyIjp7fSwidyI6eyJzbG90X2Zyb20iOnsiamxfaGQiOiJjaGFvemhpamkiLCJqbF9xZCI6OTMsInNsb3RfbmFtZSI6ImxtX2xpc3RfY3B0In19fQ==
```
## npm发包:
```bash
npm publish --access public
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc