|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
806 bytes
|
| Line | |
|---|
| 1 | import {color} from "d3-color";
|
|---|
| 2 | import rgb from "./rgb.js";
|
|---|
| 3 | import {genericArray} from "./array.js";
|
|---|
| 4 | import date from "./date.js";
|
|---|
| 5 | import number from "./number.js";
|
|---|
| 6 | import object from "./object.js";
|
|---|
| 7 | import string from "./string.js";
|
|---|
| 8 | import constant from "./constant.js";
|
|---|
| 9 | import numberArray, {isNumberArray} from "./numberArray.js";
|
|---|
| 10 |
|
|---|
| 11 | export default function(a, b) {
|
|---|
| 12 | var t = typeof b, c;
|
|---|
| 13 | return b == null || t === "boolean" ? constant(b)
|
|---|
| 14 | : (t === "number" ? number
|
|---|
| 15 | : t === "string" ? ((c = color(b)) ? (b = c, rgb) : string)
|
|---|
| 16 | : b instanceof color ? rgb
|
|---|
| 17 | : b instanceof Date ? date
|
|---|
| 18 | : isNumberArray(b) ? numberArray
|
|---|
| 19 | : Array.isArray(b) ? genericArray
|
|---|
| 20 | : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
|
|---|
| 21 | : number)(a, b);
|
|---|
| 22 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.