move some utils

master
Brad Cornes 2020-05-03 17:10:38 +01:00
parent 39733ae72a
commit 6af6797f2c
7 changed files with 13 additions and 6 deletions

View File

@ -15,7 +15,7 @@ import { isCssContext } from '../util/css'
import { findLast, findJsxStrings, arrFindLast } from '../util/find' import { findLast, findJsxStrings, arrFindLast } from '../util/find'
import { stringifyConfigValue, stringifyCss } from '../util/stringify' import { stringifyConfigValue, stringifyCss } from '../util/stringify'
import { stringifyScreen, Screen } from '../util/screens' import { stringifyScreen, Screen } from '../util/screens'
import isObject from '../util/isObject' import isObject from '../../util/isObject'
import * as emmetHelper from 'vscode-emmet-helper-bundled' import * as emmetHelper from 'vscode-emmet-helper-bundled'
import { isValidLocationForEmmetAbbreviation } from '../util/isValidLocationForEmmetAbbreviation' import { isValidLocationForEmmetAbbreviation } from '../util/isValidLocationForEmmetAbbreviation'
import { getDocumentSettings } from '../util/getDocumentSettings' import { getDocumentSettings } from '../util/getDocumentSettings'
@ -23,7 +23,7 @@ import { isJsContext } from '../util/js'
import { naturalExpand } from '../util/naturalExpand' import { naturalExpand } from '../util/naturalExpand'
import semver from 'semver' import semver from 'semver'
import { docsUrl } from '../util/docsUrl' import { docsUrl } from '../util/docsUrl'
import { ensureArray } from '../util/array' import { ensureArray } from '../../util/array'
function completionsFromClassList( function completionsFromClassList(
state: State, state: State,

View File

@ -2,7 +2,7 @@ const dlv = require('dlv')
import { State } from './state' import { State } from './state'
import removeMeta from './removeMeta' import removeMeta from './removeMeta'
import { TinyColor } from '@ctrl/tinycolor' import { TinyColor } from '@ctrl/tinycolor'
import { ensureArray, dedupe, flatten } from './array' import { ensureArray, dedupe, flatten } from '../../util/array'
const COLOR_PROPS = [ const COLOR_PROPS = [
'caret-color', 'caret-color',

View File

@ -1,4 +1,4 @@
import isObject from './isObject' import isObject from '../../util/isObject'
export default function removeMeta(obj: any): any { export default function removeMeta(obj: any): any {
let result = {} let result = {}

View File

@ -1,4 +1,4 @@
import isObject from './isObject' import isObject from '../../util/isObject'
export type MinMaxScreen = { export type MinMaxScreen = {
min?: string min?: string

View File

@ -1,7 +1,7 @@
import removeMeta from './removeMeta' import removeMeta from './removeMeta'
const dlv = require('dlv') const dlv = require('dlv')
import escapeClassName from 'css.escape' import escapeClassName from 'css.escape'
import { ensureArray } from './array' import { ensureArray } from '../../util/array'
export function stringifyConfigValue(x: any): string { export function stringifyConfigValue(x: any): string {
if (typeof x === 'string') return x if (typeof x === 'string') return x

View File

@ -9,3 +9,10 @@ export function ensureArray<T>(value: T | T[]): T[] {
export function flatten<T>(arrays: T[][]): T[] { export function flatten<T>(arrays: T[][]): T[] {
return [].concat.apply([], arrays) return [].concat.apply([], arrays)
} }
export function equal(arr1: any[], arr2: any[]): boolean {
return (
JSON.stringify(arr1.concat([]).sort()) ===
JSON.stringify(arr2.concat([]).sort())
)
}