Sass list functions

Sass list functions

وظائف القائمة تستخدم لاستدعاء القيم في القائمة، وتجميع القوائم وإضافة مشاريع إلى القائمة.

قائمة Sass غير قابلة للتغيير (لا يمكن تغييرها). لذلك، وظائف القائمة العائدة بالقائمة ستعود بقائمة جديدة وليس بتغيير القائمة الأصلية.

قائمة Sass تعتمد على 1. الموضع الأول في القائمة يقع في المرتبة 1، وليس 0.

فيما يلي قائمة بجميع وظائف القوائم في Sass:

وظيفة وصف و مثال
append(list, value, [separator])

إضافة قيمة واحدة إلى نهاية القائمة.
يمكن أن تكون علامة التباين auto،comma أو space. auto هي القيمة الافتراضية.

Example:

append((a b c), d)

نتائج: a b c d

append((a b c), (d), comma)

نتائج: a, b, c, d

index(list, value)

إرجاع موقع القيمة في القائمة.

Example:

index(a b c, b)

نتائج: 2

index(a b c, f)

نتائج: null

is-bracketed(list)

تحقق من وجود قوسين مربعين في القائمة.

Example:

is-bracketed([a b c])

نتائج: true

is-bracketed(a b c)

نتائج: false

join(list1, list2, [separator, bracketed])

تحديد list2 إضافة إلى list1 في نهاية
يمكن أن تكون علامة التباين auto،comma أو space.
auto هي القيمة الافتراضية (سيتم استخدام علامة التباين من القائمة الأولى).
bracketed يمكن أن تكون auto،true أو false. auto هي القيمة الافتراضية.

Example:

join(a b c, d e f)

نتائج: a b c d e f

join((a b c), (d e f), comma)

نتائج: a, b, c, d, e, f

join(a b c, d e f, $bracketed: true)

Result: [a b c d e f]

length(list)

Return the length of the list.

Example:

length(a b c)

Result: 3

list-separator(list)

Return the list separator used as a string. It can be space or comma.

Example:

list-separator(a b c)

Result: "space"

list-separator(a, b, c)

Result: "comma"

nth(list, n)

Return the n-th element of the list.

Example:

nth(a b c, 3)

Result: c

set-nth(list, n, value)

Set the n-th list element to the specified value.

Example:

set-nth(a b c, 2, x)

Result: a x c

zip(lists)

Combine lists into a single multidimensional list.

Example:

zip(1px 2px 3px, solid dashed dotted, red green blue)

Result: 1px solid red, 2px dashed green, 3px dotted blue