@agile-ts/utils
Advanced tools
Comparing version 0.0.10 to 0.0.11
# @agile-ts/utils | ||
## 0.0.11 | ||
### Patch Changes | ||
- 36b235a: #### ❗️ Breaking Change | ||
```ts | ||
MY_STATE.persist('persistKey'); -> MY_STATE.persist({key: 'persistKey'}); | ||
``` | ||
#### :rocket: New Feature | ||
- `core` | ||
- [#214](https://github.com/agile-ts/agile/pull/214) add migration callback ([@bennodev19](https://github.com/bennodev19)) | ||
#### :nail_care: Polish | ||
- `logger` | ||
- [#210](https://github.com/agile-ts/agile/pull/210) Refactor logger ([@bennodev19](https://github.com/bennodev19)) | ||
- `api`, `core`, `event`, `logger`, `multieditor`, `proxytree`, `react`, `utils`, `vue` | ||
- [#209](https://github.com/agile-ts/agile/pull/209) Outsource react hooks ([@bennodev19](https://github.com/bennodev19)) | ||
#### Committers: 1 | ||
- BennoDev ([@bennodev19](https://github.com/bennodev19)) | ||
## 0.0.10 | ||
@@ -4,0 +30,0 @@ |
@@ -47,7 +47,4 @@ var __defProp = Object.defineProperty; | ||
} | ||
function normalizeArray(items, config = {}) { | ||
config = defineConfig(config, { | ||
createUndefinedArray: false | ||
}); | ||
if (items == null && !config.createUndefinedArray) | ||
function normalizeArray(items, createUndefinedArray = false) { | ||
if (items == null && !createUndefinedArray) | ||
return []; | ||
@@ -73,5 +70,3 @@ return Array.isArray(items) ? items : [items]; | ||
} | ||
function defineConfig(config, defaults, overwriteUndefinedProperties) { | ||
if (overwriteUndefinedProperties === void 0) | ||
overwriteUndefinedProperties = true; | ||
function defineConfig(config, defaults, overwriteUndefinedProperties = true) { | ||
const shallowCopiedConfig = __spreadValues({}, config); | ||
@@ -129,8 +124,3 @@ for (const defaultKey in defaults) { | ||
} | ||
function removeProperties(object, properties) { | ||
const copiedObject = copy(object); | ||
properties.map((property) => delete copiedObject[property]); | ||
return copiedObject; | ||
} | ||
export { clone, copy, createArrayFromObject, defineConfig, equal, flatMerge, generateId, includesArray, isAsyncFunction, isFunction, isJsonString, isValidObject, normalizeArray, notEqual, removeProperties }; | ||
export { clone, copy, createArrayFromObject, defineConfig, equal, flatMerge, generateId, includesArray, isAsyncFunction, isFunction, isJsonString, isValidObject, normalizeArray, notEqual }; |
@@ -31,7 +31,5 @@ /** | ||
* @param items - Item/s to be transformed into an array of Items. | ||
* @param config - Config | ||
* @param createUndefinedArray - Whether to return `[undefined]` instead of `[]` if the specified Item is `undefined`. | ||
*/ | ||
export declare function normalizeArray<DataType = any>(items?: DataType | Array<DataType>, config?: { | ||
createUndefinedArray?: boolean; | ||
}): Array<DataType>; | ||
export declare function normalizeArray<DataType = any>(items?: DataType | Array<DataType>, createUndefinedArray?: boolean): Array<DataType>; | ||
/** | ||
@@ -130,9 +128,1 @@ * Checks whether the specified function is a function. | ||
export declare function clone<T = any>(instance: T): T; | ||
/** | ||
* Removes specified properties from the defined object. | ||
* | ||
* @public | ||
* @param object - Object to remove the specified properties from. | ||
* @param properties - Property keys to be removed from the specified object. | ||
*/ | ||
export declare function removeProperties<T = Object>(object: T, properties: Array<string>): T; |
@@ -89,7 +89,4 @@ 'use strict'; | ||
function normalizeArray(items) { | ||
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
config = defineConfig(config, { | ||
createUndefinedArray: false | ||
}); | ||
if (items == null && !config.createUndefinedArray) return []; | ||
var createUndefinedArray = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
if (items == null && !createUndefinedArray) return []; | ||
return Array.isArray(items) ? items : [items]; | ||
@@ -115,4 +112,4 @@ } | ||
} | ||
function defineConfig(config, defaults, overwriteUndefinedProperties) { | ||
if (overwriteUndefinedProperties === undefined) overwriteUndefinedProperties = true; | ||
function defineConfig(config, defaults) { | ||
var overwriteUndefinedProperties = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; | ||
@@ -182,7 +179,2 @@ var shallowCopiedConfig = _objectSpread2({}, config); | ||
} | ||
function removeProperties(object, properties) { | ||
var copiedObject = copy(object); | ||
properties.map(property => delete copiedObject[property]); | ||
return copiedObject; | ||
} | ||
@@ -203,3 +195,2 @@ exports.clone = clone; | ||
exports.notEqual = notEqual; | ||
exports.removeProperties = removeProperties; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@agile-ts/utils", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"author": "BennoDev", | ||
@@ -33,7 +33,8 @@ "license": "MIT", | ||
"release": "yarn run prepare", | ||
"release:manual": "yarn run prepare && yarn run release && npm publish", | ||
"release:manual": "yarn run release && npm publish", | ||
"pack": "npm pack", | ||
"test": "jest", | ||
"test:coverage": "jest --coverage", | ||
"lint": "eslint src/**/*" | ||
"lint": "eslint src/**/*", | ||
"install:clean": "shx rm -rf dist && shx rm -rf node_modules && yarn install" | ||
}, | ||
@@ -40,0 +41,0 @@ "publishConfig": { |
@@ -7,2 +7,5 @@ # [INTERNAL] Utils | ||
<a href="https://agile-ts.org"> | ||
<img src="https://img.shields.io/badge/Status-Beta-green.svg" alt="Status"/> | ||
</a> | ||
<a href="https://github.com/agile-ts/agile"> | ||
@@ -9,0 +12,0 @@ <img src="https://img.shields.io/github/license/agile-ts/agile.svg?label=license&style=flat&colorA=293140&colorB=4a4872" alt="GitHub License"/></a> |
Sorry, the diff of this file is not supported yet
42
38137
410