Socket
Socket
Sign inDemoInstall

js-awe

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-awe - npm Package Compare versions

Comparing version 1.0.36 to 1.0.37

dist/js-awe.min.js

17

package.json
{
"name": "js-awe",
"version": "1.0.36",
"version": "1.0.37",
"homepage": "https://github.com/josuamanuel/js-awe",

@@ -19,3 +19,4 @@ "author": "josuamanuel@hotmail.com",

"timeline",
"utils"
"utils",
"console.table"
],

@@ -27,9 +28,15 @@ "type": "module",

"test": "npm run testUT",
"testUT": "export CONFIG_ENV=Testing && export LOG_LEVEL=SILENT && mocha ./test/**/*.js"
"testUT": "export CONFIG_ENV=Testing && export LOG_LEVEL=SILENT && mocha ./test/**/*.js",
"build": "rollup -c"
},
"license": "MIT",
"devDependencies": {
"mocha": "^10.0.0"
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.2",
"rollup": "^3.26.2",
"rollup-plugin-node-polyfills": "^0.2.1"
},
"dependencies": {
"@rollup/plugin-commonjs": "^25.0.2",
"@types/node": "^18.6.1",

@@ -42,5 +49,5 @@ "fluture": "^14.0.0",

"loglevel": "^1.8.0",
"node-fetch": "^3.2.10",
"mocha": "^10.2.0",
"ramda": "^0.28.0"
}
}

@@ -21,4 +21,21 @@ # js-awe

A minified version soon to come...
Grab the minified version at:
<https://raw.githubusercontent.com/josuamanuel/js-awe/main/dist/js-awe.min.js>
Then copy it in your project and work with it in your html:
```html
...
<body>
<script type="module">
import { firstCapital} from './js-awe.min.js'
document.write(firstCapital("library is loaded correctly..."));
</script>
</body>
...
```
## New functional async style. Avoid await contamination

@@ -184,6 +201,4 @@

[chronoExample.js](https://github.com/josuamanuel/js-awe/blob/main/sandbox/Chrono/chronoExample.js)
Spread in your Async code some:
Spread around your async code some:
```Javascript

@@ -196,2 +211,4 @@ chrono.time('step1')

Full example: [chronoExample.js](https://github.com/josuamanuel/js-awe/blob/main/sandbox/Chrono/chronoExample.js)
```Plaintext

@@ -198,0 +215,0 @@ chronoCreation : 2023-05-25T20:58:17.175Z

@@ -7,4 +7,17 @@ import { arraySorter, pushUniqueKeyOrChange, sorterByPaths, pushUniqueKey, CustomError, pushAt } from './jsUtils.js';

import { Timeline } from './table/components/timeline.js'
import { performance } from 'node:perf_hooks'
let myGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof this !== 'undefined' ? this : {};
let performance = myGlobal?.performance
if(performance === undefined) {
try {
performance = (await import('perf_hooks')).performance
}catch(e){}
}
if(performance === undefined) performance = {}
// needed only for debuging

@@ -324,3 +337,9 @@ //import { RE } from './ramdaExt.js';

function timelineReport(data) {
function logTimeline(timeline) {
console.log('')
console.log('Timeline of events:')
console.log(timeline.draw())
}
function createTimeline(data) {
const timeline = Table(data)

@@ -331,7 +350,3 @@

console.log('')
console.log('Timeline of events:')
console.log(timeline.draw())
return data
return timeline
}

@@ -348,3 +363,4 @@

}))
timelineReport(toReport)
const toLog = createTimeline(toReport)
logTimeline(toLog)

@@ -354,2 +370,14 @@ return data

function timelineLines() {
let toReport = Object.entries(historyTimeIntervals).map(
([eventName, event]) => (
{
event: eventName,
ranges: event.ranges.map(
({ start, end }) => ({ start: Math.floor(start), end: Math.floor(end) })
)
}))
return createTimeline(toReport).draw()
}
function chronoReport() {

@@ -534,3 +562,3 @@ console.log('')

return {
time, timeEnd, report, setTime, setTimeEnd, logReport,
time, timeEnd, report, setTime, setTimeEnd, logReport, timelineLines,
getChronoState, setChronoStateUsingPerformanceAPIFormat, getChronoStateUsingPerformanceAPIFormat, average,

@@ -537,0 +565,0 @@ reset

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

import fetch from 'node-fetch'

@@ -10,2 +9,2 @@ async function fetchImproved(...args) {

export { fetch, fetchImproved }
export { fetchImproved }

@@ -526,3 +526,4 @@ 'use strict'

function project(paths, json) {
function project(paths, json, removeWithDelete=true) {
const toDelete = Symbol()
let copy

@@ -545,9 +546,34 @@ if (json === null || json === undefined ) return json

result.map((el) => el.path) // ?
result.forEach(({ pointer, value }) => {
let pendingToFilter= new Map()
result.forEach(({ pointer, value }, index) => {
const setAtPath = pointer.substring(1).split('/')
if (setAtPath.length === 1 && setAtPath[0] === '') copy = isInclude ? value : undefined
else setAt(copy, setAtPath, isInclude ? value : undefined)
if (setAtPath.length === 1 && setAtPath[0] === '') copy = isInclude ? clone(value) : undefined
else {
if(removeWithDelete === true && isInclude === false) {
const parentPath = setAtPath.slice(0,-1)
const parent = getAt(copy, parentPath)
if(Array.isArray(parent) === true) {
// Arrays are stored in a map to be reviewed later to filter out the items mark for deletion.
pendingToFilter.set(parentPath.join('/'), parent)
// mark element for deletion
setAt(copy, setAtPath, toDelete)
}else {
const fieldToDelete = setAtPath[setAtPath.length -1]
delete parent[fieldToDelete]
setAt(copy, parentPath, parent)
}
}else
setAt(copy, setAtPath, isInclude ? clone(value) : undefined)
}
})
pendingToFilter.forEach((parent, parentPath) => {
const compactingDeleteItems = parent.filter(el => el !== toDelete)
setAt(copy, parentPath.split('/'), compactingDeleteItems)
})
})

@@ -557,31 +583,33 @@

}
//{
// const users = [
// {
// name: 'Jose',
// age: 47,
// salary: 52000,
// posts: [
// { id: 1, message: 'test', likes: 2 },
// { id: 2, message: 'test1', likes: 2 },
// { id: 3, message: 'test2', likes: 2 },
// ],
// },
// {
// name: 'Luchi',
// age: 49,
// salary: 52000,
// posts: [
// { id: 1, message: 'testL', likes: 2 },
// { id: 2, message: 'testL1', likes: 2 },
// { id: 3, message: 'testL2', likes: 2 },
// ],
// },
// ]
// {
// const users = [
// {
// name: 'Jose',
// age: 47,
// salary: 52000,
// posts: [
// { id: 1, message: 'test', likes: 2 },
// { id: 2, message: 'test1', likes: 2 },
// { id: 3, message: 'test2', likes: 2 },
// ],
// },
// {
// name: 'Luchi',
// age: 49,
// salary: 52000,
// twoLevels: {a:3},
// posts: [
// { id: 1, message: 'testL', likes: 2 },
// { id: 2, message: 'testL1', likes: 2 },
// { id: 3, message: 'testL2', likes: 2 },
// ],
// },
// ]
// const pathToSelect = ['+$', '-$[*].age', '-$[*].salary', '-$[*].posts[:-1]'] //, '-$[*].age'];
// const pathToSelect = ['+$', '-$[*].age', '-$[*].twoLevels.a', '-$[*].posts[:-1]'] //, '-$[*].age'];
// project(pathToSelect, users) // ?
// project(['+$'], 2) //?
//}
// project(pathToSelect, users)
// project(['+$[*].posts[0,2]', '-$[*].posts[1]'], users)
// project(['+$'], 2) //?
// }

@@ -588,0 +616,0 @@

@@ -168,4 +168,7 @@ import { Text } from './components/text.js'

{
let myGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : typeof this !== 'undefined' ? this : {};
if (console.table) {
if(globalThis?.process?.argv0 === 'bun') console.log(Table(toLog).auto().draw())
if(myGlobal?.process?.argv0 === 'bun') console.log(Table(toLog).auto().draw())
else console.table(toLog)

@@ -172,0 +175,0 @@ }else console.log(toLog)

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

import fetch from "node-fetch";
declare function fetchImproved(...args: any[]): Promise<{

@@ -3,0 +3,0 @@ status: number;

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