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

php-imports

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

php-imports - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

lib/print/types.d.ts

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

export declare type PrintOrder = 'emptyLine' | 'singleUses.all' | 'singleUses.class' | 'singleUses.function' | 'singleUses.const' | 'groupedUses.all' | 'groupedUses.class' | 'groupedUses.function' | 'groupedUses.const';
export declare type PrintOrder = 'emptyLine' | 'all.all' | 'all.class' | 'all.function' | 'all.const' | 'singleUses.all' | 'singleUses.class' | 'singleUses.function' | 'singleUses.const' | 'groupedUses.all' | 'groupedUses.class' | 'groupedUses.function' | 'groupedUses.const';
export declare type PrintConfig = {

@@ -3,0 +3,0 @@ indent: string;

@@ -8,3 +8,3 @@ {

"license": "MIT",
"version": "0.1.0",
"version": "0.1.1",
"description": "JavaScript library for formatting PHP imports",

@@ -11,0 +11,0 @@ "homepage": "https://github.com/Tarik02/js-php-imports#readme",

@@ -9,5 +9,11 @@ import { GroupUse, GroupedUses, SingleUse } from '../group'

order: [
'singleUses.all',
'singleUses.class',
'emptyLine',
'groupedUses.all',
'singleUses.function',
'singleUses.const',
'emptyLine',
'groupedUses.class',
'emptyLine',
'groupedUses.function',
'groupedUses.const',
],

@@ -37,10 +43,75 @@ }

const parts = []
const printUse = (use: SingleUse | GroupUse): string => (
use.type === 'single'
? printSingleUse(use)
: printGroupUse(use)
)
let parts = []
for (const item of order) {
switch (item) {
case 'emptyLine':
parts.push('')
parts.push('emptyLine')
break
case 'all.all':
parts.push(
grouped.items
.map(it => printUse(it))
.join('\n'),
)
break
case 'all.class':
parts.push(
grouped.items
.filter(it => it.modifier === null)
.map(it => it.type === 'single'
? it
: ({
...it,
items: it.items.filter(item => item.modifier === null),
}),
)
.filter(it => it.type === 'single' || it.items.length !== 0)
.map(it => printUse(it))
.join('\n'),
)
break
case 'all.function':
parts.push(
grouped.items
.filter(it => it.modifier === null || it.modifier === 'function')
.map(it => it.type === 'single' || it.modifier === 'function'
? it
: ({
...it,
items: it.items.filter(item => item.modifier === 'function'),
}),
)
.filter(it => it.type === 'single' || it.items.length !== 0)
.map(it => printUse(it))
.join('\n'),
)
break
case 'all.const':
parts.push(
grouped.items
.filter(it => it.modifier === null || it.modifier === 'const')
.map(it => it.type === 'single' || it.modifier === 'const'
? it
: ({
...it,
items: it.items.filter(item => item.modifier === 'const'),
}),
)
.filter(it => it.type === 'single' || it.items.length !== 0)
.map(it => printUse(it))
.join('\n'),
)
break
case 'singleUses.all':

@@ -145,2 +216,6 @@ parts.push(

parts = parts
.filter(it => it.length > 0)
.map(it => it === 'emptyLine' ? '' : it)
const resultParts = []

@@ -147,0 +222,0 @@

export type PrintOrder =
| 'emptyLine'
| 'all.all'
| 'all.class'
| 'all.function'
| 'all.const'
| 'singleUses.all'

@@ -4,0 +8,0 @@ | 'singleUses.class'

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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