to-assigned 1.1.4 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,31 +1,23 @@
1
- // # index.d.ts
1
+ declare const isObject: (v: unknown) => v is object;
2
2
  /**
3
3
  * ## Usage
4
- * Creates a new object, array, function, or special object with properties from the provided sources.
5
- * Prototype and type are determined by the first non-primitive source (see below):
6
- *
7
- * - The sources are never modified.
8
- * - Non-object arguments are ignored.
9
- * - If all sources are primitive, returns `{}`.
10
- * - If the first non-primitive source is:
11
- * - **Array**: result is an array, prototype same as source.
12
- * - **Function**: result is a function with same `name`, `length`, and prototype. (`caller`, `callee`, `arguments` not copied)
13
- * - **Map/Set/WeakMap/WeakSet/Date**: result is a new instance of the same type, initialized from the first source (only own enumerable properties are merged, not collection contents).
14
- * - **Other object**: result is a plain object with the same prototype as the source.
15
- *
4
+ * A pure function version of `Object.assign`.
5
+ * Use to merge objects like `toAssigned(obj1, obj2)`(obj1 is not changed).
6
+ * - Ignores variables that are not `object`.
16
7
  * - Only enumerable properties (including symbol keys) are copied from all sources.
17
8
  *
18
- * @returns A new object, array, function, or special object with merged properties and inherited prototype/type.
9
+ * @returns A new object.
19
10
  *
20
11
  * ## About
21
12
  * @package ToAssigned
22
13
  * @author KasukabeTsumugi <futami16237@gmail.com>
23
- * @version 1.1.3 (Last Update: 2025.08.15 01:31:39.237)
14
+ * @version 2.0.2 (Last Update: 2026.02.17 18:56:18.158)
24
15
  * @license MIT
25
- * @link git+https://github.com/baendlorel/to-assigned.git
16
+ * @link git+https://github.com/baendlorel/kt-packages.git
17
+ * @link https://baendlorel.github.io/ Welcome to my site!
26
18
  * @description Like Object.assign but will return a new object and ignores non-object arguments.
27
- * @copyright Copyright (c) 2025 KasukabeTsumugi. All rights reserved.
19
+ * @copyright Copyright (c) 2026 KasukabeTsumugi. All rights reserved.
28
20
  */
29
21
  declare function toAssigned(...sources: any[]): any;
30
22
 
31
- export { toAssigned };
23
+ export { isObject, toAssigned };
package/dist/index.mjs CHANGED
@@ -1 +1,7 @@
1
- const e=Reflect.ownKeys,t=Reflect.setPrototypeOf,n=Reflect.getPrototypeOf,o=Object.prototype.propertyIsEnumerable,c=Array.isArray,f=Reflect.defineProperty,r=e=>null!==e&&("object"==typeof e||"function"==typeof e);function a(e){const o=e.find(r);if(!o)return{};const a=n(o);let i;if(c(o))i=[];else if("function"==typeof o){let e;(e=>{try{return new new Proxy(e,{construct:()=>({})}),!1}catch{return!0}})(o)?e=(...e)=>o(...e):(e=function(...e){return o(...e)},e.bind=(e,...t)=>o.bind(e,...t)),f(e,"name",{value:o.name,configurable:!0}),f(e,"length",{value:o.length,configurable:!0}),i=e}else i=o instanceof Map?new Map(o.entries()):o instanceof Set?new Set(o.values()):o instanceof WeakMap?new WeakMap:o instanceof WeakSet?new WeakSet:o instanceof Date?new Date(o.getTime()):{};return t(i,a),i}function i(...t){if(0===t.length)return{};const n=a(t);for(let c=0;c<t.length;c++){const f=t[c];if(f&&"object"==typeof f)for(const t of e(f))o.call(f,t)&&(n[t]=f[t])}return n}Reflect.set(i,Symbol("version"),"__VERSION__");export{i as toAssigned};
1
+ const t = Object.assign, e = t => null !== t && "object" == typeof t;
2
+
3
+ function n(...n) {
4
+ return 0 === (n = n.filter(e)).length ? {} : t({}, ...n);
5
+ }
6
+
7
+ export { e as isObject, n as toAssigned };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "to-assigned",
3
- "version": "1.1.4",
3
+ "version": "2.0.2",
4
4
  "author": {
5
5
  "name": "KasukabeTsumugi",
6
6
  "email": "futami16237@gmail.com"
@@ -22,10 +22,10 @@
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
25
- "url": "git+https://github.com/baendlorel/to-assigned.git"
25
+ "url": "git+https://github.com/baendlorel/kt-packages.git",
26
+ "directory": "packages/to-assigned"
26
27
  },
27
28
  "keywords": [
28
- "array",
29
29
  "concat",
30
30
  "utility",
31
31
  "javascript",
@@ -33,29 +33,8 @@
33
33
  ],
34
34
  "license": "MIT",
35
35
  "bugs": {
36
- "url": "https://github.com/baendlorel/to-assigned/issues"
36
+ "url": "https://github.com/baendlorel/kt-packages/issues"
37
37
  },
38
- "homepage": "https://github.com/baendlorel/to-assigned#readme",
39
- "devDependencies": {
40
- "@babel/plugin-proposal-decorators": "^7.28.0",
41
- "@babel/preset-env": "^7.28.0",
42
- "@eslint/js": "^9.30.0",
43
- "@rollup/plugin-alias": "^5.1.1",
44
- "@rollup/plugin-babel": "^6.0.4",
45
- "@rollup/plugin-commonjs": "^28.0.6",
46
- "@rollup/plugin-node-resolve": "^16.0.1",
47
- "@rollup/plugin-replace": "^6.0.2",
48
- "@rollup/plugin-terser": "^0.4.4",
49
- "@rollup/plugin-typescript": "^12.1.3",
50
- "@types/node": "^24.0.4",
51
- "eslint": "^9.30.0",
52
- "prettier": "^3.6.2",
53
- "rimraf": "^6.0.1",
54
- "rollup": "^4.44.1",
55
- "rollup-plugin-dts": "^6.2.1",
56
- "tslib": "^2.8.1",
57
- "typescript": "^5.8.3",
58
- "typescript-eslint": "^8.38.0",
59
- "vitest": "^3.2.4"
60
- }
61
- }
38
+ "homepage": "https://github.com/baendlorel/kt-packages/tree/main/packages/to-assigned#readme",
39
+ "devDependencies": {}
40
+ }