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

alga-js

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alga-js - npm Package Compare versions

Comparing version 0.0.1-alpha4 to 0.0.1-alpha5

alga-js-logo.png

6

js/array/array.js

@@ -14,3 +14,4 @@ import {

show,
pagination
pagination,
sum
} from './arrayLib.js'

@@ -31,3 +32,4 @@

show,
pagination
pagination,
sum
}

@@ -10,2 +10,3 @@ import { insert } from './insertArray.js'

import { paginate, pages, show, pagination } from './paginateArray.js'
import { sum } from './sumArray.js'

@@ -25,3 +26,4 @@ export {

show,
pagination
pagination,
sum
}

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

const sort = (oriArr, sortStr) => {
const sort = (oriArr, sortStr = 'asc') => {
if(typeof oriArr !== 'object') return

@@ -6,6 +6,6 @@ if(typeof sortStr !== 'string') return

const newArray = Array.from(oriArr)
if(sortStr === 'asc') {
if(sortStr === 'desc') {
newArray.sort((a, b) => {
if(typeof a === 'number' && typeof b === 'number') {
return a - b
return b - a
} else if(typeof a === 'string' && typeof b === 'string') {

@@ -16,5 +16,5 @@ const propA = a.toLowerCase()

if(propA < propB) {
if(propB < propA) {
propRes = -1
} else if(propA > propB) {
} else if(propB > propA) {
propRes = 1

@@ -25,6 +25,6 @@ }

})
} else if(sortStr === 'desc') {
} else {
newArray.sort((a, b) => {
if(typeof a === 'number' && typeof b === 'number') {
return b - a
return a - b
} else if(typeof a === 'string' && typeof b === 'string') {

@@ -35,5 +35,5 @@ const propA = a.toLowerCase()

if(propB < propA) {
if(propA < propB) {
propRes = -1
} else if(propB > propA) {
} else if(propA > propB) {
propRes = 1

@@ -51,3 +51,3 @@ }

return (propStr, sortStr) => {
return (propStr, sortStr = 'asc') => {
if(typeof propStr !== 'string') return

@@ -57,6 +57,6 @@ if(typeof sortStr !== 'string') return

const newArray = Array.from(oriArr)
if(sortStr === 'asc') {
if(sortStr === 'desc') {
newArray.sort((a, b) => {
if(propStr in a && propStr in b && typeof a[propStr] === 'number' && typeof b[propStr] === 'number') {
return a[propStr] - b[propStr]
return b[propStr] - a[propStr]
} else if(propStr in a && propStr in b && typeof a[propStr] === 'string' && typeof b[propStr] === 'string') {

@@ -67,5 +67,5 @@ const propA = a[propStr].toLowerCase()

if(propA < propB) {
if(propB < propA) {
propRes = -1
} else if(propA > propB) {
} else if(propB > propA) {
propRes = 1

@@ -76,6 +76,6 @@ }

})
} else if(sortStr === 'desc') {
} else {
newArray.sort((a, b) => {
if(propStr in a && propStr in b && typeof a[propStr] === 'number' && typeof b[propStr] === 'number') {
return b[propStr] - a[propStr]
return a[propStr] - b[propStr]
} else if(propStr in a && propStr in b && typeof a[propStr] === 'string' && typeof b[propStr] === 'string') {

@@ -86,5 +86,5 @@ const propA = a[propStr].toLowerCase()

if(propB < propA) {
if(propA < propB) {
propRes = -1
} else if(propB > propA) {
} else if(propA > propB) {
propRes = 1

@@ -91,0 +91,0 @@ }

@@ -1,76 +0,15 @@

const size = (bytes, decimalPoint) => {
if(bytes === 0) return '0 Bytes'
let k = 1000
let dm = decimalPoint || 1
let sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
let i = Math.floor(Math.log(bytes) / Math.log(k))
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i]
}
import {
size,
name,
type,
image,
date,
loadImage,
formatSize,
humanSize,
exported,
download,
printed
} from './fileLib.js'
const name = (val) => {
if(typeof val === 'string') {
if(val.indexOf('', 41) > 40) {
return val.slice(0, 41) +"..."
} else {
return val
}
}
}
const type = (val, type = 'type') => {
const arrFile = val.split('/')
if(type == 'format') {
arrFile.shift()
} else {
arrFile.pop()
}
return arrFile.join("")
}
const date = (val) => {
return new Date(val).toDateString()
}
const image = (image) => {
if('name' in image && typeof image.name === 'string') {
return URL.createObjectURL(image)
}
}
const loadImage = (image) => {
if('name' in image && typeof image.name === 'string') {
URL.revokeObjectURL(image)
}
}
/* Alternative */
const formatSize = (file) => {
let nBytes = 0, oFiles = file, nFiles = oFiles.length;
for (let nFileId = 0; nFileId < nFiles; nFileId++) {
nBytes += oFiles[nFileId].size;
}
let sOutput = nBytes + " bytes";
const aMultiples = ["KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
for (let nMultiple = 0, nApprox = nBytes / 1024; nApprox > 1; nApprox /= 1024, nMultiple++) {
sOutput = nApprox.toFixed(3) + " " + aMultiples[nMultiple] + " (" + nBytes + " bytes)";
}
return sOutput;
}
const humanSize = (bytes, si = false, dp = 1) => {
const thresh = si ? 1000 : 1024;
if (Math.abs(bytes) < thresh) {
return bytes + ' B';
}
const units = si ? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] : ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
let u = -1;
const r = 10**dp;
do {
bytes /= thresh;
++u;
} while (Math.round(Math.abs(bytes) * r) / r >= thresh && u < units.length - 1);
return bytes.toFixed(dp) + ' ' + units[u];
}
export default {

@@ -84,3 +23,6 @@ size,

formatSize,
humanSize
humanSize,
exported,
download,
printed
}

@@ -1,5 +0,9 @@

import { split } from './splitString.js'
import {
split,
capitalize
} from './stringLib.js'
export default {
split
split,
capitalize
}
{
"name": "alga-js",
"version": "0.0.1-alpha4",
"version": "0.0.1-alpha5",
"description": "Alga.js is a javascript helper and utility for any web font-end framework",

@@ -5,0 +5,0 @@ "module": "dist/alga.min.js",

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

<p align="center">
<a href="https://tedirghazali.gitbook.io/algajs/" target="_blank" rel="noopener noreferrer">
<img width="180" src="alga-js-logo.png" alt="Alga.js logo">
</a>
</p>
<br/>
# Alga.js (formerly pidie)
Alga.js is a javascript helper and utility for any front-end web framework
Alga.js is a javascript helper and utility for any front-end web framework, see [the demo here](https://tedirghazali.gitbook.io/algajs/)
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