New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dfinity/utils

Package Overview
Dependencies
Maintainers
10
Versions
916
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dfinity/utils - npm Package Compare versions

Comparing version

to
0.0.6-next-2022-11-10.1

2

dist/cjs/index.cjs.js

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

"use strict";var c=Object.defineProperty;var T=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var x=(t,r)=>{for(var e in r)c(t,e,{get:r[e],enumerable:!0})},U=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of b(r))!N.call(t,i)&&i!==e&&c(t,i,{get:()=>r[i],enumerable:!(n=T(r,i))||n.enumerable});return t};var I=t=>U(c({},"__esModule",{value:!0}),t);var F={};x(F,{NullishError:()=>s,arrayBufferToUint8Array:()=>h,arrayOfNumberToUint8Array:()=>V,asciiStringToByteArray:()=>B,assertNonNullish:()=>u,createAgent:()=>S,createServices:()=>O,defaultAgent:()=>p,fromDefinedNullable:()=>P,fromNullable:()=>y,principalToSubAccount:()=>_,smallerVersion:()=>D,toNullable:()=>C,uint8ArrayToArrayOfNumber:()=>R,uint8ArrayToBigInt:()=>w});module.exports=I(F);var f=require("@dfinity/agent");var o=require("@dfinity/agent"),p=()=>new o.HttpAgent({host:"https://ic0.app",identity:new o.AnonymousIdentity}),S=async({identity:t,host:r,fetchRootKey:e=!1})=>{let n=new o.HttpAgent({identity:t,...r!==void 0&&{host:r}});return e&&await n.fetchRootKey(),n};var O=({options:{canisterId:t,serviceOverride:r,certifiedServiceOverride:e,agent:n},idlFactory:i,certifiedIdlFactory:d})=>{let a=n??p(),l=r??f.Actor.createActor(i,{agent:a,canisterId:t}),g=e??f.Actor.createActor(d,{agent:a,canisterId:t});return{service:l,certifiedService:g,agent:a,canisterId:t}};var w=t=>{let r=new DataView(t.buffer,t.byteOffset,t.byteLength);if(typeof r.getBigUint64=="function")return r.getBigUint64(0);{let e=BigInt(r.getUint32(0)),n=BigInt(r.getUint32(4));return(e<<BigInt(32))+n}},h=t=>new Uint8Array(t),R=t=>Array.from(t),V=t=>new Uint8Array(t),B=t=>Array.from(t).map(r=>r.charCodeAt(0));var s=class extends Error{},u=(t,r)=>{if(t==null)throw new s(r)};var C=t=>t?[t]:[],y=t=>t==null?void 0:t[0],P=t=>{let r=y(t);return u(r),r};var _=t=>{let r=t.toUint8Array(),e=new Uint8Array(32);return e[0]=r.length,e.set(r,1),e};var m=(t,r)=>r>t.length?[...t,...[...Array(r-t.length).keys()].map(()=>0)]:t,A=t=>{if(!Number.isNaN(Number(t)))return Number(t);let r=t.split("").reduce((e,n)=>Number.isNaN(Number(n))?e:e+n,"");return Number(r)},D=({minVersion:t,currentVersion:r})=>{let e=m(t.split(".").map(A),3).join(".");return m(r.split(".").map(A),3).join(".").localeCompare(e,void 0,{numeric:!0,sensitivity:"base"})<0};0&&(module.exports={NullishError,arrayBufferToUint8Array,arrayOfNumberToUint8Array,asciiStringToByteArray,assertNonNullish,createAgent,createServices,defaultAgent,fromDefinedNullable,fromNullable,principalToSubAccount,smallerVersion,toNullable,uint8ArrayToArrayOfNumber,uint8ArrayToBigInt});
"use strict";var c=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var N=(t,r)=>{for(var e in r)c(t,e,{get:r[e],enumerable:!0})},x=(t,r,e,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of T(r))!U.call(t,i)&&i!==e&&c(t,i,{get:()=>r[i],enumerable:!(n=b(r,i))||n.enumerable});return t};var w=t=>x(c({},"__esModule",{value:!0}),t);var q={};N(q,{NullishError:()=>s,arrayBufferToUint8Array:()=>V,arrayOfNumberToUint8Array:()=>C,asciiStringToByteArray:()=>D,assertNonNullish:()=>y,bigIntToUint8Array:()=>B,createAgent:()=>I,createServices:()=>S,defaultAgent:()=>p,fromDefinedNullable:()=>_,fromNullable:()=>u,numberToUint8Array:()=>h,principalToSubAccount:()=>F,smallerVersion:()=>L,toNullable:()=>P,uint8ArrayToArrayOfNumber:()=>R,uint8ArrayToBigInt:()=>O});module.exports=w(q);var f=require("@dfinity/agent");var o=require("@dfinity/agent"),p=()=>new o.HttpAgent({host:"https://ic0.app",identity:new o.AnonymousIdentity}),I=async({identity:t,host:r,fetchRootKey:e=!1})=>{let n=new o.HttpAgent({identity:t,...r!==void 0&&{host:r}});return e&&await n.fetchRootKey(),n};var S=({options:{canisterId:t,serviceOverride:r,certifiedServiceOverride:e,agent:n},idlFactory:i,certifiedIdlFactory:g})=>{let a=n??p(),d=r??f.Actor.createActor(i,{agent:a,canisterId:t}),l=e??f.Actor.createActor(g,{agent:a,canisterId:t});return{service:d,certifiedService:l,agent:a,canisterId:t}};var O=t=>{let r=new DataView(t.buffer,t.byteOffset,t.byteLength);if(typeof r.getBigUint64=="function")return r.getBigUint64(0);{let e=BigInt(r.getUint32(0)),n=BigInt(r.getUint32(4));return(e<<BigInt(32))+n}},B=t=>{let r=new ArrayBuffer(8),e=new DataView(r);if(typeof e.setBigUint64=="function")e.setBigUint64(0,t);else{let n=Number(t>>BigInt(32)),i=Number(t&BigInt(4294967295));e.setUint32(0,n),e.setUint32(4,i)}return new Uint8Array(r)},h=t=>{let r=new DataView(new ArrayBuffer(8));for(let e=7;e>=0;--e)r.setUint8(e,t%256),t=t>>8;return new Uint8Array(r.buffer)},V=t=>new Uint8Array(t),R=t=>Array.from(t),C=t=>new Uint8Array(t),D=t=>Array.from(t).map(r=>r.charCodeAt(0));var s=class extends Error{},y=(t,r)=>{if(t==null)throw new s(r)};var P=t=>t?[t]:[],u=t=>t==null?void 0:t[0],_=t=>{let r=u(t);return y(r),r};var F=t=>{let r=t.toUint8Array(),e=new Uint8Array(32);return e[0]=r.length,e.set(r,1),e};var m=(t,r)=>r>t.length?[...t,...[...Array(r-t.length).keys()].map(()=>0)]:t,A=t=>{if(!Number.isNaN(Number(t)))return Number(t);let r=t.split("").reduce((e,n)=>Number.isNaN(Number(n))?e:e+n,"");return Number(r)},L=({minVersion:t,currentVersion:r})=>{let e=m(t.split(".").map(A),3).join(".");return m(r.split(".").map(A),3).join(".").localeCompare(e,void 0,{numeric:!0,sensitivity:"base"})<0};0&&(module.exports={NullishError,arrayBufferToUint8Array,arrayOfNumberToUint8Array,asciiStringToByteArray,assertNonNullish,bigIntToUint8Array,createAgent,createServices,defaultAgent,fromDefinedNullable,fromNullable,numberToUint8Array,principalToSubAccount,smallerVersion,toNullable,uint8ArrayToArrayOfNumber,uint8ArrayToBigInt});
//# sourceMappingURL=index.cjs.js.map

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

import{Actor as c}from"@dfinity/agent";import{AnonymousIdentity as d,HttpAgent as s}from"@dfinity/agent";var a=()=>new s({host:"https://ic0.app",identity:new d}),b=async({identity:t,host:r,fetchRootKey:e=!1})=>{let n=new s({identity:t,...r!==void 0&&{host:r}});return e&&await n.fetchRootKey(),n};var I=({options:{canisterId:t,serviceOverride:r,certifiedServiceOverride:e,agent:n},idlFactory:y,certifiedIdlFactory:m})=>{let i=n??a(),A=r??c.createActor(y,{agent:i,canisterId:t}),l=e??c.createActor(m,{agent:i,canisterId:t});return{service:A,certifiedService:l,agent:i,canisterId:t}};var O=t=>{let r=new DataView(t.buffer,t.byteOffset,t.byteLength);if(typeof r.getBigUint64=="function")return r.getBigUint64(0);{let e=BigInt(r.getUint32(0)),n=BigInt(r.getUint32(4));return(e<<BigInt(32))+n}},w=t=>new Uint8Array(t),h=t=>Array.from(t),R=t=>new Uint8Array(t),V=t=>Array.from(t).map(r=>r.charCodeAt(0));var o=class extends Error{},p=(t,r)=>{if(t==null)throw new o(r)};var P=t=>t?[t]:[],g=t=>t?.[0],_=t=>{let r=g(t);return p(r),r};var F=t=>{let r=t.toUint8Array(),e=new Uint8Array(32);return e[0]=r.length,e.set(r,1),e};var u=(t,r)=>r>t.length?[...t,...[...Array(r-t.length).keys()].map(()=>0)]:t,f=t=>{if(!Number.isNaN(Number(t)))return Number(t);let r=t.split("").reduce((e,n)=>Number.isNaN(Number(n))?e:e+n,"");return Number(r)},q=({minVersion:t,currentVersion:r})=>{let e=u(t.split(".").map(f),3).join(".");return u(r.split(".").map(f),3).join(".").localeCompare(e,void 0,{numeric:!0,sensitivity:"base"})<0};export{o as NullishError,w as arrayBufferToUint8Array,R as arrayOfNumberToUint8Array,V as asciiStringToByteArray,p as assertNonNullish,b as createAgent,I as createServices,a as defaultAgent,_ as fromDefinedNullable,g as fromNullable,F as principalToSubAccount,q as smallerVersion,P as toNullable,h as uint8ArrayToArrayOfNumber,O as uint8ArrayToBigInt};
import{Actor as p}from"@dfinity/agent";import{AnonymousIdentity as g,HttpAgent as a}from"@dfinity/agent";var c=()=>new a({host:"https://ic0.app",identity:new g}),T=async({identity:t,host:r,fetchRootKey:e=!1})=>{let n=new a({identity:t,...r!==void 0&&{host:r}});return e&&await n.fetchRootKey(),n};var w=({options:{canisterId:t,serviceOverride:r,certifiedServiceOverride:e,agent:n},idlFactory:i,certifiedIdlFactory:m})=>{let o=n??c(),A=r??p.createActor(i,{agent:o,canisterId:t}),l=e??p.createActor(m,{agent:o,canisterId:t});return{service:A,certifiedService:l,agent:o,canisterId:t}};var S=t=>{let r=new DataView(t.buffer,t.byteOffset,t.byteLength);if(typeof r.getBigUint64=="function")return r.getBigUint64(0);{let e=BigInt(r.getUint32(0)),n=BigInt(r.getUint32(4));return(e<<BigInt(32))+n}},O=t=>{let r=new ArrayBuffer(8),e=new DataView(r);if(typeof e.setBigUint64=="function")e.setBigUint64(0,t);else{let n=Number(t>>BigInt(32)),i=Number(t&BigInt(4294967295));e.setUint32(0,n),e.setUint32(4,i)}return new Uint8Array(r)},B=t=>{let r=new DataView(new ArrayBuffer(8));for(let e=7;e>=0;--e)r.setUint8(e,t%256),t=t>>8;return new Uint8Array(r.buffer)},h=t=>new Uint8Array(t),V=t=>Array.from(t),R=t=>new Uint8Array(t),C=t=>Array.from(t).map(r=>r.charCodeAt(0));var s=class extends Error{},f=(t,r)=>{if(t==null)throw new s(r)};var v=t=>t?[t]:[],d=t=>t?.[0],F=t=>{let r=d(t);return f(r),r};var q=t=>{let r=t.toUint8Array(),e=new Uint8Array(32);return e[0]=r.length,e.set(r,1),e};var u=(t,r)=>r>t.length?[...t,...[...Array(r-t.length).keys()].map(()=>0)]:t,y=t=>{if(!Number.isNaN(Number(t)))return Number(t);let r=t.split("").reduce((e,n)=>Number.isNaN(Number(n))?e:e+n,"");return Number(r)},E=({minVersion:t,currentVersion:r})=>{let e=u(t.split(".").map(y),3).join(".");return u(r.split(".").map(y),3).join(".").localeCompare(e,void 0,{numeric:!0,sensitivity:"base"})<0};export{s as NullishError,h as arrayBufferToUint8Array,R as arrayOfNumberToUint8Array,C as asciiStringToByteArray,f as assertNonNullish,O as bigIntToUint8Array,T as createAgent,w as createServices,c as defaultAgent,F as fromDefinedNullable,d as fromNullable,B as numberToUint8Array,q as principalToSubAccount,E as smallerVersion,v as toNullable,V as uint8ArrayToArrayOfNumber,S as uint8ArrayToBigInt};
//# sourceMappingURL=index.js.map
export declare const uint8ArrayToBigInt: (array: Uint8Array) => bigint;
export declare const bigIntToUint8Array: (value: bigint) => Uint8Array;
export declare const numberToUint8Array: (value: number) => Uint8Array;
export declare const arrayBufferToUint8Array: (buffer: ArrayBuffer) => Uint8Array;

@@ -3,0 +5,0 @@ export declare const uint8ArrayToArrayOfNumber: (array: Uint8Array) => Array<number>;

{
"name": "@dfinity/utils",
"version": "0.0.6-next-2022-11-10",
"version": "0.0.6-next-2022-11-10.1",
"description": "A collection of utilities and constants for NNS/SNS projects.",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

@@ -38,2 +38,4 @@ # utils-js

- [uint8ArrayToBigInt](#gear-uint8arraytobigint)
- [bigIntToUint8Array](#gear-biginttouint8array)
- [numberToUint8Array](#gear-numbertouint8array)
- [arrayBufferToUint8Array](#gear-arraybuffertouint8array)

@@ -84,2 +86,14 @@ - [uint8ArrayToArrayOfNumber](#gear-uint8arraytoarrayofnumber)

#### :gear: bigIntToUint8Array
| Function | Type |
| -------------------- | ------------------------------- |
| `bigIntToUint8Array` | `(value: bigint) => Uint8Array` |
#### :gear: numberToUint8Array
| Function | Type |
| -------------------- | ------------------------------- |
| `numberToUint8Array` | `(value: number) => Uint8Array` |
#### :gear: arrayBufferToUint8Array

@@ -86,0 +100,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet